@spark-ui/components 10.11.14 → 10.12.0
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/docgen.json +45 -7
- package/dist/tag/index.d.mts +3 -1
- package/dist/tag/index.d.ts +3 -1
- package/dist/tag/index.js +52 -38
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/index.mjs +39 -25
- package/dist/tag/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/docgen.json
CHANGED
|
@@ -41490,6 +41490,27 @@
|
|
|
41490
41490
|
]
|
|
41491
41491
|
}
|
|
41492
41492
|
},
|
|
41493
|
+
"size": {
|
|
41494
|
+
"defaultValue": {
|
|
41495
|
+
"value": "md"
|
|
41496
|
+
},
|
|
41497
|
+
"description": "",
|
|
41498
|
+
"name": "size",
|
|
41499
|
+
"declarations": [],
|
|
41500
|
+
"required": false,
|
|
41501
|
+
"type": {
|
|
41502
|
+
"name": "enum",
|
|
41503
|
+
"raw": "\"md\" | \"lg\"",
|
|
41504
|
+
"value": [
|
|
41505
|
+
{
|
|
41506
|
+
"value": "\"md\""
|
|
41507
|
+
},
|
|
41508
|
+
{
|
|
41509
|
+
"value": "\"lg\""
|
|
41510
|
+
}
|
|
41511
|
+
]
|
|
41512
|
+
}
|
|
41513
|
+
},
|
|
41493
41514
|
"intent": {
|
|
41494
41515
|
"defaultValue": {
|
|
41495
41516
|
"value": "basic"
|
|
@@ -41548,6 +41569,30 @@
|
|
|
41548
41569
|
]
|
|
41549
41570
|
}
|
|
41550
41571
|
},
|
|
41572
|
+
"shape": {
|
|
41573
|
+
"defaultValue": {
|
|
41574
|
+
"value": "pill"
|
|
41575
|
+
},
|
|
41576
|
+
"description": "",
|
|
41577
|
+
"name": "shape",
|
|
41578
|
+
"declarations": [],
|
|
41579
|
+
"required": false,
|
|
41580
|
+
"type": {
|
|
41581
|
+
"name": "enum",
|
|
41582
|
+
"raw": "\"square\" | \"rounded\" | \"pill\"",
|
|
41583
|
+
"value": [
|
|
41584
|
+
{
|
|
41585
|
+
"value": "\"square\""
|
|
41586
|
+
},
|
|
41587
|
+
{
|
|
41588
|
+
"value": "\"rounded\""
|
|
41589
|
+
},
|
|
41590
|
+
{
|
|
41591
|
+
"value": "\"pill\""
|
|
41592
|
+
}
|
|
41593
|
+
]
|
|
41594
|
+
}
|
|
41595
|
+
},
|
|
41551
41596
|
"ref": {
|
|
41552
41597
|
"defaultValue": null,
|
|
41553
41598
|
"description": "",
|
|
@@ -41569,13 +41614,6 @@
|
|
|
41569
41614
|
}
|
|
41570
41615
|
}
|
|
41571
41616
|
},
|
|
41572
|
-
"tw": {
|
|
41573
|
-
"tags": {},
|
|
41574
|
-
"description": "",
|
|
41575
|
-
"displayName": "tw",
|
|
41576
|
-
"methods": [],
|
|
41577
|
-
"props": {}
|
|
41578
|
-
},
|
|
41579
41617
|
"TextLink": {
|
|
41580
41618
|
"tags": {},
|
|
41581
41619
|
"description": "",
|
package/dist/tag/index.d.mts
CHANGED
|
@@ -5,6 +5,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
|
|
6
6
|
declare const tagStyles: (props?: ({
|
|
7
7
|
design?: "filled" | "outlined" | "tinted" | null | undefined;
|
|
8
|
+
size?: "md" | "lg" | null | undefined;
|
|
9
|
+
shape?: "square" | "rounded" | "pill" | null | undefined;
|
|
8
10
|
intent?: "main" | "alert" | "support" | "accent" | "basic" | "success" | "danger" | "info" | "neutral" | "surface" | null | undefined;
|
|
9
11
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
12
|
type TagStylesProps = VariantProps<typeof tagStyles>;
|
|
@@ -22,6 +24,6 @@ interface FilteredDesignIntent<Design extends TagProps['design'], K extends TagS
|
|
|
22
24
|
}
|
|
23
25
|
type ValidTagDesignIntent = FilteredDesignIntent<'tinted', 'surface'> | FilteredDesignIntent<'outlined', 'surface'> | FilteredDesignIntent<'filled'>;
|
|
24
26
|
type TagProps = BaseTagProps & ValidTagDesignIntent;
|
|
25
|
-
declare const Tag: ({ design, intent, asChild, className, ref, ...others }: TagProps) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare const Tag: ({ design, intent, size, shape, asChild, className, ref, ...others }: TagProps) => react_jsx_runtime.JSX.Element;
|
|
26
28
|
|
|
27
29
|
export { Tag, type TagProps, type ValidTagDesignIntent };
|
package/dist/tag/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
|
|
6
6
|
declare const tagStyles: (props?: ({
|
|
7
7
|
design?: "filled" | "outlined" | "tinted" | null | undefined;
|
|
8
|
+
size?: "md" | "lg" | null | undefined;
|
|
9
|
+
shape?: "square" | "rounded" | "pill" | null | undefined;
|
|
8
10
|
intent?: "main" | "alert" | "support" | "accent" | "basic" | "success" | "danger" | "info" | "neutral" | "surface" | null | undefined;
|
|
9
11
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
12
|
type TagStylesProps = VariantProps<typeof tagStyles>;
|
|
@@ -22,6 +24,6 @@ interface FilteredDesignIntent<Design extends TagProps['design'], K extends TagS
|
|
|
22
24
|
}
|
|
23
25
|
type ValidTagDesignIntent = FilteredDesignIntent<'tinted', 'surface'> | FilteredDesignIntent<'outlined', 'surface'> | FilteredDesignIntent<'filled'>;
|
|
24
26
|
type TagProps = BaseTagProps & ValidTagDesignIntent;
|
|
25
|
-
declare const Tag: ({ design, intent, asChild, className, ref, ...others }: TagProps) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare const Tag: ({ design, intent, size, shape, asChild, className, ref, ...others }: TagProps) => react_jsx_runtime.JSX.Element;
|
|
26
28
|
|
|
27
29
|
export { Tag, type TagProps, type ValidTagDesignIntent };
|
package/dist/tag/index.js
CHANGED
|
@@ -34,161 +34,161 @@ var Slot = ({ ref, ...props }) => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// src/tag/Tag.styles.tsx
|
|
37
|
-
var
|
|
37
|
+
var import_internal_utils4 = require("@spark-ui/internal-utils");
|
|
38
38
|
var import_class_variance_authority = require("class-variance-authority");
|
|
39
39
|
|
|
40
|
-
// src/tag/variants/default.ts
|
|
41
|
-
var tw = (a) => a;
|
|
42
|
-
|
|
43
40
|
// src/tag/variants/filled.ts
|
|
41
|
+
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
44
42
|
var filledVariants = [
|
|
45
43
|
{
|
|
46
44
|
intent: "main",
|
|
47
45
|
design: "filled",
|
|
48
|
-
class: tw(["bg-main", "text-on-main"])
|
|
46
|
+
class: (0, import_internal_utils.tw)(["bg-main", "text-on-main"])
|
|
49
47
|
},
|
|
50
48
|
{
|
|
51
49
|
intent: "support",
|
|
52
50
|
design: "filled",
|
|
53
|
-
class: tw(["bg-support", "text-on-support"])
|
|
51
|
+
class: (0, import_internal_utils.tw)(["bg-support", "text-on-support"])
|
|
54
52
|
},
|
|
55
53
|
{
|
|
56
54
|
intent: "accent",
|
|
57
55
|
design: "filled",
|
|
58
|
-
class: tw(["bg-accent", "text-on-accent"])
|
|
56
|
+
class: (0, import_internal_utils.tw)(["bg-accent", "text-on-accent"])
|
|
59
57
|
},
|
|
60
58
|
{
|
|
61
59
|
intent: "basic",
|
|
62
60
|
design: "filled",
|
|
63
|
-
class: tw(["bg-basic", "text-on-basic"])
|
|
61
|
+
class: (0, import_internal_utils.tw)(["bg-basic", "text-on-basic"])
|
|
64
62
|
},
|
|
65
63
|
{
|
|
66
64
|
intent: "success",
|
|
67
65
|
design: "filled",
|
|
68
|
-
class: tw(["bg-success", "text-on-success"])
|
|
66
|
+
class: (0, import_internal_utils.tw)(["bg-success", "text-on-success"])
|
|
69
67
|
},
|
|
70
68
|
{
|
|
71
69
|
intent: "alert",
|
|
72
70
|
design: "filled",
|
|
73
|
-
class: tw(["bg-alert", "text-on-alert"])
|
|
71
|
+
class: (0, import_internal_utils.tw)(["bg-alert", "text-on-alert"])
|
|
74
72
|
},
|
|
75
73
|
{
|
|
76
74
|
intent: "danger",
|
|
77
75
|
design: "filled",
|
|
78
|
-
class: tw(["bg-error", "text-on-error"])
|
|
76
|
+
class: (0, import_internal_utils.tw)(["bg-error", "text-on-error"])
|
|
79
77
|
},
|
|
80
78
|
{
|
|
81
79
|
intent: "info",
|
|
82
80
|
design: "filled",
|
|
83
|
-
class: tw(["bg-info", "text-on-info"])
|
|
81
|
+
class: (0, import_internal_utils.tw)(["bg-info", "text-on-info"])
|
|
84
82
|
},
|
|
85
83
|
{
|
|
86
84
|
intent: "neutral",
|
|
87
85
|
design: "filled",
|
|
88
|
-
class: tw(["bg-neutral", "text-on-neutral"])
|
|
86
|
+
class: (0, import_internal_utils.tw)(["bg-neutral", "text-on-neutral"])
|
|
89
87
|
},
|
|
90
88
|
{
|
|
91
89
|
intent: "surface",
|
|
92
90
|
design: "filled",
|
|
93
|
-
class: tw(["bg-surface", "text-on-surface"])
|
|
91
|
+
class: (0, import_internal_utils.tw)(["bg-surface", "text-on-surface"])
|
|
94
92
|
}
|
|
95
93
|
];
|
|
96
94
|
|
|
97
95
|
// src/tag/variants/outlined.ts
|
|
96
|
+
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
98
97
|
var outlinedVariants = [
|
|
99
98
|
{
|
|
100
99
|
intent: "main",
|
|
101
100
|
design: "outlined",
|
|
102
|
-
class: tw(["text-main"])
|
|
101
|
+
class: (0, import_internal_utils2.tw)(["text-main"])
|
|
103
102
|
},
|
|
104
103
|
{
|
|
105
104
|
intent: "support",
|
|
106
105
|
design: "outlined",
|
|
107
|
-
class: tw(["text-support"])
|
|
106
|
+
class: (0, import_internal_utils2.tw)(["text-support"])
|
|
108
107
|
},
|
|
109
108
|
{
|
|
110
109
|
intent: "accent",
|
|
111
110
|
design: "outlined",
|
|
112
|
-
class: tw(["text-accent"])
|
|
111
|
+
class: (0, import_internal_utils2.tw)(["text-accent"])
|
|
113
112
|
},
|
|
114
113
|
{
|
|
115
114
|
intent: "basic",
|
|
116
115
|
design: "outlined",
|
|
117
|
-
class: tw(["text-basic"])
|
|
116
|
+
class: (0, import_internal_utils2.tw)(["text-basic"])
|
|
118
117
|
},
|
|
119
118
|
{
|
|
120
119
|
intent: "success",
|
|
121
120
|
design: "outlined",
|
|
122
|
-
class: tw(["text-success"])
|
|
121
|
+
class: (0, import_internal_utils2.tw)(["text-success"])
|
|
123
122
|
},
|
|
124
123
|
{
|
|
125
124
|
intent: "alert",
|
|
126
125
|
design: "outlined",
|
|
127
|
-
class: tw(["text-alert"])
|
|
126
|
+
class: (0, import_internal_utils2.tw)(["text-alert"])
|
|
128
127
|
},
|
|
129
128
|
{
|
|
130
129
|
intent: "danger",
|
|
131
130
|
design: "outlined",
|
|
132
|
-
class: tw(["text-error"])
|
|
131
|
+
class: (0, import_internal_utils2.tw)(["text-error"])
|
|
133
132
|
},
|
|
134
133
|
{
|
|
135
134
|
intent: "info",
|
|
136
135
|
design: "outlined",
|
|
137
|
-
class: tw(["text-info"])
|
|
136
|
+
class: (0, import_internal_utils2.tw)(["text-info"])
|
|
138
137
|
},
|
|
139
138
|
{
|
|
140
139
|
intent: "neutral",
|
|
141
140
|
design: "outlined",
|
|
142
|
-
class: tw(["text-neutral"])
|
|
141
|
+
class: (0, import_internal_utils2.tw)(["text-neutral"])
|
|
143
142
|
}
|
|
144
143
|
];
|
|
145
144
|
|
|
146
145
|
// src/tag/variants/tinted.ts
|
|
146
|
+
var import_internal_utils3 = require("@spark-ui/internal-utils");
|
|
147
147
|
var tintedVariants = [
|
|
148
148
|
{
|
|
149
149
|
intent: "main",
|
|
150
150
|
design: "tinted",
|
|
151
|
-
class: tw(["bg-main-container", "text-on-main-container"])
|
|
151
|
+
class: (0, import_internal_utils3.tw)(["bg-main-container", "text-on-main-container"])
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
intent: "support",
|
|
155
155
|
design: "tinted",
|
|
156
|
-
class: tw(["bg-support-container", "text-on-support-container"])
|
|
156
|
+
class: (0, import_internal_utils3.tw)(["bg-support-container", "text-on-support-container"])
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
intent: "accent",
|
|
160
160
|
design: "tinted",
|
|
161
|
-
class: tw(["bg-accent-container", "text-on-accent-container"])
|
|
161
|
+
class: (0, import_internal_utils3.tw)(["bg-accent-container", "text-on-accent-container"])
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
intent: "basic",
|
|
165
165
|
design: "tinted",
|
|
166
|
-
class: tw(["bg-basic-container", "text-on-basic-container"])
|
|
166
|
+
class: (0, import_internal_utils3.tw)(["bg-basic-container", "text-on-basic-container"])
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
intent: "success",
|
|
170
170
|
design: "tinted",
|
|
171
|
-
class: tw(["bg-success-container", "text-on-success-container"])
|
|
171
|
+
class: (0, import_internal_utils3.tw)(["bg-success-container", "text-on-success-container"])
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
174
|
intent: "alert",
|
|
175
175
|
design: "tinted",
|
|
176
|
-
class: tw(["bg-alert-container", "text-on-alert-container"])
|
|
176
|
+
class: (0, import_internal_utils3.tw)(["bg-alert-container", "text-on-alert-container"])
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
intent: "danger",
|
|
180
180
|
design: "tinted",
|
|
181
|
-
class: tw(["bg-error-container", "text-on-error-container"])
|
|
181
|
+
class: (0, import_internal_utils3.tw)(["bg-error-container", "text-on-error-container"])
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
intent: "info",
|
|
185
185
|
design: "tinted",
|
|
186
|
-
class: tw(["bg-info-container", "text-on-info-container"])
|
|
186
|
+
class: (0, import_internal_utils3.tw)(["bg-info-container", "text-on-info-container"])
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
intent: "neutral",
|
|
190
190
|
design: "tinted",
|
|
191
|
-
class: tw(["bg-neutral-container", "text-on-neutral-container"])
|
|
191
|
+
class: (0, import_internal_utils3.tw)(["bg-neutral-container", "text-on-neutral-container"])
|
|
192
192
|
}
|
|
193
193
|
];
|
|
194
194
|
|
|
@@ -197,8 +197,7 @@ var tagStyles = (0, import_class_variance_authority.cva)(
|
|
|
197
197
|
[
|
|
198
198
|
"box-border inline-flex items-center justify-center gap-sm whitespace-nowrap",
|
|
199
199
|
"text-caption font-bold",
|
|
200
|
-
"
|
|
201
|
-
"rounded-full"
|
|
200
|
+
"px-md"
|
|
202
201
|
],
|
|
203
202
|
{
|
|
204
203
|
variants: {
|
|
@@ -208,15 +207,24 @@ var tagStyles = (0, import_class_variance_authority.cva)(
|
|
|
208
207
|
* - `outlined`: Tag will have a surface background with an colored outline/text.
|
|
209
208
|
* - `tinted`: Tag will be filled but using a lighter color scheme.
|
|
210
209
|
*/
|
|
211
|
-
design: (0,
|
|
210
|
+
design: (0, import_internal_utils4.makeVariants)({
|
|
212
211
|
filled: [],
|
|
213
212
|
outlined: ["border-sm", "border-current"],
|
|
214
213
|
tinted: []
|
|
215
214
|
}),
|
|
215
|
+
size: (0, import_internal_utils4.makeVariants)({
|
|
216
|
+
md: ["h-sz-20"],
|
|
217
|
+
lg: ["h-sz-24"]
|
|
218
|
+
}),
|
|
219
|
+
shape: (0, import_internal_utils4.makeVariants)({
|
|
220
|
+
square: [],
|
|
221
|
+
rounded: ["rounded-md"],
|
|
222
|
+
pill: ["rounded-full"]
|
|
223
|
+
}),
|
|
216
224
|
/**
|
|
217
225
|
* Color scheme of the tag.
|
|
218
226
|
*/
|
|
219
|
-
intent: (0,
|
|
227
|
+
intent: (0, import_internal_utils4.makeVariants)({
|
|
220
228
|
main: [],
|
|
221
229
|
support: [],
|
|
222
230
|
accent: [],
|
|
@@ -232,7 +240,9 @@ var tagStyles = (0, import_class_variance_authority.cva)(
|
|
|
232
240
|
compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],
|
|
233
241
|
defaultVariants: {
|
|
234
242
|
design: "filled",
|
|
235
|
-
intent: "basic"
|
|
243
|
+
intent: "basic",
|
|
244
|
+
size: "md",
|
|
245
|
+
shape: "pill"
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
248
|
);
|
|
@@ -242,6 +252,8 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
242
252
|
var Tag = ({
|
|
243
253
|
design = "filled",
|
|
244
254
|
intent = "basic",
|
|
255
|
+
size = "md",
|
|
256
|
+
shape = "pill",
|
|
245
257
|
asChild,
|
|
246
258
|
className,
|
|
247
259
|
ref,
|
|
@@ -256,7 +268,9 @@ var Tag = ({
|
|
|
256
268
|
className: tagStyles({
|
|
257
269
|
className,
|
|
258
270
|
design,
|
|
259
|
-
intent
|
|
271
|
+
intent,
|
|
272
|
+
size,
|
|
273
|
+
shape
|
|
260
274
|
}),
|
|
261
275
|
...others
|
|
262
276
|
}
|
package/dist/tag/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tag/index.ts","../../src/slot/Slot.tsx","../../src/tag/Tag.styles.tsx","../../src/tag/variants/default.ts","../../src/tag/variants/filled.ts","../../src/tag/variants/outlined.ts","../../src/tag/variants/tinted.ts","../../src/tag/Tag.tsx"],"sourcesContent":["export * from './Tag'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, outlinedVariants, tintedVariants } from './variants'\n\nexport const tagStyles = cva(\n [\n 'box-border inline-flex items-center justify-center gap-sm whitespace-nowrap',\n 'text-caption font-bold',\n 'h-sz-20 px-md',\n 'rounded-full',\n ],\n {\n variants: {\n /**\n * Main style of the tag.\n * - `filled`: Tag will be plain.\n * - `outlined`: Tag will have a surface background with an colored outline/text.\n * - `tinted`: Tag will be filled but using a lighter color scheme.\n */\n design: makeVariants<'design', ['filled', 'outlined', 'tinted']>({\n filled: [],\n outlined: ['border-sm', 'border-current'],\n tinted: [],\n }),\n /**\n * Color scheme of the tag.\n */\n intent: makeVariants<\n 'intent',\n [\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'info',\n 'neutral',\n 'danger',\n 'surface',\n ]\n >({\n main: [],\n support: [],\n accent: [],\n basic: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'basic',\n },\n }\n)\n\nexport type TagStylesProps = VariantProps<typeof tagStyles>\n","export const tw = <T>(a: T): T => a\n","import { tw } from './default'\n\nexport const filledVariants = [\n {\n intent: 'main',\n design: 'filled',\n class: tw(['bg-main', 'text-on-main']),\n },\n {\n intent: 'support',\n design: 'filled',\n class: tw(['bg-support', 'text-on-support']),\n },\n {\n intent: 'accent',\n design: 'filled',\n class: tw(['bg-accent', 'text-on-accent']),\n },\n {\n intent: 'basic',\n design: 'filled',\n class: tw(['bg-basic', 'text-on-basic']),\n },\n {\n intent: 'success',\n design: 'filled',\n class: tw(['bg-success', 'text-on-success']),\n },\n {\n intent: 'alert',\n design: 'filled',\n class: tw(['bg-alert', 'text-on-alert']),\n },\n {\n intent: 'danger',\n design: 'filled',\n class: tw(['bg-error', 'text-on-error']),\n },\n {\n intent: 'info',\n design: 'filled',\n class: tw(['bg-info', 'text-on-info']),\n },\n {\n intent: 'neutral',\n design: 'filled',\n class: tw(['bg-neutral', 'text-on-neutral']),\n },\n {\n intent: 'surface',\n design: 'filled',\n class: tw(['bg-surface', 'text-on-surface']),\n },\n] as const\n","import { tw } from './default'\n\nexport const outlinedVariants = [\n {\n intent: 'main',\n design: 'outlined',\n class: tw(['text-main']),\n },\n {\n intent: 'support',\n design: 'outlined',\n class: tw(['text-support']),\n },\n {\n intent: 'accent',\n design: 'outlined',\n class: tw(['text-accent']),\n },\n {\n intent: 'basic',\n design: 'outlined',\n class: tw(['text-basic']),\n },\n {\n intent: 'success',\n design: 'outlined',\n class: tw(['text-success']),\n },\n {\n intent: 'alert',\n design: 'outlined',\n class: tw(['text-alert']),\n },\n {\n intent: 'danger',\n design: 'outlined',\n class: tw(['text-error']),\n },\n {\n intent: 'info',\n design: 'outlined',\n class: tw(['text-info']),\n },\n {\n intent: 'neutral',\n design: 'outlined',\n class: tw(['text-neutral']),\n },\n] as const\n","import { tw } from './default'\n\nexport const tintedVariants = [\n {\n intent: 'main',\n design: 'tinted',\n class: tw(['bg-main-container', 'text-on-main-container']),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw(['bg-support-container', 'text-on-support-container']),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw(['bg-accent-container', 'text-on-accent-container']),\n },\n {\n intent: 'basic',\n design: 'tinted',\n class: tw(['bg-basic-container', 'text-on-basic-container']),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw(['bg-success-container', 'text-on-success-container']),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw(['bg-alert-container', 'text-on-alert-container']),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw(['bg-error-container', 'text-on-error-container']),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw(['bg-info-container', 'text-on-info-container']),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw(['bg-neutral-container', 'text-on-neutral-container']),\n },\n] as const\n","import { ButtonHTMLAttributes, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { tagStyles, type TagStylesProps } from './Tag.styles'\n\ninterface BaseTagProps\n extends PropsWithChildren<ButtonHTMLAttributes<HTMLSpanElement>>,\n TagStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n}\n\ninterface FilteredDesignIntent<\n Design extends TagProps['design'],\n K extends TagStylesProps['intent'] | never = never,\n> {\n design?: Design\n intent?: Exclude<TagStylesProps['intent'], K>\n ref?: Ref<HTMLButtonElement>\n}\n\nexport type ValidTagDesignIntent =\n | FilteredDesignIntent<'tinted', 'surface'>\n | FilteredDesignIntent<'outlined', 'surface'>\n | FilteredDesignIntent<'filled'>\n\nexport type TagProps = BaseTagProps & ValidTagDesignIntent\n\nexport const Tag = ({\n design = 'filled',\n intent = 'basic',\n asChild,\n className,\n ref,\n ...others\n}: TagProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n data-spark-component=\"tag\"\n ref={ref}\n className={tagStyles({\n className,\n design,\n intent,\n })}\n {...others}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAA,KAAU;AAMxD,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW,GAAG,OAAO;AAC9C;;;AClBA,4BAA6B;AAC7B,sCAAkC;;;ACD3B,IAAM,KAAK,CAAI,MAAY;;;ACE3B,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,WAAW,cAAc,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,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;AAXG,IAAM,MAAM,CAAC;AAAA,EAClB,SAAS;AAAA,EACT,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgB;AACd,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA,WAAW,UAAU;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEJ;","names":["RadixSlot","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/tag/index.ts","../../src/slot/Slot.tsx","../../src/tag/Tag.styles.tsx","../../src/tag/variants/filled.ts","../../src/tag/variants/outlined.ts","../../src/tag/variants/tinted.ts","../../src/tag/Tag.tsx"],"sourcesContent":["export * from './Tag'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, outlinedVariants, tintedVariants } from './variants'\n\nexport const tagStyles = cva(\n [\n 'box-border inline-flex items-center justify-center gap-sm whitespace-nowrap',\n 'text-caption font-bold',\n 'px-md',\n ],\n {\n variants: {\n /**\n * Main style of the tag.\n * - `filled`: Tag will be plain.\n * - `outlined`: Tag will have a surface background with an colored outline/text.\n * - `tinted`: Tag will be filled but using a lighter color scheme.\n */\n design: makeVariants<'design', ['filled', 'outlined', 'tinted']>({\n filled: [],\n outlined: ['border-sm', 'border-current'],\n tinted: [],\n }),\n size: makeVariants<'size', ['md', 'lg']>({\n md: ['h-sz-20'],\n lg: ['h-sz-24'],\n }),\n shape: makeVariants<'shape', ['square', 'rounded', 'pill']>({\n square: [],\n rounded: ['rounded-md'],\n pill: ['rounded-full'],\n }),\n /**\n * Color scheme of the tag.\n */\n intent: makeVariants<\n 'intent',\n [\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'info',\n 'neutral',\n 'danger',\n 'surface',\n ]\n >({\n main: [],\n support: [],\n accent: [],\n basic: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'basic',\n size: 'md',\n shape: 'pill',\n },\n }\n)\n\nexport type TagStylesProps = VariantProps<typeof tagStyles>\n","import { tw } from '@spark-ui/internal-utils'\n\nexport const filledVariants = [\n {\n intent: 'main',\n design: 'filled',\n class: tw(['bg-main', 'text-on-main']),\n },\n {\n intent: 'support',\n design: 'filled',\n class: tw(['bg-support', 'text-on-support']),\n },\n {\n intent: 'accent',\n design: 'filled',\n class: tw(['bg-accent', 'text-on-accent']),\n },\n {\n intent: 'basic',\n design: 'filled',\n class: tw(['bg-basic', 'text-on-basic']),\n },\n {\n intent: 'success',\n design: 'filled',\n class: tw(['bg-success', 'text-on-success']),\n },\n {\n intent: 'alert',\n design: 'filled',\n class: tw(['bg-alert', 'text-on-alert']),\n },\n {\n intent: 'danger',\n design: 'filled',\n class: tw(['bg-error', 'text-on-error']),\n },\n {\n intent: 'info',\n design: 'filled',\n class: tw(['bg-info', 'text-on-info']),\n },\n {\n intent: 'neutral',\n design: 'filled',\n class: tw(['bg-neutral', 'text-on-neutral']),\n },\n {\n intent: 'surface',\n design: 'filled',\n class: tw(['bg-surface', 'text-on-surface']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\n\nexport const outlinedVariants = [\n {\n intent: 'main',\n design: 'outlined',\n class: tw(['text-main']),\n },\n {\n intent: 'support',\n design: 'outlined',\n class: tw(['text-support']),\n },\n {\n intent: 'accent',\n design: 'outlined',\n class: tw(['text-accent']),\n },\n {\n intent: 'basic',\n design: 'outlined',\n class: tw(['text-basic']),\n },\n {\n intent: 'success',\n design: 'outlined',\n class: tw(['text-success']),\n },\n {\n intent: 'alert',\n design: 'outlined',\n class: tw(['text-alert']),\n },\n {\n intent: 'danger',\n design: 'outlined',\n class: tw(['text-error']),\n },\n {\n intent: 'info',\n design: 'outlined',\n class: tw(['text-info']),\n },\n {\n intent: 'neutral',\n design: 'outlined',\n class: tw(['text-neutral']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\n\nexport const tintedVariants = [\n {\n intent: 'main',\n design: 'tinted',\n class: tw(['bg-main-container', 'text-on-main-container']),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw(['bg-support-container', 'text-on-support-container']),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw(['bg-accent-container', 'text-on-accent-container']),\n },\n {\n intent: 'basic',\n design: 'tinted',\n class: tw(['bg-basic-container', 'text-on-basic-container']),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw(['bg-success-container', 'text-on-success-container']),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw(['bg-alert-container', 'text-on-alert-container']),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw(['bg-error-container', 'text-on-error-container']),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw(['bg-info-container', 'text-on-info-container']),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw(['bg-neutral-container', 'text-on-neutral-container']),\n },\n] as const\n","import { ButtonHTMLAttributes, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { tagStyles, type TagStylesProps } from './Tag.styles'\n\ninterface BaseTagProps\n extends PropsWithChildren<ButtonHTMLAttributes<HTMLSpanElement>>,\n TagStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n}\n\ninterface FilteredDesignIntent<\n Design extends TagProps['design'],\n K extends TagStylesProps['intent'] | never = never,\n> {\n design?: Design\n intent?: Exclude<TagStylesProps['intent'], K>\n ref?: Ref<HTMLButtonElement>\n}\n\nexport type ValidTagDesignIntent =\n | FilteredDesignIntent<'tinted', 'surface'>\n | FilteredDesignIntent<'outlined', 'surface'>\n | FilteredDesignIntent<'filled'>\n\nexport type TagProps = BaseTagProps & ValidTagDesignIntent\n\nexport const Tag = ({\n design = 'filled',\n intent = 'basic',\n size = 'md',\n shape = 'pill',\n asChild,\n className,\n ref,\n ...others\n}: TagProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n data-spark-component=\"tag\"\n ref={ref}\n className={tagStyles({\n className,\n design,\n intent,\n size,\n shape,\n })}\n {...others}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAA,KAAU;AAMxD,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW,GAAG,OAAO;AAC9C;;;AClBA,IAAAC,yBAA6B;AAC7B,sCAAkC;;;ACDlC,4BAAmB;AAEZ,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAO,0BAAG,CAAC,WAAW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AA,QACR,SAAS,CAAC;AAAA,QACV,OAAO,CAAC;AAAA,QACR,QAAQ,CAAC;AAAA,QACT,MAAM,CAAC;AAAA,QACP,SAAS,CAAC;AAAA,QACV,SAAS,CAAC;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,IACA,kBAAkB,CAAC,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,cAAc;AAAA,IAC5E,iBAAiB;AAAA,MACf,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;;;AI5BI,IAAAC,sBAAA;AAbG,IAAM,MAAM,CAAC;AAAA,EAClB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgB;AACd,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA,WAAW,UAAU;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEJ;","names":["RadixSlot","import_internal_utils","import_internal_utils","import_internal_utils","import_jsx_runtime"]}
|
package/dist/tag/index.mjs
CHANGED
|
@@ -6,10 +6,8 @@ import {
|
|
|
6
6
|
import { makeVariants } from "@spark-ui/internal-utils";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
8
8
|
|
|
9
|
-
// src/tag/variants/default.ts
|
|
10
|
-
var tw = (a) => a;
|
|
11
|
-
|
|
12
9
|
// src/tag/variants/filled.ts
|
|
10
|
+
import { tw } from "@spark-ui/internal-utils";
|
|
13
11
|
var filledVariants = [
|
|
14
12
|
{
|
|
15
13
|
intent: "main",
|
|
@@ -64,100 +62,102 @@ var filledVariants = [
|
|
|
64
62
|
];
|
|
65
63
|
|
|
66
64
|
// src/tag/variants/outlined.ts
|
|
65
|
+
import { tw as tw2 } from "@spark-ui/internal-utils";
|
|
67
66
|
var outlinedVariants = [
|
|
68
67
|
{
|
|
69
68
|
intent: "main",
|
|
70
69
|
design: "outlined",
|
|
71
|
-
class:
|
|
70
|
+
class: tw2(["text-main"])
|
|
72
71
|
},
|
|
73
72
|
{
|
|
74
73
|
intent: "support",
|
|
75
74
|
design: "outlined",
|
|
76
|
-
class:
|
|
75
|
+
class: tw2(["text-support"])
|
|
77
76
|
},
|
|
78
77
|
{
|
|
79
78
|
intent: "accent",
|
|
80
79
|
design: "outlined",
|
|
81
|
-
class:
|
|
80
|
+
class: tw2(["text-accent"])
|
|
82
81
|
},
|
|
83
82
|
{
|
|
84
83
|
intent: "basic",
|
|
85
84
|
design: "outlined",
|
|
86
|
-
class:
|
|
85
|
+
class: tw2(["text-basic"])
|
|
87
86
|
},
|
|
88
87
|
{
|
|
89
88
|
intent: "success",
|
|
90
89
|
design: "outlined",
|
|
91
|
-
class:
|
|
90
|
+
class: tw2(["text-success"])
|
|
92
91
|
},
|
|
93
92
|
{
|
|
94
93
|
intent: "alert",
|
|
95
94
|
design: "outlined",
|
|
96
|
-
class:
|
|
95
|
+
class: tw2(["text-alert"])
|
|
97
96
|
},
|
|
98
97
|
{
|
|
99
98
|
intent: "danger",
|
|
100
99
|
design: "outlined",
|
|
101
|
-
class:
|
|
100
|
+
class: tw2(["text-error"])
|
|
102
101
|
},
|
|
103
102
|
{
|
|
104
103
|
intent: "info",
|
|
105
104
|
design: "outlined",
|
|
106
|
-
class:
|
|
105
|
+
class: tw2(["text-info"])
|
|
107
106
|
},
|
|
108
107
|
{
|
|
109
108
|
intent: "neutral",
|
|
110
109
|
design: "outlined",
|
|
111
|
-
class:
|
|
110
|
+
class: tw2(["text-neutral"])
|
|
112
111
|
}
|
|
113
112
|
];
|
|
114
113
|
|
|
115
114
|
// src/tag/variants/tinted.ts
|
|
115
|
+
import { tw as tw3 } from "@spark-ui/internal-utils";
|
|
116
116
|
var tintedVariants = [
|
|
117
117
|
{
|
|
118
118
|
intent: "main",
|
|
119
119
|
design: "tinted",
|
|
120
|
-
class:
|
|
120
|
+
class: tw3(["bg-main-container", "text-on-main-container"])
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
intent: "support",
|
|
124
124
|
design: "tinted",
|
|
125
|
-
class:
|
|
125
|
+
class: tw3(["bg-support-container", "text-on-support-container"])
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
intent: "accent",
|
|
129
129
|
design: "tinted",
|
|
130
|
-
class:
|
|
130
|
+
class: tw3(["bg-accent-container", "text-on-accent-container"])
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
intent: "basic",
|
|
134
134
|
design: "tinted",
|
|
135
|
-
class:
|
|
135
|
+
class: tw3(["bg-basic-container", "text-on-basic-container"])
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
intent: "success",
|
|
139
139
|
design: "tinted",
|
|
140
|
-
class:
|
|
140
|
+
class: tw3(["bg-success-container", "text-on-success-container"])
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
intent: "alert",
|
|
144
144
|
design: "tinted",
|
|
145
|
-
class:
|
|
145
|
+
class: tw3(["bg-alert-container", "text-on-alert-container"])
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
intent: "danger",
|
|
149
149
|
design: "tinted",
|
|
150
|
-
class:
|
|
150
|
+
class: tw3(["bg-error-container", "text-on-error-container"])
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
intent: "info",
|
|
154
154
|
design: "tinted",
|
|
155
|
-
class:
|
|
155
|
+
class: tw3(["bg-info-container", "text-on-info-container"])
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
intent: "neutral",
|
|
159
159
|
design: "tinted",
|
|
160
|
-
class:
|
|
160
|
+
class: tw3(["bg-neutral-container", "text-on-neutral-container"])
|
|
161
161
|
}
|
|
162
162
|
];
|
|
163
163
|
|
|
@@ -166,8 +166,7 @@ var tagStyles = cva(
|
|
|
166
166
|
[
|
|
167
167
|
"box-border inline-flex items-center justify-center gap-sm whitespace-nowrap",
|
|
168
168
|
"text-caption font-bold",
|
|
169
|
-
"
|
|
170
|
-
"rounded-full"
|
|
169
|
+
"px-md"
|
|
171
170
|
],
|
|
172
171
|
{
|
|
173
172
|
variants: {
|
|
@@ -182,6 +181,15 @@ var tagStyles = cva(
|
|
|
182
181
|
outlined: ["border-sm", "border-current"],
|
|
183
182
|
tinted: []
|
|
184
183
|
}),
|
|
184
|
+
size: makeVariants({
|
|
185
|
+
md: ["h-sz-20"],
|
|
186
|
+
lg: ["h-sz-24"]
|
|
187
|
+
}),
|
|
188
|
+
shape: makeVariants({
|
|
189
|
+
square: [],
|
|
190
|
+
rounded: ["rounded-md"],
|
|
191
|
+
pill: ["rounded-full"]
|
|
192
|
+
}),
|
|
185
193
|
/**
|
|
186
194
|
* Color scheme of the tag.
|
|
187
195
|
*/
|
|
@@ -201,7 +209,9 @@ var tagStyles = cva(
|
|
|
201
209
|
compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],
|
|
202
210
|
defaultVariants: {
|
|
203
211
|
design: "filled",
|
|
204
|
-
intent: "basic"
|
|
212
|
+
intent: "basic",
|
|
213
|
+
size: "md",
|
|
214
|
+
shape: "pill"
|
|
205
215
|
}
|
|
206
216
|
}
|
|
207
217
|
);
|
|
@@ -211,6 +221,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
211
221
|
var Tag = ({
|
|
212
222
|
design = "filled",
|
|
213
223
|
intent = "basic",
|
|
224
|
+
size = "md",
|
|
225
|
+
shape = "pill",
|
|
214
226
|
asChild,
|
|
215
227
|
className,
|
|
216
228
|
ref,
|
|
@@ -225,7 +237,9 @@ var Tag = ({
|
|
|
225
237
|
className: tagStyles({
|
|
226
238
|
className,
|
|
227
239
|
design,
|
|
228
|
-
intent
|
|
240
|
+
intent,
|
|
241
|
+
size,
|
|
242
|
+
shape
|
|
229
243
|
}),
|
|
230
244
|
...others
|
|
231
245
|
}
|
package/dist/tag/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tag/Tag.styles.tsx","../../src/tag/variants/default.ts","../../src/tag/variants/filled.ts","../../src/tag/variants/outlined.ts","../../src/tag/variants/tinted.ts","../../src/tag/Tag.tsx"],"sourcesContent":["import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, outlinedVariants, tintedVariants } from './variants'\n\nexport const tagStyles = cva(\n [\n 'box-border inline-flex items-center justify-center gap-sm whitespace-nowrap',\n 'text-caption font-bold',\n 'h-sz-20 px-md',\n 'rounded-full',\n ],\n {\n variants: {\n /**\n * Main style of the tag.\n * - `filled`: Tag will be plain.\n * - `outlined`: Tag will have a surface background with an colored outline/text.\n * - `tinted`: Tag will be filled but using a lighter color scheme.\n */\n design: makeVariants<'design', ['filled', 'outlined', 'tinted']>({\n filled: [],\n outlined: ['border-sm', 'border-current'],\n tinted: [],\n }),\n /**\n * Color scheme of the tag.\n */\n intent: makeVariants<\n 'intent',\n [\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'info',\n 'neutral',\n 'danger',\n 'surface',\n ]\n >({\n main: [],\n support: [],\n accent: [],\n basic: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'basic',\n },\n }\n)\n\nexport type TagStylesProps = VariantProps<typeof tagStyles>\n","export const tw = <T>(a: T): T => a\n","import { tw } from './default'\n\nexport const filledVariants = [\n {\n intent: 'main',\n design: 'filled',\n class: tw(['bg-main', 'text-on-main']),\n },\n {\n intent: 'support',\n design: 'filled',\n class: tw(['bg-support', 'text-on-support']),\n },\n {\n intent: 'accent',\n design: 'filled',\n class: tw(['bg-accent', 'text-on-accent']),\n },\n {\n intent: 'basic',\n design: 'filled',\n class: tw(['bg-basic', 'text-on-basic']),\n },\n {\n intent: 'success',\n design: 'filled',\n class: tw(['bg-success', 'text-on-success']),\n },\n {\n intent: 'alert',\n design: 'filled',\n class: tw(['bg-alert', 'text-on-alert']),\n },\n {\n intent: 'danger',\n design: 'filled',\n class: tw(['bg-error', 'text-on-error']),\n },\n {\n intent: 'info',\n design: 'filled',\n class: tw(['bg-info', 'text-on-info']),\n },\n {\n intent: 'neutral',\n design: 'filled',\n class: tw(['bg-neutral', 'text-on-neutral']),\n },\n {\n intent: 'surface',\n design: 'filled',\n class: tw(['bg-surface', 'text-on-surface']),\n },\n] as const\n","import { tw } from './default'\n\nexport const outlinedVariants = [\n {\n intent: 'main',\n design: 'outlined',\n class: tw(['text-main']),\n },\n {\n intent: 'support',\n design: 'outlined',\n class: tw(['text-support']),\n },\n {\n intent: 'accent',\n design: 'outlined',\n class: tw(['text-accent']),\n },\n {\n intent: 'basic',\n design: 'outlined',\n class: tw(['text-basic']),\n },\n {\n intent: 'success',\n design: 'outlined',\n class: tw(['text-success']),\n },\n {\n intent: 'alert',\n design: 'outlined',\n class: tw(['text-alert']),\n },\n {\n intent: 'danger',\n design: 'outlined',\n class: tw(['text-error']),\n },\n {\n intent: 'info',\n design: 'outlined',\n class: tw(['text-info']),\n },\n {\n intent: 'neutral',\n design: 'outlined',\n class: tw(['text-neutral']),\n },\n] as const\n","import { tw } from './default'\n\nexport const tintedVariants = [\n {\n intent: 'main',\n design: 'tinted',\n class: tw(['bg-main-container', 'text-on-main-container']),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw(['bg-support-container', 'text-on-support-container']),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw(['bg-accent-container', 'text-on-accent-container']),\n },\n {\n intent: 'basic',\n design: 'tinted',\n class: tw(['bg-basic-container', 'text-on-basic-container']),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw(['bg-success-container', 'text-on-success-container']),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw(['bg-alert-container', 'text-on-alert-container']),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw(['bg-error-container', 'text-on-error-container']),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw(['bg-info-container', 'text-on-info-container']),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw(['bg-neutral-container', 'text-on-neutral-container']),\n },\n] as const\n","import { ButtonHTMLAttributes, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { tagStyles, type TagStylesProps } from './Tag.styles'\n\ninterface BaseTagProps\n extends PropsWithChildren<ButtonHTMLAttributes<HTMLSpanElement>>,\n TagStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n}\n\ninterface FilteredDesignIntent<\n Design extends TagProps['design'],\n K extends TagStylesProps['intent'] | never = never,\n> {\n design?: Design\n intent?: Exclude<TagStylesProps['intent'], K>\n ref?: Ref<HTMLButtonElement>\n}\n\nexport type ValidTagDesignIntent =\n | FilteredDesignIntent<'tinted', 'surface'>\n | FilteredDesignIntent<'outlined', 'surface'>\n | FilteredDesignIntent<'filled'>\n\nexport type TagProps = BaseTagProps & ValidTagDesignIntent\n\nexport const Tag = ({\n design = 'filled',\n intent = 'basic',\n asChild,\n className,\n ref,\n ...others\n}: TagProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n data-spark-component=\"tag\"\n ref={ref}\n className={tagStyles({\n className,\n design,\n intent,\n })}\n {...others}\n />\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAyB;;;ACD3B,IAAM,KAAK,CAAI,MAAY;;;ACE3B,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,WAAW,cAAc,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GA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ACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgB;AACd,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA,WAAW,UAAU;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/tag/Tag.styles.tsx","../../src/tag/variants/filled.ts","../../src/tag/variants/outlined.ts","../../src/tag/variants/tinted.ts","../../src/tag/Tag.tsx"],"sourcesContent":["import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, outlinedVariants, tintedVariants } from './variants'\n\nexport const tagStyles = cva(\n [\n 'box-border inline-flex items-center justify-center gap-sm whitespace-nowrap',\n 'text-caption font-bold',\n 'px-md',\n ],\n {\n variants: {\n /**\n * Main style of the tag.\n * - `filled`: Tag will be plain.\n * - `outlined`: Tag will have a surface background with an colored outline/text.\n * - `tinted`: Tag will be filled but using a lighter color scheme.\n */\n design: makeVariants<'design', ['filled', 'outlined', 'tinted']>({\n filled: [],\n outlined: ['border-sm', 'border-current'],\n tinted: [],\n }),\n size: makeVariants<'size', ['md', 'lg']>({\n md: ['h-sz-20'],\n lg: ['h-sz-24'],\n }),\n shape: makeVariants<'shape', ['square', 'rounded', 'pill']>({\n square: [],\n rounded: ['rounded-md'],\n pill: ['rounded-full'],\n }),\n /**\n * Color scheme of the tag.\n */\n intent: makeVariants<\n 'intent',\n [\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'info',\n 'neutral',\n 'danger',\n 'surface',\n ]\n >({\n main: [],\n support: [],\n accent: [],\n basic: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'basic',\n size: 'md',\n shape: 'pill',\n },\n }\n)\n\nexport type TagStylesProps = VariantProps<typeof tagStyles>\n","import { tw } from '@spark-ui/internal-utils'\n\nexport const filledVariants = [\n {\n intent: 'main',\n design: 'filled',\n class: tw(['bg-main', 'text-on-main']),\n },\n {\n intent: 'support',\n design: 'filled',\n class: tw(['bg-support', 'text-on-support']),\n },\n {\n intent: 'accent',\n design: 'filled',\n class: tw(['bg-accent', 'text-on-accent']),\n },\n {\n intent: 'basic',\n design: 'filled',\n class: tw(['bg-basic', 'text-on-basic']),\n },\n {\n intent: 'success',\n design: 'filled',\n class: tw(['bg-success', 'text-on-success']),\n },\n {\n intent: 'alert',\n design: 'filled',\n class: tw(['bg-alert', 'text-on-alert']),\n },\n {\n intent: 'danger',\n design: 'filled',\n class: tw(['bg-error', 'text-on-error']),\n },\n {\n intent: 'info',\n design: 'filled',\n class: tw(['bg-info', 'text-on-info']),\n },\n {\n intent: 'neutral',\n design: 'filled',\n class: tw(['bg-neutral', 'text-on-neutral']),\n },\n {\n intent: 'surface',\n design: 'filled',\n class: tw(['bg-surface', 'text-on-surface']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\n\nexport const outlinedVariants = [\n {\n intent: 'main',\n design: 'outlined',\n class: tw(['text-main']),\n },\n {\n intent: 'support',\n design: 'outlined',\n class: tw(['text-support']),\n },\n {\n intent: 'accent',\n design: 'outlined',\n class: tw(['text-accent']),\n },\n {\n intent: 'basic',\n design: 'outlined',\n class: tw(['text-basic']),\n },\n {\n intent: 'success',\n design: 'outlined',\n class: tw(['text-success']),\n },\n {\n intent: 'alert',\n design: 'outlined',\n class: tw(['text-alert']),\n },\n {\n intent: 'danger',\n design: 'outlined',\n class: tw(['text-error']),\n },\n {\n intent: 'info',\n design: 'outlined',\n class: tw(['text-info']),\n },\n {\n intent: 'neutral',\n design: 'outlined',\n class: tw(['text-neutral']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\n\nexport const tintedVariants = [\n {\n intent: 'main',\n design: 'tinted',\n class: tw(['bg-main-container', 'text-on-main-container']),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw(['bg-support-container', 'text-on-support-container']),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw(['bg-accent-container', 'text-on-accent-container']),\n },\n {\n intent: 'basic',\n design: 'tinted',\n class: tw(['bg-basic-container', 'text-on-basic-container']),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw(['bg-success-container', 'text-on-success-container']),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw(['bg-alert-container', 'text-on-alert-container']),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw(['bg-error-container', 'text-on-error-container']),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw(['bg-info-container', 'text-on-info-container']),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw(['bg-neutral-container', 'text-on-neutral-container']),\n },\n] as const\n","import { ButtonHTMLAttributes, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { tagStyles, type TagStylesProps } from './Tag.styles'\n\ninterface BaseTagProps\n extends PropsWithChildren<ButtonHTMLAttributes<HTMLSpanElement>>,\n TagStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n}\n\ninterface FilteredDesignIntent<\n Design extends TagProps['design'],\n K extends TagStylesProps['intent'] | never = never,\n> {\n design?: Design\n intent?: Exclude<TagStylesProps['intent'], K>\n ref?: Ref<HTMLButtonElement>\n}\n\nexport type ValidTagDesignIntent =\n | FilteredDesignIntent<'tinted', 'surface'>\n | FilteredDesignIntent<'outlined', 'surface'>\n | FilteredDesignIntent<'filled'>\n\nexport type TagProps = BaseTagProps & ValidTagDesignIntent\n\nexport const Tag = ({\n design = 'filled',\n intent = 'basic',\n size = 'md',\n shape = 'pill',\n asChild,\n className,\n ref,\n ...others\n}: TagProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n data-spark-component=\"tag\"\n ref={ref}\n className={tagStyles({\n className,\n design,\n intent,\n size,\n shape,\n })}\n {...others}\n />\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAyB;;;ACDlC,SAAS,UAAU;AAEZ,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,WAAW,cAAc,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,cAAc,iBAAiB,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,aAAa,gBAAgB,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,YAAY,eAAe,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,cAAc,iBAAiB,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,YAAY,eAAe,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,YAAY,eAAe,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,WAAW,cAAc,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,CAAC,cAAc,iBAAiB,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO,GAAG,C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AAAA,MACD,OAAO,aAAqD;AAAA,QAC1D,QAAQ,CAAC;AAAA,QACT,SAAS,CAAC,YAAY;AAAA,QACtB,MAAM,CAAC,cAAc;AAAA,MACvB,CAAC;AAAA;AAAA;AAAA;AAAA,MAID,QAAQ,aAcN;AAAA,QACA,MAAM,CAAC;AAAA,QACP,SAAS,CAAC;AAAA,QACV,QAAQ,CAAC;AAAA,QACT,OAAO,CAAC;AAAA,QACR,SAAS,CAAC;AAAA,QACV,OAAO,CAAC;AAAA,QACR,QAAQ,CAAC;AAAA,QACT,MAAM,CAAC;AAAA,QACP,SAAS,CAAC;AAAA,QACV,SAAS,CAAC;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,IACA,kBAAkB,CAAC,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,cAAc;AAAA,IAC5E,iBAAiB;AAAA,MACf,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;;;AI5BI;AAbG,IAAM,MAAM,CAAC;AAAA,EAClB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgB;AACd,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA,WAAW,UAAU;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEJ;","names":["tw","tw"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Spark (Leboncoin design system) components.",
|
|
6
6
|
"exports": {
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@react-aria/toast": "^3.0.0-beta.18",
|
|
54
54
|
"@react-stately/numberfield": "3.9.11",
|
|
55
55
|
"@react-stately/toast": "^3.0.0-beta.7",
|
|
56
|
-
"@spark-ui/hooks": "^10.
|
|
57
|
-
"@spark-ui/icons": "^10.
|
|
58
|
-
"@spark-ui/internal-utils": "^10.
|
|
56
|
+
"@spark-ui/hooks": "^10.12.0",
|
|
57
|
+
"@spark-ui/icons": "^10.12.0",
|
|
58
|
+
"@spark-ui/internal-utils": "^10.12.0",
|
|
59
59
|
"@zag-js/pagination": "1.14.0",
|
|
60
60
|
"@zag-js/react": "1.14.0",
|
|
61
61
|
"class-variance-authority": "0.7.1",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"url": "https://github.com/leboncoin/spark-web/issues?q=is%3Aopen+label%3A%22Component%3A+button%22"
|
|
83
83
|
},
|
|
84
84
|
"homepage": "https://sparkui.vercel.app",
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "a96c00c6af388248f768a69aebb341949f4f32e8"
|
|
86
86
|
}
|