@spark-ui/components 10.17.12 → 10.18.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/Input-g0LpWuv0.d.mts +17 -0
- package/dist/Input-g0LpWuv0.d.ts +17 -0
- package/dist/{Input-N8AWWSmt.d.mts → InputTrailingIcon-CZD9hydv.d.ts} +14 -10
- package/dist/{Input-N8AWWSmt.d.ts → InputTrailingIcon-DzmwLGtX.d.mts} +14 -10
- package/dist/docgen.json +285 -915
- package/dist/input/index.d.mts +3 -4
- package/dist/input/index.d.ts +3 -4
- package/dist/stepper/index.d.mts +51 -54
- package/dist/stepper/index.d.ts +51 -54
- package/dist/stepper/index.js +113 -1679
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +135 -201
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/textarea/index.d.mts +2 -2
- package/dist/textarea/index.d.ts +2 -2
- package/package.json +5 -7
- package/dist/InputTrailingIcon-BBp7sE6D.d.mts +0 -20
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +0 -20
package/dist/stepper/index.js
CHANGED
|
@@ -20,16 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/stepper/index.ts
|
|
21
21
|
var stepper_exports = {};
|
|
22
22
|
__export(stepper_exports, {
|
|
23
|
-
Stepper: () =>
|
|
23
|
+
Stepper: () => Stepper
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(stepper_exports);
|
|
26
26
|
|
|
27
|
-
// src/stepper/
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
// src/input/InputClearButton.tsx
|
|
32
|
-
var import_DeleteOutline = require("@spark-ui/icons/DeleteOutline");
|
|
27
|
+
// src/stepper/Buttons.tsx
|
|
28
|
+
var import_number_field = require("@base-ui-components/react/number-field");
|
|
29
|
+
var import_Minus = require("@spark-ui/icons/Minus");
|
|
30
|
+
var import_Plus = require("@spark-ui/icons/Plus");
|
|
33
31
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
34
32
|
|
|
35
33
|
// src/icon/Icon.tsx
|
|
@@ -43,14 +41,6 @@ var Slottable = import_radix_ui.Slot.Slottable;
|
|
|
43
41
|
var Slot = ({ ref, ...props }) => {
|
|
44
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
|
|
45
43
|
};
|
|
46
|
-
var wrapPolymorphicSlot = (asChild, children, callback) => {
|
|
47
|
-
if (!asChild) return callback(children);
|
|
48
|
-
return (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(
|
|
49
|
-
children,
|
|
50
|
-
void 0,
|
|
51
|
-
callback(children.props.children)
|
|
52
|
-
) : null;
|
|
53
|
-
};
|
|
54
44
|
|
|
55
45
|
// src/visually-hidden/VisuallyHidden.tsx
|
|
56
46
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -137,1708 +127,152 @@ var Icon = ({
|
|
|
137
127
|
};
|
|
138
128
|
Icon.displayName = "Icon";
|
|
139
129
|
|
|
140
|
-
// src/
|
|
141
|
-
var import_react3 = require("react");
|
|
142
|
-
var InputGroupContext = (0, import_react3.createContext)(null);
|
|
143
|
-
var useInputGroup = () => {
|
|
144
|
-
const context = (0, import_react3.useContext)(InputGroupContext);
|
|
145
|
-
return context || { isStandalone: true };
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// src/input/InputClearButton.tsx
|
|
130
|
+
// src/stepper/useRenderSlot.tsx
|
|
149
131
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
inline = false,
|
|
155
|
-
ref,
|
|
156
|
-
...others
|
|
157
|
-
}) => {
|
|
158
|
-
const { onClear, hasTrailingIcon } = useInputGroup();
|
|
159
|
-
const handleClick = (event) => {
|
|
160
|
-
if (onClick) {
|
|
161
|
-
onClick(event);
|
|
162
|
-
}
|
|
163
|
-
if (onClear) {
|
|
164
|
-
onClear();
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
168
|
-
"button",
|
|
169
|
-
{
|
|
170
|
-
ref,
|
|
171
|
-
"data-spark-component": "input-clear-button",
|
|
172
|
-
className: (0, import_class_variance_authority2.cx)(
|
|
173
|
-
className,
|
|
174
|
-
"pointer-events-auto absolute",
|
|
175
|
-
inline ? "h-sz-44 top-0 -translate-y-0" : "top-1/2 -translate-y-1/2",
|
|
176
|
-
"inline-flex h-full items-center justify-center outline-hidden",
|
|
177
|
-
"text-neutral hover:text-neutral-hovered",
|
|
178
|
-
hasTrailingIcon ? "right-3xl px-sz-12" : "pl-md pr-lg right-0"
|
|
179
|
-
),
|
|
180
|
-
tabIndex,
|
|
181
|
-
onClick: handleClick,
|
|
182
|
-
type: "button",
|
|
183
|
-
...others,
|
|
184
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_DeleteOutline.DeleteOutline, {}) })
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
var InputClearButton = Object.assign(Root, {
|
|
189
|
-
id: "ClearButton"
|
|
190
|
-
});
|
|
191
|
-
Root.displayName = "InputGroup.ClearButton";
|
|
192
|
-
|
|
193
|
-
// src/input/InputGroup.tsx
|
|
194
|
-
var import_form_field = require("@spark-ui/components/form-field");
|
|
195
|
-
var import_use_combined_state = require("@spark-ui/hooks/use-combined-state");
|
|
196
|
-
var import_use_merge_refs = require("@spark-ui/hooks/use-merge-refs");
|
|
197
|
-
var import_react4 = require("react");
|
|
198
|
-
|
|
199
|
-
// src/input/InputGroup.styles.ts
|
|
200
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
201
|
-
var inputGroupStyles = (0, import_class_variance_authority3.cva)(["relative inline-flex w-full"], {
|
|
202
|
-
variants: {
|
|
203
|
-
/**
|
|
204
|
-
* When `true`, prevents the user from interacting.
|
|
205
|
-
*/
|
|
206
|
-
disabled: {
|
|
207
|
-
true: [
|
|
208
|
-
"cursor-not-allowed",
|
|
209
|
-
"relative",
|
|
210
|
-
"after:absolute",
|
|
211
|
-
"after:top-0",
|
|
212
|
-
"after:h-full",
|
|
213
|
-
"after:w-full",
|
|
214
|
-
"after:border-sm after:border-outline",
|
|
215
|
-
"after:rounded-lg"
|
|
216
|
-
],
|
|
217
|
-
false: "after:hidden"
|
|
218
|
-
},
|
|
219
|
-
/**
|
|
220
|
-
* Sets the component as interactive or not.
|
|
221
|
-
*/
|
|
222
|
-
readOnly: {
|
|
223
|
-
true: [
|
|
224
|
-
"relative",
|
|
225
|
-
"after:absolute",
|
|
226
|
-
"after:top-0",
|
|
227
|
-
"after:h-full",
|
|
228
|
-
"after:w-full",
|
|
229
|
-
"after:border-sm after:border-outline",
|
|
230
|
-
"after:rounded-lg"
|
|
231
|
-
],
|
|
232
|
-
false: "after:hidden"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
});
|
|
132
|
+
function useRenderSlot(asChild, defaultTag) {
|
|
133
|
+
const Component = asChild ? Slot : defaultTag;
|
|
134
|
+
return asChild ? ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...props }) : void 0;
|
|
135
|
+
}
|
|
236
136
|
|
|
237
|
-
// src/
|
|
137
|
+
// src/stepper/Buttons.tsx
|
|
238
138
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
239
|
-
var
|
|
240
|
-
className,
|
|
241
|
-
children: childrenProp,
|
|
242
|
-
state: stateProp,
|
|
243
|
-
disabled: disabledProp,
|
|
244
|
-
readOnly: readOnlyProp,
|
|
245
|
-
onClear,
|
|
246
|
-
ref: forwardedRef,
|
|
247
|
-
...others
|
|
248
|
-
}) => {
|
|
249
|
-
const getElementId = (element) => {
|
|
250
|
-
return element ? element.type.id : "";
|
|
251
|
-
};
|
|
252
|
-
const findElement = (...values) => {
|
|
253
|
-
return children.find((child) => values.includes(getElementId(child) || ""));
|
|
254
|
-
};
|
|
255
|
-
const children = import_react4.Children.toArray(childrenProp).filter(import_react4.isValidElement);
|
|
256
|
-
const input = findElement("Input");
|
|
257
|
-
const props = input?.props || {};
|
|
258
|
-
const inputRef = (0, import_react4.useRef)(null);
|
|
259
|
-
const onClearRef = (0, import_react4.useRef)(onClear);
|
|
260
|
-
const ref = (0, import_use_merge_refs.useMergeRefs)(input?.ref, inputRef);
|
|
261
|
-
const [value, onChange] = (0, import_use_combined_state.useCombinedState)(
|
|
262
|
-
props.value,
|
|
263
|
-
props.defaultValue,
|
|
264
|
-
props.onValueChange
|
|
265
|
-
);
|
|
266
|
-
const field = (0, import_form_field.useFormFieldControl)();
|
|
267
|
-
const state = field.state ?? stateProp;
|
|
268
|
-
const disabled = field.disabled || !!disabledProp;
|
|
269
|
-
const readOnly = field.readOnly || !!readOnlyProp;
|
|
270
|
-
const leadingAddon = findElement("LeadingAddon");
|
|
271
|
-
const leadingIcon = findElement("LeadingIcon");
|
|
272
|
-
const clearButton = findElement("ClearButton");
|
|
273
|
-
const trailingIcon = findElement("TrailingIcon");
|
|
274
|
-
const trailingAddon = findElement("TrailingAddon");
|
|
275
|
-
const hasLeadingAddon = !!leadingAddon;
|
|
276
|
-
const hasTrailingAddon = !!trailingAddon;
|
|
277
|
-
const hasLeadingIcon = !!leadingIcon;
|
|
278
|
-
const hasTrailingIcon = !!trailingIcon;
|
|
279
|
-
const hasClearButton = !!value && !!clearButton && !disabled && !readOnly;
|
|
280
|
-
const handleChange = (event) => {
|
|
281
|
-
if (props.onChange) {
|
|
282
|
-
props.onChange(event);
|
|
283
|
-
}
|
|
284
|
-
onChange(event.target.value);
|
|
285
|
-
};
|
|
286
|
-
const handleClear = (0, import_react4.useCallback)(() => {
|
|
287
|
-
if (onClearRef.current) {
|
|
288
|
-
onClearRef.current();
|
|
289
|
-
}
|
|
290
|
-
onChange("");
|
|
291
|
-
inputRef.current.focus();
|
|
292
|
-
}, [onChange]);
|
|
293
|
-
const current = (0, import_react4.useMemo)(() => {
|
|
294
|
-
return {
|
|
295
|
-
state,
|
|
296
|
-
disabled,
|
|
297
|
-
readOnly,
|
|
298
|
-
hasLeadingIcon,
|
|
299
|
-
hasTrailingIcon,
|
|
300
|
-
hasLeadingAddon,
|
|
301
|
-
hasTrailingAddon,
|
|
302
|
-
hasClearButton,
|
|
303
|
-
onClear: handleClear
|
|
304
|
-
};
|
|
305
|
-
}, [
|
|
306
|
-
state,
|
|
307
|
-
disabled,
|
|
308
|
-
readOnly,
|
|
309
|
-
hasLeadingIcon,
|
|
310
|
-
hasTrailingIcon,
|
|
311
|
-
hasLeadingAddon,
|
|
312
|
-
hasTrailingAddon,
|
|
313
|
-
hasClearButton,
|
|
314
|
-
handleClear
|
|
315
|
-
]);
|
|
316
|
-
(0, import_react4.useEffect)(() => {
|
|
317
|
-
onClearRef.current = onClear;
|
|
318
|
-
}, [onClear]);
|
|
319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InputGroupContext.Provider, { value: current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
320
|
-
"div",
|
|
321
|
-
{
|
|
322
|
-
"data-spark-component": "input-group",
|
|
323
|
-
ref: forwardedRef,
|
|
324
|
-
className: inputGroupStyles({ disabled, readOnly, className }),
|
|
325
|
-
...others,
|
|
326
|
-
children: [
|
|
327
|
-
hasLeadingAddon && leadingAddon,
|
|
328
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative inline-flex w-full", children: [
|
|
329
|
-
input && (0, import_react4.cloneElement)(input, {
|
|
330
|
-
ref,
|
|
331
|
-
defaultValue: void 0,
|
|
332
|
-
value: value ?? "",
|
|
333
|
-
onChange: handleChange
|
|
334
|
-
}),
|
|
335
|
-
leadingIcon,
|
|
336
|
-
hasClearButton && clearButton,
|
|
337
|
-
trailingIcon
|
|
338
|
-
] }),
|
|
339
|
-
hasTrailingAddon && trailingAddon
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
|
-
) });
|
|
343
|
-
};
|
|
344
|
-
InputGroup.displayName = "InputGroup";
|
|
345
|
-
|
|
346
|
-
// src/input/InputLeadingAddon.tsx
|
|
347
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
348
|
-
|
|
349
|
-
// src/input/InputAddon.tsx
|
|
350
|
-
var import_react5 = require("react");
|
|
351
|
-
|
|
352
|
-
// src/input/InputAddon.styles.ts
|
|
353
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
354
|
-
var inputAddonStyles = (0, import_class_variance_authority4.cva)(
|
|
139
|
+
var styles = (0, import_class_variance_authority2.cva)(
|
|
355
140
|
[
|
|
356
|
-
|
|
357
|
-
"border-sm",
|
|
358
|
-
"
|
|
359
|
-
|
|
360
|
-
"
|
|
361
|
-
"
|
|
141
|
+
// Base styles
|
|
142
|
+
"border-outline border-sm min-w-sz-44 text-on-surface flex cursor-pointer items-center justify-center bg-clip-padding select-none",
|
|
143
|
+
"hover:bg-neutral/dim-5",
|
|
144
|
+
// Disabled and ReadOnly styles
|
|
145
|
+
"disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3 disabled:cursor-not-allowed",
|
|
146
|
+
"data-[disabled]:bg-on-surface/dim-5 data-[disabled]:text-on-surface/dim-3 data-[disabled]:cursor-not-allowed",
|
|
147
|
+
"data-[readonly]:bg-on-surface/dim-5 data-[readonly]:text-on-surface/dim-3 data-[readonly]:cursor-not-allowed",
|
|
148
|
+
// State styles
|
|
149
|
+
"group-data-[field-state=error]:border-error",
|
|
150
|
+
"group-data-[field-state=alert]:border-alert",
|
|
151
|
+
"group-data-[field-state=success]:border-success"
|
|
362
152
|
],
|
|
363
153
|
{
|
|
364
154
|
variants: {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
asChild: { false: ["flex", "items-center", "px-lg"] },
|
|
369
|
-
intent: {
|
|
370
|
-
neutral: "border-outline",
|
|
371
|
-
error: "border-error",
|
|
372
|
-
alert: "border-alert",
|
|
373
|
-
success: "border-success"
|
|
374
|
-
},
|
|
375
|
-
/**
|
|
376
|
-
* Disable the input addon, preventing user interaction and adding opacity.
|
|
377
|
-
*/
|
|
378
|
-
disabled: {
|
|
379
|
-
true: ["pointer-events-none border-outline!"]
|
|
380
|
-
},
|
|
381
|
-
/**
|
|
382
|
-
* Changes input addon styles based on the read only status from the input.
|
|
383
|
-
*/
|
|
384
|
-
readOnly: {
|
|
385
|
-
true: ["pointer-events-none"]
|
|
386
|
-
},
|
|
387
|
-
/**
|
|
388
|
-
* Main style of the input addon.
|
|
389
|
-
*/
|
|
390
|
-
design: {
|
|
391
|
-
text: "",
|
|
392
|
-
solid: "",
|
|
393
|
-
inline: ""
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
compoundVariants: [
|
|
397
|
-
{
|
|
398
|
-
disabled: false,
|
|
399
|
-
readOnly: false,
|
|
400
|
-
design: "text",
|
|
401
|
-
class: ["bg-surface", "text-on-surface"]
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
disabled: true,
|
|
405
|
-
design: "text",
|
|
406
|
-
class: ["text-on-surface/dim-3"]
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
disabled: true,
|
|
410
|
-
design: ["solid", "inline"],
|
|
411
|
-
class: ["opacity-dim-3"]
|
|
155
|
+
placement: {
|
|
156
|
+
left: "rounded-l-lg",
|
|
157
|
+
right: "rounded-r-lg"
|
|
412
158
|
}
|
|
413
|
-
],
|
|
414
|
-
defaultVariants: {
|
|
415
|
-
intent: "neutral"
|
|
416
159
|
}
|
|
417
160
|
}
|
|
418
161
|
);
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
asChild: asChildProp,
|
|
424
|
-
className,
|
|
425
|
-
children,
|
|
426
|
-
ref,
|
|
427
|
-
...others
|
|
428
|
-
}) => {
|
|
429
|
-
const { state, disabled, readOnly } = useInputGroup();
|
|
430
|
-
const isRawText = typeof children === "string";
|
|
431
|
-
const asChild = !!(isRawText ? false : asChildProp);
|
|
432
|
-
const child = isRawText ? children : import_react5.Children.only(children);
|
|
433
|
-
const Component = asChild && !isRawText ? Slot : "div";
|
|
434
|
-
const getDesign = () => {
|
|
435
|
-
if (isRawText) return "text";
|
|
436
|
-
return asChild ? "solid" : "inline";
|
|
437
|
-
};
|
|
438
|
-
const design = getDesign();
|
|
439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
440
|
-
Component,
|
|
162
|
+
var Decrement = ({ children, className, asChild = false, ...props }) => {
|
|
163
|
+
const render = useRenderSlot(asChild, "div");
|
|
164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
165
|
+
import_number_field.NumberField.Decrement,
|
|
441
166
|
{
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
className
|
|
446
|
-
intent: state,
|
|
447
|
-
disabled,
|
|
448
|
-
readOnly,
|
|
449
|
-
asChild,
|
|
450
|
-
design
|
|
167
|
+
"data-spark-component": "stepper-decrement-button",
|
|
168
|
+
className: styles({
|
|
169
|
+
placement: "left",
|
|
170
|
+
className
|
|
451
171
|
}),
|
|
452
|
-
|
|
453
|
-
...
|
|
454
|
-
children:
|
|
172
|
+
render,
|
|
173
|
+
...props,
|
|
174
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Minus.Minus, {}) })
|
|
455
175
|
}
|
|
456
176
|
);
|
|
457
177
|
};
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
var Root2 = ({ className, ref, ...others }) => {
|
|
463
|
-
const { disabled, readOnly } = useInputGroup();
|
|
464
|
-
const isInactive = disabled || readOnly;
|
|
465
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: (0, import_class_variance_authority5.cx)("rounded-l-lg", isInactive ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
466
|
-
InputAddon,
|
|
178
|
+
var Increment = ({ children, className, asChild = false, ...props }) => {
|
|
179
|
+
const render = useRenderSlot(asChild, "div");
|
|
180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
181
|
+
import_number_field.NumberField.Increment,
|
|
467
182
|
{
|
|
468
|
-
|
|
469
|
-
className: (
|
|
470
|
-
|
|
183
|
+
"data-spark-component": "stepper-increment-button",
|
|
184
|
+
className: styles({
|
|
185
|
+
placement: "right",
|
|
186
|
+
className
|
|
187
|
+
}),
|
|
188
|
+
render,
|
|
189
|
+
...props,
|
|
190
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Plus.Plus, {}) })
|
|
471
191
|
}
|
|
472
|
-
)
|
|
192
|
+
);
|
|
473
193
|
};
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
});
|
|
477
|
-
Root2.displayName = "InputGroup.LeadingAddon";
|
|
194
|
+
Decrement.displayName = "Stepper.DecrementButton";
|
|
195
|
+
Increment.displayName = "Stepper.IncrementButton";
|
|
478
196
|
|
|
479
|
-
// src/
|
|
480
|
-
var
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
var
|
|
484
|
-
var
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
489
|
-
Icon,
|
|
197
|
+
// src/stepper/Input.tsx
|
|
198
|
+
var import_number_field2 = require("@base-ui-components/react/number-field");
|
|
199
|
+
var import_form_field = require("@spark-ui/components/form-field");
|
|
200
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
201
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
202
|
+
var Input = ({ className, ...props }) => {
|
|
203
|
+
const field = (0, import_form_field.useFormFieldControl)();
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
205
|
+
import_number_field2.NumberField.Input,
|
|
490
206
|
{
|
|
491
|
-
"data-spark-component": "input
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
207
|
+
"data-spark-component": "stepper-input",
|
|
208
|
+
className: (0, import_class_variance_authority3.cx)(
|
|
209
|
+
// Base styles
|
|
210
|
+
"bg-surface text-on-surface h-sz-44 border-y-sm border-outline text-center",
|
|
211
|
+
// State styles
|
|
212
|
+
"group-data-[field-state=error]:border-error",
|
|
213
|
+
"group-data-[field-state=alert]:border-alert",
|
|
214
|
+
"group-data-[field-state=success]:border-success",
|
|
215
|
+
"",
|
|
216
|
+
// Disabled and ReadOnly styles
|
|
217
|
+
"data-[disabled]:bg-on-surface/dim-5 data-[disabled]:text-on-surface/dim-3 data-[disabled]:cursor-not-allowed",
|
|
218
|
+
"data-[readonly]:bg-on-surface/dim-5",
|
|
219
|
+
// Focus styles
|
|
220
|
+
"focus:outline-outline-high focus:z-raised focus:outline-2 focus:-outline-offset-1",
|
|
221
|
+
className
|
|
498
222
|
),
|
|
499
|
-
...
|
|
500
|
-
|
|
223
|
+
...field.description && { "aria-describedby": field.description },
|
|
224
|
+
...field.isRequired && { required: true },
|
|
225
|
+
...field.state === "error" && { "aria-invalid": true },
|
|
226
|
+
...props
|
|
501
227
|
}
|
|
502
228
|
);
|
|
503
229
|
};
|
|
504
|
-
|
|
230
|
+
Input.displayName = "Stepper.InputButton";
|
|
505
231
|
|
|
506
|
-
// src/
|
|
507
|
-
var
|
|
508
|
-
var InputLeadingIcon = ({ className, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputIcon, { className: (0, import_class_variance_authority7.cx)(className, "left-lg text-body-1"), ...others });
|
|
509
|
-
InputLeadingIcon.id = "LeadingIcon";
|
|
510
|
-
InputLeadingIcon.displayName = "InputGroup.LeadingIcon";
|
|
511
|
-
|
|
512
|
-
// src/input/InputTrailingAddon.tsx
|
|
513
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
514
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
515
|
-
var Root3 = ({ className, ref, ...others }) => {
|
|
516
|
-
const { disabled, readOnly } = useInputGroup();
|
|
517
|
-
const isInactive = disabled || readOnly;
|
|
518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_class_variance_authority8.cx)("rounded-r-lg", isInactive ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
519
|
-
InputAddon,
|
|
520
|
-
{
|
|
521
|
-
ref,
|
|
522
|
-
className: (0, import_class_variance_authority8.cx)(className, "rounded-l-0! ml-[-1px] rounded-r-lg"),
|
|
523
|
-
...others
|
|
524
|
-
}
|
|
525
|
-
) });
|
|
526
|
-
};
|
|
527
|
-
var InputTrailingAddon = Object.assign(Root3, {
|
|
528
|
-
id: "TrailingAddon"
|
|
529
|
-
});
|
|
530
|
-
Root3.displayName = "InputGroup.TrailingAddon";
|
|
531
|
-
|
|
532
|
-
// src/input/InputTrailingIcon.tsx
|
|
533
|
-
var import_class_variance_authority9 = require("class-variance-authority");
|
|
534
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
535
|
-
var InputTrailingIcon = ({ className, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InputIcon, { className: (0, import_class_variance_authority9.cx)(className, "right-lg text-body-1"), ...others });
|
|
536
|
-
InputTrailingIcon.id = "TrailingIcon";
|
|
537
|
-
InputTrailingIcon.displayName = "InputGroup.TrailingIcon";
|
|
538
|
-
|
|
539
|
-
// src/input/Input.tsx
|
|
232
|
+
// src/stepper/Root.tsx
|
|
233
|
+
var import_number_field3 = require("@base-ui-components/react/number-field");
|
|
540
234
|
var import_form_field2 = require("@spark-ui/components/form-field");
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
var
|
|
544
|
-
var inputStyles = (0, import_class_variance_authority10.cva)(
|
|
545
|
-
[
|
|
546
|
-
"relative",
|
|
547
|
-
"border-sm",
|
|
548
|
-
"peer",
|
|
549
|
-
"w-full",
|
|
550
|
-
"appearance-none outline-hidden",
|
|
551
|
-
"bg-surface",
|
|
552
|
-
"text-ellipsis text-body-1 text-on-surface",
|
|
553
|
-
"caret-neutral",
|
|
554
|
-
"[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]",
|
|
555
|
-
"autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]",
|
|
556
|
-
"disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3",
|
|
557
|
-
"read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5",
|
|
558
|
-
"focus:ring-1 focus:ring-inset focus:ring-focus focus:border-focus"
|
|
559
|
-
],
|
|
560
|
-
{
|
|
561
|
-
variants: {
|
|
562
|
-
/**
|
|
563
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
564
|
-
*/
|
|
565
|
-
asChild: {
|
|
566
|
-
true: ["min-h-sz-44"],
|
|
567
|
-
false: ["h-sz-44"]
|
|
568
|
-
},
|
|
569
|
-
/**
|
|
570
|
-
* Color scheme of the button.
|
|
571
|
-
*/
|
|
572
|
-
intent: {
|
|
573
|
-
neutral: ["border-outline", "default:hover:border-outline-high"],
|
|
574
|
-
success: ["default:border-success"],
|
|
575
|
-
alert: ["default:border-alert"],
|
|
576
|
-
error: ["default:border-error"]
|
|
577
|
-
},
|
|
578
|
-
/**
|
|
579
|
-
* Sets if there is an addon before the input text.
|
|
580
|
-
*/
|
|
581
|
-
hasLeadingAddon: {
|
|
582
|
-
true: ["rounded-l-0"],
|
|
583
|
-
false: ["rounded-l-lg"]
|
|
584
|
-
},
|
|
585
|
-
/**
|
|
586
|
-
* Sets if there is an addon after the input text.
|
|
587
|
-
*/
|
|
588
|
-
hasTrailingAddon: {
|
|
589
|
-
true: ["rounded-r-0"],
|
|
590
|
-
false: ["rounded-r-lg"]
|
|
591
|
-
},
|
|
592
|
-
/**
|
|
593
|
-
* Sets if there is an icon before the input text.
|
|
594
|
-
*/
|
|
595
|
-
hasLeadingIcon: {
|
|
596
|
-
true: ["pl-3xl"],
|
|
597
|
-
false: ["pl-lg"]
|
|
598
|
-
},
|
|
599
|
-
/**
|
|
600
|
-
* Sets if there is an icon after the input text.
|
|
601
|
-
*/
|
|
602
|
-
hasTrailingIcon: { true: "" },
|
|
603
|
-
/**
|
|
604
|
-
* Sets if there is a button to clear the input text.
|
|
605
|
-
*/
|
|
606
|
-
hasClearButton: { true: "" }
|
|
607
|
-
},
|
|
608
|
-
compoundVariants: [
|
|
609
|
-
{
|
|
610
|
-
hasTrailingIcon: false,
|
|
611
|
-
hasClearButton: false,
|
|
612
|
-
class: "pr-lg"
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
hasTrailingIcon: true,
|
|
616
|
-
hasClearButton: false,
|
|
617
|
-
class: "pr-3xl"
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
hasTrailingIcon: false,
|
|
621
|
-
hasClearButton: true,
|
|
622
|
-
class: "pr-3xl"
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
hasTrailingIcon: true,
|
|
626
|
-
hasClearButton: true,
|
|
627
|
-
class: "pr-[calc(var(--spacing-3xl)*2)]"
|
|
628
|
-
}
|
|
629
|
-
],
|
|
630
|
-
defaultVariants: {
|
|
631
|
-
intent: "neutral"
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
);
|
|
635
|
-
|
|
636
|
-
// src/input/Input.tsx
|
|
637
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
638
|
-
var Root4 = ({
|
|
639
|
-
className,
|
|
640
|
-
asChild = false,
|
|
641
|
-
onValueChange,
|
|
642
|
-
onChange,
|
|
643
|
-
onKeyDown,
|
|
644
|
-
disabled: disabledProp,
|
|
645
|
-
readOnly: readOnlyProp,
|
|
646
|
-
ref,
|
|
647
|
-
...others
|
|
648
|
-
}) => {
|
|
649
|
-
const field = (0, import_form_field2.useFormFieldControl)();
|
|
650
|
-
const group = useInputGroup();
|
|
651
|
-
const { id, name, isInvalid, isRequired, description } = field;
|
|
652
|
-
const {
|
|
653
|
-
hasLeadingAddon,
|
|
654
|
-
hasTrailingAddon,
|
|
655
|
-
hasLeadingIcon,
|
|
656
|
-
hasTrailingIcon,
|
|
657
|
-
hasClearButton,
|
|
658
|
-
onClear
|
|
659
|
-
} = group;
|
|
660
|
-
const Component = asChild ? Slot : "input";
|
|
661
|
-
const state = field.state || group.state;
|
|
662
|
-
const disabled = field.disabled || group.disabled || disabledProp;
|
|
663
|
-
const readOnly = field.readOnly || group.readOnly || readOnlyProp;
|
|
664
|
-
const handleChange = (event) => {
|
|
665
|
-
if (onChange) {
|
|
666
|
-
onChange(event);
|
|
667
|
-
}
|
|
668
|
-
if (onValueChange) {
|
|
669
|
-
onValueChange(event.target.value);
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
const handleKeyDown = (event) => {
|
|
673
|
-
if (onKeyDown) {
|
|
674
|
-
onKeyDown(event);
|
|
675
|
-
}
|
|
676
|
-
if (hasClearButton && onClear && event.key === "Escape") {
|
|
677
|
-
onClear();
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
681
|
-
Component,
|
|
682
|
-
{
|
|
683
|
-
"data-spark-component": "input",
|
|
684
|
-
ref,
|
|
685
|
-
id,
|
|
686
|
-
name,
|
|
687
|
-
className: inputStyles({
|
|
688
|
-
asChild,
|
|
689
|
-
className,
|
|
690
|
-
intent: state,
|
|
691
|
-
hasLeadingAddon: !!hasLeadingAddon,
|
|
692
|
-
hasTrailingAddon: !!hasTrailingAddon,
|
|
693
|
-
hasLeadingIcon: !!hasLeadingIcon,
|
|
694
|
-
hasTrailingIcon: !!hasTrailingIcon,
|
|
695
|
-
hasClearButton: !!hasClearButton
|
|
696
|
-
}),
|
|
697
|
-
disabled,
|
|
698
|
-
readOnly,
|
|
699
|
-
required: isRequired,
|
|
700
|
-
"aria-describedby": description,
|
|
701
|
-
"aria-invalid": isInvalid,
|
|
702
|
-
onChange: handleChange,
|
|
703
|
-
onKeyDown: handleKeyDown,
|
|
704
|
-
...others
|
|
705
|
-
}
|
|
706
|
-
);
|
|
707
|
-
};
|
|
708
|
-
var Input = Object.assign(Root4, {
|
|
709
|
-
id: "Input"
|
|
710
|
-
});
|
|
711
|
-
Root4.displayName = "Input";
|
|
712
|
-
|
|
713
|
-
// src/input/index.ts
|
|
714
|
-
var InputGroup2 = Object.assign(InputGroup, {
|
|
715
|
-
LeadingAddon: InputLeadingAddon,
|
|
716
|
-
TrailingAddon: InputTrailingAddon,
|
|
717
|
-
LeadingIcon: InputLeadingIcon,
|
|
718
|
-
TrailingIcon: InputTrailingIcon,
|
|
719
|
-
ClearButton: InputClearButton
|
|
720
|
-
});
|
|
721
|
-
InputGroup2.displayName = "InputGroup";
|
|
722
|
-
InputLeadingAddon.displayName = "InputGroup.LeadingAddon";
|
|
723
|
-
InputTrailingAddon.displayName = "InputGroup.TrailingAddon";
|
|
724
|
-
InputLeadingIcon.displayName = "InputGroup.LeadingIcon";
|
|
725
|
-
InputTrailingIcon.displayName = "InputGroup.TrailingIcon";
|
|
726
|
-
InputClearButton.displayName = "InputGroup.ClearButton";
|
|
727
|
-
|
|
728
|
-
// src/stepper/useStepper.ts
|
|
729
|
-
var import_numberfield = require("@react-aria/numberfield");
|
|
730
|
-
var import_numberfield2 = require("@react-stately/numberfield");
|
|
731
|
-
var useStepper = ({
|
|
732
|
-
inputRef,
|
|
733
|
-
locale = "fr",
|
|
734
|
-
...rest
|
|
735
|
-
}) => {
|
|
736
|
-
const state = (0, import_numberfield2.useNumberFieldState)({
|
|
737
|
-
...rest,
|
|
738
|
-
isDisabled: rest.disabled,
|
|
739
|
-
isReadOnly: rest.readOnly,
|
|
740
|
-
isRequired: rest.required,
|
|
741
|
-
locale
|
|
742
|
-
});
|
|
743
|
-
const { groupProps, inputProps, incrementButtonProps, decrementButtonProps } = (0, import_numberfield.useNumberField)(
|
|
744
|
-
{
|
|
745
|
-
isWheelDisabled: false,
|
|
746
|
-
...rest,
|
|
747
|
-
isDisabled: rest.disabled,
|
|
748
|
-
isReadOnly: rest.readOnly,
|
|
749
|
-
isRequired: rest.required
|
|
750
|
-
},
|
|
751
|
-
state,
|
|
752
|
-
inputRef
|
|
753
|
-
);
|
|
754
|
-
return {
|
|
755
|
-
groupProps,
|
|
756
|
-
inputProps,
|
|
757
|
-
incrementButtonProps,
|
|
758
|
-
decrementButtonProps
|
|
759
|
-
};
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
// src/stepper/Stepper.tsx
|
|
763
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
764
|
-
var StepperContext = (0, import_react6.createContext)(null);
|
|
765
|
-
var Stepper = ({
|
|
235
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
236
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
237
|
+
var Root = ({
|
|
766
238
|
children,
|
|
767
|
-
|
|
239
|
+
allowWheelScrub = true,
|
|
240
|
+
state: stateProp,
|
|
768
241
|
minValue,
|
|
769
242
|
maxValue,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
}) => {
|
|
773
|
-
const inputRef = (0, import_react6.useRef)(null);
|
|
774
|
-
const {
|
|
775
|
-
groupProps,
|
|
776
|
-
inputProps: _inputProps,
|
|
777
|
-
incrementButtonProps: _incrementButtonProps,
|
|
778
|
-
decrementButtonProps: _decrementButtonProps
|
|
779
|
-
} = useStepper({
|
|
780
|
-
...{
|
|
781
|
-
...stepperProps,
|
|
782
|
-
/**
|
|
783
|
-
* To enable the possibility to init the stepper with empty (undefined) value,
|
|
784
|
-
* we need to force the empty value to NaN.
|
|
785
|
-
* Cf. https://github.com/adobe/react-spectrum/issues/5524
|
|
786
|
-
*/
|
|
787
|
-
..."value" in stepperProps && { value: stepperProps.value ?? NaN },
|
|
788
|
-
onChange: stepperProps.onValueChange
|
|
789
|
-
},
|
|
790
|
-
formatOptions,
|
|
791
|
-
minValue,
|
|
792
|
-
maxValue,
|
|
793
|
-
inputRef
|
|
794
|
-
});
|
|
795
|
-
const formFieldControlProps = (0, import_form_field3.useFormFieldControl)();
|
|
796
|
-
const isWrappedInFormField = !!formFieldControlProps.id;
|
|
797
|
-
const incrementButtonProps = {
|
|
798
|
-
..._incrementButtonProps,
|
|
799
|
-
...isWrappedInFormField && { "aria-controls": formFieldControlProps.id }
|
|
800
|
-
};
|
|
801
|
-
const decrementButtonProps = {
|
|
802
|
-
..._decrementButtonProps,
|
|
803
|
-
...isWrappedInFormField && { "aria-controls": formFieldControlProps.id }
|
|
804
|
-
};
|
|
805
|
-
const inputProps = {
|
|
806
|
-
..._inputProps,
|
|
807
|
-
...isWrappedInFormField && {
|
|
808
|
-
id: formFieldControlProps.id,
|
|
809
|
-
required: formFieldControlProps.isRequired,
|
|
810
|
-
"aria-invalid": formFieldControlProps.isInvalid ? true : void 0
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
const { onValueChange: _, ...remainingStepperProps } = stepperProps;
|
|
814
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
815
|
-
StepperContext.Provider,
|
|
816
|
-
{
|
|
817
|
-
value: { incrementButtonProps, decrementButtonProps, inputProps, inputRef },
|
|
818
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
819
|
-
InputGroup2,
|
|
820
|
-
{
|
|
821
|
-
...remainingStepperProps,
|
|
822
|
-
...groupProps,
|
|
823
|
-
"data-spark-component": "stepper",
|
|
824
|
-
ref: forwardedRef,
|
|
825
|
-
children
|
|
826
|
-
}
|
|
827
|
-
)
|
|
828
|
-
}
|
|
829
|
-
);
|
|
830
|
-
};
|
|
831
|
-
Stepper.displayName = "Stepper";
|
|
832
|
-
var useStepperContext = () => {
|
|
833
|
-
const context = (0, import_react6.useContext)(StepperContext);
|
|
834
|
-
if (!context) {
|
|
835
|
-
throw Error("useStepperContext must be used within a Stepper provider");
|
|
836
|
-
}
|
|
837
|
-
return context;
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
// src/stepper/StepperButton.tsx
|
|
841
|
-
var import_button2 = require("@react-aria/button");
|
|
842
|
-
var import_Minus = require("@spark-ui/icons/Minus");
|
|
843
|
-
var import_Plus = require("@spark-ui/icons/Plus");
|
|
844
|
-
var import_react8 = require("react");
|
|
845
|
-
|
|
846
|
-
// src/button/Button.tsx
|
|
847
|
-
var import_class_variance_authority13 = require("class-variance-authority");
|
|
848
|
-
var import_react7 = require("react");
|
|
849
|
-
|
|
850
|
-
// src/spinner/Spinner.styles.tsx
|
|
851
|
-
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
852
|
-
var import_class_variance_authority11 = require("class-variance-authority");
|
|
853
|
-
var defaultVariants = {
|
|
854
|
-
intent: "current",
|
|
855
|
-
size: "current",
|
|
856
|
-
isBackgroundVisible: false
|
|
857
|
-
};
|
|
858
|
-
var spinnerStyles = (0, import_class_variance_authority11.cva)(
|
|
859
|
-
["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
|
|
860
|
-
{
|
|
861
|
-
variants: {
|
|
862
|
-
/**
|
|
863
|
-
* Use `size` prop to set the size of the spinner. If you want to set the full size for the spinner, don't forget to add a wrapping container with its own size.
|
|
864
|
-
*/
|
|
865
|
-
size: {
|
|
866
|
-
current: ["u-current-font-size"],
|
|
867
|
-
sm: ["w-sz-20", "h-sz-20"],
|
|
868
|
-
md: ["w-sz-28", "h-sz-28"],
|
|
869
|
-
full: ["w-full", "h-full"]
|
|
870
|
-
},
|
|
871
|
-
/**
|
|
872
|
-
* Color scheme of the spinner.
|
|
873
|
-
*/
|
|
874
|
-
intent: (0, import_internal_utils2.makeVariants)({
|
|
875
|
-
current: ["border-current"],
|
|
876
|
-
main: ["border-main"],
|
|
877
|
-
support: ["border-support"],
|
|
878
|
-
accent: ["border-accent"],
|
|
879
|
-
basic: ["border-basic"],
|
|
880
|
-
success: ["border-success"],
|
|
881
|
-
alert: ["border-alert"],
|
|
882
|
-
error: ["border-error"],
|
|
883
|
-
info: ["border-info"],
|
|
884
|
-
neutral: ["border-neutral"]
|
|
885
|
-
}),
|
|
886
|
-
/**
|
|
887
|
-
* Size of the button.
|
|
888
|
-
*/
|
|
889
|
-
isBackgroundVisible: {
|
|
890
|
-
true: ["border-b-neutral-container", "border-l-neutral-container"],
|
|
891
|
-
false: ["border-b-transparent", "border-l-transparent"]
|
|
892
|
-
}
|
|
893
|
-
},
|
|
894
|
-
defaultVariants
|
|
895
|
-
}
|
|
896
|
-
);
|
|
897
|
-
|
|
898
|
-
// src/spinner/Spinner.tsx
|
|
899
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
900
|
-
var Spinner = ({
|
|
901
|
-
className,
|
|
902
|
-
size = "current",
|
|
903
|
-
intent = "current",
|
|
904
|
-
label,
|
|
905
|
-
isBackgroundVisible,
|
|
906
|
-
ref,
|
|
907
|
-
...others
|
|
908
|
-
}) => {
|
|
909
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
910
|
-
"span",
|
|
911
|
-
{
|
|
912
|
-
role: "status",
|
|
913
|
-
"data-spark-component": "spinner",
|
|
914
|
-
ref,
|
|
915
|
-
className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
|
|
916
|
-
...others,
|
|
917
|
-
children: label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VisuallyHidden, { children: label })
|
|
918
|
-
}
|
|
919
|
-
);
|
|
920
|
-
};
|
|
921
|
-
|
|
922
|
-
// src/button/Button.styles.tsx
|
|
923
|
-
var import_internal_utils8 = require("@spark-ui/internal-utils");
|
|
924
|
-
var import_class_variance_authority12 = require("class-variance-authority");
|
|
925
|
-
|
|
926
|
-
// src/button/variants/filled.ts
|
|
927
|
-
var import_internal_utils3 = require("@spark-ui/internal-utils");
|
|
928
|
-
var filledVariants = [
|
|
929
|
-
// Main
|
|
930
|
-
{
|
|
931
|
-
intent: "main",
|
|
932
|
-
design: "filled",
|
|
933
|
-
class: (0, import_internal_utils3.tw)([
|
|
934
|
-
"bg-main",
|
|
935
|
-
"text-on-main",
|
|
936
|
-
"hover:bg-main-hovered",
|
|
937
|
-
"enabled:active:bg-main-hovered",
|
|
938
|
-
"focus-visible:bg-main-hovered"
|
|
939
|
-
])
|
|
940
|
-
},
|
|
941
|
-
// Support
|
|
942
|
-
{
|
|
943
|
-
intent: "support",
|
|
944
|
-
design: "filled",
|
|
945
|
-
class: (0, import_internal_utils3.tw)([
|
|
946
|
-
"bg-support",
|
|
947
|
-
"text-on-support",
|
|
948
|
-
"hover:bg-support-hovered",
|
|
949
|
-
"enabled:active:bg-support-hovered",
|
|
950
|
-
"focus-visible:bg-support-hovered"
|
|
951
|
-
])
|
|
952
|
-
},
|
|
953
|
-
// Accent
|
|
954
|
-
{
|
|
955
|
-
intent: "accent",
|
|
956
|
-
design: "filled",
|
|
957
|
-
class: (0, import_internal_utils3.tw)([
|
|
958
|
-
"bg-accent",
|
|
959
|
-
"text-on-accent",
|
|
960
|
-
"hover:bg-accent-hovered",
|
|
961
|
-
"enabled:active:bg-accent-hovered",
|
|
962
|
-
"focus-visible:bg-accent-hovered"
|
|
963
|
-
])
|
|
964
|
-
},
|
|
965
|
-
// Basic
|
|
966
|
-
{
|
|
967
|
-
intent: "basic",
|
|
968
|
-
design: "filled",
|
|
969
|
-
class: (0, import_internal_utils3.tw)([
|
|
970
|
-
"bg-basic",
|
|
971
|
-
"text-on-basic",
|
|
972
|
-
"hover:bg-basic-hovered",
|
|
973
|
-
"enabled:active:bg-basic-hovered",
|
|
974
|
-
"focus-visible:bg-basic-hovered"
|
|
975
|
-
])
|
|
976
|
-
},
|
|
977
|
-
// Success
|
|
978
|
-
{
|
|
979
|
-
intent: "success",
|
|
980
|
-
design: "filled",
|
|
981
|
-
class: (0, import_internal_utils3.tw)([
|
|
982
|
-
"bg-success",
|
|
983
|
-
"text-on-success",
|
|
984
|
-
"hover:bg-success-hovered",
|
|
985
|
-
"enabled:active:bg-success-hovered",
|
|
986
|
-
"focus-visible:bg-success-hovered"
|
|
987
|
-
])
|
|
988
|
-
},
|
|
989
|
-
// Alert
|
|
990
|
-
{
|
|
991
|
-
intent: "alert",
|
|
992
|
-
design: "filled",
|
|
993
|
-
class: (0, import_internal_utils3.tw)([
|
|
994
|
-
"bg-alert",
|
|
995
|
-
"text-on-alert",
|
|
996
|
-
"hover:bg-alert-hovered",
|
|
997
|
-
"enabled:active:bg-alert-hovered",
|
|
998
|
-
"focus-visible:bg-alert-hovered"
|
|
999
|
-
])
|
|
1000
|
-
},
|
|
1001
|
-
// Danger
|
|
1002
|
-
{
|
|
1003
|
-
intent: "danger",
|
|
1004
|
-
design: "filled",
|
|
1005
|
-
class: (0, import_internal_utils3.tw)([
|
|
1006
|
-
"text-on-error bg-error",
|
|
1007
|
-
"hover:bg-error-hovered enabled:active:bg-error-hovered",
|
|
1008
|
-
"focus-visible:bg-error-hovered"
|
|
1009
|
-
])
|
|
1010
|
-
},
|
|
1011
|
-
// Info
|
|
1012
|
-
{
|
|
1013
|
-
intent: "info",
|
|
1014
|
-
design: "filled",
|
|
1015
|
-
class: (0, import_internal_utils3.tw)([
|
|
1016
|
-
"text-on-error bg-info",
|
|
1017
|
-
"hover:bg-info-hovered enabled:active:bg-info-hovered",
|
|
1018
|
-
"focus-visible:bg-info-hovered"
|
|
1019
|
-
])
|
|
1020
|
-
},
|
|
1021
|
-
// Neutral
|
|
1022
|
-
{
|
|
1023
|
-
intent: "neutral",
|
|
1024
|
-
design: "filled",
|
|
1025
|
-
class: (0, import_internal_utils3.tw)([
|
|
1026
|
-
"bg-neutral",
|
|
1027
|
-
"text-on-neutral",
|
|
1028
|
-
"hover:bg-neutral-hovered",
|
|
1029
|
-
"enabled:active:bg-neutral-hovered",
|
|
1030
|
-
"focus-visible:bg-neutral-hovered"
|
|
1031
|
-
])
|
|
1032
|
-
},
|
|
1033
|
-
// Surface
|
|
1034
|
-
{
|
|
1035
|
-
intent: "surface",
|
|
1036
|
-
design: "filled",
|
|
1037
|
-
class: (0, import_internal_utils3.tw)([
|
|
1038
|
-
"bg-surface",
|
|
1039
|
-
"text-on-surface",
|
|
1040
|
-
"hover:bg-surface-hovered",
|
|
1041
|
-
"enabled:active:bg-surface-hovered",
|
|
1042
|
-
"focus-visible:bg-surface-hovered"
|
|
1043
|
-
])
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
intent: "surfaceInverse",
|
|
1047
|
-
design: "filled",
|
|
1048
|
-
class: (0, import_internal_utils3.tw)([
|
|
1049
|
-
"bg-surface-inverse",
|
|
1050
|
-
"text-on-surface-inverse",
|
|
1051
|
-
"hover:bg-surface-inverse-hovered",
|
|
1052
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1053
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1054
|
-
])
|
|
1055
|
-
}
|
|
1056
|
-
];
|
|
1057
|
-
|
|
1058
|
-
// src/button/variants/ghost.ts
|
|
1059
|
-
var import_internal_utils4 = require("@spark-ui/internal-utils");
|
|
1060
|
-
var ghostVariants = [
|
|
1061
|
-
{
|
|
1062
|
-
intent: "main",
|
|
1063
|
-
design: "ghost",
|
|
1064
|
-
class: (0, import_internal_utils4.tw)([
|
|
1065
|
-
"text-on-main-container",
|
|
1066
|
-
"hover:bg-main/dim-5",
|
|
1067
|
-
"enabled:active:bg-main/dim-5",
|
|
1068
|
-
"focus-visible:bg-main/dim-5"
|
|
1069
|
-
])
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
intent: "support",
|
|
1073
|
-
design: "ghost",
|
|
1074
|
-
class: (0, import_internal_utils4.tw)([
|
|
1075
|
-
"text-on-support-container",
|
|
1076
|
-
"hover:bg-support/dim-5",
|
|
1077
|
-
"enabled:active:bg-support/dim-5",
|
|
1078
|
-
"focus-visible:bg-support/dim-5"
|
|
1079
|
-
])
|
|
1080
|
-
},
|
|
1081
|
-
{
|
|
1082
|
-
intent: "accent",
|
|
1083
|
-
design: "ghost",
|
|
1084
|
-
class: (0, import_internal_utils4.tw)([
|
|
1085
|
-
"text-on-accent-container",
|
|
1086
|
-
"hover:bg-accent/dim-5",
|
|
1087
|
-
"enabled:active:bg-accent/dim-5",
|
|
1088
|
-
"focus-visible:bg-accent/dim-5"
|
|
1089
|
-
])
|
|
1090
|
-
},
|
|
1091
|
-
{
|
|
1092
|
-
intent: "basic",
|
|
1093
|
-
design: "ghost",
|
|
1094
|
-
class: (0, import_internal_utils4.tw)([
|
|
1095
|
-
"text-on-basic-container",
|
|
1096
|
-
"hover:bg-basic/dim-5",
|
|
1097
|
-
"enabled:active:bg-basic/dim-5",
|
|
1098
|
-
"focus-visible:bg-basic/dim-5"
|
|
1099
|
-
])
|
|
1100
|
-
},
|
|
1101
|
-
{
|
|
1102
|
-
intent: "success",
|
|
1103
|
-
design: "ghost",
|
|
1104
|
-
class: (0, import_internal_utils4.tw)([
|
|
1105
|
-
"text-on-success-container",
|
|
1106
|
-
"hover:bg-success/dim-5",
|
|
1107
|
-
"enabled:active:bg-success/dim-5",
|
|
1108
|
-
"focus-visible:bg-success/dim-5"
|
|
1109
|
-
])
|
|
1110
|
-
},
|
|
1111
|
-
{
|
|
1112
|
-
intent: "alert",
|
|
1113
|
-
design: "ghost",
|
|
1114
|
-
class: (0, import_internal_utils4.tw)([
|
|
1115
|
-
"text-on-alert-container",
|
|
1116
|
-
"hover:bg-alert/dim-5",
|
|
1117
|
-
"enabled:active:bg-alert/dim-5",
|
|
1118
|
-
"focus-visible:bg-alert/dim-5"
|
|
1119
|
-
])
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
intent: "danger",
|
|
1123
|
-
design: "ghost",
|
|
1124
|
-
class: (0, import_internal_utils4.tw)([
|
|
1125
|
-
"text-on-error-container",
|
|
1126
|
-
"hover:bg-error/dim-5",
|
|
1127
|
-
"enabled:active:bg-error/dim-5",
|
|
1128
|
-
"focus-visible:bg-error/dim-5"
|
|
1129
|
-
])
|
|
1130
|
-
},
|
|
1131
|
-
{
|
|
1132
|
-
intent: "info",
|
|
1133
|
-
design: "ghost",
|
|
1134
|
-
class: (0, import_internal_utils4.tw)([
|
|
1135
|
-
"text-on-info-container",
|
|
1136
|
-
"hover:bg-info/dim-5",
|
|
1137
|
-
"enabled:active:bg-info/dim-5",
|
|
1138
|
-
"focus-visible:bg-info/dim-5"
|
|
1139
|
-
])
|
|
1140
|
-
},
|
|
1141
|
-
{
|
|
1142
|
-
intent: "neutral",
|
|
1143
|
-
design: "ghost",
|
|
1144
|
-
class: (0, import_internal_utils4.tw)([
|
|
1145
|
-
"text-on-neutral-container",
|
|
1146
|
-
"hover:bg-neutral/dim-5",
|
|
1147
|
-
"enabled:active:bg-neutral/dim-5",
|
|
1148
|
-
"focus-visible:bg-neutral/dim-5"
|
|
1149
|
-
])
|
|
1150
|
-
},
|
|
1151
|
-
{
|
|
1152
|
-
intent: "surface",
|
|
1153
|
-
design: "ghost",
|
|
1154
|
-
class: (0, import_internal_utils4.tw)([
|
|
1155
|
-
"text-surface",
|
|
1156
|
-
"hover:bg-surface/dim-5",
|
|
1157
|
-
"enabled:active:bg-surface/dim-5",
|
|
1158
|
-
"focus-visible:bg-surface/dim-5"
|
|
1159
|
-
])
|
|
1160
|
-
},
|
|
1161
|
-
{
|
|
1162
|
-
intent: "surfaceInverse",
|
|
1163
|
-
design: "ghost",
|
|
1164
|
-
class: (0, import_internal_utils4.tw)([
|
|
1165
|
-
"text-surface-inverse",
|
|
1166
|
-
"hover:bg-surface-inverse/dim-5",
|
|
1167
|
-
"enabled:active:bg-surface-inverse/dim-5",
|
|
1168
|
-
"focus-visible:bg-surface-inverse/dim-5"
|
|
1169
|
-
])
|
|
1170
|
-
}
|
|
1171
|
-
];
|
|
1172
|
-
|
|
1173
|
-
// src/button/variants/outlined.ts
|
|
1174
|
-
var import_internal_utils5 = require("@spark-ui/internal-utils");
|
|
1175
|
-
var outlinedVariants = [
|
|
1176
|
-
{
|
|
1177
|
-
intent: "main",
|
|
1178
|
-
design: "outlined",
|
|
1179
|
-
class: (0, import_internal_utils5.tw)([
|
|
1180
|
-
"hover:bg-main/dim-5",
|
|
1181
|
-
"enabled:active:bg-main/dim-5",
|
|
1182
|
-
"focus-visible:bg-main/dim-5",
|
|
1183
|
-
"text-main"
|
|
1184
|
-
])
|
|
1185
|
-
},
|
|
1186
|
-
{
|
|
1187
|
-
intent: "support",
|
|
1188
|
-
design: "outlined",
|
|
1189
|
-
class: (0, import_internal_utils5.tw)([
|
|
1190
|
-
"hover:bg-support/dim-5",
|
|
1191
|
-
"enabled:active:bg-support/dim-5",
|
|
1192
|
-
"focus-visible:bg-support/dim-5",
|
|
1193
|
-
"text-support"
|
|
1194
|
-
])
|
|
1195
|
-
},
|
|
1196
|
-
{
|
|
1197
|
-
intent: "accent",
|
|
1198
|
-
design: "outlined",
|
|
1199
|
-
class: (0, import_internal_utils5.tw)([
|
|
1200
|
-
"hover:bg-accent/dim-5",
|
|
1201
|
-
"enabled:active:bg-accent/dim-5",
|
|
1202
|
-
"focus-visible:bg-accent/dim-5",
|
|
1203
|
-
"text-accent"
|
|
1204
|
-
])
|
|
1205
|
-
},
|
|
1206
|
-
{
|
|
1207
|
-
intent: "basic",
|
|
1208
|
-
design: "outlined",
|
|
1209
|
-
class: (0, import_internal_utils5.tw)([
|
|
1210
|
-
"hover:bg-basic/dim-5",
|
|
1211
|
-
"enabled:active:bg-basic/dim-5",
|
|
1212
|
-
"focus-visible:bg-basic/dim-5",
|
|
1213
|
-
"text-basic"
|
|
1214
|
-
])
|
|
1215
|
-
},
|
|
1216
|
-
{
|
|
1217
|
-
intent: "success",
|
|
1218
|
-
design: "outlined",
|
|
1219
|
-
class: (0, import_internal_utils5.tw)([
|
|
1220
|
-
"hover:bg-success/dim-5",
|
|
1221
|
-
"enabled:active:bg-success/dim-5",
|
|
1222
|
-
"focus-visible:bg-success/dim-5",
|
|
1223
|
-
"text-success"
|
|
1224
|
-
])
|
|
1225
|
-
},
|
|
1226
|
-
{
|
|
1227
|
-
intent: "alert",
|
|
1228
|
-
design: "outlined",
|
|
1229
|
-
class: (0, import_internal_utils5.tw)([
|
|
1230
|
-
"hover:bg-alert/dim-5",
|
|
1231
|
-
"enabled:active:bg-alert/dim-5",
|
|
1232
|
-
"focus-visible:bg-alert/dim-5",
|
|
1233
|
-
"text-alert"
|
|
1234
|
-
])
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
intent: "danger",
|
|
1238
|
-
design: "outlined",
|
|
1239
|
-
class: (0, import_internal_utils5.tw)([
|
|
1240
|
-
"hover:bg-error/dim-5",
|
|
1241
|
-
"enabled:active:bg-error/dim-5",
|
|
1242
|
-
"focus-visible:bg-error/dim-5",
|
|
1243
|
-
"text-error"
|
|
1244
|
-
])
|
|
1245
|
-
},
|
|
1246
|
-
{
|
|
1247
|
-
intent: "info",
|
|
1248
|
-
design: "outlined",
|
|
1249
|
-
class: (0, import_internal_utils5.tw)([
|
|
1250
|
-
"hover:bg-info/dim-5",
|
|
1251
|
-
"enabled:active:bg-info/dim-5",
|
|
1252
|
-
"focus-visible:bg-info/dim-5",
|
|
1253
|
-
"text-info"
|
|
1254
|
-
])
|
|
1255
|
-
},
|
|
1256
|
-
{
|
|
1257
|
-
intent: "neutral",
|
|
1258
|
-
design: "outlined",
|
|
1259
|
-
class: (0, import_internal_utils5.tw)([
|
|
1260
|
-
"hover:bg-neutral/dim-5",
|
|
1261
|
-
"enabled:active:bg-neutral/dim-5",
|
|
1262
|
-
"focus-visible:bg-neutral/dim-5",
|
|
1263
|
-
"text-neutral"
|
|
1264
|
-
])
|
|
1265
|
-
},
|
|
1266
|
-
{
|
|
1267
|
-
intent: "surface",
|
|
1268
|
-
design: "outlined",
|
|
1269
|
-
class: (0, import_internal_utils5.tw)([
|
|
1270
|
-
"hover:bg-surface/dim-5",
|
|
1271
|
-
"enabled:active:bg-surface/dim-5",
|
|
1272
|
-
"focus-visible:bg-surface/dim-5",
|
|
1273
|
-
"text-surface"
|
|
1274
|
-
])
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
intent: "surfaceInverse",
|
|
1278
|
-
design: "outlined",
|
|
1279
|
-
class: (0, import_internal_utils5.tw)([
|
|
1280
|
-
"hover:bg-surface-inverse/dim-5",
|
|
1281
|
-
"enabled:active:bg-surface-inverse/dim-5",
|
|
1282
|
-
"focus-visible:bg-surface-inverse/dim-5",
|
|
1283
|
-
"text-surface-inverse"
|
|
1284
|
-
])
|
|
1285
|
-
}
|
|
1286
|
-
];
|
|
1287
|
-
|
|
1288
|
-
// src/button/variants/tinted.ts
|
|
1289
|
-
var import_internal_utils6 = require("@spark-ui/internal-utils");
|
|
1290
|
-
var tintedVariants = [
|
|
1291
|
-
{
|
|
1292
|
-
intent: "main",
|
|
1293
|
-
design: "tinted",
|
|
1294
|
-
class: (0, import_internal_utils6.tw)([
|
|
1295
|
-
"bg-main-container",
|
|
1296
|
-
"text-on-main-container",
|
|
1297
|
-
"hover:bg-main-container-hovered",
|
|
1298
|
-
"enabled:active:bg-main-container-hovered",
|
|
1299
|
-
"focus-visible:bg-main-container-hovered"
|
|
1300
|
-
])
|
|
1301
|
-
},
|
|
1302
|
-
{
|
|
1303
|
-
intent: "support",
|
|
1304
|
-
design: "tinted",
|
|
1305
|
-
class: (0, import_internal_utils6.tw)([
|
|
1306
|
-
"bg-support-container",
|
|
1307
|
-
"text-on-support-container",
|
|
1308
|
-
"hover:bg-support-container-hovered",
|
|
1309
|
-
"enabled:active:bg-support-container-hovered",
|
|
1310
|
-
"focus-visible:bg-support-container-hovered"
|
|
1311
|
-
])
|
|
1312
|
-
},
|
|
1313
|
-
{
|
|
1314
|
-
intent: "accent",
|
|
1315
|
-
design: "tinted",
|
|
1316
|
-
class: (0, import_internal_utils6.tw)([
|
|
1317
|
-
"bg-accent-container",
|
|
1318
|
-
"text-on-accent-container",
|
|
1319
|
-
"hover:bg-accent-container-hovered",
|
|
1320
|
-
"enabled:active:bg-accent-container-hovered",
|
|
1321
|
-
"focus-visible:bg-accent-container-hovered"
|
|
1322
|
-
])
|
|
1323
|
-
},
|
|
1324
|
-
{
|
|
1325
|
-
intent: "basic",
|
|
1326
|
-
design: "tinted",
|
|
1327
|
-
class: (0, import_internal_utils6.tw)([
|
|
1328
|
-
"bg-basic-container",
|
|
1329
|
-
"text-on-basic-container",
|
|
1330
|
-
"hover:bg-basic-container-hovered",
|
|
1331
|
-
"enabled:active:bg-basic-container-hovered",
|
|
1332
|
-
"focus-visible:bg-basic-container-hovered"
|
|
1333
|
-
])
|
|
1334
|
-
},
|
|
1335
|
-
{
|
|
1336
|
-
intent: "success",
|
|
1337
|
-
design: "tinted",
|
|
1338
|
-
class: (0, import_internal_utils6.tw)([
|
|
1339
|
-
"bg-success-container",
|
|
1340
|
-
"text-on-success-container",
|
|
1341
|
-
"hover:bg-success-container-hovered",
|
|
1342
|
-
"enabled:active:bg-success-container-hovered",
|
|
1343
|
-
"focus-visible:bg-success-container-hovered"
|
|
1344
|
-
])
|
|
1345
|
-
},
|
|
1346
|
-
{
|
|
1347
|
-
intent: "alert",
|
|
1348
|
-
design: "tinted",
|
|
1349
|
-
class: (0, import_internal_utils6.tw)([
|
|
1350
|
-
"bg-alert-container",
|
|
1351
|
-
"text-on-alert-container",
|
|
1352
|
-
"hover:bg-alert-container-hovered",
|
|
1353
|
-
"enabled:active:bg-alert-container-hovered",
|
|
1354
|
-
"focus-visible:bg-alert-container-hovered"
|
|
1355
|
-
])
|
|
1356
|
-
},
|
|
1357
|
-
{
|
|
1358
|
-
intent: "danger",
|
|
1359
|
-
design: "tinted",
|
|
1360
|
-
class: (0, import_internal_utils6.tw)([
|
|
1361
|
-
"bg-error-container",
|
|
1362
|
-
"text-on-error-container",
|
|
1363
|
-
"hover:bg-error-container-hovered",
|
|
1364
|
-
"enabled:active:bg-error-container-hovered",
|
|
1365
|
-
"focus-visible:bg-error-container-hovered"
|
|
1366
|
-
])
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
intent: "info",
|
|
1370
|
-
design: "tinted",
|
|
1371
|
-
class: (0, import_internal_utils6.tw)([
|
|
1372
|
-
"bg-info-container",
|
|
1373
|
-
"text-on-info-container",
|
|
1374
|
-
"hover:bg-info-container-hovered",
|
|
1375
|
-
"enabled:active:bg-info-container-hovered",
|
|
1376
|
-
"focus-visible:bg-info-container-hovered"
|
|
1377
|
-
])
|
|
1378
|
-
},
|
|
1379
|
-
{
|
|
1380
|
-
intent: "neutral",
|
|
1381
|
-
design: "tinted",
|
|
1382
|
-
class: (0, import_internal_utils6.tw)([
|
|
1383
|
-
"bg-neutral-container",
|
|
1384
|
-
"text-on-neutral-container",
|
|
1385
|
-
"hover:bg-neutral-container-hovered",
|
|
1386
|
-
"enabled:active:bg-neutral-container-hovered",
|
|
1387
|
-
"focus-visible:bg-neutral-container-hovered"
|
|
1388
|
-
])
|
|
1389
|
-
},
|
|
1390
|
-
{
|
|
1391
|
-
intent: "surface",
|
|
1392
|
-
design: "tinted",
|
|
1393
|
-
class: (0, import_internal_utils6.tw)([
|
|
1394
|
-
"bg-surface",
|
|
1395
|
-
"text-on-surface",
|
|
1396
|
-
"hover:bg-surface-hovered",
|
|
1397
|
-
"enabled:active:bg-surface-hovered",
|
|
1398
|
-
"focus-visible:bg-surface-hovered"
|
|
1399
|
-
])
|
|
1400
|
-
},
|
|
1401
|
-
{
|
|
1402
|
-
intent: "surfaceInverse",
|
|
1403
|
-
design: "tinted",
|
|
1404
|
-
class: (0, import_internal_utils6.tw)([
|
|
1405
|
-
"bg-surface-inverse",
|
|
1406
|
-
"text-on-surface-inverse",
|
|
1407
|
-
"hover:bg-surface-inverse-hovered",
|
|
1408
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1409
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1410
|
-
])
|
|
1411
|
-
}
|
|
1412
|
-
];
|
|
1413
|
-
|
|
1414
|
-
// src/button/variants/contrast.ts
|
|
1415
|
-
var import_internal_utils7 = require("@spark-ui/internal-utils");
|
|
1416
|
-
var contrastVariants = [
|
|
1417
|
-
{
|
|
1418
|
-
intent: "main",
|
|
1419
|
-
design: "contrast",
|
|
1420
|
-
class: (0, import_internal_utils7.tw)([
|
|
1421
|
-
"text-on-main-contaier bg-surface",
|
|
1422
|
-
"hover:bg-main-container-hovered",
|
|
1423
|
-
"enabled:active:bg-main-container-hovered",
|
|
1424
|
-
"focus-visible:bg-main-container-hovered"
|
|
1425
|
-
])
|
|
1426
|
-
},
|
|
1427
|
-
{
|
|
1428
|
-
intent: "support",
|
|
1429
|
-
design: "contrast",
|
|
1430
|
-
class: (0, import_internal_utils7.tw)([
|
|
1431
|
-
"text-on-support-container bg-surface",
|
|
1432
|
-
"hover:bg-support-container-hovered",
|
|
1433
|
-
"enabled:active:bg-support-container-hovered",
|
|
1434
|
-
"focus-visible:bg-support-container-hovered"
|
|
1435
|
-
])
|
|
1436
|
-
},
|
|
1437
|
-
{
|
|
1438
|
-
intent: "accent",
|
|
1439
|
-
design: "contrast",
|
|
1440
|
-
class: (0, import_internal_utils7.tw)([
|
|
1441
|
-
"text-on-accent-container bg-surface",
|
|
1442
|
-
"hover:bg-accent-container-hovered",
|
|
1443
|
-
"enabled:active:bg-accent-container-hovered",
|
|
1444
|
-
"focus-visible:bg-accent-container-hovered"
|
|
1445
|
-
])
|
|
1446
|
-
},
|
|
1447
|
-
{
|
|
1448
|
-
intent: "basic",
|
|
1449
|
-
design: "contrast",
|
|
1450
|
-
class: (0, import_internal_utils7.tw)([
|
|
1451
|
-
"text-on-basic-container bg-surface",
|
|
1452
|
-
"hover:bg-basic-container-hovered",
|
|
1453
|
-
"enabled:active:bg-basic-container-hovered",
|
|
1454
|
-
"focus-visible:bg-basic-container-hovered"
|
|
1455
|
-
])
|
|
1456
|
-
},
|
|
1457
|
-
{
|
|
1458
|
-
intent: "success",
|
|
1459
|
-
design: "contrast",
|
|
1460
|
-
class: (0, import_internal_utils7.tw)([
|
|
1461
|
-
"text-on-success-container bg-surface",
|
|
1462
|
-
"hover:bg-success-container-hovered",
|
|
1463
|
-
"enabled:active:bg-success-container-hovered",
|
|
1464
|
-
"focus-visible:bg-success-container-hovered"
|
|
1465
|
-
])
|
|
1466
|
-
},
|
|
1467
|
-
{
|
|
1468
|
-
intent: "alert",
|
|
1469
|
-
design: "contrast",
|
|
1470
|
-
class: (0, import_internal_utils7.tw)([
|
|
1471
|
-
"text-on-alert-container bg-surface",
|
|
1472
|
-
"hover:bg-alert-container-hovered",
|
|
1473
|
-
"enabled:active:bg-alert-container-hovered",
|
|
1474
|
-
"focus-visible:bg-alert-container-hovered"
|
|
1475
|
-
])
|
|
1476
|
-
},
|
|
1477
|
-
{
|
|
1478
|
-
intent: "danger",
|
|
1479
|
-
design: "contrast",
|
|
1480
|
-
class: (0, import_internal_utils7.tw)([
|
|
1481
|
-
"text-on-error-container bg-surface",
|
|
1482
|
-
"hover:bg-error-container-hovered",
|
|
1483
|
-
"enabled:active:bg-error-container-hovered",
|
|
1484
|
-
"focus-visible:bg-error-container-hovered"
|
|
1485
|
-
])
|
|
1486
|
-
},
|
|
1487
|
-
{
|
|
1488
|
-
intent: "info",
|
|
1489
|
-
design: "contrast",
|
|
1490
|
-
class: (0, import_internal_utils7.tw)([
|
|
1491
|
-
"text-on-info-container bg-surface",
|
|
1492
|
-
"hover:bg-info-container-hovered",
|
|
1493
|
-
"enabled:active:bg-info-container-hovered",
|
|
1494
|
-
"focus-visible:bg-info-container-hovered"
|
|
1495
|
-
])
|
|
1496
|
-
},
|
|
1497
|
-
{
|
|
1498
|
-
intent: "neutral",
|
|
1499
|
-
design: "contrast",
|
|
1500
|
-
class: (0, import_internal_utils7.tw)([
|
|
1501
|
-
"text-on-neutral-container bg-surface",
|
|
1502
|
-
"hover:bg-neutral-container-hovered",
|
|
1503
|
-
"enabled:active:bg-neutral-container-hovered",
|
|
1504
|
-
"focus-visible:bg-neutral-container-hovered"
|
|
1505
|
-
])
|
|
1506
|
-
},
|
|
1507
|
-
{
|
|
1508
|
-
intent: "surface",
|
|
1509
|
-
design: "contrast",
|
|
1510
|
-
class: (0, import_internal_utils7.tw)([
|
|
1511
|
-
"text-on-surface bg-surface",
|
|
1512
|
-
"hover:bg-surface-hovered",
|
|
1513
|
-
"enabled:active:bg-surface-hovered",
|
|
1514
|
-
"focus-visible:bg-surface-hovered"
|
|
1515
|
-
])
|
|
1516
|
-
},
|
|
1517
|
-
{
|
|
1518
|
-
intent: "surfaceInverse",
|
|
1519
|
-
design: "contrast",
|
|
1520
|
-
class: (0, import_internal_utils7.tw)([
|
|
1521
|
-
"text-on-surface-inverse bg-surface-inverse",
|
|
1522
|
-
"hover:bg-surface-inverse-hovered",
|
|
1523
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1524
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1525
|
-
])
|
|
1526
|
-
}
|
|
1527
|
-
];
|
|
1528
|
-
|
|
1529
|
-
// src/button/Button.styles.tsx
|
|
1530
|
-
var buttonStyles = (0, import_class_variance_authority12.cva)(
|
|
1531
|
-
[
|
|
1532
|
-
"u-shadow-border-transition",
|
|
1533
|
-
"box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
|
|
1534
|
-
"default:px-lg",
|
|
1535
|
-
"text-body-1 font-bold",
|
|
1536
|
-
"focus-visible:u-outline"
|
|
1537
|
-
],
|
|
1538
|
-
{
|
|
1539
|
-
variants: {
|
|
1540
|
-
/**
|
|
1541
|
-
* Main style of the button.
|
|
1542
|
-
*
|
|
1543
|
-
* - `filled`: Button will be plain.
|
|
1544
|
-
*
|
|
1545
|
-
* - `outlined`: Button will be transparent with an outline.
|
|
1546
|
-
*
|
|
1547
|
-
* - `tinted`: Button will be filled but using a lighter color scheme.
|
|
1548
|
-
*
|
|
1549
|
-
* - `ghost`: Button will look like a link. No borders, plain text.
|
|
1550
|
-
*
|
|
1551
|
-
* - `contrast`: Button will be surface filled. No borders, plain text.
|
|
1552
|
-
*
|
|
1553
|
-
*/
|
|
1554
|
-
design: (0, import_internal_utils8.makeVariants)({
|
|
1555
|
-
filled: [],
|
|
1556
|
-
outlined: ["bg-transparent", "border-sm", "border-current"],
|
|
1557
|
-
tinted: [],
|
|
1558
|
-
ghost: ["default:-mx-md px-md hover:bg-main/dim-5"],
|
|
1559
|
-
contrast: []
|
|
1560
|
-
}),
|
|
1561
|
-
underline: {
|
|
1562
|
-
true: ["underline"]
|
|
1563
|
-
},
|
|
1564
|
-
/**
|
|
1565
|
-
* Color scheme of the button.
|
|
1566
|
-
*/
|
|
1567
|
-
intent: (0, import_internal_utils8.makeVariants)({
|
|
1568
|
-
main: [],
|
|
1569
|
-
support: [],
|
|
1570
|
-
accent: [],
|
|
1571
|
-
basic: [],
|
|
1572
|
-
success: [],
|
|
1573
|
-
alert: [],
|
|
1574
|
-
danger: [],
|
|
1575
|
-
info: [],
|
|
1576
|
-
neutral: [],
|
|
1577
|
-
surface: [],
|
|
1578
|
-
surfaceInverse: []
|
|
1579
|
-
}),
|
|
1580
|
-
/**
|
|
1581
|
-
* Size of the button.
|
|
1582
|
-
*/
|
|
1583
|
-
size: (0, import_internal_utils8.makeVariants)({
|
|
1584
|
-
sm: ["min-w-sz-32", "h-sz-32"],
|
|
1585
|
-
md: ["min-w-sz-44", "h-sz-44"],
|
|
1586
|
-
lg: ["min-w-sz-56", "h-sz-56"]
|
|
1587
|
-
}),
|
|
1588
|
-
/**
|
|
1589
|
-
* Shape of the button.
|
|
1590
|
-
*/
|
|
1591
|
-
shape: (0, import_internal_utils8.makeVariants)({
|
|
1592
|
-
rounded: ["rounded-lg"],
|
|
1593
|
-
square: ["rounded-0"],
|
|
1594
|
-
pill: ["rounded-full"]
|
|
1595
|
-
}),
|
|
1596
|
-
/**
|
|
1597
|
-
* Disable the button, preventing user interaction and adding opacity.
|
|
1598
|
-
*/
|
|
1599
|
-
disabled: {
|
|
1600
|
-
true: ["cursor-not-allowed", "opacity-dim-3"],
|
|
1601
|
-
false: ["cursor-pointer"]
|
|
1602
|
-
}
|
|
1603
|
-
},
|
|
1604
|
-
compoundVariants: [
|
|
1605
|
-
...filledVariants,
|
|
1606
|
-
...outlinedVariants,
|
|
1607
|
-
...tintedVariants,
|
|
1608
|
-
...ghostVariants,
|
|
1609
|
-
...contrastVariants
|
|
1610
|
-
],
|
|
1611
|
-
defaultVariants: {
|
|
1612
|
-
design: "filled",
|
|
1613
|
-
intent: "main",
|
|
1614
|
-
size: "md",
|
|
1615
|
-
shape: "rounded"
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
);
|
|
1619
|
-
|
|
1620
|
-
// src/button/Button.tsx
|
|
1621
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1622
|
-
var blockedEventHandlers = [
|
|
1623
|
-
"onClick",
|
|
1624
|
-
"onMouseDown",
|
|
1625
|
-
"onMouseUp",
|
|
1626
|
-
"onMouseEnter",
|
|
1627
|
-
"onMouseLeave",
|
|
1628
|
-
"onMouseOver",
|
|
1629
|
-
"onMouseOut",
|
|
1630
|
-
"onKeyDown",
|
|
1631
|
-
"onKeyPress",
|
|
1632
|
-
"onKeyUp",
|
|
1633
|
-
"onSubmit"
|
|
1634
|
-
];
|
|
1635
|
-
var Button = ({
|
|
1636
|
-
children,
|
|
1637
|
-
design = "filled",
|
|
1638
|
-
disabled = false,
|
|
1639
|
-
intent = "main",
|
|
1640
|
-
isLoading = false,
|
|
1641
|
-
loadingLabel,
|
|
1642
|
-
loadingText,
|
|
1643
|
-
shape = "rounded",
|
|
1644
|
-
size = "md",
|
|
1645
|
-
asChild,
|
|
1646
|
-
className,
|
|
1647
|
-
underline = false,
|
|
1648
|
-
ref,
|
|
1649
|
-
...others
|
|
1650
|
-
}) => {
|
|
1651
|
-
const Component = asChild ? Slot : "button";
|
|
1652
|
-
const shouldNotInteract = !!disabled || isLoading;
|
|
1653
|
-
const disabledEventHandlers = (0, import_react7.useMemo)(() => {
|
|
1654
|
-
const result = {};
|
|
1655
|
-
if (shouldNotInteract) {
|
|
1656
|
-
blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
|
|
1657
|
-
}
|
|
1658
|
-
return result;
|
|
1659
|
-
}, [shouldNotInteract]);
|
|
1660
|
-
const spinnerProps = {
|
|
1661
|
-
size: "current",
|
|
1662
|
-
className: loadingText ? "inline-block" : "absolute",
|
|
1663
|
-
...loadingLabel && { "aria-label": loadingLabel }
|
|
1664
|
-
};
|
|
1665
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1666
|
-
Component,
|
|
1667
|
-
{
|
|
1668
|
-
"data-spark-component": "button",
|
|
1669
|
-
...Component === "button" && { type: "button" },
|
|
1670
|
-
ref,
|
|
1671
|
-
className: buttonStyles({
|
|
1672
|
-
className,
|
|
1673
|
-
design,
|
|
1674
|
-
disabled: shouldNotInteract,
|
|
1675
|
-
intent,
|
|
1676
|
-
shape,
|
|
1677
|
-
size,
|
|
1678
|
-
underline
|
|
1679
|
-
}),
|
|
1680
|
-
disabled: !!disabled,
|
|
1681
|
-
"aria-busy": isLoading,
|
|
1682
|
-
"aria-live": isLoading ? "assertive" : "off",
|
|
1683
|
-
...others,
|
|
1684
|
-
...disabledEventHandlers,
|
|
1685
|
-
children: wrapPolymorphicSlot(
|
|
1686
|
-
asChild,
|
|
1687
|
-
children,
|
|
1688
|
-
(slotted) => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1689
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Spinner, { ...spinnerProps }),
|
|
1690
|
-
loadingText && loadingText,
|
|
1691
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1692
|
-
"div",
|
|
1693
|
-
{
|
|
1694
|
-
"aria-hidden": true,
|
|
1695
|
-
className: (0, import_class_variance_authority13.cx)("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
|
|
1696
|
-
children: slotted
|
|
1697
|
-
}
|
|
1698
|
-
)
|
|
1699
|
-
] }) : slotted
|
|
1700
|
-
)
|
|
1701
|
-
}
|
|
1702
|
-
);
|
|
1703
|
-
};
|
|
1704
|
-
Button.displayName = "Button";
|
|
1705
|
-
|
|
1706
|
-
// src/icon-button/IconButton.styles.tsx
|
|
1707
|
-
var import_internal_utils9 = require("@spark-ui/internal-utils");
|
|
1708
|
-
var import_class_variance_authority14 = require("class-variance-authority");
|
|
1709
|
-
var iconButtonStyles = (0, import_class_variance_authority14.cva)(["pl-0 pr-0"], {
|
|
1710
|
-
variants: {
|
|
1711
|
-
/**
|
|
1712
|
-
* Sets the size of the icon.
|
|
1713
|
-
*/
|
|
1714
|
-
size: (0, import_internal_utils9.makeVariants)({
|
|
1715
|
-
sm: ["text-body-1"],
|
|
1716
|
-
md: ["text-body-1"],
|
|
1717
|
-
lg: ["text-display-3"]
|
|
1718
|
-
})
|
|
1719
|
-
}
|
|
1720
|
-
});
|
|
1721
|
-
|
|
1722
|
-
// src/icon-button/IconButton.tsx
|
|
1723
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1724
|
-
var IconButton = ({
|
|
1725
|
-
design = "filled",
|
|
1726
|
-
disabled = false,
|
|
1727
|
-
intent = "main",
|
|
1728
|
-
shape = "rounded",
|
|
1729
|
-
size = "md",
|
|
1730
|
-
className,
|
|
1731
|
-
ref,
|
|
1732
|
-
...others
|
|
1733
|
-
}) => {
|
|
1734
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1735
|
-
Button,
|
|
1736
|
-
{
|
|
1737
|
-
"data-spark-component": "icon-button",
|
|
1738
|
-
ref,
|
|
1739
|
-
className: iconButtonStyles({ size, className }),
|
|
1740
|
-
design,
|
|
1741
|
-
disabled,
|
|
1742
|
-
intent,
|
|
1743
|
-
shape,
|
|
1744
|
-
size,
|
|
1745
|
-
...others
|
|
1746
|
-
}
|
|
1747
|
-
);
|
|
1748
|
-
};
|
|
1749
|
-
IconButton.displayName = "IconButton";
|
|
1750
|
-
|
|
1751
|
-
// src/stepper/StepperButton.tsx
|
|
1752
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1753
|
-
var IncrementButton = ({
|
|
1754
|
-
children,
|
|
1755
|
-
design = "ghost",
|
|
1756
|
-
intent = "neutral",
|
|
1757
|
-
className,
|
|
1758
|
-
ref: forwardedRef,
|
|
1759
|
-
...rest
|
|
1760
|
-
}) => {
|
|
1761
|
-
const innerRef = (0, import_react8.useRef)(null);
|
|
1762
|
-
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
1763
|
-
const { incrementButtonProps } = useStepperContext();
|
|
1764
|
-
const { buttonProps } = (0, import_button2.useButton)({ ...incrementButtonProps, ...rest }, ref);
|
|
1765
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.TrailingAddon, { asChild: true, "data-spark-component": "stepper-increment-button", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1766
|
-
IconButton,
|
|
1767
|
-
{
|
|
1768
|
-
ref,
|
|
1769
|
-
design,
|
|
1770
|
-
intent,
|
|
1771
|
-
className,
|
|
1772
|
-
"aria-label": buttonProps["aria-label"],
|
|
1773
|
-
...buttonProps,
|
|
1774
|
-
disabled: rest.disabled || buttonProps.disabled,
|
|
1775
|
-
children: children || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Plus.Plus, {}) })
|
|
1776
|
-
}
|
|
1777
|
-
) });
|
|
1778
|
-
};
|
|
1779
|
-
var DecrementButton = ({
|
|
1780
|
-
children,
|
|
1781
|
-
design = "ghost",
|
|
1782
|
-
intent = "neutral",
|
|
243
|
+
formatOptions,
|
|
244
|
+
step: stepProp,
|
|
1783
245
|
className,
|
|
1784
|
-
|
|
1785
|
-
...rest
|
|
246
|
+
...props
|
|
1786
247
|
}) => {
|
|
1787
|
-
const
|
|
1788
|
-
const
|
|
1789
|
-
const
|
|
1790
|
-
const
|
|
1791
|
-
return /* @__PURE__ */ (0,
|
|
1792
|
-
|
|
1793
|
-
{
|
|
1794
|
-
ref,
|
|
1795
|
-
design,
|
|
1796
|
-
intent,
|
|
1797
|
-
className,
|
|
1798
|
-
"aria-label": buttonProps["aria-label"],
|
|
1799
|
-
...buttonProps,
|
|
1800
|
-
disabled: rest.disabled || buttonProps.disabled,
|
|
1801
|
-
children: children || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Minus.Minus, {}) })
|
|
1802
|
-
}
|
|
1803
|
-
) });
|
|
1804
|
-
};
|
|
1805
|
-
var StepperIncrementButton = Object.assign(IncrementButton, {
|
|
1806
|
-
id: "TrailingAddon"
|
|
1807
|
-
});
|
|
1808
|
-
var StepperDecrementButton = Object.assign(DecrementButton, {
|
|
1809
|
-
id: "LeadingAddon"
|
|
1810
|
-
});
|
|
1811
|
-
IncrementButton.displayName = "Stepper.DecrementButton";
|
|
1812
|
-
DecrementButton.displayName = "Stepper.DecrementButton";
|
|
1813
|
-
|
|
1814
|
-
// src/stepper/StepperInput.tsx
|
|
1815
|
-
var import_use_merge_refs2 = require("@spark-ui/hooks/use-merge-refs");
|
|
1816
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1817
|
-
var Input2 = ({ ref: forwardedRef, ...props }) => {
|
|
1818
|
-
const { inputRef, inputProps } = useStepperContext();
|
|
1819
|
-
const ref = (0, import_use_merge_refs2.useMergeRefs)(forwardedRef, inputRef);
|
|
1820
|
-
const { className = "", ...remainingProps } = props;
|
|
1821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1822
|
-
Input,
|
|
248
|
+
const render = useRenderSlot(true, "div");
|
|
249
|
+
const field = (0, import_form_field2.useFormFieldControl)();
|
|
250
|
+
const state = field.state ?? stateProp;
|
|
251
|
+
const step = stepProp == null && formatOptions?.style === "percent" ? 0.01 : stepProp;
|
|
252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
253
|
+
import_number_field3.NumberField.Root,
|
|
1823
254
|
{
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
255
|
+
"data-spark-component": "stepper",
|
|
256
|
+
allowWheelScrub,
|
|
257
|
+
render,
|
|
258
|
+
min: minValue,
|
|
259
|
+
max: maxValue,
|
|
260
|
+
format: formatOptions,
|
|
261
|
+
step,
|
|
262
|
+
...field.id && { id: field.id },
|
|
263
|
+
...props,
|
|
264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_number_field3.NumberField.Group, { className: (0, import_class_variance_authority4.cx)("group flex", className), "data-field-state": state, children })
|
|
1828
265
|
}
|
|
1829
266
|
);
|
|
1830
267
|
};
|
|
1831
|
-
|
|
1832
|
-
id: "Input"
|
|
1833
|
-
});
|
|
1834
|
-
Input2.displayName = "Stepper.Input";
|
|
268
|
+
Root.displayName = "Stepper";
|
|
1835
269
|
|
|
1836
270
|
// src/stepper/index.ts
|
|
1837
|
-
var
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
271
|
+
var Stepper = Object.assign(Root, { IncrementButton: Increment, DecrementButton: Decrement, Input });
|
|
272
|
+
Stepper.displayName = "Stepper";
|
|
273
|
+
Increment.displayName = "Stepper.IncrementButton";
|
|
274
|
+
Decrement.displayName = "Stepper.DecrementButton";
|
|
275
|
+
Input.displayName = "Stepper.Input";
|
|
1842
276
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1843
277
|
0 && (module.exports = {
|
|
1844
278
|
Stepper
|