mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 00:10:37 +00:00
EZQMS-529: Added support for primary/positive/negative kinds for CheckBox and RadioButton (#4384)
Signed-off-by: Petr Vyazovetskiy <develop.pit@gmail.com>
This commit is contained in:
parent
5c3ae84c54
commit
b4d898be5b
@ -726,6 +726,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.kind-primary .marker {
|
||||||
|
border-color: var(--primary-button-default);
|
||||||
|
}
|
||||||
|
&.kind-positive .marker {
|
||||||
|
border-color: var(--positive-button-default);
|
||||||
|
}
|
||||||
|
&.kind-negative .marker {
|
||||||
|
border-color: var(--negative-button-default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* StatesBar */
|
/* StatesBar */
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
export let symbol: 'check' | 'minus' = 'check'
|
export let symbol: 'check' | 'minus' = 'check'
|
||||||
export let size: 'small' | 'medium' | 'large' = 'small'
|
export let size: 'small' | 'medium' | 'large' = 'small'
|
||||||
export let circle: boolean = false
|
export let circle: boolean = false
|
||||||
export let kind: 'default' | 'primary' | 'positive' = 'default'
|
export let kind: 'default' | 'primary' | 'positive' | 'negative' = 'default'
|
||||||
export let readonly = false
|
export let readonly = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let oldChecked = checked
|
let oldChecked = checked
|
||||||
|
|
||||||
const handleValueChanged = (event: Event) => {
|
const handleValueChanged = (event: Event): void => {
|
||||||
if (readonly) {
|
if (readonly) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -47,6 +47,7 @@
|
|||||||
class:circle
|
class:circle
|
||||||
class:primary={kind === 'primary'}
|
class:primary={kind === 'primary'}
|
||||||
class:positive={kind === 'positive'}
|
class:positive={kind === 'positive'}
|
||||||
|
class:negative={kind === 'negative'}
|
||||||
class:readonly
|
class:readonly
|
||||||
class:checked
|
class:checked
|
||||||
on:click|stopPropagation
|
on:click|stopPropagation
|
||||||
@ -59,6 +60,7 @@
|
|||||||
class="check"
|
class="check"
|
||||||
class:primary={kind === 'primary'}
|
class:primary={kind === 'primary'}
|
||||||
class:positive={kind === 'positive'}
|
class:positive={kind === 'positive'}
|
||||||
|
class:negative={kind === 'negative'}
|
||||||
x="4"
|
x="4"
|
||||||
y="7.4"
|
y="7.4"
|
||||||
width="8"
|
width="8"
|
||||||
@ -69,6 +71,7 @@
|
|||||||
class="check"
|
class="check"
|
||||||
class:primary={kind === 'primary'}
|
class:primary={kind === 'primary'}
|
||||||
class:positive={kind === 'positive'}
|
class:positive={kind === 'positive'}
|
||||||
|
class:negative={kind === 'negative'}
|
||||||
points="7.3,11.5 4,8.3 5,7.4 7.3,9.7 11.8,5.1 12.7,6.1 "
|
points="7.3,11.5 4,8.3 5,7.4 7.3,9.7 11.8,5.1 12.7,6.1 "
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
@ -103,20 +106,32 @@
|
|||||||
height: 1rem;
|
height: 1rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
& {
|
||||||
&.checked {
|
&.checked {
|
||||||
background-color: var(--theme-checkbox-bg-color);
|
background-color: var(--theme-checkbox-bg-color);
|
||||||
}
|
}
|
||||||
&.primary.checked {
|
|
||||||
background-color: var(--primary-button-default);
|
|
||||||
border-color: transparent;
|
|
||||||
}
|
}
|
||||||
&.positive.checked {
|
&.readonly {
|
||||||
background-color: var(--positive-button-default);
|
|
||||||
border-color: transparent;
|
|
||||||
}
|
|
||||||
&.readonly.checked {
|
|
||||||
background-color: var(--theme-checkbox-disabled);
|
background-color: var(--theme-checkbox-disabled);
|
||||||
}
|
}
|
||||||
|
&.primary {
|
||||||
|
border-color: var(--primary-button-default);
|
||||||
|
&:not(.readonly).checked {
|
||||||
|
background-color: var(--primary-button-default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.positive {
|
||||||
|
border-color: var(--positive-button-default);
|
||||||
|
&:not(.readonly).checked {
|
||||||
|
background-color: var(--positive-button-default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.negative {
|
||||||
|
border-color: var(--negative-button-default);
|
||||||
|
&:not(.readonly).checked {
|
||||||
|
background-color: var(--negative-button-default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.chBox {
|
.chBox {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -132,10 +147,10 @@
|
|||||||
& .check {
|
& .check {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
fill: var(--theme-checkbox-color);
|
fill: var(--theme-checkbox-color);
|
||||||
&.primary {
|
|
||||||
fill: var(--primary-button-color);
|
&.primary,
|
||||||
}
|
&.positive,
|
||||||
&.positive {
|
&.negative {
|
||||||
fill: var(--primary-button-color);
|
fill: var(--primary-button-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +159,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
&:disabled + .checkSVG .check {
|
&:disabled + .checkSVG .check {
|
||||||
fill: var(--theme-checkbox-disabled);
|
fill: var(--primary-button-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.checkSVG {
|
.checkSVG {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
export let action: () => void = () => {}
|
export let action: () => void = () => {}
|
||||||
export let gap: 'large' | 'small' | 'medium' | 'none' = 'none'
|
export let gap: 'large' | 'small' | 'medium' | 'none' = 'none'
|
||||||
export let labelGap: 'large' | 'medium' = 'medium'
|
export let labelGap: 'large' | 'medium' = 'medium'
|
||||||
|
export let kind: 'primary' | 'positive' | 'negative' | 'default' = 'default'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
@ -37,6 +38,9 @@
|
|||||||
class="antiRadio gap-{gap}"
|
class="antiRadio gap-{gap}"
|
||||||
class:disabled
|
class:disabled
|
||||||
class:checked={group === value}
|
class:checked={group === value}
|
||||||
|
class:kind-primary={kind === 'primary'}
|
||||||
|
class:kind-positive={kind === 'positive'}
|
||||||
|
class:kind-negative={kind === 'negative'}
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!disabled && group !== value) action()
|
if (!disabled && group !== value) action()
|
||||||
|
Loading…
Reference in New Issue
Block a user