@vygruppen/spor-react 13.6.0 → 13.7.1
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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-postinstall.log +3 -4
- package/CHANGELOG.md +28 -0
- package/__tests__/toast.test.tsx +108 -0
- package/dist/index.cjs +126 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.mjs +127 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/input/Autocomplete.tsx +2 -0
- package/src/input/Field.tsx +2 -4
- package/src/layout/RadioCard.tsx +2 -1
- package/src/link/TextLink.tsx +27 -11
- package/src/theme/recipes/badge.ts +20 -0
- package/src/theme/recipes/input.ts +8 -1
- package/src/theme/recipes/separator.ts +4 -3
- package/src/theme/slot-recipes/input-chip.ts +4 -5
- package/src/theme/slot-recipes/select.ts +5 -0
- package/src/theme/slot-recipes/toast.ts +38 -1
- package/src/toast/toast.tsx +10 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vygruppen/spor-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.7.1",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"react-stately": "^3.31.1",
|
|
47
47
|
"react-swipeable": "^7.0.1",
|
|
48
48
|
"usehooks-ts": "^3.1.0",
|
|
49
|
-
"@vygruppen/spor-design-tokens": "5.1.
|
|
50
|
-
"@vygruppen/spor-icon-react": "5.0.
|
|
49
|
+
"@vygruppen/spor-design-tokens": "5.1.1",
|
|
50
|
+
"@vygruppen/spor-icon-react": "5.0.3",
|
|
51
51
|
"@vygruppen/spor-loader": "0.7.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -50,6 +50,7 @@ export function Autocomplete({
|
|
|
50
50
|
openOnClick = true,
|
|
51
51
|
openOnFocus = true,
|
|
52
52
|
ref,
|
|
53
|
+
size = "md",
|
|
53
54
|
...rest
|
|
54
55
|
}: Props) {
|
|
55
56
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
@@ -114,6 +115,7 @@ export function Autocomplete({
|
|
|
114
115
|
if (openOnFocus && filteredChildren.length > 0)
|
|
115
116
|
combobox.setOpen(true);
|
|
116
117
|
}}
|
|
118
|
+
size={size}
|
|
117
119
|
/>
|
|
118
120
|
</Combobox.Input>
|
|
119
121
|
<Combobox.IndicatorGroup>
|
package/src/input/Field.tsx
CHANGED
|
@@ -121,23 +121,21 @@ export const Field = ({
|
|
|
121
121
|
gap={gap}
|
|
122
122
|
>
|
|
123
123
|
{label && !floatingLabel && (
|
|
124
|
-
<Label asChild={labelAsChild}
|
|
124
|
+
<Label asChild={labelAsChild} css={styles.label}>
|
|
125
125
|
{renderLabelWithIndicator(label, labelAsChild)}
|
|
126
126
|
</Label>
|
|
127
127
|
)}
|
|
128
128
|
|
|
129
|
-
{children}
|
|
130
|
-
|
|
131
129
|
{label && floatingLabel && (
|
|
132
130
|
<FloatingLabel
|
|
133
131
|
data-float={shouldFloat ? true : undefined}
|
|
134
132
|
asChild={labelAsChild}
|
|
135
|
-
aria-hidden
|
|
136
133
|
css={styles.label}
|
|
137
134
|
>
|
|
138
135
|
{renderLabelWithIndicator(label, labelAsChild)}
|
|
139
136
|
</FloatingLabel>
|
|
140
137
|
)}
|
|
138
|
+
{children}
|
|
141
139
|
{errorText && (
|
|
142
140
|
<ChakraField.ErrorText aria-live="polite">
|
|
143
141
|
{errorText}
|
package/src/layout/RadioCard.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
Flex,
|
|
3
4
|
RadioCard as ChakraRadioCard,
|
|
4
5
|
RecipeVariantProps,
|
|
5
6
|
useSlotRecipe,
|
|
@@ -64,7 +65,7 @@ export const RadioCard = ({
|
|
|
64
65
|
/>
|
|
65
66
|
<ChakraRadioCard.ItemControl id={itemControlId} aria-hidden>
|
|
66
67
|
{showIndicator && <ChakraRadioCard.ItemIndicator />}
|
|
67
|
-
{children}
|
|
68
|
+
<Flex direction="column">{children}</Flex>
|
|
68
69
|
</ChakraRadioCard.ItemControl>
|
|
69
70
|
</ChakraRadioCard.Item>
|
|
70
71
|
);
|
package/src/link/TextLink.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
LinkOutOutline18Icon,
|
|
9
9
|
LinkOutOutline24Icon,
|
|
10
|
+
LinkOutOutline30Icon,
|
|
10
11
|
} from "@vygruppen/spor-icon-react";
|
|
11
12
|
import React, {
|
|
12
13
|
cloneElement,
|
|
@@ -39,17 +40,32 @@ const ExternalIcon = ({
|
|
|
39
40
|
}: {
|
|
40
41
|
label: string;
|
|
41
42
|
size: LinkProps["size"];
|
|
42
|
-
}) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
}) => {
|
|
44
|
+
const getIcon = () => {
|
|
45
|
+
switch (size) {
|
|
46
|
+
case "lg": {
|
|
47
|
+
return <LinkOutOutline30Icon aria-hidden display="inline" />;
|
|
48
|
+
}
|
|
49
|
+
case "md": {
|
|
50
|
+
return <LinkOutOutline24Icon aria-hidden display="inline" />;
|
|
51
|
+
}
|
|
52
|
+
case "sm": {
|
|
53
|
+
return <LinkOutOutline18Icon aria-hidden display="inline" />;
|
|
54
|
+
}
|
|
55
|
+
default: {
|
|
56
|
+
return <LinkOutOutline24Icon aria-hidden display="inline" />;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return (
|
|
61
|
+
<span style={{ whiteSpace: "nowrap" }}>
|
|
62
|
+
{"\u2060"}
|
|
63
|
+
{getIcon()}
|
|
64
|
+
{/* Visually hidden text for screen readers */}
|
|
65
|
+
<VisuallyHidden>{label}</VisuallyHidden>
|
|
66
|
+
</span>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
53
69
|
|
|
54
70
|
export const TextLink = ({
|
|
55
71
|
ref,
|
|
@@ -7,57 +7,69 @@ export const badgeRecipie = defineRecipe({
|
|
|
7
7
|
justifyContent: "center",
|
|
8
8
|
height: "fit-content",
|
|
9
9
|
gap: "0.5",
|
|
10
|
+
outline: "1px solid",
|
|
11
|
+
outlineOffset: "-1px",
|
|
10
12
|
},
|
|
11
13
|
variants: {
|
|
12
14
|
colorPalette: {
|
|
13
15
|
neutral: {
|
|
14
16
|
backgroundColor: "surface",
|
|
15
17
|
color: "text",
|
|
18
|
+
outlineColor: "outline",
|
|
16
19
|
"& svg": { color: "icon" },
|
|
17
20
|
},
|
|
18
21
|
grey: {
|
|
19
22
|
backgroundColor: "surface.neutral",
|
|
20
23
|
color: "text.neutral",
|
|
24
|
+
outlineColor: "outline.neutral",
|
|
21
25
|
"& svg": { color: "icon.neutral" },
|
|
22
26
|
},
|
|
23
27
|
green: {
|
|
24
28
|
backgroundColor: "surface.success",
|
|
25
29
|
color: "text.success",
|
|
30
|
+
outlineColor: "outline.success",
|
|
26
31
|
"& svg": { color: "icon.success" },
|
|
27
32
|
},
|
|
28
33
|
blue: {
|
|
29
34
|
backgroundColor: "surface.info",
|
|
30
35
|
color: "text.info",
|
|
36
|
+
outlineColor: "outline.info",
|
|
31
37
|
"& svg": { color: "icon.info" },
|
|
32
38
|
},
|
|
33
39
|
cream: {
|
|
34
40
|
backgroundColor: "surface.warning",
|
|
35
41
|
color: "text.warning",
|
|
42
|
+
outlineColor: "outline.warning",
|
|
36
43
|
"& svg": { color: "icon.warning" },
|
|
37
44
|
},
|
|
38
45
|
yellow: {
|
|
39
46
|
backgroundColor: "surface.notice",
|
|
40
47
|
color: "text.notice",
|
|
48
|
+
outlineColor: "outline.notice",
|
|
41
49
|
"& svg": { color: "icon.notice" },
|
|
42
50
|
},
|
|
43
51
|
orange: {
|
|
44
52
|
backgroundColor: "surface.caution",
|
|
45
53
|
color: "text.caution",
|
|
54
|
+
outlineColor: "outline.caution",
|
|
46
55
|
"& svg": { color: "icon.caution" },
|
|
47
56
|
},
|
|
48
57
|
red: {
|
|
49
58
|
backgroundColor: "surface.critical",
|
|
50
59
|
color: "text.critical",
|
|
60
|
+
outlineColor: "outline.critical",
|
|
51
61
|
"& svg": { color: "icon.critical" },
|
|
52
62
|
},
|
|
53
63
|
brightRed: {
|
|
54
64
|
backgroundColor: { _light: "brightRed", _dark: "brightRed" },
|
|
55
65
|
color: { _light: "pink", _dark: "pink" },
|
|
66
|
+
outlineColor: "outline.error",
|
|
56
67
|
"& svg": { color: { _light: "pink", _dark: "pink" } },
|
|
57
68
|
},
|
|
58
69
|
disabled: {
|
|
59
70
|
backgroundColor: "surface.disabled",
|
|
60
71
|
color: "text.disabled",
|
|
72
|
+
outlineColor: "outline.disabled",
|
|
61
73
|
"& svg": { color: "icon.disabled" },
|
|
62
74
|
},
|
|
63
75
|
},
|
|
@@ -100,6 +112,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
100
112
|
css: {
|
|
101
113
|
backgroundColor: { _light: "darkBlue", _dark: "lightBlue" },
|
|
102
114
|
color: { _light: "icyBlue", _dark: "royal" },
|
|
115
|
+
outlineColor: { _light: "ocean", _dark: "cloudy" },
|
|
103
116
|
"& svg": { color: { _light: "royal", _dark: "icyBlue" } },
|
|
104
117
|
},
|
|
105
118
|
},
|
|
@@ -109,6 +122,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
109
122
|
css: {
|
|
110
123
|
backgroundColor: { _light: "darkTeal", _dark: "seaMist" },
|
|
111
124
|
color: { _light: "mint", _dark: "jungle" },
|
|
125
|
+
outlineColor: { _light: "greenHaze", _dark: "coralGreen" },
|
|
112
126
|
"& svg": { color: { _light: "mint", _dark: "jungle" } },
|
|
113
127
|
},
|
|
114
128
|
},
|
|
@@ -118,6 +132,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
118
132
|
css: {
|
|
119
133
|
backgroundColor: { _light: "carbon", _dark: "platinum" },
|
|
120
134
|
color: { _light: "white", _dark: "darkGrey" },
|
|
135
|
+
outlineColor: { _light: "iron", _dark: "silver" },
|
|
121
136
|
"& svg": { color: { _light: "white", _dark: "darkGrey" } },
|
|
122
137
|
},
|
|
123
138
|
},
|
|
@@ -128,6 +143,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
128
143
|
css: {
|
|
129
144
|
backgroundColor: { _light: "coffee", _dark: "blonde" },
|
|
130
145
|
color: { _light: "cornsilk", _dark: "coffee" },
|
|
146
|
+
outlineColor: { _light: "bronze", _dark: "banana" },
|
|
131
147
|
"& svg": { color: { _light: "cornsilk", _dark: "coffee" } },
|
|
132
148
|
},
|
|
133
149
|
},
|
|
@@ -137,6 +153,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
137
153
|
css: {
|
|
138
154
|
backgroundColor: { _light: "bronze", _dark: "banana" },
|
|
139
155
|
color: { _light: "cornsilk", _dark: "coffee" },
|
|
156
|
+
outlineColor: { _light: "golden", _dark: "banana" },
|
|
140
157
|
"& svg": { color: { _light: "cornsilk", _dark: "coffee" } },
|
|
141
158
|
},
|
|
142
159
|
},
|
|
@@ -146,6 +163,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
146
163
|
css: {
|
|
147
164
|
backgroundColor: { _light: "wood", _dark: "champagne" },
|
|
148
165
|
color: { _light: "bisque", _dark: "wood" },
|
|
166
|
+
outlineColor: { _light: "russet", _dark: "saffron" },
|
|
149
167
|
"& svg": { color: { _light: "bisque", _dark: "wood" } },
|
|
150
168
|
},
|
|
151
169
|
},
|
|
@@ -155,6 +173,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
155
173
|
css: {
|
|
156
174
|
backgroundColor: { _light: "burgundy", _dark: "lightRed" },
|
|
157
175
|
color: { _light: "pink", _dark: "maroon" },
|
|
176
|
+
outlineColor: { _light: "crimson", _dark: "salmon" },
|
|
158
177
|
"& svg": { color: { _light: "pink", _dark: "maroon" } },
|
|
159
178
|
},
|
|
160
179
|
},
|
|
@@ -164,6 +183,7 @@ export const badgeRecipie = defineRecipe({
|
|
|
164
183
|
inverted: true,
|
|
165
184
|
css: {
|
|
166
185
|
backgroundColor: { _light: "ink", _dark: "white" },
|
|
186
|
+
outlineColor: { _light: "whiteAlpha.400", _dark: "blackAlpha.400" },
|
|
167
187
|
color: { _light: "white", _dark: "darkGrey" },
|
|
168
188
|
"& svg": { color: { _light: "white", _dark: "darkGrey" } },
|
|
169
189
|
},
|
|
@@ -56,6 +56,10 @@ export const inputRecipe = defineRecipe({
|
|
|
56
56
|
outline: "2px solid",
|
|
57
57
|
outlineColor: "outline.focus",
|
|
58
58
|
},
|
|
59
|
+
"&:-webkit-autofill, &:-webkit-autofill:focus": {
|
|
60
|
+
boxShadow: "0 0 0 1000px var(--spor-colors-surface-info-hover) inset",
|
|
61
|
+
WebkitTextFillColor: "var(--spor-colors-text)",
|
|
62
|
+
},
|
|
59
63
|
},
|
|
60
64
|
floating: {
|
|
61
65
|
boxShadow: "sm",
|
|
@@ -72,11 +76,14 @@ export const inputRecipe = defineRecipe({
|
|
|
72
76
|
outlineColor: "outline.neutral",
|
|
73
77
|
backgroundColor: "surface.floating.active",
|
|
74
78
|
},
|
|
75
|
-
|
|
76
79
|
focus: {
|
|
77
80
|
outline: "1px solid",
|
|
78
81
|
outlineColor: "outline.focus",
|
|
79
82
|
},
|
|
83
|
+
"&:-webkit-autofill, &:-webkit-autofill:focus": {
|
|
84
|
+
boxShadow: "0 0 0 1000px var(--spor-colors-surface-info-hover) inset",
|
|
85
|
+
WebkitTextFillColor: "var(--spor-colors-text)",
|
|
86
|
+
},
|
|
80
87
|
},
|
|
81
88
|
},
|
|
82
89
|
size: {
|
|
@@ -12,13 +12,14 @@ export const separatorRecipe = defineRecipe({
|
|
|
12
12
|
borderStyle: "solid",
|
|
13
13
|
},
|
|
14
14
|
dashed: {
|
|
15
|
+
"--dash-color": "var(--spor-colors-outline)",
|
|
15
16
|
borderImageSlice: 1,
|
|
16
17
|
borderImageSource: `repeating-linear-gradient(
|
|
17
18
|
var(--gradient-direction),
|
|
18
|
-
var(--
|
|
19
|
-
var(--
|
|
19
|
+
var(--dash-color) 0,
|
|
20
|
+
var(--dash-color) var(--dash-size),
|
|
20
21
|
transparent var(--dash-size),
|
|
21
|
-
transparent calc(var(--dash-size) + var(--dash-gap))
|
|
22
|
+
transparent calc(var(--dash-size) + var(--dash-gap))
|
|
22
23
|
)`,
|
|
23
24
|
},
|
|
24
25
|
},
|
|
@@ -76,7 +76,7 @@ export const inputChipSlotRecipe = defineSlotRecipe({
|
|
|
76
76
|
root: {
|
|
77
77
|
fontSize: "desktop.xs",
|
|
78
78
|
paddingX: "1.5",
|
|
79
|
-
|
|
79
|
+
height: 5,
|
|
80
80
|
fontWeight: "normal",
|
|
81
81
|
borderRadius: "xs",
|
|
82
82
|
},
|
|
@@ -85,17 +85,16 @@ export const inputChipSlotRecipe = defineSlotRecipe({
|
|
|
85
85
|
root: {
|
|
86
86
|
fontSize: "desktop.sm",
|
|
87
87
|
paddingX: "2",
|
|
88
|
-
|
|
88
|
+
height: 6,
|
|
89
89
|
fontWeight: "bold",
|
|
90
90
|
borderRadius: "9px",
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
93
|
md: {
|
|
94
94
|
root: {
|
|
95
|
-
padding: 5,
|
|
96
95
|
fontSize: "desktop.md",
|
|
97
96
|
paddingX: "2",
|
|
98
|
-
|
|
97
|
+
height: 7,
|
|
99
98
|
fontWeight: "bold",
|
|
100
99
|
borderRadius: "sm",
|
|
101
100
|
},
|
|
@@ -104,7 +103,7 @@ export const inputChipSlotRecipe = defineSlotRecipe({
|
|
|
104
103
|
root: {
|
|
105
104
|
fontSize: "desktop.md",
|
|
106
105
|
paddingX: "2",
|
|
107
|
-
|
|
106
|
+
height: "8",
|
|
108
107
|
fontWeight: "bold",
|
|
109
108
|
borderRadius: "md",
|
|
110
109
|
},
|
|
@@ -166,6 +166,11 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
166
166
|
outlineColor: "outline.error",
|
|
167
167
|
},
|
|
168
168
|
},
|
|
169
|
+
valueText: {
|
|
170
|
+
textOverflow: "ellipsis",
|
|
171
|
+
whiteSpace: "nowrap",
|
|
172
|
+
overflow: "hidden",
|
|
173
|
+
},
|
|
169
174
|
itemText: {
|
|
170
175
|
flex: "1",
|
|
171
176
|
alignItems: "center",
|
|
@@ -16,6 +16,7 @@ export const toastSlotRecipe = defineSlotRecipe({
|
|
|
16
16
|
translate: "var(--x) var(--y)",
|
|
17
17
|
opacity: "var(--opacity)",
|
|
18
18
|
willChange: "translate, opacity, scale",
|
|
19
|
+
outline: "1px solid",
|
|
19
20
|
|
|
20
21
|
borderRadius: "sm",
|
|
21
22
|
transition:
|
|
@@ -25,18 +26,54 @@ export const toastSlotRecipe = defineSlotRecipe({
|
|
|
25
26
|
transition: "translate 400ms, scale 400ms, opacity 200ms",
|
|
26
27
|
transitionTimingFunction: "cubic-bezier(0.06, 0.71, 0.55, 1)",
|
|
27
28
|
},
|
|
28
|
-
boxShadow: "
|
|
29
|
+
boxShadow: "sm",
|
|
29
30
|
|
|
30
31
|
color: "text",
|
|
31
32
|
"&[data-type=success]": {
|
|
32
33
|
backgroundColor: "surface.success",
|
|
34
|
+
outlineColor: "outline.success",
|
|
33
35
|
},
|
|
34
36
|
"&[data-type=error]": {
|
|
35
37
|
backgroundColor: "surface.critical",
|
|
38
|
+
outlineColor: "outline.critical",
|
|
36
39
|
},
|
|
37
40
|
|
|
38
41
|
"&[data-type=info]": {
|
|
39
42
|
backgroundColor: "surface.info",
|
|
43
|
+
outlineColor: "outline.info",
|
|
44
|
+
},
|
|
45
|
+
"&[data-inverted][data-type=success]": {
|
|
46
|
+
backgroundColor: { _light: "darkTeal", _dark: "seaMist" },
|
|
47
|
+
color: { _light: "mint", _dark: "jungle" },
|
|
48
|
+
outlineColor: { _light: "greenHaze", _dark: "coralGreen" },
|
|
49
|
+
"& path:first-of-type": {
|
|
50
|
+
fill: { _light: "mint", _dark: "jungle" },
|
|
51
|
+
},
|
|
52
|
+
"& path:not(:first-of-type)": {
|
|
53
|
+
fill: { _light: "darkTeal", _dark: "seaMist" },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
"&[data-inverted][data-type=error]": {
|
|
57
|
+
backgroundColor: { _light: "burgundy", _dark: "lightRed" },
|
|
58
|
+
color: { _light: "pink", _dark: "maroon" },
|
|
59
|
+
outlineColor: { _light: "crimson", _dark: "salmon" },
|
|
60
|
+
"& path:first-of-type": {
|
|
61
|
+
fill: { _light: "pink", _dark: "maroon" },
|
|
62
|
+
},
|
|
63
|
+
"& path:not(:first-of-type)": {
|
|
64
|
+
fill: { _light: "burgundy", _dark: "lightRed" },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
"&[data-inverted][data-type=info]": {
|
|
68
|
+
backgroundColor: { _light: "darkBlue", _dark: "lightBlue" },
|
|
69
|
+
color: { _light: "icyBlue", _dark: "royal" },
|
|
70
|
+
outlineColor: { _light: "ocean", _dark: "cloudy" },
|
|
71
|
+
"& path:first-of-type": {
|
|
72
|
+
fill: { _light: "icyBlue", _dark: "navy" },
|
|
73
|
+
},
|
|
74
|
+
"& path:not(:first-of-type)": {
|
|
75
|
+
fill: { _light: "darkBlue", _dark: "lightBlue" },
|
|
76
|
+
},
|
|
40
77
|
},
|
|
41
78
|
},
|
|
42
79
|
|
package/src/toast/toast.tsx
CHANGED
|
@@ -31,6 +31,7 @@ type ToastProps = {
|
|
|
31
31
|
id?: string;
|
|
32
32
|
action?: ToastAction;
|
|
33
33
|
closable?: boolean;
|
|
34
|
+
inverted?: boolean;
|
|
34
35
|
} & Pick<BoxProps, "width">;
|
|
35
36
|
|
|
36
37
|
export const createToast = ({
|
|
@@ -41,6 +42,7 @@ export const createToast = ({
|
|
|
41
42
|
width = "sm",
|
|
42
43
|
action,
|
|
43
44
|
closable = false,
|
|
45
|
+
inverted = false,
|
|
44
46
|
}: ToastProps) =>
|
|
45
47
|
toaster.create({
|
|
46
48
|
description: text,
|
|
@@ -48,7 +50,7 @@ export const createToast = ({
|
|
|
48
50
|
id: id ?? crypto.randomUUID(),
|
|
49
51
|
duration,
|
|
50
52
|
action,
|
|
51
|
-
meta: { width },
|
|
53
|
+
meta: { width, inverted },
|
|
52
54
|
closable: closable,
|
|
53
55
|
});
|
|
54
56
|
|
|
@@ -59,9 +61,7 @@ export const Toaster = () => {
|
|
|
59
61
|
{(toast) => (
|
|
60
62
|
<Toast.Root
|
|
61
63
|
width={{ md: toast.meta?.width }}
|
|
62
|
-
|
|
63
|
-
borderColor={`outline.${toast.type}`}
|
|
64
|
-
boxShadow="sm"
|
|
64
|
+
data-inverted={toast.meta?.inverted ? "" : undefined}
|
|
65
65
|
role="alert"
|
|
66
66
|
>
|
|
67
67
|
<AlertIcon variant={toast.type as Variant} />
|
|
@@ -69,8 +69,12 @@ export const Toaster = () => {
|
|
|
69
69
|
<Toast.Description>{toast.description}</Toast.Description>
|
|
70
70
|
</Stack>
|
|
71
71
|
{toast.action && (
|
|
72
|
-
<Toast.ActionTrigger
|
|
73
|
-
<Button
|
|
72
|
+
<Toast.ActionTrigger asChild>
|
|
73
|
+
<Button
|
|
74
|
+
variant="ghost"
|
|
75
|
+
size="xs"
|
|
76
|
+
onClick={toast.action.onClick}
|
|
77
|
+
>
|
|
74
78
|
{toast.action.label}
|
|
75
79
|
</Button>
|
|
76
80
|
</Toast.ActionTrigger>
|