@spark-ui/components 11.1.0 → 11.1.2
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/DialogTrigger-woU7vsJi.d.ts +142 -0
- package/dist/Input-N8AWWSmt.d.ts +41 -0
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +20 -0
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +19 -0
- package/dist/accordion/index.d.ts +73 -0
- package/dist/accordion/index.js +325 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/alert-dialog/index.d.ts +119 -0
- package/dist/alert-dialog/index.js +1554 -0
- package/dist/alert-dialog/index.js.map +1 -0
- package/dist/avatar/index.d.ts +66 -0
- package/dist/avatar/index.js +1303 -0
- package/dist/avatar/index.js.map +1 -0
- package/dist/badge/index.d.ts +47 -0
- package/dist/badge/index.js +122 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/breadcrumb/index.d.ts +64 -0
- package/dist/breadcrumb/index.js +327 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/button/index.d.ts +41 -0
- package/dist/button/index.js +935 -0
- package/dist/button/index.js.map +1 -0
- package/dist/card/index.d.ts +61 -0
- package/dist/card/index.js +502 -0
- package/dist/card/index.js.map +1 -0
- package/dist/carousel/index.d.ts +261 -0
- package/dist/carousel/index.js +1801 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/checkbox/index.d.ts +120 -0
- package/dist/checkbox/index.js +511 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/chip/index.d.ts +97 -0
- package/dist/chip/index.js +908 -0
- package/dist/chip/index.js.map +1 -0
- package/dist/collapsible/index.d.ts +43 -0
- package/dist/collapsible/index.js +109 -0
- package/dist/collapsible/index.js.map +1 -0
- package/dist/combobox/index.d.ts +287 -0
- package/dist/combobox/index.js +2588 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/dialog/index.d.ts +33 -0
- package/dist/dialog/index.js +1389 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/divider/index.d.ts +61 -0
- package/dist/divider/index.js +224 -0
- package/dist/divider/index.js.map +1 -0
- package/dist/drawer/index.d.ts +152 -0
- package/dist/drawer/index.js +1400 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/dropdown/index.d.ts +233 -0
- package/dist/dropdown/index.js +2051 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/form-field/index.d.ts +186 -0
- package/dist/form-field/index.js +553 -0
- package/dist/form-field/index.js.map +1 -0
- package/dist/icon/index.d.ts +28 -0
- package/dist/icon/index.js +127 -0
- package/dist/icon/index.js.map +1 -0
- package/dist/icon-button/index.d.ts +16 -0
- package/dist/icon-button/index.js +980 -0
- package/dist/icon-button/index.js.map +1 -0
- package/dist/input/index.d.ts +78 -0
- package/dist/input/index.js +724 -0
- package/dist/input/index.js.map +1 -0
- package/dist/kbd/index.d.ts +9 -0
- package/dist/kbd/index.js +47 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/label/index.d.ts +11 -0
- package/dist/label/index.js +78 -0
- package/dist/label/index.js.map +1 -0
- package/dist/link-box/index.d.ts +34 -0
- package/dist/link-box/index.js +92 -0
- package/dist/link-box/index.js.map +1 -0
- package/dist/pagination/index.d.ts +143 -0
- package/dist/pagination/index.js +1353 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/popover/index.d.ts +93 -0
- package/dist/popover/index.js +1339 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/portal/index.d.ts +13 -0
- package/dist/portal/index.js +37 -0
- package/dist/portal/index.js.map +1 -0
- package/dist/progress/index.d.ts +48 -0
- package/dist/progress/index.js +223 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress-tracker/index.d.ts +80 -0
- package/dist/progress-tracker/index.js +571 -0
- package/dist/progress-tracker/index.js.map +1 -0
- package/dist/radio-group/index.d.ts +100 -0
- package/dist/radio-group/index.js +318 -0
- package/dist/radio-group/index.js.map +1 -0
- package/dist/rating/index.d.ts +78 -0
- package/dist/rating/index.js +363 -0
- package/dist/rating/index.js.map +1 -0
- package/dist/scrolling-list/index.d.ts +118 -0
- package/dist/scrolling-list/index.js +1426 -0
- package/dist/scrolling-list/index.js.map +1 -0
- package/dist/segmented-gauge/index.d.ts +100 -0
- package/dist/segmented-gauge/index.js +277 -0
- package/dist/segmented-gauge/index.js.map +1 -0
- package/dist/select/index.d.ts +167 -0
- package/dist/select/index.js +581 -0
- package/dist/select/index.js.map +1 -0
- package/dist/skeleton/index.d.ts +67 -0
- package/dist/skeleton/index.js +206 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/slider/index.d.ts +97 -0
- package/dist/slider/index.js +220 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slot/index.d.ts +16 -0
- package/dist/slot/index.js +51 -0
- package/dist/slot/index.js.map +1 -0
- package/dist/snackbar/index.d.ts +158 -0
- package/dist/snackbar/index.js +1756 -0
- package/dist/snackbar/index.js.map +1 -0
- package/dist/spinner/index.d.mts +1 -1
- package/dist/spinner/index.d.ts +21 -0
- package/dist/spinner/index.js +139 -0
- package/dist/spinner/index.js.map +1 -0
- package/dist/stepper/index.d.ts +81 -0
- package/dist/stepper/index.js +1847 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/switch/index.d.ts +64 -0
- package/dist/switch/index.js +327 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/tabs/index.d.ts +103 -0
- package/dist/tabs/index.js +1376 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/tag/index.d.ts +29 -0
- package/dist/tag/index.js +283 -0
- package/dist/tag/index.js.map +1 -0
- package/dist/text-link/index.d.ts +20 -0
- package/dist/text-link/index.js +100 -0
- package/dist/text-link/index.js.map +1 -0
- package/dist/textarea/index.d.ts +57 -0
- package/dist/textarea/index.js +797 -0
- package/dist/textarea/index.js.map +1 -0
- package/dist/toast/index.d.ts +56 -0
- package/dist/toast/index.js +1412 -0
- package/dist/toast/index.js.map +1 -0
- package/dist/toast/index.mjs +1 -1
- package/dist/toast/index.mjs.map +1 -1
- package/dist/visually-hidden/index.d.ts +16 -0
- package/dist/visually-hidden/index.js +67 -0
- package/dist/visually-hidden/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,908 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/chip/index.ts
|
|
21
|
+
var chip_exports = {};
|
|
22
|
+
__export(chip_exports, {
|
|
23
|
+
Chip: () => Chip2
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(chip_exports);
|
|
26
|
+
|
|
27
|
+
// src/chip/Chip.styles.tsx
|
|
28
|
+
var import_internal_utils4 = require("@spark-ui/internal-utils");
|
|
29
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
30
|
+
|
|
31
|
+
// src/chip/variants/outlined.ts
|
|
32
|
+
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
33
|
+
var outlinedVariants = [
|
|
34
|
+
/** Intents **/
|
|
35
|
+
{
|
|
36
|
+
design: "outlined",
|
|
37
|
+
intent: "main",
|
|
38
|
+
class: (0, import_internal_utils.tw)([
|
|
39
|
+
"enabled:hover:bg-main/dim-5",
|
|
40
|
+
"enabled:active:bg-main/dim-5",
|
|
41
|
+
"focus-visible:bg-main/dim-5",
|
|
42
|
+
"aria-pressed:bg-main-container aria-pressed:text-on-main-container aria-pressed:enabled:hover:bg-main-container/dim-1",
|
|
43
|
+
"text-main"
|
|
44
|
+
])
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
design: "outlined",
|
|
48
|
+
intent: "support",
|
|
49
|
+
class: (0, import_internal_utils.tw)([
|
|
50
|
+
"enabled:hover:bg-support/dim-5",
|
|
51
|
+
"enabled:active:bg-support/dim-5",
|
|
52
|
+
"focus-visible:bg-support/dim-5",
|
|
53
|
+
"aria-pressed:bg-support-container aria-pressed:text-on-support-container aria-pressed:enabled:hover:bg-support-container/dim-1",
|
|
54
|
+
"text-support"
|
|
55
|
+
])
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
design: "outlined",
|
|
59
|
+
intent: "basic",
|
|
60
|
+
class: (0, import_internal_utils.tw)([
|
|
61
|
+
"enabled:hover:bg-basic/dim-5",
|
|
62
|
+
"enabled:active:bg-basic/dim-5",
|
|
63
|
+
"focus-visible:bg-basic/dim-5",
|
|
64
|
+
"aria-pressed:bg-basic-container aria-pressed:text-on-basic-container aria-pressed:enabled:hover:bg-basic-container/dim-1",
|
|
65
|
+
"text-basic"
|
|
66
|
+
])
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
intent: "accent",
|
|
70
|
+
design: "outlined",
|
|
71
|
+
class: (0, import_internal_utils.tw)([
|
|
72
|
+
"enabled:hover:bg-accent/dim-5",
|
|
73
|
+
"enabled:active:bg-accent/dim-5",
|
|
74
|
+
"focus-visible:bg-accent/dim-5",
|
|
75
|
+
"aria-pressed:bg-accent-container",
|
|
76
|
+
"aria-pressed:bg-accent-container aria-pressed:text-on-accent-container aria-pressed:enabled:hover:bg-accent-container/dim-1",
|
|
77
|
+
"text-accent"
|
|
78
|
+
])
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
design: "outlined",
|
|
82
|
+
intent: "success",
|
|
83
|
+
class: (0, import_internal_utils.tw)([
|
|
84
|
+
"enabled:hover:bg-success/dim-5",
|
|
85
|
+
"enabled:active:bg-success/dim-5",
|
|
86
|
+
"focus-visible:bg-success/dim-5",
|
|
87
|
+
"aria-pressed:bg-success-container aria-pressed:text-on-success-container aria-pressed:enabled:hover:bg-success-container/dim-1",
|
|
88
|
+
"text-success"
|
|
89
|
+
])
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
intent: "alert",
|
|
93
|
+
design: "outlined",
|
|
94
|
+
class: (0, import_internal_utils.tw)([
|
|
95
|
+
"enabled:hover:bg-alert/dim-5",
|
|
96
|
+
"enabled:active:bg-alert/dim-5",
|
|
97
|
+
"focus-visible:bg-alert/dim-5",
|
|
98
|
+
"aria-pressed:bg-alert-container aria-pressed:text-on-alert-container aria-pressed:enabled:hover:bg-alert-container/dim-1",
|
|
99
|
+
"text-alert"
|
|
100
|
+
])
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
design: "outlined",
|
|
104
|
+
intent: "danger",
|
|
105
|
+
class: (0, import_internal_utils.tw)([
|
|
106
|
+
"enabled:hover:bg-error/dim-5",
|
|
107
|
+
"enabled:active:bg-error/dim-5",
|
|
108
|
+
"focus-visible:bg-error/dim-5",
|
|
109
|
+
"aria-pressed:bg-error-container aria-pressed:text-on-error-container aria-pressed:enabled:hover:bg-error-container/dim-1",
|
|
110
|
+
"text-error"
|
|
111
|
+
])
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
design: "outlined",
|
|
115
|
+
intent: "info",
|
|
116
|
+
class: (0, import_internal_utils.tw)([
|
|
117
|
+
"enabled:hover:bg-info/dim-5",
|
|
118
|
+
"enabled:active:bg-info/dim-5",
|
|
119
|
+
"focus-visible:bg-info/dim-5",
|
|
120
|
+
"aria-pressed:bg-info-container aria-pressed:text-on-info-container aria-pressed:enabled:hover:bg-info-container/dim-1",
|
|
121
|
+
"text-info"
|
|
122
|
+
])
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
design: "outlined",
|
|
126
|
+
intent: "neutral",
|
|
127
|
+
class: (0, import_internal_utils.tw)([
|
|
128
|
+
"enabled:hover:bg-neutral/dim-5",
|
|
129
|
+
"enabled:active:bg-neutral/dim-5",
|
|
130
|
+
"focus-visible:bg-neutral/dim-5",
|
|
131
|
+
"aria-pressed:bg-neutral-container aria-pressed:text-on-neutral-container aria-pressed:enabled:hover:bg-neutral-container/dim-1",
|
|
132
|
+
"text-neutral"
|
|
133
|
+
])
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
design: "outlined",
|
|
137
|
+
intent: "surface",
|
|
138
|
+
class: (0, import_internal_utils.tw)([
|
|
139
|
+
"enabled:hover:bg-surface/dim-5",
|
|
140
|
+
"enabled:active:bg-surface/dim-5",
|
|
141
|
+
"focus-visible:bg-surface/dim-5",
|
|
142
|
+
"aria-pressed:bg-surface aria-pressed:text-on-surface aria-pressed:enabled:hover:bg-surface-hovered",
|
|
143
|
+
"text-surface"
|
|
144
|
+
])
|
|
145
|
+
},
|
|
146
|
+
/** Spacings **/
|
|
147
|
+
{
|
|
148
|
+
design: "outlined",
|
|
149
|
+
hasClearButton: false,
|
|
150
|
+
class: (0, import_internal_utils.tw)(["px-[calc(var(--spacing-md)-var(--border-width-sm))]"])
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
design: "outlined",
|
|
154
|
+
hasClearButton: true,
|
|
155
|
+
class: (0, import_internal_utils.tw)(["pl-[calc(var(--spacing-md)-var(--border-width-sm))]"])
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
// src/chip/variants/tinted.ts
|
|
160
|
+
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
161
|
+
var tintedVariants = [
|
|
162
|
+
/** Intents **/
|
|
163
|
+
{
|
|
164
|
+
intent: "main",
|
|
165
|
+
design: "tinted",
|
|
166
|
+
class: (0, import_internal_utils2.tw)([
|
|
167
|
+
"bg-main-container",
|
|
168
|
+
"enabled:hover:bg-main-container-hovered",
|
|
169
|
+
"enabled:active:bg-main-container-hovered",
|
|
170
|
+
"focus-visible:bg-main-container-hovered",
|
|
171
|
+
"aria-pressed:bg-main aria-pressed:text-on-main aria-pressed:enabled:hover:bg-main/dim-1",
|
|
172
|
+
"text-on-main-container"
|
|
173
|
+
])
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
intent: "support",
|
|
177
|
+
design: "tinted",
|
|
178
|
+
class: (0, import_internal_utils2.tw)([
|
|
179
|
+
"bg-support-container",
|
|
180
|
+
"enabled:hover:bg-support-container-hovered",
|
|
181
|
+
"enabled:active:bg-support-container-hovered",
|
|
182
|
+
"focus-visible:bg-support-container-hovered",
|
|
183
|
+
"aria-pressed:bg-support aria-pressed:text-on-support aria-pressed:enabled:hover:bg-support/dim-1",
|
|
184
|
+
"text-on-support-container"
|
|
185
|
+
])
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
intent: "basic",
|
|
189
|
+
design: "tinted",
|
|
190
|
+
class: (0, import_internal_utils2.tw)([
|
|
191
|
+
"bg-basic-container",
|
|
192
|
+
"enabled:hover:bg-basic-container-hovered",
|
|
193
|
+
"enabled:active:bg-basic-container-hovered",
|
|
194
|
+
"focus-visible:bg-basic-container-hovered",
|
|
195
|
+
"aria-pressed:bg-basic aria-pressed:text-on-basic aria-pressed:enabled:hover:bg-basic/dim-1",
|
|
196
|
+
"text-on-basic-container"
|
|
197
|
+
])
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
intent: "accent",
|
|
201
|
+
design: "tinted",
|
|
202
|
+
class: (0, import_internal_utils2.tw)([
|
|
203
|
+
"bg-accent-container",
|
|
204
|
+
"enabled:hover:bg-accent-container-hovered",
|
|
205
|
+
"enabled:active:bg-accent-container-hovered",
|
|
206
|
+
"focus-visible:bg-accent-container-hovered",
|
|
207
|
+
"aria-pressed:bg-accent aria-pressed:text-on-accent aria-pressed:enabled:hover:bg-accent/dim-1",
|
|
208
|
+
"text-on-accent-container"
|
|
209
|
+
])
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
intent: "success",
|
|
213
|
+
design: "tinted",
|
|
214
|
+
class: (0, import_internal_utils2.tw)([
|
|
215
|
+
"bg-success-container",
|
|
216
|
+
"enabled:hover:bg-success-container-hovered",
|
|
217
|
+
"enabled:active:bg-success-container-hovered",
|
|
218
|
+
"focus-visible:bg-success-container-hovered",
|
|
219
|
+
"aria-pressed:bg-success aria-pressed:text-on-success aria-pressed:enabled:hover:bg-success/dim-1",
|
|
220
|
+
"text-on-success-container"
|
|
221
|
+
])
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
intent: "alert",
|
|
225
|
+
design: "tinted",
|
|
226
|
+
class: (0, import_internal_utils2.tw)([
|
|
227
|
+
"bg-alert-container",
|
|
228
|
+
"enabled:hover:bg-alert-container-hovered",
|
|
229
|
+
"enabled:active:bg-alert-container-hovered",
|
|
230
|
+
"focus-visible:bg-alert-container-hovered",
|
|
231
|
+
"aria-pressed:bg-alert aria-pressed:text-on-alert aria-pressed:enabled:hover:bg-alert/dim-1",
|
|
232
|
+
"text-on-alert-container"
|
|
233
|
+
])
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
intent: "danger",
|
|
237
|
+
design: "tinted",
|
|
238
|
+
class: (0, import_internal_utils2.tw)([
|
|
239
|
+
"bg-error-container",
|
|
240
|
+
"enabled:hover:bg-error-container-hovered",
|
|
241
|
+
"enabled:active:bg-error-container-hovered",
|
|
242
|
+
"focus-visible:bg-error-container-hovered",
|
|
243
|
+
"aria-pressed:bg-error aria-pressed:text-on-error aria-pressed:enabled:hover:bg-error/dim-1",
|
|
244
|
+
"text-on-error-container"
|
|
245
|
+
])
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
intent: "info",
|
|
249
|
+
design: "tinted",
|
|
250
|
+
class: (0, import_internal_utils2.tw)([
|
|
251
|
+
"bg-info-container",
|
|
252
|
+
"enabled:hover:bg-info-container-hovered",
|
|
253
|
+
"enabled:active:bg-info-container-hovered",
|
|
254
|
+
"focus-visible:bg-info-container-hovered",
|
|
255
|
+
"aria-pressed:bg-info aria-pressed:text-on-info aria-pressed:enabled:hover:bg-info/dim-1",
|
|
256
|
+
"text-on-info-container"
|
|
257
|
+
])
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
intent: "neutral",
|
|
261
|
+
design: "tinted",
|
|
262
|
+
class: (0, import_internal_utils2.tw)([
|
|
263
|
+
"bg-neutral-container",
|
|
264
|
+
"enabled:hover:bg-neutral-container-hovered",
|
|
265
|
+
"enabled:active:bg-neutral-container-hovered",
|
|
266
|
+
"focus-visible:bg-neutral-container-hovered",
|
|
267
|
+
"aria-pressed:bg-neutral aria-pressed:text-on-neutral aria-pressed:enabled:hover:bg-neutral/dim-1",
|
|
268
|
+
"text-on-neutral-container"
|
|
269
|
+
])
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
intent: "surface",
|
|
273
|
+
design: "tinted",
|
|
274
|
+
class: (0, import_internal_utils2.tw)([
|
|
275
|
+
"bg-surface/dim-1",
|
|
276
|
+
"enabled:hover:bg-surface-hovered/dim-1",
|
|
277
|
+
"enabled:active:bg-surface-hovered/dim-1",
|
|
278
|
+
"focus-visible:bg-surface-hovered/dim-1",
|
|
279
|
+
"aria-pressed:bg-surface aria-pressed:text-on-surface aria-pressed:enabled:hover:bg-surface-hovered",
|
|
280
|
+
"text-on-surface/dim-1"
|
|
281
|
+
])
|
|
282
|
+
},
|
|
283
|
+
/** Spacings **/
|
|
284
|
+
{
|
|
285
|
+
design: "tinted",
|
|
286
|
+
hasClearButton: false,
|
|
287
|
+
class: (0, import_internal_utils2.tw)(["px-md"])
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
design: "tinted",
|
|
291
|
+
hasClearButton: true,
|
|
292
|
+
class: (0, import_internal_utils2.tw)(["pl-md"])
|
|
293
|
+
}
|
|
294
|
+
];
|
|
295
|
+
|
|
296
|
+
// src/chip/variants/dashed.ts
|
|
297
|
+
var import_internal_utils3 = require("@spark-ui/internal-utils");
|
|
298
|
+
var dashedVariants = [
|
|
299
|
+
/** Intents **/
|
|
300
|
+
{
|
|
301
|
+
intent: "main",
|
|
302
|
+
design: "dashed",
|
|
303
|
+
class: (0, import_internal_utils3.tw)([
|
|
304
|
+
"enabled:hover:bg-main/dim-5",
|
|
305
|
+
"enabled:active:bg-main/dim-5",
|
|
306
|
+
"focus-visible:bg-main/dim-5",
|
|
307
|
+
"aria-pressed:bg-main-container aria-pressed:text-on-main-container aria-pressed:enabled:hover:bg-main-container/dim-1",
|
|
308
|
+
"text-main"
|
|
309
|
+
])
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
intent: "support",
|
|
313
|
+
design: "dashed",
|
|
314
|
+
class: (0, import_internal_utils3.tw)([
|
|
315
|
+
"enabled:hover:bg-support/dim-5",
|
|
316
|
+
"enabled:active:bg-support/dim-5",
|
|
317
|
+
"focus-visible:bg-support/dim-5",
|
|
318
|
+
"aria-pressed:bg-support-container aria-pressed:text-on-support-container aria-pressed:enabled:hover:bg-support-container/dim-1",
|
|
319
|
+
"text-support"
|
|
320
|
+
])
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
intent: "basic",
|
|
324
|
+
design: "dashed",
|
|
325
|
+
class: (0, import_internal_utils3.tw)([
|
|
326
|
+
"enabled:hover:bg-basic/dim-5",
|
|
327
|
+
"enabled:active:bg-basic/dim-5",
|
|
328
|
+
"focus-visible:bg-basic/dim-5",
|
|
329
|
+
"aria-pressed:bg-basic-container aria-pressed:text-on-basic-container aria-pressed:enabled:hover:bg-basic-container/dim-1",
|
|
330
|
+
"text-basic"
|
|
331
|
+
])
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
intent: "accent",
|
|
335
|
+
design: "dashed",
|
|
336
|
+
class: (0, import_internal_utils3.tw)([
|
|
337
|
+
"enabled:hover:bg-accent/dim-5",
|
|
338
|
+
"enabled:active:bg-accent/dim-5",
|
|
339
|
+
"focus-visible:bg-accent/dim-5",
|
|
340
|
+
"aria-pressed:bg-accent-container aria-pressed:text-on-accent-container aria-pressed:enabled:hover:bg-accent-container/dim-1",
|
|
341
|
+
"text-accent"
|
|
342
|
+
])
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
intent: "success",
|
|
346
|
+
design: "dashed",
|
|
347
|
+
class: (0, import_internal_utils3.tw)([
|
|
348
|
+
"enabled:hover:bg-success/dim-5",
|
|
349
|
+
"enabled:active:bg-success/dim-5",
|
|
350
|
+
"focus-visible:bg-success/dim-5",
|
|
351
|
+
"aria-pressed:bg-success-container aria-pressed:text-on-success-container aria-pressed:enabled:hover:bg-success-container/dim-1",
|
|
352
|
+
"text-success"
|
|
353
|
+
])
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
intent: "alert",
|
|
357
|
+
design: "dashed",
|
|
358
|
+
class: (0, import_internal_utils3.tw)([
|
|
359
|
+
"enabled:hover:bg-alert/dim-5",
|
|
360
|
+
"enabled:active:bg-alert/dim-5",
|
|
361
|
+
"focus-visible:bg-alert/dim-5",
|
|
362
|
+
"aria-pressed:bg-alert-container aria-pressed:text-on-alert-container aria-pressed:enabled:hover:bg-alert-container/dim-1",
|
|
363
|
+
"text-alert"
|
|
364
|
+
])
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
intent: "danger",
|
|
368
|
+
design: "dashed",
|
|
369
|
+
class: (0, import_internal_utils3.tw)([
|
|
370
|
+
"enabled:hover:bg-error/dim-5",
|
|
371
|
+
"enabled:active:bg-error/dim-5",
|
|
372
|
+
"focus-visible:bg-error/dim-5",
|
|
373
|
+
"aria-pressed:bg-error-container aria-pressed:text-on-error-container aria-pressed:enabled:hover:bg-error-container/dim-1",
|
|
374
|
+
"text-error"
|
|
375
|
+
])
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
intent: "info",
|
|
379
|
+
design: "dashed",
|
|
380
|
+
class: (0, import_internal_utils3.tw)([
|
|
381
|
+
"enabled:hover:bg-info/dim-5",
|
|
382
|
+
"enabled:active:bg-info/dim-5",
|
|
383
|
+
"focus-visible:bg-info/dim-5",
|
|
384
|
+
"aria-pressed:bg-info-container aria-pressed:text-on-info-container aria-pressed:enabled:hover:bg-info-container/dim-1",
|
|
385
|
+
"text-info"
|
|
386
|
+
])
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
intent: "neutral",
|
|
390
|
+
design: "dashed",
|
|
391
|
+
class: (0, import_internal_utils3.tw)([
|
|
392
|
+
"enabled:hover:bg-neutral/dim-5",
|
|
393
|
+
"enabled:active:bg-neutral/dim-5",
|
|
394
|
+
"focus-visible:bg-neutral/dim-5",
|
|
395
|
+
"aria-pressed:bg-neutral-container aria-pressed:text-on-neutral-container aria-pressed:enabled:hover:bg-neutral-container/dim-1",
|
|
396
|
+
"text-neutral"
|
|
397
|
+
])
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
intent: "surface",
|
|
401
|
+
design: "dashed",
|
|
402
|
+
class: (0, import_internal_utils3.tw)([
|
|
403
|
+
"enabled:hover:bg-surface/dim-5",
|
|
404
|
+
"enabled:active:bg-surface/dim-5",
|
|
405
|
+
"focus-visible:bg-surface/dim-5",
|
|
406
|
+
"aria-pressed:bg-surface aria-pressed:text-on-surface aria-pressed:enabled:hover:bg-surface-hovered",
|
|
407
|
+
"text-surface"
|
|
408
|
+
])
|
|
409
|
+
},
|
|
410
|
+
/** Spacings **/
|
|
411
|
+
{
|
|
412
|
+
design: "dashed",
|
|
413
|
+
hasClearButton: false,
|
|
414
|
+
class: (0, import_internal_utils3.tw)(["px-[calc(var(--spacing-md)-var(--border-width-sm))]"])
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
design: "dashed",
|
|
418
|
+
hasClearButton: true,
|
|
419
|
+
class: (0, import_internal_utils3.tw)(["pl-[calc(var(--spacing-md)-var(--border-width-sm))]"])
|
|
420
|
+
}
|
|
421
|
+
];
|
|
422
|
+
|
|
423
|
+
// src/chip/Chip.styles.tsx
|
|
424
|
+
var chipStyles = (0, import_class_variance_authority.cva)(
|
|
425
|
+
[
|
|
426
|
+
"box-border inline-flex h-sz-32 flex-nowrap items-center justify-center rounded-md text-body-1 font-regular",
|
|
427
|
+
"focus-visible:u-outline",
|
|
428
|
+
"ease-out duration-150"
|
|
429
|
+
],
|
|
430
|
+
{
|
|
431
|
+
variants: {
|
|
432
|
+
/**
|
|
433
|
+
* Main style of the chip.
|
|
434
|
+
*
|
|
435
|
+
* - `filled`: Chip will be plain.
|
|
436
|
+
*
|
|
437
|
+
* - `outlined`: Chip will be transparent with an outline.
|
|
438
|
+
*
|
|
439
|
+
* - `tinted`: Chip will be filled but using a lighter color scheme.
|
|
440
|
+
*
|
|
441
|
+
* - `dashed`: Chip will be transparent with an outline dashed.
|
|
442
|
+
*/
|
|
443
|
+
design: (0, import_internal_utils4.makeVariants)({
|
|
444
|
+
outlined: ["bg-transparent border-sm border-solid border-current"],
|
|
445
|
+
tinted: [""],
|
|
446
|
+
dashed: [
|
|
447
|
+
"bg-transparent border-sm border-dashed shadow-none focus-visible:border-outline-high"
|
|
448
|
+
]
|
|
449
|
+
}),
|
|
450
|
+
/**
|
|
451
|
+
* Color scheme of the chip.
|
|
452
|
+
*/
|
|
453
|
+
intent: (0, import_internal_utils4.makeVariants)({
|
|
454
|
+
main: [],
|
|
455
|
+
support: [],
|
|
456
|
+
basic: [],
|
|
457
|
+
accent: [],
|
|
458
|
+
success: [],
|
|
459
|
+
alert: [],
|
|
460
|
+
danger: [],
|
|
461
|
+
info: [],
|
|
462
|
+
neutral: [],
|
|
463
|
+
surface: []
|
|
464
|
+
}),
|
|
465
|
+
/**
|
|
466
|
+
* Disable the chip, preventing user interaction and adding opacity.
|
|
467
|
+
*/
|
|
468
|
+
disabled: {
|
|
469
|
+
true: ["cursor-not-allowed", "opacity-dim-3"]
|
|
470
|
+
},
|
|
471
|
+
hasClearButton: {
|
|
472
|
+
true: [],
|
|
473
|
+
false: []
|
|
474
|
+
}
|
|
475
|
+
// 'pl-[calc(var(--spacing-md)-(var(--border-width-sm)))]'
|
|
476
|
+
},
|
|
477
|
+
compoundVariants: [...outlinedVariants, ...tintedVariants, ...dashedVariants],
|
|
478
|
+
defaultVariants: {
|
|
479
|
+
design: "outlined",
|
|
480
|
+
intent: "basic"
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
// src/chip/useChipContext.tsx
|
|
486
|
+
var import_react = require("react");
|
|
487
|
+
var ChipContext = (0, import_react.createContext)({});
|
|
488
|
+
var useChipContext = () => (0, import_react.useContext)(ChipContext) || {};
|
|
489
|
+
|
|
490
|
+
// src/chip/useChipElement.tsx
|
|
491
|
+
var import_use_combined_state = require("@spark-ui/hooks/use-combined-state");
|
|
492
|
+
var import_emulate_tab = require("emulate-tab");
|
|
493
|
+
var import_react3 = require("react");
|
|
494
|
+
|
|
495
|
+
// src/slot/Slot.tsx
|
|
496
|
+
var import_radix_ui = require("radix-ui");
|
|
497
|
+
var import_react2 = require("react");
|
|
498
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
499
|
+
var Slottable = import_radix_ui.Slot.Slottable;
|
|
500
|
+
var Slot = ({ ref, ...props }) => {
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
// src/chip/useChipElement.tsx
|
|
505
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
506
|
+
var getDisplayName = (element) => {
|
|
507
|
+
return element ? element.type.displayName : "";
|
|
508
|
+
};
|
|
509
|
+
var findElement = (children) => (...values) => {
|
|
510
|
+
const validChildren = import_react3.Children.toArray(children).filter(import_react3.isValidElement);
|
|
511
|
+
return validChildren.find((child) => {
|
|
512
|
+
const displayName = getDisplayName(child);
|
|
513
|
+
return values.includes(displayName || "");
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
var useChipElement = ({
|
|
517
|
+
onClick,
|
|
518
|
+
asChild,
|
|
519
|
+
pressed,
|
|
520
|
+
defaultPressed,
|
|
521
|
+
disabled,
|
|
522
|
+
value,
|
|
523
|
+
defaultValue,
|
|
524
|
+
children,
|
|
525
|
+
onClear
|
|
526
|
+
}) => {
|
|
527
|
+
const [isPressed, setIsPressed] = (0, import_use_combined_state.useCombinedState)(pressed, defaultPressed);
|
|
528
|
+
const [innerValue] = (0, import_use_combined_state.useCombinedState)(
|
|
529
|
+
value,
|
|
530
|
+
defaultValue
|
|
531
|
+
);
|
|
532
|
+
const findChipElement = findElement(children);
|
|
533
|
+
const leadingIcon = findChipElement("Chip.LeadingIcon");
|
|
534
|
+
const trailingIcon = findChipElement("Chip.TrailingIcon");
|
|
535
|
+
const content = findChipElement("Chip.Content");
|
|
536
|
+
const clearButton = findChipElement("Chip.ClearButton");
|
|
537
|
+
const isButton = (onClick || isPressed) !== void 0;
|
|
538
|
+
const formattedChildren = [leadingIcon, content, clearButton].every(
|
|
539
|
+
(element) => element === void 0
|
|
540
|
+
) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "inline-block grow truncate", children }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
541
|
+
leadingIcon,
|
|
542
|
+
content,
|
|
543
|
+
leadingIcon === void 0 ? trailingIcon : null,
|
|
544
|
+
clearButton
|
|
545
|
+
] });
|
|
546
|
+
const onKeyDown = (event) => {
|
|
547
|
+
if (!!clearButton && !disabled && ["Delete", "Backspace"].includes(event.key)) {
|
|
548
|
+
if (onClear) {
|
|
549
|
+
onClear();
|
|
550
|
+
event.key === "Delete" && (0, import_emulate_tab.emulateTab)();
|
|
551
|
+
event.key === "Backspace" && import_emulate_tab.emulateTab.backwards();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
if (isButton) {
|
|
556
|
+
return {
|
|
557
|
+
Element: asChild ? Slot : "button",
|
|
558
|
+
chipProps: {
|
|
559
|
+
type: "button",
|
|
560
|
+
...isPressed !== void 0 && {
|
|
561
|
+
"aria-pressed": isPressed,
|
|
562
|
+
"data-state": isPressed ? "on" : "off"
|
|
563
|
+
},
|
|
564
|
+
onClick: (event) => {
|
|
565
|
+
isPressed !== void 0 && setIsPressed(!isPressed);
|
|
566
|
+
onClick && onClick(event, { pressed: isPressed, value: innerValue });
|
|
567
|
+
},
|
|
568
|
+
onKeyDown,
|
|
569
|
+
disabled,
|
|
570
|
+
children: formattedChildren
|
|
571
|
+
},
|
|
572
|
+
compoundElements: {
|
|
573
|
+
leadingIcon,
|
|
574
|
+
trailingIcon,
|
|
575
|
+
content,
|
|
576
|
+
clearButton
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
return {
|
|
581
|
+
Element: asChild ? Slot : "div",
|
|
582
|
+
chipProps: {
|
|
583
|
+
"aria-disabled": disabled,
|
|
584
|
+
children: formattedChildren,
|
|
585
|
+
onKeyDown
|
|
586
|
+
},
|
|
587
|
+
compoundElements: {
|
|
588
|
+
leadingIcon,
|
|
589
|
+
trailingIcon,
|
|
590
|
+
content,
|
|
591
|
+
clearButton
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
// src/chip/Chip.tsx
|
|
597
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
598
|
+
var Chip = ({
|
|
599
|
+
design = "outlined",
|
|
600
|
+
disabled,
|
|
601
|
+
children,
|
|
602
|
+
intent = "basic",
|
|
603
|
+
defaultPressed,
|
|
604
|
+
pressed,
|
|
605
|
+
asChild,
|
|
606
|
+
className,
|
|
607
|
+
onClick,
|
|
608
|
+
onClear,
|
|
609
|
+
ref: forwardedRef,
|
|
610
|
+
...otherProps
|
|
611
|
+
}) => {
|
|
612
|
+
const {
|
|
613
|
+
Element: ChipElement,
|
|
614
|
+
chipProps: { children: formattedChildren, ...chipProps },
|
|
615
|
+
compoundElements
|
|
616
|
+
} = useChipElement({
|
|
617
|
+
asChild,
|
|
618
|
+
pressed,
|
|
619
|
+
defaultPressed,
|
|
620
|
+
onClick,
|
|
621
|
+
disabled: !!disabled,
|
|
622
|
+
value: otherProps.value,
|
|
623
|
+
defaultValue: otherProps.defaultValue,
|
|
624
|
+
children,
|
|
625
|
+
onClear
|
|
626
|
+
});
|
|
627
|
+
const { clearButton } = compoundElements;
|
|
628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChipContext.Provider, { value: { disabled, design, intent, onClear }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
629
|
+
ChipElement,
|
|
630
|
+
{
|
|
631
|
+
ref: forwardedRef,
|
|
632
|
+
className: chipStyles({
|
|
633
|
+
className,
|
|
634
|
+
design,
|
|
635
|
+
disabled,
|
|
636
|
+
intent,
|
|
637
|
+
hasClearButton: !!clearButton
|
|
638
|
+
}),
|
|
639
|
+
...{
|
|
640
|
+
...chipProps,
|
|
641
|
+
...otherProps
|
|
642
|
+
},
|
|
643
|
+
"data-spark-component": "chip",
|
|
644
|
+
children: formattedChildren
|
|
645
|
+
}
|
|
646
|
+
) });
|
|
647
|
+
};
|
|
648
|
+
Chip.displayName = "Chip";
|
|
649
|
+
|
|
650
|
+
// src/chip/ChipClearButton.tsx
|
|
651
|
+
var import_Close = require("@spark-ui/icons/Close");
|
|
652
|
+
var import_react5 = require("react");
|
|
653
|
+
|
|
654
|
+
// src/icon/Icon.tsx
|
|
655
|
+
var import_react4 = require("react");
|
|
656
|
+
|
|
657
|
+
// src/visually-hidden/VisuallyHidden.tsx
|
|
658
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
659
|
+
var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
|
|
660
|
+
const Component = asChild ? Slot : "span";
|
|
661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
662
|
+
Component,
|
|
663
|
+
{
|
|
664
|
+
...props,
|
|
665
|
+
ref,
|
|
666
|
+
style: {
|
|
667
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
668
|
+
position: "absolute",
|
|
669
|
+
border: 0,
|
|
670
|
+
width: 1,
|
|
671
|
+
height: 1,
|
|
672
|
+
padding: 0,
|
|
673
|
+
margin: -1,
|
|
674
|
+
overflow: "hidden",
|
|
675
|
+
clip: "rect(0, 0, 0, 0)",
|
|
676
|
+
whiteSpace: "nowrap",
|
|
677
|
+
wordWrap: "normal",
|
|
678
|
+
...props.style
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
);
|
|
682
|
+
};
|
|
683
|
+
VisuallyHidden.displayName = "VisuallyHidden";
|
|
684
|
+
|
|
685
|
+
// src/icon/Icon.styles.tsx
|
|
686
|
+
var import_internal_utils5 = require("@spark-ui/internal-utils");
|
|
687
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
688
|
+
var iconStyles = (0, import_class_variance_authority2.cva)(["fill-current shrink-0"], {
|
|
689
|
+
variants: {
|
|
690
|
+
/**
|
|
691
|
+
* Color scheme of the icon.
|
|
692
|
+
*/
|
|
693
|
+
intent: (0, import_internal_utils5.makeVariants)({
|
|
694
|
+
current: ["text-current"],
|
|
695
|
+
main: ["text-main"],
|
|
696
|
+
support: ["text-support"],
|
|
697
|
+
accent: ["text-accent"],
|
|
698
|
+
basic: ["text-basic"],
|
|
699
|
+
success: ["text-success"],
|
|
700
|
+
alert: ["text-alert"],
|
|
701
|
+
error: ["text-error"],
|
|
702
|
+
info: ["text-info"],
|
|
703
|
+
neutral: ["text-neutral"]
|
|
704
|
+
}),
|
|
705
|
+
/**
|
|
706
|
+
* Sets the size of the icon.
|
|
707
|
+
*/
|
|
708
|
+
size: (0, import_internal_utils5.makeVariants)({
|
|
709
|
+
current: ["u-current-font-size"],
|
|
710
|
+
sm: ["w-sz-16", "h-sz-16"],
|
|
711
|
+
md: ["w-sz-24", "h-sz-24"],
|
|
712
|
+
lg: ["w-sz-32", "h-sz-32"],
|
|
713
|
+
xl: ["w-sz-40", "h-sz-40"]
|
|
714
|
+
})
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
// src/icon/Icon.tsx
|
|
719
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
720
|
+
var Icon = ({
|
|
721
|
+
label,
|
|
722
|
+
className,
|
|
723
|
+
size = "current",
|
|
724
|
+
intent = "current",
|
|
725
|
+
children,
|
|
726
|
+
...others
|
|
727
|
+
}) => {
|
|
728
|
+
const child = import_react4.Children.only(children);
|
|
729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
730
|
+
(0, import_react4.cloneElement)(child, {
|
|
731
|
+
className: iconStyles({ className, size, intent }),
|
|
732
|
+
"data-spark-component": "icon",
|
|
733
|
+
"aria-hidden": "true",
|
|
734
|
+
focusable: "false",
|
|
735
|
+
...others
|
|
736
|
+
}),
|
|
737
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VisuallyHidden, { children: label })
|
|
738
|
+
] });
|
|
739
|
+
};
|
|
740
|
+
Icon.displayName = "Icon";
|
|
741
|
+
|
|
742
|
+
// src/chip/ChipClearButton.styles.tsx
|
|
743
|
+
var import_internal_utils6 = require("@spark-ui/internal-utils");
|
|
744
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
745
|
+
var chipClearButtonWrapperStyles = (0, import_class_variance_authority3.cva)(
|
|
746
|
+
["ml-md flex h-full items-center justify-center focus-visible:outline-hidden"],
|
|
747
|
+
{
|
|
748
|
+
variants: {
|
|
749
|
+
disabled: {
|
|
750
|
+
false: ["cursor-pointer"],
|
|
751
|
+
true: ["cursor-not-allowed"]
|
|
752
|
+
},
|
|
753
|
+
isBordered: {
|
|
754
|
+
false: ["pr-md"],
|
|
755
|
+
true: ["pr-[7px]"]
|
|
756
|
+
},
|
|
757
|
+
design: {
|
|
758
|
+
outlined: [],
|
|
759
|
+
tinted: [],
|
|
760
|
+
dashed: []
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
compoundVariants: [
|
|
764
|
+
{
|
|
765
|
+
design: "outlined",
|
|
766
|
+
disabled: false,
|
|
767
|
+
class: (0, import_internal_utils6.tw)(["hover:opacity-dim-1"])
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
design: "outlined",
|
|
771
|
+
disabled: true,
|
|
772
|
+
class: (0, import_internal_utils6.tw)(["opacity-dim-3"])
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
design: "tinted",
|
|
776
|
+
disabled: false,
|
|
777
|
+
class: (0, import_internal_utils6.tw)(["hover:opacity-dim-1"])
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
design: "tinted",
|
|
781
|
+
disabled: true,
|
|
782
|
+
class: (0, import_internal_utils6.tw)(["opacity-dim-3"])
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
design: "dashed",
|
|
786
|
+
disabled: false,
|
|
787
|
+
class: (0, import_internal_utils6.tw)(["hover:opacity-dim-1"])
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
design: "dashed",
|
|
791
|
+
disabled: true,
|
|
792
|
+
class: (0, import_internal_utils6.tw)(["opacity-dim-3"])
|
|
793
|
+
}
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
var chipClearButtonStyles = (0, import_class_variance_authority3.cva)(
|
|
798
|
+
["rounded-full p-sz-2 [font-size:var(--spacing-sz-8)] border-sm", "focus-visible:u-outline"],
|
|
799
|
+
{
|
|
800
|
+
variants: {
|
|
801
|
+
disabled: {
|
|
802
|
+
true: ["cursor-not-allowed"],
|
|
803
|
+
false: ["cursor-pointer"]
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
defaultVariants: {
|
|
807
|
+
disabled: false
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
);
|
|
811
|
+
|
|
812
|
+
// src/chip/ChipClearButton.tsx
|
|
813
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
814
|
+
var ChipClearButton = ({
|
|
815
|
+
children = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Close.Close, {}) }),
|
|
816
|
+
tabIndex = 0,
|
|
817
|
+
label,
|
|
818
|
+
ref: forwardedRef
|
|
819
|
+
}) => {
|
|
820
|
+
const { design, disabled, onClear } = useChipContext();
|
|
821
|
+
const onClearHandler = (0, import_react5.useCallback)(
|
|
822
|
+
(event) => {
|
|
823
|
+
event.stopPropagation();
|
|
824
|
+
!disabled && onClear && onClear(event);
|
|
825
|
+
},
|
|
826
|
+
[disabled, onClear]
|
|
827
|
+
);
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
829
|
+
"span",
|
|
830
|
+
{
|
|
831
|
+
className: chipClearButtonWrapperStyles({
|
|
832
|
+
isBordered: ["outline", "dashed"].includes(`${design}`),
|
|
833
|
+
disabled: !!disabled,
|
|
834
|
+
design
|
|
835
|
+
}),
|
|
836
|
+
onClick: onClearHandler,
|
|
837
|
+
ref: forwardedRef,
|
|
838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
839
|
+
"button",
|
|
840
|
+
{
|
|
841
|
+
tabIndex,
|
|
842
|
+
type: "button",
|
|
843
|
+
disabled: !!disabled,
|
|
844
|
+
className: chipClearButtonStyles({ disabled }),
|
|
845
|
+
"aria-label": label,
|
|
846
|
+
children: children && (0, import_react5.cloneElement)(children, { ariaLabel: label })
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
}
|
|
850
|
+
);
|
|
851
|
+
};
|
|
852
|
+
ChipClearButton.displayName = "Chip.ClearButton";
|
|
853
|
+
|
|
854
|
+
// src/chip/ChipContent.tsx
|
|
855
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
856
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
857
|
+
var ChipContent = ({ children, className, ref: forwardedRef }) => {
|
|
858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: (0, import_class_variance_authority4.cx)("inline-block grow truncate", className), ref: forwardedRef, children });
|
|
859
|
+
};
|
|
860
|
+
ChipContent.displayName = "Chip.Content";
|
|
861
|
+
|
|
862
|
+
// src/chip/ChipLeadingIcon.tsx
|
|
863
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
864
|
+
|
|
865
|
+
// src/chip/ChipIcon.tsx
|
|
866
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
867
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
868
|
+
var ChipIcon = ({ children, className, ref: forwardedRef }) => {
|
|
869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: (0, import_class_variance_authority5.cx)("flex h-full items-center justify-center", className), ref: forwardedRef, children });
|
|
870
|
+
};
|
|
871
|
+
ChipIcon.displayName = "Chip.Icon";
|
|
872
|
+
|
|
873
|
+
// src/chip/ChipLeadingIcon.tsx
|
|
874
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
875
|
+
var ChipLeadingIcon = ({
|
|
876
|
+
className,
|
|
877
|
+
ref: forwardedRef,
|
|
878
|
+
...props
|
|
879
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChipIcon, { className: (0, import_class_variance_authority6.cx)("mr-sm", className), ref: forwardedRef, ...props });
|
|
880
|
+
ChipLeadingIcon.displayName = "Chip.LeadingIcon";
|
|
881
|
+
|
|
882
|
+
// src/chip/ChipTrailingIcon.tsx
|
|
883
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
884
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
885
|
+
var ChipTrailingIcon = ({
|
|
886
|
+
className,
|
|
887
|
+
ref: forwardedRef,
|
|
888
|
+
...props
|
|
889
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChipIcon, { className: (0, import_class_variance_authority7.cx)("ml-md", className), ref: forwardedRef, ...props });
|
|
890
|
+
ChipTrailingIcon.displayName = "Chip.TrailingIcon";
|
|
891
|
+
|
|
892
|
+
// src/chip/index.ts
|
|
893
|
+
var Chip2 = Object.assign(Chip, {
|
|
894
|
+
Content: ChipContent,
|
|
895
|
+
LeadingIcon: ChipLeadingIcon,
|
|
896
|
+
TrailingIcon: ChipTrailingIcon,
|
|
897
|
+
ClearButton: ChipClearButton
|
|
898
|
+
});
|
|
899
|
+
Chip2.displayName = "Chip";
|
|
900
|
+
Chip2.ClearButton.displayName = "Chip.ClearButton";
|
|
901
|
+
Chip2.Content.displayName = "Chip.Content";
|
|
902
|
+
Chip2.LeadingIcon.displayName = "Chip.LeadingIcon";
|
|
903
|
+
Chip2.TrailingIcon.displayName = "Chip.TrailingIcon";
|
|
904
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
905
|
+
0 && (module.exports = {
|
|
906
|
+
Chip
|
|
907
|
+
});
|
|
908
|
+
//# sourceMappingURL=index.js.map
|