@uselets/ui 1.7.2 → 1.9.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/README.md +10 -3
- package/dist/{chart-DHS2QeM8.d.ts → chart-lqgodZYQ.d.ts} +11 -7
- package/dist/cli/uselets.mjs.map +1 -1
- package/dist/components/accordion.d.ts +5 -5
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +13 -13
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +5 -5
- package/dist/components/alert.js +1 -1
- package/dist/components/alert.js.map +1 -1
- package/dist/components/anchor.d.ts +2 -2
- package/dist/components/anchor.js +1 -1
- package/dist/components/anchor.js.map +1 -1
- package/dist/components/area-chart.d.ts +7 -3
- package/dist/components/area-chart.js +1 -1
- package/dist/components/area-chart.js.map +1 -1
- package/dist/components/avatar.d.ts +7 -7
- package/dist/components/avatar.js +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +3 -3
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/bar-chart.d.ts +7 -3
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/bar-chart.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.d.ts +4 -4
- package/dist/components/button-group.js +1 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.d.ts +3 -3
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.d.ts +9 -9
- package/dist/components/card.js +1 -1
- package/dist/components/card.js.map +1 -1
- package/dist/components/carousel.d.ts +7 -7
- package/dist/components/carousel.js +1 -1
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/carousel.spec.js +1 -1
- package/dist/components/carousel.spec.js.map +1 -1
- package/dist/components/center.d.ts +2 -2
- package/dist/components/center.js +1 -1
- package/dist/components/center.js.map +1 -1
- package/dist/components/chart.d.ts +2 -2
- package/dist/components/chart.js +2 -2
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code.d.ts +2 -2
- package/dist/components/code.js +1 -1
- package/dist/components/code.js.map +1 -1
- package/dist/components/collapsible.d.ts +4 -4
- package/dist/components/collapsible.js +1 -1
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.d.ts +16 -16
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +10 -10
- package/dist/components/command.js +1 -1
- package/dist/components/command.js.map +1 -1
- package/dist/components/container.d.ts +2 -2
- package/dist/components/container.js +1 -1
- package/dist/components/container.js.map +1 -1
- package/dist/components/data-table.d.ts +9 -9
- package/dist/components/data-table.js +1 -1
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +12 -12
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog.d.ts +12 -12
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/donut-chart.d.ts +2 -2
- package/dist/components/donut-chart.js +1 -1
- package/dist/components/donut-chart.js.map +1 -1
- package/dist/components/drawer.d.ts +14 -12
- package/dist/components/drawer.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +16 -16
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropzone.d.ts +2 -2
- package/dist/components/dropzone.js +1 -1
- package/dist/components/dropzone.js.map +1 -1
- package/dist/components/empty.d.ts +7 -7
- package/dist/components/empty.js +1 -1
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.d.ts +11 -11
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/field.spec.js +1 -1
- package/dist/components/field.spec.js.map +1 -1
- package/dist/components/flex.d.ts +2 -2
- package/dist/components/flex.js +1 -1
- package/dist/components/flex.js.map +1 -1
- package/dist/components/grid.d.ts +3 -3
- package/dist/components/grid.js +1 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/group.d.ts +2 -2
- package/dist/components/group.js +1 -1
- package/dist/components/group.js.map +1 -1
- package/dist/components/heading.d.ts +2 -2
- package/dist/components/heading.js +1 -1
- package/dist/components/heading.js.map +1 -1
- package/dist/components/hover-card.d.ts +4 -4
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-group.d.ts +7 -7
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.d.ts +5 -5
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +1 -1
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/list.d.ts +4 -4
- package/dist/components/list.js +1 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/mask-input.d.ts +2 -2
- package/dist/components/mask-input.js +1 -1
- package/dist/components/mask-input.js.map +1 -1
- package/dist/components/native-select.d.ts +4 -4
- package/dist/components/native-select.js +1 -1
- package/dist/components/native-select.js.map +1 -1
- package/dist/components/navigation-menu.d.ts +9 -9
- package/dist/components/navigation-menu.js +1 -1
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/pagination.d.ts +8 -8
- package/dist/components/pagination.js +1 -1
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/pie-chart.d.ts +10 -4
- package/dist/components/pie-chart.js +1 -1
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +8 -8
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +3 -3
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/resizable.d.ts +4 -4
- package/dist/components/resizable.js +1 -1
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/scroll-area.d.ts +3 -3
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.d.ts +11 -11
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +2 -2
- package/dist/components/separator.js +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sidebar.d.ts +25 -25
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/simple-grid.d.ts +2 -2
- package/dist/components/simple-grid.js +1 -1
- package/dist/components/simple-grid.js.map +1 -1
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/skeleton.spec.js +1 -1
- package/dist/components/skeleton.spec.js.map +1 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/sonner.js +1 -1
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +1 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stack.d.ts +2 -2
- package/dist/components/stack.js +1 -1
- package/dist/components/stack.js.map +1 -1
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +10 -10
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +5 -5
- package/dist/components/tabs.js +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/text.d.ts +2 -2
- package/dist/components/text.js +1 -1
- package/dist/components/text.js.map +1 -1
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +1 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.d.ts +3 -3
- package/dist/components/theme.js +1 -1
- package/dist/components/theme.js.map +1 -1
- package/dist/components/timeline.d.ts +3 -3
- package/dist/components/timeline.js +1 -1
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toggle-group.d.ts +3 -3
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +1 -1
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +6 -6
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unstyled-button.d.ts +2 -2
- package/dist/components/unstyled-button.js +1 -1
- package/dist/components/unstyled-button.js.map +1 -1
- package/dist/components/visibility.d.ts +3 -3
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.js.map +1 -1
- package/dist/{dist-C35vdEt2.js → dist-B-hwiqYg.js} +13 -13
- package/dist/dist-B-hwiqYg.js.map +1 -0
- package/dist/hooks/use-breakpoint-value.d.ts +1 -1
- package/dist/hooks/use-breakpoint-value.js +1 -1
- package/dist/hooks/use-breakpoint-value.js.map +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.js +1 -1
- package/dist/hooks/use-breakpoint.js.map +1 -1
- package/dist/hooks/use-breakpoint.spec.js +1 -1
- package/dist/hooks/use-breakpoint.spec.js.map +1 -1
- package/dist/hooks/use-disclosure.d.ts +1 -1
- package/dist/hooks/use-disclosure.js +1 -1
- package/dist/hooks/use-disclosure.js.map +1 -1
- package/dist/hooks/use-disclosure.spec.js +1 -1
- package/dist/hooks/use-disclosure.spec.js.map +1 -1
- package/dist/hooks/use-document-visibility.d.ts +1 -1
- package/dist/hooks/use-document-visibility.js +1 -1
- package/dist/hooks/use-document-visibility.js.map +1 -1
- package/dist/hooks/use-document-visibility.spec.js +1 -1
- package/dist/hooks/use-document-visibility.spec.js.map +1 -1
- package/dist/hooks/use-idle.d.ts +1 -1
- package/dist/hooks/use-idle.js +1 -1
- package/dist/hooks/use-idle.js.map +1 -1
- package/dist/hooks/use-idle.spec.js +1 -1
- package/dist/hooks/use-idle.spec.js.map +1 -1
- package/dist/hooks/use-interval.d.ts +1 -1
- package/dist/hooks/use-interval.js +1 -1
- package/dist/hooks/use-interval.js.map +1 -1
- package/dist/hooks/use-interval.spec.js +1 -1
- package/dist/hooks/use-interval.spec.js.map +1 -1
- package/dist/hooks/use-local-storage.d.ts +1 -1
- package/dist/hooks/use-local-storage.js +1 -1
- package/dist/hooks/use-local-storage.js.map +1 -1
- package/dist/hooks/use-local-storage.spec.js +1 -1
- package/dist/hooks/use-local-storage.spec.js.map +1 -1
- package/dist/hooks/use-mask.d.ts +1 -1
- package/dist/hooks/use-mask.js +1 -1
- package/dist/hooks/use-mask.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/hooks/use-mobile.spec.js +1 -1
- package/dist/hooks/use-mobile.spec.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/lib/badge.d.ts +11 -11
- package/dist/lib/badge.js +1 -1
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/button.d.ts +11 -11
- package/dist/lib/button.js +1 -1
- package/dist/lib/button.js.map +1 -1
- package/dist/lib/color.d.ts +11 -11
- package/dist/lib/color.js +1 -1
- package/dist/lib/color.js.map +1 -1
- package/dist/lib/compose-refs.d.ts +1 -1
- package/dist/lib/compose-refs.js +1 -1
- package/dist/lib/compose-refs.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/{magic-string.es-C-uSEkg2.js → magic-string.es-DbBO8R0S.js} +2 -2
- package/dist/{magic-string.es-C-uSEkg2.js.map → magic-string.es-DbBO8R0S.js.map} +1 -1
- package/dist/{react.esm-BagSCtI3.js → react.esm-D88qr0ij.js} +12 -12
- package/dist/{react.esm-BagSCtI3.js.map → react.esm-D88qr0ij.js.map} +1 -1
- package/dist/skills/uselets-ui/references/component-catalog.md +8 -7
- package/dist/skills/uselets-ui/references/package-guide.md +7 -1
- package/dist/styles/gomax.css +16 -0
- package/dist/styles/max.css +16 -0
- package/dist/styles/theme.css +8 -0
- package/package.json +17 -14
- package/skills/uselets-ui/references/component-catalog.md +8 -7
- package/skills/uselets-ui/references/package-guide.md +7 -1
- package/dist/dist-C35vdEt2.js.map +0 -1
- /package/dist/{chunk-CHh1Zzun.js → rolldown-runtime-Bdj-bS2b.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Combobox as Combobox$1 } from "@base-ui/react";
|
|
4
4
|
|
|
@@ -31,17 +31,17 @@ type ComboboxChipsInputProps = Combobox$1.Input.Props;
|
|
|
31
31
|
declare const Combobox: typeof Combobox$1.Root;
|
|
32
32
|
declare function ComboboxValue({
|
|
33
33
|
...props
|
|
34
|
-
}: ComboboxValueProps):
|
|
34
|
+
}: ComboboxValueProps): React.JSX.Element;
|
|
35
35
|
declare function ComboboxTrigger({
|
|
36
36
|
className,
|
|
37
37
|
children,
|
|
38
38
|
icon,
|
|
39
39
|
...props
|
|
40
|
-
}: ComboboxTriggerProps):
|
|
40
|
+
}: ComboboxTriggerProps): React.JSX.Element;
|
|
41
41
|
declare function ComboboxClear({
|
|
42
42
|
className,
|
|
43
43
|
...props
|
|
44
|
-
}: ComboboxClearProps):
|
|
44
|
+
}: ComboboxClearProps): React.JSX.Element;
|
|
45
45
|
declare function ComboboxInput({
|
|
46
46
|
className,
|
|
47
47
|
children,
|
|
@@ -52,7 +52,7 @@ declare function ComboboxInput({
|
|
|
52
52
|
showClear,
|
|
53
53
|
triggerIcon,
|
|
54
54
|
...props
|
|
55
|
-
}: ComboboxInputProps):
|
|
55
|
+
}: ComboboxInputProps): React.JSX.Element;
|
|
56
56
|
declare function ComboboxContent({
|
|
57
57
|
className,
|
|
58
58
|
side,
|
|
@@ -62,50 +62,50 @@ declare function ComboboxContent({
|
|
|
62
62
|
anchor,
|
|
63
63
|
container,
|
|
64
64
|
...props
|
|
65
|
-
}: ComboboxContentProps):
|
|
65
|
+
}: ComboboxContentProps): React.JSX.Element;
|
|
66
66
|
declare function ComboboxList({
|
|
67
67
|
className,
|
|
68
68
|
...props
|
|
69
|
-
}: ComboboxListProps):
|
|
69
|
+
}: ComboboxListProps): React.JSX.Element;
|
|
70
70
|
declare function ComboboxItem({
|
|
71
71
|
className,
|
|
72
72
|
children,
|
|
73
73
|
...props
|
|
74
|
-
}: ComboboxItemProps):
|
|
74
|
+
}: ComboboxItemProps): React.JSX.Element;
|
|
75
75
|
declare function ComboboxGroup({
|
|
76
76
|
className,
|
|
77
77
|
...props
|
|
78
|
-
}: ComboboxGroupProps):
|
|
78
|
+
}: ComboboxGroupProps): React.JSX.Element;
|
|
79
79
|
declare function ComboboxLabel({
|
|
80
80
|
className,
|
|
81
81
|
...props
|
|
82
|
-
}: ComboboxLabelProps):
|
|
82
|
+
}: ComboboxLabelProps): React.JSX.Element;
|
|
83
83
|
declare function ComboboxCollection({
|
|
84
84
|
...props
|
|
85
|
-
}: ComboboxCollectionProps):
|
|
85
|
+
}: ComboboxCollectionProps): React.JSX.Element;
|
|
86
86
|
declare function ComboboxEmpty({
|
|
87
87
|
className,
|
|
88
88
|
...props
|
|
89
|
-
}: ComboboxEmptyProps):
|
|
89
|
+
}: ComboboxEmptyProps): React.JSX.Element;
|
|
90
90
|
declare function ComboboxSeparator({
|
|
91
91
|
className,
|
|
92
92
|
...props
|
|
93
|
-
}: ComboboxSeparatorProps):
|
|
93
|
+
}: ComboboxSeparatorProps): React.JSX.Element;
|
|
94
94
|
declare function ComboboxChips({
|
|
95
95
|
className,
|
|
96
96
|
...props
|
|
97
|
-
}: ComboboxChipsProps):
|
|
97
|
+
}: ComboboxChipsProps): React.JSX.Element;
|
|
98
98
|
declare function ComboboxChip({
|
|
99
99
|
className,
|
|
100
100
|
children,
|
|
101
101
|
showRemove,
|
|
102
102
|
...props
|
|
103
|
-
}: ComboboxChipProps):
|
|
103
|
+
}: ComboboxChipProps): React.JSX.Element;
|
|
104
104
|
declare function ComboboxChipsInput({
|
|
105
105
|
className,
|
|
106
106
|
id,
|
|
107
107
|
...props
|
|
108
|
-
}: ComboboxChipsInputProps):
|
|
108
|
+
}: ComboboxChipsInputProps): React.JSX.Element;
|
|
109
109
|
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { Combobox, ComboboxChip, ComboboxChipProps, ComboboxChips, ComboboxChipsInput, ComboboxChipsInputProps, ComboboxChipsProps, ComboboxClear, ComboboxClearProps, ComboboxCollection, ComboboxCollectionProps, ComboboxContent, ComboboxContentProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupProps, ComboboxInput, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxProps, ComboboxSeparator, ComboboxSeparatorProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps, useComboboxAnchor };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{useFieldControlId as n}from"./field.js";import{InputGroup as r,InputGroupAddon as i,InputGroupButton as a,InputGroupInput as o}from"./input-group.js";import{IconCheck as s,IconSelector as c,IconX as l}from"@tabler/icons-react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"react";import{Combobox as p}from"@base-ui/react";const m=p.Root;function ComboboxValue({...e}){return u(p.Value,{"data-slot":`combobox-value`,...e})}function ComboboxTrigger({className:t,children:n,icon:r=u(c,{className:`pointer-events-none size-4 text-muted-foreground`}),...i}){return d(p.Trigger,{"data-slot":`combobox-trigger`,className:e(`[&_svg:not([class*='size-'])]:size-4`,t),...i,children:[n,r]})}function ComboboxClear({className:t,...n}){return u(p.Clear,{"data-slot":`combobox-clear`,render:u(a,{variant:`ghost`,size:`icon-xs`}),className:e(t),...n,children:u(l,{className:`pointer-events-none`})})}function ComboboxInput({className:t,children:s,disabled:c=!1,icon:l,id:f,showTrigger:m=!0,showClear:h=!1,triggerIcon:g,..._}){let v=n(f);return d(r,{className:e(`w-auto`,t),children:[l&&u(i,{align:`inline-start`,children:l}),u(p.Input,{id:v,render:u(o,{disabled:c}),..._}),d(i,{align:`inline-end`,children:[m&&u(a,{size:`icon-xs`,variant:`ghost`,asChild:!0,"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:c,children:u(ComboboxTrigger,{icon:g})}),h&&u(ComboboxClear,{disabled:c})]}),s]})}function ComboboxContent({className:t,side:n=`bottom`,sideOffset:r=6,align:i=`start`,alignOffset:a=0,anchor:o,container:s,...c}){return u(p.Portal,{container:s,className:`absolute`,children:u(p.Positioner,{side:n,sideOffset:r,align:i,alignOffset:a,anchor:o,className:`isolate z-50`,children:u(p.Popup,{"data-slot":`combobox-content`,"data-chips":!!o,className:e(`group/combobox-content max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+(--spacing(7)))] origin-(--transform-origin) overflow-hidden rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,t),...c})})})}function ComboboxList({className:t,...n}){return u(p.List,{"data-slot":`combobox-list`,className:e(`no-scrollbar max-h-[min(calc(--spacing(72)-(--spacing(9))),calc(var(--available-height)-(--spacing(9))))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,t),...n})}function ComboboxItem({className:t,children:n,...r}){return d(p.Item,{"data-slot":`combobox-item`,className:e(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**: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`,t),...r,children:[n,u(p.ItemIndicator,{render:u(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:u(s,{className:`pointer-events-none`})})]})}function ComboboxGroup({className:t,...n}){return u(p.Group,{"data-slot":`combobox-group`,className:e(t),...n})}function ComboboxLabel({className:t,...n}){return u(p.GroupLabel,{"data-slot":`combobox-label`,className:e(`px-2 py-1.5 text-xs text-muted-foreground`,t),...n})}function ComboboxCollection({...e}){return u(p.Collection,{"data-slot":`combobox-collection`,...e})}function ComboboxEmpty({className:t,...n}){return u(p.Empty,{"data-slot":`combobox-empty`,className:e(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,t),...n})}function ComboboxSeparator({className:t,...n}){return u(p.Separator,{"data-slot":`combobox-separator`,className:e(`-mx-1 my-1 h-px bg-border`,t),...n})}function ComboboxChips({className:t,...n}){return u(p.Chips,{"data-slot":`combobox-chips`,className:e(`flex min-h-8 overflow-hidden flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40`,t),...n})}function ComboboxChip({className:n,children:r,showRemove:i=!0,...a}){return d(p.Chip,{"data-slot":`combobox-chip`,className:e(`flex h-[calc(--spacing(5.25))] w-fit text-left max-w-full items-center justify-start gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0`,n),...a,children:[u(`span`,{className:`flex-1 truncate`,children:r}),i&&u(p.ChipRemove,{render:u(t,{variant:`ghost`,color:`zinc`,size:`icon-xs`}),className:`-ml-1 opacity-50 shrink-0 hover:opacity-100`,"data-slot":`combobox-chip-remove`,children:u(l,{className:`pointer-events-none`})})]})}function ComboboxChipsInput({className:t,id:r,...i}){let a=n(r);return u(p.Input,{id:a,"data-slot":`combobox-chip-input`,className:e(`min-w-16 flex-1 outline-none`,t),...i})}function useComboboxAnchor(){return f.useRef(null)}export{m as Combobox,ComboboxChip,ComboboxChips,ComboboxChipsInput,ComboboxClear,ComboboxCollection,ComboboxContent,ComboboxEmpty,ComboboxGroup,ComboboxInput,ComboboxItem,ComboboxLabel,ComboboxList,ComboboxSeparator,ComboboxTrigger,ComboboxValue,useComboboxAnchor};
|
|
2
2
|
//# sourceMappingURL=combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport { IconCheck, IconSelector, IconX } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'\n\nexport type ComboboxProps = React.ComponentProps<typeof ComboboxPrimitive.Root>\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props\n\nexport type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props & {\n icon?: React.ReactNode\n}\n\nexport type ComboboxClearProps = ComboboxPrimitive.Clear.Props\n\nexport type ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n icon?: React.ReactNode\n triggerIcon?: React.ReactNode\n showTrigger?: boolean\n showClear?: boolean\n}\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'> &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\nexport type ComboboxListProps = ComboboxPrimitive.List.Props\n\nexport type ComboboxItemProps = ComboboxPrimitive.Item.Props\n\nexport type ComboboxGroupProps = ComboboxPrimitive.Group.Props\n\nexport type ComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\n\nexport type ComboboxEmptyProps = ComboboxPrimitive.Empty.Props\n\nexport type ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props\n\nexport type ComboboxChipsProps = React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props\n\nexport type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}\n\nexport type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxValueProps) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n icon = <IconSelector className=\"pointer-events-none size-4 text-muted-foreground\" />,\n ...props\n}: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n {icon}\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxClearProps) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={cn(className)}\n {...props}\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n icon,\n id,\n showTrigger = true,\n showClear = false,\n triggerIcon,\n ...props\n}: ComboboxInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <InputGroup className={cn('w-auto', className)}>\n {icon && <InputGroupAddon align=\"inline-start\">{icon}</InputGroupAddon>}\n <ComboboxPrimitive.Input id={fieldControlId} render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n <ComboboxTrigger icon={triggerIcon} />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n container,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPrimitive.Portal container={container} className=\"absolute\">\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n 'group/combobox-content max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+(--spacing(7)))] origin-(--transform-origin) overflow-hidden rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!',\n className\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)-(--spacing(9))),calc(var(--available-height)-(--spacing(9))))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**: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\",\n className\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />}\n >\n <IconCheck className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxGroupProps) {\n return <ComboboxPrimitive.Group data-slot=\"combobox-group\" className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({ className, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-h-8 overflow-hidden flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({ className, children, showRemove = true, ...props }: ComboboxChipProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n 'flex h-[calc(--spacing(5.25))] w-fit text-left max-w-full items-center justify-start gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0',\n className\n )}\n {...props}\n >\n <span className=\"flex-1 truncate\">{children}</span>\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" color=\"zinc\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 shrink-0 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, id, ...props }: ComboboxChipsInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <ComboboxPrimitive.Input\n id={fieldControlId}\n data-slot=\"combobox-chip-input\"\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxClear,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport { IconCheck, IconSelector, IconX } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'\n\nexport type ComboboxProps = React.ComponentProps<typeof ComboboxPrimitive.Root>\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props\n\nexport type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props & {\n icon?: React.ReactNode\n}\n\nexport type ComboboxClearProps = ComboboxPrimitive.Clear.Props\n\nexport type ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n icon?: React.ReactNode\n triggerIcon?: React.ReactNode\n showTrigger?: boolean\n showClear?: boolean\n}\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'> &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\nexport type ComboboxListProps = ComboboxPrimitive.List.Props\n\nexport type ComboboxItemProps = ComboboxPrimitive.Item.Props\n\nexport type ComboboxGroupProps = ComboboxPrimitive.Group.Props\n\nexport type ComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\n\nexport type ComboboxEmptyProps = ComboboxPrimitive.Empty.Props\n\nexport type ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props\n\nexport type ComboboxChipsProps = React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props\n\nexport type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}\n\nexport type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxValueProps) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n icon = <IconSelector className=\"pointer-events-none size-4 text-muted-foreground\" />,\n ...props\n}: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n {icon}\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxClearProps) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={cn(className)}\n {...props}\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n icon,\n id,\n showTrigger = true,\n showClear = false,\n triggerIcon,\n ...props\n}: ComboboxInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <InputGroup className={cn('w-auto', className)}>\n {icon && <InputGroupAddon align=\"inline-start\">{icon}</InputGroupAddon>}\n <ComboboxPrimitive.Input id={fieldControlId} render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n <ComboboxTrigger icon={triggerIcon} />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n container,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPrimitive.Portal container={container} className=\"absolute\">\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n 'group/combobox-content max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+(--spacing(7)))] origin-(--transform-origin) overflow-hidden rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!',\n className\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)-(--spacing(9))),calc(var(--available-height)-(--spacing(9))))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**: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\",\n className\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />}\n >\n <IconCheck className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxGroupProps) {\n return <ComboboxPrimitive.Group data-slot=\"combobox-group\" className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({ className, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-h-8 overflow-hidden flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({ className, children, showRemove = true, ...props }: ComboboxChipProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n 'flex h-[calc(--spacing(5.25))] w-fit text-left max-w-full items-center justify-start gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0',\n className\n )}\n {...props}\n >\n <span className=\"flex-1 truncate\">{children}</span>\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" color=\"zinc\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 shrink-0 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, id, ...props }: ComboboxChipsInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <ComboboxPrimitive.Input\n id={fieldControlId}\n data-slot=\"combobox-chip-input\"\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxClear,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { Dialog } from "./dialog.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Command as Command$1 } from "cmdk";
|
|
@@ -21,7 +21,7 @@ type CommandShortcutProps = React.ComponentProps<'span'>;
|
|
|
21
21
|
declare function Command({
|
|
22
22
|
className,
|
|
23
23
|
...props
|
|
24
|
-
}: CommandProps):
|
|
24
|
+
}: CommandProps): React.JSX.Element;
|
|
25
25
|
declare function CommandDialog({
|
|
26
26
|
title,
|
|
27
27
|
description,
|
|
@@ -29,37 +29,37 @@ declare function CommandDialog({
|
|
|
29
29
|
className,
|
|
30
30
|
showCloseButton,
|
|
31
31
|
...props
|
|
32
|
-
}: CommandDialogProps):
|
|
32
|
+
}: CommandDialogProps): React.JSX.Element;
|
|
33
33
|
declare function CommandInput({
|
|
34
34
|
className,
|
|
35
35
|
id,
|
|
36
36
|
...props
|
|
37
|
-
}: CommandInputProps):
|
|
37
|
+
}: CommandInputProps): React.JSX.Element;
|
|
38
38
|
declare function CommandList({
|
|
39
39
|
className,
|
|
40
40
|
...props
|
|
41
|
-
}: CommandListProps):
|
|
41
|
+
}: CommandListProps): React.JSX.Element;
|
|
42
42
|
declare function CommandEmpty({
|
|
43
43
|
className,
|
|
44
44
|
...props
|
|
45
|
-
}: CommandEmptyProps):
|
|
45
|
+
}: CommandEmptyProps): React.JSX.Element;
|
|
46
46
|
declare function CommandGroup({
|
|
47
47
|
className,
|
|
48
48
|
...props
|
|
49
|
-
}: CommandGroupProps):
|
|
49
|
+
}: CommandGroupProps): React.JSX.Element;
|
|
50
50
|
declare function CommandSeparator({
|
|
51
51
|
className,
|
|
52
52
|
...props
|
|
53
|
-
}: CommandSeparatorProps):
|
|
53
|
+
}: CommandSeparatorProps): React.JSX.Element;
|
|
54
54
|
declare function CommandItem({
|
|
55
55
|
className,
|
|
56
56
|
children,
|
|
57
57
|
...props
|
|
58
|
-
}: CommandItemProps):
|
|
58
|
+
}: CommandItemProps): React.JSX.Element;
|
|
59
59
|
declare function CommandShortcut({
|
|
60
60
|
className,
|
|
61
61
|
...props
|
|
62
|
-
}: CommandShortcutProps):
|
|
62
|
+
}: CommandShortcutProps): React.JSX.Element;
|
|
63
63
|
//#endregion
|
|
64
64
|
export { Command, CommandDialog, CommandDialogProps, CommandEmpty, CommandEmptyProps, CommandGroup, CommandGroupProps, CommandInput, CommandInputProps, CommandItem, CommandItemProps, CommandList, CommandListProps, CommandProps, CommandSeparator, CommandSeparatorProps, CommandShortcut, CommandShortcutProps };
|
|
65
65
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{useFieldControlId as t}from"./field.js";import{InputGroup as n,InputGroupAddon as r}from"./input-group.js";import{Dialog as i,DialogContent as a,DialogDescription as o,DialogHeader as s,DialogTitle as c}from"./dialog.js";import{IconCheck as l,IconSearch as u}from"@tabler/icons-react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{Command as p}from"cmdk";function Command({className:t,...n}){return d(p,{"data-slot":`command`,className:e(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,t),...n})}function CommandDialog({title:t=`Command Palette`,description:n=`Search for a command to run...`,children:r,className:l,showCloseButton:u=!1,...p}){return f(i,{...p,children:[f(s,{className:`sr-only`,children:[d(c,{children:t}),d(o,{children:n})]}),d(a,{className:e(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,l),showCloseButton:u,children:r})]})}function CommandInput({className:i,id:a,...o}){let s=t(a);return d(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:f(n,{className:e(`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none!`,`*:data-[slot=input-group-addon]:pl-2!`),children:[d(p.Input,{id:s,"data-slot":`command-input`,className:e(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,i),...o}),d(r,{children:d(u,{className:`size-4 shrink-0 opacity-50`})})]})})}function CommandList({className:t,...n}){return d(p.List,{"data-slot":`command-list`,className:e(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,t),...n})}function CommandEmpty({className:t,...n}){return d(p.Empty,{"data-slot":`command-empty`,className:e(`py-6 text-center text-sm`,t),...n})}function CommandGroup({className:t,...n}){return d(p.Group,{"data-slot":`command-group`,className:e(`overflow-hidden p-1 text-foreground`,`**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5`,`**:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium`,`**:[[cmdk-group-heading]]:text-muted-foreground`,t),...n})}function CommandSeparator({className:t,...n}){return d(p.Separator,{"data-slot":`command-separator`,className:e(`-mx-1 h-px bg-border`,t),...n})}function CommandItem({className:t,children:n,...r}){return f(p.Item,{"data-slot":`command-item`,className:e(`group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none`,`in-data-[slot=dialog-content]:rounded-lg!`,`data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,t),...r,children:[n,d(l,{className:e(`ml-auto opacity-0`,`group-has-data-[slot=command-shortcut]/command-item:hidden`,`group-data-[checked=true]/command-item:opacity-100`)})]})}function CommandShortcut({className:t,...n}){return d(`span`,{"data-slot":`command-shortcut`,className:e(`ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground`,t),...n})}export{Command,CommandDialog,CommandEmpty,CommandGroup,CommandInput,CommandItem,CommandList,CommandSeparator,CommandShortcut};
|
|
2
2
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":["CommandPrimitive"],"sources":["../../src/components/command.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconCheck, IconSearch } from '@tabler/icons-react'\nimport { Command as CommandPrimitive } from 'cmdk'\n\nimport { cn } from '../lib/utils'\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon } from './input-group'\n\nexport type CommandProps = React.ComponentProps<typeof CommandPrimitive>\n\nexport type CommandDialogProps = React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}\n\nexport type CommandInputProps = React.ComponentProps<typeof CommandPrimitive.Input>\n\nexport type CommandListProps = React.ComponentProps<typeof CommandPrimitive.List>\n\nexport type CommandEmptyProps = React.ComponentProps<typeof CommandPrimitive.Empty>\n\nexport type CommandGroupProps = React.ComponentProps<typeof CommandPrimitive.Group>\n\nexport type CommandSeparatorProps = React.ComponentProps<typeof CommandPrimitive.Separator>\n\nexport type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item>\n\nexport type CommandShortcutProps = React.ComponentProps<'span'>\n\nfunction Command({ className, ...props }: CommandProps) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n 'flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n className,\n showCloseButton = false,\n ...props\n}: CommandDialogProps) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({ className, id, ...props }: CommandInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup\n className={cn(\n 'h-8! rounded-lg! border-input/30 bg-input/30 shadow-none!',\n '*:data-[slot=input-group-addon]:pl-2!'\n )}\n >\n <CommandPrimitive.Input\n id={fieldControlId}\n data-slot=\"command-input\"\n className={cn('w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className)}\n {...props}\n />\n <InputGroupAddon>\n <IconSearch className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({ className, ...props }: CommandListProps) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn('no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({ className, ...props }: CommandEmptyProps) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn('py-6 text-center text-sm', className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({ className, ...props }: CommandGroupProps) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n 'overflow-hidden p-1 text-foreground',\n '**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5',\n '**:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',\n '**:[[cmdk-group-heading]]:text-muted-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({ className, ...props }: CommandSeparatorProps) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn('-mx-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({ className, children, ...props }: CommandItemProps) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n 'group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none',\n 'in-data-[slot=dialog-content]:rounded-lg!',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n 'data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <IconCheck\n className={cn(\n 'ml-auto opacity-0',\n 'group-has-data-[slot=command-shortcut]/command-item:hidden',\n 'group-data-[checked=true]/command-item:opacity-100'\n )}\n />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({ className, ...props }: CommandShortcutProps) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.js","names":["CommandPrimitive"],"sources":["../../src/components/command.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconCheck, IconSearch } from '@tabler/icons-react'\nimport { Command as CommandPrimitive } from 'cmdk'\n\nimport { cn } from '../lib/utils'\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon } from './input-group'\n\nexport type CommandProps = React.ComponentProps<typeof CommandPrimitive>\n\nexport type CommandDialogProps = React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}\n\nexport type CommandInputProps = React.ComponentProps<typeof CommandPrimitive.Input>\n\nexport type CommandListProps = React.ComponentProps<typeof CommandPrimitive.List>\n\nexport type CommandEmptyProps = React.ComponentProps<typeof CommandPrimitive.Empty>\n\nexport type CommandGroupProps = React.ComponentProps<typeof CommandPrimitive.Group>\n\nexport type CommandSeparatorProps = React.ComponentProps<typeof CommandPrimitive.Separator>\n\nexport type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item>\n\nexport type CommandShortcutProps = React.ComponentProps<'span'>\n\nfunction Command({ className, ...props }: CommandProps) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n 'flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n className,\n showCloseButton = false,\n ...props\n}: CommandDialogProps) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({ className, id, ...props }: CommandInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup\n className={cn(\n 'h-8! rounded-lg! border-input/30 bg-input/30 shadow-none!',\n '*:data-[slot=input-group-addon]:pl-2!'\n )}\n >\n <CommandPrimitive.Input\n id={fieldControlId}\n data-slot=\"command-input\"\n className={cn('w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className)}\n {...props}\n />\n <InputGroupAddon>\n <IconSearch className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({ className, ...props }: CommandListProps) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn('no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({ className, ...props }: CommandEmptyProps) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn('py-6 text-center text-sm', className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({ className, ...props }: CommandGroupProps) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n 'overflow-hidden p-1 text-foreground',\n '**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5',\n '**:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',\n '**:[[cmdk-group-heading]]:text-muted-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({ className, ...props }: CommandSeparatorProps) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn('-mx-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({ className, children, ...props }: CommandItemProps) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n 'group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none',\n 'in-data-[slot=dialog-content]:rounded-lg!',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n 'data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <IconCheck\n className={cn(\n 'ml-auto opacity-0',\n 'group-has-data-[slot=command-shortcut]/command-item:hidden',\n 'group-data-[checked=true]/command-item:opacity-100'\n )}\n />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({ className, ...props }: CommandShortcutProps) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut\n}\n"],"mappings":"kcAiCA,SAAS,QAAQ,CAAE,YAAW,GAAG,GAAuB,CACtD,OACE,EAACA,EAAD,CACE,YAAU,UACV,UAAW,EACT,6FACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,cAAc,CACrB,QAAQ,kBACR,cAAc,iCACd,WACA,YACA,kBAAkB,GAClB,GAAG,GACkB,CACrB,OACE,EAAC,EAAD,CAAQ,GAAI,WAAZ,CACE,EAAC,EAAD,CAAc,UAAU,mBAAxB,CACE,EAAC,EAAD,CAAA,SAAc,CAAmB,CAAA,EACjC,EAAC,EAAD,CAAA,SAAoB,CAA+B,CAAA,CACvC,IACd,EAAC,EAAD,CACE,UAAW,EAAG,wDAAyD,CAAS,EAC/D,kBAEhB,UACY,CAAA,CACT,GAEZ,CAEA,SAAS,aAAa,CAAE,YAAW,KAAI,GAAG,GAA4B,CACpE,IAAM,EAAiB,EAAkB,CAAE,EAE3C,OACE,EAAC,MAAD,CAAK,YAAU,wBAAwB,UAAU,oBAC/C,EAAC,EAAD,CACE,UAAW,EACT,4DACA,uCACF,WAJF,CAME,EAACA,EAAiB,MAAlB,CACE,GAAI,EACJ,YAAU,gBACV,UAAW,EAAG,gFAAiF,CAAS,EACxG,GAAI,CACL,CAAA,EACD,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAY,UAAU,4BAA8B,CAAA,CACrC,CAAA,CACP,GACT,CAAA,CAET,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAACA,EAAiB,KAAlB,CACE,YAAU,eACV,UAAW,EAAG,mFAAoF,CAAS,EAC3G,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAACA,EAAiB,MAAlB,CACE,YAAU,gBACV,UAAW,EAAG,2BAA4B,CAAS,EACnD,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAACA,EAAiB,MAAlB,CACE,YAAU,gBACV,UAAW,EACT,sCACA,kEACA,0EACA,kDACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,iBAAiB,CAAE,YAAW,GAAG,GAAgC,CACxE,OACE,EAACA,EAAiB,UAAlB,CACE,YAAU,oBACV,UAAW,EAAG,uBAAwB,CAAS,EAC/C,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,WAAU,GAAG,GAA2B,CACxE,OACE,EAACA,EAAiB,KAAlB,CACE,YAAU,eACV,UAAW,EACT,+HACA,4CACA,2EACA,6FACA,oFACA,CACF,EACA,GAAI,WAVN,CAYG,EACD,EAAC,EAAD,CACE,UAAW,EACT,oBACA,6DACA,oDACF,CACD,CAAA,CACoB,GAE3B,CAEA,SAAS,gBAAgB,CAAE,YAAW,GAAG,GAA+B,CACtE,OACE,EAAC,OAAD,CACE,YAAU,mBACV,UAAW,EACT,yGACA,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ declare function Container({
|
|
|
11
11
|
className,
|
|
12
12
|
size,
|
|
13
13
|
...props
|
|
14
|
-
}: ContainerProps):
|
|
14
|
+
}: ContainerProps): React.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { Container, ContainerProps, containerVariants };
|
|
17
17
|
//# sourceMappingURL=container.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(`mx-auto w-full`,{variants:{size:{sm:`max-w-3xl px-4 sm:px-6`,md:`max-w-5xl px-4 sm:px-6 lg:px-8`,lg:`max-w-7xl px-4 sm:px-6 lg:px-8`,full:`max-w-none px-4 sm:px-6 lg:px-8`}},defaultVariants:{size:`lg`}});function Container({className:n,size:i=`lg`,...a}){return t(`div`,{"data-slot":`container`,"data-size":i,className:e(r({size:i}),n),...a})}export{Container,r as containerVariants};
|
|
2
2
|
//# sourceMappingURL=container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","names":[],"sources":["../../src/components/container.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst containerVariants = cva('mx-auto w-full', {\n variants: {\n size: {\n sm: 'max-w-3xl px-4 sm:px-6',\n md: 'max-w-5xl px-4 sm:px-6 lg:px-8',\n lg: 'max-w-7xl px-4 sm:px-6 lg:px-8',\n full: 'max-w-none px-4 sm:px-6 lg:px-8'\n }\n },\n defaultVariants: {\n size: 'lg'\n }\n})\n\nexport type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>\n\nfunction Container({ className, size = 'lg', ...props }: ContainerProps) {\n return (\n <div data-slot=\"container\" data-size={size} className={cn(containerVariants({ size }), className)} {...props} />\n )\n}\n\nexport { Container, containerVariants }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"container.js","names":[],"sources":["../../src/components/container.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst containerVariants = cva('mx-auto w-full', {\n variants: {\n size: {\n sm: 'max-w-3xl px-4 sm:px-6',\n md: 'max-w-5xl px-4 sm:px-6 lg:px-8',\n lg: 'max-w-7xl px-4 sm:px-6 lg:px-8',\n full: 'max-w-none px-4 sm:px-6 lg:px-8'\n }\n },\n defaultVariants: {\n size: 'lg'\n }\n})\n\nexport type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>\n\nfunction Container({ className, size = 'lg', ...props }: ContainerProps) {\n return (\n <div data-slot=\"container\" data-size={size} className={cn(containerVariants({ size }), className)} {...props} />\n )\n}\n\nexport { Container, containerVariants }\n"],"mappings":"oKAMA,MAAM,EAAoB,EAAI,iBAAkB,CAC9C,SAAU,CACR,KAAM,CACJ,GAAI,yBACJ,GAAI,iCACJ,GAAI,iCACJ,KAAM,iCACR,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EAID,SAAS,UAAU,CAAE,YAAW,OAAO,KAAM,GAAG,GAAyB,CACvE,OACE,EAAC,MAAD,CAAK,YAAU,YAAY,YAAW,EAAM,UAAW,EAAG,EAAkB,CAAE,MAAK,CAAC,EAAG,CAAS,EAAG,GAAI,CAAQ,CAAA,CAEnH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { TableProps } from "./table.js";
|
|
4
4
|
import * as React from "react";
|
|
@@ -105,40 +105,40 @@ declare function useDataTable<TData extends RowData$1, TValue = unknown>({
|
|
|
105
105
|
enablePagination,
|
|
106
106
|
labels
|
|
107
107
|
}: UseDataTableOptions<TData, TValue>): Table<TData>;
|
|
108
|
-
declare function DataTableRoot<TData extends RowData$1, TValue = unknown>(props: DataTableRootProps<TData, TValue>):
|
|
108
|
+
declare function DataTableRoot<TData extends RowData$1, TValue = unknown>(props: DataTableRootProps<TData, TValue>): React.JSX.Element;
|
|
109
109
|
declare function DataTableColumnHeader<TData extends RowData$1, TValue>({
|
|
110
110
|
column,
|
|
111
111
|
title,
|
|
112
112
|
className,
|
|
113
113
|
...props
|
|
114
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
114
|
+
}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element;
|
|
115
115
|
declare function DataTableViewOptions<TData extends RowData$1>({
|
|
116
116
|
table: tableProp,
|
|
117
117
|
label,
|
|
118
118
|
className,
|
|
119
119
|
...props
|
|
120
|
-
}: DataTableViewOptionsProps<TData>):
|
|
120
|
+
}: DataTableViewOptionsProps<TData>): React.JSX.Element | null;
|
|
121
121
|
declare function DataTableToolbar<TData extends RowData$1>({
|
|
122
122
|
filterColumns,
|
|
123
123
|
showColumnVisibility,
|
|
124
124
|
toolbarActions,
|
|
125
125
|
labels: labelsOverride,
|
|
126
126
|
className
|
|
127
|
-
}: DataTableToolbarProps<TData>):
|
|
127
|
+
}: DataTableToolbarProps<TData>): React.JSX.Element | null;
|
|
128
128
|
declare function DataTableHeader<TData extends RowData$1>({
|
|
129
129
|
className
|
|
130
|
-
}?: DataTableHeaderProps):
|
|
130
|
+
}?: DataTableHeaderProps): React.JSX.Element;
|
|
131
131
|
declare function DataTableBody<TData extends RowData$1>({
|
|
132
132
|
emptyMessage,
|
|
133
133
|
className
|
|
134
|
-
}?: DataTableBodyProps):
|
|
134
|
+
}?: DataTableBodyProps): React.JSX.Element;
|
|
135
135
|
declare function DataTablePagination<TData extends RowData$1>({
|
|
136
136
|
table: tableProp,
|
|
137
137
|
pageSizeOptions,
|
|
138
138
|
labels: labelsOverride,
|
|
139
139
|
className,
|
|
140
140
|
...props
|
|
141
|
-
}: DataTablePaginationProps<TData>):
|
|
141
|
+
}: DataTablePaginationProps<TData>): React.JSX.Element;
|
|
142
142
|
declare function createDataTableSelectColumn<TData extends RowData$1>(options?: {
|
|
143
143
|
labels?: Pick<Partial<DataTableLabels>, 'selectAllRows' | 'selectRow'>;
|
|
144
144
|
}): ColumnDef$1<TData>;
|
|
@@ -158,7 +158,7 @@ declare function DataTable<TData extends RowData$1, TValue = unknown>({
|
|
|
158
158
|
className,
|
|
159
159
|
tableClassName,
|
|
160
160
|
variant
|
|
161
|
-
}: DataTableProps<TData, TValue>):
|
|
161
|
+
}: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
162
162
|
//#endregion
|
|
163
163
|
export { type Column, type ColumnDef, DataTable, DataTableBody, DataTableBodyProps, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableHeader, DataTableHeaderProps, DataTableLabels, DataTablePagination, DataTablePaginationProps, DataTableProps, DataTableRoot, DataTableRootProps, DataTableToolbar, DataTableToolbarProps, DataTableViewOptions, DataTableViewOptionsProps, type RowData, type TanStackTable, UseDataTableOptions, createDataTableSelectColumn, defaultDataTableLabels, useDataTable, useDataTableContext };
|
|
164
164
|
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{Checkbox as n}from"./checkbox.js";import{Input as r}from"./input.js";import{InputGroup as i,InputGroupAddon as a,InputGroupInput as o}from"./input-group.js";import{DropdownMenu as s,DropdownMenuCheckboxItem as c,DropdownMenuContent as l,DropdownMenuGroup as u,DropdownMenuTrigger as d}from"./dropdown-menu.js";import{Select as f,SelectContent as p,SelectGroup as m,SelectItem as h,SelectTrigger as g,SelectValue as _}from"./select.js";import{Table as v,TableBody as y,TableCell as b,TableContainer as x,TableHead as S,TableHeader as C,TableRow as w}from"./table.js";import{IconArrowsSort as T,IconChevronLeft as E,IconChevronRight as D,IconChevronsLeft as O,IconChevronsRight as k,IconColumns3 as A,IconSortAscending as j,IconSortDescending as M}from"@tabler/icons-react";import{jsx as N,jsxs as P}from"react/jsx-runtime";import*as F from"react";import{flexRender as I,getCoreRowModel as L,getFilteredRowModel as R,getPaginationRowModel as z,getSortedRowModel as B,useReactTable as V}from"@tanstack/react-table";const H={filterPlaceholder:`Filtrar linhas...`,filterColumnSelectorLabel:`Coluna para filtrar`,emptyMessage:`Nenhum resultado.`,columnsButton:`Colunas`,rowsPerPage:`Linhas por página`,pageOf:(e,t)=>`Página ${e} de ${t}`,goToFirstPage:`Ir para a primeira página`,goToPreviousPage:`Ir para a página anterior`,goToNextPage:`Ir para a próxima página`,goToLastPage:`Ir para a última página`,selectAllRows:`Selecionar todas as linhas`,selectRow:`Selecionar linha`},U=F.createContext(null);function useDataTableContext(){let e=F.useContext(U);if(!e)throw Error(`useDataTableContext must be used within <DataTableRoot>`);return e}function useOptionalDataTableContext(){return F.useContext(U)}function renderToolbarActions(e,t){return typeof e==`function`?e(t):e}function getColumnLabel(e){return e?e.columnDef.meta?.label??e.id:``}function useDataTable({columns:e,data:t,getRowId:n,pageSize:r=10,enableRowSelection:i=!1,enableSorting:a=!1,enablePagination:o=!1,labels:s}){let[c,l]=F.useState([]),[u,d]=F.useState([]),[f,p]=F.useState({}),[m,h]=F.useState({pageIndex:0,pageSize:r}),[g,_]=F.useState({}),v=F.useMemo(()=>({...H,...s}),[s]);return V({data:t,columns:F.useMemo(()=>!i||e.some(e=>e.id===`select`)?e:[createDataTableSelectColumn({labels:{selectAllRows:v.selectAllRows,selectRow:v.selectRow}}),...e],[e,i,v.selectAllRows,v.selectRow]),getRowId:n,enableRowSelection:i,enableSorting:a,state:{sorting:c,columnFilters:u,columnVisibility:f,rowSelection:g,pagination:m},onSortingChange:l,onColumnFiltersChange:d,onColumnVisibilityChange:p,onPaginationChange:h,onRowSelectionChange:_,getCoreRowModel:L(),getFilteredRowModel:R(),getPaginationRowModel:o?z():void 0,getSortedRowModel:a?B():void 0})}function DataTableRootControlled({table:t,labels:n,className:r,children:i}){let a={table:t,labels:F.useMemo(()=>({...H,...n}),[n])};return N(U.Provider,{value:a,children:N(`div`,{className:e(`flex w-full flex-col gap-4`,r),children:i})})}function DataTableRootUncontrolled({columns:e,data:t,getRowId:n,pageSize:r,enableRowSelection:i,enableSorting:a,enablePagination:o,labels:s,className:c,children:l}){return N(DataTableRootControlled,{table:useDataTable({columns:e,data:t,getRowId:n,pageSize:r,enableRowSelection:i,enableSorting:a,enablePagination:o,labels:s}),labels:s,className:c,children:l})}function DataTableRoot(e){if(`table`in e&&e.table!==void 0){let{table:t,labels:n,className:r,children:i}=e;return N(DataTableRootControlled,{table:t,labels:n,className:r,children:i})}let{columns:t,data:n,getRowId:r,pageSize:i,enableRowSelection:a,enableSorting:o,enablePagination:s,labels:c,className:l,children:u}=e;return N(DataTableRootUncontrolled,{columns:t,data:n,getRowId:r,pageSize:i,enableRowSelection:a,enableSorting:o,enablePagination:s,labels:c,className:l,children:u})}function DataTableColumnHeader({column:n,title:r,className:i,...a}){if(!n.getCanSort())return N(`div`,{className:e(`inline-flex items-center gap-1`,i),...a,children:r});let o=n.getIsSorted();return P(`div`,{className:e(`inline-flex items-center gap-1`,i),...a,children:[r,N(t,{variant:`ghost`,color:`zinc`,size:`icon-xs`,onClick:()=>{if(o===`desc`)return n.clearSorting();n.toggleSorting(o===`asc`)},children:N(o===`desc`?M:o===`asc`?j:T,{className:`size-4`,"data-icon":`inline-end`})})]})}function DataTableViewOptions({table:n,label:r,className:i,...a}){let o=useOptionalDataTableContext(),f=n??o?.table;if(!f)throw Error("DataTableViewOptions requires a `table` prop or to be rendered within <DataTableRoot>");let p=r??o?.labels.columnsButton??H.columnsButton,m=f.getAllColumns().filter(e=>e.accessorFn!==void 0&&e.getCanHide());return m.length===0?null:P(s,{children:[N(d,{asChild:!0,children:P(t,{type:`button`,variant:`outline`,color:`zinc`,size:`sm`,className:e(`ml-auto`,i),...a,children:[N(A,{"data-icon":`inline-start`}),p]})}),N(l,{align:`end`,className:`w-44`,children:N(u,{children:m.map(e=>N(c,{checked:e.getIsVisible(),onCheckedChange:t=>e.toggleVisibility(!!t),children:e.id},e.id))})})]})}function DataTableToolbar({filterColumns:t,showColumnVisibility:n,toolbarActions:s,labels:c,className:l}){let{table:u,labels:d}=useDataTableContext(),f=F.useMemo(()=>c?{...d,...c}:d,[d,c]),p=F.useMemo(()=>t?Array.isArray(t)?t:[t]:[],[t]),m=renderToolbarActions(s,u),h=p.length>0,[g,_]=F.useState(p[0]);if(F.useEffect(()=>{if(p.length===0){_(void 0);return}_(e=>e&&p.includes(e)?e:p[0])},[p]),!h&&!n&&!m)return null;let v=g?u.getColumn(g):void 0,y=v?.getFilterValue()??``,handleColumnChange=e=>{e!==g&&(g&&u.getColumn(g)?.setFilterValue(void 0),_(e))};return P(`div`,{className:e(`flex flex-col gap-2 sm:flex-row sm:items-center`,l),children:[h&&v?p.length>1?P(i,{className:`h-8 w-full sm:max-w-md`,children:[N(a,{align:`inline-start`,className:`pr-0`,children:N(`select`,{"aria-label":f.filterColumnSelectorLabel,value:g,onChange:e=>handleColumnChange(e.target.value),className:`cursor-pointer appearance-none border-0 bg-transparent pr-1 text-sm font-medium text-foreground outline-none focus:outline-none`,children:p.map(e=>N(`option`,{value:e,children:getColumnLabel(u.getColumn(e))},e))})}),N(o,{placeholder:f.filterPlaceholder,value:y,onChange:e=>v.setFilterValue(e.target.value)})]}):N(r,{placeholder:f.filterPlaceholder,value:y,onChange:e=>v.setFilterValue(e.target.value),className:`h-8 w-full sm:max-w-xs`}):null,P(`div`,{className:`flex flex-1 items-center justify-end gap-2`,children:[m,n?N(DataTableViewOptions,{table:u,label:f.columnsButton}):null]})]})}function DataTableHeader({className:e}={}){let{table:t}=useDataTableContext();return N(C,{className:e,children:t.getHeaderGroups().map(e=>N(w,{children:e.headers.map(e=>N(S,{colSpan:e.colSpan,children:e.isPlaceholder?null:I(e.column.columnDef.header,e.getContext())},e.id))},e.id))})}function DataTableBody({emptyMessage:e,className:t}={}){let{table:n,labels:r}=useDataTableContext(),i=n.getRowModel().rows,a=n.getVisibleLeafColumns().length,o=e??r.emptyMessage;return N(y,{className:t,children:i.length===0?N(w,{children:N(b,{colSpan:a,className:`h-24 text-center`,children:o})}):i.map(e=>N(w,{"data-state":e.getIsSelected()?`selected`:void 0,children:e.getVisibleCells().map(e=>N(b,{children:I(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})}function DataTablePagination({table:n,pageSizeOptions:r=[10,20,30,40,50],labels:i,className:a,...o}){let s=useOptionalDataTableContext(),c=n??s?.table;if(!c)throw Error("DataTablePagination requires a `table` prop or to be rendered within <DataTableRoot>");let l=F.useMemo(()=>({...H,...s?.labels,...i}),[s?.labels,i]),u=c.getPageCount(),d=Math.max(u,1),v=c.getState().pagination.pageIndex;return N(`div`,{className:e(`flex items-center justify-end gap-4 px-2`,a),...o,children:P(`div`,{className:`flex items-center gap-6 lg:gap-8`,children:[P(`div`,{className:`hidden items-center gap-2 sm:flex`,children:[N(`p`,{className:`text-sm font-medium`,children:l.rowsPerPage}),P(f,{value:`${c.getState().pagination.pageSize}`,onValueChange:e=>c.setPageSize(Number(e)),children:[N(g,{size:`sm`,className:`h-8 w-20`,children:N(_,{})}),N(p,{side:`top`,children:N(m,{children:r.map(e=>N(h,{value:`${e}`,children:e},e))})})]})]}),N(`div`,{className:`text-sm font-medium`,children:l.pageOf(v+1,d)}),P(`div`,{className:`flex items-center gap-1`,children:[N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,className:`hidden lg:inline-flex`,onClick:()=>c.setPageIndex(0),disabled:!c.getCanPreviousPage(),"aria-label":l.goToFirstPage,children:N(O,{})}),N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,onClick:()=>c.previousPage(),disabled:!c.getCanPreviousPage(),"aria-label":l.goToPreviousPage,children:N(E,{})}),N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,onClick:()=>c.nextPage(),disabled:!c.getCanNextPage(),"aria-label":l.goToNextPage,children:N(D,{})}),N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,className:`hidden lg:inline-flex`,onClick:()=>c.setPageIndex(u-1),disabled:!c.getCanNextPage(),"aria-label":l.goToLastPage,children:N(k,{})})]})]})})}function createDataTableSelectColumn(e){let t=e?.labels?.selectAllRows??H.selectAllRows,r=e?.labels?.selectRow??H.selectRow;return{id:`select`,enableSorting:!1,enableHiding:!1,header:({table:e})=>N(n,{"aria-label":t,checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&`indeterminate`,onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t)}),cell:({row:e})=>N(n,{"aria-label":r,checked:e.getIsSelected()||e.getIsSomeSelected()&&`indeterminate`,disabled:!e.getCanSelect(),onCheckedChange:t=>e.toggleSelected(!!t)})}}function DataTable({columns:e,data:t,getRowId:n,filterColumns:r,pageSize:i=10,pageSizeOptions:a,enableRowSelection:o=!1,enableSorting:s=!1,showPagination:c=!1,showColumnVisibility:l=!1,toolbarActions:u,labels:d,className:f,tableClassName:p,variant:m}){return P(DataTableRoot,{columns:e,data:t,getRowId:n,pageSize:i,enableRowSelection:o,enableSorting:s,labels:d,className:f,children:[N(DataTableToolbar,{filterColumns:r,showColumnVisibility:l,toolbarActions:u}),N(x,{children:P(v,{className:p,variant:m,children:[N(DataTableHeader,{}),N(DataTableBody,{})]})}),c?N(DataTablePagination,{pageSizeOptions:a}):null]})}export{DataTable,DataTableBody,DataTableColumnHeader,DataTableHeader,DataTablePagination,DataTableRoot,DataTableToolbar,DataTableViewOptions,createDataTableSelectColumn,H as defaultDataTableLabels,useDataTable,useDataTableContext};
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{Checkbox as n}from"./checkbox.js";import{Input as r}from"./input.js";import{InputGroup as i,InputGroupAddon as a,InputGroupInput as o}from"./input-group.js";import{DropdownMenu as s,DropdownMenuCheckboxItem as c,DropdownMenuContent as l,DropdownMenuGroup as u,DropdownMenuTrigger as d}from"./dropdown-menu.js";import{Select as f,SelectContent as p,SelectGroup as m,SelectItem as h,SelectTrigger as g,SelectValue as _}from"./select.js";import{Table as v,TableBody as y,TableCell as b,TableContainer as x,TableHead as S,TableHeader as C,TableRow as w}from"./table.js";import{IconArrowsSort as T,IconChevronLeft as E,IconChevronRight as D,IconChevronsLeft as O,IconChevronsRight as k,IconColumns3 as A,IconSortAscending as j,IconSortDescending as M}from"@tabler/icons-react";import{jsx as N,jsxs as P}from"react/jsx-runtime";import*as F from"react";import{flexRender as I,getCoreRowModel as L,getFilteredRowModel as R,getPaginationRowModel as z,getSortedRowModel as B,useReactTable as V}from"@tanstack/react-table";const H={filterPlaceholder:`Filtrar linhas...`,filterColumnSelectorLabel:`Coluna para filtrar`,emptyMessage:`Nenhum resultado.`,columnsButton:`Colunas`,rowsPerPage:`Linhas por página`,pageOf:(e,t)=>`Página ${e} de ${t}`,goToFirstPage:`Ir para a primeira página`,goToPreviousPage:`Ir para a página anterior`,goToNextPage:`Ir para a próxima página`,goToLastPage:`Ir para a última página`,selectAllRows:`Selecionar todas as linhas`,selectRow:`Selecionar linha`},U=F.createContext(null);function useDataTableContext(){let e=F.useContext(U);if(!e)throw Error(`useDataTableContext must be used within <DataTableRoot>`);return e}function useOptionalDataTableContext(){return F.useContext(U)}function renderToolbarActions(e,t){return typeof e==`function`?e(t):e}function getColumnLabel(e){return e?e.columnDef.meta?.label??e.id:``}function useDataTable({columns:e,data:t,getRowId:n,pageSize:r=10,enableRowSelection:i=!1,enableSorting:a=!1,enablePagination:o=!1,labels:s}){let[c,l]=F.useState([]),[u,d]=F.useState([]),[f,p]=F.useState({}),[m,h]=F.useState({pageIndex:0,pageSize:r}),[g,_]=F.useState({}),v=F.useMemo(()=>({...H,...s}),[s]);return V({data:t,columns:F.useMemo(()=>!i||e.some(e=>e.id===`select`)?e:[createDataTableSelectColumn({labels:{selectAllRows:v.selectAllRows,selectRow:v.selectRow}}),...e],[e,i,v.selectAllRows,v.selectRow]),getRowId:n,enableRowSelection:i,enableSorting:a,state:{sorting:c,columnFilters:u,columnVisibility:f,rowSelection:g,pagination:m},onSortingChange:l,onColumnFiltersChange:d,onColumnVisibilityChange:p,onPaginationChange:h,onRowSelectionChange:_,getCoreRowModel:L(),getFilteredRowModel:R(),getPaginationRowModel:o?z():void 0,getSortedRowModel:a?B():void 0})}function DataTableRootControlled({table:t,labels:n,className:r,children:i}){let a={table:t,labels:F.useMemo(()=>({...H,...n}),[n])};return N(U.Provider,{value:a,children:N(`div`,{className:e(`flex w-full flex-col gap-4`,r),children:i})})}function DataTableRootUncontrolled({columns:e,data:t,getRowId:n,pageSize:r,enableRowSelection:i,enableSorting:a,enablePagination:o,labels:s,className:c,children:l}){return N(DataTableRootControlled,{table:useDataTable({columns:e,data:t,getRowId:n,pageSize:r,enableRowSelection:i,enableSorting:a,enablePagination:o,labels:s}),labels:s,className:c,children:l})}function DataTableRoot(e){if(`table`in e&&e.table!==void 0){let{table:t,labels:n,className:r,children:i}=e;return N(DataTableRootControlled,{table:t,labels:n,className:r,children:i})}let{columns:t,data:n,getRowId:r,pageSize:i,enableRowSelection:a,enableSorting:o,enablePagination:s,labels:c,className:l,children:u}=e;return N(DataTableRootUncontrolled,{columns:t,data:n,getRowId:r,pageSize:i,enableRowSelection:a,enableSorting:o,enablePagination:s,labels:c,className:l,children:u})}function DataTableColumnHeader({column:n,title:r,className:i,...a}){if(!n.getCanSort())return N(`div`,{className:e(`inline-flex items-center gap-1`,i),...a,children:r});let o=n.getIsSorted();return P(`div`,{className:e(`inline-flex items-center gap-1`,i),...a,children:[r,N(t,{variant:`ghost`,color:`zinc`,size:`icon-xs`,onClick:()=>{if(o===`desc`)return n.clearSorting();n.toggleSorting(o===`asc`)},children:N(o===`desc`?M:o===`asc`?j:T,{className:`size-4`,"data-icon":`inline-end`})})]})}function DataTableViewOptions({table:n,label:r,className:i,...a}){let o=useOptionalDataTableContext(),f=n??o?.table;if(!f)throw Error("DataTableViewOptions requires a `table` prop or to be rendered within <DataTableRoot>");let p=r??o?.labels.columnsButton??H.columnsButton,m=f.getAllColumns().filter(e=>e.accessorFn!==void 0&&e.getCanHide());return m.length===0?null:P(s,{children:[N(d,{asChild:!0,children:P(t,{type:`button`,variant:`outline`,color:`zinc`,size:`sm`,className:e(`ml-auto`,i),...a,children:[N(A,{"data-icon":`inline-start`}),p]})}),N(l,{align:`end`,className:`w-44`,children:N(u,{children:m.map(e=>N(c,{checked:e.getIsVisible(),onCheckedChange:t=>e.toggleVisibility(!!t),children:e.id},e.id))})})]})}function DataTableToolbar({filterColumns:t,showColumnVisibility:n,toolbarActions:s,labels:c,className:l}){let{table:u,labels:d}=useDataTableContext(),f=F.useMemo(()=>c?{...d,...c}:d,[d,c]),p=F.useMemo(()=>t?Array.isArray(t)?t:[t]:[],[t]),m=renderToolbarActions(s,u),h=p.length>0,[g,_]=F.useState(p[0]);if(F.useEffect(()=>{if(p.length===0){_(void 0);return}_(e=>e&&p.includes(e)?e:p[0])},[p]),!h&&!n&&!m)return null;let v=g?u.getColumn(g):void 0,y=v?.getFilterValue()??``,handleColumnChange=e=>{e!==g&&(g&&u.getColumn(g)?.setFilterValue(void 0),_(e))};return P(`div`,{className:e(`flex flex-col gap-2 sm:flex-row sm:items-center`,l),children:[h&&v?p.length>1?P(i,{className:`h-8 w-full sm:max-w-md`,children:[N(a,{align:`inline-start`,className:`pr-0`,children:N(`select`,{"aria-label":f.filterColumnSelectorLabel,value:g,onChange:e=>handleColumnChange(e.target.value),className:`cursor-pointer appearance-none border-0 bg-transparent pr-1 text-sm font-medium text-foreground outline-none focus:outline-none`,children:p.map(e=>N(`option`,{value:e,children:getColumnLabel(u.getColumn(e))},e))})}),N(o,{placeholder:f.filterPlaceholder,value:y,onChange:e=>v.setFilterValue(e.target.value)})]}):N(r,{placeholder:f.filterPlaceholder,value:y,onChange:e=>v.setFilterValue(e.target.value),className:`h-8 w-full sm:max-w-xs`}):null,P(`div`,{className:`flex flex-1 items-center justify-end gap-2`,children:[m,n?N(DataTableViewOptions,{table:u,label:f.columnsButton}):null]})]})}function DataTableHeader({className:e}={}){let{table:t}=useDataTableContext();return N(C,{className:e,children:t.getHeaderGroups().map(e=>N(w,{children:e.headers.map(e=>N(S,{colSpan:e.colSpan,children:e.isPlaceholder?null:I(e.column.columnDef.header,e.getContext())},e.id))},e.id))})}function DataTableBody({emptyMessage:e,className:t}={}){let{table:n,labels:r}=useDataTableContext(),i=n.getRowModel().rows,a=n.getVisibleLeafColumns().length,o=e??r.emptyMessage;return N(y,{className:t,children:i.length===0?N(w,{children:N(b,{colSpan:a,className:`h-24 text-center`,children:o})}):i.map(e=>N(w,{"data-state":e.getIsSelected()?`selected`:void 0,children:e.getVisibleCells().map(e=>N(b,{children:I(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})}function DataTablePagination({table:n,pageSizeOptions:r=[10,20,30,40,50],labels:i,className:a,...o}){let s=useOptionalDataTableContext(),c=n??s?.table;if(!c)throw Error("DataTablePagination requires a `table` prop or to be rendered within <DataTableRoot>");let l=F.useMemo(()=>({...H,...s?.labels,...i}),[s?.labels,i]),u=c.getPageCount(),d=Math.max(u,1),v=c.getState().pagination.pageIndex;return N(`div`,{className:e(`flex items-center justify-end gap-4 px-2`,a),...o,children:P(`div`,{className:`flex items-center gap-6 lg:gap-8`,children:[P(`div`,{className:`hidden items-center gap-2 sm:flex`,children:[N(`p`,{className:`text-sm font-medium`,children:l.rowsPerPage}),P(f,{value:`${c.getState().pagination.pageSize}`,onValueChange:e=>c.setPageSize(Number(e)),children:[N(g,{size:`sm`,className:`h-8 w-20`,children:N(_,{})}),N(p,{side:`top`,children:N(m,{children:r.map(e=>N(h,{value:`${e}`,children:e},e))})})]})]}),N(`div`,{className:`text-sm font-medium`,children:l.pageOf(v+1,d)}),P(`div`,{className:`flex items-center gap-1`,children:[N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,className:`hidden lg:inline-flex`,onClick:()=>c.setPageIndex(0),disabled:!c.getCanPreviousPage(),"aria-label":l.goToFirstPage,children:N(O,{})}),N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,onClick:()=>c.previousPage(),disabled:!c.getCanPreviousPage(),"aria-label":l.goToPreviousPage,children:N(E,{})}),N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,onClick:()=>c.nextPage(),disabled:!c.getCanNextPage(),"aria-label":l.goToNextPage,children:N(D,{})}),N(t,{type:`button`,variant:`outline`,color:`zinc`,size:`icon-sm`,className:`hidden lg:inline-flex`,onClick:()=>c.setPageIndex(u-1),disabled:!c.getCanNextPage(),"aria-label":l.goToLastPage,children:N(k,{})})]})]})})}function createDataTableSelectColumn(e){let t=e?.labels?.selectAllRows??H.selectAllRows,r=e?.labels?.selectRow??H.selectRow;return{id:`select`,enableSorting:!1,enableHiding:!1,header:({table:e})=>N(n,{"aria-label":t,checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&`indeterminate`,onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t)}),cell:({row:e})=>N(n,{"aria-label":r,checked:e.getIsSelected()||e.getIsSomeSelected()&&`indeterminate`,disabled:!e.getCanSelect(),onCheckedChange:t=>e.toggleSelected(!!t)})}}function DataTable({columns:e,data:t,getRowId:n,filterColumns:r,pageSize:i=10,pageSizeOptions:a,enableRowSelection:o=!1,enableSorting:s=!1,showPagination:c=!1,showColumnVisibility:l=!1,toolbarActions:u,labels:d,className:f,tableClassName:p,variant:m}){return P(DataTableRoot,{columns:e,data:t,getRowId:n,pageSize:i,enableRowSelection:o,enableSorting:s,labels:d,className:f,children:[N(DataTableToolbar,{filterColumns:r,showColumnVisibility:l,toolbarActions:u}),N(x,{children:P(v,{className:p,variant:m,children:[N(DataTableHeader,{}),N(DataTableBody,{})]})}),c?N(DataTablePagination,{pageSizeOptions:a}):null]})}export{DataTable,DataTableBody,DataTableColumnHeader,DataTableHeader,DataTablePagination,DataTableRoot,DataTableToolbar,DataTableViewOptions,createDataTableSelectColumn,H as defaultDataTableLabels,useDataTable,useDataTableContext};
|
|
2
2
|
//# sourceMappingURL=data-table.js.map
|