@wow-two-beta/ui 0.0.57 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/button/Button.d.ts +0 -9
- package/dist/actions/buttonGroup/ButtonGroup.d.ts +2 -2
- package/dist/actions/disclosureButton/DisclosureButton.d.ts +1 -1
- package/dist/actions/index.js +4 -4
- package/dist/actions/speedDial/SpeedDial.d.ts +2 -2
- package/dist/actions/toggleButton/ToggleButton.d.ts +1 -1
- package/dist/actions/toggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
- package/dist/{chunk-VR5HH4SX.js → chunk-4XWLEKH2.js} +10 -4
- package/dist/chunk-4XWLEKH2.js.map +1 -0
- package/dist/{chunk-3GZOE7JF.js → chunk-577JZ2A2.js} +3 -3
- package/dist/{chunk-3GZOE7JF.js.map → chunk-577JZ2A2.js.map} +1 -1
- package/dist/{chunk-BI6JZY2O.js → chunk-DJJOQWOG.js} +6 -6
- package/dist/chunk-DJJOQWOG.js.map +1 -0
- package/dist/{chunk-FEXH7YWU.js → chunk-EEHJHPAP.js} +30 -30
- package/dist/chunk-EEHJHPAP.js.map +1 -0
- package/dist/{chunk-5Y43MUOK.js → chunk-EJCO7AWR.js} +11 -11
- package/dist/chunk-EJCO7AWR.js.map +1 -0
- package/dist/{chunk-ZFNGOAHR.js → chunk-EX4AOJCN.js} +58 -58
- package/dist/chunk-EX4AOJCN.js.map +1 -0
- package/dist/{chunk-4WYHY6KV.js → chunk-FNSC4LAL.js} +3 -3
- package/dist/{chunk-4WYHY6KV.js.map → chunk-FNSC4LAL.js.map} +1 -1
- package/dist/{chunk-WOKIYORV.js → chunk-FYG23O4O.js} +262 -28
- package/dist/chunk-FYG23O4O.js.map +1 -0
- package/dist/{chunk-WPTF6ZRR.js → chunk-GSAOM2ZR.js} +67 -38
- package/dist/chunk-GSAOM2ZR.js.map +1 -0
- package/dist/{chunk-JOOE4KS5.js → chunk-HG7NX6GP.js} +509 -380
- package/dist/chunk-HG7NX6GP.js.map +1 -0
- package/dist/{chunk-XDP6GEBA.js → chunk-JYGC5SRP.js} +39 -5
- package/dist/chunk-JYGC5SRP.js.map +1 -0
- package/dist/{chunk-4QOCAFCA.js → chunk-MTD4RTGO.js} +19 -19
- package/dist/chunk-MTD4RTGO.js.map +1 -0
- package/dist/{chunk-USGZGMLY.js → chunk-NR5DYKSJ.js} +3 -3
- package/dist/{chunk-USGZGMLY.js.map → chunk-NR5DYKSJ.js.map} +1 -1
- package/dist/{chunk-VYOQYXK6.js → chunk-OBW7JUNL.js} +12 -12
- package/dist/chunk-OBW7JUNL.js.map +1 -0
- package/dist/{chunk-UI4RT5JF.js → chunk-TTSJZEL7.js} +25 -25
- package/dist/chunk-TTSJZEL7.js.map +1 -0
- package/dist/{chunk-5PMOT5MD.js → chunk-V267IMBH.js} +86 -4
- package/dist/chunk-V267IMBH.js.map +1 -0
- package/dist/{chunk-ZH6BB54G.js → chunk-XDATW7NF.js} +3 -3
- package/dist/{chunk-ZH6BB54G.js.map → chunk-XDATW7NF.js.map} +1 -1
- package/dist/{chunk-4OKJVYBV.js → chunk-Y5GS4CLT.js} +221 -186
- package/dist/chunk-Y5GS4CLT.js.map +1 -0
- package/dist/display/accordion/Accordion.d.ts +15 -11
- package/dist/display/activityFeed/ActivityFeed.d.ts +2 -2
- package/dist/display/annotationMarker/AnnotationMarker.d.ts +6 -7
- package/dist/display/audioPlayer/AudioPlayer.d.ts +1 -1
- package/dist/display/audioWaveform/AudioWaveform.d.ts +1 -1
- package/dist/display/avatar/Avatar.d.ts +1 -1
- package/dist/display/badgeOverlay/BadgeOverlay.d.ts +1 -1
- package/dist/display/carousel/Carousel.d.ts +1 -1
- package/dist/display/chatBubble/ChatBubble.d.ts +2 -2
- package/dist/display/collapsible/Collapsible.d.ts +2 -2
- package/dist/display/commentThread/CommentThread.d.ts +1 -1
- package/dist/display/confetti/Confetti.d.ts +2 -2
- package/dist/display/countBadge/CountBadge.d.ts +3 -4
- package/dist/display/countUp/CountUp.d.ts +2 -2
- package/dist/display/dataGrid/DataGrid.d.ts +2 -2
- package/dist/display/dataTable/DataTable.d.ts +5 -5
- package/dist/display/diffViewer/DiffViewer.d.ts +1 -1
- package/dist/display/eventCalendar/EventCalendar.d.ts +1 -1
- package/dist/display/gantt/Gantt.d.ts +1 -1
- package/dist/display/gradientText/GradientText.d.ts +2 -2
- package/dist/display/heatmapCalendar/HeatmapCalendar.d.ts +1 -1
- package/dist/display/highlight/Highlight.d.ts +2 -2
- package/dist/display/index.js +6 -6
- package/dist/display/list/List.d.ts +2 -2
- package/dist/display/marquee/Marquee.d.ts +1 -1
- package/dist/display/messageList/MessageList.d.ts +3 -3
- package/dist/display/notificationDot/NotificationDot.d.ts +1 -1
- package/dist/display/pdfViewer/PDFViewer.d.ts +1 -1
- package/dist/display/reactionBar/ReactionBar.d.ts +6 -6
- package/dist/display/scrollReveal/ScrollReveal.d.ts +1 -1
- package/dist/display/sectionHeader/SectionHeader.d.ts +1 -1
- package/dist/display/separator/Separator.d.ts +2 -3
- package/dist/display/sparkline/Sparkline.d.ts +1 -1
- package/dist/display/status/Status.d.ts +1 -1
- package/dist/display/swipeActions/SwipeActions.d.ts +1 -1
- package/dist/display/table/Table.d.ts +17 -5
- package/dist/display/table/index.d.ts +1 -1
- package/dist/display/tabs/Tabs.d.ts +1 -1
- package/dist/display/text/Text.variants.d.ts +14 -14
- package/dist/display/threadView/ThreadView.d.ts +2 -2
- package/dist/display/tilt/Tilt.d.ts +2 -3
- package/dist/display/tooltip/Tooltip.d.ts +2 -2
- package/dist/display/tree/Tree.d.ts +2 -2
- package/dist/display/typewriter/Typewriter.d.ts +2 -2
- package/dist/feedback/index.js +6 -6
- package/dist/feedback/liveCursor/LiveCursor.d.ts +4 -6
- package/dist/feedback/loadingOverlay/LoadingOverlay.d.ts +5 -6
- package/dist/feedback/notificationCenter/NotificationCenter.d.ts +1 -1
- package/dist/feedback/onboardingChecklist/OnboardingChecklist.d.ts +3 -3
- package/dist/feedback/presenceIndicator/PresenceIndicator.d.ts +1 -1
- package/dist/feedback/statusIndicator/StatusIndicator.d.ts +1 -1
- package/dist/feedback/toaster/Toaster.d.ts +2 -2
- package/dist/feedback/tour/Tour.d.ts +2 -2
- package/dist/feedback/trendIndicator/TrendIndicator.d.ts +2 -2
- package/dist/feedback/typingIndicator/TypingIndicator.d.ts +1 -1
- package/dist/feedback/undoBar/UndoBar.d.ts +4 -4
- package/dist/forms/addressForm/AddressForm.d.ts +3 -3
- package/dist/forms/characterCount/CharacterCount.d.ts +1 -1
- package/dist/forms/chatComposer/ChatComposer.d.ts +2 -2
- package/dist/forms/checkbox/Checkbox.d.ts +1 -1
- package/dist/forms/checkboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/forms/codeEditor/CodeEditor.d.ts +2 -2
- package/dist/forms/colorArea/ColorArea.d.ts +1 -1
- package/dist/forms/colorField/ColorField.d.ts +1 -1
- package/dist/forms/colorPicker/ColorPicker.d.ts +2 -2
- package/dist/forms/colorSlider/ColorSlider.d.ts +1 -1
- package/dist/forms/colorSwatch/ColorSwatch.variants.d.ts +14 -14
- package/dist/forms/colorSwatchPicker/ColorSwatchPicker.d.ts +2 -2
- package/dist/forms/colorWheel/ColorWheel.d.ts +1 -1
- package/dist/forms/combobox/Combobox.d.ts +4 -4
- package/dist/forms/cronInput/CronInput.d.ts +2 -2
- package/dist/forms/datePicker/DatePicker.d.ts +1 -1
- package/dist/forms/dateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/forms/editable/Editable.d.ts +7 -7
- package/dist/forms/emojiPicker/EmojiPicker.d.ts +1 -1
- package/dist/forms/fileUpload/FileUpload.d.ts +1 -1
- package/dist/forms/fontPicker/FontPicker.d.ts +1 -1
- package/dist/forms/gradientPicker/GradientPicker.d.ts +1 -1
- package/dist/forms/iconPicker/IconPicker.d.ts +1 -1
- package/dist/forms/index.js +11 -11
- package/dist/forms/jsonEditor/JSONEditor.d.ts +3 -3
- package/dist/forms/knob/Knob.d.ts +2 -2
- package/dist/forms/label/Label.d.ts +1 -1
- package/dist/forms/listbox/Listbox.d.ts +8 -4
- package/dist/forms/markdownEditor/MarkdownEditor.d.ts +1 -1
- package/dist/forms/multiSelect/MultiSelect.d.ts +4 -4
- package/dist/forms/passwordInput/PasswordInput.d.ts +1 -1
- package/dist/forms/passwordStrength/PasswordStrength.d.ts +1 -1
- package/dist/forms/phoneInput/PhoneInput.d.ts +3 -3
- package/dist/forms/pinInput/PinInput.d.ts +2 -2
- package/dist/forms/radioGroup/RadioGroup.d.ts +1 -1
- package/dist/forms/reactionPicker/ReactionPicker.d.ts +1 -1
- package/dist/forms/recurrenceEditor/RecurrenceEditor.d.ts +2 -2
- package/dist/forms/searchInput/SearchInput.d.ts +1 -1
- package/dist/forms/select/Select.d.ts +14 -7
- package/dist/forms/select/Select.variants.d.ts +46 -3
- package/dist/forms/stepper/Stepper.d.ts +1 -1
- package/dist/forms/tagsInput/TagsInput.d.ts +2 -2
- package/dist/forms/timePicker/TimePicker.d.ts +1 -1
- package/dist/forms/wizard/Wizard.d.ts +5 -5
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useTypeahead.d.ts +37 -0
- package/dist/icons/index.js +1 -1
- package/dist/index.js +18 -18
- package/dist/layout/appShell/AppShell.d.ts +2 -2
- package/dist/layout/frame/Frame.d.ts +1 -1
- package/dist/layout/grid/Grid.d.ts +17 -5
- package/dist/layout/grid/Grid.variants.d.ts +15 -0
- package/dist/layout/grid/index.d.ts +1 -1
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +9 -9
- package/dist/layout/inline/Inline.d.ts +5 -0
- package/dist/layout/navbar/Navbar.d.ts +37 -0
- package/dist/layout/navbar/Navbar.variants.d.ts +76 -0
- package/dist/layout/navbar/index.d.ts +2 -0
- package/dist/layout/pullToRefresh/PullToRefresh.d.ts +1 -1
- package/dist/layout/resizablePanels/ResizablePanels.d.ts +1 -1
- package/dist/layout/section/Section.d.ts +26 -0
- package/dist/layout/section/Section.variants.d.ts +62 -0
- package/dist/layout/section/index.d.ts +2 -0
- package/dist/nav/commandPalette/CommandPalette.d.ts +1 -1
- package/dist/nav/contextMenu/ContextMenu.d.ts +1 -1
- package/dist/nav/index.js +8 -8
- package/dist/nav/menu/Menu.d.ts +1 -1
- package/dist/nav/navItem/NavItem.d.ts +2 -3
- package/dist/nav/tableOfContents/TableOfContents.d.ts +1 -1
- package/dist/overlays/actionSheet/ActionSheet.d.ts +1 -1
- package/dist/overlays/backdrop/Backdrop.d.ts +3 -6
- package/dist/overlays/dialog/Dialog.d.ts +1 -1
- package/dist/overlays/drawer/Drawer.d.ts +1 -1
- package/dist/overlays/index.js +8 -8
- package/dist/overlays/popover/Popover.d.ts +1 -1
- package/dist/primitives/anchoredPositioner/AnchoredPositioner.d.ts +1 -1
- package/dist/primitives/dismissableLayer/DismissableLayer.d.ts +2 -2
- package/dist/primitives/index.js +1 -1
- package/dist/primitives/presence/Presence.d.ts +3 -3
- package/dist/primitives/rovingFocusGroup/RovingFocusGroup.d.ts +3 -6
- package/dist/primitives/scrollLockProvider/ScrollLockProvider.d.ts +2 -2
- package/dist/utils/Environment.d.ts +8 -0
- package/dist/utils/SurfaceStyles.d.ts +7 -0
- package/dist/utils/Tones.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4OKJVYBV.js.map +0 -1
- package/dist/chunk-4QOCAFCA.js.map +0 -1
- package/dist/chunk-5PMOT5MD.js.map +0 -1
- package/dist/chunk-5Y43MUOK.js.map +0 -1
- package/dist/chunk-BI6JZY2O.js.map +0 -1
- package/dist/chunk-FEXH7YWU.js.map +0 -1
- package/dist/chunk-JOOE4KS5.js.map +0 -1
- package/dist/chunk-UI4RT5JF.js.map +0 -1
- package/dist/chunk-VR5HH4SX.js.map +0 -1
- package/dist/chunk-VYOQYXK6.js.map +0 -1
- package/dist/chunk-WOKIYORV.js.map +0 -1
- package/dist/chunk-WPTF6ZRR.js.map +0 -1
- package/dist/chunk-XDP6GEBA.js.map +0 -1
- package/dist/chunk-ZFNGOAHR.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { listboxItemVariants, listboxVariants, listboxGroupLabelVariants, listboxSeparatorVariants, listboxEmptyVariants } from './chunk-
|
|
2
|
-
import { PopoverTrigger, Popover, PopoverContent } from './chunk-
|
|
3
|
-
import { startOfMonth, isSameDay, isToday, isDateDisabled, parseISODate, formatISODate, parseISOTime, Tag, addMonths, Kbd, addDays, buildMonthGrid, MONTHS_LONG, WEEKDAYS_SHORT, formatISOTime, startOfDay, isInRange } from './chunk-
|
|
4
|
-
import { useControlled } from './chunk-
|
|
1
|
+
import { listboxItemVariants, listboxVariants, listboxGroupLabelVariants, listboxSeparatorVariants, listboxEmptyVariants } from './chunk-577JZ2A2.js';
|
|
2
|
+
import { PopoverTrigger, Popover, PopoverContent } from './chunk-MTD4RTGO.js';
|
|
3
|
+
import { startOfMonth, isSameDay, isToday, isDateDisabled, parseISODate, formatISODate, parseISOTime, Tag, addMonths, Kbd, addDays, buildMonthGrid, MONTHS_LONG, WEEKDAYS_SHORT, formatISOTime, startOfDay, isInRange } from './chunk-XDATW7NF.js';
|
|
4
|
+
import { useControlled, useTypeahead } from './chunk-V267IMBH.js';
|
|
5
5
|
import { Icon } from './chunk-MVMDDGW7.js';
|
|
6
|
-
import { tv, CssExtensions, ColorExtensions, dataAttr, surfaceVariants, Equality } from './chunk-
|
|
7
|
-
import { useFormControl, FormControlProvider, RovingFocusGroup, useRovingFocusItem, Portal, AnchoredPositioner, DismissableLayer } from './chunk-
|
|
6
|
+
import { tv, CssExtensions, ColorExtensions, dataAttr, surfaceVariants, Equality } from './chunk-JYGC5SRP.js';
|
|
7
|
+
import { useFormControl, FormControlProvider, Announce, RovingFocusGroup, useRovingFocusItem, Portal, AnchoredPositioner, DismissableLayer } from './chunk-TTSJZEL7.js';
|
|
8
8
|
import { useId } from './chunk-LGTGZ3RW.js';
|
|
9
9
|
import { cn, composeRefs } from './chunk-X2MYOHOB.js';
|
|
10
10
|
import * as React from 'react';
|
|
@@ -19,9 +19,9 @@ var SIZE = {
|
|
|
19
19
|
md: "text-sm"
|
|
20
20
|
};
|
|
21
21
|
var Label = forwardRef(
|
|
22
|
-
({ className,
|
|
22
|
+
({ className, isRequired: isRequiredProp, size = "md", htmlFor, id, children, ...props }, ref) => {
|
|
23
23
|
const ctx = useFormControl();
|
|
24
|
-
const isRequired =
|
|
24
|
+
const isRequired = isRequiredProp ?? ctx?.isRequired ?? false;
|
|
25
25
|
return /* @__PURE__ */ jsxs(
|
|
26
26
|
"label",
|
|
27
27
|
{
|
|
@@ -285,7 +285,7 @@ var PasswordInput = forwardRef(
|
|
|
285
285
|
disabled,
|
|
286
286
|
required,
|
|
287
287
|
readOnly,
|
|
288
|
-
|
|
288
|
+
hasToggle = true,
|
|
289
289
|
autoComplete = "current-password",
|
|
290
290
|
...props
|
|
291
291
|
}, ref) => {
|
|
@@ -307,11 +307,11 @@ var PasswordInput = forwardRef(
|
|
|
307
307
|
readOnly: readOnly ?? ctx?.isReadOnly,
|
|
308
308
|
"aria-invalid": ctx?.isInvalid || void 0,
|
|
309
309
|
"aria-describedby": ctx ? `${ctx.helperId} ${ctx.errorId}` : void 0,
|
|
310
|
-
className: cn(inputBaseVariants({ size, state: finalState }),
|
|
310
|
+
className: cn(inputBaseVariants({ size, state: finalState }), hasToggle && "pr-10"),
|
|
311
311
|
...props
|
|
312
312
|
}
|
|
313
313
|
),
|
|
314
|
-
|
|
314
|
+
hasToggle && /* @__PURE__ */ jsx(
|
|
315
315
|
"button",
|
|
316
316
|
{
|
|
317
317
|
type: "button",
|
|
@@ -336,7 +336,7 @@ var SearchInput = forwardRef(
|
|
|
336
336
|
disabled,
|
|
337
337
|
required,
|
|
338
338
|
readOnly,
|
|
339
|
-
|
|
339
|
+
isClearable = true,
|
|
340
340
|
onClear,
|
|
341
341
|
onChange,
|
|
342
342
|
defaultValue,
|
|
@@ -351,7 +351,7 @@ var SearchInput = forwardRef(
|
|
|
351
351
|
const isControlled = value !== void 0;
|
|
352
352
|
const [uncontrolled, setUncontrolled] = useState(defaultValue ?? "");
|
|
353
353
|
const currentValue = isControlled ? value : uncontrolled;
|
|
354
|
-
const showClear =
|
|
354
|
+
const showClear = isClearable && String(currentValue ?? "").length > 0;
|
|
355
355
|
const handleClear = () => {
|
|
356
356
|
const el = inputRef.current;
|
|
357
357
|
if (el) {
|
|
@@ -580,7 +580,7 @@ var Checkbox = forwardRef(
|
|
|
580
580
|
({
|
|
581
581
|
className,
|
|
582
582
|
size = "md",
|
|
583
|
-
|
|
583
|
+
isIndeterminate,
|
|
584
584
|
variant = "solid",
|
|
585
585
|
tone = "primary",
|
|
586
586
|
color,
|
|
@@ -594,8 +594,8 @@ var Checkbox = forwardRef(
|
|
|
594
594
|
const isDisabled = disabled ?? ctx?.isDisabled;
|
|
595
595
|
const inputRef = useRef(null);
|
|
596
596
|
useEffect(() => {
|
|
597
|
-
if (inputRef.current) inputRef.current.indeterminate = Boolean(
|
|
598
|
-
}, [
|
|
597
|
+
if (inputRef.current) inputRef.current.indeterminate = Boolean(isIndeterminate);
|
|
598
|
+
}, [isIndeterminate]);
|
|
599
599
|
const { preset: sizePreset, box: sizeBox } = CssExtensions.parseSizeUnion(
|
|
600
600
|
size,
|
|
601
601
|
CHECKBOX_SIZE_PRESETS
|
|
@@ -620,7 +620,7 @@ var Checkbox = forwardRef(
|
|
|
620
620
|
disabled: isDisabled,
|
|
621
621
|
required: required ?? ctx?.isRequired,
|
|
622
622
|
checked,
|
|
623
|
-
"aria-checked":
|
|
623
|
+
"aria-checked": isIndeterminate ? "mixed" : void 0,
|
|
624
624
|
"aria-invalid": ctx?.isInvalid || void 0,
|
|
625
625
|
"aria-describedby": ctx ? `${ctx.helperId} ${ctx.errorId}` : void 0,
|
|
626
626
|
className: "peer absolute inset-0 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
@@ -633,9 +633,9 @@ var Checkbox = forwardRef(
|
|
|
633
633
|
"aria-hidden": "true",
|
|
634
634
|
className: cn(
|
|
635
635
|
checkboxVariants({ variant, tone }),
|
|
636
|
-
|
|
636
|
+
isIndeterminate ? INDETERMINATE_CHECKED_CLASS[variant][tone] : "[&>svg]:opacity-0 peer-checked:[&>svg]:opacity-100"
|
|
637
637
|
),
|
|
638
|
-
children:
|
|
638
|
+
children: isIndeterminate ? /* @__PURE__ */ jsx(Minus, { className: iconClass }) : /* @__PURE__ */ jsx(Check, { className: iconClass })
|
|
639
639
|
}
|
|
640
640
|
)
|
|
641
641
|
]
|
|
@@ -873,7 +873,7 @@ var CheckboxGroup = forwardRef(
|
|
|
873
873
|
value,
|
|
874
874
|
defaultValue,
|
|
875
875
|
onValueChange,
|
|
876
|
-
|
|
876
|
+
isDisabled,
|
|
877
877
|
orientation = "vertical",
|
|
878
878
|
className,
|
|
879
879
|
children,
|
|
@@ -888,7 +888,7 @@ var CheckboxGroup = forwardRef(
|
|
|
888
888
|
if (v === void 0) return;
|
|
889
889
|
setSelected(selected.includes(v) ? selected.filter((x) => x !== v) : [...selected, v]);
|
|
890
890
|
};
|
|
891
|
-
return /* @__PURE__ */ jsxs(Fieldset, { ref, disabled, className: cn(className), ...props, children: [
|
|
891
|
+
return /* @__PURE__ */ jsxs(Fieldset, { ref, disabled: isDisabled, className: cn(className), ...props, children: [
|
|
892
892
|
legend && /* @__PURE__ */ jsx(Legend, { children: legend }),
|
|
893
893
|
/* @__PURE__ */ jsx("div", { className: cn("flex gap-3", orientation === "vertical" ? "flex-col" : "flex-row flex-wrap"), children: Children.map(children, (child) => {
|
|
894
894
|
if (!isValidElement(child)) return child;
|
|
@@ -910,7 +910,7 @@ var RadioGroup = forwardRef(
|
|
|
910
910
|
value,
|
|
911
911
|
defaultValue,
|
|
912
912
|
onValueChange,
|
|
913
|
-
|
|
913
|
+
isDisabled,
|
|
914
914
|
orientation = "vertical",
|
|
915
915
|
className,
|
|
916
916
|
children,
|
|
@@ -923,7 +923,7 @@ var RadioGroup = forwardRef(
|
|
|
923
923
|
default: defaultValue ?? null,
|
|
924
924
|
onChange: onValueChange
|
|
925
925
|
});
|
|
926
|
-
return /* @__PURE__ */ jsxs(Fieldset, { ref, disabled, className: cn(className), ...props, children: [
|
|
926
|
+
return /* @__PURE__ */ jsxs(Fieldset, { ref, disabled: isDisabled, className: cn(className), ...props, children: [
|
|
927
927
|
legend && /* @__PURE__ */ jsx(Legend, { children: legend }),
|
|
928
928
|
/* @__PURE__ */ jsx("div", { className: cn("flex gap-3", orientation === "vertical" ? "flex-col" : "flex-row flex-wrap"), children: Children.map(children, (child) => {
|
|
929
929
|
if (!isValidElement(child)) return child;
|
|
@@ -953,8 +953,8 @@ var PinInput = forwardRef(
|
|
|
953
953
|
onComplete,
|
|
954
954
|
type = "numeric",
|
|
955
955
|
size = "md",
|
|
956
|
-
|
|
957
|
-
|
|
956
|
+
isMasked,
|
|
957
|
+
isDisabled,
|
|
958
958
|
className,
|
|
959
959
|
...props
|
|
960
960
|
}, ref) => {
|
|
@@ -1007,11 +1007,11 @@ var PinInput = forwardRef(
|
|
|
1007
1007
|
ref: (el) => {
|
|
1008
1008
|
inputs.current[i] = el;
|
|
1009
1009
|
},
|
|
1010
|
-
type:
|
|
1010
|
+
type: isMasked ? "password" : "text",
|
|
1011
1011
|
inputMode: type === "numeric" ? "numeric" : "text",
|
|
1012
1012
|
autoComplete: "one-time-code",
|
|
1013
1013
|
maxLength: 1,
|
|
1014
|
-
disabled,
|
|
1014
|
+
disabled: isDisabled,
|
|
1015
1015
|
value: ch,
|
|
1016
1016
|
onChange: (e) => handleChange(i, e.target.value),
|
|
1017
1017
|
onKeyDown: (e) => handleKeyDown(i, e),
|
|
@@ -1109,7 +1109,7 @@ var PercentInput = forwardRef(
|
|
|
1109
1109
|
);
|
|
1110
1110
|
PercentInput.displayName = "PercentInput";
|
|
1111
1111
|
var CharacterCount = forwardRef(
|
|
1112
|
-
({ value, max,
|
|
1112
|
+
({ value, max, isMaxShown = true, className, ...props }, ref) => {
|
|
1113
1113
|
const over = value > max;
|
|
1114
1114
|
return /* @__PURE__ */ jsxs(
|
|
1115
1115
|
"div",
|
|
@@ -1124,7 +1124,7 @@ var CharacterCount = forwardRef(
|
|
|
1124
1124
|
...props,
|
|
1125
1125
|
children: [
|
|
1126
1126
|
value,
|
|
1127
|
-
|
|
1127
|
+
isMaxShown && ` / ${max}`
|
|
1128
1128
|
]
|
|
1129
1129
|
}
|
|
1130
1130
|
);
|
|
@@ -1229,7 +1229,7 @@ function scorePassword(pw) {
|
|
|
1229
1229
|
return Math.min(4, score);
|
|
1230
1230
|
}
|
|
1231
1231
|
var PasswordStrength = forwardRef(
|
|
1232
|
-
({ value, score,
|
|
1232
|
+
({ value, score, isLabelHidden, className, ...props }, ref) => {
|
|
1233
1233
|
const s = score ?? (value.length === 0 ? 0 : scorePassword(value));
|
|
1234
1234
|
const label = LABELS[s] ?? "";
|
|
1235
1235
|
const tone = TONE[s] ?? "bg-destructive";
|
|
@@ -1244,7 +1244,7 @@ var PasswordStrength = forwardRef(
|
|
|
1244
1244
|
},
|
|
1245
1245
|
i
|
|
1246
1246
|
)) }),
|
|
1247
|
-
!
|
|
1247
|
+
!isLabelHidden && value && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: label })
|
|
1248
1248
|
] });
|
|
1249
1249
|
}
|
|
1250
1250
|
);
|
|
@@ -1303,26 +1303,27 @@ function useListboxContext() {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
function ListboxImpl(props, ref) {
|
|
1305
1305
|
const {
|
|
1306
|
-
|
|
1306
|
+
isMultiple = false,
|
|
1307
1307
|
value,
|
|
1308
1308
|
defaultValue,
|
|
1309
1309
|
onValueChange,
|
|
1310
1310
|
isEqual,
|
|
1311
1311
|
indicator,
|
|
1312
|
+
onActiveChange,
|
|
1312
1313
|
variant,
|
|
1313
1314
|
tone,
|
|
1314
1315
|
radius,
|
|
1315
1316
|
padding,
|
|
1316
1317
|
elevation,
|
|
1317
|
-
|
|
1318
|
+
isDisabled,
|
|
1318
1319
|
className,
|
|
1319
1320
|
children,
|
|
1320
1321
|
onKeyDown,
|
|
1321
1322
|
...rest
|
|
1322
1323
|
} = props;
|
|
1323
1324
|
const equals = isEqual ?? defaultEquals;
|
|
1324
|
-
const resolvedIndicator = indicator ?? (
|
|
1325
|
-
const initial = defaultValue ?? (
|
|
1325
|
+
const resolvedIndicator = indicator ?? (isMultiple ? "checkbox" : "check");
|
|
1326
|
+
const initial = defaultValue ?? (isMultiple ? [] : void 0);
|
|
1326
1327
|
const [current, setCurrent] = useControlled({
|
|
1327
1328
|
controlled: value,
|
|
1328
1329
|
default: initial,
|
|
@@ -1344,7 +1345,7 @@ function ListboxImpl(props, ref) {
|
|
|
1344
1345
|
}, []);
|
|
1345
1346
|
const onItemSelect = useCallback(
|
|
1346
1347
|
(next) => {
|
|
1347
|
-
if (
|
|
1348
|
+
if (isMultiple) {
|
|
1348
1349
|
const cur = Array.isArray(current) ? current : [];
|
|
1349
1350
|
const has = cur.some((v) => equals(v, next));
|
|
1350
1351
|
const out = has ? cur.filter((v) => !equals(v, next)) : [...cur, next];
|
|
@@ -1353,19 +1354,28 @@ function ListboxImpl(props, ref) {
|
|
|
1353
1354
|
setCurrent(next);
|
|
1354
1355
|
}
|
|
1355
1356
|
},
|
|
1356
|
-
[
|
|
1357
|
+
[isMultiple, current, setCurrent, equals]
|
|
1357
1358
|
);
|
|
1358
1359
|
useEffect(() => {
|
|
1359
1360
|
if (activeId) return;
|
|
1360
1361
|
const firstSelected = items.current.find(
|
|
1361
|
-
(i) => !i.
|
|
1362
|
+
(i) => !i.isDisabled && values.some((v) => equals(v, i.value))
|
|
1362
1363
|
);
|
|
1363
|
-
const firstEnabled = items.current.find((i) => !i.
|
|
1364
|
+
const firstEnabled = items.current.find((i) => !i.isDisabled);
|
|
1364
1365
|
setActiveId((firstSelected ?? firstEnabled)?.id ?? null);
|
|
1365
1366
|
}, []);
|
|
1367
|
+
const onActiveChangeRef = useRef(onActiveChange);
|
|
1368
|
+
onActiveChangeRef.current = onActiveChange;
|
|
1369
|
+
useEffect(() => {
|
|
1370
|
+
onActiveChangeRef.current?.(activeId);
|
|
1371
|
+
}, [activeId]);
|
|
1372
|
+
const activateById = useCallback((id) => {
|
|
1373
|
+
setActiveId(id);
|
|
1374
|
+
document.getElementById(id)?.scrollIntoView({ block: "nearest" });
|
|
1375
|
+
}, []);
|
|
1366
1376
|
const moveActive = useCallback(
|
|
1367
1377
|
(direction, jump = 1) => {
|
|
1368
|
-
const list = items.current.filter((i) => !i.
|
|
1378
|
+
const list = items.current.filter((i) => !i.isDisabled);
|
|
1369
1379
|
if (list.length === 0) return;
|
|
1370
1380
|
const currentIdx = list.findIndex((i) => i.id === activeId);
|
|
1371
1381
|
let nextIdx = currentIdx + direction * jump;
|
|
@@ -1373,17 +1383,25 @@ function ListboxImpl(props, ref) {
|
|
|
1373
1383
|
if (nextIdx < 0) nextIdx = 0;
|
|
1374
1384
|
if (nextIdx >= list.length) nextIdx = list.length - 1;
|
|
1375
1385
|
const nextEntry = list[nextIdx];
|
|
1376
|
-
if (nextEntry)
|
|
1377
|
-
setActiveId(nextEntry.id);
|
|
1378
|
-
document.getElementById(nextEntry.id)?.scrollIntoView({ block: "nearest" });
|
|
1379
|
-
}
|
|
1386
|
+
if (nextEntry) activateById(nextEntry.id);
|
|
1380
1387
|
},
|
|
1381
|
-
[activeId]
|
|
1388
|
+
[activeId, activateById]
|
|
1382
1389
|
);
|
|
1390
|
+
const typeahead = useTypeahead({
|
|
1391
|
+
items: () => items.current,
|
|
1392
|
+
getLabel: (entry) => document.getElementById(entry.id)?.textContent ?? "",
|
|
1393
|
+
isDisabled: (entry) => entry.isDisabled,
|
|
1394
|
+
getActiveIndex: () => items.current.findIndex((i) => i.id === activeId),
|
|
1395
|
+
onMatch: (entry) => activateById(entry.id)
|
|
1396
|
+
});
|
|
1383
1397
|
const handleKeyDown = useCallback(
|
|
1384
1398
|
(event) => {
|
|
1385
1399
|
onKeyDown?.(event);
|
|
1386
|
-
if (event.defaultPrevented ||
|
|
1400
|
+
if (event.defaultPrevented || isDisabled) return;
|
|
1401
|
+
if (typeahead.onKeyDown(event)) {
|
|
1402
|
+
event.preventDefault();
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1387
1405
|
switch (event.key) {
|
|
1388
1406
|
case "ArrowDown":
|
|
1389
1407
|
event.preventDefault();
|
|
@@ -1413,18 +1431,18 @@ function ListboxImpl(props, ref) {
|
|
|
1413
1431
|
case " ": {
|
|
1414
1432
|
if (!activeId) return;
|
|
1415
1433
|
const entry = items.current.find((i) => i.id === activeId);
|
|
1416
|
-
if (!entry || entry.
|
|
1434
|
+
if (!entry || entry.isDisabled) return;
|
|
1417
1435
|
event.preventDefault();
|
|
1418
1436
|
onItemSelect(entry.value);
|
|
1419
1437
|
break;
|
|
1420
1438
|
}
|
|
1421
1439
|
}
|
|
1422
1440
|
},
|
|
1423
|
-
[activeId,
|
|
1441
|
+
[activeId, isDisabled, moveActive, onItemSelect, onKeyDown, typeahead]
|
|
1424
1442
|
);
|
|
1425
1443
|
const ctx = useMemo(
|
|
1426
1444
|
() => ({
|
|
1427
|
-
|
|
1445
|
+
isMultiple,
|
|
1428
1446
|
values,
|
|
1429
1447
|
isEqual: equals,
|
|
1430
1448
|
activeId,
|
|
@@ -1433,10 +1451,10 @@ function ListboxImpl(props, ref) {
|
|
|
1433
1451
|
unregisterItem,
|
|
1434
1452
|
setActiveId,
|
|
1435
1453
|
indicator: resolvedIndicator,
|
|
1436
|
-
|
|
1454
|
+
isDisabled: isDisabled ?? false
|
|
1437
1455
|
}),
|
|
1438
1456
|
[
|
|
1439
|
-
|
|
1457
|
+
isMultiple,
|
|
1440
1458
|
values,
|
|
1441
1459
|
equals,
|
|
1442
1460
|
activeId,
|
|
@@ -1444,7 +1462,7 @@ function ListboxImpl(props, ref) {
|
|
|
1444
1462
|
registerItem,
|
|
1445
1463
|
unregisterItem,
|
|
1446
1464
|
resolvedIndicator,
|
|
1447
|
-
|
|
1465
|
+
isDisabled
|
|
1448
1466
|
]
|
|
1449
1467
|
);
|
|
1450
1468
|
const resolvedPadding = padding ?? "xs";
|
|
@@ -1453,10 +1471,10 @@ function ListboxImpl(props, ref) {
|
|
|
1453
1471
|
{
|
|
1454
1472
|
ref,
|
|
1455
1473
|
role: "listbox",
|
|
1456
|
-
tabIndex:
|
|
1457
|
-
"aria-multiselectable":
|
|
1474
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
1475
|
+
"aria-multiselectable": isMultiple || void 0,
|
|
1458
1476
|
"aria-activedescendant": activeId ?? void 0,
|
|
1459
|
-
"aria-disabled":
|
|
1477
|
+
"aria-disabled": isDisabled || void 0,
|
|
1460
1478
|
onKeyDown: handleKeyDown,
|
|
1461
1479
|
className: cn(
|
|
1462
1480
|
surfaceVariants({ variant, tone, radius, padding: resolvedPadding, elevation }),
|
|
@@ -1516,25 +1534,25 @@ function LeadingIndicator({
|
|
|
1516
1534
|
function TrailingIndicator({
|
|
1517
1535
|
indicator,
|
|
1518
1536
|
isSelected,
|
|
1519
|
-
|
|
1537
|
+
isMultiple
|
|
1520
1538
|
}) {
|
|
1521
1539
|
if (indicator === "check" && isSelected) {
|
|
1522
|
-
return /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4 shrink-0", !
|
|
1540
|
+
return /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4 shrink-0", !isMultiple && "opacity-80") });
|
|
1523
1541
|
}
|
|
1524
1542
|
return null;
|
|
1525
1543
|
}
|
|
1526
|
-
var ListboxItem = forwardRef(function ListboxItem2({ value,
|
|
1544
|
+
var ListboxItem = forwardRef(function ListboxItem2({ value, isDisabled = false, indicator: itemIndicator, className, children, onClick, onPointerEnter, ...rest }, forwardedRef) {
|
|
1527
1545
|
const ctx = useListboxContext();
|
|
1528
1546
|
const id = useId$1();
|
|
1529
1547
|
const ref = useRef(null);
|
|
1530
1548
|
const indicator = itemIndicator ?? ctx.indicator;
|
|
1531
1549
|
useEffect(() => {
|
|
1532
|
-
ctx.registerItem({ id, value,
|
|
1550
|
+
ctx.registerItem({ id, value, isDisabled });
|
|
1533
1551
|
return () => ctx.unregisterItem(id);
|
|
1534
|
-
}, [ctx, id, value,
|
|
1552
|
+
}, [ctx, id, value, isDisabled]);
|
|
1535
1553
|
const isSelected = ctx.values.some((v) => ctx.isEqual(v, value));
|
|
1536
1554
|
const isActive = ctx.activeId === id;
|
|
1537
|
-
const state =
|
|
1555
|
+
const state = isDisabled ? "disabled" : isSelected ? "selected" : isActive ? "active" : "default";
|
|
1538
1556
|
const setRefs = (node) => {
|
|
1539
1557
|
ref.current = node;
|
|
1540
1558
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
@@ -1547,25 +1565,25 @@ var ListboxItem = forwardRef(function ListboxItem2({ value, disabled = false, in
|
|
|
1547
1565
|
id,
|
|
1548
1566
|
role: "option",
|
|
1549
1567
|
"aria-selected": isSelected,
|
|
1550
|
-
"aria-disabled":
|
|
1568
|
+
"aria-disabled": isDisabled || void 0,
|
|
1551
1569
|
"data-active": isActive ? "" : void 0,
|
|
1552
1570
|
"data-selected": isSelected ? "" : void 0,
|
|
1553
|
-
"data-disabled":
|
|
1571
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
1554
1572
|
onClick: (e) => {
|
|
1555
1573
|
onClick?.(e);
|
|
1556
|
-
if (e.defaultPrevented ||
|
|
1574
|
+
if (e.defaultPrevented || isDisabled || ctx.isDisabled) return;
|
|
1557
1575
|
ctx.onItemSelect(value);
|
|
1558
1576
|
},
|
|
1559
1577
|
onPointerEnter: (e) => {
|
|
1560
1578
|
onPointerEnter?.(e);
|
|
1561
|
-
if (!
|
|
1579
|
+
if (!isDisabled) ctx.setActiveId(id);
|
|
1562
1580
|
},
|
|
1563
1581
|
className: cn(listboxItemVariants({ state }), className),
|
|
1564
1582
|
...rest,
|
|
1565
1583
|
children: [
|
|
1566
1584
|
/* @__PURE__ */ jsx(LeadingIndicator, { indicator, isSelected }),
|
|
1567
|
-
/* @__PURE__ */ jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2", children }),
|
|
1568
|
-
/* @__PURE__ */ jsx(TrailingIndicator, { indicator, isSelected,
|
|
1585
|
+
/* @__PURE__ */ jsx("span", { "data-listbox-item-content": true, className: "flex min-w-0 flex-1 items-center gap-2", children }),
|
|
1586
|
+
/* @__PURE__ */ jsx(TrailingIndicator, { indicator, isSelected, isMultiple: ctx.isMultiple })
|
|
1569
1587
|
]
|
|
1570
1588
|
}
|
|
1571
1589
|
);
|
|
@@ -1591,22 +1609,15 @@ Listbox.Empty = ListboxEmpty;
|
|
|
1591
1609
|
|
|
1592
1610
|
// src/forms/select/Select.variants.ts
|
|
1593
1611
|
var selectTriggerVariants = tv({
|
|
1594
|
-
|
|
1612
|
+
extend: inputBaseVariants,
|
|
1613
|
+
base: "items-center justify-between gap-2 data-[state=open]:border-border-strong",
|
|
1595
1614
|
variants: {
|
|
1596
1615
|
size: {
|
|
1597
|
-
xs: "
|
|
1598
|
-
sm: "
|
|
1599
|
-
md: "
|
|
1600
|
-
lg: "
|
|
1601
|
-
},
|
|
1602
|
-
state: {
|
|
1603
|
-
default: "border-input hover:border-border-strong",
|
|
1604
|
-
invalid: "border-destructive focus-visible:ring-destructive"
|
|
1616
|
+
xs: "gap-1.5",
|
|
1617
|
+
sm: "",
|
|
1618
|
+
md: "",
|
|
1619
|
+
lg: ""
|
|
1605
1620
|
}
|
|
1606
|
-
},
|
|
1607
|
-
defaultVariants: {
|
|
1608
|
-
size: "md",
|
|
1609
|
-
state: "default"
|
|
1610
1621
|
}
|
|
1611
1622
|
});
|
|
1612
1623
|
var SelectContext = createContext(null);
|
|
@@ -1620,18 +1631,24 @@ function SelectImpl({
|
|
|
1620
1631
|
defaultValue,
|
|
1621
1632
|
onValueChange,
|
|
1622
1633
|
keyEquals,
|
|
1623
|
-
|
|
1634
|
+
isDisabled,
|
|
1624
1635
|
isLoading = false,
|
|
1625
|
-
|
|
1636
|
+
loadingLabel = "Loading options\u2026",
|
|
1637
|
+
isClearable = false,
|
|
1638
|
+
clearLabel = "Clear selection",
|
|
1626
1639
|
name,
|
|
1627
1640
|
serializeKey,
|
|
1628
|
-
|
|
1641
|
+
getOptionLabel,
|
|
1642
|
+
isInvalid,
|
|
1629
1643
|
defaultOpen = false,
|
|
1630
1644
|
open: openProp,
|
|
1631
1645
|
onOpenChange,
|
|
1632
1646
|
placement = "bottom",
|
|
1633
1647
|
children
|
|
1634
1648
|
}) {
|
|
1649
|
+
const field = useFormControl();
|
|
1650
|
+
const finalDisabled = isDisabled ?? field?.isDisabled ?? false;
|
|
1651
|
+
const finalInvalid = isInvalid ?? field?.isInvalid ?? false;
|
|
1635
1652
|
const [openState, setOpenState] = useControlled({
|
|
1636
1653
|
controlled: openProp,
|
|
1637
1654
|
default: defaultOpen,
|
|
@@ -1644,12 +1661,18 @@ function SelectImpl({
|
|
|
1644
1661
|
onChange: void 0
|
|
1645
1662
|
});
|
|
1646
1663
|
const [items, setItems] = useState([]);
|
|
1664
|
+
const labelCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
1647
1665
|
const [query, setQuery] = useState("");
|
|
1666
|
+
const [activeDescendant, setActiveDescendant] = useState(null);
|
|
1667
|
+
const generatedListboxId = useId("select-listbox");
|
|
1668
|
+
const listboxRef = useRef(null);
|
|
1648
1669
|
const [selectedEntry, setSelectedEntry] = useState(null);
|
|
1649
1670
|
const keyEqualsRef = useRef(keyEquals);
|
|
1650
1671
|
keyEqualsRef.current = keyEquals;
|
|
1651
1672
|
const serializeKeyRef = useRef(serializeKey);
|
|
1652
1673
|
serializeKeyRef.current = serializeKey;
|
|
1674
|
+
const getOptionLabelRef = useRef(getOptionLabel);
|
|
1675
|
+
getOptionLabelRef.current = getOptionLabel;
|
|
1653
1676
|
const onValueChangeRef = useRef(onValueChange);
|
|
1654
1677
|
onValueChangeRef.current = onValueChange;
|
|
1655
1678
|
const keyEqualsFn = useCallback((a, b) => {
|
|
@@ -1660,13 +1683,18 @@ function SelectImpl({
|
|
|
1660
1683
|
const fn = serializeKeyRef.current;
|
|
1661
1684
|
return (fn ?? ((x) => String(x)))(k);
|
|
1662
1685
|
}, []);
|
|
1686
|
+
const getOptionLabelFn = useCallback((k) => {
|
|
1687
|
+
const fn = getOptionLabelRef.current;
|
|
1688
|
+
return fn ? fn(k) : null;
|
|
1689
|
+
}, []);
|
|
1663
1690
|
const registerItem = useCallback(
|
|
1664
1691
|
(entry) => {
|
|
1692
|
+
labelCacheRef.current.set(serializeKeyFn(entry.itemKey), entry.label);
|
|
1665
1693
|
setItems((prev) => {
|
|
1666
1694
|
const idx = prev.findIndex((p) => Object.is(p.itemKey, entry.itemKey));
|
|
1667
1695
|
if (idx >= 0) {
|
|
1668
1696
|
const existing = prev[idx];
|
|
1669
|
-
if (existing && existing.label === entry.label && existing.text === entry.text && Object.is(existing.value, entry.value)) {
|
|
1697
|
+
if (existing && existing.label === entry.label && existing.text === entry.text && existing.isDisabled === entry.isDisabled && Object.is(existing.value, entry.value)) {
|
|
1670
1698
|
return prev;
|
|
1671
1699
|
}
|
|
1672
1700
|
const next = prev.slice();
|
|
@@ -1676,7 +1704,7 @@ function SelectImpl({
|
|
|
1676
1704
|
return [...prev, entry];
|
|
1677
1705
|
});
|
|
1678
1706
|
},
|
|
1679
|
-
[]
|
|
1707
|
+
[serializeKeyFn]
|
|
1680
1708
|
);
|
|
1681
1709
|
const unregisterItem = useCallback((k) => {
|
|
1682
1710
|
setItems((prev) => {
|
|
@@ -1687,6 +1715,10 @@ function SelectImpl({
|
|
|
1687
1715
|
return next;
|
|
1688
1716
|
});
|
|
1689
1717
|
}, []);
|
|
1718
|
+
const getCachedLabel = useCallback(
|
|
1719
|
+
(k) => labelCacheRef.current.get(serializeKeyFn(k)),
|
|
1720
|
+
[serializeKeyFn]
|
|
1721
|
+
);
|
|
1690
1722
|
const emitChange = useCallback(
|
|
1691
1723
|
(next) => {
|
|
1692
1724
|
onValueChangeRef.current?.(next);
|
|
@@ -1727,14 +1759,25 @@ function SelectImpl({
|
|
|
1727
1759
|
items,
|
|
1728
1760
|
registerItem,
|
|
1729
1761
|
unregisterItem,
|
|
1762
|
+
getCachedLabel,
|
|
1730
1763
|
query,
|
|
1731
1764
|
setQuery,
|
|
1732
|
-
|
|
1765
|
+
isDisabled: finalDisabled,
|
|
1733
1766
|
isLoading,
|
|
1734
|
-
|
|
1767
|
+
loadingLabel,
|
|
1768
|
+
isClearable,
|
|
1769
|
+
clearLabel,
|
|
1735
1770
|
serializeKey: serializeKeyFn,
|
|
1771
|
+
getOptionLabel: getOptionLabelFn,
|
|
1736
1772
|
name,
|
|
1737
|
-
|
|
1773
|
+
isInvalid: finalInvalid,
|
|
1774
|
+
listboxId: generatedListboxId,
|
|
1775
|
+
activeDescendant,
|
|
1776
|
+
setActiveDescendant,
|
|
1777
|
+
listboxRef,
|
|
1778
|
+
fieldId: field?.id,
|
|
1779
|
+
labelId: field?.labelId,
|
|
1780
|
+
describedBy: field ? `${field.helperId} ${field.errorId}` : void 0
|
|
1738
1781
|
}),
|
|
1739
1782
|
[
|
|
1740
1783
|
openState,
|
|
@@ -1748,13 +1791,20 @@ function SelectImpl({
|
|
|
1748
1791
|
items,
|
|
1749
1792
|
registerItem,
|
|
1750
1793
|
unregisterItem,
|
|
1794
|
+
getCachedLabel,
|
|
1751
1795
|
query,
|
|
1752
|
-
|
|
1796
|
+
finalDisabled,
|
|
1753
1797
|
isLoading,
|
|
1754
|
-
|
|
1798
|
+
loadingLabel,
|
|
1799
|
+
isClearable,
|
|
1800
|
+
clearLabel,
|
|
1755
1801
|
serializeKeyFn,
|
|
1802
|
+
getOptionLabelFn,
|
|
1756
1803
|
name,
|
|
1757
|
-
|
|
1804
|
+
finalInvalid,
|
|
1805
|
+
generatedListboxId,
|
|
1806
|
+
activeDescendant,
|
|
1807
|
+
field
|
|
1758
1808
|
]
|
|
1759
1809
|
);
|
|
1760
1810
|
return /* @__PURE__ */ jsx(SelectContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
@@ -1763,7 +1813,10 @@ function SelectImpl({
|
|
|
1763
1813
|
open: openState,
|
|
1764
1814
|
onOpenChange: (o) => {
|
|
1765
1815
|
setOpenState(o);
|
|
1766
|
-
if (!o)
|
|
1816
|
+
if (!o) {
|
|
1817
|
+
setQuery("");
|
|
1818
|
+
setActiveDescendant(null);
|
|
1819
|
+
}
|
|
1767
1820
|
},
|
|
1768
1821
|
placement,
|
|
1769
1822
|
offset: 4,
|
|
@@ -1799,25 +1852,59 @@ var TRIGGER_CLEAR_OFFSET_CLASSES = {
|
|
|
1799
1852
|
md: "right-[41px]",
|
|
1800
1853
|
lg: "right-[49px]"
|
|
1801
1854
|
};
|
|
1855
|
+
function triggerDataState(open, isLoading, isDisabled, isInvalid) {
|
|
1856
|
+
if (open) return "open";
|
|
1857
|
+
if (isLoading) return "loading";
|
|
1858
|
+
if (isDisabled) return "disabled";
|
|
1859
|
+
if (isInvalid) return "invalid";
|
|
1860
|
+
return void 0;
|
|
1861
|
+
}
|
|
1802
1862
|
var SelectTrigger = forwardRef(
|
|
1803
|
-
function SelectTrigger2({ size, state, className, children, ...rest }, ref) {
|
|
1863
|
+
function SelectTrigger2({ size, state, className, children, "aria-label": ariaLabel, onKeyDown, ...rest }, ref) {
|
|
1804
1864
|
const ctx = useSelectContext();
|
|
1805
|
-
const triggerState = state ?? (ctx.
|
|
1806
|
-
const
|
|
1865
|
+
const triggerState = state ?? (ctx.isInvalid ? "invalid" : "default");
|
|
1866
|
+
const triggerTypeahead = useTypeahead({
|
|
1867
|
+
items: () => ctx.items,
|
|
1868
|
+
getLabel: (entry) => entry.text,
|
|
1869
|
+
isDisabled: (entry) => entry.isDisabled,
|
|
1870
|
+
getActiveIndex: () => ctx.hasSelection ? ctx.items.findIndex((i) => ctx.keyEquals(i.itemKey, ctx.selectedKey)) : -1,
|
|
1871
|
+
onMatch: (entry) => ctx.onSelect(entry),
|
|
1872
|
+
enabled: !ctx.open && !ctx.isDisabled && !ctx.isLoading
|
|
1873
|
+
});
|
|
1874
|
+
const handleTriggerKeyDown = (event) => {
|
|
1875
|
+
onKeyDown?.(event);
|
|
1876
|
+
if (event.defaultPrevented) return;
|
|
1877
|
+
if (!ctx.open && triggerTypeahead.onKeyDown(event)) {
|
|
1878
|
+
event.preventDefault();
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
const showClear = ctx.isClearable && ctx.hasSelection && !ctx.isLoading && !ctx.isDisabled;
|
|
1807
1882
|
const sizeKey = size ?? "md";
|
|
1808
1883
|
const iconClass = TRIGGER_ICON_CLASSES[sizeKey];
|
|
1809
1884
|
const clearBoxClass = TRIGGER_CLEAR_BOX_CLASSES[sizeKey];
|
|
1810
1885
|
const dividerClass = TRIGGER_DIVIDER_CLASSES[sizeKey];
|
|
1811
1886
|
const clearOffsetClass = TRIGGER_CLEAR_OFFSET_CLASSES[sizeKey];
|
|
1887
|
+
const labelledBy = !ariaLabel ? ctx.labelId : void 0;
|
|
1812
1888
|
return /* @__PURE__ */ jsxs("span", { className: "relative inline-flex w-full", children: [
|
|
1889
|
+
/* @__PURE__ */ jsx(Announce, { children: ctx.isLoading ? ctx.loadingLabel : "" }),
|
|
1813
1890
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1814
1891
|
"button",
|
|
1815
1892
|
{
|
|
1816
1893
|
ref,
|
|
1817
1894
|
type: "button",
|
|
1818
|
-
|
|
1895
|
+
id: ctx.fieldId,
|
|
1896
|
+
disabled: ctx.isDisabled || ctx.isLoading,
|
|
1819
1897
|
"aria-busy": ctx.isLoading || void 0,
|
|
1898
|
+
"aria-haspopup": "listbox",
|
|
1899
|
+
"aria-controls": ctx.listboxId,
|
|
1900
|
+
"aria-activedescendant": ctx.open ? ctx.activeDescendant ?? void 0 : void 0,
|
|
1901
|
+
"aria-invalid": triggerState === "invalid" || void 0,
|
|
1902
|
+
"aria-label": ariaLabel,
|
|
1903
|
+
"aria-labelledby": labelledBy,
|
|
1904
|
+
"aria-describedby": ctx.describedBy,
|
|
1905
|
+
"data-state": triggerDataState(ctx.open, ctx.isLoading, ctx.isDisabled, ctx.isInvalid),
|
|
1820
1906
|
className: cn(selectTriggerVariants({ size, state: triggerState }), className),
|
|
1907
|
+
onKeyDown: handleTriggerKeyDown,
|
|
1821
1908
|
...rest,
|
|
1822
1909
|
children: [
|
|
1823
1910
|
children ?? /* @__PURE__ */ jsx(SelectValue, {}),
|
|
@@ -1844,10 +1931,10 @@ var SelectTrigger = forwardRef(
|
|
|
1844
1931
|
"button",
|
|
1845
1932
|
{
|
|
1846
1933
|
type: "button",
|
|
1847
|
-
"aria-label":
|
|
1934
|
+
"aria-label": ctx.clearLabel,
|
|
1848
1935
|
onClick: () => ctx.onClear(),
|
|
1849
1936
|
className: cn(
|
|
1850
|
-
"absolute top-1/2 grid -translate-y-1/2 place-items-center rounded-full text-subtle-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1937
|
+
"absolute top-1/2 grid min-h-6 min-w-6 -translate-y-1/2 place-items-center rounded-full text-subtle-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1851
1938
|
clearBoxClass,
|
|
1852
1939
|
clearOffsetClass
|
|
1853
1940
|
),
|
|
@@ -1861,12 +1948,13 @@ function SelectValue({ placeholder, children }) {
|
|
|
1861
1948
|
const ctx = useSelectContext();
|
|
1862
1949
|
if (children) return /* @__PURE__ */ jsx("span", { className: "truncate", children });
|
|
1863
1950
|
const match = ctx.hasSelection ? ctx.items.find((i) => ctx.keyEquals(i.itemKey, ctx.selectedKey)) : void 0;
|
|
1864
|
-
const label = match?.label ?? ctx.selectedLabel ?? (ctx.hasSelection ? ctx.serializeKey(ctx.selectedKey) : null);
|
|
1951
|
+
const label = match?.label ?? ctx.selectedLabel ?? (ctx.hasSelection ? ctx.getCachedLabel(ctx.selectedKey) : null) ?? (ctx.hasSelection ? ctx.getOptionLabel?.(ctx.selectedKey) : null) ?? (ctx.hasSelection ? ctx.serializeKey(ctx.selectedKey) : null);
|
|
1865
1952
|
return /* @__PURE__ */ jsx("span", { className: cn("truncate text-left", !label && "text-subtle-foreground"), children: label ?? placeholder });
|
|
1866
1953
|
}
|
|
1954
|
+
var FORWARDED_NAV_KEYS = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "Home", "End", "PageDown", "PageUp", "Enter"]);
|
|
1867
1955
|
function SelectContent({
|
|
1868
1956
|
className,
|
|
1869
|
-
|
|
1957
|
+
isSearchable = false,
|
|
1870
1958
|
searchPlaceholder = "Search\u2026",
|
|
1871
1959
|
noResultsLabel = "No results",
|
|
1872
1960
|
matchWidth = false,
|
|
@@ -1881,6 +1969,21 @@ function SelectContent({
|
|
|
1881
1969
|
const hasItems = ctx.items.length > 0;
|
|
1882
1970
|
const visibleCount = ctx.query ? ctx.items.filter((i) => i.text.toLowerCase().includes(ctx.query.toLowerCase())).length : ctx.items.length;
|
|
1883
1971
|
const showEmpty = hasItems && visibleCount === 0;
|
|
1972
|
+
const handleSearchKeyDown = useCallback(
|
|
1973
|
+
(event) => {
|
|
1974
|
+
if (event.key === "Escape") {
|
|
1975
|
+
return;
|
|
1976
|
+
}
|
|
1977
|
+
if (!FORWARDED_NAV_KEYS.has(event.key)) return;
|
|
1978
|
+
const node = ctx.listboxRef.current;
|
|
1979
|
+
if (!node) return;
|
|
1980
|
+
event.preventDefault();
|
|
1981
|
+
node.dispatchEvent(
|
|
1982
|
+
new KeyboardEvent("keydown", { key: event.key, bubbles: true, cancelable: true })
|
|
1983
|
+
);
|
|
1984
|
+
},
|
|
1985
|
+
[ctx.listboxRef]
|
|
1986
|
+
);
|
|
1884
1987
|
return /* @__PURE__ */ jsxs(
|
|
1885
1988
|
PopoverContent,
|
|
1886
1989
|
{
|
|
@@ -1891,19 +1994,28 @@ function SelectContent({
|
|
|
1891
1994
|
elevation,
|
|
1892
1995
|
className: cn(
|
|
1893
1996
|
"overflow-hidden",
|
|
1894
|
-
|
|
1997
|
+
/* Truncate the option's first content child (the label) so trailing meta stays visible.
|
|
1998
|
+
Targets Listbox.Item's stable `data-listbox-item-content` wrapper rather than a deep
|
|
1999
|
+
`[role=option]>span.flex-1>:first-child` chain that breaks if the markup shifts. */
|
|
2000
|
+
matchWidth ? "w-(--anchor-width) [&_[data-listbox-item-content]>:first-child]:truncate" : "w-auto min-w-(--anchor-width)",
|
|
1895
2001
|
className
|
|
1896
2002
|
),
|
|
1897
2003
|
children: [
|
|
1898
|
-
|
|
2004
|
+
isSearchable && /* @__PURE__ */ jsx("div", { className: "border-b border-border p-1", children: /* @__PURE__ */ jsx(
|
|
1899
2005
|
SearchInput,
|
|
1900
2006
|
{
|
|
1901
2007
|
size: "sm",
|
|
1902
2008
|
autoFocus: true,
|
|
2009
|
+
role: "combobox",
|
|
2010
|
+
"aria-expanded": true,
|
|
2011
|
+
"aria-controls": ctx.listboxId,
|
|
2012
|
+
"aria-activedescendant": ctx.activeDescendant ?? void 0,
|
|
2013
|
+
"aria-autocomplete": "list",
|
|
1903
2014
|
value: ctx.query,
|
|
1904
2015
|
onChange: (e) => ctx.setQuery(e.target.value),
|
|
2016
|
+
onKeyDown: handleSearchKeyDown,
|
|
1905
2017
|
placeholder: searchPlaceholder,
|
|
1906
|
-
|
|
2018
|
+
isClearable: true,
|
|
1907
2019
|
onClear: () => ctx.setQuery(""),
|
|
1908
2020
|
className: "rounded-sm"
|
|
1909
2021
|
}
|
|
@@ -1911,6 +2023,10 @@ function SelectContent({
|
|
|
1911
2023
|
/* @__PURE__ */ jsxs(
|
|
1912
2024
|
Listbox,
|
|
1913
2025
|
{
|
|
2026
|
+
ref: ctx.listboxRef,
|
|
2027
|
+
id: ctx.listboxId,
|
|
2028
|
+
tabIndex: isSearchable ? -1 : 0,
|
|
2029
|
+
onActiveChange: ctx.setActiveDescendant,
|
|
1914
2030
|
value: ctx.selectedKey ?? void 0,
|
|
1915
2031
|
onValueChange: (k) => {
|
|
1916
2032
|
if (k === null || k === void 0) return;
|
|
@@ -1921,8 +2037,19 @@ function SelectContent({
|
|
|
1921
2037
|
variant: "flat",
|
|
1922
2038
|
radius: "none",
|
|
1923
2039
|
children: [
|
|
2040
|
+
ctx.isLoading && /* @__PURE__ */ jsxs(
|
|
2041
|
+
"div",
|
|
2042
|
+
{
|
|
2043
|
+
role: "status",
|
|
2044
|
+
className: "flex items-center gap-2 px-2 py-2 text-sm text-subtle-foreground",
|
|
2045
|
+
children: [
|
|
2046
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
2047
|
+
/* @__PURE__ */ jsx("span", { children: ctx.loadingLabel })
|
|
2048
|
+
]
|
|
2049
|
+
}
|
|
2050
|
+
),
|
|
1924
2051
|
children,
|
|
1925
|
-
showEmpty && /* @__PURE__ */ jsx(ListboxEmpty, { children: noResultsLabel })
|
|
2052
|
+
!ctx.isLoading && showEmpty && /* @__PURE__ */ jsx(ListboxEmpty, { children: noResultsLabel })
|
|
1926
2053
|
]
|
|
1927
2054
|
}
|
|
1928
2055
|
)
|
|
@@ -1940,20 +2067,22 @@ function extractText(node) {
|
|
|
1940
2067
|
}
|
|
1941
2068
|
return "";
|
|
1942
2069
|
}
|
|
1943
|
-
var SelectItem = forwardRef(function SelectItem2({ itemKey, value, label, children, text,
|
|
2070
|
+
var SelectItem = forwardRef(function SelectItem2({ itemKey, value, label, children, text, isDisabled, className }, ref) {
|
|
1944
2071
|
const ctx = useSelectContext();
|
|
1945
|
-
const { registerItem, query } = ctx;
|
|
2072
|
+
const { registerItem, unregisterItem, query } = ctx;
|
|
1946
2073
|
const resolvedValue = value === void 0 ? itemKey : value;
|
|
1947
|
-
const itemText = useMemo(
|
|
1948
|
-
(
|
|
1949
|
-
|
|
1950
|
-
|
|
2074
|
+
const itemText = useMemo(() => {
|
|
2075
|
+
if (text !== void 0) return text;
|
|
2076
|
+
const fromLabel = extractText(label);
|
|
2077
|
+
return fromLabel !== "" ? fromLabel : extractText(children);
|
|
2078
|
+
}, [text, label, children]);
|
|
1951
2079
|
useEffect(() => {
|
|
1952
|
-
registerItem({ itemKey, value: resolvedValue, label, text: itemText });
|
|
1953
|
-
|
|
2080
|
+
registerItem({ itemKey, value: resolvedValue, label, text: itemText, isDisabled: isDisabled ?? false });
|
|
2081
|
+
return () => unregisterItem(itemKey);
|
|
2082
|
+
}, [registerItem, unregisterItem, itemKey, resolvedValue, label, itemText, isDisabled]);
|
|
1954
2083
|
const matchesQuery = !query || itemText.toLowerCase().includes(query.toLowerCase());
|
|
1955
2084
|
if (!matchesQuery) return null;
|
|
1956
|
-
return /* @__PURE__ */ jsx(ListboxItem, { ref, value: itemKey,
|
|
2085
|
+
return /* @__PURE__ */ jsx(ListboxItem, { ref, value: itemKey, isDisabled, className, children: children ?? label });
|
|
1957
2086
|
});
|
|
1958
2087
|
Select.Trigger = SelectTrigger;
|
|
1959
2088
|
Select.Value = SelectValue;
|
|
@@ -1972,9 +2101,9 @@ function MultiSelect({
|
|
|
1972
2101
|
value,
|
|
1973
2102
|
defaultValue,
|
|
1974
2103
|
onValueChange,
|
|
1975
|
-
|
|
2104
|
+
isDisabled = false,
|
|
1976
2105
|
name,
|
|
1977
|
-
|
|
2106
|
+
isInvalid,
|
|
1978
2107
|
defaultOpen = false,
|
|
1979
2108
|
open: openProp,
|
|
1980
2109
|
onOpenChange,
|
|
@@ -2012,9 +2141,9 @@ function MultiSelect({
|
|
|
2012
2141
|
labels,
|
|
2013
2142
|
registerLabel,
|
|
2014
2143
|
unregisterLabel,
|
|
2015
|
-
|
|
2144
|
+
isDisabled,
|
|
2016
2145
|
name,
|
|
2017
|
-
|
|
2146
|
+
isInvalid
|
|
2018
2147
|
}),
|
|
2019
2148
|
[
|
|
2020
2149
|
openState,
|
|
@@ -2024,9 +2153,9 @@ function MultiSelect({
|
|
|
2024
2153
|
labels,
|
|
2025
2154
|
registerLabel,
|
|
2026
2155
|
unregisterLabel,
|
|
2027
|
-
|
|
2156
|
+
isDisabled,
|
|
2028
2157
|
name,
|
|
2029
|
-
|
|
2158
|
+
isInvalid
|
|
2030
2159
|
]
|
|
2031
2160
|
);
|
|
2032
2161
|
return /* @__PURE__ */ jsx(MultiSelectContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
@@ -2046,13 +2175,13 @@ function MultiSelect({
|
|
|
2046
2175
|
var MultiSelectTrigger = forwardRef(
|
|
2047
2176
|
function MultiSelectTrigger2({ size, state, className, onKeyDown, children, ...rest }, ref) {
|
|
2048
2177
|
const ctx = useMultiSelectContext();
|
|
2049
|
-
const triggerState = state ?? (ctx.
|
|
2178
|
+
const triggerState = state ?? (ctx.isInvalid ? "invalid" : "default");
|
|
2050
2179
|
return /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2051
2180
|
"button",
|
|
2052
2181
|
{
|
|
2053
2182
|
ref,
|
|
2054
2183
|
type: "button",
|
|
2055
|
-
disabled: ctx.
|
|
2184
|
+
disabled: ctx.isDisabled,
|
|
2056
2185
|
onKeyDown: (e) => {
|
|
2057
2186
|
onKeyDown?.(e);
|
|
2058
2187
|
if (e.defaultPrevented) return;
|
|
@@ -2093,7 +2222,7 @@ function MultiSelectTags({ placeholder }) {
|
|
|
2093
2222
|
className: "inline-flex items-center gap-1 rounded-sm bg-muted px-1.5 py-0.5 text-xs",
|
|
2094
2223
|
children: [
|
|
2095
2224
|
ctx.labels[v] ?? v,
|
|
2096
|
-
!ctx.
|
|
2225
|
+
!ctx.isDisabled && /* @__PURE__ */ jsx(
|
|
2097
2226
|
"span",
|
|
2098
2227
|
{
|
|
2099
2228
|
role: "button",
|
|
@@ -2135,7 +2264,7 @@ function MultiSelectContent({
|
|
|
2135
2264
|
children: /* @__PURE__ */ jsx(
|
|
2136
2265
|
Listbox,
|
|
2137
2266
|
{
|
|
2138
|
-
|
|
2267
|
+
isMultiple: true,
|
|
2139
2268
|
value: ctx.values,
|
|
2140
2269
|
onValueChange: (v) => ctx.setValues(v),
|
|
2141
2270
|
variant: "flat",
|
|
@@ -2176,8 +2305,8 @@ function Combobox({
|
|
|
2176
2305
|
inputValue,
|
|
2177
2306
|
defaultInputValue,
|
|
2178
2307
|
onInputChange,
|
|
2179
|
-
|
|
2180
|
-
|
|
2308
|
+
isDisabled = false,
|
|
2309
|
+
isInvalid,
|
|
2181
2310
|
name,
|
|
2182
2311
|
defaultOpen = false,
|
|
2183
2312
|
open: openProp,
|
|
@@ -2240,8 +2369,8 @@ function Combobox({
|
|
|
2240
2369
|
inputRef,
|
|
2241
2370
|
contentRef,
|
|
2242
2371
|
listboxId,
|
|
2243
|
-
|
|
2244
|
-
|
|
2372
|
+
isDisabled,
|
|
2373
|
+
isInvalid,
|
|
2245
2374
|
selectItem
|
|
2246
2375
|
}),
|
|
2247
2376
|
[
|
|
@@ -2255,8 +2384,8 @@ function Combobox({
|
|
|
2255
2384
|
registerItem,
|
|
2256
2385
|
unregisterItem,
|
|
2257
2386
|
listboxId,
|
|
2258
|
-
|
|
2259
|
-
|
|
2387
|
+
isDisabled,
|
|
2388
|
+
isInvalid,
|
|
2260
2389
|
selectItem
|
|
2261
2390
|
]
|
|
2262
2391
|
);
|
|
@@ -2268,7 +2397,7 @@ function Combobox({
|
|
|
2268
2397
|
var ComboboxInput = forwardRef(
|
|
2269
2398
|
function ComboboxInput2({ className, size, state, onKeyDown, onFocus, onBlur, ...rest }, forwardedRef) {
|
|
2270
2399
|
const ctx = useComboboxContext();
|
|
2271
|
-
const inputState = state ?? (ctx.
|
|
2400
|
+
const inputState = state ?? (ctx.isInvalid ? "invalid" : "default");
|
|
2272
2401
|
const setActiveAndScroll = useCallback(
|
|
2273
2402
|
(id) => {
|
|
2274
2403
|
ctx.setActiveId(id);
|
|
@@ -2278,7 +2407,7 @@ var ComboboxInput = forwardRef(
|
|
|
2278
2407
|
);
|
|
2279
2408
|
const moveActive = useCallback(
|
|
2280
2409
|
(direction) => {
|
|
2281
|
-
const list = ctx.itemsRef.current.filter((i) => !i.
|
|
2410
|
+
const list = ctx.itemsRef.current.filter((i) => !i.isDisabled);
|
|
2282
2411
|
if (list.length === 0) return;
|
|
2283
2412
|
const idx = list.findIndex((i) => i.id === ctx.activeId);
|
|
2284
2413
|
let nextIdx = idx + direction;
|
|
@@ -2292,7 +2421,7 @@ var ComboboxInput = forwardRef(
|
|
|
2292
2421
|
);
|
|
2293
2422
|
const handleKeyDown = (e) => {
|
|
2294
2423
|
onKeyDown?.(e);
|
|
2295
|
-
if (e.defaultPrevented || ctx.
|
|
2424
|
+
if (e.defaultPrevented || ctx.isDisabled) return;
|
|
2296
2425
|
switch (e.key) {
|
|
2297
2426
|
case "ArrowDown":
|
|
2298
2427
|
e.preventDefault();
|
|
@@ -2307,14 +2436,14 @@ var ComboboxInput = forwardRef(
|
|
|
2307
2436
|
case "Home":
|
|
2308
2437
|
if (ctx.open) {
|
|
2309
2438
|
e.preventDefault();
|
|
2310
|
-
const first = ctx.itemsRef.current.find((i) => !i.
|
|
2439
|
+
const first = ctx.itemsRef.current.find((i) => !i.isDisabled);
|
|
2311
2440
|
if (first) setActiveAndScroll(first.id);
|
|
2312
2441
|
}
|
|
2313
2442
|
break;
|
|
2314
2443
|
case "End":
|
|
2315
2444
|
if (ctx.open) {
|
|
2316
2445
|
e.preventDefault();
|
|
2317
|
-
const list = ctx.itemsRef.current.filter((i) => !i.
|
|
2446
|
+
const list = ctx.itemsRef.current.filter((i) => !i.isDisabled);
|
|
2318
2447
|
const last = list[list.length - 1];
|
|
2319
2448
|
if (last) setActiveAndScroll(last.id);
|
|
2320
2449
|
}
|
|
@@ -2325,7 +2454,7 @@ var ComboboxInput = forwardRef(
|
|
|
2325
2454
|
case "Enter": {
|
|
2326
2455
|
if (!ctx.open || !ctx.activeId) return;
|
|
2327
2456
|
const entry = ctx.itemsRef.current.find((i) => i.id === ctx.activeId);
|
|
2328
|
-
if (!entry || entry.
|
|
2457
|
+
if (!entry || entry.isDisabled) return;
|
|
2329
2458
|
e.preventDefault();
|
|
2330
2459
|
ctx.selectItem(entry);
|
|
2331
2460
|
break;
|
|
@@ -2352,8 +2481,8 @@ var ComboboxInput = forwardRef(
|
|
|
2352
2481
|
"aria-controls": ctx.listboxId,
|
|
2353
2482
|
"aria-activedescendant": ctx.activeId ?? void 0,
|
|
2354
2483
|
"aria-autocomplete": "list",
|
|
2355
|
-
"aria-disabled": ctx.
|
|
2356
|
-
disabled: ctx.
|
|
2484
|
+
"aria-disabled": ctx.isDisabled || void 0,
|
|
2485
|
+
disabled: ctx.isDisabled,
|
|
2357
2486
|
value: ctx.inputValue,
|
|
2358
2487
|
onChange: (e) => {
|
|
2359
2488
|
ctx.setInputValue(e.target.value);
|
|
@@ -2393,7 +2522,7 @@ function ComboboxContent({
|
|
|
2393
2522
|
const ctx = useComboboxContext();
|
|
2394
2523
|
useEffect(() => {
|
|
2395
2524
|
if (!ctx.open) return;
|
|
2396
|
-
const list = ctx.itemsRef.current.filter((i) => !i.
|
|
2525
|
+
const list = ctx.itemsRef.current.filter((i) => !i.isDisabled);
|
|
2397
2526
|
if (ctx.activeId && !list.some((i) => i.id === ctx.activeId)) {
|
|
2398
2527
|
ctx.setActiveId(list[0]?.id ?? null);
|
|
2399
2528
|
}
|
|
@@ -2441,22 +2570,22 @@ function ComboboxContent({
|
|
|
2441
2570
|
}
|
|
2442
2571
|
) });
|
|
2443
2572
|
}
|
|
2444
|
-
var ComboboxItem = forwardRef(function ComboboxItem2({ value,
|
|
2573
|
+
var ComboboxItem = forwardRef(function ComboboxItem2({ value, isDisabled = false, className, children, onClick, onPointerEnter, ...rest }, forwardedRef) {
|
|
2445
2574
|
const ctx = useComboboxContext();
|
|
2446
2575
|
const id = useId$1();
|
|
2447
2576
|
useEffect(() => {
|
|
2448
|
-
ctx.registerItem({ id, value,
|
|
2577
|
+
ctx.registerItem({ id, value, isDisabled, label: children });
|
|
2449
2578
|
return () => ctx.unregisterItem(id);
|
|
2450
|
-
}, [ctx, id, value,
|
|
2579
|
+
}, [ctx, id, value, isDisabled, children]);
|
|
2451
2580
|
useEffect(() => {
|
|
2452
2581
|
if (!ctx.activeId) {
|
|
2453
|
-
const list = ctx.itemsRef.current.filter((i) => !i.
|
|
2582
|
+
const list = ctx.itemsRef.current.filter((i) => !i.isDisabled);
|
|
2454
2583
|
if (list[0]) ctx.setActiveId(list[0].id);
|
|
2455
2584
|
}
|
|
2456
2585
|
}, [ctx]);
|
|
2457
2586
|
const isSelected = ctx.value === value;
|
|
2458
2587
|
const isActive = ctx.activeId === id;
|
|
2459
|
-
const state =
|
|
2588
|
+
const state = isDisabled ? "disabled" : isSelected ? "selected" : isActive ? "active" : "default";
|
|
2460
2589
|
return /* @__PURE__ */ jsxs(
|
|
2461
2590
|
"div",
|
|
2462
2591
|
{
|
|
@@ -2464,17 +2593,17 @@ var ComboboxItem = forwardRef(function ComboboxItem2({ value, disabled = false,
|
|
|
2464
2593
|
id,
|
|
2465
2594
|
role: "option",
|
|
2466
2595
|
"aria-selected": isSelected,
|
|
2467
|
-
"aria-disabled":
|
|
2596
|
+
"aria-disabled": isDisabled || void 0,
|
|
2468
2597
|
"data-active": isActive ? "" : void 0,
|
|
2469
2598
|
"data-selected": isSelected ? "" : void 0,
|
|
2470
2599
|
onClick: (e) => {
|
|
2471
2600
|
onClick?.(e);
|
|
2472
|
-
if (e.defaultPrevented ||
|
|
2473
|
-
ctx.selectItem({ id, value,
|
|
2601
|
+
if (e.defaultPrevented || isDisabled) return;
|
|
2602
|
+
ctx.selectItem({ id, value, isDisabled, label: children });
|
|
2474
2603
|
},
|
|
2475
2604
|
onPointerEnter: (e) => {
|
|
2476
2605
|
onPointerEnter?.(e);
|
|
2477
|
-
if (!
|
|
2606
|
+
if (!isDisabled) ctx.setActiveId(id);
|
|
2478
2607
|
},
|
|
2479
2608
|
className: cn(listboxItemVariants({ state }), className),
|
|
2480
2609
|
...rest,
|
|
@@ -2886,7 +3015,7 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
2886
3015
|
min,
|
|
2887
3016
|
max,
|
|
2888
3017
|
isDisabled: dayDisabled,
|
|
2889
|
-
|
|
3018
|
+
isInvalid,
|
|
2890
3019
|
name,
|
|
2891
3020
|
size,
|
|
2892
3021
|
state,
|
|
@@ -2903,7 +3032,7 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
2903
3032
|
controlled: void 0,
|
|
2904
3033
|
default: false
|
|
2905
3034
|
});
|
|
2906
|
-
const triggerState = state ?? (
|
|
3035
|
+
const triggerState = state ?? (isInvalid ? "invalid" : "default");
|
|
2907
3036
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, placement: "bottom-start", offset: 6, children: [
|
|
2908
3037
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2909
3038
|
"button",
|
|
@@ -2919,7 +3048,7 @@ var DatePicker = forwardRef(function DatePicker2({
|
|
|
2919
3048
|
]
|
|
2920
3049
|
}
|
|
2921
3050
|
) }),
|
|
2922
|
-
/* @__PURE__ */ jsx(PopoverContent, {
|
|
3051
|
+
/* @__PURE__ */ jsx(PopoverContent, { isBare: true, children: /* @__PURE__ */ jsx(
|
|
2923
3052
|
Calendar,
|
|
2924
3053
|
{
|
|
2925
3054
|
value: date,
|
|
@@ -2945,7 +3074,7 @@ var TimePicker = forwardRef(function TimePicker2({
|
|
|
2945
3074
|
minuteStep = 5,
|
|
2946
3075
|
placeholder = "Pick a time",
|
|
2947
3076
|
format = defaultFormat2,
|
|
2948
|
-
|
|
3077
|
+
isInvalid,
|
|
2949
3078
|
name,
|
|
2950
3079
|
size,
|
|
2951
3080
|
state,
|
|
@@ -2976,7 +3105,7 @@ var TimePicker = forwardRef(function TimePicker2({
|
|
|
2976
3105
|
minutesRef.current?.querySelector("[data-selected]")?.scrollIntoView({ block: "center" });
|
|
2977
3106
|
});
|
|
2978
3107
|
}, [open]);
|
|
2979
|
-
const triggerState = state ?? (
|
|
3108
|
+
const triggerState = state ?? (isInvalid ? "invalid" : "default");
|
|
2980
3109
|
const update = (next) => {
|
|
2981
3110
|
const merged = {
|
|
2982
3111
|
hours: next.hours ?? time?.hours ?? 0,
|
|
@@ -2999,7 +3128,7 @@ var TimePicker = forwardRef(function TimePicker2({
|
|
|
2999
3128
|
]
|
|
3000
3129
|
}
|
|
3001
3130
|
) }),
|
|
3002
|
-
/* @__PURE__ */ jsx(PopoverContent, {
|
|
3131
|
+
/* @__PURE__ */ jsx(PopoverContent, { isBare: true, children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-md", children: [
|
|
3003
3132
|
/* @__PURE__ */ jsx(
|
|
3004
3133
|
"div",
|
|
3005
3134
|
{
|
|
@@ -3079,7 +3208,7 @@ var DateRangePicker = forwardRef(
|
|
|
3079
3208
|
min,
|
|
3080
3209
|
max,
|
|
3081
3210
|
isDisabled: dayDisabled,
|
|
3082
|
-
|
|
3211
|
+
isInvalid,
|
|
3083
3212
|
name,
|
|
3084
3213
|
size,
|
|
3085
3214
|
state,
|
|
@@ -3096,7 +3225,7 @@ var DateRangePicker = forwardRef(
|
|
|
3096
3225
|
controlled: void 0,
|
|
3097
3226
|
default: false
|
|
3098
3227
|
});
|
|
3099
|
-
const triggerState = state ?? (
|
|
3228
|
+
const triggerState = state ?? (isInvalid ? "invalid" : "default");
|
|
3100
3229
|
const wasComplete = useRef(false);
|
|
3101
3230
|
useEffect(() => {
|
|
3102
3231
|
const complete = !!(range?.start && range?.end);
|
|
@@ -3121,7 +3250,7 @@ var DateRangePicker = forwardRef(
|
|
|
3121
3250
|
]
|
|
3122
3251
|
}
|
|
3123
3252
|
) }),
|
|
3124
|
-
/* @__PURE__ */ jsx(PopoverContent, {
|
|
3253
|
+
/* @__PURE__ */ jsx(PopoverContent, { isBare: true, children: /* @__PURE__ */ jsx(
|
|
3125
3254
|
RangeCalendar,
|
|
3126
3255
|
{
|
|
3127
3256
|
value: range,
|
|
@@ -3158,11 +3287,11 @@ var colorSwatchVariants = tv({
|
|
|
3158
3287
|
true: "cursor-pointer transition-shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 hover:shadow-sm",
|
|
3159
3288
|
false: ""
|
|
3160
3289
|
},
|
|
3161
|
-
|
|
3290
|
+
isSelected: {
|
|
3162
3291
|
true: "ring-2 ring-ring ring-offset-1",
|
|
3163
3292
|
false: ""
|
|
3164
3293
|
},
|
|
3165
|
-
|
|
3294
|
+
isDisabled: {
|
|
3166
3295
|
true: "cursor-not-allowed opacity-50",
|
|
3167
3296
|
false: ""
|
|
3168
3297
|
}
|
|
@@ -3171,14 +3300,14 @@ var colorSwatchVariants = tv({
|
|
|
3171
3300
|
size: "md",
|
|
3172
3301
|
shape: "square",
|
|
3173
3302
|
interactive: false,
|
|
3174
|
-
|
|
3175
|
-
|
|
3303
|
+
isSelected: false,
|
|
3304
|
+
isDisabled: false
|
|
3176
3305
|
}
|
|
3177
3306
|
});
|
|
3178
|
-
var ColorSwatch = forwardRef(function ColorSwatch2({ color = "#000000", size, shape,
|
|
3307
|
+
var ColorSwatch = forwardRef(function ColorSwatch2({ color = "#000000", size, shape, isSelected, isDisabled, className, onClick, style, ...rest }, ref) {
|
|
3179
3308
|
const interactive = !!onClick;
|
|
3180
3309
|
const classes = cn(
|
|
3181
|
-
colorSwatchVariants({ size, shape, interactive,
|
|
3310
|
+
colorSwatchVariants({ size, shape, interactive, isSelected, isDisabled }),
|
|
3182
3311
|
className
|
|
3183
3312
|
);
|
|
3184
3313
|
const styleWithColor = {
|
|
@@ -3192,7 +3321,7 @@ var ColorSwatch = forwardRef(function ColorSwatch2({ color = "#000000", size, sh
|
|
|
3192
3321
|
{
|
|
3193
3322
|
ref,
|
|
3194
3323
|
type: "button",
|
|
3195
|
-
disabled,
|
|
3324
|
+
disabled: isDisabled,
|
|
3196
3325
|
onClick,
|
|
3197
3326
|
style: styleWithColor,
|
|
3198
3327
|
className: classes,
|
|
@@ -3302,18 +3431,18 @@ function parseColorToHsv(input) {
|
|
|
3302
3431
|
function hsvToHex(hsv, options) {
|
|
3303
3432
|
return formatHex(hsvToRgb(hsv), options);
|
|
3304
3433
|
}
|
|
3305
|
-
function commitHex(text,
|
|
3434
|
+
function commitHex(text, hasAlpha) {
|
|
3306
3435
|
const normalised = text.startsWith("#") ? text : `#${text}`;
|
|
3307
3436
|
const rgb = parseHex(normalised);
|
|
3308
3437
|
if (!rgb) return null;
|
|
3309
|
-
return formatHex(rgb, { withAlpha });
|
|
3438
|
+
return formatHex(rgb, { withAlpha: hasAlpha });
|
|
3310
3439
|
}
|
|
3311
3440
|
var ColorField = forwardRef(function ColorField2({
|
|
3312
3441
|
value,
|
|
3313
3442
|
defaultValue,
|
|
3314
3443
|
onValueChange,
|
|
3315
3444
|
swatchShape = "square",
|
|
3316
|
-
|
|
3445
|
+
hasAlpha = false,
|
|
3317
3446
|
size,
|
|
3318
3447
|
state,
|
|
3319
3448
|
className,
|
|
@@ -3339,7 +3468,7 @@ var ColorField = forwardRef(function ColorField2({
|
|
|
3339
3468
|
setCommitted(null);
|
|
3340
3469
|
return;
|
|
3341
3470
|
}
|
|
3342
|
-
const next = commitHex(draft,
|
|
3471
|
+
const next = commitHex(draft, hasAlpha);
|
|
3343
3472
|
if (next) {
|
|
3344
3473
|
setCommitted(next);
|
|
3345
3474
|
setDraft(next);
|
|
@@ -3421,7 +3550,7 @@ var ColorSlider = forwardRef(function ColorSlider2({
|
|
|
3421
3550
|
onValueChange,
|
|
3422
3551
|
color,
|
|
3423
3552
|
step,
|
|
3424
|
-
|
|
3553
|
+
isDisabled = false,
|
|
3425
3554
|
className,
|
|
3426
3555
|
"aria-label": ariaLabel,
|
|
3427
3556
|
...rest
|
|
@@ -3447,24 +3576,24 @@ var ColorSlider = forwardRef(function ColorSlider2({
|
|
|
3447
3576
|
);
|
|
3448
3577
|
const handlePointerDown = useCallback(
|
|
3449
3578
|
(e) => {
|
|
3450
|
-
if (
|
|
3579
|
+
if (isDisabled) return;
|
|
3451
3580
|
e.preventDefault();
|
|
3452
3581
|
e.target.setPointerCapture?.(e.pointerId);
|
|
3453
3582
|
updateFromClientX(e.clientX);
|
|
3454
3583
|
},
|
|
3455
|
-
[
|
|
3584
|
+
[isDisabled, updateFromClientX]
|
|
3456
3585
|
);
|
|
3457
3586
|
const handlePointerMove = useCallback(
|
|
3458
3587
|
(e) => {
|
|
3459
|
-
if (
|
|
3588
|
+
if (isDisabled) return;
|
|
3460
3589
|
if (e.buttons !== 1) return;
|
|
3461
3590
|
updateFromClientX(e.clientX);
|
|
3462
3591
|
},
|
|
3463
|
-
[
|
|
3592
|
+
[isDisabled, updateFromClientX]
|
|
3464
3593
|
);
|
|
3465
3594
|
const handleKeyDown = useCallback(
|
|
3466
3595
|
(e) => {
|
|
3467
|
-
if (
|
|
3596
|
+
if (isDisabled) return;
|
|
3468
3597
|
let next = val;
|
|
3469
3598
|
switch (e.key) {
|
|
3470
3599
|
case "ArrowRight":
|
|
@@ -3492,7 +3621,7 @@ var ColorSlider = forwardRef(function ColorSlider2({
|
|
|
3492
3621
|
e.preventDefault();
|
|
3493
3622
|
setVal(channel === "hue" ? clampHue(next) : clamp01(next));
|
|
3494
3623
|
},
|
|
3495
|
-
[channel,
|
|
3624
|
+
[channel, isDisabled, max, setVal, stepValue, val]
|
|
3496
3625
|
);
|
|
3497
3626
|
const ratio = channel === "hue" ? val >= 360 ? 1 : clampHue(val) / 360 : clamp01(val);
|
|
3498
3627
|
const gradient = buildGradient(channel, color);
|
|
@@ -3520,21 +3649,21 @@ var ColorSlider = forwardRef(function ColorSlider2({
|
|
|
3520
3649
|
{
|
|
3521
3650
|
ref: composeRefs(trackRef),
|
|
3522
3651
|
role: "slider",
|
|
3523
|
-
tabIndex:
|
|
3652
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
3524
3653
|
"aria-label": ariaLabel ?? `${channel} slider`,
|
|
3525
3654
|
"aria-valuemin": 0,
|
|
3526
3655
|
"aria-valuemax": max,
|
|
3527
3656
|
"aria-valuenow": Math.round(val * 100) / 100,
|
|
3528
|
-
"aria-disabled":
|
|
3657
|
+
"aria-disabled": isDisabled || void 0,
|
|
3529
3658
|
"aria-orientation": "horizontal",
|
|
3530
|
-
"data-disabled":
|
|
3659
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
3531
3660
|
onPointerDown: handlePointerDown,
|
|
3532
3661
|
onPointerMove: handlePointerMove,
|
|
3533
3662
|
onKeyDown: handleKeyDown,
|
|
3534
3663
|
style: trackStyle,
|
|
3535
3664
|
className: cn(
|
|
3536
3665
|
"relative h-3 w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
3537
|
-
|
|
3666
|
+
isDisabled && "pointer-events-none opacity-50"
|
|
3538
3667
|
),
|
|
3539
3668
|
children: /* @__PURE__ */ jsx(
|
|
3540
3669
|
"div",
|
|
@@ -3558,7 +3687,7 @@ var ColorArea = forwardRef(function ColorArea2({
|
|
|
3558
3687
|
defaultValue,
|
|
3559
3688
|
onValueChange,
|
|
3560
3689
|
step = 0.01,
|
|
3561
|
-
|
|
3690
|
+
isDisabled = false,
|
|
3562
3691
|
className,
|
|
3563
3692
|
"aria-label": ariaLabel = "Saturation and value",
|
|
3564
3693
|
...rest
|
|
@@ -3595,23 +3724,23 @@ var ColorArea = forwardRef(function ColorArea2({
|
|
|
3595
3724
|
);
|
|
3596
3725
|
const handlePointerDown = useCallback(
|
|
3597
3726
|
(e) => {
|
|
3598
|
-
if (
|
|
3727
|
+
if (isDisabled) return;
|
|
3599
3728
|
e.preventDefault();
|
|
3600
3729
|
e.target.setPointerCapture?.(e.pointerId);
|
|
3601
3730
|
updateFromClient(e.clientX, e.clientY);
|
|
3602
3731
|
},
|
|
3603
|
-
[
|
|
3732
|
+
[isDisabled, updateFromClient]
|
|
3604
3733
|
);
|
|
3605
3734
|
const handlePointerMove = useCallback(
|
|
3606
3735
|
(e) => {
|
|
3607
|
-
if (
|
|
3736
|
+
if (isDisabled || e.buttons !== 1) return;
|
|
3608
3737
|
updateFromClient(e.clientX, e.clientY);
|
|
3609
3738
|
},
|
|
3610
|
-
[
|
|
3739
|
+
[isDisabled, updateFromClient]
|
|
3611
3740
|
);
|
|
3612
3741
|
const handleKeyDown = useCallback(
|
|
3613
3742
|
(e) => {
|
|
3614
|
-
if (
|
|
3743
|
+
if (isDisabled) return;
|
|
3615
3744
|
const big = step * 10;
|
|
3616
3745
|
let nextS = s;
|
|
3617
3746
|
let nextV = v;
|
|
@@ -3648,7 +3777,7 @@ var ColorArea = forwardRef(function ColorArea2({
|
|
|
3648
3777
|
e.preventDefault();
|
|
3649
3778
|
emit(nextS, nextV);
|
|
3650
3779
|
},
|
|
3651
|
-
[
|
|
3780
|
+
[isDisabled, emit, s, step, v]
|
|
3652
3781
|
);
|
|
3653
3782
|
const baseColor = `hsl(${hue}, 100%, 50%)`;
|
|
3654
3783
|
const trackStyle = {
|
|
@@ -3666,18 +3795,18 @@ var ColorArea = forwardRef(function ColorArea2({
|
|
|
3666
3795
|
{
|
|
3667
3796
|
ref: composeRefs(forwardedRef, trackRef),
|
|
3668
3797
|
role: "slider",
|
|
3669
|
-
tabIndex:
|
|
3798
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
3670
3799
|
"aria-label": ariaLabel,
|
|
3671
3800
|
"aria-valuetext": `saturation ${(s * 100).toFixed(0)}%, value ${(v * 100).toFixed(0)}%`,
|
|
3672
|
-
"aria-disabled":
|
|
3673
|
-
"data-disabled":
|
|
3801
|
+
"aria-disabled": isDisabled || void 0,
|
|
3802
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
3674
3803
|
onPointerDown: handlePointerDown,
|
|
3675
3804
|
onPointerMove: handlePointerMove,
|
|
3676
3805
|
onKeyDown: handleKeyDown,
|
|
3677
3806
|
style: trackStyle,
|
|
3678
3807
|
className: cn(
|
|
3679
3808
|
"relative aspect-square w-full select-none rounded-md border border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
3680
|
-
|
|
3809
|
+
isDisabled && "pointer-events-none opacity-50",
|
|
3681
3810
|
className
|
|
3682
3811
|
),
|
|
3683
3812
|
...rest,
|
|
@@ -3707,7 +3836,7 @@ var ColorWheel = forwardRef(function ColorWheel2({
|
|
|
3707
3836
|
size = 200,
|
|
3708
3837
|
thickness = 30,
|
|
3709
3838
|
step = 1,
|
|
3710
|
-
|
|
3839
|
+
isDisabled = false,
|
|
3711
3840
|
className,
|
|
3712
3841
|
"aria-label": ariaLabel = "Hue",
|
|
3713
3842
|
...rest
|
|
@@ -3728,23 +3857,23 @@ var ColorWheel = forwardRef(function ColorWheel2({
|
|
|
3728
3857
|
);
|
|
3729
3858
|
const handlePointerDown = useCallback(
|
|
3730
3859
|
(e) => {
|
|
3731
|
-
if (
|
|
3860
|
+
if (isDisabled) return;
|
|
3732
3861
|
e.preventDefault();
|
|
3733
3862
|
e.target.setPointerCapture?.(e.pointerId);
|
|
3734
3863
|
updateFromClient(e.clientX, e.clientY);
|
|
3735
3864
|
},
|
|
3736
|
-
[
|
|
3865
|
+
[isDisabled, updateFromClient]
|
|
3737
3866
|
);
|
|
3738
3867
|
const handlePointerMove = useCallback(
|
|
3739
3868
|
(e) => {
|
|
3740
|
-
if (
|
|
3869
|
+
if (isDisabled || e.buttons !== 1) return;
|
|
3741
3870
|
updateFromClient(e.clientX, e.clientY);
|
|
3742
3871
|
},
|
|
3743
|
-
[
|
|
3872
|
+
[isDisabled, updateFromClient]
|
|
3744
3873
|
);
|
|
3745
3874
|
const handleKeyDown = useCallback(
|
|
3746
3875
|
(e) => {
|
|
3747
|
-
if (
|
|
3876
|
+
if (isDisabled) return;
|
|
3748
3877
|
let next = hue;
|
|
3749
3878
|
switch (e.key) {
|
|
3750
3879
|
case "ArrowRight":
|
|
@@ -3773,7 +3902,7 @@ var ColorWheel = forwardRef(function ColorWheel2({
|
|
|
3773
3902
|
e.preventDefault();
|
|
3774
3903
|
setHue(clampHue(next));
|
|
3775
3904
|
},
|
|
3776
|
-
[
|
|
3905
|
+
[isDisabled, hue, setHue, step]
|
|
3777
3906
|
);
|
|
3778
3907
|
const radius = (size - thickness) / 2;
|
|
3779
3908
|
const angleRad = hue * Math.PI / 180;
|
|
@@ -3791,20 +3920,20 @@ var ColorWheel = forwardRef(function ColorWheel2({
|
|
|
3791
3920
|
{
|
|
3792
3921
|
ref: composeRefs(forwardedRef, trackRef),
|
|
3793
3922
|
role: "slider",
|
|
3794
|
-
tabIndex:
|
|
3923
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
3795
3924
|
"aria-label": ariaLabel,
|
|
3796
3925
|
"aria-valuemin": 0,
|
|
3797
3926
|
"aria-valuemax": 360,
|
|
3798
3927
|
"aria-valuenow": Math.round(hue),
|
|
3799
|
-
"aria-disabled":
|
|
3800
|
-
"data-disabled":
|
|
3928
|
+
"aria-disabled": isDisabled || void 0,
|
|
3929
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
3801
3930
|
onPointerDown: handlePointerDown,
|
|
3802
3931
|
onPointerMove: handlePointerMove,
|
|
3803
3932
|
onKeyDown: handleKeyDown,
|
|
3804
3933
|
style: wheelStyle,
|
|
3805
3934
|
className: cn(
|
|
3806
3935
|
"relative inline-block select-none rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3807
|
-
|
|
3936
|
+
isDisabled && "pointer-events-none opacity-50",
|
|
3808
3937
|
className
|
|
3809
3938
|
),
|
|
3810
3939
|
...rest,
|
|
@@ -3823,7 +3952,7 @@ var ColorWheel = forwardRef(function ColorWheel2({
|
|
|
3823
3952
|
}
|
|
3824
3953
|
);
|
|
3825
3954
|
});
|
|
3826
|
-
function ColorSwatchItem({ color,
|
|
3955
|
+
function ColorSwatchItem({ color, isSelected, isDisabled, size, shape, onSelect }) {
|
|
3827
3956
|
const roving = useRovingFocusItem();
|
|
3828
3957
|
return /* @__PURE__ */ jsx(
|
|
3829
3958
|
ColorSwatch,
|
|
@@ -3832,8 +3961,8 @@ function ColorSwatchItem({ color, selected, disabled, size, shape, onSelect }) {
|
|
|
3832
3961
|
color,
|
|
3833
3962
|
size,
|
|
3834
3963
|
shape,
|
|
3835
|
-
|
|
3836
|
-
|
|
3964
|
+
isSelected,
|
|
3965
|
+
isDisabled,
|
|
3837
3966
|
tabIndex: roving.tabIndex,
|
|
3838
3967
|
onClick: () => onSelect(color),
|
|
3839
3968
|
onKeyDown: (e) => {
|
|
@@ -3857,7 +3986,7 @@ function ColorSwatchPicker({
|
|
|
3857
3986
|
onValueChange,
|
|
3858
3987
|
swatchSize = "md",
|
|
3859
3988
|
swatchShape = "square",
|
|
3860
|
-
|
|
3989
|
+
isDisabled = false,
|
|
3861
3990
|
className,
|
|
3862
3991
|
...rest
|
|
3863
3992
|
}) {
|
|
@@ -3870,15 +3999,15 @@ function ColorSwatchPicker({
|
|
|
3870
3999
|
RovingFocusGroup,
|
|
3871
4000
|
{
|
|
3872
4001
|
orientation: "both",
|
|
3873
|
-
|
|
4002
|
+
canLoop: true,
|
|
3874
4003
|
className: cn("flex flex-wrap gap-1.5", className),
|
|
3875
4004
|
...rest,
|
|
3876
4005
|
children: colors.map((c) => /* @__PURE__ */ jsx(
|
|
3877
4006
|
ColorSwatchItem,
|
|
3878
4007
|
{
|
|
3879
4008
|
color: c,
|
|
3880
|
-
|
|
3881
|
-
|
|
4009
|
+
isSelected: selected === c,
|
|
4010
|
+
isDisabled,
|
|
3882
4011
|
size: swatchSize,
|
|
3883
4012
|
shape: swatchShape,
|
|
3884
4013
|
onSelect: (color) => setSelected(color)
|
|
@@ -3893,10 +4022,10 @@ var ColorPicker = forwardRef(function ColorPicker2({
|
|
|
3893
4022
|
value,
|
|
3894
4023
|
defaultValue = "#3b82f6",
|
|
3895
4024
|
onValueChange,
|
|
3896
|
-
|
|
4025
|
+
hasAlpha = false,
|
|
3897
4026
|
presets,
|
|
3898
4027
|
triggerSize = "md",
|
|
3899
|
-
|
|
4028
|
+
isDisabled = false,
|
|
3900
4029
|
name,
|
|
3901
4030
|
className,
|
|
3902
4031
|
"aria-label": ariaLabel = "Pick a color"
|
|
@@ -3911,14 +4040,14 @@ var ColorPicker = forwardRef(function ColorPicker2({
|
|
|
3911
4040
|
if (!hex) return;
|
|
3912
4041
|
const parsed = parseColorToHsv(hex);
|
|
3913
4042
|
if (!parsed) return;
|
|
3914
|
-
const currentHex = hsvToHex(hsv, { withAlpha });
|
|
4043
|
+
const currentHex = hsvToHex(hsv, { withAlpha: hasAlpha });
|
|
3915
4044
|
if (currentHex.toLowerCase() !== hex.toLowerCase()) {
|
|
3916
4045
|
setHsvState({ ...parsed, a: hsv.a });
|
|
3917
4046
|
}
|
|
3918
|
-
}, [hex,
|
|
4047
|
+
}, [hex, hasAlpha]);
|
|
3919
4048
|
const updateHsv = (next) => {
|
|
3920
4049
|
setHsvState(next);
|
|
3921
|
-
setHex(hsvToHex(next, { withAlpha }));
|
|
4050
|
+
setHex(hsvToHex(next, { withAlpha: hasAlpha }));
|
|
3922
4051
|
};
|
|
3923
4052
|
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
3924
4053
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
@@ -3927,7 +4056,7 @@ var ColorPicker = forwardRef(function ColorPicker2({
|
|
|
3927
4056
|
ref,
|
|
3928
4057
|
type: "button",
|
|
3929
4058
|
"aria-label": ariaLabel,
|
|
3930
|
-
disabled,
|
|
4059
|
+
disabled: isDisabled,
|
|
3931
4060
|
className: cn(
|
|
3932
4061
|
"inline-flex items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-sm transition-colors hover:border-border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
3933
4062
|
className
|
|
@@ -3957,7 +4086,7 @@ var ColorPicker = forwardRef(function ColorPicker2({
|
|
|
3957
4086
|
"aria-label": "Hue"
|
|
3958
4087
|
}
|
|
3959
4088
|
),
|
|
3960
|
-
|
|
4089
|
+
hasAlpha && /* @__PURE__ */ jsx(
|
|
3961
4090
|
ColorSlider,
|
|
3962
4091
|
{
|
|
3963
4092
|
channel: "alpha",
|
|
@@ -3972,7 +4101,7 @@ var ColorPicker = forwardRef(function ColorPicker2({
|
|
|
3972
4101
|
{
|
|
3973
4102
|
value: hex,
|
|
3974
4103
|
onValueChange: (next) => setHex(next),
|
|
3975
|
-
|
|
4104
|
+
hasAlpha
|
|
3976
4105
|
}
|
|
3977
4106
|
),
|
|
3978
4107
|
presets && presets.length > 0 && /* @__PURE__ */ jsx(
|
|
@@ -4062,7 +4191,7 @@ var StepperList = forwardRef(function StepperList2({ className, children, ...res
|
|
|
4062
4191
|
}
|
|
4063
4192
|
);
|
|
4064
4193
|
});
|
|
4065
|
-
var StepperStep = forwardRef(function StepperStep2({ value, description,
|
|
4194
|
+
var StepperStep = forwardRef(function StepperStep2({ value, description, isDisabled = false, className, onClick, children, ...rest }, ref) {
|
|
4066
4195
|
const ctx = useStepperContext();
|
|
4067
4196
|
const roving = useRovingFocusItem();
|
|
4068
4197
|
useEffect(() => {
|
|
@@ -4092,19 +4221,19 @@ var StepperStep = forwardRef(function StepperStep2({ value, description, disable
|
|
|
4092
4221
|
"aria-controls": panelId,
|
|
4093
4222
|
"aria-current": status === "active" ? "step" : void 0,
|
|
4094
4223
|
"data-status": status,
|
|
4095
|
-
"data-disabled": dataAttr(
|
|
4224
|
+
"data-disabled": dataAttr(isDisabled),
|
|
4096
4225
|
tabIndex: roving.tabIndex,
|
|
4097
|
-
disabled,
|
|
4226
|
+
disabled: isDisabled,
|
|
4098
4227
|
onClick: (e) => {
|
|
4099
4228
|
onClick?.(e);
|
|
4100
|
-
if (e.defaultPrevented ||
|
|
4229
|
+
if (e.defaultPrevented || isDisabled) return;
|
|
4101
4230
|
ctx.setValue(value);
|
|
4102
4231
|
},
|
|
4103
4232
|
onFocus: roving.onFocus,
|
|
4104
4233
|
onKeyDown: roving.onKeyDown,
|
|
4105
4234
|
className: cn(
|
|
4106
4235
|
"group flex items-center gap-2 text-left text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",
|
|
4107
|
-
|
|
4236
|
+
isDisabled && "pointer-events-none opacity-50",
|
|
4108
4237
|
className
|
|
4109
4238
|
),
|
|
4110
4239
|
...rest,
|
|
@@ -4181,9 +4310,9 @@ var TagsInput = forwardRef(function TagsInput2({
|
|
|
4181
4310
|
placeholder = "Add tag\u2026",
|
|
4182
4311
|
delimiters = [","],
|
|
4183
4312
|
validate = (t) => t.trim().length > 0,
|
|
4184
|
-
|
|
4313
|
+
allowsDuplicates = false,
|
|
4185
4314
|
max,
|
|
4186
|
-
|
|
4315
|
+
isInvalid,
|
|
4187
4316
|
disabled,
|
|
4188
4317
|
readOnly,
|
|
4189
4318
|
name,
|
|
@@ -4206,17 +4335,17 @@ var TagsInput = forwardRef(function TagsInput2({
|
|
|
4206
4335
|
});
|
|
4207
4336
|
const inputRef = useRef(null);
|
|
4208
4337
|
const [pendingDelete, setPendingDelete] = useState(false);
|
|
4209
|
-
const state =
|
|
4338
|
+
const state = isInvalid ? "invalid" : "default";
|
|
4210
4339
|
const commit = useCallback(
|
|
4211
4340
|
(raw) => {
|
|
4212
4341
|
const trimmed = raw.trim();
|
|
4213
4342
|
if (!trimmed || !validate(trimmed)) return;
|
|
4214
|
-
if (!
|
|
4343
|
+
if (!allowsDuplicates && tags.includes(trimmed)) return;
|
|
4215
4344
|
if (max != null && tags.length >= max) return;
|
|
4216
4345
|
setTags([...tags, trimmed]);
|
|
4217
4346
|
setText("");
|
|
4218
4347
|
},
|
|
4219
|
-
[tags, validate,
|
|
4348
|
+
[tags, validate, allowsDuplicates, max, setTags, setText]
|
|
4220
4349
|
);
|
|
4221
4350
|
const removeAt = useCallback(
|
|
4222
4351
|
(idx) => {
|
|
@@ -4263,7 +4392,7 @@ var TagsInput = forwardRef(function TagsInput2({
|
|
|
4263
4392
|
onClick: handleContainerClick,
|
|
4264
4393
|
"data-disabled": disabled || void 0,
|
|
4265
4394
|
"data-readonly": readOnly || void 0,
|
|
4266
|
-
"data-invalid":
|
|
4395
|
+
"data-invalid": isInvalid || void 0,
|
|
4267
4396
|
className: cn(
|
|
4268
4397
|
inputBaseVariants({ size, state }),
|
|
4269
4398
|
"h-auto min-h-10 flex-wrap items-center gap-1.5 py-1.5",
|
|
@@ -4292,7 +4421,7 @@ var TagsInput = forwardRef(function TagsInput2({
|
|
|
4292
4421
|
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
4293
4422
|
disabled,
|
|
4294
4423
|
readOnly,
|
|
4295
|
-
"aria-invalid":
|
|
4424
|
+
"aria-invalid": isInvalid || void 0,
|
|
4296
4425
|
onChange: (e) => setText(e.target.value),
|
|
4297
4426
|
onKeyDown: handleKeyDown,
|
|
4298
4427
|
onBlur: (e) => {
|
|
@@ -4328,7 +4457,7 @@ var FileUpload = forwardRef(function FileUpload2({
|
|
|
4328
4457
|
maxFiles,
|
|
4329
4458
|
onFilesChange,
|
|
4330
4459
|
disabled,
|
|
4331
|
-
|
|
4460
|
+
isInvalid,
|
|
4332
4461
|
label = "Drop files here, or click to browse",
|
|
4333
4462
|
hint,
|
|
4334
4463
|
children,
|
|
@@ -4425,7 +4554,7 @@ var FileUpload = forwardRef(function FileUpload2({
|
|
|
4425
4554
|
openPicker();
|
|
4426
4555
|
}
|
|
4427
4556
|
};
|
|
4428
|
-
const showError =
|
|
4557
|
+
const showError = isInvalid || dragState === "reject";
|
|
4429
4558
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), children: [
|
|
4430
4559
|
/* @__PURE__ */ jsxs(
|
|
4431
4560
|
"div",
|
|
@@ -4501,15 +4630,15 @@ function Editable({
|
|
|
4501
4630
|
value: valueProp,
|
|
4502
4631
|
defaultValue,
|
|
4503
4632
|
onValueChange,
|
|
4504
|
-
|
|
4633
|
+
isEditing: editingProp,
|
|
4505
4634
|
defaultEditing = false,
|
|
4506
4635
|
onEditingChange,
|
|
4507
4636
|
placeholder = "Click to edit",
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4637
|
+
canSubmitOnBlur = true,
|
|
4638
|
+
canSubmitOnEnter = true,
|
|
4639
|
+
canCancelOnEscape = true,
|
|
4640
|
+
isDisabled = false,
|
|
4641
|
+
isReadOnly = false,
|
|
4513
4642
|
name,
|
|
4514
4643
|
className,
|
|
4515
4644
|
children
|
|
@@ -4542,16 +4671,16 @@ function Editable({
|
|
|
4542
4671
|
value,
|
|
4543
4672
|
draft,
|
|
4544
4673
|
setDraft,
|
|
4545
|
-
editing,
|
|
4674
|
+
isEditing: editing,
|
|
4546
4675
|
setEditing,
|
|
4547
4676
|
submit,
|
|
4548
4677
|
cancel,
|
|
4549
4678
|
placeholder,
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4679
|
+
isDisabled,
|
|
4680
|
+
isReadOnly,
|
|
4681
|
+
canSubmitOnBlur,
|
|
4682
|
+
canSubmitOnEnter,
|
|
4683
|
+
canCancelOnEscape,
|
|
4555
4684
|
inputRef
|
|
4556
4685
|
}),
|
|
4557
4686
|
[
|
|
@@ -4562,11 +4691,11 @@ function Editable({
|
|
|
4562
4691
|
submit,
|
|
4563
4692
|
cancel,
|
|
4564
4693
|
placeholder,
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4694
|
+
isDisabled,
|
|
4695
|
+
isReadOnly,
|
|
4696
|
+
canSubmitOnBlur,
|
|
4697
|
+
canSubmitOnEnter,
|
|
4698
|
+
canCancelOnEscape
|
|
4570
4699
|
]
|
|
4571
4700
|
);
|
|
4572
4701
|
return /* @__PURE__ */ jsx(EditableContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs("div", { className: cn("inline-flex items-center gap-1.5", className), children: [
|
|
@@ -4577,9 +4706,9 @@ function Editable({
|
|
|
4577
4706
|
var EditablePreview = forwardRef(
|
|
4578
4707
|
function EditablePreview2({ className, onClick, onKeyDown, ...rest }, forwardedRef) {
|
|
4579
4708
|
const ctx = useEditableContext();
|
|
4580
|
-
if (ctx.
|
|
4709
|
+
if (ctx.isEditing) return null;
|
|
4581
4710
|
const isEmpty = !ctx.value;
|
|
4582
|
-
const interactive = !ctx.
|
|
4711
|
+
const interactive = !ctx.isDisabled && !ctx.isReadOnly;
|
|
4583
4712
|
return /* @__PURE__ */ jsx(
|
|
4584
4713
|
"span",
|
|
4585
4714
|
{
|
|
@@ -4616,20 +4745,20 @@ var EditableInput = forwardRef(
|
|
|
4616
4745
|
function EditableInput2({ className, size, state, onKeyDown, onBlur, ...rest }, forwardedRef) {
|
|
4617
4746
|
const ctx = useEditableContext();
|
|
4618
4747
|
useEffect(() => {
|
|
4619
|
-
if (ctx.
|
|
4748
|
+
if (ctx.isEditing && ctx.inputRef.current) {
|
|
4620
4749
|
ctx.inputRef.current.focus();
|
|
4621
4750
|
const len = ctx.inputRef.current.value.length;
|
|
4622
4751
|
ctx.inputRef.current.setSelectionRange(len, len);
|
|
4623
4752
|
}
|
|
4624
|
-
}, [ctx.
|
|
4625
|
-
if (!ctx.
|
|
4753
|
+
}, [ctx.isEditing, ctx.inputRef]);
|
|
4754
|
+
if (!ctx.isEditing) return null;
|
|
4626
4755
|
const handleKeyDown = (e) => {
|
|
4627
4756
|
onKeyDown?.(e);
|
|
4628
4757
|
if (e.defaultPrevented) return;
|
|
4629
|
-
if (ctx.
|
|
4758
|
+
if (ctx.canSubmitOnEnter && e.key === "Enter") {
|
|
4630
4759
|
e.preventDefault();
|
|
4631
4760
|
ctx.submit();
|
|
4632
|
-
} else if (ctx.
|
|
4761
|
+
} else if (ctx.canCancelOnEscape && e.key === "Escape") {
|
|
4633
4762
|
e.preventDefault();
|
|
4634
4763
|
ctx.cancel();
|
|
4635
4764
|
}
|
|
@@ -4640,14 +4769,14 @@ var EditableInput = forwardRef(
|
|
|
4640
4769
|
ref: composeRefs(forwardedRef, ctx.inputRef),
|
|
4641
4770
|
type: "text",
|
|
4642
4771
|
value: ctx.draft,
|
|
4643
|
-
disabled: ctx.
|
|
4644
|
-
readOnly: ctx.
|
|
4772
|
+
disabled: ctx.isDisabled,
|
|
4773
|
+
readOnly: ctx.isReadOnly,
|
|
4645
4774
|
onChange: (e) => ctx.setDraft(e.target.value),
|
|
4646
4775
|
onKeyDown: handleKeyDown,
|
|
4647
4776
|
onBlur: (e) => {
|
|
4648
4777
|
onBlur?.(e);
|
|
4649
4778
|
if (e.defaultPrevented) return;
|
|
4650
|
-
if (ctx.
|
|
4779
|
+
if (ctx.canSubmitOnBlur) ctx.submit();
|
|
4651
4780
|
},
|
|
4652
4781
|
className: cn(inputBaseVariants({ size, state }), className),
|
|
4653
4782
|
...rest
|
|
@@ -4658,7 +4787,7 @@ var EditableInput = forwardRef(
|
|
|
4658
4787
|
var EditableSubmit = forwardRef(
|
|
4659
4788
|
function EditableSubmit2({ className, onClick, children, type = "button", ...rest }, forwardedRef) {
|
|
4660
4789
|
const ctx = useEditableContext();
|
|
4661
|
-
if (!ctx.
|
|
4790
|
+
if (!ctx.isEditing) return null;
|
|
4662
4791
|
return /* @__PURE__ */ jsx(
|
|
4663
4792
|
"button",
|
|
4664
4793
|
{
|
|
@@ -4684,7 +4813,7 @@ var EditableSubmit = forwardRef(
|
|
|
4684
4813
|
var EditableCancel = forwardRef(
|
|
4685
4814
|
function EditableCancel2({ className, onClick, children, type = "button", ...rest }, forwardedRef) {
|
|
4686
4815
|
const ctx = useEditableContext();
|
|
4687
|
-
if (!ctx.
|
|
4816
|
+
if (!ctx.isEditing) return null;
|
|
4688
4817
|
return /* @__PURE__ */ jsx(
|
|
4689
4818
|
"button",
|
|
4690
4819
|
{
|
|
@@ -4735,8 +4864,8 @@ var Wizard = forwardRef(function Wizard2({
|
|
|
4735
4864
|
return {
|
|
4736
4865
|
id: props.id,
|
|
4737
4866
|
label: props.label,
|
|
4738
|
-
|
|
4739
|
-
|
|
4867
|
+
isOptional: props.isOptional,
|
|
4868
|
+
isFinal: props.isFinal
|
|
4740
4869
|
};
|
|
4741
4870
|
});
|
|
4742
4871
|
const [steps, setSteps] = useState(stepFromChildren);
|
|
@@ -4798,7 +4927,7 @@ var Wizard = forwardRef(function Wizard2({
|
|
|
4798
4927
|
setIsPending(false);
|
|
4799
4928
|
}
|
|
4800
4929
|
}
|
|
4801
|
-
if (currentStep.
|
|
4930
|
+
if (currentStep.isFinal) {
|
|
4802
4931
|
setIsPending(true);
|
|
4803
4932
|
try {
|
|
4804
4933
|
await onComplete?.();
|
|
@@ -4880,7 +5009,7 @@ var WizardSteps = forwardRef(
|
|
|
4880
5009
|
children: [
|
|
4881
5010
|
/* @__PURE__ */ jsx("span", { className: "grid h-5 w-5 place-items-center rounded-full bg-background/20 text-[10px]", children: i + 1 }),
|
|
4882
5011
|
step.label ?? step.id,
|
|
4883
|
-
step.
|
|
5012
|
+
step.isOptional && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[10px] opacity-70", children: "(optional)" })
|
|
4884
5013
|
]
|
|
4885
5014
|
},
|
|
4886
5015
|
step.id
|
|
@@ -4890,14 +5019,14 @@ var WizardSteps = forwardRef(
|
|
|
4890
5019
|
);
|
|
4891
5020
|
}
|
|
4892
5021
|
);
|
|
4893
|
-
var WizardStep = forwardRef(function WizardStep2({ id, label, validate,
|
|
5022
|
+
var WizardStep = forwardRef(function WizardStep2({ id, label, validate, isOptional, isFinal, className, children, ...rest }, ref) {
|
|
4894
5023
|
const ctx = useWizard();
|
|
4895
5024
|
const isCurrent = ctx.currentStep?.id === id;
|
|
4896
5025
|
const { registerStep, unregisterStep, registerValidator, unregisterValidator } = ctx;
|
|
4897
5026
|
useEffect(() => {
|
|
4898
|
-
registerStep({ id, label,
|
|
5027
|
+
registerStep({ id, label, isOptional, isFinal });
|
|
4899
5028
|
return () => unregisterStep(id);
|
|
4900
|
-
}, [registerStep, unregisterStep, id, label,
|
|
5029
|
+
}, [registerStep, unregisterStep, id, label, isOptional, isFinal]);
|
|
4901
5030
|
useEffect(() => {
|
|
4902
5031
|
if (validate) registerValidator(id, validate);
|
|
4903
5032
|
else unregisterValidator(id);
|
|
@@ -4922,13 +5051,13 @@ var WizardFooter = forwardRef(
|
|
|
4922
5051
|
prevLabel = "Back",
|
|
4923
5052
|
nextLabel = "Next",
|
|
4924
5053
|
submitLabel = "Finish",
|
|
4925
|
-
|
|
5054
|
+
hasPrev = true,
|
|
4926
5055
|
className,
|
|
4927
5056
|
...rest
|
|
4928
5057
|
}, ref) {
|
|
4929
5058
|
const ctx = useWizard();
|
|
4930
5059
|
const isFirst = ctx.currentIndex === 0;
|
|
4931
|
-
const isFinal = ctx.currentStep?.
|
|
5060
|
+
const isFinal = ctx.currentStep?.isFinal ?? false;
|
|
4932
5061
|
return /* @__PURE__ */ jsxs(
|
|
4933
5062
|
"div",
|
|
4934
5063
|
{
|
|
@@ -4936,7 +5065,7 @@ var WizardFooter = forwardRef(
|
|
|
4936
5065
|
className: cn("mt-2 flex items-center justify-between gap-3", className),
|
|
4937
5066
|
...rest,
|
|
4938
5067
|
children: [
|
|
4939
|
-
|
|
5068
|
+
hasPrev && !isFirst && ctx.canGoBack ? /* @__PURE__ */ jsx(
|
|
4940
5069
|
"button",
|
|
4941
5070
|
{
|
|
4942
5071
|
type: "button",
|
|
@@ -4971,10 +5100,10 @@ var CodeEditor = forwardRef(
|
|
|
4971
5100
|
onValueChange,
|
|
4972
5101
|
language,
|
|
4973
5102
|
tabSize = 2,
|
|
4974
|
-
|
|
5103
|
+
isTabIndented = false,
|
|
4975
5104
|
disabled,
|
|
4976
5105
|
readOnly,
|
|
4977
|
-
|
|
5106
|
+
isInvalid,
|
|
4978
5107
|
minHeight = "12rem",
|
|
4979
5108
|
placeholder,
|
|
4980
5109
|
className,
|
|
@@ -4991,7 +5120,7 @@ var CodeEditor = forwardRef(
|
|
|
4991
5120
|
const gutterRef = useRef(null);
|
|
4992
5121
|
const [scrollTop, setScrollTop] = useState(0);
|
|
4993
5122
|
const lineCount = useMemo(() => value.split("\n").length, [value]);
|
|
4994
|
-
const indentChar =
|
|
5123
|
+
const indentChar = isTabIndented ? " " : " ".repeat(tabSize);
|
|
4995
5124
|
const insertAtSelection = useCallback(
|
|
4996
5125
|
(insert, selStart, selEnd) => {
|
|
4997
5126
|
const next = value.slice(0, selStart) + insert + value.slice(selEnd);
|
|
@@ -5012,7 +5141,7 @@ var CodeEditor = forwardRef(
|
|
|
5012
5141
|
if (e.shiftKey) {
|
|
5013
5142
|
const lineStart = value.lastIndexOf("\n", start - 1) + 1;
|
|
5014
5143
|
const lineSlice = value.slice(lineStart, start);
|
|
5015
|
-
const match =
|
|
5144
|
+
const match = isTabIndented ? /^\t/ : new RegExp(`^ {1,${tabSize}}`);
|
|
5016
5145
|
const m = match.exec(lineSlice);
|
|
5017
5146
|
if (m) {
|
|
5018
5147
|
const next = value.slice(0, lineStart) + lineSlice.slice(m[0].length) + value.slice(start);
|
|
@@ -5044,7 +5173,7 @@ var CodeEditor = forwardRef(
|
|
|
5044
5173
|
let newStart;
|
|
5045
5174
|
let newEnd;
|
|
5046
5175
|
if (e.shiftKey) {
|
|
5047
|
-
const re =
|
|
5176
|
+
const re = isTabIndented ? /^\t/gm : new RegExp(`^ {1,${tabSize}}`, "gm");
|
|
5048
5177
|
let removedTotal = 0;
|
|
5049
5178
|
let removedFirst = 0;
|
|
5050
5179
|
const outdented = block.replace(re, (m, offset) => {
|
|
@@ -5075,7 +5204,7 @@ var CodeEditor = forwardRef(
|
|
|
5075
5204
|
}
|
|
5076
5205
|
}
|
|
5077
5206
|
};
|
|
5078
|
-
const state =
|
|
5207
|
+
const state = isInvalid ? "invalid" : "default";
|
|
5079
5208
|
const gutterText = useMemo(
|
|
5080
5209
|
() => Array.from({ length: lineCount }, (_, i) => String(i + 1)).join("\n"),
|
|
5081
5210
|
[lineCount]
|
|
@@ -5128,7 +5257,7 @@ var CodeEditor = forwardRef(
|
|
|
5128
5257
|
readOnly,
|
|
5129
5258
|
spellCheck: false,
|
|
5130
5259
|
placeholder,
|
|
5131
|
-
"aria-invalid":
|
|
5260
|
+
"aria-invalid": isInvalid || void 0,
|
|
5132
5261
|
className: "block flex-1 resize-none whitespace-pre overflow-auto bg-transparent px-3 py-2 outline-none placeholder:text-subtle-foreground disabled:cursor-not-allowed"
|
|
5133
5262
|
}
|
|
5134
5263
|
)
|
|
@@ -5196,7 +5325,7 @@ var MarkdownEditor = forwardRef(
|
|
|
5196
5325
|
renderPreview,
|
|
5197
5326
|
disabled,
|
|
5198
5327
|
readOnly,
|
|
5199
|
-
|
|
5328
|
+
isInvalid,
|
|
5200
5329
|
minHeight = "18rem",
|
|
5201
5330
|
placeholder,
|
|
5202
5331
|
className,
|
|
@@ -5240,7 +5369,7 @@ var MarkdownEditor = forwardRef(
|
|
|
5240
5369
|
};
|
|
5241
5370
|
const showEdit = view === "split" || view === "edit";
|
|
5242
5371
|
const showPreview = view === "split" || view === "preview";
|
|
5243
|
-
const state =
|
|
5372
|
+
const state = isInvalid ? "invalid" : "default";
|
|
5244
5373
|
return /* @__PURE__ */ jsxs(
|
|
5245
5374
|
"div",
|
|
5246
5375
|
{
|
|
@@ -5294,7 +5423,7 @@ var MarkdownEditor = forwardRef(
|
|
|
5294
5423
|
disabled,
|
|
5295
5424
|
readOnly,
|
|
5296
5425
|
spellCheck: false,
|
|
5297
|
-
"aria-invalid":
|
|
5426
|
+
"aria-invalid": isInvalid || void 0,
|
|
5298
5427
|
onChange: (e) => setValue(e.target.value),
|
|
5299
5428
|
className: cn(
|
|
5300
5429
|
"flex-1 resize-none whitespace-pre-wrap break-words bg-transparent p-3 font-mono text-sm outline-none placeholder:text-subtle-foreground disabled:cursor-not-allowed",
|
|
@@ -5347,9 +5476,9 @@ var JSONEditor = forwardRef(function JSONEditor2({
|
|
|
5347
5476
|
mode: modeProp,
|
|
5348
5477
|
defaultMode = "tree",
|
|
5349
5478
|
onModeChange,
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5479
|
+
isDisabled,
|
|
5480
|
+
isReadOnly,
|
|
5481
|
+
isInvalid,
|
|
5353
5482
|
indent = 2,
|
|
5354
5483
|
minHeight = "14rem",
|
|
5355
5484
|
className,
|
|
@@ -5372,11 +5501,11 @@ var JSONEditor = forwardRef(function JSONEditor2({
|
|
|
5372
5501
|
"div",
|
|
5373
5502
|
{
|
|
5374
5503
|
ref,
|
|
5375
|
-
"data-state":
|
|
5504
|
+
"data-state": isInvalid ? "invalid" : "default",
|
|
5376
5505
|
className: cn(
|
|
5377
5506
|
"flex flex-col overflow-hidden rounded-md border border-input bg-card text-card-foreground shadow-sm",
|
|
5378
|
-
|
|
5379
|
-
|
|
5507
|
+
isInvalid && "border-destructive",
|
|
5508
|
+
isDisabled && "opacity-60",
|
|
5380
5509
|
className
|
|
5381
5510
|
),
|
|
5382
5511
|
style: { minHeight },
|
|
@@ -5397,22 +5526,22 @@ var JSONEditor = forwardRef(function JSONEditor2({
|
|
|
5397
5526
|
},
|
|
5398
5527
|
m
|
|
5399
5528
|
)) }) }),
|
|
5400
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto", style: { minHeight: 0 }, children: mode === "tree" ? /* @__PURE__ */ jsx(TreeView, { value, updateAt,
|
|
5529
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto", style: { minHeight: 0 }, children: mode === "tree" ? /* @__PURE__ */ jsx(TreeView, { value, updateAt, isDisabled, isReadOnly }) : /* @__PURE__ */ jsx(TextView, { value, setValue, isDisabled, isReadOnly, indent }) })
|
|
5401
5530
|
]
|
|
5402
5531
|
}
|
|
5403
5532
|
);
|
|
5404
5533
|
});
|
|
5405
|
-
function TreeView({ value, updateAt,
|
|
5406
|
-
return /* @__PURE__ */ jsx("ul", { role: "tree", className: "font-mono text-sm", children: /* @__PURE__ */ jsx(TreeNode, { keyName: null, value, path: [], updateAt,
|
|
5534
|
+
function TreeView({ value, updateAt, isDisabled, isReadOnly }) {
|
|
5535
|
+
return /* @__PURE__ */ jsx("ul", { role: "tree", className: "font-mono text-sm", children: /* @__PURE__ */ jsx(TreeNode, { keyName: null, value, path: [], updateAt, isDisabled, isReadOnly, depth: 0 }) });
|
|
5407
5536
|
}
|
|
5408
|
-
function TreeNode({ keyName, value, path, updateAt,
|
|
5537
|
+
function TreeNode({ keyName, value, path, updateAt, isDisabled, isReadOnly, depth }) {
|
|
5409
5538
|
const type = describeType(value);
|
|
5410
5539
|
const isObject = type === "object" || type === "array";
|
|
5411
5540
|
const [open, setOpen] = useState(depth < 2);
|
|
5412
5541
|
const [editing, setEditing] = useState(false);
|
|
5413
5542
|
const [draft, setDraft] = useState("");
|
|
5414
5543
|
const startEdit = () => {
|
|
5415
|
-
if (
|
|
5544
|
+
if (isDisabled || isReadOnly || isObject) return;
|
|
5416
5545
|
setEditing(true);
|
|
5417
5546
|
setDraft(typeof value === "string" ? value : String(value));
|
|
5418
5547
|
};
|
|
@@ -5474,7 +5603,7 @@ function TreeNode({ keyName, value, path, updateAt, disabled, readOnly, depth })
|
|
|
5474
5603
|
onClick: startEdit,
|
|
5475
5604
|
className: cn(
|
|
5476
5605
|
"cursor-text rounded-sm px-1 text-left transition-colors",
|
|
5477
|
-
!
|
|
5606
|
+
!isDisabled && !isReadOnly && "hover:bg-muted",
|
|
5478
5607
|
type === "string" && "text-info",
|
|
5479
5608
|
type === "number" && "text-warning",
|
|
5480
5609
|
type === "boolean" && "text-success",
|
|
@@ -5501,15 +5630,15 @@ function TreeNode({ keyName, value, path, updateAt, disabled, readOnly, depth })
|
|
|
5501
5630
|
value: v,
|
|
5502
5631
|
path: [...path, k],
|
|
5503
5632
|
updateAt,
|
|
5504
|
-
|
|
5505
|
-
|
|
5633
|
+
isDisabled,
|
|
5634
|
+
isReadOnly,
|
|
5506
5635
|
depth: depth + 1
|
|
5507
5636
|
},
|
|
5508
5637
|
String(k)
|
|
5509
5638
|
)) })
|
|
5510
5639
|
] });
|
|
5511
5640
|
}
|
|
5512
|
-
function TextView({ value, setValue,
|
|
5641
|
+
function TextView({ value, setValue, isDisabled, isReadOnly, indent }) {
|
|
5513
5642
|
const initial = useMemo(() => safeStringify(value, indent), [value, indent]);
|
|
5514
5643
|
const [draft, setDraft] = useState(initial);
|
|
5515
5644
|
const [error, setError] = useState(null);
|
|
@@ -5532,8 +5661,8 @@ function TextView({ value, setValue, disabled, readOnly, indent }) {
|
|
|
5532
5661
|
"textarea",
|
|
5533
5662
|
{
|
|
5534
5663
|
value: draft,
|
|
5535
|
-
disabled,
|
|
5536
|
-
readOnly,
|
|
5664
|
+
disabled: isDisabled,
|
|
5665
|
+
readOnly: isReadOnly,
|
|
5537
5666
|
spellCheck: false,
|
|
5538
5667
|
onChange: (e) => {
|
|
5539
5668
|
dirty.current = true;
|
|
@@ -5638,8 +5767,8 @@ var RecurrenceEditor = forwardRef(
|
|
|
5638
5767
|
onValueChange,
|
|
5639
5768
|
from = /* @__PURE__ */ new Date(),
|
|
5640
5769
|
previewCount = 5,
|
|
5641
|
-
|
|
5642
|
-
|
|
5770
|
+
isDisabled,
|
|
5771
|
+
isReadOnly,
|
|
5643
5772
|
name,
|
|
5644
5773
|
className,
|
|
5645
5774
|
...rest
|
|
@@ -5665,7 +5794,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5665
5794
|
ref,
|
|
5666
5795
|
className: cn(
|
|
5667
5796
|
"flex flex-col gap-3 rounded-md border border-border bg-card p-4 text-card-foreground shadow-sm",
|
|
5668
|
-
|
|
5797
|
+
isDisabled && "opacity-60",
|
|
5669
5798
|
className
|
|
5670
5799
|
),
|
|
5671
5800
|
...rest,
|
|
@@ -5679,8 +5808,8 @@ var RecurrenceEditor = forwardRef(
|
|
|
5679
5808
|
min: 1,
|
|
5680
5809
|
max: 999,
|
|
5681
5810
|
value: rule.interval,
|
|
5682
|
-
disabled,
|
|
5683
|
-
readOnly,
|
|
5811
|
+
disabled: isDisabled,
|
|
5812
|
+
readOnly: isReadOnly,
|
|
5684
5813
|
onChange: (e) => update({ interval: Math.max(1, Number(e.target.value) || 1) }),
|
|
5685
5814
|
className: cn(inputBaseVariants({ size: "sm" }), "w-16")
|
|
5686
5815
|
}
|
|
@@ -5690,7 +5819,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5690
5819
|
{
|
|
5691
5820
|
"aria-label": "Frequency",
|
|
5692
5821
|
value: rule.freq,
|
|
5693
|
-
disabled,
|
|
5822
|
+
disabled: isDisabled,
|
|
5694
5823
|
onChange: (e) => update({ freq: e.target.value }),
|
|
5695
5824
|
className: cn(inputBaseVariants({ size: "sm" }), "w-32"),
|
|
5696
5825
|
children: [
|
|
@@ -5712,7 +5841,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5712
5841
|
type: "button",
|
|
5713
5842
|
role: "checkbox",
|
|
5714
5843
|
"aria-checked": checked,
|
|
5715
|
-
disabled:
|
|
5844
|
+
disabled: isDisabled || isReadOnly,
|
|
5716
5845
|
onClick: () => {
|
|
5717
5846
|
const set = new Set(rule.byDay ?? []);
|
|
5718
5847
|
if (set.has(wd)) set.delete(wd);
|
|
@@ -5738,8 +5867,8 @@ var RecurrenceEditor = forwardRef(
|
|
|
5738
5867
|
min: 1,
|
|
5739
5868
|
max: 31,
|
|
5740
5869
|
value: rule.byMonthDay ?? from.getDate(),
|
|
5741
|
-
disabled,
|
|
5742
|
-
readOnly,
|
|
5870
|
+
disabled: isDisabled,
|
|
5871
|
+
readOnly: isReadOnly,
|
|
5743
5872
|
onChange: (e) => update({ byMonthDay: Math.min(31, Math.max(1, Number(e.target.value) || 1)) }),
|
|
5744
5873
|
className: cn(inputBaseVariants({ size: "sm" }), "w-20")
|
|
5745
5874
|
}
|
|
@@ -5754,7 +5883,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5754
5883
|
type: "radio",
|
|
5755
5884
|
name: `${name ?? "rule"}-end`,
|
|
5756
5885
|
checked: endMode === "never",
|
|
5757
|
-
disabled:
|
|
5886
|
+
disabled: isDisabled || isReadOnly,
|
|
5758
5887
|
onChange: () => update({ count: void 0, until: null })
|
|
5759
5888
|
}
|
|
5760
5889
|
),
|
|
@@ -5767,7 +5896,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5767
5896
|
type: "radio",
|
|
5768
5897
|
name: `${name ?? "rule"}-end`,
|
|
5769
5898
|
checked: endMode === "count",
|
|
5770
|
-
disabled:
|
|
5899
|
+
disabled: isDisabled || isReadOnly,
|
|
5771
5900
|
onChange: () => update({ count: rule.count ?? 10, until: null })
|
|
5772
5901
|
}
|
|
5773
5902
|
),
|
|
@@ -5778,7 +5907,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5778
5907
|
type: "number",
|
|
5779
5908
|
min: 1,
|
|
5780
5909
|
value: rule.count ?? "",
|
|
5781
|
-
disabled:
|
|
5910
|
+
disabled: isDisabled || isReadOnly || endMode !== "count",
|
|
5782
5911
|
onChange: (e) => update({ count: Math.max(1, Number(e.target.value) || 1), until: null }),
|
|
5783
5912
|
className: cn(inputBaseVariants({ size: "sm" }), "w-20")
|
|
5784
5913
|
}
|
|
@@ -5792,7 +5921,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5792
5921
|
type: "radio",
|
|
5793
5922
|
name: `${name ?? "rule"}-end`,
|
|
5794
5923
|
checked: endMode === "until",
|
|
5795
|
-
disabled:
|
|
5924
|
+
disabled: isDisabled || isReadOnly,
|
|
5796
5925
|
onChange: () => update({ until: addMonths(from, 6), count: void 0 })
|
|
5797
5926
|
}
|
|
5798
5927
|
),
|
|
@@ -5802,7 +5931,7 @@ var RecurrenceEditor = forwardRef(
|
|
|
5802
5931
|
{
|
|
5803
5932
|
type: "date",
|
|
5804
5933
|
value: formatISODate(rule.until ?? null),
|
|
5805
|
-
disabled:
|
|
5934
|
+
disabled: isDisabled || isReadOnly || endMode !== "until",
|
|
5806
5935
|
onChange: (e) => update({ until: parseISODate(e.target.value), count: void 0 }),
|
|
5807
5936
|
className: cn(inputBaseVariants({ size: "sm" }), "w-44")
|
|
5808
5937
|
}
|
|
@@ -5841,8 +5970,8 @@ var Knob = forwardRef(function Knob2({
|
|
|
5841
5970
|
arcDegrees = 270,
|
|
5842
5971
|
tone = "brand",
|
|
5843
5972
|
format = (v) => v.toFixed(2),
|
|
5844
|
-
|
|
5845
|
-
|
|
5973
|
+
isValueShown = true,
|
|
5974
|
+
isDisabled,
|
|
5846
5975
|
name,
|
|
5847
5976
|
className,
|
|
5848
5977
|
"aria-label": ariaLabel = "Knob",
|
|
@@ -5865,12 +5994,12 @@ var Knob = forwardRef(function Knob2({
|
|
|
5865
5994
|
[min, max, setValue]
|
|
5866
5995
|
);
|
|
5867
5996
|
const handlePointerDown = (e) => {
|
|
5868
|
-
if (
|
|
5997
|
+
if (isDisabled || e.button !== 0) return;
|
|
5869
5998
|
dragStateRef.current = { startY: e.clientY, startValue: value };
|
|
5870
5999
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
5871
6000
|
};
|
|
5872
6001
|
const handlePointerMove = (e) => {
|
|
5873
|
-
if (
|
|
6002
|
+
if (isDisabled || !dragStateRef.current) return;
|
|
5874
6003
|
const dy = dragStateRef.current.startY - e.clientY;
|
|
5875
6004
|
const range = max - min;
|
|
5876
6005
|
const sensitivity = range / 200;
|
|
@@ -5885,16 +6014,16 @@ var Knob = forwardRef(function Knob2({
|
|
|
5885
6014
|
const el = containerRef.current;
|
|
5886
6015
|
if (!el) return;
|
|
5887
6016
|
const handleWheel = (e) => {
|
|
5888
|
-
if (
|
|
6017
|
+
if (isDisabled) return;
|
|
5889
6018
|
e.preventDefault();
|
|
5890
6019
|
const delta = e.deltaY < 0 ? step : -step;
|
|
5891
6020
|
setClamped(value + delta);
|
|
5892
6021
|
};
|
|
5893
6022
|
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
5894
6023
|
return () => el.removeEventListener("wheel", handleWheel);
|
|
5895
|
-
}, [
|
|
6024
|
+
}, [isDisabled, step, value, setClamped]);
|
|
5896
6025
|
const handleKey = (e) => {
|
|
5897
|
-
if (
|
|
6026
|
+
if (isDisabled) return;
|
|
5898
6027
|
const s = e.shiftKey ? largeStep : step;
|
|
5899
6028
|
switch (e.key) {
|
|
5900
6029
|
case "ArrowUp":
|
|
@@ -5946,8 +6075,8 @@ var Knob = forwardRef(function Knob2({
|
|
|
5946
6075
|
"aria-valuemin": min,
|
|
5947
6076
|
"aria-valuemax": max,
|
|
5948
6077
|
"aria-orientation": "vertical",
|
|
5949
|
-
"aria-disabled":
|
|
5950
|
-
tabIndex:
|
|
6078
|
+
"aria-disabled": isDisabled || void 0,
|
|
6079
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
5951
6080
|
onPointerDown: handlePointerDown,
|
|
5952
6081
|
onPointerMove: handlePointerMove,
|
|
5953
6082
|
onPointerUp: handlePointerUp,
|
|
@@ -5957,7 +6086,7 @@ var Knob = forwardRef(function Knob2({
|
|
|
5957
6086
|
className: cn(
|
|
5958
6087
|
"relative inline-flex select-none items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
5959
6088
|
TONE_CLASS[tone],
|
|
5960
|
-
|
|
6089
|
+
isDisabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing",
|
|
5961
6090
|
className
|
|
5962
6091
|
),
|
|
5963
6092
|
...rest,
|
|
@@ -5997,7 +6126,7 @@ var Knob = forwardRef(function Knob2({
|
|
|
5997
6126
|
}
|
|
5998
6127
|
)
|
|
5999
6128
|
] }),
|
|
6000
|
-
|
|
6129
|
+
isValueShown && /* @__PURE__ */ jsx(
|
|
6001
6130
|
"span",
|
|
6002
6131
|
{
|
|
6003
6132
|
"aria-hidden": "true",
|
|
@@ -6187,7 +6316,7 @@ var IconPicker = forwardRef(
|
|
|
6187
6316
|
size = 20,
|
|
6188
6317
|
iconButtonSize = 36,
|
|
6189
6318
|
placeholder = "Search icons\u2026",
|
|
6190
|
-
|
|
6319
|
+
isDisabled,
|
|
6191
6320
|
name,
|
|
6192
6321
|
className,
|
|
6193
6322
|
...rest
|
|
@@ -6220,7 +6349,7 @@ var IconPicker = forwardRef(
|
|
|
6220
6349
|
type: "search",
|
|
6221
6350
|
value: query,
|
|
6222
6351
|
placeholder,
|
|
6223
|
-
disabled,
|
|
6352
|
+
disabled: isDisabled,
|
|
6224
6353
|
onChange: (e) => setQuery(e.target.value),
|
|
6225
6354
|
className: cn(inputBaseVariants({ size: "sm" }))
|
|
6226
6355
|
}
|
|
@@ -6241,7 +6370,7 @@ var IconPicker = forwardRef(
|
|
|
6241
6370
|
type: "button",
|
|
6242
6371
|
"aria-pressed": selected,
|
|
6243
6372
|
"aria-label": key,
|
|
6244
|
-
disabled,
|
|
6373
|
+
disabled: isDisabled,
|
|
6245
6374
|
onClick: () => setValue(key),
|
|
6246
6375
|
style: { width: iconButtonSize, height: iconButtonSize },
|
|
6247
6376
|
className: cn(
|
|
@@ -6285,7 +6414,7 @@ var FontPicker = forwardRef(
|
|
|
6285
6414
|
fonts = BUILT_IN_FONTS,
|
|
6286
6415
|
placeholder = "Select font\u2026",
|
|
6287
6416
|
previewText = "The quick brown fox",
|
|
6288
|
-
|
|
6417
|
+
isDisabled,
|
|
6289
6418
|
name,
|
|
6290
6419
|
className,
|
|
6291
6420
|
...rest
|
|
@@ -6309,7 +6438,7 @@ var FontPicker = forwardRef(
|
|
|
6309
6438
|
"button",
|
|
6310
6439
|
{
|
|
6311
6440
|
type: "button",
|
|
6312
|
-
disabled,
|
|
6441
|
+
disabled: isDisabled,
|
|
6313
6442
|
"aria-haspopup": "listbox",
|
|
6314
6443
|
"aria-expanded": open,
|
|
6315
6444
|
className: cn(
|
|
@@ -6321,7 +6450,7 @@ var FontPicker = forwardRef(
|
|
|
6321
6450
|
]
|
|
6322
6451
|
}
|
|
6323
6452
|
) }),
|
|
6324
|
-
/* @__PURE__ */ jsxs(PopoverContent, {
|
|
6453
|
+
/* @__PURE__ */ jsxs(PopoverContent, { isBare: true, className: "w-[20rem] p-2", children: [
|
|
6325
6454
|
/* @__PURE__ */ jsx(
|
|
6326
6455
|
"input",
|
|
6327
6456
|
{
|
|
@@ -6464,10 +6593,10 @@ var CronInput = forwardRef(
|
|
|
6464
6593
|
defaultValue,
|
|
6465
6594
|
onValueChange,
|
|
6466
6595
|
placeholder = "* * * * *",
|
|
6467
|
-
|
|
6596
|
+
isInvalid,
|
|
6468
6597
|
size,
|
|
6469
6598
|
state,
|
|
6470
|
-
|
|
6599
|
+
hasPreview = true,
|
|
6471
6600
|
disabled,
|
|
6472
6601
|
readOnly,
|
|
6473
6602
|
name,
|
|
@@ -6480,7 +6609,7 @@ var CronInput = forwardRef(
|
|
|
6480
6609
|
onChange: onValueChange
|
|
6481
6610
|
});
|
|
6482
6611
|
const preview = useMemo(() => parseCron(value), [value]);
|
|
6483
|
-
const isError =
|
|
6612
|
+
const isError = isInvalid || preview.startsWith("Invalid") || preview.startsWith("Cron");
|
|
6484
6613
|
const inputState = isError ? "invalid" : state ?? "default";
|
|
6485
6614
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
6486
6615
|
/* @__PURE__ */ jsx(
|
|
@@ -6499,7 +6628,7 @@ var CronInput = forwardRef(
|
|
|
6499
6628
|
className: cn(inputBaseVariants({ size, state: inputState }), "font-mono")
|
|
6500
6629
|
}
|
|
6501
6630
|
),
|
|
6502
|
-
|
|
6631
|
+
hasPreview && /* @__PURE__ */ jsx(
|
|
6503
6632
|
"div",
|
|
6504
6633
|
{
|
|
6505
6634
|
"aria-live": "polite",
|
|
@@ -6530,7 +6659,7 @@ function gradientToCss(g) {
|
|
|
6530
6659
|
return `conic-gradient(from ${g.angle}deg, ${stopsStr})`;
|
|
6531
6660
|
}
|
|
6532
6661
|
var GradientPicker = forwardRef(
|
|
6533
|
-
function GradientPicker2({ value: valueProp, defaultValue, onValueChange,
|
|
6662
|
+
function GradientPicker2({ value: valueProp, defaultValue, onValueChange, isDisabled, name, className, ...rest }, ref) {
|
|
6534
6663
|
const [gradient, setGradient] = useControlled({
|
|
6535
6664
|
controlled: valueProp,
|
|
6536
6665
|
default: defaultValue ?? DEFAULT_GRADIENT,
|
|
@@ -6560,7 +6689,7 @@ var GradientPicker = forwardRef(
|
|
|
6560
6689
|
ref,
|
|
6561
6690
|
className: cn(
|
|
6562
6691
|
"flex flex-col gap-3 rounded-md border border-border bg-card p-3 text-card-foreground shadow-sm",
|
|
6563
|
-
|
|
6692
|
+
isDisabled && "opacity-60",
|
|
6564
6693
|
className
|
|
6565
6694
|
),
|
|
6566
6695
|
...rest,
|
|
@@ -6572,7 +6701,7 @@ var GradientPicker = forwardRef(
|
|
|
6572
6701
|
type: "button",
|
|
6573
6702
|
role: "radio",
|
|
6574
6703
|
"aria-checked": gradient.kind === k,
|
|
6575
|
-
disabled,
|
|
6704
|
+
disabled: isDisabled,
|
|
6576
6705
|
onClick: () => update({ kind: k }),
|
|
6577
6706
|
className: cn(
|
|
6578
6707
|
"inline-flex h-6 items-center rounded px-2 text-xs font-medium transition-colors",
|
|
@@ -6591,7 +6720,7 @@ var GradientPicker = forwardRef(
|
|
|
6591
6720
|
min: 0,
|
|
6592
6721
|
max: 360,
|
|
6593
6722
|
value: gradient.angle,
|
|
6594
|
-
disabled,
|
|
6723
|
+
disabled: isDisabled,
|
|
6595
6724
|
onChange: (e) => update({ angle: Math.max(0, Math.min(360, Number(e.target.value) || 0)) }),
|
|
6596
6725
|
className: cn(inputBaseVariants({ size: "sm" }), "w-20")
|
|
6597
6726
|
}
|
|
@@ -6613,7 +6742,7 @@ var GradientPicker = forwardRef(
|
|
|
6613
6742
|
{
|
|
6614
6743
|
type: "color",
|
|
6615
6744
|
value: stop.color,
|
|
6616
|
-
disabled,
|
|
6745
|
+
disabled: isDisabled,
|
|
6617
6746
|
onChange: (e) => updateStop(i, { color: e.target.value }),
|
|
6618
6747
|
className: "h-7 w-10 cursor-pointer rounded-sm border border-input bg-background"
|
|
6619
6748
|
}
|
|
@@ -6623,7 +6752,7 @@ var GradientPicker = forwardRef(
|
|
|
6623
6752
|
{
|
|
6624
6753
|
type: "text",
|
|
6625
6754
|
value: stop.color,
|
|
6626
|
-
disabled,
|
|
6755
|
+
disabled: isDisabled,
|
|
6627
6756
|
onChange: (e) => updateStop(i, { color: e.target.value }),
|
|
6628
6757
|
className: cn(inputBaseVariants({ size: "sm" }), "flex-1 font-mono")
|
|
6629
6758
|
}
|
|
@@ -6635,7 +6764,7 @@ var GradientPicker = forwardRef(
|
|
|
6635
6764
|
min: 0,
|
|
6636
6765
|
max: 100,
|
|
6637
6766
|
value: stop.position,
|
|
6638
|
-
disabled,
|
|
6767
|
+
disabled: isDisabled,
|
|
6639
6768
|
onChange: (e) => updateStop(i, { position: Math.max(0, Math.min(100, Number(e.target.value) || 0)) }),
|
|
6640
6769
|
className: cn(inputBaseVariants({ size: "sm" }), "w-16")
|
|
6641
6770
|
}
|
|
@@ -6646,7 +6775,7 @@ var GradientPicker = forwardRef(
|
|
|
6646
6775
|
{
|
|
6647
6776
|
type: "button",
|
|
6648
6777
|
"aria-label": "Remove stop",
|
|
6649
|
-
disabled:
|
|
6778
|
+
disabled: isDisabled || gradient.stops.length <= 2,
|
|
6650
6779
|
onClick: () => removeStop(i),
|
|
6651
6780
|
className: "inline-flex h-7 w-7 items-center justify-center rounded text-destructive hover:bg-destructive-soft disabled:pointer-events-none disabled:opacity-40",
|
|
6652
6781
|
children: /* @__PURE__ */ jsx(Icon, { icon: Trash, size: 12 })
|
|
@@ -6657,7 +6786,7 @@ var GradientPicker = forwardRef(
|
|
|
6657
6786
|
"button",
|
|
6658
6787
|
{
|
|
6659
6788
|
type: "button",
|
|
6660
|
-
disabled,
|
|
6789
|
+
disabled: isDisabled,
|
|
6661
6790
|
onClick: addStop,
|
|
6662
6791
|
className: "inline-flex h-8 w-full items-center justify-center gap-1 rounded-md border border-dashed border-border text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
6663
6792
|
children: [
|
|
@@ -6758,7 +6887,7 @@ function configFor(iso) {
|
|
|
6758
6887
|
}
|
|
6759
6888
|
var EMPTY = { country: "US", line1: "", city: "", region: "", postalCode: "" };
|
|
6760
6889
|
var AddressForm = forwardRef(
|
|
6761
|
-
function AddressForm2({ value: valueProp, defaultValue, onValueChange,
|
|
6890
|
+
function AddressForm2({ value: valueProp, defaultValue, onValueChange, isDisabled, isReadOnly, isCompact, name, className, ...rest }, ref) {
|
|
6762
6891
|
const [address, setAddress] = useControlled({
|
|
6763
6892
|
controlled: valueProp,
|
|
6764
6893
|
default: defaultValue ?? EMPTY,
|
|
@@ -6782,7 +6911,7 @@ var AddressForm = forwardRef(
|
|
|
6782
6911
|
{
|
|
6783
6912
|
id: ids.country,
|
|
6784
6913
|
value: address.country,
|
|
6785
|
-
disabled:
|
|
6914
|
+
disabled: isDisabled || isReadOnly,
|
|
6786
6915
|
onChange: (e) => update({ country: e.target.value, region: "" }),
|
|
6787
6916
|
className: cn(inputBaseVariants({ size: "md" })),
|
|
6788
6917
|
children: [
|
|
@@ -6801,8 +6930,8 @@ var AddressForm = forwardRef(
|
|
|
6801
6930
|
type: "text",
|
|
6802
6931
|
autoComplete: "address-line1",
|
|
6803
6932
|
value: address.line1,
|
|
6804
|
-
disabled,
|
|
6805
|
-
readOnly,
|
|
6933
|
+
disabled: isDisabled,
|
|
6934
|
+
readOnly: isReadOnly,
|
|
6806
6935
|
onChange: (e) => update({ line1: e.target.value }),
|
|
6807
6936
|
className: cn(inputBaseVariants({ size: "md" }))
|
|
6808
6937
|
}
|
|
@@ -6820,14 +6949,14 @@ var AddressForm = forwardRef(
|
|
|
6820
6949
|
type: "text",
|
|
6821
6950
|
autoComplete: "address-line2",
|
|
6822
6951
|
value: address.line2 ?? "",
|
|
6823
|
-
disabled,
|
|
6824
|
-
readOnly,
|
|
6952
|
+
disabled: isDisabled,
|
|
6953
|
+
readOnly: isReadOnly,
|
|
6825
6954
|
onChange: (e) => update({ line2: e.target.value }),
|
|
6826
6955
|
className: cn(inputBaseVariants({ size: "md" }))
|
|
6827
6956
|
}
|
|
6828
6957
|
)
|
|
6829
6958
|
] }),
|
|
6830
|
-
/* @__PURE__ */ jsxs("div", { className: cn("grid gap-3",
|
|
6959
|
+
/* @__PURE__ */ jsxs("div", { className: cn("grid gap-3", isCompact ? "grid-cols-1" : "grid-cols-3"), children: [
|
|
6831
6960
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
6832
6961
|
/* @__PURE__ */ jsx("label", { htmlFor: ids.city, className: "text-xs font-medium text-foreground", children: "City" }),
|
|
6833
6962
|
/* @__PURE__ */ jsx(
|
|
@@ -6837,8 +6966,8 @@ var AddressForm = forwardRef(
|
|
|
6837
6966
|
type: "text",
|
|
6838
6967
|
autoComplete: "address-level2",
|
|
6839
6968
|
value: address.city,
|
|
6840
|
-
disabled,
|
|
6841
|
-
readOnly,
|
|
6969
|
+
disabled: isDisabled,
|
|
6970
|
+
readOnly: isReadOnly,
|
|
6842
6971
|
onChange: (e) => update({ city: e.target.value }),
|
|
6843
6972
|
className: cn(inputBaseVariants({ size: "md" }))
|
|
6844
6973
|
}
|
|
@@ -6851,7 +6980,7 @@ var AddressForm = forwardRef(
|
|
|
6851
6980
|
{
|
|
6852
6981
|
id: ids.region,
|
|
6853
6982
|
value: address.region,
|
|
6854
|
-
disabled:
|
|
6983
|
+
disabled: isDisabled || isReadOnly,
|
|
6855
6984
|
onChange: (e) => update({ region: e.target.value }),
|
|
6856
6985
|
className: cn(inputBaseVariants({ size: "md" })),
|
|
6857
6986
|
children: [
|
|
@@ -6866,8 +6995,8 @@ var AddressForm = forwardRef(
|
|
|
6866
6995
|
type: "text",
|
|
6867
6996
|
autoComplete: "address-level1",
|
|
6868
6997
|
value: address.region,
|
|
6869
|
-
disabled,
|
|
6870
|
-
readOnly,
|
|
6998
|
+
disabled: isDisabled,
|
|
6999
|
+
readOnly: isReadOnly,
|
|
6871
7000
|
onChange: (e) => update({ region: e.target.value }),
|
|
6872
7001
|
className: cn(inputBaseVariants({ size: "md" }))
|
|
6873
7002
|
}
|
|
@@ -6882,8 +7011,8 @@ var AddressForm = forwardRef(
|
|
|
6882
7011
|
type: "text",
|
|
6883
7012
|
autoComplete: "postal-code",
|
|
6884
7013
|
value: address.postalCode,
|
|
6885
|
-
disabled,
|
|
6886
|
-
readOnly,
|
|
7014
|
+
disabled: isDisabled,
|
|
7015
|
+
readOnly: isReadOnly,
|
|
6887
7016
|
onChange: (e) => update({ postalCode: e.target.value }),
|
|
6888
7017
|
className: cn(inputBaseVariants({ size: "md" }))
|
|
6889
7018
|
}
|
|
@@ -6971,9 +7100,9 @@ var PhoneInput = forwardRef(
|
|
|
6971
7100
|
defaultValue,
|
|
6972
7101
|
onValueChange,
|
|
6973
7102
|
defaultCountry = "US",
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
7103
|
+
isDisabled,
|
|
7104
|
+
isReadOnly,
|
|
7105
|
+
isInvalid,
|
|
6977
7106
|
placeholder = "(555) 555-5555",
|
|
6978
7107
|
name,
|
|
6979
7108
|
className,
|
|
@@ -7008,8 +7137,8 @@ var PhoneInput = forwardRef(
|
|
|
7008
7137
|
ref,
|
|
7009
7138
|
className: cn(
|
|
7010
7139
|
"inline-flex items-stretch overflow-hidden rounded-md border bg-background",
|
|
7011
|
-
|
|
7012
|
-
|
|
7140
|
+
isInvalid ? "border-destructive" : "border-input",
|
|
7141
|
+
isDisabled && "opacity-60",
|
|
7013
7142
|
className
|
|
7014
7143
|
),
|
|
7015
7144
|
...rest,
|
|
@@ -7019,7 +7148,7 @@ var PhoneInput = forwardRef(
|
|
|
7019
7148
|
{
|
|
7020
7149
|
"aria-label": "Country",
|
|
7021
7150
|
value: iso,
|
|
7022
|
-
disabled:
|
|
7151
|
+
disabled: isDisabled || isReadOnly,
|
|
7023
7152
|
onChange: (e) => setCountry(e.target.value),
|
|
7024
7153
|
className: cn(
|
|
7025
7154
|
"h-10 cursor-pointer border-r border-input bg-card pl-2 pr-1 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
@@ -7040,9 +7169,9 @@ var PhoneInput = forwardRef(
|
|
|
7040
7169
|
autoComplete: "tel-national",
|
|
7041
7170
|
value: national,
|
|
7042
7171
|
placeholder,
|
|
7043
|
-
disabled,
|
|
7044
|
-
readOnly,
|
|
7045
|
-
"aria-invalid":
|
|
7172
|
+
disabled: isDisabled,
|
|
7173
|
+
readOnly: isReadOnly,
|
|
7174
|
+
"aria-invalid": isInvalid || void 0,
|
|
7046
7175
|
onChange: (e) => setNational(e.target.value),
|
|
7047
7176
|
className: cn(
|
|
7048
7177
|
inputBaseVariants({ size: "md" }),
|
|
@@ -7340,7 +7469,7 @@ var EmojiPicker = forwardRef(
|
|
|
7340
7469
|
columns = 8,
|
|
7341
7470
|
cellSize = 28,
|
|
7342
7471
|
categories = EMOJI,
|
|
7343
|
-
|
|
7472
|
+
isDisabled,
|
|
7344
7473
|
className,
|
|
7345
7474
|
...rest
|
|
7346
7475
|
}, ref) {
|
|
@@ -7377,7 +7506,7 @@ var EmojiPicker = forwardRef(
|
|
|
7377
7506
|
},
|
|
7378
7507
|
className: cn(
|
|
7379
7508
|
"flex flex-col rounded-md border border-border bg-card text-card-foreground shadow-sm",
|
|
7380
|
-
|
|
7509
|
+
isDisabled && "opacity-60",
|
|
7381
7510
|
className
|
|
7382
7511
|
),
|
|
7383
7512
|
style: { width: columns * cellSize + 24 },
|
|
@@ -7389,7 +7518,7 @@ var EmojiPicker = forwardRef(
|
|
|
7389
7518
|
type: "search",
|
|
7390
7519
|
value: query,
|
|
7391
7520
|
placeholder,
|
|
7392
|
-
disabled,
|
|
7521
|
+
disabled: isDisabled,
|
|
7393
7522
|
onChange: (e) => setQuery(e.target.value),
|
|
7394
7523
|
className: cn(inputBaseVariants({ size: "sm" }))
|
|
7395
7524
|
}
|
|
@@ -7417,9 +7546,9 @@ var EmojiPicker = forwardRef(
|
|
|
7417
7546
|
"aria-label": "Emoji",
|
|
7418
7547
|
className: "overflow-y-auto p-2",
|
|
7419
7548
|
style: { maxHeight: 280 },
|
|
7420
|
-
children: matches ? matches.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No emoji match." }) : /* @__PURE__ */ jsx("div", { className: "grid", style: { gridTemplateColumns: `repeat(${columns}, ${cellSize}px)` }, children: matches.map((e) => /* @__PURE__ */ jsx(EmojiCell, { entry: e, cellSize,
|
|
7549
|
+
children: matches ? matches.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No emoji match." }) : /* @__PURE__ */ jsx("div", { className: "grid", style: { gridTemplateColumns: `repeat(${columns}, ${cellSize}px)` }, children: matches.map((e) => /* @__PURE__ */ jsx(EmojiCell, { entry: e, cellSize, isDisabled, onSelect }, e.emoji)) }) : categories.map((cat) => /* @__PURE__ */ jsxs("div", { "data-cat": cat.id, id: `emoji-cat-${cat.id}`, className: "mb-3", children: [
|
|
7421
7550
|
/* @__PURE__ */ jsx("div", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: cat.label }),
|
|
7422
|
-
/* @__PURE__ */ jsx("div", { className: "grid", style: { gridTemplateColumns: `repeat(${columns}, ${cellSize}px)` }, children: cat.emojis.map((e) => /* @__PURE__ */ jsx(EmojiCell, { entry: e, cellSize,
|
|
7551
|
+
/* @__PURE__ */ jsx("div", { className: "grid", style: { gridTemplateColumns: `repeat(${columns}, ${cellSize}px)` }, children: cat.emojis.map((e) => /* @__PURE__ */ jsx(EmojiCell, { entry: e, cellSize, isDisabled, onSelect }, e.emoji)) })
|
|
7423
7552
|
] }, cat.id))
|
|
7424
7553
|
}
|
|
7425
7554
|
)
|
|
@@ -7428,13 +7557,13 @@ var EmojiPicker = forwardRef(
|
|
|
7428
7557
|
);
|
|
7429
7558
|
}
|
|
7430
7559
|
);
|
|
7431
|
-
function EmojiCell({ entry, cellSize,
|
|
7560
|
+
function EmojiCell({ entry, cellSize, isDisabled, onSelect }) {
|
|
7432
7561
|
return /* @__PURE__ */ jsx("div", { role: "gridcell", children: /* @__PURE__ */ jsx(
|
|
7433
7562
|
"button",
|
|
7434
7563
|
{
|
|
7435
7564
|
type: "button",
|
|
7436
7565
|
"aria-label": entry.name,
|
|
7437
|
-
disabled,
|
|
7566
|
+
disabled: isDisabled,
|
|
7438
7567
|
onClick: () => onSelect(entry.emoji),
|
|
7439
7568
|
style: { width: cellSize, height: cellSize },
|
|
7440
7569
|
className: "inline-flex items-center justify-center rounded-md text-lg transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
@@ -7454,7 +7583,7 @@ var ReactionPicker = forwardRef(
|
|
|
7454
7583
|
selected,
|
|
7455
7584
|
onSelect,
|
|
7456
7585
|
onMore,
|
|
7457
|
-
|
|
7586
|
+
isMoreHidden,
|
|
7458
7587
|
size = "md",
|
|
7459
7588
|
className,
|
|
7460
7589
|
...props
|
|
@@ -7491,7 +7620,7 @@ var ReactionPicker = forwardRef(
|
|
|
7491
7620
|
emoji
|
|
7492
7621
|
);
|
|
7493
7622
|
}),
|
|
7494
|
-
!
|
|
7623
|
+
!isMoreHidden && onMore && /* @__PURE__ */ jsx(
|
|
7495
7624
|
"button",
|
|
7496
7625
|
{
|
|
7497
7626
|
type: "button",
|
|
@@ -7517,11 +7646,11 @@ var ChatComposer = forwardRef(
|
|
|
7517
7646
|
onValueChange,
|
|
7518
7647
|
onSubmit,
|
|
7519
7648
|
placeholder = "Write a message\u2026",
|
|
7520
|
-
|
|
7649
|
+
isDisabled,
|
|
7521
7650
|
leading,
|
|
7522
7651
|
trailing,
|
|
7523
7652
|
sendButton,
|
|
7524
|
-
|
|
7653
|
+
isSendButtonHidden,
|
|
7525
7654
|
submitOn = "enter",
|
|
7526
7655
|
maxHeight = 200,
|
|
7527
7656
|
textareaProps,
|
|
@@ -7549,7 +7678,7 @@ var ChatComposer = forwardRef(
|
|
|
7549
7678
|
const handleSubmit = (e) => {
|
|
7550
7679
|
e?.preventDefault();
|
|
7551
7680
|
const trimmed = value.trim();
|
|
7552
|
-
if (!trimmed ||
|
|
7681
|
+
if (!trimmed || isDisabled) return;
|
|
7553
7682
|
onSubmit?.(trimmed);
|
|
7554
7683
|
if (valueProp === void 0) setValue("");
|
|
7555
7684
|
};
|
|
@@ -7572,7 +7701,7 @@ var ChatComposer = forwardRef(
|
|
|
7572
7701
|
className: cn(
|
|
7573
7702
|
"flex w-full items-end gap-2 rounded-2xl border border-input bg-background px-3 py-2",
|
|
7574
7703
|
"focus-within:ring-2 focus-within:ring-ring",
|
|
7575
|
-
|
|
7704
|
+
isDisabled && "cursor-not-allowed opacity-60",
|
|
7576
7705
|
className
|
|
7577
7706
|
),
|
|
7578
7707
|
...props,
|
|
@@ -7588,7 +7717,7 @@ var ChatComposer = forwardRef(
|
|
|
7588
7717
|
onKeyDown: handleKeyDown,
|
|
7589
7718
|
rows: 1,
|
|
7590
7719
|
placeholder,
|
|
7591
|
-
disabled,
|
|
7720
|
+
disabled: isDisabled,
|
|
7592
7721
|
className: cn(
|
|
7593
7722
|
"flex-1 resize-none bg-transparent py-1 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none",
|
|
7594
7723
|
textareaProps?.className
|
|
@@ -7596,11 +7725,11 @@ var ChatComposer = forwardRef(
|
|
|
7596
7725
|
}
|
|
7597
7726
|
),
|
|
7598
7727
|
trailing && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-1 self-end pb-1", children: trailing }),
|
|
7599
|
-
!
|
|
7728
|
+
!isSendButtonHidden && (sendButton ?? /* @__PURE__ */ jsx(
|
|
7600
7729
|
"button",
|
|
7601
7730
|
{
|
|
7602
7731
|
type: "submit",
|
|
7603
|
-
disabled:
|
|
7732
|
+
disabled: isDisabled || isEmpty,
|
|
7604
7733
|
"aria-label": "Send message",
|
|
7605
7734
|
className: cn(
|
|
7606
7735
|
"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full self-end",
|
|
@@ -7619,5 +7748,5 @@ var ChatComposer = forwardRef(
|
|
|
7619
7748
|
ChatComposer.displayName = "ChatComposer";
|
|
7620
7749
|
|
|
7621
7750
|
export { ADDRESS_COUNTRIES, AddressForm, BUILT_IN_EMOJI, BUILT_IN_FONTS, Calendar, CharacterCount, ChatComposer, Checkbox, CheckboxField, CheckboxGroup, ChoiceCard, CodeEditor, ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker, ColorWheel, Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxSeparator, CronInput, CurrencyInput, DateField, DatePicker, DateRangePicker, Editable, EditableCancel, EditableInput, EditablePreview, EditableSubmit, EmailInput, EmojiPicker, Fieldset, FilePicker, FileUpload, FontPicker, FormErrorMessage, FormField, FormHelperText, GradientPicker, IconPicker, InputAddon, InputGroup, JSONEditor, KeyboardShortcutPicker, Knob, Label, LabeledInput, Legend, Listbox, ListboxEmpty, ListboxGroup, ListboxItem, ListboxSeparator, MarkdownEditor, MaskedInput, MultiSelect, MultiSelectContent, MultiSelectItem, MultiSelectTags, MultiSelectTrigger, NumberInput, PHONE_COUNTRIES, PasswordInput, PasswordStrength, PercentInput, PhoneInput, PinInput, Radio, RadioField, RadioGroup, RangeCalendar, ReactionPicker, RecurrenceEditor, SearchInput, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Slider, Stepper, StepperList, StepperPanel, StepperStep, Switch, SwitchField, TagsInput, TelInput, TextInput, Textarea, TimeField, TimePicker, UrlInput, Wizard, WizardFooter, WizardStep, WizardSteps, colorSwatchVariants, gradientToCss, useWizard };
|
|
7622
|
-
//# sourceMappingURL=chunk-
|
|
7623
|
-
//# sourceMappingURL=chunk-
|
|
7751
|
+
//# sourceMappingURL=chunk-HG7NX6GP.js.map
|
|
7752
|
+
//# sourceMappingURL=chunk-HG7NX6GP.js.map
|