@tribepad/themis 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/Accordion/index.js +1 -335
- package/dist/elements/Accordion/index.js.map +1 -1
- package/dist/elements/Accordion/index.mjs +1 -317
- package/dist/elements/Accordion/index.mjs.map +1 -1
- package/dist/elements/AlertDialog/AlertDialog.d.ts +43 -0
- package/dist/elements/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/dist/elements/AlertDialog/AlertDialog.styles.d.ts +15 -0
- package/dist/elements/AlertDialog/AlertDialog.styles.d.ts.map +1 -0
- package/dist/elements/AlertDialog/AlertDialog.types.d.ts +72 -0
- package/dist/elements/AlertDialog/AlertDialog.types.d.ts.map +1 -0
- package/dist/elements/AlertDialog/index.d.ts +25 -0
- package/dist/elements/AlertDialog/index.d.ts.map +1 -0
- package/dist/elements/AlertDialog/index.js +3 -0
- package/dist/elements/AlertDialog/index.js.map +1 -0
- package/dist/elements/AlertDialog/index.mjs +3 -0
- package/dist/elements/AlertDialog/index.mjs.map +1 -0
- package/dist/elements/Avatar/index.js +1 -468
- package/dist/elements/Avatar/index.js.map +1 -1
- package/dist/elements/Avatar/index.mjs +1 -456
- package/dist/elements/Avatar/index.mjs.map +1 -1
- package/dist/elements/Badge/index.js +1 -243
- package/dist/elements/Badge/index.js.map +1 -1
- package/dist/elements/Badge/index.mjs +1 -234
- package/dist/elements/Badge/index.mjs.map +1 -1
- package/dist/elements/Breadcrumbs/index.js +1 -821
- package/dist/elements/Breadcrumbs/index.js.map +1 -1
- package/dist/elements/Breadcrumbs/index.mjs +1 -810
- package/dist/elements/Breadcrumbs/index.mjs.map +1 -1
- package/dist/elements/Button/Button.d.ts +26 -81
- package/dist/elements/Button/Button.d.ts.map +1 -1
- package/dist/elements/Button/Button.styles.d.ts +35 -0
- package/dist/elements/Button/Button.styles.d.ts.map +1 -0
- package/dist/elements/Button/Button.types.d.ts +20 -8
- package/dist/elements/Button/Button.types.d.ts.map +1 -1
- package/dist/elements/Button/index.js +1 -288
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/Button/index.mjs +1 -283
- package/dist/elements/Button/index.mjs.map +1 -1
- package/dist/elements/ButtonGroup/index.js +1 -237
- package/dist/elements/ButtonGroup/index.js.map +1 -1
- package/dist/elements/ButtonGroup/index.mjs +1 -222
- package/dist/elements/ButtonGroup/index.mjs.map +1 -1
- package/dist/elements/Card/index.js +1 -579
- package/dist/elements/Card/index.js.map +1 -1
- package/dist/elements/Card/index.mjs +1 -560
- package/dist/elements/Card/index.mjs.map +1 -1
- package/dist/elements/Carousel/Carousel.d.ts +1 -11
- package/dist/elements/Carousel/Carousel.d.ts.map +1 -1
- package/dist/elements/Carousel/LazyCarousel.d.ts +1 -1
- package/dist/elements/Carousel/LazyCarousel.d.ts.map +1 -1
- package/dist/elements/Carousel/index.js +1 -789
- package/dist/elements/Carousel/index.js.map +1 -1
- package/dist/elements/Carousel/index.mjs +1 -786
- package/dist/elements/Carousel/index.mjs.map +1 -1
- package/dist/elements/Chart/ChartContext.d.ts.map +1 -1
- package/dist/elements/Chart/index.js +1 -1842
- package/dist/elements/Chart/index.js.map +1 -1
- package/dist/elements/Chart/index.mjs +1 -1832
- package/dist/elements/Chart/index.mjs.map +1 -1
- package/dist/elements/Checkbox/index.js +1 -316
- package/dist/elements/Checkbox/index.js.map +1 -1
- package/dist/elements/Checkbox/index.mjs +1 -306
- package/dist/elements/Checkbox/index.mjs.map +1 -1
- package/dist/elements/CheckboxGroup/index.js +1 -455
- package/dist/elements/CheckboxGroup/index.js.map +1 -1
- package/dist/elements/CheckboxGroup/index.mjs +1 -439
- package/dist/elements/CheckboxGroup/index.mjs.map +1 -1
- package/dist/elements/Combobox/Combobox.d.ts +56 -0
- package/dist/elements/Combobox/Combobox.d.ts.map +1 -0
- package/dist/elements/Combobox/Combobox.styles.d.ts +29 -0
- package/dist/elements/Combobox/Combobox.styles.d.ts.map +1 -0
- package/dist/elements/Combobox/Combobox.types.d.ts +67 -0
- package/dist/elements/Combobox/Combobox.types.d.ts.map +1 -0
- package/dist/elements/Combobox/index.d.ts +20 -0
- package/dist/elements/Combobox/index.d.ts.map +1 -0
- package/dist/elements/Combobox/index.js +3 -0
- package/dist/elements/Combobox/index.js.map +1 -0
- package/dist/elements/Combobox/index.mjs +3 -0
- package/dist/elements/Combobox/index.mjs.map +1 -0
- package/dist/elements/DatePicker/DatePicker.d.ts +1 -1
- package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/elements/DatePicker/index.js +1 -903
- package/dist/elements/DatePicker/index.js.map +1 -1
- package/dist/elements/DatePicker/index.mjs +1 -853
- package/dist/elements/DatePicker/index.mjs.map +1 -1
- package/dist/elements/Dropdown/Dropdown.d.ts +7 -15
- package/dist/elements/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/elements/Dropdown/Dropdown.styles.d.ts +22 -0
- package/dist/elements/Dropdown/Dropdown.styles.d.ts.map +1 -0
- package/dist/elements/Dropdown/index.d.ts +1 -0
- package/dist/elements/Dropdown/index.d.ts.map +1 -1
- package/dist/elements/Dropdown/index.js +1 -193
- package/dist/elements/Dropdown/index.js.map +1 -1
- package/dist/elements/Dropdown/index.mjs +1 -184
- package/dist/elements/Dropdown/index.mjs.map +1 -1
- package/dist/elements/FileField/index.js +1 -1539
- package/dist/elements/FileField/index.js.map +1 -1
- package/dist/elements/FileField/index.mjs +1 -1507
- package/dist/elements/FileField/index.mjs.map +1 -1
- package/dist/elements/FormLayout/index.js +1 -170
- package/dist/elements/FormLayout/index.js.map +1 -1
- package/dist/elements/FormLayout/index.mjs +1 -167
- package/dist/elements/FormLayout/index.mjs.map +1 -1
- package/dist/elements/Modal/Modal.d.ts +9 -14
- package/dist/elements/Modal/Modal.d.ts.map +1 -1
- package/dist/elements/Modal/Modal.styles.d.ts +29 -0
- package/dist/elements/Modal/Modal.styles.d.ts.map +1 -0
- package/dist/elements/Modal/index.d.ts +1 -0
- package/dist/elements/Modal/index.d.ts.map +1 -1
- package/dist/elements/Modal/index.js +1 -232
- package/dist/elements/Modal/index.js.map +1 -1
- package/dist/elements/Modal/index.mjs +1 -220
- package/dist/elements/Modal/index.mjs.map +1 -1
- package/dist/elements/NumberField/NumberField.variants.d.ts +1 -1
- package/dist/elements/NumberField/index.js +1 -666
- package/dist/elements/NumberField/index.js.map +1 -1
- package/dist/elements/NumberField/index.mjs +1 -654
- package/dist/elements/NumberField/index.mjs.map +1 -1
- package/dist/elements/OTPInput/OTPInput.d.ts.map +1 -1
- package/dist/elements/OTPInput/index.js +1 -734
- package/dist/elements/OTPInput/index.js.map +1 -1
- package/dist/elements/OTPInput/index.mjs +1 -732
- package/dist/elements/OTPInput/index.mjs.map +1 -1
- package/dist/elements/Pagination/Pagination.d.ts +45 -0
- package/dist/elements/Pagination/Pagination.d.ts.map +1 -0
- package/dist/elements/Pagination/Pagination.styles.d.ts +10 -0
- package/dist/elements/Pagination/Pagination.styles.d.ts.map +1 -0
- package/dist/elements/Pagination/Pagination.types.d.ts +55 -0
- package/dist/elements/Pagination/Pagination.types.d.ts.map +1 -0
- package/dist/elements/Pagination/index.d.ts +21 -0
- package/dist/elements/Pagination/index.d.ts.map +1 -0
- package/dist/elements/Pagination/index.js +3 -0
- package/dist/elements/Pagination/index.js.map +1 -0
- package/dist/elements/Pagination/index.mjs +3 -0
- package/dist/elements/Pagination/index.mjs.map +1 -0
- package/dist/elements/Panel/index.js +1 -330
- package/dist/elements/Panel/index.js.map +1 -1
- package/dist/elements/Panel/index.mjs +1 -323
- package/dist/elements/Panel/index.mjs.map +1 -1
- package/dist/elements/PasswordField/PasswordField.d.ts +27 -0
- package/dist/elements/PasswordField/PasswordField.d.ts.map +1 -0
- package/dist/elements/PasswordField/PasswordField.styles.d.ts +32 -0
- package/dist/elements/PasswordField/PasswordField.styles.d.ts.map +1 -0
- package/dist/elements/PasswordField/PasswordField.types.d.ts +100 -0
- package/dist/elements/PasswordField/PasswordField.types.d.ts.map +1 -0
- package/dist/elements/PasswordField/index.css +2 -0
- package/dist/elements/PasswordField/index.css.map +1 -0
- package/dist/elements/PasswordField/index.d.ts +20 -0
- package/dist/elements/PasswordField/index.d.ts.map +1 -0
- package/dist/elements/PasswordField/index.js +3 -0
- package/dist/elements/PasswordField/index.js.map +1 -0
- package/dist/elements/PasswordField/index.mjs +3 -0
- package/dist/elements/PasswordField/index.mjs.map +1 -0
- package/dist/elements/Progress/index.js +1 -187
- package/dist/elements/Progress/index.js.map +1 -1
- package/dist/elements/Progress/index.mjs +1 -181
- package/dist/elements/Progress/index.mjs.map +1 -1
- package/dist/elements/RadioGroup/index.js +1 -369
- package/dist/elements/RadioGroup/index.js.map +1 -1
- package/dist/elements/RadioGroup/index.mjs +1 -359
- package/dist/elements/RadioGroup/index.mjs.map +1 -1
- package/dist/elements/Resizable/index.js +1 -1580
- package/dist/elements/Resizable/index.js.map +1 -1
- package/dist/elements/Resizable/index.mjs +1 -1566
- package/dist/elements/Resizable/index.mjs.map +1 -1
- package/dist/elements/SearchField/SearchField.d.ts +27 -0
- package/dist/elements/SearchField/SearchField.d.ts.map +1 -0
- package/dist/elements/SearchField/SearchField.styles.d.ts +32 -0
- package/dist/elements/SearchField/SearchField.styles.d.ts.map +1 -0
- package/dist/elements/SearchField/SearchField.types.d.ts +45 -0
- package/dist/elements/SearchField/SearchField.types.d.ts.map +1 -0
- package/dist/elements/SearchField/index.css +2 -0
- package/dist/elements/SearchField/index.css.map +1 -0
- package/dist/elements/SearchField/index.d.ts +21 -0
- package/dist/elements/SearchField/index.d.ts.map +1 -0
- package/dist/elements/SearchField/index.js +3 -0
- package/dist/elements/SearchField/index.js.map +1 -0
- package/dist/elements/SearchField/index.mjs +3 -0
- package/dist/elements/SearchField/index.mjs.map +1 -0
- package/dist/elements/Select/Select.d.ts +19 -48
- package/dist/elements/Select/Select.d.ts.map +1 -1
- package/dist/elements/Select/Select.styles.d.ts +55 -0
- package/dist/elements/Select/Select.styles.d.ts.map +1 -0
- package/dist/elements/Select/index.js +1 -589
- package/dist/elements/Select/index.js.map +1 -1
- package/dist/elements/Select/index.mjs +1 -582
- package/dist/elements/Select/index.mjs.map +1 -1
- package/dist/elements/Skeleton/index.js +1 -82
- package/dist/elements/Skeleton/index.js.map +1 -1
- package/dist/elements/Skeleton/index.mjs +1 -78
- package/dist/elements/Skeleton/index.mjs.map +1 -1
- package/dist/elements/Switch/index.js +1 -179
- package/dist/elements/Switch/index.js.map +1 -1
- package/dist/elements/Switch/index.mjs +1 -173
- package/dist/elements/Switch/index.mjs.map +1 -1
- package/dist/elements/Table/Table.d.ts +3 -24
- package/dist/elements/Table/Table.d.ts.map +1 -1
- package/dist/elements/Table/Table.styles.d.ts +24 -0
- package/dist/elements/Table/Table.styles.d.ts.map +1 -0
- package/dist/elements/Table/index.js +1 -595
- package/dist/elements/Table/index.js.map +1 -1
- package/dist/elements/Table/index.mjs +1 -578
- package/dist/elements/Table/index.mjs.map +1 -1
- package/dist/elements/Tabs/Tabs.d.ts +5 -3
- package/dist/elements/Tabs/Tabs.d.ts.map +1 -1
- package/dist/elements/Tabs/Tabs.types.d.ts +15 -0
- package/dist/elements/Tabs/Tabs.types.d.ts.map +1 -1
- package/dist/elements/Tabs/index.js +1 -337
- package/dist/elements/Tabs/index.js.map +1 -1
- package/dist/elements/Tabs/index.mjs +1 -320
- package/dist/elements/Tabs/index.mjs.map +1 -1
- package/dist/elements/TextField/TextField.d.ts +6 -42
- package/dist/elements/TextField/TextField.d.ts.map +1 -1
- package/dist/elements/TextField/TextField.hooks.d.ts +63 -0
- package/dist/elements/TextField/TextField.hooks.d.ts.map +1 -0
- package/dist/elements/TextField/TextField.icons.d.ts +19 -0
- package/dist/elements/TextField/TextField.icons.d.ts.map +1 -0
- package/dist/elements/TextField/TextField.styles.d.ts +37 -0
- package/dist/elements/TextField/TextField.styles.d.ts.map +1 -0
- package/dist/elements/TextField/TextField.types.d.ts +3 -0
- package/dist/elements/TextField/TextField.types.d.ts.map +1 -1
- package/dist/elements/TextField/index.css +1 -22
- package/dist/elements/TextField/index.css.map +1 -1
- package/dist/elements/TextField/index.js +1 -902
- package/dist/elements/TextField/index.js.map +1 -1
- package/dist/elements/TextField/index.mjs +1 -882
- package/dist/elements/TextField/index.mjs.map +1 -1
- package/dist/elements/TimeField/index.js +1 -254
- package/dist/elements/TimeField/index.js.map +1 -1
- package/dist/elements/TimeField/index.mjs +1 -238
- package/dist/elements/TimeField/index.mjs.map +1 -1
- package/dist/elements/Toast/Toast.d.ts +0 -22
- package/dist/elements/Toast/Toast.d.ts.map +1 -1
- package/dist/elements/Toast/index.js +1 -737
- package/dist/elements/Toast/index.js.map +1 -1
- package/dist/elements/Toast/index.mjs +1 -724
- package/dist/elements/Toast/index.mjs.map +1 -1
- package/dist/elements/Tooltip/index.js +1 -323
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/Tooltip/index.mjs +1 -310
- package/dist/elements/Tooltip/index.mjs.map +1 -1
- package/dist/elements/index.css +1 -22
- package/dist/elements/index.css.map +1 -1
- package/dist/elements/index.d.ts +13 -1
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/elements/index.js +1 -12455
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -12233
- package/dist/elements/index.mjs.map +1 -1
- package/dist/index.css +1 -22
- package/dist/index.css.map +1 -1
- package/dist/index.js +2 -12490
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -12262
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/index.js +2 -54
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/index.mjs +2 -48
- package/dist/schemas/index.mjs.map +1 -1
- package/dist/styles/defaults.css +151 -0
- package/dist/styles/index.js +1 -166
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/index.mjs +1 -129
- package/dist/styles/index.mjs.map +1 -1
- package/dist/styles/shared-variants.d.ts +3 -3
- package/dist/styles/shared-variants.d.ts.map +1 -1
- package/dist/utils/index.js +1 -12
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -10
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +9 -7
- package/src/elements/Accordion/Accordion.stories.tsx +1 -1
- package/src/elements/AlertDialog/AlertDialog.stories.tsx +124 -0
- package/src/elements/Avatar/Avatar.stories.tsx +1 -1
- package/src/elements/Badge/Badge.stories.tsx +1 -1
- package/src/elements/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/elements/Button/Button.stories.tsx +1 -1
- package/src/elements/ButtonGroup/ButtonGroup.stories.tsx +1 -1
- package/src/elements/Card/Card.stories.tsx +1 -1
- package/src/elements/Carousel/Carousel.stories.tsx +1 -1
- package/src/elements/Chart/Chart.stories.tsx +1 -1
- package/src/elements/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/elements/CheckboxGroup/CheckboxGroup.stories.tsx +4 -4
- package/src/elements/Combobox/Combobox.stories.tsx +133 -0
- package/src/elements/DatePicker/DatePicker.stories.tsx +1 -1
- package/src/elements/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/elements/FileField/FileField.stories.tsx +2 -2
- package/src/elements/FileField/FileProgress.stories.tsx +1 -1
- package/src/elements/FormLayout/FormLayout.stories.tsx +1 -1
- package/src/elements/Modal/Modal.stories.tsx +1 -1
- package/src/elements/NumberField/NumberField.stories.tsx +1 -1
- package/src/elements/OTPInput/OTPInput.stories.tsx +1 -1
- package/src/elements/Pagination/Pagination.stories.tsx +203 -0
- package/src/elements/Panel/Panel.stories.tsx +1 -1
- package/src/elements/PasswordField/PasswordField.stories.tsx +167 -0
- package/src/elements/Progress/Progress.stories.tsx +7 -2
- package/src/elements/RadioGroup/RadioGroup.stories.tsx +3 -3
- package/src/elements/Resizable/Resizable.stories.tsx +1 -1
- package/src/elements/SearchField/SearchField.stories.tsx +146 -0
- package/src/elements/Select/Select.stories.tsx +1 -1
- package/src/elements/Skeleton/Skeleton.stories.tsx +1 -1
- package/src/elements/Switch/Switch.stories.tsx +1 -1
- package/src/elements/Table/Table.stories.tsx +1 -1
- package/src/elements/Tabs/Tabs.stories.tsx +46 -2
- package/src/elements/TextField/TextField.stories.tsx +1 -1
- package/src/elements/TimeField/TimeField.stories.tsx +1 -1
- package/src/elements/Toast/Toast.stories.tsx +1 -1
- package/src/elements/Tooltip/Tooltip.stories.tsx +1 -1
|
@@ -1,656 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, memo, forwardRef, useId, useContext } from 'react';
|
|
3
|
-
import { Button as Button$1, NumberField as NumberField$1, Label, Group, Input, Text, FieldError } from 'react-aria-components';
|
|
4
|
-
import { Loader2, Zap, Minus, Plus } from 'lucide-react';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { clsx } from 'clsx';
|
|
7
|
-
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
|
|
11
|
-
// src/elements/NumberField/NumberField.tsx
|
|
12
|
-
function cn(...inputs) {
|
|
13
|
-
return twMerge(clsx(inputs));
|
|
14
|
-
}
|
|
15
|
-
var PRESSED_STYLES = "data-[pressed]:scale-[0.97]";
|
|
16
|
-
var HOVER_STYLES = "data-[hovered]:shadow-md";
|
|
17
|
-
var HIGH_CONTRAST_HOVER = "hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground";
|
|
18
|
-
var HIGH_CONTRAST_PRESSED = "hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";
|
|
19
|
-
var ButtonGroupContext = createContext(null);
|
|
20
|
-
ButtonGroupContext.displayName = "ButtonGroupContext";
|
|
21
|
-
function useButtonGroupContext() {
|
|
22
|
-
return useContext(ButtonGroupContext);
|
|
23
|
-
}
|
|
24
|
-
var ButtonGroupItemContext = createContext(null);
|
|
25
|
-
ButtonGroupItemContext.displayName = "ButtonGroupItemContext";
|
|
26
|
-
function useButtonGroupItemContext() {
|
|
27
|
-
return useContext(ButtonGroupItemContext);
|
|
28
|
-
}
|
|
29
|
-
cva("inline-flex items-center gap-0", {
|
|
30
|
-
variants: {
|
|
31
|
-
orientation: {
|
|
32
|
-
horizontal: "flex-row",
|
|
33
|
-
vertical: "flex-col w-full"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
defaultVariants: {
|
|
37
|
-
orientation: "horizontal"
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
var buttonGroupItemVariants = cva("", {
|
|
41
|
-
variants: {
|
|
42
|
-
orientation: {
|
|
43
|
-
// min-w-[44px] ensures visual layer fills touch target width (for icon buttons)
|
|
44
|
-
horizontal: "min-w-[44px]",
|
|
45
|
-
// flex (overrides inline-flex) + min-h-[44px] makes visual layer fill touch target,
|
|
46
|
-
// eliminating gaps between stacked buttons in vertical orientation
|
|
47
|
-
vertical: "flex min-h-[44px]"
|
|
48
|
-
},
|
|
49
|
-
position: {
|
|
50
|
-
first: "",
|
|
51
|
-
middle: "",
|
|
52
|
-
last: "",
|
|
53
|
-
only: ""
|
|
54
|
-
// Single button - no modifications needed
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
compoundVariants: [
|
|
58
|
-
// ==========================================================================
|
|
59
|
-
// Horizontal Orientation
|
|
60
|
-
// ==========================================================================
|
|
61
|
-
{
|
|
62
|
-
orientation: "horizontal",
|
|
63
|
-
position: "first",
|
|
64
|
-
className: "rounded-r-none border-r-0"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
orientation: "horizontal",
|
|
68
|
-
position: "middle",
|
|
69
|
-
className: "rounded-none border-r-0"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
orientation: "horizontal",
|
|
73
|
-
position: "last",
|
|
74
|
-
className: "rounded-l-none"
|
|
75
|
-
},
|
|
76
|
-
// ==========================================================================
|
|
77
|
-
// Vertical Orientation
|
|
78
|
-
// Note: w-full is handled by Button's effectiveFullWidth for both layers
|
|
79
|
-
// ==========================================================================
|
|
80
|
-
{
|
|
81
|
-
orientation: "vertical",
|
|
82
|
-
position: "first",
|
|
83
|
-
className: "rounded-b-none border-b-0"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
orientation: "vertical",
|
|
87
|
-
position: "middle",
|
|
88
|
-
className: "rounded-none border-b-0"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
orientation: "vertical",
|
|
92
|
-
position: "last",
|
|
93
|
-
className: "rounded-t-none"
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
defaultVariants: {
|
|
97
|
-
orientation: "horizontal",
|
|
98
|
-
position: "only"
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
cva("bg-[var(--border)]", {
|
|
102
|
-
variants: {
|
|
103
|
-
orientation: {
|
|
104
|
-
horizontal: "w-px h-6 mx-1",
|
|
105
|
-
vertical: "h-px w-full my-1"
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
defaultVariants: {
|
|
109
|
-
orientation: "horizontal"
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
var buttonOuterVariants = cva(
|
|
113
|
-
"inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",
|
|
114
|
-
{
|
|
115
|
-
variants: {
|
|
116
|
-
fullWidth: {
|
|
117
|
-
true: "w-full",
|
|
118
|
-
false: ""
|
|
119
|
-
},
|
|
120
|
-
inVerticalGroup: {
|
|
121
|
-
true: "items-stretch",
|
|
122
|
-
false: "items-center"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
defaultVariants: {
|
|
126
|
-
fullWidth: false,
|
|
127
|
-
inVerticalGroup: false
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
var buttonVisualVariants = cva(
|
|
132
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",
|
|
133
|
-
{
|
|
134
|
-
variants: {
|
|
135
|
-
variant: {
|
|
136
|
-
default: "bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] data-[pressed]:bg-[var(--primary-action)]/80",
|
|
137
|
-
destructive: "bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background)]/90 data-[pressed]:bg-[var(--destructive-background)]/80",
|
|
138
|
-
outline: "border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)] data-[pressed]:bg-[var(--input-border)]",
|
|
139
|
-
secondary: "bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary)]/80 data-[pressed]:bg-[var(--secondary)]/70",
|
|
140
|
-
ghost: "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)] data-[pressed]:bg-[var(--accent)]",
|
|
141
|
-
link: "text-[var(--text-link)] underline-offset-4 hover:underline data-[pressed]:text-[var(--text-link-hover)]"
|
|
142
|
-
},
|
|
143
|
-
fullWidth: {
|
|
144
|
-
true: "w-full",
|
|
145
|
-
false: ""
|
|
146
|
-
},
|
|
147
|
-
visualSize: {
|
|
148
|
-
default: "h-10 px-4 py-2",
|
|
149
|
-
sm: "h-9 rounded-md px-3 text-xs",
|
|
150
|
-
lg: "h-11 rounded-md px-8",
|
|
151
|
-
icon: "h-10 w-10",
|
|
152
|
-
dot: "h-5 w-5 rounded-full p-0 min-h-0 min-w-0"
|
|
153
|
-
},
|
|
154
|
-
paywall: {
|
|
155
|
-
true: "!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",
|
|
156
|
-
false: ""
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
defaultVariants: {
|
|
160
|
-
variant: "default",
|
|
161
|
-
visualSize: "default",
|
|
162
|
-
paywall: false
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
var Button = memo(forwardRef(
|
|
167
|
-
({
|
|
168
|
-
className,
|
|
169
|
-
buttonVisualClassName,
|
|
170
|
-
variant,
|
|
171
|
-
size,
|
|
172
|
-
visualSize,
|
|
173
|
-
fullWidth,
|
|
174
|
-
loading = false,
|
|
175
|
-
loadingText = "Loading...",
|
|
176
|
-
shortcut,
|
|
177
|
-
children,
|
|
178
|
-
isDisabled,
|
|
179
|
-
paywall = false,
|
|
180
|
-
paywallRedirect,
|
|
181
|
-
paywallDescription,
|
|
182
|
-
onPress,
|
|
183
|
-
...props
|
|
184
|
-
}, ref) => {
|
|
185
|
-
const paywallDescriptionId = useId();
|
|
186
|
-
const groupContext = useButtonGroupContext();
|
|
187
|
-
const itemContext = useButtonGroupItemContext();
|
|
188
|
-
const effectiveVariant = variant ?? groupContext?.variant ?? "default";
|
|
189
|
-
const effectiveSize = size ?? groupContext?.size;
|
|
190
|
-
const effectiveIsDisabled = isDisabled ?? groupContext?.isDisabled ?? false;
|
|
191
|
-
const isInVerticalGroup = groupContext?.orientation === "vertical";
|
|
192
|
-
const effectiveFullWidth = fullWidth || isInVerticalGroup;
|
|
193
|
-
const positionClassName = itemContext ? buttonGroupItemVariants({
|
|
194
|
-
orientation: groupContext?.orientation ?? "horizontal",
|
|
195
|
-
position: itemContext.position
|
|
196
|
-
}) : "";
|
|
197
|
-
const effectiveVisualSize = visualSize ?? effectiveSize ?? "default";
|
|
198
|
-
if (process.env.NODE_ENV !== "production") {
|
|
199
|
-
if ((effectiveVisualSize === "dot" || effectiveVisualSize === "icon") && !props["aria-label"] && !children) {
|
|
200
|
-
console.warn(
|
|
201
|
-
'[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const handlePress = (e) => {
|
|
206
|
-
if (paywall) {
|
|
207
|
-
if (paywallRedirect) {
|
|
208
|
-
window.open(paywallRedirect, "_blank", "noopener,noreferrer");
|
|
209
|
-
}
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
onPress?.(e);
|
|
213
|
-
};
|
|
214
|
-
const computedIsDisabled = effectiveIsDisabled || loading || void 0;
|
|
215
|
-
return /* @__PURE__ */ jsx(
|
|
216
|
-
Button$1,
|
|
217
|
-
{
|
|
218
|
-
ref,
|
|
219
|
-
isDisabled: computedIsDisabled,
|
|
220
|
-
"aria-disabled": paywall ? true : void 0,
|
|
221
|
-
"aria-describedby": paywall ? paywallDescriptionId : void 0,
|
|
222
|
-
onPress: handlePress,
|
|
223
|
-
className: cn(buttonOuterVariants({ fullWidth: effectiveFullWidth, inVerticalGroup: isInVerticalGroup }), className),
|
|
224
|
-
...props,
|
|
225
|
-
children: (renderProps) => (
|
|
226
|
-
/* Layer 2: Visual Button */
|
|
227
|
-
/* @__PURE__ */ jsxs(
|
|
228
|
-
"span",
|
|
229
|
-
{
|
|
230
|
-
className: cn(
|
|
231
|
-
buttonVisualVariants({
|
|
232
|
-
variant: effectiveVariant,
|
|
233
|
-
visualSize: effectiveVisualSize,
|
|
234
|
-
paywall,
|
|
235
|
-
fullWidth: effectiveFullWidth
|
|
236
|
-
}),
|
|
237
|
-
// Position styling from ButtonGroup context (border-radius adjustments)
|
|
238
|
-
positionClassName,
|
|
239
|
-
buttonVisualClassName,
|
|
240
|
-
// Layer 2 interaction styles (no focus - focus ring is on Layer 1)
|
|
241
|
-
PRESSED_STYLES,
|
|
242
|
-
HOVER_STYLES,
|
|
243
|
-
HIGH_CONTRAST_HOVER,
|
|
244
|
-
HIGH_CONTRAST_PRESSED
|
|
245
|
-
),
|
|
246
|
-
"data-pressed": renderProps.isPressed || void 0,
|
|
247
|
-
children: [
|
|
248
|
-
loading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
249
|
-
/* @__PURE__ */ jsx(Loader2, { className: "motion-safe:animate-spin", "aria-hidden": "true" }),
|
|
250
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: loadingText })
|
|
251
|
-
] }),
|
|
252
|
-
!loading && children,
|
|
253
|
-
paywall && /* @__PURE__ */ jsx(
|
|
254
|
-
Zap,
|
|
255
|
-
{
|
|
256
|
-
"data-testid": "zap-icon",
|
|
257
|
-
"aria-hidden": "true",
|
|
258
|
-
className: "ml-1"
|
|
259
|
-
}
|
|
260
|
-
),
|
|
261
|
-
paywall && /* @__PURE__ */ jsxs("span", { id: paywallDescriptionId, className: "sr-only", children: [
|
|
262
|
-
"Premium feature: ",
|
|
263
|
-
paywallDescription || "Upgrade required to access this feature"
|
|
264
|
-
] }),
|
|
265
|
-
renderProps.isFocusVisible && shortcut && /* @__PURE__ */ jsx("kbd", { className: "ml-auto hidden text-xs opacity-60 lg:inline", children: shortcut }),
|
|
266
|
-
renderProps.isPressed && /* @__PURE__ */ jsx(
|
|
267
|
-
"span",
|
|
268
|
-
{
|
|
269
|
-
className: "absolute inset-0 rounded-[inherit] bg-current opacity-10 motion-safe:animate-in motion-safe:zoom-in-95",
|
|
270
|
-
"aria-hidden": "true"
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
]
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
)
|
|
277
|
-
}
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
));
|
|
281
|
-
Button.displayName = "Button";
|
|
282
|
-
var DEFAULT_MAX_VALUE = 4294967295;
|
|
283
|
-
var DEFAULT_MIN_VALUE = 0;
|
|
284
|
-
var NEGATIVE_MIN_VALUE = -2147483647;
|
|
285
|
-
var NumberFieldPropsSchema = z.object({
|
|
286
|
-
// Value props
|
|
287
|
-
/** Current value (controlled mode) */
|
|
288
|
-
value: z.number().nullable().optional(),
|
|
289
|
-
/** Default value (uncontrolled mode) */
|
|
290
|
-
defaultValue: z.number().optional(),
|
|
291
|
-
// Constraint props
|
|
292
|
-
/** Minimum allowed value (default: 0) */
|
|
293
|
-
minValue: z.number().optional(),
|
|
294
|
-
/** Maximum allowed value (default: 4294967295 / UINT32_MAX) */
|
|
295
|
-
maxValue: z.number().optional(),
|
|
296
|
-
/** Allow negative numbers (sets minValue to -2147483647 if not explicitly set) */
|
|
297
|
-
allowNegative: z.boolean().optional(),
|
|
298
|
-
/** Step increment for stepper buttons and arrow keys (default: 1) */
|
|
299
|
-
step: z.number().positive().optional(),
|
|
300
|
-
// Formatting props
|
|
301
|
-
/** Intl.NumberFormat options for locale-aware formatting */
|
|
302
|
-
formatOptions: z.custom().optional(),
|
|
303
|
-
// State props
|
|
304
|
-
/** Whether the field is disabled */
|
|
305
|
-
isDisabled: z.boolean().optional(),
|
|
306
|
-
/** Whether the field is read-only */
|
|
307
|
-
isReadOnly: z.boolean().optional(),
|
|
308
|
-
/** Whether the field is required */
|
|
309
|
-
isRequired: z.boolean().optional(),
|
|
310
|
-
/** Whether the field is in an invalid state */
|
|
311
|
-
isInvalid: z.boolean().optional(),
|
|
312
|
-
/** Whether scroll wheel adjustment is disabled */
|
|
313
|
-
isWheelDisabled: z.boolean().optional(),
|
|
314
|
-
// Validation props
|
|
315
|
-
/** Custom validation function that returns an error message or null */
|
|
316
|
-
validate: z.function().optional(),
|
|
317
|
-
/** Validation behavior: 'native' for HTML5 validation, 'aria' for ARIA-only */
|
|
318
|
-
validationBehavior: z.enum(["native", "aria"]).default("native"),
|
|
319
|
-
// Display props
|
|
320
|
-
/** Field label (required for accessibility) */
|
|
321
|
-
label: z.string(),
|
|
322
|
-
/** Description text below the field */
|
|
323
|
-
description: z.string().optional(),
|
|
324
|
-
/** Error message string or render function */
|
|
325
|
-
errorMessage: z.union([z.string(), z.function()]).optional(),
|
|
326
|
-
// Stepper props
|
|
327
|
-
/** Layout for stepper buttons */
|
|
328
|
-
stepperLayout: z.enum(["sides", "stacked", "hidden"]).default("sides"),
|
|
329
|
-
/** Custom aria-label for increment button */
|
|
330
|
-
incrementAriaLabel: z.string().optional(),
|
|
331
|
-
/** Custom aria-label for decrement button */
|
|
332
|
-
decrementAriaLabel: z.string().optional(),
|
|
333
|
-
// Form props
|
|
334
|
-
/** Name attribute for form submission */
|
|
335
|
-
name: z.string().optional(),
|
|
336
|
-
// Variant props
|
|
337
|
-
/** Size variant */
|
|
338
|
-
size: z.enum(["sm", "default", "lg"]).default("default"),
|
|
339
|
-
// Event props
|
|
340
|
-
/** Called when the numeric value changes */
|
|
341
|
-
onChange: z.function().optional(),
|
|
342
|
-
/** Called when the field gains focus */
|
|
343
|
-
onFocus: z.function().optional(),
|
|
344
|
-
/** Called when the field loses focus */
|
|
345
|
-
onBlur: z.function().optional(),
|
|
346
|
-
/** Called when focus state changes */
|
|
347
|
-
onFocusChange: z.function().optional(),
|
|
348
|
-
// Standard props
|
|
349
|
-
/** Additional CSS classes */
|
|
350
|
-
className: z.string().optional(),
|
|
351
|
-
/** Whether to auto-focus on mount */
|
|
352
|
-
autoFocus: z.boolean().optional()
|
|
353
|
-
});
|
|
354
|
-
var numberFieldVariants = cva(
|
|
355
|
-
[
|
|
356
|
-
// Base styles
|
|
357
|
-
"inline-flex items-center rounded-md border",
|
|
358
|
-
"bg-[var(--content-background)] text-[var(--content-foreground)]",
|
|
359
|
-
"transition-colors duration-200",
|
|
360
|
-
// Focus within
|
|
361
|
-
"focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2",
|
|
362
|
-
// Disabled
|
|
363
|
-
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
|
|
364
|
-
],
|
|
365
|
-
{
|
|
366
|
-
variants: {
|
|
367
|
-
size: {
|
|
368
|
-
sm: "h-9 text-sm",
|
|
369
|
-
default: "h-10 text-base",
|
|
370
|
-
lg: "h-12 text-lg"
|
|
371
|
-
},
|
|
372
|
-
isInvalid: {
|
|
373
|
-
true: "border-[var(--destructive)] focus-within:ring-[var(--destructive)]",
|
|
374
|
-
false: "border-[var(--input)] hover:border-[var(--input)]/80"
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
defaultVariants: {
|
|
378
|
-
size: "default",
|
|
379
|
-
isInvalid: false
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
var numberFieldInputVariants = cva(
|
|
384
|
-
[
|
|
385
|
-
// Base styles
|
|
386
|
-
"flex-1 bg-transparent text-center tabular-nums",
|
|
387
|
-
"min-w-0",
|
|
388
|
-
// Allow shrinking
|
|
389
|
-
// Focus
|
|
390
|
-
"focus:outline-none",
|
|
391
|
-
// Hide native spinners
|
|
392
|
-
"[appearance:textfield]",
|
|
393
|
-
"[&::-webkit-outer-spin-button]:appearance-none",
|
|
394
|
-
"[&::-webkit-inner-spin-button]:appearance-none"
|
|
395
|
-
],
|
|
396
|
-
{
|
|
397
|
-
variants: {
|
|
398
|
-
size: {
|
|
399
|
-
sm: "px-2 text-sm",
|
|
400
|
-
default: "px-3 text-base",
|
|
401
|
-
lg: "px-4 text-lg"
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
defaultVariants: {
|
|
405
|
-
size: "default"
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
);
|
|
409
|
-
var numberFieldStepperVariants = cva(
|
|
410
|
-
[
|
|
411
|
-
// Base styles
|
|
412
|
-
"flex items-center justify-center",
|
|
413
|
-
"transition-colors duration-150",
|
|
414
|
-
"select-none",
|
|
415
|
-
// Hover
|
|
416
|
-
"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",
|
|
417
|
-
// Focus
|
|
418
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
|
|
419
|
-
"focus-visible:ring-inset",
|
|
420
|
-
// Active (pressed)
|
|
421
|
-
"active:bg-[var(--accent)]/80",
|
|
422
|
-
// Disabled
|
|
423
|
-
"disabled:pointer-events-none disabled:opacity-50"
|
|
424
|
-
],
|
|
425
|
-
{
|
|
426
|
-
variants: {
|
|
427
|
-
size: {
|
|
428
|
-
sm: "min-w-8 min-h-8 text-sm",
|
|
429
|
-
default: "min-w-10 min-h-10 text-base",
|
|
430
|
-
lg: "min-w-12 min-h-12 text-lg"
|
|
431
|
-
},
|
|
432
|
-
position: {
|
|
433
|
-
left: "rounded-l-md border-r border-[var(--input)]",
|
|
434
|
-
right: "rounded-r-md border-l border-[var(--input)]",
|
|
435
|
-
top: "rounded-tr-md border-b border-l border-[var(--input)] h-1/2",
|
|
436
|
-
bottom: "rounded-br-md border-l border-[var(--input)] h-1/2"
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
defaultVariants: {
|
|
440
|
-
size: "default"
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
);
|
|
444
|
-
var numberFieldLabelVariants = cva(
|
|
445
|
-
[
|
|
446
|
-
"block font-medium text-[var(--content-foreground)]",
|
|
447
|
-
"mb-1.5",
|
|
448
|
-
// Required indicator
|
|
449
|
-
'data-[required]:after:content-["*"] data-[required]:after:ml-0.5',
|
|
450
|
-
"data-[required]:after:text-[var(--destructive)]"
|
|
451
|
-
],
|
|
452
|
-
{
|
|
453
|
-
variants: {
|
|
454
|
-
size: {
|
|
455
|
-
sm: "text-sm",
|
|
456
|
-
default: "text-sm",
|
|
457
|
-
lg: "text-base"
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
defaultVariants: {
|
|
461
|
-
size: "default"
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
);
|
|
465
|
-
var numberFieldDescriptionVariants = cva(
|
|
466
|
-
[
|
|
467
|
-
"text-[var(--menu-muted)]",
|
|
468
|
-
"mt-1"
|
|
469
|
-
],
|
|
470
|
-
{
|
|
471
|
-
variants: {
|
|
472
|
-
size: {
|
|
473
|
-
sm: "text-xs",
|
|
474
|
-
default: "text-sm",
|
|
475
|
-
lg: "text-base"
|
|
476
|
-
}
|
|
477
|
-
},
|
|
478
|
-
defaultVariants: {
|
|
479
|
-
size: "default"
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
);
|
|
483
|
-
var numberFieldErrorVariants = cva(
|
|
484
|
-
[
|
|
485
|
-
"flex items-center gap-1",
|
|
486
|
-
"text-[var(--destructive)]",
|
|
487
|
-
"mt-1"
|
|
488
|
-
],
|
|
489
|
-
{
|
|
490
|
-
variants: {
|
|
491
|
-
size: {
|
|
492
|
-
sm: "text-xs",
|
|
493
|
-
default: "text-sm",
|
|
494
|
-
lg: "text-base"
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
defaultVariants: {
|
|
498
|
-
size: "default"
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
);
|
|
502
|
-
var NumberField = forwardRef(
|
|
503
|
-
({
|
|
504
|
-
// Display props
|
|
505
|
-
label,
|
|
506
|
-
description,
|
|
507
|
-
errorMessage,
|
|
508
|
-
// Variant props
|
|
509
|
-
size = "default",
|
|
510
|
-
stepperLayout = "sides",
|
|
511
|
-
// Custom props
|
|
512
|
-
allowNegative = false,
|
|
513
|
-
incrementAriaLabel,
|
|
514
|
-
decrementAriaLabel,
|
|
515
|
-
// Constraint props (apply defaults)
|
|
516
|
-
minValue,
|
|
517
|
-
maxValue,
|
|
518
|
-
// Standard props
|
|
519
|
-
className,
|
|
520
|
-
isInvalid,
|
|
521
|
-
isRequired,
|
|
522
|
-
isDisabled,
|
|
523
|
-
isReadOnly,
|
|
524
|
-
// All other props go to AriaNumberField
|
|
525
|
-
...props
|
|
526
|
-
}, ref) => {
|
|
527
|
-
const effectiveMinValue = minValue ?? (allowNegative ? NEGATIVE_MIN_VALUE : DEFAULT_MIN_VALUE);
|
|
528
|
-
const effectiveMaxValue = maxValue ?? DEFAULT_MAX_VALUE;
|
|
529
|
-
const showSteppers = stepperLayout !== "hidden" && !isReadOnly;
|
|
530
|
-
const isStackedLayout = stepperLayout === "stacked";
|
|
531
|
-
return /* @__PURE__ */ jsxs(
|
|
532
|
-
NumberField$1,
|
|
533
|
-
{
|
|
534
|
-
ref,
|
|
535
|
-
className: cn("group flex flex-col", className),
|
|
536
|
-
minValue: effectiveMinValue,
|
|
537
|
-
maxValue: effectiveMaxValue,
|
|
538
|
-
isInvalid,
|
|
539
|
-
isRequired,
|
|
540
|
-
isDisabled,
|
|
541
|
-
isReadOnly,
|
|
542
|
-
...props,
|
|
543
|
-
children: [
|
|
544
|
-
/* @__PURE__ */ jsx(
|
|
545
|
-
Label,
|
|
546
|
-
{
|
|
547
|
-
className: cn(numberFieldLabelVariants({ size })),
|
|
548
|
-
"data-required": isRequired || void 0,
|
|
549
|
-
children: label
|
|
550
|
-
}
|
|
551
|
-
),
|
|
552
|
-
/* @__PURE__ */ jsxs(
|
|
553
|
-
Group,
|
|
554
|
-
{
|
|
555
|
-
className: cn(
|
|
556
|
-
numberFieldVariants({
|
|
557
|
-
size,
|
|
558
|
-
isInvalid: isInvalid ?? false
|
|
559
|
-
}),
|
|
560
|
-
isStackedLayout && "pr-0"
|
|
561
|
-
),
|
|
562
|
-
children: [
|
|
563
|
-
showSteppers && !isStackedLayout && /* @__PURE__ */ jsx(
|
|
564
|
-
Button,
|
|
565
|
-
{
|
|
566
|
-
slot: "decrement",
|
|
567
|
-
variant: "ghost",
|
|
568
|
-
className: "!min-h-0 !min-w-0",
|
|
569
|
-
buttonVisualClassName: cn(
|
|
570
|
-
numberFieldStepperVariants({
|
|
571
|
-
size,
|
|
572
|
-
position: "left"
|
|
573
|
-
})
|
|
574
|
-
),
|
|
575
|
-
"aria-label": decrementAriaLabel ?? "Decrease value",
|
|
576
|
-
children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
577
|
-
}
|
|
578
|
-
),
|
|
579
|
-
/* @__PURE__ */ jsx(
|
|
580
|
-
Input,
|
|
581
|
-
{
|
|
582
|
-
className: cn(numberFieldInputVariants({ size }))
|
|
583
|
-
}
|
|
584
|
-
),
|
|
585
|
-
showSteppers && isStackedLayout && /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
|
|
586
|
-
/* @__PURE__ */ jsx(
|
|
587
|
-
Button,
|
|
588
|
-
{
|
|
589
|
-
slot: "increment",
|
|
590
|
-
variant: "ghost",
|
|
591
|
-
className: "!min-h-0 !min-w-0",
|
|
592
|
-
buttonVisualClassName: cn(
|
|
593
|
-
numberFieldStepperVariants({
|
|
594
|
-
size,
|
|
595
|
-
position: "top"
|
|
596
|
-
})
|
|
597
|
-
),
|
|
598
|
-
"aria-label": incrementAriaLabel ?? "Increase value",
|
|
599
|
-
children: /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3", "aria-hidden": "true" })
|
|
600
|
-
}
|
|
601
|
-
),
|
|
602
|
-
/* @__PURE__ */ jsx(
|
|
603
|
-
Button,
|
|
604
|
-
{
|
|
605
|
-
slot: "decrement",
|
|
606
|
-
variant: "ghost",
|
|
607
|
-
className: "!min-h-0 !min-w-0",
|
|
608
|
-
buttonVisualClassName: cn(
|
|
609
|
-
numberFieldStepperVariants({
|
|
610
|
-
size,
|
|
611
|
-
position: "bottom"
|
|
612
|
-
})
|
|
613
|
-
),
|
|
614
|
-
"aria-label": decrementAriaLabel ?? "Decrease value",
|
|
615
|
-
children: /* @__PURE__ */ jsx(Minus, { className: "h-3 w-3", "aria-hidden": "true" })
|
|
616
|
-
}
|
|
617
|
-
)
|
|
618
|
-
] }),
|
|
619
|
-
showSteppers && !isStackedLayout && /* @__PURE__ */ jsx(
|
|
620
|
-
Button,
|
|
621
|
-
{
|
|
622
|
-
slot: "increment",
|
|
623
|
-
variant: "ghost",
|
|
624
|
-
className: "!min-h-0 !min-w-0",
|
|
625
|
-
buttonVisualClassName: cn(
|
|
626
|
-
numberFieldStepperVariants({
|
|
627
|
-
size,
|
|
628
|
-
position: "right"
|
|
629
|
-
})
|
|
630
|
-
),
|
|
631
|
-
"aria-label": incrementAriaLabel ?? "Increase value",
|
|
632
|
-
children: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
633
|
-
}
|
|
634
|
-
)
|
|
635
|
-
]
|
|
636
|
-
}
|
|
637
|
-
),
|
|
638
|
-
description && /* @__PURE__ */ jsx(
|
|
639
|
-
Text,
|
|
640
|
-
{
|
|
641
|
-
slot: "description",
|
|
642
|
-
className: cn(numberFieldDescriptionVariants({ size })),
|
|
643
|
-
children: description
|
|
644
|
-
}
|
|
645
|
-
),
|
|
646
|
-
/* @__PURE__ */ jsx(FieldError, { className: cn(numberFieldErrorVariants({ size })), children: errorMessage })
|
|
647
|
-
]
|
|
648
|
-
}
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
);
|
|
652
|
-
NumberField.displayName = "NumberField";
|
|
653
|
-
|
|
654
|
-
export { DEFAULT_MAX_VALUE, DEFAULT_MIN_VALUE, NEGATIVE_MIN_VALUE, NumberField, NumberFieldPropsSchema, numberFieldDescriptionVariants, numberFieldErrorVariants, numberFieldInputVariants, numberFieldLabelVariants, numberFieldStepperVariants, numberFieldVariants };
|
|
655
|
-
//# sourceMappingURL=index.mjs.map
|
|
2
|
+
import {createContext,memo,forwardRef,useId,useContext}from'react';import {Button,NumberField,Label,Group,Input,Text,FieldError}from'react-aria-components';import {Loader2,Zap,Minus,Plus}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {z}from'zod';function t(...c){return twMerge(clsx(c))}var C=cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),L=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] data-[pressed]:bg-[var(--primary-action)]/80",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background)]/90 data-[pressed]:bg-[var(--destructive-background)]/80",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)] data-[pressed]:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary)]/80 data-[pressed]:bg-[var(--secondary)]/70",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)] data-[pressed]:bg-[var(--accent)]",link:"text-[var(--text-link)] underline-offset-4 hover:underline data-[pressed]:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var P="data-[pressed]:scale-[0.97]";var G="data-[hovered]:shadow-md";var S="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",y="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";var ee=createContext(null);ee.displayName="ButtonGroupContext";function te(){return useContext(ee)}var re=createContext(null);re.displayName="ButtonGroupItemContext";function oe(){return useContext(re)}cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var ae=cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var i=memo(forwardRef(({className:c,buttonVisualClassName:v,variant:A,size:o,visualSize:x,fullWidth:I,loading:s=false,loadingText:h="Loading...",shortcut:g,children:V,isDisabled:w,paywall:a=false,paywallRedirect:b,paywallDescription:_,onPress:N,...F},T)=>{let E=useId(),n=te(),l=oe(),u=A??n?.variant??"default",le=o??n?.size,ue=w??n?.isDisabled??false,X=n?.orientation==="vertical",j=I||X,de=l?ae({orientation:n?.orientation??"horizontal",position:l.position}):"",B=x??le??"default";return process.env.NODE_ENV!=="production"&&(B==="dot"||B==="icon")&&!F["aria-label"]&&!V&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsx(Button,{ref:T,isDisabled:ue||s||void 0,"aria-disabled":a?true:void 0,"aria-describedby":a?E:void 0,onPress:f=>{if(a){b&&window.open(b,"_blank","noopener,noreferrer");return}N?.(f);},className:t(C({fullWidth:j,inVerticalGroup:X}),c),...F,children:f=>jsxs("span",{className:t(L({variant:u,visualSize:B,paywall:a,fullWidth:j}),de,v,P,G,S,y),"data-pressed":f.isPressed||void 0,children:[s&&jsxs(Fragment,{children:[jsx(Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsx("span",{className:"sr-only","aria-live":"polite",children:h})]}),!s&&V,a&&jsx(Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),a&&jsxs("span",{id:E,className:"sr-only",children:["Premium feature: ",_||"Upgrade required to access this feature"]}),f.isFocusVisible&&g&&jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:g}),f.isPressed&&jsx("span",{className:"absolute inset-0 rounded-[inherit] bg-current opacity-10 motion-safe:animate-in motion-safe:zoom-in-95","aria-hidden":"true"})]})})}));i.displayName="Button";var k=4294967295,O=0,U=-2147483647,Ne=z.object({value:z.number().nullable().optional(),defaultValue:z.number().optional(),minValue:z.number().optional(),maxValue:z.number().optional(),allowNegative:z.boolean().optional(),step:z.number().positive().optional(),formatOptions:z.custom().optional(),isDisabled:z.boolean().optional(),isReadOnly:z.boolean().optional(),isRequired:z.boolean().optional(),isInvalid:z.boolean().optional(),isWheelDisabled:z.boolean().optional(),validate:z.function().optional(),validationBehavior:z.enum(["native","aria"]).default("native"),label:z.string(),description:z.string().optional(),errorMessage:z.union([z.string(),z.function()]).optional(),stepperLayout:z.enum(["sides","stacked","hidden"]).default("sides"),incrementAriaLabel:z.string().optional(),decrementAriaLabel:z.string().optional(),name:z.string().optional(),size:z.enum(["sm","default","lg"]).default("default"),onChange:z.function().optional(),onFocus:z.function().optional(),onBlur:z.function().optional(),onFocusChange:z.function().optional(),className:z.string().optional(),autoFocus:z.boolean().optional()});var H=cva(["inline-flex items-center rounded-md border","bg-[var(--content-background)] text-[var(--content-foreground)]","transition-colors duration-200","focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"],{variants:{size:{sm:"h-9 text-sm",default:"h-10 text-base",lg:"h-12 text-lg"},isInvalid:{true:"border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]",false:"border-[var(--input-border)] hover:border-[var(--input-border)]/80"}},defaultVariants:{size:"default",isInvalid:false}}),M=cva(["flex-1 bg-transparent text-center tabular-nums","min-w-0","focus:outline-none","[appearance:textfield]","[&::-webkit-outer-spin-button]:appearance-none","[&::-webkit-inner-spin-button]:appearance-none"],{variants:{size:{sm:"px-2 text-sm",default:"px-3 text-base",lg:"px-4 text-lg"}},defaultVariants:{size:"default"}}),m=cva(["flex items-center justify-center","transition-colors duration-150","select-none","hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]","focus-visible:ring-inset","active:bg-[var(--accent)]/80","disabled:pointer-events-none disabled:opacity-50"],{variants:{size:{sm:"min-w-8 min-h-8 text-sm",default:"min-w-10 min-h-10 text-base",lg:"min-w-12 min-h-12 text-lg"},position:{left:"rounded-l-md border-r border-[var(--input-border)]",right:"rounded-r-md border-l border-[var(--input-border)]",top:"rounded-tr-md border-b border-l border-[var(--input-border)] h-1/2",bottom:"rounded-br-md border-l border-[var(--input-border)] h-1/2"}},defaultVariants:{size:"default"}}),$=cva(["block font-medium text-[var(--content-foreground)]","mb-1.5",'data-[required]:after:content-["*"] data-[required]:after:ml-0.5',"data-[required]:after:text-[var(--destructive-background)]"],{variants:{size:{sm:"text-sm",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),W=cva(["text-[var(--menu-muted)]","mt-1"],{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),Y=cva(["flex items-center gap-1","text-[var(--destructive-background)]","mt-1"],{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}});var se=forwardRef(({label:c,description:v,errorMessage:A,size:o="default",stepperLayout:x="sides",allowNegative:I=false,incrementAriaLabel:s,decrementAriaLabel:h,minValue:g,maxValue:V,className:w,isInvalid:a,isRequired:b,isDisabled:_,isReadOnly:N,...F},T)=>{let E=g??(I?U:O),n=V??k,l=x!=="hidden"&&!N,u=x==="stacked";return jsxs(NumberField,{ref:T,className:t("group flex flex-col",w),minValue:E,maxValue:n,isInvalid:a,isRequired:b,isDisabled:_,isReadOnly:N,...F,children:[jsx(Label,{className:t($({size:o})),"data-required":b||void 0,children:c}),jsxs(Group,{className:t(H({size:o,isInvalid:a??false}),u&&"pr-0"),children:[l&&!u&&jsx(i,{slot:"decrement",variant:"ghost",className:"!min-h-0 !min-w-0",buttonVisualClassName:t(m({size:o,position:"left"})),"aria-label":h??"Decrease value",children:jsx(Minus,{className:"h-4 w-4","aria-hidden":"true"})}),jsx(Input,{className:t(M({size:o}))}),l&&u&&jsxs("div",{className:"flex flex-col h-full",children:[jsx(i,{slot:"increment",variant:"ghost",className:"!min-h-0 !min-w-0",buttonVisualClassName:t(m({size:o,position:"top"})),"aria-label":s??"Increase value",children:jsx(Plus,{className:"h-3 w-3","aria-hidden":"true"})}),jsx(i,{slot:"decrement",variant:"ghost",className:"!min-h-0 !min-w-0",buttonVisualClassName:t(m({size:o,position:"bottom"})),"aria-label":h??"Decrease value",children:jsx(Minus,{className:"h-3 w-3","aria-hidden":"true"})})]}),l&&!u&&jsx(i,{slot:"increment",variant:"ghost",className:"!min-h-0 !min-w-0",buttonVisualClassName:t(m({size:o,position:"right"})),"aria-label":s??"Increase value",children:jsx(Plus,{className:"h-4 w-4","aria-hidden":"true"})})]}),v&&jsx(Text,{slot:"description",className:t(W({size:o})),children:v}),jsx(FieldError,{className:t(Y({size:o})),children:A})]})});se.displayName="NumberField";export{k as DEFAULT_MAX_VALUE,O as DEFAULT_MIN_VALUE,U as NEGATIVE_MIN_VALUE,se as NumberField,Ne as NumberFieldPropsSchema,W as numberFieldDescriptionVariants,Y as numberFieldErrorVariants,M as numberFieldInputVariants,$ as numberFieldLabelVariants,m as numberFieldStepperVariants,H as numberFieldVariants};//# sourceMappingURL=index.mjs.map
|
|
656
3
|
//# sourceMappingURL=index.mjs.map
|