@nswds/ui 5.4.0 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +80 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/avatar.d.ts +13 -0
- package/dist/components/avatar.js +92 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +91 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button-group.d.ts +15 -0
- package/dist/components/button-group.js +77 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.d.ts +2 -2
- package/dist/components/carousel.d.ts +34 -0
- package/dist/components/carousel.js +186 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +31 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/combobox.d.ts +26 -0
- package/dist/components/combobox.js +242 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/direction.d.ts +1 -0
- package/dist/components/direction.js +4 -0
- package/dist/components/direction.js.map +1 -0
- package/dist/components/header.d.ts +1 -1
- package/dist/components/input-group.d.ts +23 -0
- package/dist/components/input-group.js +136 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.d.ts +13 -0
- package/dist/components/input-otp.js +79 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +30 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/link.d.ts +1 -1
- package/dist/components/masthead.d.ts +1 -1
- package/dist/components/native-select.d.ts +10 -0
- package/dist/components/native-select.js +60 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/pagination.d.ts +23 -0
- package/dist/components/pagination.js +109 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +67 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.js +41 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/select.d.ts +17 -0
- package/dist/components/select.js +177 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/skip-link.d.ts +1 -1
- package/dist/components/slider.d.ts +2 -82
- package/dist/components/slider.js +39 -106
- package/dist/components/slider.js.map +1 -1
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +34 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +87 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +14 -0
- package/dist/components/tabs.js +76 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +73 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +12 -0
- package/dist/components/toggle.js +45 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +22 -0
- package/dist/styles.css +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Radio } from '@base-ui/react/radio';
|
|
3
|
+
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
4
|
+
|
|
5
|
+
declare function RadioGroup({ className, ...props }: RadioGroup$1.Props): React.JSX.Element;
|
|
6
|
+
declare function RadioGroupItem({ className, ...props }: Radio.Root.Props): React.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Radio } from '@base-ui/react/radio';
|
|
4
|
+
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
|
|
7
|
+
function RadioGroup({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
RadioGroup$1,
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "radio-group",
|
|
12
|
+
className: cn("grid w-full gap-3", className),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function RadioGroupItem({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
Radio.Root,
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "radio-group-item",
|
|
22
|
+
className: cn(
|
|
23
|
+
"group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props,
|
|
27
|
+
children: /* @__PURE__ */ jsx(
|
|
28
|
+
Radio.Indicator,
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "radio-group-indicator",
|
|
31
|
+
className: "flex size-4 items-center justify-center",
|
|
32
|
+
children: /* @__PURE__ */ jsx("span", { className: "absolute start-1/2 top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground rtl:translate-x-1/2" })
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { RadioGroup, RadioGroupItem };
|
|
40
|
+
//# sourceMappingURL=radio-group.js.map
|
|
41
|
+
//# sourceMappingURL=radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/radio-group.tsx"],"names":["RadioGroupPrimitive","RadioPrimitive"],"mappings":";;;;;AAOA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAA8B;AACtE,EAAA,uBACE,GAAA;AAAA,IAACA,YAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,SAAS,CAAA;AAAA,MAC3C,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,cAAA,CAAe,EAAE,SAAA,EAAW,GAAG,OAAM,EAA8B;AAC1E,EAAA,uBACE,GAAA;AAAA,IAACC,KAAA,CAAe,IAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,2yBAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACA,KAAA,CAAe,SAAA;AAAA,QAAf;AAAA,UACC,WAAA,EAAU,uBAAA;AAAA,UACV,SAAA,EAAU,yCAAA;AAAA,UAEV,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,4HAAA,EAA6H;AAAA;AAAA;AAC/I;AAAA,GACF;AAEJ","file":"radio-group.js","sourcesContent":["'use client'\n\nimport { Radio as RadioPrimitive } from '@base-ui/react/radio'\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group'\n\nimport { cn } from '../lib/utils.js'\n\nfunction RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {\n return (\n <RadioGroupPrimitive\n data-slot='radio-group'\n className={cn('grid w-full gap-3', className)}\n {...props}\n />\n )\n}\n\nfunction RadioGroupItem({ className, ...props }: RadioPrimitive.Root.Props) {\n return (\n <RadioPrimitive.Root\n data-slot='radio-group-item'\n className={cn(\n 'group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary',\n className,\n )}\n {...props}\n >\n <RadioPrimitive.Indicator\n data-slot='radio-group-indicator'\n className='flex size-4 items-center justify-center'\n >\n <span className='absolute start-1/2 top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground rtl:translate-x-1/2' />\n </RadioPrimitive.Indicator>\n </RadioPrimitive.Root>\n )\n}\n\nexport { RadioGroup, RadioGroupItem }\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Select as Select$1 } from '@base-ui/react/select';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Select: typeof Select$1.Root;
|
|
5
|
+
declare function SelectGroup({ className, ...props }: Select$1.Group.Props): React.JSX.Element;
|
|
6
|
+
declare function SelectValue({ className, ...props }: Select$1.Value.Props): React.JSX.Element;
|
|
7
|
+
declare function SelectTrigger({ className, size, children, ...props }: Select$1.Trigger.Props & {
|
|
8
|
+
size?: 'sm' | 'default';
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function SelectContent({ className, children, side, sideOffset, align, alignOffset, alignItemWithTrigger, ...props }: Select$1.Popup.Props & Pick<Select$1.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'>): React.JSX.Element;
|
|
11
|
+
declare function SelectLabel({ className, ...props }: Select$1.GroupLabel.Props): React.JSX.Element;
|
|
12
|
+
declare function SelectItem({ className, children, ...props }: Select$1.Item.Props): React.JSX.Element;
|
|
13
|
+
declare function SelectSeparator({ className, ...props }: Select$1.Separator.Props): React.JSX.Element;
|
|
14
|
+
declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof Select$1.ScrollUpArrow>): React.JSX.Element;
|
|
15
|
+
declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof Select$1.ScrollDownArrow>): React.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Select as Select$1 } from '@base-ui/react/select';
|
|
4
|
+
import { IconCheck } from '../icons/check.js';
|
|
5
|
+
import { IconExpandLess } from '../icons/expand-less.js';
|
|
6
|
+
import { IconExpandMore } from '../icons/expand-more.js';
|
|
7
|
+
import { cn } from '../lib/utils.js';
|
|
8
|
+
|
|
9
|
+
const Select = Select$1.Root;
|
|
10
|
+
function SelectGroup({ className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Select$1.Group,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "select-group",
|
|
15
|
+
className: cn("scroll-my-1 p-1", className),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function SelectValue({ className, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Select$1.Value,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "select-value",
|
|
25
|
+
className: cn("flex flex-1 text-start", className),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function SelectTrigger({
|
|
31
|
+
className,
|
|
32
|
+
size = "default",
|
|
33
|
+
children,
|
|
34
|
+
...props
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ jsxs(
|
|
37
|
+
Select$1.Trigger,
|
|
38
|
+
{
|
|
39
|
+
"data-slot": "select-trigger",
|
|
40
|
+
"data-size": size,
|
|
41
|
+
className: cn(
|
|
42
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
...props,
|
|
46
|
+
children: [
|
|
47
|
+
children,
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Select$1.Icon,
|
|
50
|
+
{
|
|
51
|
+
render: /* @__PURE__ */ jsx(IconExpandMore, { className: "pointer-events-none size-3.5 text-muted-foreground" })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function SelectContent({
|
|
59
|
+
className,
|
|
60
|
+
children,
|
|
61
|
+
side = "bottom",
|
|
62
|
+
sideOffset = 4,
|
|
63
|
+
align = "center",
|
|
64
|
+
alignOffset = 0,
|
|
65
|
+
alignItemWithTrigger = true,
|
|
66
|
+
...props
|
|
67
|
+
}) {
|
|
68
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
69
|
+
Select$1.Positioner,
|
|
70
|
+
{
|
|
71
|
+
side,
|
|
72
|
+
sideOffset,
|
|
73
|
+
align,
|
|
74
|
+
alignOffset,
|
|
75
|
+
alignItemWithTrigger,
|
|
76
|
+
className: "isolate z-50",
|
|
77
|
+
children: /* @__PURE__ */ jsxs(
|
|
78
|
+
Select$1.Popup,
|
|
79
|
+
{
|
|
80
|
+
"data-slot": "select-content",
|
|
81
|
+
"data-align-trigger": alignItemWithTrigger,
|
|
82
|
+
className: cn(
|
|
83
|
+
"relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
...props,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
89
|
+
/* @__PURE__ */ jsx(Select$1.List, { children }),
|
|
90
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
) });
|
|
96
|
+
}
|
|
97
|
+
function SelectLabel({ className, ...props }) {
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
Select$1.GroupLabel,
|
|
100
|
+
{
|
|
101
|
+
"data-slot": "select-label",
|
|
102
|
+
className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function SelectItem({ className, children, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsxs(
|
|
109
|
+
Select$1.Item,
|
|
110
|
+
{
|
|
111
|
+
"data-slot": "select-item",
|
|
112
|
+
className: cn(
|
|
113
|
+
"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
114
|
+
className
|
|
115
|
+
),
|
|
116
|
+
...props,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children }),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
Select$1.ItemIndicator,
|
|
121
|
+
{
|
|
122
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute end-2 flex items-center justify-center" }),
|
|
123
|
+
children: /* @__PURE__ */ jsx(IconCheck, { className: "pointer-events-none" })
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function SelectSeparator({ className, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx(
|
|
132
|
+
Select$1.Separator,
|
|
133
|
+
{
|
|
134
|
+
"data-slot": "select-separator",
|
|
135
|
+
className: cn("pointer-events-none -mx-1 my-1 h-px bg-border/50", className),
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function SelectScrollUpButton({
|
|
141
|
+
className,
|
|
142
|
+
...props
|
|
143
|
+
}) {
|
|
144
|
+
return /* @__PURE__ */ jsx(
|
|
145
|
+
Select$1.ScrollUpArrow,
|
|
146
|
+
{
|
|
147
|
+
"data-slot": "select-scroll-up-button",
|
|
148
|
+
className: cn(
|
|
149
|
+
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
150
|
+
className
|
|
151
|
+
),
|
|
152
|
+
...props,
|
|
153
|
+
children: /* @__PURE__ */ jsx(IconExpandLess, {})
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
function SelectScrollDownButton({
|
|
158
|
+
className,
|
|
159
|
+
...props
|
|
160
|
+
}) {
|
|
161
|
+
return /* @__PURE__ */ jsx(
|
|
162
|
+
Select$1.ScrollDownArrow,
|
|
163
|
+
{
|
|
164
|
+
"data-slot": "select-scroll-down-button",
|
|
165
|
+
className: cn(
|
|
166
|
+
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
167
|
+
className
|
|
168
|
+
),
|
|
169
|
+
...props,
|
|
170
|
+
children: /* @__PURE__ */ jsx(IconExpandMore, {})
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
|
|
176
|
+
//# sourceMappingURL=select.js.map
|
|
177
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/select.tsx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L,CAAA,EAAiE;AAC/D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,eAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,2BAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ","file":"select.js","sourcesContent":["'use client'\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & {\n size?: 'sm' | 'default'\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n data-size={size}\n className={cn(\n \"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-3.5 text-muted-foreground' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
declare const skipLinkVariants: (props?: ({
|
|
6
|
-
color?: "
|
|
6
|
+
color?: "white" | "grey" | "light" | "dark" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
8
|
type SkipLinkProps = React__default.ComponentPropsWithoutRef<'a'> & VariantProps<typeof skipLinkVariants> & {
|
|
9
9
|
/** Same-page fragment target, e.g. `"#content"`. */
|
|
@@ -1,86 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Styled Base UI Slider parts, exported for layouts the composed `Slider`
|
|
6
|
-
* below does not cover (a two-thumb range with its own labelling, a vertical
|
|
7
|
-
* slider in a toolbar, a value readout somewhere other than beside the label).
|
|
8
|
-
*
|
|
9
|
-
* All keyboard, pointer, ARIA and form behaviour comes from Base UI —
|
|
10
|
-
* arrow/Home/End/PageUp/PageDown stepping, `role="slider"`,
|
|
11
|
-
* `aria-valuenow`/`-valuemin`/`-valuemax`, thumb focus management, and RTL.
|
|
12
|
-
* Nothing here re-implements any of it (AGENTS.md §8, "never hand-roll ARIA").
|
|
13
|
-
*/
|
|
14
|
-
declare function SliderRoot<Value extends number | readonly number[] = number>({ className, ...props }: Slider$1.Root.Props<Value>): React.JSX.Element;
|
|
15
|
-
/**
|
|
16
|
-
* The interactive area. Larger than the visible track, for a 24px pointer
|
|
17
|
-
* target.
|
|
18
|
-
*
|
|
19
|
-
* The disabled fade lives HERE rather than on the root, which is where the
|
|
20
|
-
* reflex is to put it (and where `Button` puts its own). On a Button, the faded
|
|
21
|
-
* text sits on a solid fill and survives; on a slider the label and value are
|
|
22
|
-
* plain text on the page background, and fading them took the label to 3.55:1
|
|
23
|
-
* and the readout to 2.39:1 — both below the 4.5:1 minimum, caught by the axe
|
|
24
|
-
* check on the Disabled story. A disabled control still has to be readable
|
|
25
|
-
* (WCAG 2.2, 1.4.3), so only the track, indicator and thumb dim; the label and
|
|
26
|
-
* value keep their contrast, and the root just stops taking pointer events.
|
|
27
|
-
*/
|
|
28
|
-
declare function SliderControl({ className, ...props }: Slider$1.Control.Props): React.JSX.Element;
|
|
29
|
-
/** The unfilled rail. */
|
|
30
|
-
declare function SliderTrack({ className, ...props }: Slider$1.Track.Props): React.JSX.Element;
|
|
31
|
-
/** The filled portion, from `min` to the current value. */
|
|
32
|
-
declare function SliderIndicator({ className, ...props }: Slider$1.Indicator.Props): React.JSX.Element;
|
|
33
|
-
/**
|
|
34
|
-
* The draggable handle.
|
|
35
|
-
*
|
|
36
|
-
* `border-background` rather than `border-white`: the ring separating the thumb
|
|
37
|
-
* from the track has to read against the page surface, which is near-black in
|
|
38
|
-
* dark mode, so a hardcoded white would invert the effect exactly where it
|
|
39
|
-
* matters most.
|
|
40
|
-
*/
|
|
41
|
-
declare function SliderThumb({ className, ...props }: Slider$1.Thumb.Props): React.JSX.Element;
|
|
42
|
-
/** The current value, rendered as an `<output>` by Base UI. */
|
|
43
|
-
declare function SliderValue({ className, ...props }: Slider$1.Value.Props): React.JSX.Element;
|
|
44
|
-
/** The slider's visible label, associated by Base UI. */
|
|
45
|
-
declare function SliderLabel({ className, ...props }: Slider$1.Label.Props): React.JSX.Element;
|
|
46
|
-
type SliderProps<Value extends number | readonly number[] = number> = Omit<Slider$1.Root.Props<Value>, 'children'> & {
|
|
47
|
-
/**
|
|
48
|
-
* Visible label. Omit only when the control is labelled from outside — via
|
|
49
|
-
* `Field`/`FieldLabel`, or an `aria-label` on the root — never leave it
|
|
50
|
-
* unnamed (WCAG 2.2, 4.1.2).
|
|
51
|
-
*/
|
|
52
|
-
label?: React.ReactNode;
|
|
53
|
-
/** Show the live value beside the label. Defaults to `true`. */
|
|
54
|
-
showValue?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Unit appended to the readout, e.g. `'px'` or `'%'`. Purely visual — Base
|
|
57
|
-
* UI announces the underlying number, so use `format` on the root for a unit
|
|
58
|
-
* assistive tech should hear.
|
|
59
|
-
*/
|
|
60
|
-
suffix?: React.ReactNode;
|
|
61
|
-
/** Optional leading glyph, sized and hidden from assistive tech here. */
|
|
62
|
-
icon?: React.ElementType;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* A slider for choosing a number from a range.
|
|
66
|
-
*
|
|
67
|
-
* Composes the parts above into the common layout: label and live value on one
|
|
68
|
-
* row, track beneath. For anything else, import the parts directly.
|
|
69
|
-
*
|
|
70
|
-
* ```tsx
|
|
71
|
-
* <Slider label='Size' defaultValue={56} min={16} max={140} suffix='px' />
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* **Inside a `Field` it needs no `label` of its own.** Base UI's Slider reads
|
|
75
|
-
* the surrounding Field context (`SliderRootState` extends `FieldRootState`),
|
|
76
|
-
* so `FieldLabel`, `FieldDescription` and `FieldError` associate with it the
|
|
77
|
-
* same way they do for `Input` — passing both would name the control twice.
|
|
78
|
-
*
|
|
79
|
-
* **Range sliders work through the parts, not this wrapper.** Pass an array
|
|
80
|
-
* `value` and Base UI renders one thumb per entry, but a single visible label
|
|
81
|
-
* cannot correctly name two thumbs; build those from `SliderRoot` and give
|
|
82
|
-
* each `SliderThumb` its own accessible name.
|
|
83
|
-
*/
|
|
84
|
-
declare function Slider<Value extends number | readonly number[] = number>({ className, label, showValue, suffix, icon: Icon, ...props }: SliderProps<Value>): React.JSX.Element;
|
|
4
|
+
declare function Slider({ className, defaultValue, value, min, max, ...props }: Slider$1.Root.Props): React.JSX.Element;
|
|
85
5
|
|
|
86
|
-
export { Slider
|
|
6
|
+
export { Slider };
|
|
@@ -1,122 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
4
3
|
import { cn } from '../lib/utils.js';
|
|
5
4
|
|
|
6
|
-
function
|
|
5
|
+
function Slider({
|
|
7
6
|
className,
|
|
7
|
+
defaultValue,
|
|
8
|
+
value,
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
8
11
|
...props
|
|
9
12
|
}) {
|
|
13
|
+
const _values = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max];
|
|
10
14
|
return /* @__PURE__ */ jsx(
|
|
11
15
|
Slider$1.Root,
|
|
12
16
|
{
|
|
17
|
+
className: cn("data-horizontal:w-full data-vertical:h-full", className),
|
|
13
18
|
"data-slot": "slider",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...props
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"data-[orientation=horizontal]:h-2 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2",
|
|
45
|
-
className
|
|
46
|
-
),
|
|
47
|
-
...props
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
function SliderIndicator({ className, ...props }) {
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
Slider$1.Indicator,
|
|
54
|
-
{
|
|
55
|
-
"data-slot": "slider-indicator",
|
|
56
|
-
className: cn("rounded-full bg-primary select-none", className),
|
|
57
|
-
...props
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
function SliderThumb({ className, ...props }) {
|
|
62
|
-
return /* @__PURE__ */ jsx(
|
|
63
|
-
Slider$1.Thumb,
|
|
64
|
-
{
|
|
65
|
-
"data-slot": "slider-thumb",
|
|
66
|
-
className: cn(
|
|
67
|
-
"size-5 rounded-full border-2 border-background bg-primary shadow-sm",
|
|
68
|
-
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
69
|
-
"data-[dragging]:scale-110 motion-safe:transition-transform",
|
|
70
|
-
className
|
|
71
|
-
),
|
|
72
|
-
...props
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
function SliderValue({ className, ...props }) {
|
|
77
|
-
return /* @__PURE__ */ jsx(
|
|
78
|
-
Slider$1.Value,
|
|
79
|
-
{
|
|
80
|
-
"data-slot": "slider-value",
|
|
81
|
-
className: cn("text-base tabular-nums", className),
|
|
82
|
-
...props
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
function SliderLabel({ className, ...props }) {
|
|
87
|
-
return /* @__PURE__ */ jsx(
|
|
88
|
-
Slider$1.Label,
|
|
89
|
-
{
|
|
90
|
-
"data-slot": "slider-label",
|
|
91
|
-
className: cn("text-base font-semibold", className),
|
|
92
|
-
...props
|
|
19
|
+
defaultValue,
|
|
20
|
+
value,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
thumbAlignment: "edge",
|
|
24
|
+
...props,
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Control, { className: "relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
Slider$1.Track,
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "slider-track",
|
|
30
|
+
className: "relative grow overflow-hidden rounded-md bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
31
|
+
children: /* @__PURE__ */ jsx(
|
|
32
|
+
Slider$1.Indicator,
|
|
33
|
+
{
|
|
34
|
+
"data-slot": "slider-range",
|
|
35
|
+
className: "bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
|
|
41
|
+
Slider$1.Thumb,
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "slider-thumb",
|
|
44
|
+
className: "relative block size-3 shrink-0 rounded-md border border-ring bg-white ring-ring/30 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-2 focus-visible:ring-2 focus-visible:outline-hidden active:ring-2 disabled:pointer-events-none disabled:opacity-50"
|
|
45
|
+
},
|
|
46
|
+
index
|
|
47
|
+
))
|
|
48
|
+
] })
|
|
93
49
|
}
|
|
94
50
|
);
|
|
95
51
|
}
|
|
96
|
-
function Slider({
|
|
97
|
-
className,
|
|
98
|
-
label,
|
|
99
|
-
showValue = true,
|
|
100
|
-
suffix,
|
|
101
|
-
icon: Icon,
|
|
102
|
-
...props
|
|
103
|
-
}) {
|
|
104
|
-
return /* @__PURE__ */ jsxs(SliderRoot, { className: cn("flex-col items-stretch gap-1", className), ...props, children: [
|
|
105
|
-
label || showValue ? /* @__PURE__ */ jsxs("div", { "data-slot": "slider-header", className: "flex items-center gap-3", children: [
|
|
106
|
-
Icon ? /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", className: "size-5 shrink-0 text-muted-foreground" }) : null,
|
|
107
|
-
label ? /* @__PURE__ */ jsx(SliderLabel, { children: label }) : null,
|
|
108
|
-
showValue ? /* @__PURE__ */ jsx(SliderValue, { className: "ms-auto text-muted-foreground", children: (formattedValues) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
109
|
-
formattedValues.join(" \u2013 "),
|
|
110
|
-
suffix
|
|
111
|
-
] }) }) : null
|
|
112
|
-
] }) : null,
|
|
113
|
-
/* @__PURE__ */ jsx(SliderControl, { children: /* @__PURE__ */ jsxs(SliderTrack, { children: [
|
|
114
|
-
/* @__PURE__ */ jsx(SliderIndicator, {}),
|
|
115
|
-
/* @__PURE__ */ jsx(SliderThumb, {})
|
|
116
|
-
] }) })
|
|
117
|
-
] });
|
|
118
|
-
}
|
|
119
52
|
|
|
120
|
-
export { Slider
|
|
53
|
+
export { Slider };
|
|
121
54
|
//# sourceMappingURL=slider.js.map
|
|
122
55
|
//# sourceMappingURL=slider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/slider.tsx"],"names":["SliderPrimitive"],"mappings":";;;;AAkBA,SAAS,UAAA,CAA8D;AAAA,EACrE,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAsC;AACpC,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,IAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,mFAAA;AAAA,QACA,4GAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAeA,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,OAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,gBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,+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,EAAA,EAAgB,CAAA;AAAA,0BAChB,WAAA,EAAA,EAAY;AAAA,KAAA,EACf,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"slider.js","sourcesContent":["'use client'\n\nimport type * as React from 'react'\n\nimport { Slider as SliderPrimitive } from '@base-ui/react/slider'\n\nimport { cn } from '../lib/utils.js'\n\n/**\n * Styled Base UI Slider parts, exported for layouts the composed `Slider`\n * below does not cover (a two-thumb range with its own labelling, a vertical\n * slider in a toolbar, a value readout somewhere other than beside the label).\n *\n * All keyboard, pointer, ARIA and form behaviour comes from Base UI —\n * arrow/Home/End/PageUp/PageDown stepping, `role=\"slider\"`,\n * `aria-valuenow`/`-valuemin`/`-valuemax`, thumb focus management, and RTL.\n * Nothing here re-implements any of it (AGENTS.md §8, \"never hand-roll ARIA\").\n */\nfunction SliderRoot<Value extends number | readonly number[] = number>({\n className,\n ...props\n}: SliderPrimitive.Root.Props<Value>) {\n return (\n <SliderPrimitive.Root<Value>\n data-slot='slider'\n className={cn(\n 'flex w-full touch-none items-center select-none data-disabled:pointer-events-none',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * The interactive area. Larger than the visible track, for a 24px pointer\n * target.\n *\n * The disabled fade lives HERE rather than on the root, which is where the\n * reflex is to put it (and where `Button` puts its own). On a Button, the faded\n * text sits on a solid fill and survives; on a slider the label and value are\n * plain text on the page background, and fading them took the label to 3.55:1\n * and the readout to 2.39:1 — both below the 4.5:1 minimum, caught by the axe\n * check on the Disabled story. A disabled control still has to be readable\n * (WCAG 2.2, 1.4.3), so only the track, indicator and thumb dim; the label and\n * value keep their contrast, and the root just stops taking pointer events.\n */\nfunction SliderControl({ className, ...props }: SliderPrimitive.Control.Props) {\n return (\n <SliderPrimitive.Control\n data-slot='slider-control'\n className={cn(\n 'flex w-full flex-1 items-center py-3 data-disabled:opacity-50',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:justify-center data-[orientation=vertical]:px-3 data-[orientation=vertical]:py-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** The unfilled rail. */\nfunction SliderTrack({ className, ...props }: SliderPrimitive.Track.Props) {\n return (\n <SliderPrimitive.Track\n data-slot='slider-track'\n className={cn(\n 'relative w-full overflow-hidden rounded-full bg-muted',\n 'data-[orientation=horizontal]:h-2 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** The filled portion, from `min` to the current value. */\nfunction SliderIndicator({ className, ...props }: SliderPrimitive.Indicator.Props) {\n return (\n <SliderPrimitive.Indicator\n data-slot='slider-indicator'\n className={cn('rounded-full bg-primary select-none', className)}\n {...props}\n />\n )\n}\n\n/**\n * The draggable handle.\n *\n * `border-background` rather than `border-white`: the ring separating the thumb\n * from the track has to read against the page surface, which is near-black in\n * dark mode, so a hardcoded white would invert the effect exactly where it\n * matters most.\n */\nfunction SliderThumb({ className, ...props }: SliderPrimitive.Thumb.Props) {\n return (\n <SliderPrimitive.Thumb\n data-slot='slider-thumb'\n className={cn(\n 'size-5 rounded-full border-2 border-background bg-primary shadow-sm',\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring',\n 'data-[dragging]:scale-110 motion-safe:transition-transform',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** The current value, rendered as an `<output>` by Base UI. */\nfunction SliderValue({ className, ...props }: SliderPrimitive.Value.Props) {\n return (\n <SliderPrimitive.Value\n data-slot='slider-value'\n className={cn('text-base tabular-nums', className)}\n {...props}\n />\n )\n}\n\n/** The slider's visible label, associated by Base UI. */\nfunction SliderLabel({ className, ...props }: SliderPrimitive.Label.Props) {\n return (\n <SliderPrimitive.Label\n data-slot='slider-label'\n className={cn('text-base font-semibold', className)}\n {...props}\n />\n )\n}\n\ntype SliderProps<Value extends number | readonly number[] = number> = Omit<\n SliderPrimitive.Root.Props<Value>,\n 'children'\n> & {\n /**\n * Visible label. Omit only when the control is labelled from outside — via\n * `Field`/`FieldLabel`, or an `aria-label` on the root — never leave it\n * unnamed (WCAG 2.2, 4.1.2).\n */\n label?: React.ReactNode\n /** Show the live value beside the label. Defaults to `true`. */\n showValue?: boolean\n /**\n * Unit appended to the readout, e.g. `'px'` or `'%'`. Purely visual — Base\n * UI announces the underlying number, so use `format` on the root for a unit\n * assistive tech should hear.\n */\n suffix?: React.ReactNode\n /** Optional leading glyph, sized and hidden from assistive tech here. */\n icon?: React.ElementType\n}\n\n/**\n * A slider for choosing a number from a range.\n *\n * Composes the parts above into the common layout: label and live value on one\n * row, track beneath. For anything else, import the parts directly.\n *\n * ```tsx\n * <Slider label='Size' defaultValue={56} min={16} max={140} suffix='px' />\n * ```\n *\n * **Inside a `Field` it needs no `label` of its own.** Base UI's Slider reads\n * the surrounding Field context (`SliderRootState` extends `FieldRootState`),\n * so `FieldLabel`, `FieldDescription` and `FieldError` associate with it the\n * same way they do for `Input` — passing both would name the control twice.\n *\n * **Range sliders work through the parts, not this wrapper.** Pass an array\n * `value` and Base UI renders one thumb per entry, but a single visible label\n * cannot correctly name two thumbs; build those from `SliderRoot` and give\n * each `SliderThumb` its own accessible name.\n */\nfunction Slider<Value extends number | readonly number[] = number>({\n className,\n label,\n showValue = true,\n suffix,\n icon: Icon,\n ...props\n}: SliderProps<Value>) {\n return (\n <SliderRoot<Value> className={cn('flex-col items-stretch gap-1', className)} {...props}>\n {label || showValue ? (\n <div data-slot='slider-header' className='flex items-center gap-3'>\n {Icon ? (\n <Icon aria-hidden='true' className='size-5 shrink-0 text-muted-foreground' />\n ) : null}\n {label ? <SliderLabel>{label}</SliderLabel> : null}\n {showValue ? (\n <SliderValue className='ms-auto text-muted-foreground'>\n {(formattedValues) => (\n <>\n {formattedValues.join(' – ')}\n {suffix}\n </>\n )}\n </SliderValue>\n ) : null}\n </div>\n ) : null}\n <SliderControl>\n <SliderTrack>\n <SliderIndicator />\n <SliderThumb />\n </SliderTrack>\n </SliderControl>\n </SliderRoot>\n )\n}\n\nexport {\n Slider,\n SliderControl,\n SliderIndicator,\n SliderLabel,\n SliderRoot,\n SliderThumb,\n SliderTrack,\n SliderValue,\n}\nexport type { SliderProps }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/slider.tsx"],"names":["SliderPrimitive"],"mappings":";;;;AAIA,SAAS,MAAA,CAAO;AAAA,EACd,SAAA;AAAA,EACA,YAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA,GAAM,CAAA;AAAA,EACN,GAAA,GAAM,GAAA;AAAA,EACN,GAAG;AACL,CAAA,EAA+B;AAC7B,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAC/B,KAAA,GACA,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,GACxB,YAAA,GACA,CAAC,KAAK,GAAG,CAAA;AAEf,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,IAAA;AAAA,IAAhB;AAAA,MACC,SAAA,EAAW,EAAA,CAAG,6CAAA,EAA+C,SAAS,CAAA;AAAA,MACtE,WAAA,EAAU,QAAA;AAAA,MACV,YAAA;AAAA,MACA,KAAA;AAAA,MACA,GAAA;AAAA,MACA,GAAA;AAAA,MACA,cAAA,EAAe,MAAA;AAAA,MACd,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,IAAA,CAACA,QAAA,CAAgB,OAAA,EAAhB,EAAwB,WAAU,2KAAA,EACjC,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAACA,QAAA,CAAgB,KAAA;AAAA,UAAhB;AAAA,YACC,WAAA,EAAU,cAAA;AAAA,YACV,SAAA,EAAU,iJAAA;AAAA,YAEV,QAAA,kBAAA,GAAA;AAAA,cAACA,QAAA,CAAgB,SAAA;AAAA,cAAhB;AAAA,gBACC,WAAA,EAAU,cAAA;AAAA,gBACV,SAAA,EAAU;AAAA;AAAA;AACZ;AAAA,SACF;AAAA,QACC,KAAA,CAAM,KAAK,EAAE,MAAA,EAAQ,QAAQ,MAAA,EAAO,EAAG,CAAC,CAAA,EAAG,KAAA,qBAC1C,GAAA;AAAA,UAACA,QAAA,CAAgB,KAAA;AAAA,UAAhB;AAAA,YACC,WAAA,EAAU,cAAA;AAAA,YAEV,SAAA,EAAU;AAAA,WAAA;AAAA,UADL;AAAA,SAGR;AAAA,OAAA,EACH;AAAA;AAAA,GACF;AAEJ","file":"slider.js","sourcesContent":["import { Slider as SliderPrimitive } from '@base-ui/react/slider'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Slider({\n className,\n defaultValue,\n value,\n min = 0,\n max = 100,\n ...props\n}: SliderPrimitive.Root.Props) {\n const _values = Array.isArray(value)\n ? value\n : Array.isArray(defaultValue)\n ? defaultValue\n : [min, max]\n\n return (\n <SliderPrimitive.Root\n className={cn('data-horizontal:w-full data-vertical:h-full', className)}\n data-slot='slider'\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n thumbAlignment='edge'\n {...props}\n >\n <SliderPrimitive.Control className='relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col'>\n <SliderPrimitive.Track\n data-slot='slider-track'\n className='relative grow overflow-hidden rounded-md bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1'\n >\n <SliderPrimitive.Indicator\n data-slot='slider-range'\n className='bg-primary select-none data-horizontal:h-full data-vertical:w-full'\n />\n </SliderPrimitive.Track>\n {Array.from({ length: _values.length }, (_, index) => (\n <SliderPrimitive.Thumb\n data-slot='slider-thumb'\n key={index}\n className='relative block size-3 shrink-0 rounded-md border border-ring bg-white ring-ring/30 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-2 focus-visible:ring-2 focus-visible:outline-hidden active:ring-2 disabled:pointer-events-none disabled:opacity-50'\n />\n ))}\n </SliderPrimitive.Control>\n </SliderPrimitive.Root>\n )\n}\n\nexport { Slider }\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
function Switch({
|
|
7
|
+
className,
|
|
8
|
+
size = "default",
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Switch$1.Root,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "switch",
|
|
15
|
+
"data-size": size,
|
|
16
|
+
className: cn(
|
|
17
|
+
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
...props,
|
|
21
|
+
children: /* @__PURE__ */ jsx(
|
|
22
|
+
Switch$1.Thumb,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "switch-thumb",
|
|
25
|
+
className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] rtl:group-data-[size=default]/switch:data-checked:-translate-x-[calc(100%-2px)] rtl:group-data-[size=sm]/switch:data-checked:-translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 rtl:group-data-[size=default]/switch:data-unchecked:-translate-x-0 rtl:group-data-[size=sm]/switch:data-unchecked:-translate-x-0 dark:data-unchecked:bg-foreground"
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Switch };
|
|
33
|
+
//# sourceMappingURL=switch.js.map
|
|
34
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/switch.tsx"],"names":["SwitchPrimitive"],"mappings":";;;;AAMA,SAAS,MAAA,CAAO;AAAA,EACd,SAAA;AAAA,EACA,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACL,CAAA,EAEG;AACD,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,IAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,SAAA,EAAW,EAAA;AAAA,QACT,6vBAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACA,QAAA,CAAgB,KAAA;AAAA,QAAhB;AAAA,UACC,WAAA,EAAU,cAAA;AAAA,UACV,SAAA,EAAU;AAAA;AAAA;AACZ;AAAA,GACF;AAEJ","file":"switch.js","sourcesContent":["'use client'\n\nimport { Switch as SwitchPrimitive } from '@base-ui/react/switch'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Switch({\n className,\n size = 'default',\n ...props\n}: SwitchPrimitive.Root.Props & {\n size?: 'sm' | 'default'\n}) {\n return (\n <SwitchPrimitive.Root\n data-slot='switch'\n data-size={size}\n className={cn(\n 'peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot='switch-thumb'\n className='pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] rtl:group-data-[size=default]/switch:data-checked:-translate-x-[calc(100%-2px)] rtl:group-data-[size=sm]/switch:data-checked:-translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 rtl:group-data-[size=default]/switch:data-unchecked:-translate-x-0 rtl:group-data-[size=sm]/switch:data-unchecked:-translate-x-0 dark:data-unchecked:bg-foreground'\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare function Table({ className, ...props }: React.ComponentProps<'table'>): React.JSX.Element;
|
|
4
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): React.JSX.Element;
|
|
5
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): React.JSX.Element;
|
|
6
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>): React.JSX.Element;
|
|
7
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<'tr'>): React.JSX.Element;
|
|
8
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<'th'>): React.JSX.Element;
|
|
9
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<'td'>): React.JSX.Element;
|
|
10
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<'caption'>): React.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|