@wheelhouse/ui 0.2.0 → 0.2.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/blocks/index.d.ts +2 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +1 -0
- package/dist/blocks/navigation/index.d.ts +2 -0
- package/dist/blocks/navigation/index.d.ts.map +1 -0
- package/dist/blocks/navigation/index.js +1 -0
- package/dist/blocks/navigation/pattern-1/index.d.ts +3 -0
- package/dist/blocks/navigation/pattern-1/index.d.ts.map +1 -0
- package/dist/blocks/navigation/pattern-1/index.js +1 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.config.d.ts +47 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.config.d.ts.map +1 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.config.js +55 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.d.ts +7 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.d.ts.map +1 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.js +50 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.stories.d.ts +16 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.stories.d.ts.map +1 -0
- package/dist/blocks/navigation/pattern-1/pattern-1.stories.js +20 -0
- package/dist/components/accordion/accordion.js +2 -2
- package/dist/components/alert/alert.stories.js +4 -4
- package/dist/components/alert-dialog/alert-dialog.stories.js +2 -2
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +3 -4
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/calendar/calendar.d.ts +34 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +82 -0
- package/dist/components/calendar/calendar.stories.d.ts +16 -0
- package/dist/components/calendar/calendar.stories.d.ts.map +1 -0
- package/dist/components/calendar/calendar.stories.js +33 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/collapsible/collapsible.stories.js +4 -4
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +5 -7
- package/dist/components/command/command.d.ts.map +1 -1
- package/dist/components/command/command.js +3 -4
- package/dist/components/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu/context-menu.js +4 -5
- package/dist/components/date-selector/date-selector-context.d.ts +6 -0
- package/dist/components/date-selector/date-selector-context.d.ts.map +1 -0
- package/dist/components/date-selector/date-selector-context.js +11 -0
- package/dist/components/date-selector/date-selector-parts.d.ts +68 -0
- package/dist/components/date-selector/date-selector-parts.d.ts.map +1 -0
- package/dist/components/date-selector/date-selector-parts.js +131 -0
- package/dist/components/date-selector/date-selector-types.d.ts +118 -0
- package/dist/components/date-selector/date-selector-types.d.ts.map +1 -0
- package/dist/components/date-selector/date-selector-types.js +32 -0
- package/dist/components/date-selector/date-selector-value.d.ts +47 -0
- package/dist/components/date-selector/date-selector-value.d.ts.map +1 -0
- package/dist/components/date-selector/date-selector-value.js +183 -0
- package/dist/components/date-selector/date-selector.d.ts +6 -0
- package/dist/components/date-selector/date-selector.d.ts.map +1 -0
- package/dist/components/date-selector/date-selector.js +144 -0
- package/dist/components/date-selector/date-selector.stories.d.ts +135 -0
- package/dist/components/date-selector/date-selector.stories.d.ts.map +1 -0
- package/dist/components/date-selector/date-selector.stories.js +144 -0
- package/dist/components/date-selector/index.d.ts +7 -0
- package/dist/components/date-selector/index.d.ts.map +1 -0
- package/dist/components/date-selector/index.js +5 -0
- package/dist/components/date-selector/use-date-selector.d.ts +50 -0
- package/dist/components/date-selector/use-date-selector.d.ts.map +1 -0
- package/dist/components/date-selector/use-date-selector.js +305 -0
- package/dist/components/dialog/dialog.js +2 -2
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +5 -6
- package/dist/components/empty/empty.stories.js +2 -2
- package/dist/components/filters/filters.js +4 -4
- package/dist/components/filters/filters.stories.js +3 -3
- package/dist/components/frame/frame.d.ts +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/input-group/input-group.d.ts +2 -2
- package/dist/components/input-group/input-group.stories.js +3 -3
- package/dist/components/item/item.d.ts +2 -2
- package/dist/components/item/item.stories.d.ts.map +1 -1
- package/dist/components/item/item.stories.js +5 -6
- package/dist/components/kbd/kbd.stories.js +2 -2
- package/dist/components/menubar/menubar.js +3 -3
- package/dist/components/native-select/native-select.js +2 -2
- package/dist/components/navigation-menu/navigation-menu.js +2 -2
- package/dist/components/pagination/pagination.js +4 -4
- package/dist/components/select/select.js +5 -5
- package/dist/components/sheet/sheet.js +2 -2
- package/dist/components/sonner/sonner.d.ts +1 -1
- package/dist/components/sonner/sonner.js +7 -7
- package/dist/components/sortable/index.d.ts +3 -0
- package/dist/components/sortable/index.d.ts.map +1 -0
- package/dist/components/sortable/index.js +1 -0
- package/dist/components/sortable/sortable.d.ts +94 -0
- package/dist/components/sortable/sortable.d.ts.map +1 -0
- package/dist/components/sortable/sortable.js +210 -0
- package/dist/components/sortable/sortable.stories.d.ts +14 -0
- package/dist/components/sortable/sortable.stories.d.ts.map +1 -0
- package/dist/components/sortable/sortable.stories.js +38 -0
- package/dist/components/spinner/spinner.d.ts +3 -3
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spinner/spinner.js +2 -2
- package/dist/components/status-indicator/index.d.ts +3 -0
- package/dist/components/status-indicator/index.d.ts.map +1 -0
- package/dist/components/status-indicator/index.js +1 -0
- package/dist/components/status-indicator/status-indicator.d.ts +51 -0
- package/dist/components/status-indicator/status-indicator.d.ts.map +1 -0
- package/dist/components/status-indicator/status-indicator.js +48 -0
- package/dist/components/status-indicator/status-indicator.stories.d.ts +20 -0
- package/dist/components/status-indicator/status-indicator.stories.d.ts.map +1 -0
- package/dist/components/status-indicator/status-indicator.stories.js +97 -0
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/text/text.d.ts +1 -1
- package/dist/components/text/text.js +1 -1
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +11 -4
- package/package.json +9 -6
- package/src/styles/globals.css +4 -12
|
@@ -12,7 +12,7 @@ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGr
|
|
|
12
12
|
import { Kbd } from '../kbd';
|
|
13
13
|
import { ScrollArea } from '../scroll-area';
|
|
14
14
|
import { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';
|
|
15
|
-
import {
|
|
15
|
+
import { AlertCircle, Check, X } from 'lucide-react';
|
|
16
16
|
import { createOperatorsFromI18n, DEFAULT_I18N } from './filters-defaults';
|
|
17
17
|
import { createFilter } from './filters-utils';
|
|
18
18
|
const FilterContext = createContext({
|
|
@@ -113,9 +113,9 @@ function FilterInput({ field, onBlur, onKeyDown, className, ...props }) {
|
|
|
113
113
|
// Call the original onKeyDown if provided
|
|
114
114
|
onKeyDown?.(e);
|
|
115
115
|
};
|
|
116
|
-
return (_jsxs(InputGroup, { className: cn('w-36', context.size == 'sm' && 'h-7!', context.size == 'default' && 'h-8!', context.size == 'lg' && 'h-9!', className), children: [field?.prefix && (_jsx(InputGroupAddon, { children: _jsx(InputGroupText, { children: field.prefix }) })), _jsx(InputGroupInput, { ref: inputRef, "aria-invalid": !isValid, "aria-describedby": !isValid && validationMessage ? `${field?.key || 'input'}-error` : undefined, onBlur: handleBlur, onKeyDown: handleKeyDown, className: cn(context.size == 'sm' && 'h-7! text-xs', context.size == 'default' && 'h-8!', context.size == 'lg' && 'h-9!'), ...props }), !isValid && validationMessage && (_jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(InputGroupButton, { size: "icon-xs" }), children: _jsx(
|
|
116
|
+
return (_jsxs(InputGroup, { className: cn('w-36', context.size == 'sm' && 'h-7!', context.size == 'default' && 'h-8!', context.size == 'lg' && 'h-9!', className), children: [field?.prefix && (_jsx(InputGroupAddon, { children: _jsx(InputGroupText, { children: field.prefix }) })), _jsx(InputGroupInput, { ref: inputRef, "aria-invalid": !isValid, "aria-describedby": !isValid && validationMessage ? `${field?.key || 'input'}-error` : undefined, onBlur: handleBlur, onKeyDown: handleKeyDown, className: cn(context.size == 'sm' && 'h-7! text-xs', context.size == 'default' && 'h-8!', context.size == 'lg' && 'h-9!'), ...props }), !isValid && validationMessage && (_jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(InputGroupButton, { size: "icon-xs" }), children: _jsx(AlertCircle, { className: "size-3.5 text-destructive" }) }), _jsx(TooltipContent, { children: _jsx("p", { className: "text-sm", children: validationMessage }) })] }) })), field?.suffix && (_jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupText, { children: field.suffix }) }))] }));
|
|
117
117
|
}
|
|
118
|
-
function FilterRemoveButton({ className, icon = _jsx(
|
|
118
|
+
function FilterRemoveButton({ className, icon = _jsx(X, {}), ...props }) {
|
|
119
119
|
const context = useFilterContext();
|
|
120
120
|
return (_jsx(Button, { variant: "outline", size: context.size === 'sm' ? 'icon-sm' : context.size === 'lg' ? 'icon-lg' : 'icon', className: className, ...props, children: icon }));
|
|
121
121
|
}
|
|
@@ -171,7 +171,7 @@ function FilterOperatorDropdown({ field, operator, values, onChange }) {
|
|
|
171
171
|
const operators = getOperatorsForField(field, values, context.i18n);
|
|
172
172
|
// Find the operator label, with fallback to formatted operator name
|
|
173
173
|
const operatorLabel = operators.find((op) => op.value === operator)?.label || context.i18n.helpers.formatOperator(operator);
|
|
174
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: context.size, className: "text-muted-foreground hover:text-foreground", children: operatorLabel }) }), _jsx(DropdownMenuContent, { align: "start", className: "w-fit min-w-fit", children: operators.map((op) => (_jsxs(DropdownMenuItem, { onClick: () => onChange(op.value), className: cn('flex items-center justify-between data-highlighted:bg-accent data-highlighted:text-accent-foreground'), children: [_jsx("span", { children: op.label }), _jsx(
|
|
174
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: context.size, className: "text-muted-foreground hover:text-foreground", children: operatorLabel }) }), _jsx(DropdownMenuContent, { align: "start", className: "w-fit min-w-fit", children: operators.map((op) => (_jsxs(DropdownMenuItem, { onClick: () => onChange(op.value), className: cn('flex items-center justify-between data-highlighted:bg-accent data-highlighted:text-accent-foreground'), children: [_jsx("span", { children: op.label }), _jsx(Check, { className: cn('ms-auto text-primary', op.value === operator ? 'opacity-100' : 'opacity-0') })] }, op.value))) })] }));
|
|
175
175
|
}
|
|
176
176
|
function SelectOptionsPopover({ field, values, onChange, onClose, inline = false }) {
|
|
177
177
|
const [open, setOpen] = useState(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Filter as FilterIcon, Tag } from 'lucide-react';
|
|
5
5
|
import { Button } from '../button';
|
|
6
6
|
import { createFilter, Filters } from '.';
|
|
7
7
|
const demoFields = [
|
|
@@ -9,7 +9,7 @@ const demoFields = [
|
|
|
9
9
|
key: 'status',
|
|
10
10
|
label: 'Status',
|
|
11
11
|
type: 'select',
|
|
12
|
-
icon: _jsx(
|
|
12
|
+
icon: _jsx(FilterIcon, { className: "size-4" }),
|
|
13
13
|
options: [
|
|
14
14
|
{ value: 'active', label: 'Active' },
|
|
15
15
|
{ value: 'draft', label: 'Draft' },
|
|
@@ -20,7 +20,7 @@ const demoFields = [
|
|
|
20
20
|
label: 'Name',
|
|
21
21
|
type: 'text',
|
|
22
22
|
placeholder: 'Contains…',
|
|
23
|
-
icon: _jsx(
|
|
23
|
+
icon: _jsx(Tag, { className: "size-4" }),
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
26
|
function FiltersStoryHost() {
|
|
@@ -25,7 +25,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
25
25
|
*/
|
|
26
26
|
declare const frameVariants: (props?: ({
|
|
27
27
|
variant?: "default" | "ghost" | "inverse" | null | undefined;
|
|
28
|
-
spacing?: "default" | "
|
|
28
|
+
spacing?: "default" | "sm" | "lg" | "xs" | null | undefined;
|
|
29
29
|
stacked?: boolean | null | undefined;
|
|
30
30
|
dense?: boolean | null | undefined;
|
|
31
31
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -7,12 +7,14 @@ export * from './badge';
|
|
|
7
7
|
export * from './breadcrumb';
|
|
8
8
|
export * from './button';
|
|
9
9
|
export * from './button-group';
|
|
10
|
+
export * from './calendar';
|
|
10
11
|
export * from './card';
|
|
11
12
|
export * from './checkbox';
|
|
12
13
|
export * from './collapsible';
|
|
13
14
|
export * from './command';
|
|
14
15
|
export * from './combobox';
|
|
15
16
|
export * from './context-menu';
|
|
17
|
+
export * from './date-selector';
|
|
16
18
|
export * from './dialog';
|
|
17
19
|
export * from './direction';
|
|
18
20
|
export * from './drawer';
|
|
@@ -41,7 +43,9 @@ export * from './select';
|
|
|
41
43
|
export * from './sheet';
|
|
42
44
|
export * from './slider';
|
|
43
45
|
export * from './sonner';
|
|
46
|
+
export * from './sortable';
|
|
44
47
|
export * from './spinner';
|
|
48
|
+
export * from './status-indicator';
|
|
45
49
|
export * from './switch';
|
|
46
50
|
export * from './tabs';
|
|
47
51
|
export * from './text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -7,12 +7,14 @@ export * from './badge';
|
|
|
7
7
|
export * from './breadcrumb';
|
|
8
8
|
export * from './button';
|
|
9
9
|
export * from './button-group';
|
|
10
|
+
export * from './calendar';
|
|
10
11
|
export * from './card';
|
|
11
12
|
export * from './checkbox';
|
|
12
13
|
export * from './collapsible';
|
|
13
14
|
export * from './command';
|
|
14
15
|
export * from './combobox';
|
|
15
16
|
export * from './context-menu';
|
|
17
|
+
export * from './date-selector';
|
|
16
18
|
export * from './dialog';
|
|
17
19
|
export * from './direction';
|
|
18
20
|
export * from './drawer';
|
|
@@ -41,7 +43,9 @@ export * from './select';
|
|
|
41
43
|
export * from './sheet';
|
|
42
44
|
export * from './slider';
|
|
43
45
|
export * from './sonner';
|
|
46
|
+
export * from './sortable';
|
|
44
47
|
export * from './spinner';
|
|
48
|
+
export * from './status-indicator';
|
|
45
49
|
export * from './switch';
|
|
46
50
|
export * from './tabs';
|
|
47
51
|
export * from './text';
|
|
@@ -6,13 +6,13 @@ import type { TextareaProps } from '../textarea';
|
|
|
6
6
|
/** Props for `InputGroup`. */
|
|
7
7
|
export type InputGroupProps = React.ComponentProps<'div'>;
|
|
8
8
|
declare const inputGroupAddonVariants: (props?: ({
|
|
9
|
-
align?: "inline-
|
|
9
|
+
align?: "inline-end" | "inline-start" | "block-start" | "block-end" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
export declare const inputGroupAddonAlignKeys: readonly ["inline-start", "inline-end", "block-start", "block-end"];
|
|
12
12
|
/** Props for `InputGroupAddon`. */
|
|
13
13
|
export type InputGroupAddonProps = React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>;
|
|
14
14
|
declare const inputGroupButtonVariants: (props?: ({
|
|
15
|
-
size?: "
|
|
15
|
+
size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
17
|
export declare const inputGroupButtonSizeKeys: readonly ["xs", "sm", "icon-xs", "icon-sm"];
|
|
18
18
|
/** Props for `InputGroupButton` (ghost button sized for use inside a group). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Search } from 'lucide-react';
|
|
3
3
|
import { Kbd } from '../kbd';
|
|
4
4
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from '.';
|
|
5
5
|
const meta = {
|
|
@@ -15,7 +15,7 @@ export const Default = {
|
|
|
15
15
|
render: () => (_jsx("div", { className: "w-80", children: _jsxs(InputGroup, { children: [_jsx(InputGroupAddon, { children: _jsx(InputGroupText, { children: "https://" }) }), _jsx(InputGroupInput, { placeholder: "example.com" })] }) })),
|
|
16
16
|
};
|
|
17
17
|
export const WithTrailingButton = {
|
|
18
|
-
render: () => (_jsx("div", { className: "w-80", children: _jsxs(InputGroup, { children: [_jsx(InputGroupInput, { placeholder: "Search\u2026" }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { type: "button", "aria-label": "Search", children: _jsx(
|
|
18
|
+
render: () => (_jsx("div", { className: "w-80", children: _jsxs(InputGroup, { children: [_jsx(InputGroupInput, { placeholder: "Search\u2026" }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { type: "button", "aria-label": "Search", children: _jsx(Search, { className: "size-4" }) }) })] }) })),
|
|
19
19
|
};
|
|
20
20
|
export const WithKbd = {
|
|
21
21
|
render: () => (_jsx("div", { className: "w-80", children: _jsxs(InputGroup, { children: [_jsx(InputGroupInput, { placeholder: "Command\u2026" }), _jsxs(InputGroupAddon, { align: "inline-end", children: [_jsx(Kbd, { children: "\u2318" }), _jsx(Kbd, { children: "K" })] })] }) })),
|
|
@@ -25,5 +25,5 @@ export const Textarea = {
|
|
|
25
25
|
};
|
|
26
26
|
export const Gallery = {
|
|
27
27
|
parameters: { layout: 'padded' },
|
|
28
|
-
render: () => (_jsxs("div", { className: "flex max-w-md flex-col gap-8", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "URL prefix" }), _jsxs(InputGroup, { children: [_jsx(InputGroupAddon, { children: _jsx(InputGroupText, { children: "https://" }) }), _jsx(InputGroupInput, { placeholder: "yoursite.com" })] })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Trailing action" }), _jsxs(InputGroup, { children: [_jsx(InputGroupInput, { placeholder: "Search\u2026" }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { type: "button", "aria-label": "Search", children: _jsx(
|
|
28
|
+
render: () => (_jsxs("div", { className: "flex max-w-md flex-col gap-8", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "URL prefix" }), _jsxs(InputGroup, { children: [_jsx(InputGroupAddon, { children: _jsx(InputGroupText, { children: "https://" }) }), _jsx(InputGroupInput, { placeholder: "yoursite.com" })] })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Trailing action" }), _jsxs(InputGroup, { children: [_jsx(InputGroupInput, { placeholder: "Search\u2026" }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { type: "button", "aria-label": "Search", children: _jsx(Search, { className: "size-4" }) }) })] })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Multiline" }), _jsxs(InputGroup, { children: [_jsx(InputGroupAddon, { align: "block-start", children: _jsx(InputGroupText, { children: "Comment" }) }), _jsx(InputGroupTextarea, { rows: 3, placeholder: "Write here\u2026" })] })] })] })),
|
|
29
29
|
};
|
|
@@ -8,7 +8,7 @@ export type ItemGroupProps = React.ComponentProps<'div'>;
|
|
|
8
8
|
export type ItemSeparatorProps = React.ComponentProps<typeof Separator>;
|
|
9
9
|
declare const itemVariants: (props?: ({
|
|
10
10
|
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
11
|
-
size?: "default" | "
|
|
11
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
export declare const itemVariantKeys: readonly ["default", "outline", "muted"];
|
|
14
14
|
export declare const itemSizeKeys: readonly ["default", "sm", "xs"];
|
|
@@ -17,7 +17,7 @@ export declare const itemSizeKeys: readonly ["default", "sm", "xs"];
|
|
|
17
17
|
*/
|
|
18
18
|
export type ItemProps = useRender.ComponentProps<'div'> & VariantProps<typeof itemVariants>;
|
|
19
19
|
declare const itemMediaVariants: (props?: ({
|
|
20
|
-
variant?: "
|
|
20
|
+
variant?: "default" | "image" | "icon" | null | undefined;
|
|
21
21
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
22
|
export declare const itemMediaVariantKeys: readonly ["default", "icon", "image"];
|
|
23
23
|
/** Props for `ItemMedia`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.stories.d.ts","sourceRoot":"","sources":["../../../src/components/item/item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"item.stories.d.ts","sourceRoot":"","sources":["../../../src/components/item/item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EACH,IAAI,EAaP,MAAM,GAAG,CAAC;AAEX,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;CAgBmB,CAAC;AAE9B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAiBrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KA2FrB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { UserIcon } from '@phosphor-icons/react/User';
|
|
2
|
+
import { Bell, User } from 'lucide-react';
|
|
4
3
|
import { Button } from '../button';
|
|
5
4
|
import { Switch } from '../switch';
|
|
6
5
|
import { Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, itemMediaVariantKeys, ItemSeparator, itemSizeKeys, ItemTitle, itemVariantKeys, } from '.';
|
|
@@ -23,19 +22,19 @@ const meta = {
|
|
|
23
22
|
};
|
|
24
23
|
export default meta;
|
|
25
24
|
export const Default = {
|
|
26
|
-
render: (args) => (_jsx("div", { className: "w-full max-w-md", children: _jsxs(Item, { ...args, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(
|
|
25
|
+
render: (args) => (_jsx("div", { className: "w-full max-w-md", children: _jsxs(Item, { ...args, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(Bell, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: "Notifications" }), _jsx(ItemDescription, { children: "Email, push, and in-app alerts." })] }), _jsx(ItemActions, { children: _jsx(Switch, { "aria-label": "Enable notifications", defaultChecked: true }) })] }) })),
|
|
27
26
|
};
|
|
28
27
|
export const Outline = {
|
|
29
28
|
args: { variant: 'outline' },
|
|
30
|
-
render: (args) => (_jsx("div", { className: "w-full max-w-md", children: _jsxs(Item, { ...args, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(
|
|
29
|
+
render: (args) => (_jsx("div", { className: "w-full max-w-md", children: _jsxs(Item, { ...args, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(User, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: "Profile" }), _jsx(ItemDescription, { children: "Manage your public name and avatar." })] }), _jsx(ItemActions, { children: _jsx(Button, { size: "sm", variant: "outline", children: "Edit" }) })] }) })),
|
|
31
30
|
};
|
|
32
31
|
export const AsLink = {
|
|
33
32
|
render: () => (_jsx("div", { className: "w-full max-w-md", children: _jsxs(Item, { render:
|
|
34
33
|
// Children are merged from `Item` by useRender; ESLint cannot see them on this JSX node.
|
|
35
34
|
// eslint-disable-next-line jsx-a11y/anchor-has-content -- runtime children from Item
|
|
36
|
-
_jsx("a", { href: "https://example.org", className: "cursor-pointer", rel: "noreferrer", target: "_blank" }), children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(
|
|
35
|
+
_jsx("a", { href: "https://example.org", className: "cursor-pointer", rel: "noreferrer", target: "_blank" }), children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(Bell, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: "Open settings" }), _jsxs(ItemDescription, { children: ["Entire row is a link when using ", _jsx("code", { className: "rounded bg-muted px-1", children: "render" }), "."] })] })] }) })),
|
|
37
36
|
};
|
|
38
37
|
export const Gallery = {
|
|
39
38
|
parameters: { layout: 'padded' },
|
|
40
|
-
render: () => (_jsxs("div", { className: "flex max-w-lg flex-col gap-10", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Variants" }), _jsx(ItemGroup, { children: itemVariantKeys.map((variant) => (_jsxs(Item, { variant: variant, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(
|
|
39
|
+
render: () => (_jsxs("div", { className: "flex max-w-lg flex-col gap-10", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Variants" }), _jsx(ItemGroup, { children: itemVariantKeys.map((variant) => (_jsxs(Item, { variant: variant, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(Bell, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { className: "capitalize", children: variant }), _jsx(ItemDescription, { children: "Variant preset for list rows." })] })] }, variant))) })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Sizes" }), _jsx(ItemGroup, { children: itemSizeKeys.map((size) => (_jsxs(Item, { size: size, children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(User, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { className: "capitalize", children: size }), _jsx(ItemDescription, { children: "Spacing for dense menus or roomy panels." })] })] }, size))) })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "With header & footer" }), _jsxs(Item, { variant: "outline", children: [_jsxs(ItemHeader, { children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase", children: "Section" }), _jsx(Button, { size: "xs", variant: "ghost", children: "More" })] }), _jsx(ItemMedia, { variant: "icon", children: _jsx(Bell, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: "Grouped layout" }), _jsx(ItemDescription, { children: "Header and footer span the full width of the item." })] }), _jsx(ItemFooter, { children: _jsx("span", { className: "text-xs text-muted-foreground", children: "Updated today" }) })] })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Media variants" }), _jsx("div", { className: "flex flex-col gap-2", children: itemMediaVariantKeys.map((mv) => (_jsxs(Item, { children: [_jsx(ItemMedia, { variant: mv, children: mv === 'image' ? _jsx("img", { src: "https://avatars.githubusercontent.com/u/1406596?v=4", alt: "" }) : mv === 'icon' ? _jsx(Bell, {}) : null }), _jsxs(ItemContent, { children: [_jsxs(ItemTitle, { className: "capitalize", children: [mv, " media"] }), _jsx(ItemDescription, { children: "Leading visual treatment." })] })] }, mv))) })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("p", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Separated list" }), _jsxs(ItemGroup, { children: [_jsx(Item, { size: "sm", children: _jsx(ItemContent, { children: _jsx(ItemTitle, { children: "First" }) }) }), _jsx(ItemSeparator, {}), _jsx(Item, { size: "sm", children: _jsx(ItemContent, { children: _jsx(ItemTitle, { children: "Second" }) }) })] })] })] })),
|
|
41
40
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Command } from 'lucide-react';
|
|
3
3
|
import { Kbd, KbdGroup } from '.';
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'UI/Kbd',
|
|
@@ -17,7 +17,7 @@ export const Chord = {
|
|
|
17
17
|
render: () => (_jsxs(KbdGroup, { children: [_jsx(Kbd, { children: "\u2318" }), _jsx(Kbd, { children: "K" })] })),
|
|
18
18
|
};
|
|
19
19
|
export const WithIcon = {
|
|
20
|
-
render: () => (_jsxs(KbdGroup, { children: [_jsx(Kbd, { "aria-label": "Command", children: _jsx(
|
|
20
|
+
render: () => (_jsxs(KbdGroup, { children: [_jsx(Kbd, { "aria-label": "Command", children: _jsx(Command, { className: "size-3", strokeWidth: 2.5 }) }), _jsx(Kbd, { children: "\u21E7" }), _jsx(Kbd, { children: "P" })] })),
|
|
21
21
|
};
|
|
22
22
|
export const Gallery = {
|
|
23
23
|
parameters: { layout: 'padded' },
|
|
@@ -4,7 +4,7 @@ import { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
|
4
4
|
import { Menubar as MenubarPrimitive } from '@base-ui/react/menubar';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from '../dropdown-menu';
|
|
7
|
-
import {
|
|
7
|
+
import { Check } from 'lucide-react';
|
|
8
8
|
function Menubar({ className, ...props }) {
|
|
9
9
|
return _jsx(MenubarPrimitive, { "data-slot": "menubar", className: cn('flex h-8 items-center gap-0.5 rounded-lg border p-[3px]', className), ...props });
|
|
10
10
|
}
|
|
@@ -27,13 +27,13 @@ function MenubarItem({ className, inset, variant = 'default', ...props }) {
|
|
|
27
27
|
return (_jsx(DropdownMenuItem, { "data-slot": "menubar-item", "data-inset": inset, "data-variant": variant, className: cn("group/menubar-item gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!", className), ...props }));
|
|
28
28
|
}
|
|
29
29
|
function MenubarCheckboxItem({ className, children, checked, inset, ...props }) {
|
|
30
|
-
return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "menubar-checkbox-item", "data-inset": inset, className: cn('relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', className), checked: checked, ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4", children: _jsx(MenuPrimitive.CheckboxItemIndicator, { children: _jsx(
|
|
30
|
+
return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "menubar-checkbox-item", "data-inset": inset, className: cn('relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', className), checked: checked, ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4", children: _jsx(MenuPrimitive.CheckboxItemIndicator, { children: _jsx(Check, {}) }) }), children] }));
|
|
31
31
|
}
|
|
32
32
|
function MenubarRadioGroup({ ...props }) {
|
|
33
33
|
return _jsx(DropdownMenuRadioGroup, { "data-slot": "menubar-radio-group", ...props });
|
|
34
34
|
}
|
|
35
35
|
function MenubarRadioItem({ className, children, inset, ...props }) {
|
|
36
|
-
return (_jsxs(MenuPrimitive.RadioItem, { "data-slot": "menubar-radio-item", "data-inset": inset, className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4", children: _jsx(MenuPrimitive.RadioItemIndicator, { children: _jsx(
|
|
36
|
+
return (_jsxs(MenuPrimitive.RadioItem, { "data-slot": "menubar-radio-item", "data-inset": inset, className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4", children: _jsx(MenuPrimitive.RadioItemIndicator, { children: _jsx(Check, {}) }) }), children] }));
|
|
37
37
|
}
|
|
38
38
|
function MenubarLabel({ className, inset, ...props }) {
|
|
39
39
|
return (_jsx(DropdownMenuLabel, { "data-slot": "menubar-label", "data-inset": inset, className: cn('px-1.5 py-1 text-sm font-medium data-inset:pl-7', className), ...props }));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronDown } from 'lucide-react';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
5
|
function NativeSelect({ className, size = 'default', ...props }) {
|
|
6
|
-
return (_jsxs("div", { className: cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className), "data-slot": "native-select-wrapper", "data-size": size, children: [_jsx("select", { "data-slot": "native-select", "data-size": size, className: "h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", ...props }), _jsx(
|
|
6
|
+
return (_jsxs("div", { className: cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className), "data-slot": "native-select-wrapper", "data-size": size, children: [_jsx("select", { "data-slot": "native-select", "data-size": size, className: "h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", ...props }), _jsx(ChevronDown, { className: "pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none", "aria-hidden": "true", "data-slot": "native-select-icon" })] }));
|
|
7
7
|
}
|
|
8
8
|
function NativeSelectOption({ className, ...props }) {
|
|
9
9
|
return _jsx("option", { "data-slot": "native-select-option", className: cn('bg-[Canvas] text-[CanvasText]', className), ...props });
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
|
-
import {
|
|
7
|
+
import { ChevronDown } from 'lucide-react';
|
|
8
8
|
function NavigationMenu({ align = 'start', className, children, ...props }) {
|
|
9
9
|
return (_jsxs(NavigationMenuPrimitive.Root, { "data-slot": "navigation-menu", className: cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className), ...props, children: [children, _jsx(NavigationMenuPositioner, { align: align })] }));
|
|
10
10
|
}
|
|
@@ -16,7 +16,7 @@ function NavigationMenuItem({ className, ...props }) {
|
|
|
16
16
|
}
|
|
17
17
|
const navigationMenuTriggerStyle = cva('group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted');
|
|
18
18
|
function NavigationMenuTrigger({ className, children, ...props }) {
|
|
19
|
-
return (_jsxs(NavigationMenuPrimitive.Trigger, { "data-slot": "navigation-menu-trigger", className: cn(navigationMenuTriggerStyle(), 'group', className), ...props, children: [children, ' ', _jsx(
|
|
19
|
+
return (_jsxs(NavigationMenuPrimitive.Trigger, { "data-slot": "navigation-menu-trigger", className: cn(navigationMenuTriggerStyle(), 'group', className), ...props, children: [children, ' ', _jsx(ChevronDown, { className: "relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180", "aria-hidden": "true" })] }));
|
|
20
20
|
}
|
|
21
21
|
function NavigationMenuContent({ className, ...props }) {
|
|
22
22
|
return (_jsx(NavigationMenuPrimitive.Content, { "data-slot": "navigation-menu-content", className: cn('data-ending-style:data-activation-direction=left:translate-x-[50%] data-ending-style:data-activation-direction=right:translate-x-[-50%] data-starting-style:data-activation-direction=left:translate-x-[-50%] data-starting-style:data-activation-direction=right:translate-x-[50%] h-full w-auto p-1 transition-[opacity,transform,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300 data-ending-style:opacity-0 data-starting-style:opacity-0 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95', className), ...props }));
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
import { Button } from '../button';
|
|
5
|
-
import {
|
|
5
|
+
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';
|
|
6
6
|
function Pagination({ className, ...props }) {
|
|
7
7
|
return _jsx("nav", { role: "navigation", "aria-label": "pagination", "data-slot": "pagination", className: cn('mx-auto flex w-full justify-center', className), ...props });
|
|
8
8
|
}
|
|
@@ -18,12 +18,12 @@ function PaginationLink({ className, isActive, size = 'icon', ...props }) {
|
|
|
18
18
|
_jsx("a", { "aria-current": isActive ? 'page' : undefined, "data-slot": "pagination-link", "data-active": isActive, ...props }) }));
|
|
19
19
|
}
|
|
20
20
|
function PaginationPrevious({ className, text = 'Previous', ...props }) {
|
|
21
|
-
return (_jsxs(PaginationLink, { "aria-label": "Go to previous page", size: "default", className: cn('pl-1.5!', className), ...props, children: [_jsx(
|
|
21
|
+
return (_jsxs(PaginationLink, { "aria-label": "Go to previous page", size: "default", className: cn('pl-1.5!', className), ...props, children: [_jsx(ChevronLeft, { "data-icon": "inline-start" }), _jsx("span", { className: "hidden sm:block", children: text })] }));
|
|
22
22
|
}
|
|
23
23
|
function PaginationNext({ className, text = 'Next', ...props }) {
|
|
24
|
-
return (_jsxs(PaginationLink, { "aria-label": "Go to next page", size: "default", className: cn('pr-1.5!', className), ...props, children: [_jsx("span", { className: "hidden sm:block", children: text }), _jsx(
|
|
24
|
+
return (_jsxs(PaginationLink, { "aria-label": "Go to next page", size: "default", className: cn('pr-1.5!', className), ...props, children: [_jsx("span", { className: "hidden sm:block", children: text }), _jsx(ChevronRight, { "data-icon": "inline-end" })] }));
|
|
25
25
|
}
|
|
26
26
|
function PaginationEllipsis({ className, ...props }) {
|
|
27
|
-
return (_jsxs("span", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn("flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx(
|
|
27
|
+
return (_jsxs("span", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn("flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx(MoreHorizontal, {}), _jsx("span", { className: "sr-only", children: "More pages" })] }));
|
|
28
28
|
}
|
|
29
29
|
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Select as SelectPrimitive } from '@base-ui/react/select';
|
|
5
|
-
import {
|
|
5
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
/**
|
|
8
8
|
* Root for a native-style select. Compose `SelectTrigger`, `SelectValue`, `SelectContent`,
|
|
@@ -21,7 +21,7 @@ function SelectValue({ className, ...props }) {
|
|
|
21
21
|
}
|
|
22
22
|
/** Button that opens the list popup; shows a chevron icon. */
|
|
23
23
|
function SelectTrigger({ className, size = 'default', children, ...props }) {
|
|
24
|
-
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none 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 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *: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-4", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(
|
|
24
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none 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 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *: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-4", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(ChevronDown, { className: "pointer-events-none size-4 text-muted-foreground" }) })] }));
|
|
25
25
|
}
|
|
26
26
|
/** Portal, positioner, and scrollable list surface for options. */
|
|
27
27
|
function SelectContent({ className, children, side = 'bottom', sideOffset = 4, align = 'center', alignOffset = 0, alignItemWithTrigger = true, ...props }) {
|
|
@@ -33,7 +33,7 @@ function SelectLabel({ className, ...props }) {
|
|
|
33
33
|
}
|
|
34
34
|
/** One selectable option; shows a check when selected. */
|
|
35
35
|
function SelectItem({ className, children, ...props }) {
|
|
36
|
-
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm 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-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className), ...props, children: [_jsx(SelectPrimitive.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children: children }), _jsx(SelectPrimitive.ItemIndicator, { render: _jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }), children: _jsx(
|
|
36
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm 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-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className), ...props, children: [_jsx(SelectPrimitive.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children: children }), _jsx(SelectPrimitive.ItemIndicator, { render: _jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }), children: _jsx(Check, { className: "pointer-events-none" }) })] }));
|
|
37
37
|
}
|
|
38
38
|
/** Horizontal rule between groups or items. */
|
|
39
39
|
function SelectSeparator({ className, ...props }) {
|
|
@@ -41,10 +41,10 @@ function SelectSeparator({ className, ...props }) {
|
|
|
41
41
|
}
|
|
42
42
|
/** Scroll affordance at the top of a long list (pointer/hover). */
|
|
43
43
|
function SelectScrollUpButton({ className, ...props }) {
|
|
44
|
-
return (_jsx(SelectPrimitive.ScrollUpArrow, { "data-slot": "select-scroll-up-button", className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: _jsx(
|
|
44
|
+
return (_jsx(SelectPrimitive.ScrollUpArrow, { "data-slot": "select-scroll-up-button", className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: _jsx(ChevronUp, {}) }));
|
|
45
45
|
}
|
|
46
46
|
/** Scroll affordance at the bottom of a long list (pointer/hover). */
|
|
47
47
|
function SelectScrollDownButton({ className, ...props }) {
|
|
48
|
-
return (_jsx(SelectPrimitive.ScrollDownArrow, { "data-slot": "select-scroll-down-button", className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: _jsx(
|
|
48
|
+
return (_jsx(SelectPrimitive.ScrollDownArrow, { "data-slot": "select-scroll-down-button", className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: _jsx(ChevronDown, {}) }));
|
|
49
49
|
}
|
|
50
50
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Dialog as SheetPrimitive } from '@base-ui/react/dialog';
|
|
5
|
-
import {
|
|
5
|
+
import { X } from 'lucide-react';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
import { Button } from '../button';
|
|
8
8
|
function Sheet({ ...props }) {
|
|
@@ -21,7 +21,7 @@ function SheetOverlay({ className, ...props }) {
|
|
|
21
21
|
return (_jsx(SheetPrimitive.Backdrop, { "data-slot": "sheet-overlay", className: cn('fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs', className), ...props }));
|
|
22
22
|
}
|
|
23
23
|
function SheetContent({ className, children, side = 'right', showCloseButton = true, ...props }) {
|
|
24
|
-
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Popup, { "data-slot": "sheet-content", "data-side": side, className: cn('fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm', className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { "data-slot": "sheet-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-3 right-3", size: "icon-sm" }), children: [_jsx(
|
|
24
|
+
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Popup, { "data-slot": "sheet-content", "data-side": side, className: cn('fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm', className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { "data-slot": "sheet-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-3 right-3", size: "icon-sm" }), children: [_jsx(X, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
25
25
|
}
|
|
26
26
|
function SheetHeader({ className, ...props }) {
|
|
27
27
|
return _jsx("div", { "data-slot": "sheet-header", className: cn('flex flex-col gap-0.5 p-4', className), ...props });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ToasterProps } from 'sonner';
|
|
2
2
|
/**
|
|
3
|
-
* Opinionated [Sonner](https://sonner.emilkowal.ski/) toaster: Wheelhouse popover tokens,
|
|
3
|
+
* Opinionated [Sonner](https://sonner.emilkowal.ski/) toaster: Wheelhouse popover tokens, Lucide icons,
|
|
4
4
|
* and `cn-toast` class for styling. Mount once near the app root.
|
|
5
5
|
*
|
|
6
6
|
* Defaults to **`theme="system"`** so light/dark follows the OS; in Next.js with `next-themes`, pass
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Toaster as Sonner } from 'sonner';
|
|
5
|
-
import {
|
|
5
|
+
import { AlertTriangle, CheckCircle, Info, Loader2, XCircle } from 'lucide-react';
|
|
6
6
|
/**
|
|
7
|
-
* Opinionated [Sonner](https://sonner.emilkowal.ski/) toaster: Wheelhouse popover tokens,
|
|
7
|
+
* Opinionated [Sonner](https://sonner.emilkowal.ski/) toaster: Wheelhouse popover tokens, Lucide icons,
|
|
8
8
|
* and `cn-toast` class for styling. Mount once near the app root.
|
|
9
9
|
*
|
|
10
10
|
* Defaults to **`theme="system"`** so light/dark follows the OS; in Next.js with `next-themes`, pass
|
|
@@ -13,11 +13,11 @@ import { CheckCircleIcon, InfoIcon, SpinnerIcon, WarningIcon, XCircleIcon } from
|
|
|
13
13
|
*/
|
|
14
14
|
function Toaster({ theme = 'system', ...props }) {
|
|
15
15
|
return (_jsx(Sonner, { theme: theme, className: "toaster group", icons: {
|
|
16
|
-
success: _jsx(
|
|
17
|
-
info: _jsx(
|
|
18
|
-
warning: _jsx(
|
|
19
|
-
error: _jsx(
|
|
20
|
-
loading: _jsx(
|
|
16
|
+
success: _jsx(CheckCircle, { className: "size-4" }),
|
|
17
|
+
info: _jsx(Info, { className: "size-4" }),
|
|
18
|
+
warning: _jsx(AlertTriangle, { className: "size-4" }),
|
|
19
|
+
error: _jsx(XCircle, { className: "size-4" }),
|
|
20
|
+
loading: _jsx(Loader2, { className: "size-4 animate-spin" }),
|
|
21
21
|
}, style: {
|
|
22
22
|
'--normal-bg': 'var(--popover)',
|
|
23
23
|
'--normal-text': 'var(--popover-foreground)',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/sortable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACzF,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Sortable, SortableItem, SortableItemHandle, SortableOverlay } from './sortable';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drag-and-drop sortable lists and grids built on [dnd-kit](https://dndkit.com/).
|
|
3
|
+
*
|
|
4
|
+
* Compose **`Sortable`** (root) with **`SortableItem`** rows and an optional **`SortableItemHandle`**
|
|
5
|
+
* for the drag affordance. The root renders a **`DragOverlay`** portal while dragging; use
|
|
6
|
+
* **`SortableOverlay`** only when you need a fully custom overlay.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
import { type ReactNode } from 'react';
|
|
12
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
13
|
+
import { type DragEndEvent, DragOverlay, type DragStartEvent, type Modifiers, type UniqueIdentifier } from '@dnd-kit/core';
|
|
14
|
+
/**
|
|
15
|
+
* Props for {@link Sortable}. `T` is your row model; stable string ids come from {@link SortableRootProps.getItemValue}.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T - Item type in the controlled `value` array.
|
|
18
|
+
*/
|
|
19
|
+
export interface SortableRootProps<T> extends Omit<useRender.ComponentProps<'div'>, 'onDragStart' | 'onDragEnd' | 'children'> {
|
|
20
|
+
/** Controlled list; order updates when items are reordered (unless {@link SortableRootProps.onMove} handles persistence). */
|
|
21
|
+
value: T[];
|
|
22
|
+
/** Called with the next array when the user drops an item in a new position. */
|
|
23
|
+
onValueChange: (value: T[]) => void;
|
|
24
|
+
/** Stable string id for each item; must match the corresponding {@link SortableItemProps.value}. */
|
|
25
|
+
getItemValue: (item: T) => string;
|
|
26
|
+
/** Typically a list of `SortableItem` elements (one per row). */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Optional full control on drop: receive indices and apply `value` yourself (e.g. server mutation).
|
|
30
|
+
* When omitted, the root calls `onValueChange` with an array moved via dnd-kit `arrayMove`.
|
|
31
|
+
*/
|
|
32
|
+
onMove?: (event: {
|
|
33
|
+
event: DragEndEvent;
|
|
34
|
+
activeIndex: number;
|
|
35
|
+
overIndex: number;
|
|
36
|
+
}) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Layout strategy for `@dnd-kit/sortable`: vertical list, horizontal/flow, or grid (both use rect sorting).
|
|
39
|
+
* @defaultValue vertical
|
|
40
|
+
*/
|
|
41
|
+
strategy?: 'horizontal' | 'vertical' | 'grid';
|
|
42
|
+
/** Passed through to `DndContext`; invoked when a drag starts. */
|
|
43
|
+
onDragStart?: (event: DragStartEvent) => void;
|
|
44
|
+
/** Passed through to `DndContext`; invoked when a drag ends (after reorder logic). */
|
|
45
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
46
|
+
/** Optional dnd-kit modifiers (e.g. `restrictToParentElement`) for both context and overlay. */
|
|
47
|
+
modifiers?: Modifiers;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Root for a sortable region. Wires `DndContext`, `SortableContext`, sensors, and a `DragOverlay` portal on the client.
|
|
51
|
+
*
|
|
52
|
+
* Renders the default element as a `div` with `data-slot="sortable"` (see Base UI `useRender` / `render` prop).
|
|
53
|
+
*/
|
|
54
|
+
declare function Sortable<T>({ value, onValueChange, getItemValue, className, render, onMove, strategy, onDragStart, onDragEnd, modifiers, children, ...props }: SortableRootProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Props for {@link SortableItem}. `value` is the sortable id (string) registered with dnd-kit.
|
|
57
|
+
*/
|
|
58
|
+
export interface SortableItemProps extends useRender.ComponentProps<'div'> {
|
|
59
|
+
/** Must match `getItemValue(item)` for that row and be unique among siblings. */
|
|
60
|
+
value: string;
|
|
61
|
+
/** When true, the item does not participate in dragging. */
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* One row in a sortable list. Provides `data-slot="sortable-item"` and sortable transforms unless rendered inside a drag overlay clone.
|
|
66
|
+
*/
|
|
67
|
+
declare function SortableItem({ value, className, render, disabled, ...props }: SortableItemProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* Props for {@link SortableItemHandle}. Spread `listeners` from context onto this node (handled internally).
|
|
70
|
+
*/
|
|
71
|
+
export interface SortableItemHandleProps extends useRender.ComponentProps<'div'> {
|
|
72
|
+
/** When true (default), applies grab/grabbing cursor classes while dragging. */
|
|
73
|
+
cursor?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Drag handle for a `SortableItem`. Must be nested under `SortableItem` so listeners and drag state apply.
|
|
77
|
+
*/
|
|
78
|
+
declare function SortableItemHandle({ className, render, cursor, ...props }: SortableItemHandleProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
79
|
+
/**
|
|
80
|
+
* Props for {@link SortableOverlay}. Extends dnd-kit `DragOverlay` except `children`, which may be a render function receiving the active id.
|
|
81
|
+
*/
|
|
82
|
+
export interface SortableOverlayProps extends Omit<React.ComponentProps<typeof DragOverlay>, 'children'> {
|
|
83
|
+
/** Static node or function `({ value }) => …` for custom overlay content tied to the active item id. */
|
|
84
|
+
children?: ReactNode | ((params: {
|
|
85
|
+
value: UniqueIdentifier;
|
|
86
|
+
}) => ReactNode);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Alternate overlay entry: renders `DragOverlay` in a portal with shared modifiers/animation from `Sortable` context.
|
|
90
|
+
* Prefer the built-in overlay on `Sortable` unless you need this API.
|
|
91
|
+
*/
|
|
92
|
+
declare function SortableOverlay({ children, className, ...props }: SortableOverlayProps): React.ReactPortal | null;
|
|
93
|
+
export { Sortable, SortableItem, SortableItemHandle, SortableOverlay };
|
|
94
|
+
//# sourceMappingURL=sortable.d.ts.map
|