@moduix/react 1.1.1 → 2.0.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 +16 -16
- package/dist/components/accordion/Accordion.css +8 -1
- package/dist/components/accordion/Accordion.d.ts +3 -2
- package/dist/components/accordion/Accordion.js +17 -5
- package/dist/components/accordion/Accordion.module.js +1 -0
- package/dist/components/accordion/index.d.ts +2 -2
- package/dist/components/alert/Alert.css +19 -5
- package/dist/components/alert/Alert.d.ts +5 -3
- package/dist/components/alert/Alert.js +17 -5
- package/dist/components/alert/Alert.module.js +1 -0
- package/dist/components/angle-slider/AngleSlider.d.ts +18 -2
- package/dist/components/angle-slider/AngleSlider.js +34 -18
- package/dist/components/angle-slider/index.d.ts +2 -2
- package/dist/components/aspect-ratio/AspectRatio.css +3 -1
- package/dist/components/aspect-ratio/AspectRatio.js +2 -2
- package/dist/components/avatar/Avatar.d.ts +6 -3
- package/dist/components/avatar/Avatar.js +12 -5
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/badge/Badge.css +44 -1
- package/dist/components/badge/Badge.d.ts +2 -2
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/bleed/Bleed.d.ts +6 -4
- package/dist/components/bleed/Bleed.js +3 -3
- package/dist/components/breadcrumbs/Breadcrumbs.css +7 -1
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +18 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +18 -4
- package/dist/components/breadcrumbs/Breadcrumbs.module.js +2 -1
- package/dist/components/breadcrumbs/index.d.ts +2 -0
- package/dist/components/button/Button.css +21 -1
- package/dist/components/button/Button.d.ts +6 -0
- package/dist/components/button/Button.js +12 -7
- package/dist/components/card/Card.css +20 -4
- package/dist/components/card/Card.d.ts +1 -0
- package/dist/components/card/Card.js +12 -1
- package/dist/components/card/Card.module.js +1 -0
- package/dist/components/carousel/Carousel.css +2 -0
- package/dist/components/carousel/Carousel.d.ts +4 -0
- package/dist/components/carousel/Carousel.js +15 -2
- package/dist/components/checkbox/Checkbox.d.ts +2 -3
- package/dist/components/checkbox/Checkbox.js +25 -22
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/clipboard/Clipboard.css +1 -1
- package/dist/components/clipboard/Clipboard.d.ts +2 -0
- package/dist/components/clipboard/Clipboard.js +15 -4
- package/dist/components/close-button/CloseButton.d.ts +12 -2
- package/dist/components/close-button/CloseButton.js +9 -9
- package/dist/components/collapsible/Collapsible.css +9 -2
- package/dist/components/collapsible/Collapsible.d.ts +3 -2
- package/dist/components/collapsible/Collapsible.js +18 -6
- package/dist/components/collapsible/Collapsible.module.js +1 -0
- package/dist/components/collapsible/index.d.ts +2 -2
- package/dist/components/color-picker/ColorPicker.css +35 -6
- package/dist/components/color-picker/ColorPicker.d.ts +3 -3
- package/dist/components/color-picker/ColorPicker.js +78 -27
- package/dist/components/color-picker/ColorPicker.module.js +1 -0
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/combobox/Combobox.css +37 -8
- package/dist/components/combobox/Combobox.d.ts +9 -2
- package/dist/components/combobox/Combobox.js +34 -8
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/command-palette/CommandPalette.css +40 -74
- package/dist/components/command-palette/CommandPalette.d.ts +13 -3
- package/dist/components/command-palette/CommandPalette.js +54 -43
- package/dist/components/command-palette/CommandPalette.module.js +0 -2
- package/dist/components/container/Container.js +1 -1
- package/dist/components/date-input/DateInput.css +3 -1
- package/dist/components/date-input/DateInput.d.ts +12 -7
- package/dist/components/date-input/DateInput.js +35 -14
- package/dist/components/date-input/index.d.ts +2 -2
- package/dist/components/date-picker/DatePicker.css +41 -13
- package/dist/components/date-picker/DatePicker.d.ts +30 -2
- package/dist/components/date-picker/DatePicker.js +94 -9
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/dialog/Dialog.css +14 -10
- package/dist/components/dialog/Dialog.d.ts +2 -2
- package/dist/components/dialog/Dialog.js +3 -3
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/drawer/Drawer.d.ts +2 -2
- package/dist/components/drawer/Drawer.js +3 -3
- package/dist/components/drawer/index.d.ts +2 -2
- package/dist/components/editable/Editable.d.ts +9 -2
- package/dist/components/editable/Editable.js +14 -5
- package/dist/components/editable/index.d.ts +2 -2
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/field/Field.css +0 -4
- package/dist/components/field/Field.d.ts +3 -2
- package/dist/components/field/Field.js +6 -5
- package/dist/components/field/Field.module.js +0 -1
- package/dist/components/field/index.d.ts +2 -2
- package/dist/components/fieldset/Fieldset.d.ts +2 -2
- package/dist/components/fieldset/Fieldset.js +3 -3
- package/dist/components/fieldset/index.d.ts +2 -2
- package/dist/components/file-upload/FileUpload.css +81 -8
- package/dist/components/file-upload/FileUpload.d.ts +22 -5
- package/dist/components/file-upload/FileUpload.js +79 -21
- package/dist/components/file-upload/FileUpload.module.js +3 -0
- package/dist/components/file-upload/index.d.ts +2 -2
- package/dist/components/floating-panel/FloatingPanel.css +14 -10
- package/dist/components/floating-panel/FloatingPanel.d.ts +11 -3
- package/dist/components/floating-panel/FloatingPanel.js +15 -9
- package/dist/components/heading/Heading.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/hover-card/HoverCard.css +14 -10
- package/dist/components/hover-card/HoverCard.d.ts +3 -2
- package/dist/components/hover-card/HoverCard.js +5 -4
- package/dist/components/hover-card/index.d.ts +2 -2
- package/dist/components/image/Image.css +7 -0
- package/dist/components/image/Image.d.ts +12 -0
- package/dist/components/image/Image.js +28 -0
- package/dist/components/image/Image.module.js +5 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image-cropper/ImageCropper.d.ts +7 -2
- package/dist/components/image-cropper/ImageCropper.js +25 -3
- package/dist/components/image-cropper/index.d.ts +2 -2
- package/dist/components/input/Input.js +1 -1
- package/dist/components/input-group/InputGroup.d.ts +3 -0
- package/dist/components/input-group/InputGroup.js +1 -1
- package/dist/components/kbd/Kbd.js +1 -1
- package/dist/components/lightbox/Lightbox.css +12 -10
- package/dist/components/lightbox/Lightbox.d.ts +4 -2
- package/dist/components/lightbox/Lightbox.js +9 -7
- package/dist/components/lightbox/index.d.ts +2 -2
- package/dist/components/list/List.js +1 -1
- package/dist/components/listbox/Listbox.css +60 -1
- package/dist/components/listbox/Listbox.d.ts +14 -2
- package/dist/components/listbox/Listbox.js +41 -5
- package/dist/components/listbox/Listbox.module.js +3 -0
- package/dist/components/listbox/index.d.ts +2 -2
- package/dist/components/marquee/Marquee.d.ts +2 -1
- package/dist/components/marquee/Marquee.js +4 -3
- package/dist/components/marquee/index.d.ts +2 -2
- package/dist/components/menu/Menu.css +14 -8
- package/dist/components/menu/Menu.d.ts +3 -2
- package/dist/components/menu/Menu.js +6 -5
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/native-select/NativeSelect.d.ts +6 -2
- package/dist/components/native-select/NativeSelect.js +5 -4
- package/dist/components/number-input/NumberInput.css +0 -6
- package/dist/components/number-input/NumberInput.d.ts +7 -2
- package/dist/components/number-input/NumberInput.js +17 -4
- package/dist/components/number-input/index.d.ts +2 -2
- package/dist/components/pagination/Pagination.d.ts +4 -0
- package/dist/components/pagination/Pagination.js +13 -4
- package/dist/components/password-input/PasswordInput.d.ts +4 -0
- package/dist/components/password-input/PasswordInput.js +10 -2
- package/dist/components/pin-input/PinInput.d.ts +6 -1
- package/dist/components/pin-input/PinInput.js +25 -16
- package/dist/components/popover/Popover.css +20 -11
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.d.ts +6 -0
- package/dist/components/progress-circular/ProgressCircular.js +14 -3
- package/dist/components/progress-linear/ProgressLinear.d.ts +3 -0
- package/dist/components/progress-linear/ProgressLinear.js +6 -3
- package/dist/components/qr-code/QrCode.css +3 -2
- package/dist/components/qr-code/QrCode.d.ts +2 -2
- package/dist/components/qr-code/QrCode.js +3 -3
- package/dist/components/qr-code/index.d.ts +2 -2
- package/dist/components/radio-group/RadioGroup.d.ts +8 -4
- package/dist/components/radio-group/RadioGroup.js +22 -14
- package/dist/components/radio-group/index.d.ts +2 -2
- package/dist/components/rating-group/RatingGroup.css +3 -3
- package/dist/components/rating-group/RatingGroup.d.ts +11 -4
- package/dist/components/rating-group/RatingGroup.js +29 -18
- package/dist/components/rating-group/index.d.ts +2 -2
- package/dist/components/scroll-area/ScrollArea.css +7 -2
- package/dist/components/scroll-area/ScrollArea.d.ts +3 -0
- package/dist/components/scroll-area/ScrollArea.js +9 -6
- package/dist/components/segment-group/SegmentGroup.d.ts +13 -3
- package/dist/components/segment-group/SegmentGroup.js +23 -15
- package/dist/components/segment-group/index.d.ts +2 -2
- package/dist/components/select/Select.css +24 -15
- package/dist/components/select/Select.d.ts +18 -4
- package/dist/components/select/Select.js +65 -20
- package/dist/components/separator/Separator.js +1 -1
- package/dist/components/sidebar/Sidebar.css +144 -4
- package/dist/components/sidebar/Sidebar.d.ts +26 -0
- package/dist/components/sidebar/Sidebar.js +105 -13
- package/dist/components/sidebar/Sidebar.module.js +6 -0
- package/dist/components/signature-pad/SignaturePad.css +12 -41
- package/dist/components/signature-pad/SignaturePad.d.ts +14 -6
- package/dist/components/signature-pad/SignaturePad.js +56 -17
- package/dist/components/signature-pad/index.d.ts +2 -2
- package/dist/components/simple-grid/SimpleGrid.js +3 -3
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.css +6 -4
- package/dist/components/slider/Slider.d.ts +12 -3
- package/dist/components/slider/Slider.js +24 -15
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/spinner/Spinner.js +2 -2
- package/dist/components/split-button/SplitButton.d.ts +1 -1
- package/dist/components/split-button/SplitButton.js +3 -4
- package/dist/components/splitter/Splitter.css +13 -12
- package/dist/components/splitter/Splitter.d.ts +2 -2
- package/dist/components/splitter/Splitter.js +12 -11
- package/dist/components/splitter/index.d.ts +2 -2
- package/dist/components/stack/Stack.d.ts +1 -3
- package/dist/components/stack/Stack.js +4 -6
- package/dist/components/steps/Steps.d.ts +2 -1
- package/dist/components/steps/Steps.js +5 -4
- package/dist/components/swap/Swap.css +45 -0
- package/dist/components/swap/Swap.d.ts +11 -0
- package/dist/components/swap/Swap.js +39 -0
- package/dist/components/swap/Swap.module.js +11 -0
- package/dist/components/swap/index.d.ts +2 -0
- package/dist/components/switch/Switch.css +2 -2
- package/dist/components/switch/Switch.d.ts +4 -4
- package/dist/components/switch/Switch.js +19 -16
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/table/Table.css +3 -3
- package/dist/components/table/Table.js +3 -2
- package/dist/components/table/Table.module.js +0 -1
- package/dist/components/tabs/Tabs.css +3 -1
- package/dist/components/tabs/Tabs.d.ts +3 -2
- package/dist/components/tabs/Tabs.js +5 -4
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tag/Tag.css +12 -42
- package/dist/components/tag/Tag.js +7 -20
- package/dist/components/tags-input/TagsInput.css +3 -40
- package/dist/components/tags-input/TagsInput.d.ts +7 -4
- package/dist/components/tags-input/TagsInput.js +33 -21
- package/dist/components/tags-input/index.d.ts +2 -2
- package/dist/components/text/Text.d.ts +2 -2
- package/dist/components/text/Text.js +1 -1
- package/dist/components/textarea/Textarea.js +1 -1
- package/dist/components/timer/Timer.d.ts +14 -2
- package/dist/components/timer/Timer.js +13 -5
- package/dist/components/timer/index.d.ts +2 -2
- package/dist/components/toast/Toast.d.ts +3 -1
- package/dist/components/toast/Toast.js +11 -2
- package/dist/components/toggle/Toggle.css +3 -3
- package/dist/components/toggle/Toggle.d.ts +3 -2
- package/dist/components/toggle/Toggle.js +5 -4
- package/dist/components/toggle/index.d.ts +2 -2
- package/dist/components/toggle-group/ToggleGroup.d.ts +3 -2
- package/dist/components/toggle-group/ToggleGroup.js +4 -3
- package/dist/components/toggle-group/index.d.ts +2 -2
- package/dist/components/tooltip/Tooltip.css +14 -10
- package/dist/components/tooltip/Tooltip.d.ts +3 -2
- package/dist/components/tooltip/Tooltip.js +10 -3
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tour/Tour.css +23 -18
- package/dist/components/tour/Tour.d.ts +6 -0
- package/dist/components/tour/Tour.js +8 -1
- package/dist/components/tree-view/TreeView.css +1 -1
- package/dist/components/tree-view/TreeView.d.ts +2 -2
- package/dist/components/tree-view/TreeView.js +4 -4
- package/dist/components/tree-view/index.d.ts +2 -2
- package/dist/index.d.ts +40 -39
- package/dist/index.js +40 -39
- package/dist/lib/moduix/icons/ui/Icons.d.ts +1 -45
- package/dist/lib/moduix/icons/ui/Icons.js +36 -263
- package/dist/lib/moduix/icons/ui/index.d.ts +2 -2
- package/dist/lib/moduix/overlayPortal.js +1 -1
- package/package.json +4 -3
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { CheckIcon, ChevronUpDownIcon, CloseIcon } from "../../lib/moduix/icons/ui/Icons.js";
|
|
2
1
|
import { normalizeClassName } from "../../lib/moduix/normalizeClassName.js";
|
|
2
|
+
import { CheckIcon, ChevronUpDownIcon } from "../../lib/moduix/icons/ui/Icons.js";
|
|
3
|
+
import { CloseButton } from "../close-button/CloseButton.js";
|
|
3
4
|
import { OverlayPortal, OverlayPortalProvider } from "../../lib/moduix/overlayPortal.js";
|
|
4
5
|
import Combobox_module_default from "./Combobox.module.js";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { forwardRef } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Combobox, useCombobox, useComboboxContext } from "@ark-ui/react/combobox";
|
|
9
10
|
//#region src/components/combobox/Combobox.tsx
|
|
10
11
|
const ComboboxRoot = forwardRef(function ComboboxRoot({ className, portalled, portalRef, ...props }, ref) {
|
|
11
12
|
return /* @__PURE__ */ jsx(OverlayPortalProvider, {
|
|
@@ -56,13 +57,29 @@ const ComboboxInput = forwardRef(function ComboboxInput({ asChild, className, ..
|
|
|
56
57
|
...props
|
|
57
58
|
});
|
|
58
59
|
});
|
|
59
|
-
const ComboboxClearTrigger = forwardRef(function ComboboxClearTrigger({ className, children, ...props }, ref) {
|
|
60
|
+
const ComboboxClearTrigger = forwardRef(function ComboboxClearTrigger({ asChild, className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }, ref) {
|
|
61
|
+
const triggerClassName = clsx(Combobox_module_default.clearTrigger, normalizeClassName(className));
|
|
62
|
+
if (asChild) return /* @__PURE__ */ jsx(Combobox.ClearTrigger, {
|
|
63
|
+
ref,
|
|
64
|
+
asChild: true,
|
|
65
|
+
"data-slot": "combobox-clear-trigger",
|
|
66
|
+
className: triggerClassName,
|
|
67
|
+
"aria-label": ariaLabel,
|
|
68
|
+
"aria-labelledby": ariaLabelledBy,
|
|
69
|
+
...props,
|
|
70
|
+
children
|
|
71
|
+
});
|
|
60
72
|
return /* @__PURE__ */ jsx(Combobox.ClearTrigger, {
|
|
61
73
|
ref,
|
|
74
|
+
asChild: true,
|
|
62
75
|
"data-slot": "combobox-clear-trigger",
|
|
63
|
-
className:
|
|
76
|
+
className: triggerClassName,
|
|
64
77
|
...props,
|
|
65
|
-
children:
|
|
78
|
+
children: /* @__PURE__ */ jsx(CloseButton.Root, {
|
|
79
|
+
"aria-label": ariaLabel ?? (ariaLabelledBy == null ? "Clear selection" : void 0),
|
|
80
|
+
"aria-labelledby": ariaLabelledBy,
|
|
81
|
+
children
|
|
82
|
+
})
|
|
66
83
|
});
|
|
67
84
|
});
|
|
68
85
|
const ComboboxTrigger = forwardRef(function ComboboxTrigger({ className, children, ...props }, ref) {
|
|
@@ -147,6 +164,13 @@ const ComboboxItemIndicator = forwardRef(function ComboboxItemIndicator({ classN
|
|
|
147
164
|
children: children ?? /* @__PURE__ */ jsx(CheckIcon, {})
|
|
148
165
|
});
|
|
149
166
|
});
|
|
167
|
+
const ComboboxOption = forwardRef(function ComboboxOption({ children, indicator, ...props }, ref) {
|
|
168
|
+
return /* @__PURE__ */ jsxs(ComboboxItem, {
|
|
169
|
+
ref,
|
|
170
|
+
...props,
|
|
171
|
+
children: [/* @__PURE__ */ jsx(ComboboxItemText, { children }), indicator !== false ? /* @__PURE__ */ jsx(ComboboxItemIndicator, { children: indicator }) : null]
|
|
172
|
+
});
|
|
173
|
+
});
|
|
150
174
|
const Combobox$1 = Object.assign(ComboboxRoot, {
|
|
151
175
|
Root: ComboboxRoot,
|
|
152
176
|
RootProvider: ComboboxRootProvider,
|
|
@@ -163,7 +187,9 @@ const Combobox$1 = Object.assign(ComboboxRoot, {
|
|
|
163
187
|
ItemGroupLabel: ComboboxItemGroupLabel,
|
|
164
188
|
Item: ComboboxItem,
|
|
165
189
|
ItemText: ComboboxItemText,
|
|
166
|
-
ItemIndicator: ComboboxItemIndicator
|
|
190
|
+
ItemIndicator: ComboboxItemIndicator,
|
|
191
|
+
Option: ComboboxOption,
|
|
192
|
+
Context: Combobox.Context
|
|
167
193
|
});
|
|
168
194
|
//#endregion
|
|
169
|
-
export { Combobox$1 as Combobox };
|
|
195
|
+
export { Combobox$1 as Combobox, useCombobox, useComboboxContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Combobox } from "./Combobox.js";
|
|
2
|
-
export { Combobox };
|
|
1
|
+
import { Combobox, useCombobox, useComboboxContext } from "./Combobox.js";
|
|
2
|
+
export { Combobox, useCombobox, useComboboxContext };
|
|
@@ -69,11 +69,6 @@
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
._4OfG0a_content {
|
|
72
|
-
--command-palette-close-icon-size-effective: var(--command-palette-close-icon-size, var(--command-palette-clear-size, var(--size-sm)));
|
|
73
|
-
--command-palette-close-offset-effective: var(--command-palette-close-offset, var(--spacing-3));
|
|
74
|
-
--command-palette-header-padding-inline-end-effective: var(--command-palette-header-padding-inline-end, calc(var(--command-palette-header-padding-x, var(--spacing-4)) +
|
|
75
|
-
var(--command-palette-close-icon-size-effective) +
|
|
76
|
-
var(--command-palette-close-offset-effective)));
|
|
77
72
|
box-sizing: border-box;
|
|
78
73
|
width: min(var(--command-palette-width, 37.5rem),
|
|
79
74
|
var(--command-palette-max-width, calc(100vw - var(--spacing-8, 2rem))));
|
|
@@ -90,17 +85,18 @@
|
|
|
90
85
|
outline: 0;
|
|
91
86
|
flex-direction: column;
|
|
92
87
|
display: flex;
|
|
93
|
-
position: relative;
|
|
94
88
|
overflow: hidden;
|
|
95
89
|
|
|
96
90
|
&[data-state="open"] {
|
|
97
91
|
animation: _4OfG0a_command-palette-content-in
|
|
98
|
-
var(--command-palette-transition, var(--
|
|
92
|
+
var(--command-palette-transition, var(--popup-motion-duration, var(--duration-normal))
|
|
93
|
+
var(--popup-motion-easing, var(--ease-in-out)));
|
|
99
94
|
}
|
|
100
95
|
|
|
101
96
|
&[data-state="closed"] {
|
|
102
97
|
animation: _4OfG0a_command-palette-content-out
|
|
103
|
-
var(--command-palette-transition, var(--
|
|
98
|
+
var(--command-palette-transition, var(--popup-motion-duration, var(--duration-normal))
|
|
99
|
+
var(--popup-motion-easing, var(--ease-in-out)));
|
|
104
100
|
animation-fill-mode: forwards;
|
|
105
101
|
}
|
|
106
102
|
}
|
|
@@ -109,7 +105,6 @@
|
|
|
109
105
|
gap: var(--command-palette-header-gap, var(--spacing-1));
|
|
110
106
|
padding: var(--command-palette-header-padding-y, var(--spacing-4))
|
|
111
107
|
var(--command-palette-header-padding-x, var(--spacing-4)) 0;
|
|
112
|
-
padding-inline-end: var(--command-palette-header-padding-inline-end-effective);
|
|
113
108
|
display: grid;
|
|
114
109
|
}
|
|
115
110
|
|
|
@@ -128,58 +123,17 @@
|
|
|
128
123
|
margin: 0;
|
|
129
124
|
}
|
|
130
125
|
|
|
131
|
-
.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
color: var(--command-palette-muted-color, var(--color-muted-foreground));
|
|
137
|
-
cursor: pointer;
|
|
138
|
-
transition: background-color var(--transition-default),
|
|
139
|
-
color var(--transition-default);
|
|
140
|
-
background: none;
|
|
141
|
-
border: 0;
|
|
142
|
-
flex-shrink: 0;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
align-items: center;
|
|
145
|
-
margin: 0;
|
|
146
|
-
padding: 0;
|
|
147
|
-
display: inline-flex;
|
|
148
|
-
|
|
149
|
-
@media (hover: hover) {
|
|
150
|
-
&:hover {
|
|
151
|
-
background-color: var(--command-palette-clear-bg-hover, var(--color-accent));
|
|
152
|
-
color: var(--command-palette-color, var(--color-popover-foreground));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
&:focus-visible {
|
|
157
|
-
outline: var(--command-palette-focus-ring-width, var(--border-width-sm)) solid
|
|
158
|
-
var(--command-palette-focus-ring-color, var(--color-ring));
|
|
159
|
-
outline-offset: var(--command-palette-focus-ring-offset, var(--border-width-sm));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
._4OfG0a_closeTrigger {
|
|
164
|
-
top: var(--command-palette-close-offset-effective);
|
|
165
|
-
right: var(--command-palette-close-offset-effective);
|
|
166
|
-
z-index: 1;
|
|
167
|
-
position: absolute;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
._4OfG0a_closeIcon {
|
|
171
|
-
--close-button-size: var(--command-palette-close-icon-size-effective);
|
|
172
|
-
--close-button-radius: var(--command-palette-close-icon-radius, var(--command-palette-clear-radius, var(--radius-md)));
|
|
173
|
-
--close-button-icon-size: var(--command-palette-close-icon-glyph-size, var(--command-palette-icon-size, 1rem));
|
|
174
|
-
--close-button-bg: var(--command-palette-close-icon-bg, transparent);
|
|
126
|
+
._4OfG0a_clearTrigger {
|
|
127
|
+
--close-button-size: var(--command-palette-clear-size, var(--size-sm));
|
|
128
|
+
--close-button-radius: var(--command-palette-clear-radius, var(--radius-md));
|
|
129
|
+
--close-button-icon-size: var(--command-palette-icon-size, 1rem);
|
|
130
|
+
--close-button-bg: transparent;
|
|
175
131
|
--close-button-bg-hover: var(--command-palette-clear-bg-hover, var(--color-accent));
|
|
176
|
-
--close-button-color: var(--command-palette-
|
|
132
|
+
--close-button-color: var(--command-palette-muted-color, var(--color-muted-foreground));
|
|
177
133
|
--close-button-color-hover: var(--command-palette-color, var(--color-popover-foreground));
|
|
134
|
+
--close-button-focus-ring-width: var(--command-palette-focus-ring-width, var(--border-width-sm));
|
|
178
135
|
--close-button-focus-ring-color: var(--command-palette-focus-ring-color, var(--color-ring));
|
|
179
|
-
|
|
180
|
-
right: var(--command-palette-close-offset-effective);
|
|
181
|
-
z-index: 1;
|
|
182
|
-
position: absolute;
|
|
136
|
+
--close-button-focus-ring-offset: var(--command-palette-focus-ring-offset, var(--border-width-sm));
|
|
183
137
|
}
|
|
184
138
|
|
|
185
139
|
._4OfG0a_body {
|
|
@@ -206,25 +160,37 @@
|
|
|
206
160
|
box-sizing: border-box;
|
|
207
161
|
align-items: center;
|
|
208
162
|
gap: var(--command-palette-input-gap, var(--spacing-2));
|
|
209
|
-
min-height: var(--command-palette-input-height,
|
|
210
|
-
|
|
211
|
-
var(--command-palette-control-
|
|
212
|
-
|
|
213
|
-
|
|
163
|
+
min-height: var(--command-palette-input-height, var(--size-md));
|
|
164
|
+
margin: var(--command-palette-control-margin-y, var(--spacing-2))
|
|
165
|
+
var(--command-palette-control-margin-x, var(--spacing-4))
|
|
166
|
+
var(--command-palette-control-margin-bottom, var(--spacing-2));
|
|
167
|
+
border: var(--command-palette-input-border-width, var(--border-width-sm)) solid
|
|
168
|
+
var(--command-palette-input-border-color, var(--color-border));
|
|
169
|
+
border-radius: var(--command-palette-input-radius, var(--radius-md));
|
|
170
|
+
padding: var(--command-palette-control-padding-y, var(--spacing-1))
|
|
171
|
+
var(--command-palette-control-padding-x, var(--spacing-3));
|
|
172
|
+
background-color: var(--command-palette-input-bg, var(--color-background));
|
|
173
|
+
color: var(--command-palette-input-color, var(--color-foreground));
|
|
174
|
+
transition: background-color var(--transition-default),
|
|
175
|
+
border-color var(--transition-default);
|
|
214
176
|
flex: none;
|
|
215
177
|
display: flex;
|
|
216
178
|
position: relative;
|
|
179
|
+
|
|
180
|
+
&:has(._4OfG0a_input:is([data-invalid], [aria-invalid="true"])) {
|
|
181
|
+
border-color: var(--command-palette-input-border-color-invalid, var(--color-destructive));
|
|
182
|
+
}
|
|
217
183
|
}
|
|
218
184
|
|
|
219
185
|
._4OfG0a_input {
|
|
220
186
|
box-sizing: border-box;
|
|
221
187
|
width: 100%;
|
|
222
188
|
min-width: 0;
|
|
223
|
-
height: var(--command-palette-input-control-height, var(--size-
|
|
189
|
+
height: var(--command-palette-input-control-height, var(--size-sm));
|
|
224
190
|
color: inherit;
|
|
225
191
|
font: inherit;
|
|
226
|
-
font-size: var(--command-palette-input-font-size, var(--text-
|
|
227
|
-
line-height: var(--command-palette-input-line-height, var(--line-height-text-
|
|
192
|
+
font-size: var(--command-palette-input-font-size, var(--text-sm));
|
|
193
|
+
line-height: var(--command-palette-input-line-height, var(--line-height-text-sm));
|
|
228
194
|
background: none;
|
|
229
195
|
border: 0;
|
|
230
196
|
outline: 0;
|
|
@@ -474,19 +440,19 @@
|
|
|
474
440
|
|
|
475
441
|
@keyframes _4OfG0a_command-palette-content-in {
|
|
476
442
|
from {
|
|
477
|
-
opacity: var(--command-palette-content-starting-opacity, 0);
|
|
478
|
-
translate: var(--command-palette-content-starting-translate-x, 0)
|
|
479
|
-
var(--command-palette-content-starting-translate-y, -.75rem);
|
|
480
|
-
scale: var(--command-palette-content-starting-scale, var(--scale-popup));
|
|
443
|
+
opacity: var(--command-palette-content-starting-opacity, var(--popup-motion-starting-opacity, 0));
|
|
444
|
+
translate: var(--command-palette-content-starting-translate-x, var(--popup-motion-starting-translate-x, 0))
|
|
445
|
+
var(--command-palette-content-starting-translate-y, var(--popup-motion-starting-translate-y, -.75rem));
|
|
446
|
+
scale: var(--command-palette-content-starting-scale, var(--popup-motion-starting-scale, var(--scale-popup)));
|
|
481
447
|
}
|
|
482
448
|
}
|
|
483
449
|
|
|
484
450
|
@keyframes _4OfG0a_command-palette-content-out {
|
|
485
451
|
to {
|
|
486
|
-
opacity: var(--command-palette-content-ending-opacity, 0);
|
|
487
|
-
translate: var(--command-palette-content-ending-translate-x, 0)
|
|
488
|
-
var(--command-palette-content-ending-translate-y, -.75rem);
|
|
489
|
-
scale: var(--command-palette-content-ending-scale, var(--scale-popup));
|
|
452
|
+
opacity: var(--command-palette-content-ending-opacity, var(--popup-motion-ending-opacity, 0));
|
|
453
|
+
translate: var(--command-palette-content-ending-translate-x, var(--popup-motion-ending-translate-x, 0))
|
|
454
|
+
var(--command-palette-content-ending-translate-y, var(--popup-motion-ending-translate-y, -.75rem));
|
|
455
|
+
scale: var(--command-palette-content-ending-scale, var(--popup-motion-ending-scale, var(--scale-popup)));
|
|
490
456
|
}
|
|
491
457
|
}
|
|
492
458
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CloseButton } from "../close-button/CloseButton.js";
|
|
1
2
|
import { OverlayPortalProps } from "../../lib/moduix/overlayPortal.js";
|
|
2
3
|
import { Kbd } from "../kbd/Kbd.js";
|
|
3
4
|
import { ComponentProps } from "react";
|
|
@@ -10,6 +11,10 @@ type CommandPaletteRootProps = ComponentProps<typeof Dialog.Root> & {
|
|
|
10
11
|
shortcutTarget?: Document | HTMLElement | null;
|
|
11
12
|
} & OverlayPortalProps;
|
|
12
13
|
type CommandPaletteRootProviderProps = ComponentProps<typeof Dialog.RootProvider> & OverlayPortalProps;
|
|
14
|
+
type CommandPaletteSearchProps = ComponentProps<typeof Combobox.Input> & {
|
|
15
|
+
controlProps?: ComponentProps<typeof Combobox.Control>;
|
|
16
|
+
clearTriggerProps?: ComponentProps<typeof CloseButton.Root>;
|
|
17
|
+
};
|
|
13
18
|
declare function CommandPaletteRoot({
|
|
14
19
|
shortcut,
|
|
15
20
|
shortcutTarget,
|
|
@@ -42,16 +47,21 @@ declare const CommandPalette: typeof CommandPaletteRoot & {
|
|
|
42
47
|
Backdrop: import("react").ForwardRefExoticComponent<Omit<Dialog.BackdropProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
48
|
Positioner: import("react").ForwardRefExoticComponent<Omit<Dialog.PositionerProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
49
|
Content: import("react").ForwardRefExoticComponent<Omit<Dialog.ContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
|
+
Panel: import("react").ForwardRefExoticComponent<Omit<Dialog.ContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
51
|
Title: import("react").ForwardRefExoticComponent<Omit<Dialog.TitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
46
52
|
Description: import("react").ForwardRefExoticComponent<Omit<Dialog.DescriptionProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
-
CloseTrigger: import("react").ForwardRefExoticComponent<Omit<Dialog.CloseTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
48
|
-
CloseIcon: import("react").ForwardRefExoticComponent<Omit<Omit<Dialog.CloseTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "asChild">, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
49
53
|
Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react/factory").PolymorphicProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
54
|
Body: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react/factory").PolymorphicProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
55
|
Combobox: Combobox.RootComponent;
|
|
52
56
|
Control: import("react").ForwardRefExoticComponent<Omit<Combobox.ControlProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
53
57
|
Input: import("react").ForwardRefExoticComponent<Omit<Combobox.InputProps & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
54
|
-
|
|
58
|
+
Search: import("react").ForwardRefExoticComponent<Omit<CommandPaletteSearchProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
59
|
+
ClearTrigger: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("@ark-ui/react/factory").PolymorphicProps & {
|
|
60
|
+
'data-disabled'?: string;
|
|
61
|
+
'data-part'?: string;
|
|
62
|
+
'data-scope'?: string;
|
|
63
|
+
'data-slot'?: string;
|
|
64
|
+
} & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
55
65
|
List: import("react").ForwardRefExoticComponent<Omit<Combobox.ContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
56
66
|
Empty: import("react").ForwardRefExoticComponent<Omit<Combobox.EmptyProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
57
67
|
ItemGroup: import("react").ForwardRefExoticComponent<Omit<Combobox.ItemGroupProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { CheckIcon, CloseIcon } from "../../lib/moduix/icons/ui/Icons.js";
|
|
2
1
|
import { normalizeClassName } from "../../lib/moduix/normalizeClassName.js";
|
|
2
|
+
import { CheckIcon } from "../../lib/moduix/icons/ui/Icons.js";
|
|
3
3
|
import { CloseButton } from "../close-button/CloseButton.js";
|
|
4
4
|
import { OverlayPortal, OverlayPortalProvider } from "../../lib/moduix/overlayPortal.js";
|
|
5
5
|
import { Kbd } from "../kbd/Kbd.js";
|
|
6
6
|
import { ScrollArea } from "../scroll-area/ScrollArea.js";
|
|
7
7
|
import CommandPalette_module_default from "./CommandPalette.module.js";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { ark } from "@ark-ui/react/factory";
|
|
10
9
|
import { clsx } from "clsx";
|
|
11
10
|
import { forwardRef, useEffect } from "react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { Combobox } from "@ark-ui/react/combobox";
|
|
13
13
|
import { Dialog, useDialog, useDialogContext } from "@ark-ui/react/dialog";
|
|
14
14
|
//#region src/components/command-palette/CommandPalette.tsx
|
|
15
|
-
const DEFAULT_CLOSE_TRIGGER_LABEL = "Close command palette";
|
|
16
|
-
const DEFAULT_CLOSE_ICON_LABEL = "Close command palette";
|
|
17
15
|
const DEFAULT_CLEAR_TRIGGER_LABEL = "Clear search";
|
|
16
|
+
const DEFAULT_SEARCH_INPUT_LABEL = "Search commands";
|
|
18
17
|
function isShortcutMatch(event, shortcut) {
|
|
19
18
|
const parts = shortcut.toLowerCase().split("+").map((part) => part.trim()).filter(Boolean);
|
|
20
19
|
const [modifier, key] = parts;
|
|
@@ -38,9 +37,9 @@ function CommandPaletteRoot({ shortcut = false, shortcutTarget, lazyMount = true
|
|
|
38
37
|
if (!shortcut || shortcutTarget === null) return;
|
|
39
38
|
const target = shortcutTarget ?? document;
|
|
40
39
|
const handleKeyDown = (event) => {
|
|
41
|
-
if (event.defaultPrevented || event.isComposing ||
|
|
40
|
+
if (event.defaultPrevented || event.isComposing || !isShortcutMatch(event, shortcut) || !dialog.open && isEditableTarget(event.target)) return;
|
|
42
41
|
event.preventDefault();
|
|
43
|
-
dialog.setOpen(
|
|
42
|
+
dialog.setOpen(!dialog.open);
|
|
44
43
|
};
|
|
45
44
|
const eventListener = handleKeyDown;
|
|
46
45
|
target.addEventListener("keydown", eventListener);
|
|
@@ -109,6 +108,13 @@ const CommandPaletteContent = forwardRef(function CommandPaletteContent({ classN
|
|
|
109
108
|
...props
|
|
110
109
|
});
|
|
111
110
|
});
|
|
111
|
+
const CommandPalettePanel = forwardRef(function CommandPalettePanel({ children, ...props }, ref) {
|
|
112
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CommandPaletteBackdrop, {}), /* @__PURE__ */ jsx(CommandPalettePositioner, { children: /* @__PURE__ */ jsx(CommandPaletteContent, {
|
|
113
|
+
ref,
|
|
114
|
+
...props,
|
|
115
|
+
children: /* @__PURE__ */ jsx(CommandPaletteBody, { children })
|
|
116
|
+
}) })] });
|
|
117
|
+
});
|
|
112
118
|
const CommandPaletteTitle = forwardRef(function CommandPaletteTitle({ className, ...props }, ref) {
|
|
113
119
|
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
114
120
|
ref,
|
|
@@ -125,31 +131,6 @@ const CommandPaletteDescription = forwardRef(function CommandPaletteDescription(
|
|
|
125
131
|
...props
|
|
126
132
|
});
|
|
127
133
|
});
|
|
128
|
-
const CommandPaletteCloseTrigger = forwardRef(function CommandPaletteCloseTrigger({ asChild, className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }, ref) {
|
|
129
|
-
return /* @__PURE__ */ jsx(Dialog.CloseTrigger, {
|
|
130
|
-
ref,
|
|
131
|
-
asChild,
|
|
132
|
-
"data-slot": "command-palette-close-trigger",
|
|
133
|
-
"aria-label": ariaLabel ?? (!asChild && children == null && ariaLabelledBy == null ? DEFAULT_CLOSE_TRIGGER_LABEL : void 0),
|
|
134
|
-
"aria-labelledby": ariaLabelledBy,
|
|
135
|
-
className: clsx(!asChild && CommandPalette_module_default.closeTrigger, normalizeClassName(className)),
|
|
136
|
-
...props,
|
|
137
|
-
children: children ?? (!asChild ? /* @__PURE__ */ jsx(CloseIcon, { className: CommandPalette_module_default.iconSvg }) : void 0)
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
const CommandPaletteCloseIcon = forwardRef(function CommandPaletteCloseIcon({ className, children, "aria-label": ariaLabel = DEFAULT_CLOSE_ICON_LABEL, ...props }, ref) {
|
|
141
|
-
return /* @__PURE__ */ jsx(Dialog.CloseTrigger, {
|
|
142
|
-
asChild: true,
|
|
143
|
-
...props,
|
|
144
|
-
children: /* @__PURE__ */ jsx(CloseButton.Root, {
|
|
145
|
-
ref,
|
|
146
|
-
"data-slot": "command-palette-close-icon",
|
|
147
|
-
"aria-label": ariaLabel,
|
|
148
|
-
className: clsx(CommandPalette_module_default.closeIcon, normalizeClassName(className)),
|
|
149
|
-
children
|
|
150
|
-
})
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
134
|
const CommandPaletteHeader = forwardRef(function CommandPaletteHeader({ className, ...props }, ref) {
|
|
154
135
|
return /* @__PURE__ */ jsx(ark.div, {
|
|
155
136
|
ref,
|
|
@@ -201,18 +182,48 @@ const CommandPaletteInput = forwardRef(function CommandPaletteInput({ className,
|
|
|
201
182
|
...props
|
|
202
183
|
});
|
|
203
184
|
});
|
|
204
|
-
const
|
|
205
|
-
return /* @__PURE__ */
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
...
|
|
213
|
-
children: children ?? (!asChild ? /* @__PURE__ */ jsx(CloseIcon, { className: CommandPalette_module_default.iconSvg }) : void 0)
|
|
185
|
+
const CommandPaletteSearch = forwardRef(function CommandPaletteSearch({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, clearTriggerProps, controlProps, ...props }, ref) {
|
|
186
|
+
return /* @__PURE__ */ jsxs(CommandPaletteControl, {
|
|
187
|
+
...controlProps,
|
|
188
|
+
children: [/* @__PURE__ */ jsx(CommandPaletteInput, {
|
|
189
|
+
ref,
|
|
190
|
+
"aria-label": ariaLabel ?? (ariaLabelledBy == null ? DEFAULT_SEARCH_INPUT_LABEL : void 0),
|
|
191
|
+
"aria-labelledby": ariaLabelledBy,
|
|
192
|
+
...props
|
|
193
|
+
}), /* @__PURE__ */ jsx(CommandPaletteClearTrigger, { ...clearTriggerProps })]
|
|
214
194
|
});
|
|
215
195
|
});
|
|
196
|
+
const CommandPaletteClearTrigger = forwardRef(function CommandPaletteClearTrigger({ asChild, className, children, disabled, onClick, onPointerDown, tabIndex, "aria-controls": ariaControls, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }, ref) {
|
|
197
|
+
return /* @__PURE__ */ jsx(Combobox.Context, { children: (combobox) => {
|
|
198
|
+
const inputProps = combobox.getInputProps();
|
|
199
|
+
const isInvalid = inputProps["aria-invalid"] === true || inputProps["aria-invalid"] === "true";
|
|
200
|
+
return /* @__PURE__ */ jsx(CloseButton.Root, {
|
|
201
|
+
ref,
|
|
202
|
+
asChild,
|
|
203
|
+
...props,
|
|
204
|
+
disabled: disabled ?? combobox.disabled,
|
|
205
|
+
"data-scope": "combobox",
|
|
206
|
+
"data-part": "clear-trigger",
|
|
207
|
+
"data-slot": "command-palette-clear-trigger",
|
|
208
|
+
"data-invalid": isInvalid ? "" : void 0,
|
|
209
|
+
hidden: combobox.inputValue.length === 0,
|
|
210
|
+
tabIndex: tabIndex ?? -1,
|
|
211
|
+
"aria-controls": ariaControls ?? inputProps.id,
|
|
212
|
+
"aria-label": ariaLabel ?? (!asChild && children == null && ariaLabelledBy == null ? DEFAULT_CLEAR_TRIGGER_LABEL : void 0),
|
|
213
|
+
"aria-labelledby": ariaLabelledBy,
|
|
214
|
+
className: clsx(CommandPalette_module_default.clearTrigger, normalizeClassName(className)),
|
|
215
|
+
onPointerDown: (event) => {
|
|
216
|
+
onPointerDown?.(event);
|
|
217
|
+
if (event.button === 0) event.preventDefault();
|
|
218
|
+
},
|
|
219
|
+
onClick: (event) => {
|
|
220
|
+
onClick?.(event);
|
|
221
|
+
if (!event.defaultPrevented) combobox.setInputValue("");
|
|
222
|
+
},
|
|
223
|
+
children
|
|
224
|
+
});
|
|
225
|
+
} });
|
|
226
|
+
});
|
|
216
227
|
const CommandPaletteList = forwardRef(function CommandPaletteList({ className, children, ...props }, ref) {
|
|
217
228
|
return /* @__PURE__ */ jsx(Combobox.Content, {
|
|
218
229
|
ref,
|
|
@@ -354,15 +365,15 @@ const CommandPalette = Object.assign(CommandPaletteRoot, {
|
|
|
354
365
|
Backdrop: CommandPaletteBackdrop,
|
|
355
366
|
Positioner: CommandPalettePositioner,
|
|
356
367
|
Content: CommandPaletteContent,
|
|
368
|
+
Panel: CommandPalettePanel,
|
|
357
369
|
Title: CommandPaletteTitle,
|
|
358
370
|
Description: CommandPaletteDescription,
|
|
359
|
-
CloseTrigger: CommandPaletteCloseTrigger,
|
|
360
|
-
CloseIcon: CommandPaletteCloseIcon,
|
|
361
371
|
Header: CommandPaletteHeader,
|
|
362
372
|
Body: CommandPaletteBody,
|
|
363
373
|
Combobox: CommandPaletteCombobox,
|
|
364
374
|
Control: CommandPaletteControl,
|
|
365
375
|
Input: CommandPaletteInput,
|
|
376
|
+
Search: CommandPaletteSearch,
|
|
366
377
|
ClearTrigger: CommandPaletteClearTrigger,
|
|
367
378
|
List: CommandPaletteList,
|
|
368
379
|
Empty: CommandPaletteEmpty,
|
|
@@ -4,8 +4,6 @@ var CommandPalette_module_default = {
|
|
|
4
4
|
"backdrop": "_4OfG0a_backdrop",
|
|
5
5
|
"body": "_4OfG0a_body",
|
|
6
6
|
"clearTrigger": "_4OfG0a_clearTrigger",
|
|
7
|
-
"closeIcon": "_4OfG0a_closeIcon",
|
|
8
|
-
"closeTrigger": "_4OfG0a_closeTrigger",
|
|
9
7
|
"combobox": "_4OfG0a_combobox",
|
|
10
8
|
"command-palette-backdrop-in": "_4OfG0a_command-palette-backdrop-in",
|
|
11
9
|
"command-palette-backdrop-out": "_4OfG0a_command-palette-backdrop-out",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { normalizeClassName } from "../../lib/moduix/normalizeClassName.js";
|
|
2
2
|
import Container_module_default from "./Container.module.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { ark } from "@ark-ui/react/factory";
|
|
5
4
|
import { clsx } from "clsx";
|
|
6
5
|
import { forwardRef } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/container/Container.tsx
|
|
8
8
|
const ContainerRoot = forwardRef(function ContainerRoot({ size = "lg", gutter = "md", className, ...props }, ref) {
|
|
9
9
|
return /* @__PURE__ */ jsx(ark.div, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
.X3ODua_root {
|
|
3
3
|
align-items: flex-start;
|
|
4
4
|
gap: var(--date-input-gap, var(--spacing-1));
|
|
5
|
-
width: var(--date-input-width,
|
|
5
|
+
width: var(--date-input-width, 100%);
|
|
6
6
|
max-width: var(--date-input-max-width, none);
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
display: inline-flex;
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.X3ODua_control {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
width: var(--date-input-control-width, 100%);
|
|
23
25
|
min-height: var(--date-input-control-height, var(--size-lg));
|
|
24
26
|
border: var(--date-input-border-width, var(--border-width-sm))
|
|
25
27
|
var(--date-input-border-style, solid) var(--date-input-border-color, var(--color-border));
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
import { DateInput } from "@ark-ui/react/date-input";
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { DateInput, DateInputDateValue, useDateInput, useDateInputContext } from "@ark-ui/react/date-input";
|
|
3
3
|
|
|
4
4
|
//#region src/components/date-input/DateInput.d.ts
|
|
5
|
+
type DateInputFormProps = {
|
|
6
|
+
names?: readonly string[];
|
|
7
|
+
};
|
|
5
8
|
declare function DateInputSeparator({
|
|
6
9
|
className,
|
|
7
10
|
'aria-hidden': ariaHidden,
|
|
8
11
|
role,
|
|
9
12
|
...props
|
|
10
13
|
}: ComponentProps<'span'>): import("react").JSX.Element;
|
|
11
|
-
declare const DateInput$1: import("react").ForwardRefExoticComponent<Omit<DateInput.RootProps & import("react").RefAttributes<HTMLDivElement
|
|
12
|
-
Root: import("react").ForwardRefExoticComponent<Omit<DateInput.RootProps & import("react").RefAttributes<HTMLDivElement
|
|
13
|
-
RootProvider: import("react").ForwardRefExoticComponent<Omit<DateInput.RootProviderProps & import("react").RefAttributes<HTMLDivElement
|
|
14
|
+
declare const DateInput$1: import("react").ForwardRefExoticComponent<Omit<DateInput.RootProps & import("react").RefAttributes<HTMLDivElement> & DateInputFormProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
15
|
+
Root: import("react").ForwardRefExoticComponent<Omit<DateInput.RootProps & import("react").RefAttributes<HTMLDivElement> & DateInputFormProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
RootProvider: import("react").ForwardRefExoticComponent<Omit<DateInput.RootProviderProps & import("react").RefAttributes<HTMLDivElement> & DateInputFormProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
17
|
Label: import("react").ForwardRefExoticComponent<Omit<DateInput.LabelProps & import("react").RefAttributes<HTMLLabelElement>, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
15
18
|
Control: import("react").ForwardRefExoticComponent<Omit<DateInput.ControlProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
19
|
SegmentGroup: import("react").ForwardRefExoticComponent<Omit<DateInput.SegmentGroupProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
20
|
Segment: import("react").ForwardRefExoticComponent<Omit<DateInput.SegmentProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
18
|
-
|
|
21
|
+
Segments: import("react").ForwardRefExoticComponent<Omit<Omit<DateInput.SegmentGroupProps & import("react").RefAttributes<HTMLDivElement>, "children" | "asChild">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
22
|
Separator: typeof DateInputSeparator;
|
|
23
|
+
Context: (props: DateInput.ContextProps) => ReactNode;
|
|
24
|
+
SegmentContext: (props: DateInput.SegmentContextProps) => import("react").JSX.Element[];
|
|
20
25
|
};
|
|
21
26
|
//#endregion
|
|
22
|
-
export { DateInput$1 as DateInput };
|
|
27
|
+
export { DateInput$1 as DateInput, type DateInputDateValue, useDateInput, useDateInputContext };
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { normalizeClassName } from "../../lib/moduix/normalizeClassName.js";
|
|
2
2
|
import DateInput_module_default from "./DateInput.module.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { clsx } from "clsx";
|
|
5
|
-
import { forwardRef } from "react";
|
|
6
|
-
import {
|
|
4
|
+
import { Children, cloneElement, forwardRef } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { DateInput, useDateInput, useDateInputContext } from "@ark-ui/react/date-input";
|
|
7
7
|
//#region src/components/date-input/DateInput.tsx
|
|
8
|
-
const DateInputRoot = forwardRef(function DateInputRoot({ className, ...props }, ref) {
|
|
8
|
+
const DateInputRoot = forwardRef(function DateInputRoot({ asChild, children, className, names, ...props }, ref) {
|
|
9
9
|
return /* @__PURE__ */ jsx(DateInput.Root, {
|
|
10
10
|
ref,
|
|
11
11
|
"data-slot": "date-input-root",
|
|
12
12
|
className: clsx(DateInput_module_default.root, normalizeClassName(className)),
|
|
13
|
-
|
|
13
|
+
asChild,
|
|
14
|
+
...props,
|
|
15
|
+
children: withHiddenInputs(children, asChild, names)
|
|
14
16
|
});
|
|
15
17
|
});
|
|
16
|
-
const DateInputRootProvider = forwardRef(function DateInputRootProvider({ className, ...props }, ref) {
|
|
18
|
+
const DateInputRootProvider = forwardRef(function DateInputRootProvider({ asChild, children, className, names, ...props }, ref) {
|
|
17
19
|
return /* @__PURE__ */ jsx(DateInput.RootProvider, {
|
|
18
20
|
ref,
|
|
19
21
|
"data-slot": "date-input-root-provider",
|
|
20
22
|
className: clsx(DateInput_module_default.root, normalizeClassName(className)),
|
|
21
|
-
|
|
23
|
+
asChild,
|
|
24
|
+
...props,
|
|
25
|
+
children: withHiddenInputs(children, asChild, names)
|
|
22
26
|
});
|
|
23
27
|
});
|
|
24
28
|
const DateInputLabel = forwardRef(function DateInputLabel({ className, ...props }, ref) {
|
|
@@ -53,13 +57,28 @@ const DateInputSegment = forwardRef(function DateInputSegment({ className, ...pr
|
|
|
53
57
|
...props
|
|
54
58
|
});
|
|
55
59
|
});
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
+
const DateInputSegments = forwardRef(function DateInputSegments(props, ref) {
|
|
61
|
+
return /* @__PURE__ */ jsx(DateInputSegmentGroup, {
|
|
58
62
|
ref,
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsx(DateInput.SegmentContext, { children: (segment) => /* @__PURE__ */ jsx(DateInputSegment, { segment }) })
|
|
61
65
|
});
|
|
62
66
|
});
|
|
67
|
+
function withHiddenInputs(children, asChild, names) {
|
|
68
|
+
const hiddenInputs = /* @__PURE__ */ jsx(DateInputFormInputs, { names });
|
|
69
|
+
if (!asChild) return /* @__PURE__ */ jsxs(Fragment$1, { children: [children, hiddenInputs] });
|
|
70
|
+
const child = Children.only(children);
|
|
71
|
+
return cloneElement(child, {}, child.props.children, hiddenInputs);
|
|
72
|
+
}
|
|
73
|
+
function DateInputFormInputs({ names }) {
|
|
74
|
+
const dateInput = useDateInputContext();
|
|
75
|
+
const inputCount = Math.max(dateInput.displayValues.length, names?.length ?? 0, 1);
|
|
76
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: inputCount }, (_, index) => /* @__PURE__ */ jsx(DateInput.HiddenInput, {
|
|
77
|
+
index,
|
|
78
|
+
name: names?.[index],
|
|
79
|
+
"data-slot": "date-input-hidden-input"
|
|
80
|
+
}, index)) });
|
|
81
|
+
}
|
|
63
82
|
function DateInputSeparator({ className, "aria-hidden": ariaHidden = true, role = "presentation", ...props }) {
|
|
64
83
|
return /* @__PURE__ */ jsx("span", {
|
|
65
84
|
"data-slot": "date-input-separator",
|
|
@@ -76,8 +95,10 @@ const DateInput$1 = Object.assign(DateInputRoot, {
|
|
|
76
95
|
Control: DateInputControl,
|
|
77
96
|
SegmentGroup: DateInputSegmentGroup,
|
|
78
97
|
Segment: DateInputSegment,
|
|
79
|
-
|
|
80
|
-
Separator: DateInputSeparator
|
|
98
|
+
Segments: DateInputSegments,
|
|
99
|
+
Separator: DateInputSeparator,
|
|
100
|
+
Context: DateInput.Context,
|
|
101
|
+
SegmentContext: DateInput.SegmentContext
|
|
81
102
|
});
|
|
82
103
|
//#endregion
|
|
83
|
-
export { DateInput$1 as DateInput };
|
|
104
|
+
export { DateInput$1 as DateInput, useDateInput, useDateInputContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DateInput } from "./DateInput.js";
|
|
2
|
-
export { DateInput };
|
|
1
|
+
import { DateInput, DateInputDateValue, useDateInput, useDateInputContext } from "./DateInput.js";
|
|
2
|
+
export { DateInput, type DateInputDateValue, useDateInput, useDateInputContext };
|