EZQMS-529: Added support for primary/positive/negative kinds for CheckBox and RadioButton ()

Signed-off-by: Petr Vyazovetskiy <develop.pit@gmail.com>
This commit is contained in:
Pete Anøther 2024-01-19 10:43:24 -03:00 committed by GitHub
parent 5c3ae84c54
commit b4d898be5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 53 additions and 25 deletions
packages

View File

@ -69,7 +69,7 @@
&__navHeader { &__navHeader {
flex-direction: column; flex-direction: column;
flex-shrink: 0; flex-shrink: 0;
&.divide { &.divide {
border-bottom: 1px solid var(--theme-navpanel-divider); border-bottom: 1px solid var(--theme-navpanel-divider);
} }
@ -171,11 +171,11 @@
.hulyModal-container { .hulyModal-container {
height: 100%; height: 100%;
border-top: 1px solid transparent; border-top: 1px solid transparent;
.hulyModal-content { .hulyModal-content {
padding: var(--spacing-2) var(--spacing-1_5); padding: var(--spacing-2) var(--spacing-1_5);
height: 100%; height: 100%;
&__titleGroup { &__titleGroup {
flex-shrink: 0; flex-shrink: 0;
padding: var(--spacing-2) var(--spacing-0_5) 0; padding: var(--spacing-2) var(--spacing-0_5) 0;
@ -186,7 +186,7 @@
} }
&__settingsSet { &__settingsSet {
flex-shrink: 0; flex-shrink: 0;
&:not(.table) { &:not(.table) {
padding: var(--spacing-4) var(--spacing-2_5) 0; padding: var(--spacing-4) var(--spacing-2_5) 0;
} }
@ -203,7 +203,7 @@
min-width: 0; min-width: 0;
min-height: var(--global-max-Size); min-height: var(--global-max-Size);
border-bottom: 1px solid var(--global-subtle-ui-BorderColor); border-bottom: 1px solid var(--global-subtle-ui-BorderColor);
&:first-child { &:first-child {
border-top: 1px solid var(--global-subtle-ui-BorderColor); border-top: 1px solid var(--global-subtle-ui-BorderColor);
} }
@ -672,14 +672,14 @@
&:active { &:active {
.marker { .marker {
background-color: var(--primary-button-pressed); background-color: var(--primary-button-pressed);
} }
} }
.marker::after { .marker::after {
opacity: 1; opacity: 1;
} }
} }
label { label {
color: var(--theme-caption-color); color: var(--theme-caption-color);
} }
@ -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 */

View File

@ -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 { & {
background-color: var(--theme-checkbox-bg-color); &.checked {
background-color: var(--theme-checkbox-bg-color);
}
} }
&.primary.checked { &.readonly {
background-color: var(--primary-button-default);
border-color: transparent;
}
&.positive.checked {
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 {

View File

@ -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()