@urbicon-ui/blocks 6.21.1 → 6.21.3
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/NumberInput/NumberInput.svelte +197 -0
- package/dist/components/NumberInput/NumberInput.svelte.d.ts +4 -0
- package/dist/components/NumberInput/index.d.ts +55 -0
- package/dist/components/NumberInput/index.js +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/primitives/Avatar/avatar.variants.d.ts +6 -6
- package/dist/primitives/Badge/Badge.svelte +18 -8
- package/dist/primitives/Badge/index.d.ts +26 -6
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +11 -6
- package/dist/primitives/Breadcrumb/index.d.ts +2 -2
- package/dist/primitives/Button/button.variants.d.ts +4 -4
- package/dist/primitives/ButtonGroup/index.d.ts +1 -1
- package/dist/primitives/Card/card.variants.d.ts +5 -5
- package/dist/primitives/Checkbox/Checkbox.svelte +3 -3
- package/dist/primitives/Combobox/Combobox.svelte +478 -104
- package/dist/primitives/Combobox/combobox.variants.d.ts +89 -17
- package/dist/primitives/Combobox/combobox.variants.js +94 -13
- package/dist/primitives/Combobox/index.d.ts +166 -51
- package/dist/primitives/ConfirmDialog/index.d.ts +19 -0
- package/dist/primitives/Dialog/Dialog.svelte +74 -0
- package/dist/primitives/Dialog/dialog.variants.d.ts +9 -9
- package/dist/primitives/Dialog/index.d.ts +12 -1
- package/dist/primitives/Drawer/Drawer.svelte +2 -1
- package/dist/primitives/Drawer/drawer.variants.d.ts +8 -0
- package/dist/primitives/Drawer/drawer.variants.js +45 -10
- package/dist/primitives/Drawer/index.d.ts +13 -4
- package/dist/primitives/FormField/FormField.svelte +6 -6
- package/dist/primitives/FormField/index.d.ts +13 -4
- package/dist/primitives/Input/Input.svelte +8 -4
- package/dist/primitives/Input/input.variants.d.ts +9 -9
- package/dist/primitives/Menu/Menu.svelte +66 -4
- package/dist/primitives/Menu/index.d.ts +25 -0
- package/dist/primitives/Pagination/Pagination.svelte +28 -13
- package/dist/primitives/Pagination/index.d.ts +44 -0
- package/dist/primitives/Popover/Popover.svelte +34 -3
- package/dist/primitives/Popover/index.d.ts +3 -3
- package/dist/primitives/RadioGroup/RadioGroup.svelte +3 -3
- package/dist/primitives/Select/Select.svelte +21 -11
- package/dist/primitives/Select/index.d.ts +7 -0
- package/dist/primitives/Select/select.variants.d.ts +17 -17
- package/dist/primitives/Select/select.variants.js +18 -0
- package/dist/primitives/Skeleton/skeleton.variants.d.ts +3 -3
- package/dist/primitives/Slider/Slider.svelte +4 -8
- package/dist/primitives/Spinner/spinner.variants.d.ts +16 -16
- package/dist/primitives/Textarea/Textarea.svelte +13 -5
- package/dist/primitives/Textarea/textarea.variants.d.ts +7 -7
- package/dist/primitives/Textarea/textarea.variants.js +5 -2
- package/dist/primitives/Toast/Toaster.svelte +42 -2
- package/dist/primitives/Toast/index.d.ts +30 -0
- package/dist/primitives/Toast/toast.store.svelte.d.ts +25 -1
- package/dist/primitives/Toast/toast.store.svelte.js +91 -1
- package/dist/primitives/Toast/toast.variants.d.ts +18 -0
- package/dist/primitives/Toast/toast.variants.js +15 -0
- package/dist/primitives/Toggle/Toggle.svelte +17 -3
- package/dist/primitives/Toggle/index.d.ts +8 -2
- package/dist/primitives/Toggle/toggle.variants.d.ts +7 -0
- package/dist/primitives/Toggle/toggle.variants.js +26 -0
- package/dist/primitives/Toolbar/toolbar.variants.d.ts +6 -6
- package/dist/primitives/Tooltip/Tooltip.svelte +47 -21
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/primitives/Tooltip/index.d.ts +31 -3
- package/dist/primitives/Tooltip/tooltip.variants.d.ts +4 -4
- package/dist/primitives/Tooltip/tooltip.variants.js +2 -2
- package/dist/primitives/index.d.ts +3 -3
- package/dist/style/semantic.css +55 -29
- package/dist/translations/de.d.ts +3 -0
- package/dist/translations/de.js +4 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +4 -1
- package/dist/utils/figma-token-export.d.ts +13 -0
- package/dist/utils/figma-token-export.js +99 -26
- package/dist/utils/guide.svelte.d.ts +8 -2
- package/dist/utils/guide.svelte.js +86 -5
- package/dist/utils/use-form-field.svelte.d.ts +9 -9
- package/dist/utils/use-form-field.svelte.js +12 -12
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import { type SlotNames, type VariantProps } from '../../utils/variants.js';
|
|
|
2
2
|
export declare const selectVariants: ((props?: {
|
|
3
3
|
tier?: "commit" | "modify" | undefined;
|
|
4
4
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
5
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
6
6
|
open?: boolean | undefined;
|
|
7
7
|
disabled?: boolean | undefined;
|
|
8
8
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -13,7 +13,7 @@ export declare const selectVariants: ((props?: {
|
|
|
13
13
|
wrapper: (props?: ({
|
|
14
14
|
tier?: "commit" | "modify" | undefined;
|
|
15
15
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
16
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
16
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
17
17
|
open?: boolean | undefined;
|
|
18
18
|
disabled?: boolean | undefined;
|
|
19
19
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -26,7 +26,7 @@ export declare const selectVariants: ((props?: {
|
|
|
26
26
|
base: (props?: ({
|
|
27
27
|
tier?: "commit" | "modify" | undefined;
|
|
28
28
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
29
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
29
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
30
30
|
open?: boolean | undefined;
|
|
31
31
|
disabled?: boolean | undefined;
|
|
32
32
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -39,7 +39,7 @@ export declare const selectVariants: ((props?: {
|
|
|
39
39
|
trigger: (props?: ({
|
|
40
40
|
tier?: "commit" | "modify" | undefined;
|
|
41
41
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
42
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
42
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
43
43
|
open?: boolean | undefined;
|
|
44
44
|
disabled?: boolean | undefined;
|
|
45
45
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -52,7 +52,7 @@ export declare const selectVariants: ((props?: {
|
|
|
52
52
|
triggerText: (props?: ({
|
|
53
53
|
tier?: "commit" | "modify" | undefined;
|
|
54
54
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
55
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
55
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
56
56
|
open?: boolean | undefined;
|
|
57
57
|
disabled?: boolean | undefined;
|
|
58
58
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -65,7 +65,7 @@ export declare const selectVariants: ((props?: {
|
|
|
65
65
|
placeholder: (props?: ({
|
|
66
66
|
tier?: "commit" | "modify" | undefined;
|
|
67
67
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
68
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
68
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
69
69
|
open?: boolean | undefined;
|
|
70
70
|
disabled?: boolean | undefined;
|
|
71
71
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -78,7 +78,7 @@ export declare const selectVariants: ((props?: {
|
|
|
78
78
|
chevron: (props?: ({
|
|
79
79
|
tier?: "commit" | "modify" | undefined;
|
|
80
80
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
81
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
81
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
82
82
|
open?: boolean | undefined;
|
|
83
83
|
disabled?: boolean | undefined;
|
|
84
84
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -91,7 +91,7 @@ export declare const selectVariants: ((props?: {
|
|
|
91
91
|
clear: (props?: ({
|
|
92
92
|
tier?: "commit" | "modify" | undefined;
|
|
93
93
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
94
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
94
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
95
95
|
open?: boolean | undefined;
|
|
96
96
|
disabled?: boolean | undefined;
|
|
97
97
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -104,7 +104,7 @@ export declare const selectVariants: ((props?: {
|
|
|
104
104
|
listbox: (props?: ({
|
|
105
105
|
tier?: "commit" | "modify" | undefined;
|
|
106
106
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
107
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
107
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
108
108
|
open?: boolean | undefined;
|
|
109
109
|
disabled?: boolean | undefined;
|
|
110
110
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -117,7 +117,7 @@ export declare const selectVariants: ((props?: {
|
|
|
117
117
|
option: (props?: ({
|
|
118
118
|
tier?: "commit" | "modify" | undefined;
|
|
119
119
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
120
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
120
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
121
121
|
open?: boolean | undefined;
|
|
122
122
|
disabled?: boolean | undefined;
|
|
123
123
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -130,7 +130,7 @@ export declare const selectVariants: ((props?: {
|
|
|
130
130
|
optionLabel: (props?: ({
|
|
131
131
|
tier?: "commit" | "modify" | undefined;
|
|
132
132
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
133
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
133
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
134
134
|
open?: boolean | undefined;
|
|
135
135
|
disabled?: boolean | undefined;
|
|
136
136
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -143,7 +143,7 @@ export declare const selectVariants: ((props?: {
|
|
|
143
143
|
optionCheck: (props?: ({
|
|
144
144
|
tier?: "commit" | "modify" | undefined;
|
|
145
145
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
146
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
146
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
147
147
|
open?: boolean | undefined;
|
|
148
148
|
disabled?: boolean | undefined;
|
|
149
149
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -156,7 +156,7 @@ export declare const selectVariants: ((props?: {
|
|
|
156
156
|
optionCheckbox: (props?: ({
|
|
157
157
|
tier?: "commit" | "modify" | undefined;
|
|
158
158
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
159
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
159
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
160
160
|
open?: boolean | undefined;
|
|
161
161
|
disabled?: boolean | undefined;
|
|
162
162
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -169,7 +169,7 @@ export declare const selectVariants: ((props?: {
|
|
|
169
169
|
group: (props?: ({
|
|
170
170
|
tier?: "commit" | "modify" | undefined;
|
|
171
171
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
172
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
172
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
173
173
|
open?: boolean | undefined;
|
|
174
174
|
disabled?: boolean | undefined;
|
|
175
175
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -182,7 +182,7 @@ export declare const selectVariants: ((props?: {
|
|
|
182
182
|
groupLabel: (props?: ({
|
|
183
183
|
tier?: "commit" | "modify" | undefined;
|
|
184
184
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
185
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
185
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
186
186
|
open?: boolean | undefined;
|
|
187
187
|
disabled?: boolean | undefined;
|
|
188
188
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -195,7 +195,7 @@ export declare const selectVariants: ((props?: {
|
|
|
195
195
|
label: (props?: ({
|
|
196
196
|
tier?: "commit" | "modify" | undefined;
|
|
197
197
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
198
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
198
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
199
199
|
open?: boolean | undefined;
|
|
200
200
|
disabled?: boolean | undefined;
|
|
201
201
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -208,7 +208,7 @@ export declare const selectVariants: ((props?: {
|
|
|
208
208
|
message: (props?: ({
|
|
209
209
|
tier?: "commit" | "modify" | undefined;
|
|
210
210
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
211
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
211
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
212
212
|
open?: boolean | undefined;
|
|
213
213
|
disabled?: boolean | undefined;
|
|
214
214
|
messageType?: "error" | "helper" | undefined;
|
|
@@ -82,6 +82,16 @@ export const selectVariants = tv({
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
size: {
|
|
85
|
+
// Full xs–xl scale, mirroring Input's h-7…h-14 ladder (form-family
|
|
86
|
+
// symmetry: a dense form should not pair an xs Input with an sm Select).
|
|
87
|
+
xs: {
|
|
88
|
+
trigger: 'h-7 pl-2 pr-7 text-xs gap-1.5',
|
|
89
|
+
chevron: 'w-3 h-3',
|
|
90
|
+
clear: 'right-1.5 p-0.5 [&_svg]:w-3 [&_svg]:h-3',
|
|
91
|
+
option: 'py-1 text-xs min-h-[1.75rem]',
|
|
92
|
+
optionCheck: 'w-3 h-3',
|
|
93
|
+
optionCheckbox: 'w-3 h-3 [&_svg]:w-2 [&_svg]:h-2'
|
|
94
|
+
},
|
|
85
95
|
sm: {
|
|
86
96
|
trigger: 'h-8 pl-3 pr-8 text-sm gap-2',
|
|
87
97
|
chevron: 'w-3.5 h-3.5',
|
|
@@ -105,6 +115,14 @@ export const selectVariants = tv({
|
|
|
105
115
|
option: 'py-2.5 text-base min-h-[3rem]',
|
|
106
116
|
optionCheck: 'w-5 h-5',
|
|
107
117
|
optionCheckbox: 'w-[18px] h-[18px] [&_svg]:w-3.5 [&_svg]:h-3.5'
|
|
118
|
+
},
|
|
119
|
+
xl: {
|
|
120
|
+
trigger: 'h-14 pl-6 pr-14 text-xl gap-3',
|
|
121
|
+
chevron: 'w-6 h-6',
|
|
122
|
+
clear: 'right-5 p-1 [&_svg]:w-6 [&_svg]:h-6',
|
|
123
|
+
option: 'py-3 text-lg min-h-[3.5rem]',
|
|
124
|
+
optionCheck: 'w-6 h-6',
|
|
125
|
+
optionCheckbox: 'w-5 h-5 [&_svg]:w-4 [&_svg]:h-4'
|
|
108
126
|
}
|
|
109
127
|
},
|
|
110
128
|
open: {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { type SlotNames, type VariantProps } from '../../utils/variants.js';
|
|
2
2
|
export declare const skeletonVariants: ((props?: {
|
|
3
3
|
variant?: "rounded" | "text" | "circular" | "rectangular" | undefined;
|
|
4
|
-
size?: "sm" | "md" | "lg" | "
|
|
4
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
5
5
|
animation?: "none" | "pulse" | "wave" | undefined;
|
|
6
6
|
} | undefined) => {
|
|
7
7
|
base: (props?: ({
|
|
8
8
|
variant?: "rounded" | "text" | "circular" | "rectangular" | undefined;
|
|
9
|
-
size?: "sm" | "md" | "lg" | "
|
|
9
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
10
10
|
animation?: "none" | "pulse" | "wave" | undefined;
|
|
11
11
|
} & {
|
|
12
12
|
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
13
13
|
}) | undefined) => string;
|
|
14
14
|
wrapper: (props?: ({
|
|
15
15
|
variant?: "rounded" | "text" | "circular" | "rectangular" | undefined;
|
|
16
|
-
size?: "sm" | "md" | "lg" | "
|
|
16
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
17
17
|
animation?: "none" | "pulse" | "wave" | undefined;
|
|
18
18
|
} & {
|
|
19
19
|
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
const uid = `slider-${propsId}`;
|
|
48
48
|
const ff = useFormField(() => ({
|
|
49
49
|
fieldId: uid,
|
|
50
|
-
|
|
50
|
+
helper,
|
|
51
51
|
error,
|
|
52
52
|
disabled
|
|
53
53
|
}));
|
|
@@ -86,11 +86,7 @@
|
|
|
86
86
|
|
|
87
87
|
// ─── Range-Constraints ──────────────────────────────────────────────────
|
|
88
88
|
type ZoneStatus =
|
|
89
|
-
| '
|
|
90
|
-
| 'insideRecommended'
|
|
91
|
-
| 'insideValidOnly'
|
|
92
|
-
| 'outsideValidDanger'
|
|
93
|
-
| 'outsideValidWarning';
|
|
89
|
+
'none' | 'insideRecommended' | 'insideValidOnly' | 'outsideValidDanger' | 'outsideValidWarning';
|
|
94
90
|
|
|
95
91
|
const hasRangeConstraints = $derived(!!validRange || !!recommendedRange);
|
|
96
92
|
|
|
@@ -537,9 +533,9 @@
|
|
|
537
533
|
>
|
|
538
534
|
{error}
|
|
539
535
|
</div>
|
|
540
|
-
{:else if ff.
|
|
536
|
+
{:else if ff.helperId}
|
|
541
537
|
<div
|
|
542
|
-
id={ff.
|
|
538
|
+
id={ff.helperId}
|
|
543
539
|
class={unstyled
|
|
544
540
|
? (slotClasses?.message ?? '')
|
|
545
541
|
: styles.message({ class: slotClasses?.message })}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type SlotNames, type VariantProps } from '../../utils/variants.js';
|
|
2
2
|
export declare const spinnerVariants: ((props?: {
|
|
3
3
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
4
|
-
size?: "sm" | "md" | "lg" | "
|
|
4
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
5
5
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
6
6
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
7
7
|
} | undefined) => {
|
|
8
8
|
base: (props?: ({
|
|
9
9
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
10
|
-
size?: "sm" | "md" | "lg" | "
|
|
10
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
11
11
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
12
12
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
13
13
|
} & {
|
|
@@ -15,7 +15,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
15
15
|
}) | undefined) => string;
|
|
16
16
|
svg: (props?: ({
|
|
17
17
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
18
|
-
size?: "sm" | "md" | "lg" | "
|
|
18
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
19
19
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
20
20
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
21
21
|
} & {
|
|
@@ -23,7 +23,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
23
23
|
}) | undefined) => string;
|
|
24
24
|
svgCircle: (props?: ({
|
|
25
25
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
26
|
-
size?: "sm" | "md" | "lg" | "
|
|
26
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
27
27
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
28
28
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
29
29
|
} & {
|
|
@@ -31,7 +31,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
31
31
|
}) | undefined) => string;
|
|
32
32
|
svgPath: (props?: ({
|
|
33
33
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
34
|
-
size?: "sm" | "md" | "lg" | "
|
|
34
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
35
35
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
36
36
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
37
37
|
} & {
|
|
@@ -39,7 +39,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
39
39
|
}) | undefined) => string;
|
|
40
40
|
dots: (props?: ({
|
|
41
41
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
42
|
-
size?: "sm" | "md" | "lg" | "
|
|
42
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
43
43
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
44
44
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
45
45
|
} & {
|
|
@@ -47,7 +47,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
47
47
|
}) | undefined) => string;
|
|
48
48
|
dot: (props?: ({
|
|
49
49
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
50
|
-
size?: "sm" | "md" | "lg" | "
|
|
50
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
51
51
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
52
52
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
53
53
|
} & {
|
|
@@ -55,7 +55,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
55
55
|
}) | undefined) => string;
|
|
56
56
|
pulse: (props?: ({
|
|
57
57
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
58
|
-
size?: "sm" | "md" | "lg" | "
|
|
58
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
59
59
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
60
60
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
61
61
|
} & {
|
|
@@ -63,7 +63,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
63
63
|
}) | undefined) => string;
|
|
64
64
|
pulseCenter: (props?: ({
|
|
65
65
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
66
|
-
size?: "sm" | "md" | "lg" | "
|
|
66
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
67
67
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
68
68
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
69
69
|
} & {
|
|
@@ -71,7 +71,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
71
71
|
}) | undefined) => string;
|
|
72
72
|
pulseRing: (props?: ({
|
|
73
73
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
74
|
-
size?: "sm" | "md" | "lg" | "
|
|
74
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
75
75
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
76
76
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
77
77
|
} & {
|
|
@@ -79,7 +79,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
79
79
|
}) | undefined) => string;
|
|
80
80
|
ring: (props?: ({
|
|
81
81
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
82
|
-
size?: "sm" | "md" | "lg" | "
|
|
82
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
83
83
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
84
84
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
85
85
|
} & {
|
|
@@ -87,7 +87,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
87
87
|
}) | undefined) => string;
|
|
88
88
|
ringElement: (props?: ({
|
|
89
89
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
90
|
-
size?: "sm" | "md" | "lg" | "
|
|
90
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
91
91
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
92
92
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
93
93
|
} & {
|
|
@@ -95,7 +95,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
95
95
|
}) | undefined) => string;
|
|
96
96
|
bars: (props?: ({
|
|
97
97
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
98
|
-
size?: "sm" | "md" | "lg" | "
|
|
98
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
99
99
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
100
100
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
101
101
|
} & {
|
|
@@ -103,7 +103,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
103
103
|
}) | undefined) => string;
|
|
104
104
|
bar: (props?: ({
|
|
105
105
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
106
|
-
size?: "sm" | "md" | "lg" | "
|
|
106
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
107
107
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
108
108
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
109
109
|
} & {
|
|
@@ -111,7 +111,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
111
111
|
}) | undefined) => string;
|
|
112
112
|
content: (props?: ({
|
|
113
113
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
114
|
-
size?: "sm" | "md" | "lg" | "
|
|
114
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
115
115
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
116
116
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
117
117
|
} & {
|
|
@@ -119,7 +119,7 @@ export declare const spinnerVariants: ((props?: {
|
|
|
119
119
|
}) | undefined) => string;
|
|
120
120
|
srOnly: (props?: ({
|
|
121
121
|
variant?: "pulse" | "default" | "ring" | "bars" | "dots" | undefined;
|
|
122
|
-
size?: "sm" | "md" | "lg" | "
|
|
122
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
123
123
|
intent?: "primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "current" | undefined;
|
|
124
124
|
speed?: "fast" | "slow" | "normal" | undefined;
|
|
125
125
|
} & {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
unstyled: unstyledProp = false,
|
|
29
29
|
slotClasses: slotClassesProp = {},
|
|
30
30
|
preset,
|
|
31
|
+
oninput: userOnInput,
|
|
31
32
|
...restProps
|
|
32
33
|
}: TextareaProps = $props();
|
|
33
34
|
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
const propsId = $props.id();
|
|
44
45
|
const ff = useFormField(() => ({
|
|
45
46
|
fieldId: `textarea-${propsId}`,
|
|
46
|
-
|
|
47
|
+
helper,
|
|
47
48
|
error,
|
|
48
49
|
required,
|
|
49
50
|
disabled
|
|
@@ -103,6 +104,14 @@
|
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
106
|
|
|
107
|
+
function handleInput(event: Event & { currentTarget: EventTarget & HTMLTextAreaElement }) {
|
|
108
|
+
if (autoResize) adjustHeight();
|
|
109
|
+
// Forward the consumer's oninput — Textarea's own handler sits after
|
|
110
|
+
// `{...restProps}` on the element, so without this it would swallow it
|
|
111
|
+
// (same class as Input's onkeydown forward).
|
|
112
|
+
userOnInput?.(event);
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
$effect(() => {
|
|
107
116
|
if (textareaRef && mint && mint !== 'none' && !disabled) {
|
|
108
117
|
return mintRegistry.apply(textareaRef, mint);
|
|
@@ -137,8 +146,7 @@
|
|
|
137
146
|
{required}
|
|
138
147
|
aria-invalid={ff.invalid ? 'true' : undefined}
|
|
139
148
|
aria-describedby={ff.describedBy}
|
|
140
|
-
oninput={
|
|
141
|
-
></textarea>
|
|
149
|
+
oninput={handleInput}></textarea>
|
|
142
150
|
|
|
143
151
|
{#if showFooter}
|
|
144
152
|
<div
|
|
@@ -154,9 +162,9 @@
|
|
|
154
162
|
>
|
|
155
163
|
{error}
|
|
156
164
|
</div>
|
|
157
|
-
{:else if ff.
|
|
165
|
+
{:else if ff.helperId}
|
|
158
166
|
<div
|
|
159
|
-
id={ff.
|
|
167
|
+
id={ff.helperId}
|
|
160
168
|
class={unstyled
|
|
161
169
|
? (slotClasses?.message ?? '')
|
|
162
170
|
: styles.message({ class: slotClasses?.message })}
|
|
@@ -2,7 +2,7 @@ import { type SlotNames, type VariantProps } from '../../utils/variants.js';
|
|
|
2
2
|
export declare const textareaVariants: ((props?: {
|
|
3
3
|
tier?: "commit" | "modify" | undefined;
|
|
4
4
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
5
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
6
6
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
7
7
|
autoResize?: boolean | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
@@ -15,7 +15,7 @@ export declare const textareaVariants: ((props?: {
|
|
|
15
15
|
wrapper: (props?: ({
|
|
16
16
|
tier?: "commit" | "modify" | undefined;
|
|
17
17
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
18
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
18
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
19
19
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
20
20
|
autoResize?: boolean | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
@@ -30,7 +30,7 @@ export declare const textareaVariants: ((props?: {
|
|
|
30
30
|
base: (props?: ({
|
|
31
31
|
tier?: "commit" | "modify" | undefined;
|
|
32
32
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
33
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
33
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
34
34
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
35
35
|
autoResize?: boolean | undefined;
|
|
36
36
|
disabled?: boolean | undefined;
|
|
@@ -45,7 +45,7 @@ export declare const textareaVariants: ((props?: {
|
|
|
45
45
|
label: (props?: ({
|
|
46
46
|
tier?: "commit" | "modify" | undefined;
|
|
47
47
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
48
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
48
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
49
49
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
50
50
|
autoResize?: boolean | undefined;
|
|
51
51
|
disabled?: boolean | undefined;
|
|
@@ -60,7 +60,7 @@ export declare const textareaVariants: ((props?: {
|
|
|
60
60
|
footer: (props?: ({
|
|
61
61
|
tier?: "commit" | "modify" | undefined;
|
|
62
62
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
63
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
63
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
64
64
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
65
65
|
autoResize?: boolean | undefined;
|
|
66
66
|
disabled?: boolean | undefined;
|
|
@@ -75,7 +75,7 @@ export declare const textareaVariants: ((props?: {
|
|
|
75
75
|
message: (props?: ({
|
|
76
76
|
tier?: "commit" | "modify" | undefined;
|
|
77
77
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
78
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
78
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
79
79
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
80
80
|
autoResize?: boolean | undefined;
|
|
81
81
|
disabled?: boolean | undefined;
|
|
@@ -90,7 +90,7 @@ export declare const textareaVariants: ((props?: {
|
|
|
90
90
|
counter: (props?: ({
|
|
91
91
|
tier?: "commit" | "modify" | undefined;
|
|
92
92
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
93
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
93
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
94
94
|
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
95
95
|
autoResize?: boolean | undefined;
|
|
96
96
|
disabled?: boolean | undefined;
|
|
@@ -39,11 +39,14 @@ export const textareaVariants = tv({
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
size: {
|
|
42
|
+
// Full xs–xl scale (form-family symmetry with Input's ladder).
|
|
42
43
|
// `pointer-coarse:text-base` floors the font to 16px on touch so iOS
|
|
43
|
-
// Safari doesn't auto-zoom the field on focus. Desktop keeps 14px.
|
|
44
|
+
// Safari doesn't auto-zoom the field on focus. Desktop keeps 12/14px.
|
|
45
|
+
xs: { base: 'px-2 py-1.5 text-xs pointer-coarse:text-base min-h-[4rem]' },
|
|
44
46
|
sm: { base: 'px-3 py-2 text-sm pointer-coarse:text-base min-h-[5rem]' },
|
|
45
47
|
md: { base: 'px-4 py-3 text-base min-h-[7rem]' },
|
|
46
|
-
lg: { base: 'px-6 py-4 text-lg min-h-[9rem]' }
|
|
48
|
+
lg: { base: 'px-6 py-4 text-lg min-h-[9rem]' },
|
|
49
|
+
xl: { base: 'px-8 py-5 text-xl min-h-[11rem]' }
|
|
47
50
|
},
|
|
48
51
|
// Message colour is owned by messageType/error (declared below) — an
|
|
49
52
|
// intent-level message tone could never win the fold and shipped
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
import WarningTriangleIconDefault from '../../icons/WarningTriangleIcon.svelte';
|
|
12
12
|
import DangerCircleIconDefault from '../../icons/DangerCircleIcon.svelte';
|
|
13
13
|
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
14
|
-
import
|
|
14
|
+
import Spinner from '../Spinner/Spinner.svelte';
|
|
15
|
+
import type { ToastData, ToastProps } from './index';
|
|
15
16
|
|
|
16
17
|
const bt = useBlocksI18n();
|
|
17
18
|
|
|
@@ -66,12 +67,25 @@
|
|
|
66
67
|
content: () => '',
|
|
67
68
|
title: () => '',
|
|
68
69
|
description: () => '',
|
|
70
|
+
actions: () => '',
|
|
71
|
+
actionButton: () => '',
|
|
72
|
+
cancelButton: () => '',
|
|
69
73
|
dismissButton: () => '',
|
|
70
74
|
progress: () => ''
|
|
71
75
|
}
|
|
72
76
|
: toastVariants({ placement })
|
|
73
77
|
);
|
|
74
78
|
|
|
79
|
+
// Run a toast action/cancel button: fire its handler, then dismiss unless the
|
|
80
|
+
// action opted out (`dismissOnClick: false`, e.g. a "Retry" that re-issues the
|
|
81
|
+
// async work and updates the same toast).
|
|
82
|
+
function runAction(toast: ToastData, which: 'action' | 'cancel') {
|
|
83
|
+
const action = toast[which];
|
|
84
|
+
if (!action) return;
|
|
85
|
+
action.onClick?.(toast.id);
|
|
86
|
+
if (action.dismissOnClick !== false) toaster.dismiss(toast.id);
|
|
87
|
+
}
|
|
88
|
+
|
|
75
89
|
function slot(key: keyof typeof styles, intent?: string) {
|
|
76
90
|
const overrides = slotClasses?.[key];
|
|
77
91
|
if (unstyled) return overrides ?? '';
|
|
@@ -115,7 +129,11 @@
|
|
|
115
129
|
{#each visibleToasts as toast (toast.id)}
|
|
116
130
|
{@const IntentIcon = INTENT_ICON_MAP[toast.intent] ?? INTENT_ICON_MAP.neutral}
|
|
117
131
|
<div class={slot('toast', toast.intent)} role="alert" transition:fly={flyParams()}>
|
|
118
|
-
|
|
132
|
+
{#if toast.loading}
|
|
133
|
+
<span class={slot('icon', toast.intent)}><Spinner size="sm" /></span>
|
|
134
|
+
{:else}
|
|
135
|
+
<IntentIcon class={slot('icon', toast.intent)} />
|
|
136
|
+
{/if}
|
|
119
137
|
|
|
120
138
|
<div class={slot('content')}>
|
|
121
139
|
{#if toast.title}
|
|
@@ -124,6 +142,28 @@
|
|
|
124
142
|
{#if toast.description}
|
|
125
143
|
<div class={slot('description')}>{toast.description}</div>
|
|
126
144
|
{/if}
|
|
145
|
+
{#if toast.action || toast.cancel}
|
|
146
|
+
<div class={slot('actions')}>
|
|
147
|
+
{#if toast.action}
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
class={slot('actionButton')}
|
|
151
|
+
onclick={() => runAction(toast, 'action')}
|
|
152
|
+
>
|
|
153
|
+
{toast.action.label}
|
|
154
|
+
</button>
|
|
155
|
+
{/if}
|
|
156
|
+
{#if toast.cancel}
|
|
157
|
+
<button
|
|
158
|
+
type="button"
|
|
159
|
+
class={slot('cancelButton')}
|
|
160
|
+
onclick={() => runAction(toast, 'cancel')}
|
|
161
|
+
>
|
|
162
|
+
{toast.cancel.label}
|
|
163
|
+
</button>
|
|
164
|
+
{/if}
|
|
165
|
+
</div>
|
|
166
|
+
{/if}
|
|
127
167
|
</div>
|
|
128
168
|
|
|
129
169
|
{#if toast.dismissible}
|
|
@@ -11,6 +11,17 @@ export declare const TOAST_INTENTS: readonly ["primary", "info", "success", "war
|
|
|
11
11
|
* standard intent palette.
|
|
12
12
|
*/
|
|
13
13
|
export type ToastIntent = (typeof TOAST_INTENTS)[number];
|
|
14
|
+
/**
|
|
15
|
+
* An action or cancel button rendered inside a toast (Sonner-style).
|
|
16
|
+
*/
|
|
17
|
+
export interface ToastAction {
|
|
18
|
+
/** Button label. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Click handler. Receives the toast id so the handler can dismiss/update it. */
|
|
21
|
+
onClick?: (id: string) => void;
|
|
22
|
+
/** Dismiss the toast after the click. @default true */
|
|
23
|
+
dismissOnClick?: boolean;
|
|
24
|
+
}
|
|
14
25
|
/**
|
|
15
26
|
* Internal data shape for a rendered toast. Created by `toaster.add()`.
|
|
16
27
|
*/
|
|
@@ -29,6 +40,25 @@ export interface ToastData {
|
|
|
29
40
|
dismissible: boolean;
|
|
30
41
|
/** Show an animated progress bar that counts down the remaining `duration`. @default true */
|
|
31
42
|
showProgress: boolean;
|
|
43
|
+
/** Primary action button (prominent). */
|
|
44
|
+
action?: ToastAction;
|
|
45
|
+
/** Secondary/cancel button (quiet). */
|
|
46
|
+
cancel?: ToastAction;
|
|
47
|
+
/** Render a spinner instead of the intent icon (used by `toaster.promise` while pending). @default false */
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Per-state config for `toaster.promise`. Each state is either a plain title
|
|
52
|
+
* string or a full {@link ToastInput}; `success`/`error` may also be a function
|
|
53
|
+
* of the resolved value / rejection reason.
|
|
54
|
+
*/
|
|
55
|
+
export interface ToastPromiseOptions<T> {
|
|
56
|
+
/** Shown while the promise is pending (spinner, persistent, not dismissible). */
|
|
57
|
+
loading: string | ToastInput;
|
|
58
|
+
/** Shown when the promise resolves. */
|
|
59
|
+
success: string | ToastInput | ((value: T) => string | ToastInput);
|
|
60
|
+
/** Shown when the promise rejects. */
|
|
61
|
+
error: string | ToastInput | ((reason: unknown) => string | ToastInput);
|
|
32
62
|
}
|
|
33
63
|
/**
|
|
34
64
|
* Options accepted by `toaster.add()` and the shorthand methods (`info`, `success`, `warning`, `danger`).
|