@nswds/ui 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +94 -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 +1 -1
- 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/header.js +37 -9
- package/dist/components/header.js.map +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/logo.d.ts +15 -1
- package/dist/components/logo.js +59 -50
- package/dist/components/logo.js.map +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 +112 -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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;AAUA,MAAM,SAASA,QAAA,CAAgB;AAE/B,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iBA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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?: "light" | "white" | "grey" | "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,+DAAA;AAAA,QACA,oLAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAGA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,E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AAA,EACjE,SAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA,GAAY,IAAA;AAAA,EACZ,MAAA;AAAA,EACA,IAAA,EAAM,IAAA;AAAA,EACN,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,uBACE,IAAA,CAAC,cAAkB,SAAA,EAAW,EAAA,CAAG,gCAAgC,SAAS,CAAA,EAAI,GAAG,KAAA,EAC9E,QAAA,EAAA;AAAA,IAAA,KAAA,IAAS,4BACR,IAAA,CAAC,KAAA,EAAA,EAAI,WAAA,EAAU,eAAA,EAAgB,WAAU,yBAAA,EACtC,QAAA,EAAA;AAAA,MAAA,IAAA,uBACE,IAAA,EAAA,EAAK,aAAA,EAAY,MAAA,EAAO,SAAA,EAAU,yCAAwC,CAAA,GACzE,IAAA;AAAA,MACH,KAAA,mBAAQ,GAAA,CAAC,WAAA,EAAA,EAAa,QAAA,EAAA,KAAA,EAAM,CAAA,GAAiB,IAAA;AAAA,MAC7C,4BACC,GAAA,CAAC,WAAA,EAAA,EAAY,WAAU,+BAAA,EACpB,QAAA,EAAA,CAAC,oCACA,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,eAAA,CAAgB,KAAK,UAAK,CAAA;AAAA,QAC1B;AAAA,OAAA,EACH,GAEJ,CAAA,GACE;AAAA,KAAA,EACN,CAAA,GACE,IAAA;AAAA,oBACJ,GAAA,CAAC,aAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,WAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,eAAA,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,SAA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ACF;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 };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
function Table({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: /* @__PURE__ */ jsx(
|
|
7
|
+
"table",
|
|
8
|
+
{
|
|
9
|
+
"data-slot": "table",
|
|
10
|
+
className: cn("w-full caption-bottom text-xs", className),
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
) });
|
|
14
|
+
}
|
|
15
|
+
function TableHeader({ className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props });
|
|
17
|
+
}
|
|
18
|
+
function TableBody({ className, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"tbody",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "table-body",
|
|
23
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
24
|
+
...props
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function TableFooter({ className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"tfoot",
|
|
31
|
+
{
|
|
32
|
+
"data-slot": "table-footer",
|
|
33
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function TableRow({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
"tr",
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "table-row",
|
|
43
|
+
className: cn(
|
|
44
|
+
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function TableHead({ className, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
"th",
|
|
54
|
+
{
|
|
55
|
+
"data-slot": "table-head",
|
|
56
|
+
className: cn(
|
|
57
|
+
"h-10 px-2 text-start align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pe-0",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
function TableCell({ className, ...props }) {
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
"td",
|
|
67
|
+
{
|
|
68
|
+
"data-slot": "table-cell",
|
|
69
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0", className),
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function TableCaption({ className, ...props }) {
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
"caption",
|
|
77
|
+
{
|
|
78
|
+
"data-slot": "table-caption",
|
|
79
|
+
className: cn("mt-4 text-xs text-muted-foreground", className),
|
|
80
|
+
...props
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
86
|
+
//# sourceMappingURL=table.js.map
|
|
87
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/table.tsx"],"names":[],"mappings":";;;AAMA,SAAS,KAAA,CAAM,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AACrE,EAAA,uBACE,GAAA,CAAC,K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S,SAAA,CAAU,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+B;AACtE,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,+GAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,SAAA,CAAU,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+B;AACtE,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,kEAAA,EAAoE,SAAS,CAAA;AAAA,MAC1F,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAoC;AAC9E,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,oCAAA,EAAsC,SAAS,CAAA;AAAA,MAC5D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"table.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Table({ className, ...props }: React.ComponentProps<'table'>) {\n return (\n <div data-slot='table-container' className='relative w-full overflow-x-auto'>\n <table\n data-slot='table'\n className={cn('w-full caption-bottom text-xs', className)}\n {...props}\n />\n </div>\n )\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {\n return <thead data-slot='table-header' className={cn('[&_tr]:border-b', className)} {...props} />\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {\n return (\n <tbody\n data-slot='table-body'\n className={cn('[&_tr:last-child]:border-0', className)}\n {...props}\n />\n )\n}\n\nfunction TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {\n return (\n <tfoot\n data-slot='table-footer'\n className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}\n {...props}\n />\n )\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<'tr'>) {\n return (\n <tr\n data-slot='table-row'\n className={cn(\n 'border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<'th'>) {\n return (\n <th\n data-slot='table-head'\n className={cn(\n 'h-10 px-2 text-start align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pe-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<'td'>) {\n return (\n <td\n data-slot='table-cell'\n className={cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0', className)}\n {...props}\n />\n )\n}\n\nfunction TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {\n return (\n <caption\n data-slot='table-caption'\n className={cn('mt-4 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow }\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare function Tabs({ className, orientation, ...props }: Tabs$1.Root.Props): React.JSX.Element;
|
|
7
|
+
declare const tabsListVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "line" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
11
|
+
declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): React.JSX.Element;
|
|
12
|
+
declare function TabsContent({ className, ...props }: Tabs$1.Panel.Props): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
|
|
7
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Tabs$1.Root,
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "tabs",
|
|
12
|
+
"data-orientation": orientation,
|
|
13
|
+
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const tabsListVariants = cva(
|
|
19
|
+
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
variant: {
|
|
23
|
+
default: "bg-muted",
|
|
24
|
+
line: "gap-1 bg-transparent"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: "default"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
function TabsList({
|
|
33
|
+
className,
|
|
34
|
+
variant = "default",
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
Tabs$1.List,
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "tabs-list",
|
|
41
|
+
"data-variant": variant,
|
|
42
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function TabsTrigger({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Tabs$1.Tab,
|
|
50
|
+
{
|
|
51
|
+
"data-slot": "tabs-trigger",
|
|
52
|
+
className: cn(
|
|
53
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
54
|
+
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
55
|
+
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
|
|
56
|
+
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-end-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
57
|
+
className
|
|
58
|
+
),
|
|
59
|
+
...props
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function TabsContent({ className, ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Tabs$1.Panel,
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "tabs-content",
|
|
68
|
+
className: cn("flex-1 text-xs/relaxed outline-none", className),
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
75
|
+
//# sourceMappingURL=tabs.js.map
|
|
76
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/tabs.tsx"],"names":["TabsPrimitive"],"mappings":";;;;;AAOA,SAAS,KAAK,EAAE,SAAA,EAAW,cAAc,YAAA,EAAc,GAAG,OAAM,EAA6B;AAC3F,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAc,IAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,MAAA;AAAA,MACV,kBAAA,EAAkB,WAAA;AAAA,MAClB,SAAA,EAAW,EAAA,CAAG,gDAAA,EAAkD,SAAS,CAAA;AAAA,MACxE,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,gBAAA,GAAmB,GAAA;AAAA,EACvB,yOAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,UAAA;AAAA,QACT,IAAA,EAAM;AAAA;AACR,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ;AAEA,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,GAAG;AACL,CAAA,EAAqE;AACnE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAc,IAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,WAAW,EAAA,CAAG,gBAAA,CAAiB,EAAE,OAAA,EAAS,GAAG,SAAS,CAAA;AAAA,MACrD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAA4B;AACrE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAc,GAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,yxBAAA;AAAA,QACA,+PAAA;AAAA,QACA,mJAAA;AAAA,QACA,oYAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAA8B;AACvE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAc,KAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"tabs.js","sourcesContent":["'use client'\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Tabs({ className, orientation = 'horizontal', ...props }: TabsPrimitive.Root.Props) {\n return (\n <TabsPrimitive.Root\n data-slot='tabs'\n data-orientation={orientation}\n className={cn('group/tabs flex gap-2 data-horizontal:flex-col', className)}\n {...props}\n />\n )\n}\n\nconst tabsListVariants = cva(\n 'group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none',\n {\n variants: {\n variant: {\n default: 'bg-muted',\n line: 'gap-1 bg-transparent',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n)\n\nfunction TabsList({\n className,\n variant = 'default',\n ...props\n}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {\n return (\n <TabsPrimitive.List\n data-slot='tabs-list'\n data-variant={variant}\n className={cn(tabsListVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {\n return (\n <TabsPrimitive.Tab\n data-slot='tabs-trigger'\n className={cn(\n \"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n 'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',\n 'data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground',\n 'after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-end-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {\n return (\n <TabsPrimitive.Panel\n data-slot='tabs-content'\n className={cn('flex-1 text-xs/relaxed outline-none', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, tabsListVariants, TabsTrigger }\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
|
+
|
|
4
|
+
function Textarea({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"textarea",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "textarea",
|
|
9
|
+
className: cn(
|
|
10
|
+
"flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 transition-colors outline-none placeholder:text-muted-foreground 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 max-md:text-sm md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Textarea };
|
|
19
|
+
//# sourceMappingURL=textarea.js.map
|
|
20
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/textarea.tsx"],"names":[],"mappings":";;;AAIA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6fAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"textarea.js","sourcesContent":["import * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n return (\n <textarea\n data-slot='textarea'\n className={cn(\n 'flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 transition-colors outline-none placeholder:text-muted-foreground 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 max-md:text-sm md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport { Textarea }\n"]}
|