@r2digisolutions/components 0.21.10 → 0.21.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atoms/SelectionBox/SelectionBox.svelte +4 -2
- package/dist/components/atoms/SelectionBox/SelectionBox.svelte.d.ts +1 -1
- package/dist/components/molecules/MultiSelect/MultiSelect.svelte +4 -6
- package/dist/components/molecules/Select/Select.svelte +8 -6
- package/dist/components/molecules/SelectCard/SelectCard.svelte +14 -6
- package/dist/components/molecules/SelectCard/SelectCard.svelte.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
export type SelectionBoxSize = 'sm' | 'md' | 'lg';
|
|
3
|
-
export type SelectionBoxTone = 'brand' | 'primary' | 'success';
|
|
3
|
+
export type SelectionBoxTone = 'brand' | 'primary' | 'success' | 'neutral';
|
|
4
4
|
export type SelectionBoxRadius = 'sm' | 'md' | 'none';
|
|
5
5
|
|
|
6
6
|
interface SelectionBoxProps {
|
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
primary:
|
|
62
62
|
'checked:bg-primary checked:border-primary indeterminate:bg-primary indeterminate:border-primary hover:border-primary/60 focus-visible:ring-primary',
|
|
63
63
|
success:
|
|
64
|
-
'checked:bg-green-500 checked:border-green-500 indeterminate:bg-green-500 indeterminate:border-green-500 hover:border-green-400 focus-visible:ring-green-500'
|
|
64
|
+
'checked:bg-green-500 checked:border-green-500 indeterminate:bg-green-500 indeterminate:border-green-500 hover:border-green-400 focus-visible:ring-green-500',
|
|
65
|
+
neutral:
|
|
66
|
+
'checked:bg-neutral-800 checked:border-neutral-800 indeterminate:bg-neutral-800 indeterminate:border-neutral-800 hover:border-neutral-500 focus-visible:ring-neutral-500 dark:checked:bg-neutral-200 dark:checked:border-neutral-200 dark:indeterminate:bg-neutral-200 dark:indeterminate:border-neutral-200 dark:hover:border-neutral-400 dark:focus-visible:ring-neutral-400'
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
function handleChange(e: Event) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type SelectionBoxSize = 'sm' | 'md' | 'lg';
|
|
2
|
-
export type SelectionBoxTone = 'brand' | 'primary' | 'success';
|
|
2
|
+
export type SelectionBoxTone = 'brand' | 'primary' | 'success' | 'neutral';
|
|
3
3
|
export type SelectionBoxRadius = 'sm' | 'md' | 'none';
|
|
4
4
|
interface SelectionBoxProps {
|
|
5
5
|
checked?: boolean;
|
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
!option.disabled &&
|
|
369
369
|
!blocked &&
|
|
370
370
|
(highlighted === index || isSelected
|
|
371
|
-
? 'bg-
|
|
371
|
+
? 'bg-neutral-800 text-white dark:bg-neutral-200 dark:text-neutral-900'
|
|
372
372
|
: 'text-primary hover:bg-surface-overlay')
|
|
373
373
|
]}
|
|
374
374
|
>
|
|
@@ -376,18 +376,16 @@
|
|
|
376
376
|
class={[
|
|
377
377
|
'flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors',
|
|
378
378
|
isSelected
|
|
379
|
-
?
|
|
380
|
-
? 'border-white bg-white'
|
|
381
|
-
: 'border-brand-500 bg-brand-500'
|
|
379
|
+
? 'border-white bg-white dark:border-neutral-900 dark:bg-neutral-900'
|
|
382
380
|
: highlighted === index
|
|
383
|
-
? 'border-white/60'
|
|
381
|
+
? 'border-white/60 dark:border-neutral-900/50'
|
|
384
382
|
: 'border-border-strong'
|
|
385
383
|
]}
|
|
386
384
|
aria-hidden="true"
|
|
387
385
|
>
|
|
388
386
|
{#if isSelected}
|
|
389
387
|
<svg
|
|
390
|
-
class="h-2.5 w-2.5 text-
|
|
388
|
+
class="h-2.5 w-2.5 text-neutral-800 dark:text-neutral-100"
|
|
391
389
|
viewBox="0 0 24 24"
|
|
392
390
|
fill="none"
|
|
393
391
|
stroke="currentColor"
|
|
@@ -642,9 +642,9 @@
|
|
|
642
642
|
'transition-[background-color,color,box-shadow] duration-75',
|
|
643
643
|
option.disabled ? 'cursor-not-allowed opacity-40' : 'cursor-pointer',
|
|
644
644
|
isHighlighted && !option.disabled
|
|
645
|
-
? 'bg-
|
|
645
|
+
? 'bg-neutral-800 text-white shadow-sm dark:bg-neutral-200 dark:text-neutral-900'
|
|
646
646
|
: isSelected && !option.disabled
|
|
647
|
-
? 'bg-
|
|
647
|
+
? 'bg-neutral-100 font-medium text-primary dark:bg-neutral-800/70'
|
|
648
648
|
: 'text-primary hover:bg-surface-overlay'
|
|
649
649
|
]}
|
|
650
650
|
>
|
|
@@ -654,10 +654,10 @@
|
|
|
654
654
|
'h-4 w-4 flex shrink-0 items-center justify-center rounded-full border transition-colors duration-75',
|
|
655
655
|
isHighlighted && !option.disabled
|
|
656
656
|
? isSelected
|
|
657
|
-
? 'border-white bg-white'
|
|
658
|
-
: 'border-white/60 bg-transparent'
|
|
657
|
+
? 'border-white bg-white dark:border-neutral-900 dark:bg-neutral-900'
|
|
658
|
+
: 'border-white/60 bg-transparent dark:border-neutral-900/50'
|
|
659
659
|
: isSelected && !option.disabled
|
|
660
|
-
? 'border-
|
|
660
|
+
? 'border-neutral-800 bg-neutral-800 dark:border-neutral-200 dark:bg-neutral-200'
|
|
661
661
|
: 'border-border-strong bg-transparent'
|
|
662
662
|
]}
|
|
663
663
|
aria-hidden="true"
|
|
@@ -666,7 +666,9 @@
|
|
|
666
666
|
<svg
|
|
667
667
|
class={[
|
|
668
668
|
'h-2.5 w-2.5',
|
|
669
|
-
isHighlighted
|
|
669
|
+
isHighlighted
|
|
670
|
+
? 'text-neutral-800 dark:text-neutral-100'
|
|
671
|
+
: 'text-white dark:text-neutral-900'
|
|
670
672
|
]}
|
|
671
673
|
viewBox="0 0 24 24"
|
|
672
674
|
fill="none"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
layout?: SelectCardLayout;
|
|
20
20
|
/** box = SelectionBox · badge = check pill · none = border only */
|
|
21
21
|
check?: SelectCardCheck;
|
|
22
|
-
/** Accent when selected (default
|
|
22
|
+
/** Accent when selected (default neutral — works with data-theme="neutral") */
|
|
23
23
|
tone?: SelectCardTone;
|
|
24
24
|
class?: string;
|
|
25
25
|
leading?: Snippet;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
disabled = false,
|
|
40
40
|
layout = 'media',
|
|
41
41
|
check = 'box',
|
|
42
|
-
tone = '
|
|
42
|
+
tone = 'neutral',
|
|
43
43
|
class: className = '',
|
|
44
44
|
leading,
|
|
45
45
|
children,
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
|
|
51
51
|
const selectedTone: Record<SelectCardTone, string> = {
|
|
52
52
|
brand: 'border-brand-500 bg-brand-50/50 ring-2 ring-brand-500/20 dark:bg-brand-950/30',
|
|
53
|
-
neutral:
|
|
53
|
+
neutral:
|
|
54
|
+
'border-neutral-400 bg-neutral-100/80 ring-2 ring-neutral-400/25 dark:border-neutral-500 dark:bg-neutral-800/60 dark:ring-neutral-500/30',
|
|
54
55
|
success:
|
|
55
56
|
'border-emerald-500 bg-emerald-50/70 ring-2 ring-emerald-500/20 dark:border-emerald-400 dark:bg-emerald-950/35',
|
|
56
57
|
error: 'border-red-500 bg-red-50/70 ring-2 ring-red-500/20 dark:border-red-400 dark:bg-red-950/35',
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
|
|
62
63
|
const hoverTone: Record<SelectCardTone, string> = {
|
|
63
64
|
brand: 'hover:border-brand-300 dark:hover:border-brand-700',
|
|
64
|
-
neutral: 'hover:border-border-
|
|
65
|
+
neutral: 'hover:border-neutral-400 dark:hover:border-neutral-500',
|
|
65
66
|
success: 'hover:border-emerald-300 dark:hover:border-emerald-700',
|
|
66
67
|
error: 'hover:border-red-300 dark:hover:border-red-700',
|
|
67
68
|
warning: 'hover:border-amber-300 dark:hover:border-amber-700',
|
|
@@ -70,7 +71,8 @@
|
|
|
70
71
|
|
|
71
72
|
const badgeTone: Record<SelectCardTone, string> = {
|
|
72
73
|
brand: 'border-brand-500 bg-brand-500 text-white',
|
|
73
|
-
neutral:
|
|
74
|
+
neutral:
|
|
75
|
+
'border-neutral-700 bg-neutral-800 text-white dark:border-neutral-300 dark:bg-neutral-200 dark:text-neutral-900',
|
|
74
76
|
success: 'border-emerald-500 bg-emerald-500 text-white',
|
|
75
77
|
error: 'border-red-500 bg-red-500 text-white',
|
|
76
78
|
warning: 'border-amber-500 bg-amber-500 text-white',
|
|
@@ -79,13 +81,17 @@
|
|
|
79
81
|
|
|
80
82
|
const focusTone: Record<SelectCardTone, string> = {
|
|
81
83
|
brand: 'focus-visible:ring-brand-500/30',
|
|
82
|
-
neutral: 'focus-visible:ring-
|
|
84
|
+
neutral: 'focus-visible:ring-neutral-400/40 dark:focus-visible:ring-neutral-500/40',
|
|
83
85
|
success: 'focus-visible:ring-emerald-500/30',
|
|
84
86
|
error: 'focus-visible:ring-red-500/30',
|
|
85
87
|
warning: 'focus-visible:ring-amber-500/30',
|
|
86
88
|
info: 'focus-visible:ring-sky-500/30'
|
|
87
89
|
};
|
|
88
90
|
|
|
91
|
+
const selectionBoxTone = $derived(
|
|
92
|
+
tone === 'brand' ? 'brand' : tone === 'success' ? 'success' : 'neutral'
|
|
93
|
+
);
|
|
94
|
+
|
|
89
95
|
const rootClass = $derived(
|
|
90
96
|
[
|
|
91
97
|
'group relative w-full text-left transition-all',
|
|
@@ -170,6 +176,7 @@
|
|
|
170
176
|
<SelectionBox
|
|
171
177
|
checked={selected}
|
|
172
178
|
size="sm"
|
|
179
|
+
tone={selectionBoxTone}
|
|
173
180
|
{disabled}
|
|
174
181
|
label={title ? `Select ${title}` : 'Select'}
|
|
175
182
|
onchange={handleCheck}
|
|
@@ -202,6 +209,7 @@
|
|
|
202
209
|
<SelectionBox
|
|
203
210
|
checked={selected}
|
|
204
211
|
size="md"
|
|
212
|
+
tone={selectionBoxTone}
|
|
205
213
|
{disabled}
|
|
206
214
|
label={title ? `Select ${title}` : 'Select'}
|
|
207
215
|
onchange={handleCheck}
|
|
@@ -14,7 +14,7 @@ interface SelectCardProps {
|
|
|
14
14
|
layout?: SelectCardLayout;
|
|
15
15
|
/** box = SelectionBox · badge = check pill · none = border only */
|
|
16
16
|
check?: SelectCardCheck;
|
|
17
|
-
/** Accent when selected (default
|
|
17
|
+
/** Accent when selected (default neutral — works with data-theme="neutral") */
|
|
18
18
|
tone?: SelectCardTone;
|
|
19
19
|
class?: string;
|
|
20
20
|
leading?: Snippet;
|