@kazee-ds/react 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/index.js +186 -32
- package/dist/index.js.map +1 -1
- package/dist/types/Combobox.d.ts +9 -0
- package/dist/types/Dialog.d.ts +10 -2
- package/dist/types/Input.d.ts +1 -1
- package/dist/types/Popover.d.ts +6 -2
- package/dist/types/Select.d.ts +1 -0
- package/dist/types/combobox-composition.d.ts +16 -5
- package/dist/types/selection-popover.d.ts +3 -0
- package/dist/types/structural-parts.d.ts +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @kazee-ds/react
|
|
2
2
|
|
|
3
|
+
Workspace additions: full-control Combobox anchoring, bounded popovers, Select-compatible sizing and opt-in focus/nonempty-selection policies. These additions are unpublished; see [Combobox and option-list documentation](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/select-and-combobox.md).
|
|
4
|
+
|
|
3
5
|
Accessible Kazee React components, including Toast, built on React Aria Components. Requires React/React DOM 19+ and ESM.
|
|
4
6
|
|
|
5
|
-
Version **0.
|
|
7
|
+
Version **0.10.0** adds Combobox sizing, focus/search and nonempty-selection policies, full-control popovers, and compact and compound Dialog header/footer dividers and builds on controlled selectable Card actions, Avatar/AvatarGroup, expanded Badge, sized/icon Switch, interactive/compact Card, dense controls, input clearing and composable date/time families. Existing compact APIs remain supported. Verify registry availability before installing; use matching local packed artifacts for checkout testing. See [component expansion](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/component-expansion.md) and [release status](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.md).
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
Version 0.5.3 ignores Toast shortcut events with missing or non-string keys. Normal shortcuts and scoped Escape dismissal remain available.
|
|
@@ -12,7 +14,7 @@ Version 0.5.3 ignores Toast shortcut events with missing or non-string keys. Nor
|
|
|
12
14
|
Public npm installation requires no read token or login. Preserve the application's package manager and lockfile.
|
|
13
15
|
|
|
14
16
|
```sh
|
|
15
|
-
npm install --save-exact @kazee-ds/react@0.
|
|
17
|
+
npm install --save-exact @kazee-ds/react@0.10.0 @kazee-ds/styles@0.10.0
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## Use
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { ToggleButton as ToggleButton$1 } from "react-aria-components/ToggleButton";
|
|
7
7
|
import { ToggleButtonGroup as ToggleButtonGroup$1 } from "react-aria-components/ToggleButtonGroup";
|
|
8
8
|
import { I18nProvider, useLocale } from "react-aria-components/I18nProvider";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Popover as Popover$1 } from "react-aria-components/Popover";
|
|
10
|
+
import { Button as Button$2, Label as Label$1, ListBox as ListBox$1, ListBoxItem, Select as Select$1, SelectStateContext, SelectValue } from "react-aria-components/Select";
|
|
11
11
|
import { ListBox as ListBox$2, ListBoxItem as ListBoxItem$1, ListBoxSection } from "react-aria-components/ListBox";
|
|
12
12
|
import { Text } from "react-aria-components/Text";
|
|
13
13
|
import { Header, Header as Header$1 } from "react-aria-components/Header";
|
|
@@ -26,7 +26,7 @@ import { Modal, ModalOverlay } from "react-aria-components/Modal";
|
|
|
26
26
|
import { Tooltip as Tooltip$1, TooltipTrigger } from "react-aria-components/Tooltip";
|
|
27
27
|
import { Menu, MenuItem, MenuSection, MenuTrigger, SubmenuTrigger } from "react-aria-components/Menu";
|
|
28
28
|
import { Separator as Separator$1 } from "react-aria-components/Separator";
|
|
29
|
-
import { Button as Button$5, ComboBox, ComboBoxStateContext, Input as Input$3, Label as Label$6, ListBox as ListBox$3, ListBoxItem as ListBoxItem$2
|
|
29
|
+
import { Button as Button$5, ComboBox, ComboBoxStateContext, Input as Input$3, Label as Label$6, ListBox as ListBox$3, ListBoxItem as ListBoxItem$2 } from "react-aria-components/ComboBox";
|
|
30
30
|
import { CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, RangeCalendar as RangeCalendar$1, RangeCalendarStateContext } from "react-aria-components/RangeCalendar";
|
|
31
31
|
import { CalendarDate, GregorianCalendar, endOfMonth, getLocalTimeZone, now, parseAbsolute, parseDate, parseDateTime, parseTime, parseZonedDateTime, startOfMonth, startOfWeek, toCalendarDateTime, toZoned, today } from "@internationalized/date";
|
|
32
32
|
import { Calendar as Calendar$1, CalendarCell as CalendarCell$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, CalendarStateContext } from "react-aria-components/Calendar";
|
|
@@ -188,6 +188,40 @@ function Root$1(props) {
|
|
|
188
188
|
}
|
|
189
189
|
var ToggleButtonGroup = /* @__PURE__ */ Object.assign(Root$1, { Separator: ButtonGroupSeparator });
|
|
190
190
|
//#endregion
|
|
191
|
+
//#region src/selection-popover.tsx
|
|
192
|
+
/** Positioning must receive the cap: its available-space inline style wins over CSS. */
|
|
193
|
+
function SelectionPopover({ maxHeight, ...props }) {
|
|
194
|
+
const [remHeight, setRemHeight] = useState(256);
|
|
195
|
+
useLayoutEffect(() => {
|
|
196
|
+
if (maxHeight !== void 0 && Number.isFinite(maxHeight) && maxHeight > 0) return;
|
|
197
|
+
const root = document.documentElement;
|
|
198
|
+
const update = () => setRemHeight((parseFloat(getComputedStyle(root).fontSize) || 16) * 16);
|
|
199
|
+
update();
|
|
200
|
+
const resize = new ResizeObserver(update);
|
|
201
|
+
resize.observe(root);
|
|
202
|
+
const mutation = new MutationObserver(update);
|
|
203
|
+
mutation.observe(root, {
|
|
204
|
+
attributes: true,
|
|
205
|
+
attributeFilter: [
|
|
206
|
+
"style",
|
|
207
|
+
"class",
|
|
208
|
+
"data-theme"
|
|
209
|
+
]
|
|
210
|
+
});
|
|
211
|
+
window.addEventListener("resize", update);
|
|
212
|
+
return () => {
|
|
213
|
+
resize.disconnect();
|
|
214
|
+
mutation.disconnect();
|
|
215
|
+
window.removeEventListener("resize", update);
|
|
216
|
+
};
|
|
217
|
+
}, [maxHeight]);
|
|
218
|
+
const limit = maxHeight !== void 0 && Number.isFinite(maxHeight) && maxHeight > 0 ? maxHeight : remHeight;
|
|
219
|
+
return /* @__PURE__ */ jsx(Popover$1, {
|
|
220
|
+
...props,
|
|
221
|
+
maxHeight: limit
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
191
225
|
//#region src/label-context.ts
|
|
192
226
|
/** Item labels use Text slots rather than introducing native label elements. */
|
|
193
227
|
var ItemLabelContext = createContext(false);
|
|
@@ -424,7 +458,7 @@ function SelectClearButton({ className, children, "aria-label": label = "Hapus p
|
|
|
424
458
|
}
|
|
425
459
|
function SelectPopover({ className, ...props }) {
|
|
426
460
|
const { classNames } = useContext(SelectPartsContext);
|
|
427
|
-
return /* @__PURE__ */ jsx(
|
|
461
|
+
return /* @__PURE__ */ jsx(SelectionPopover, {
|
|
428
462
|
...props,
|
|
429
463
|
className: partClass(partClass("select__popover", classNames?.popover), className)
|
|
430
464
|
});
|
|
@@ -689,7 +723,8 @@ function SelectCompact(props) {
|
|
|
689
723
|
children: /* @__PURE__ */ jsx(CloseIcon, { className: partClass("selection__close-icon", props.classNames?.clearIcon) })
|
|
690
724
|
})]
|
|
691
725
|
}),
|
|
692
|
-
/* @__PURE__ */ jsx(
|
|
726
|
+
/* @__PURE__ */ jsx(SelectionPopover, {
|
|
727
|
+
maxHeight: props.maxHeight,
|
|
693
728
|
className: partClass("select__popover", props.classNames?.popover),
|
|
694
729
|
children: /* @__PURE__ */ jsx(ListBox$1, {
|
|
695
730
|
className: partClass("select__list", props.classNames?.list),
|
|
@@ -2728,9 +2763,18 @@ function DialogContent(props) {
|
|
|
2728
2763
|
base: "dialog__content"
|
|
2729
2764
|
});
|
|
2730
2765
|
}
|
|
2731
|
-
|
|
2766
|
+
function dividedPart(base) {
|
|
2767
|
+
return function Part({ divided, className, ...props }) {
|
|
2768
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2769
|
+
...props,
|
|
2770
|
+
className: partClass(base, className),
|
|
2771
|
+
"data-divided": divided || void 0
|
|
2772
|
+
});
|
|
2773
|
+
};
|
|
2774
|
+
}
|
|
2775
|
+
var OverlayHeader = dividedPart("overlay__header");
|
|
2732
2776
|
var OverlayBody = divPart("overlay__body");
|
|
2733
|
-
var OverlayFooter =
|
|
2777
|
+
var OverlayFooter = dividedPart("overlay__footer");
|
|
2734
2778
|
function OverlayHeading({ level = 2, slot = "title", ...props }) {
|
|
2735
2779
|
return /* @__PURE__ */ jsx(Heading, {
|
|
2736
2780
|
...props,
|
|
@@ -2759,7 +2803,7 @@ function DialogCloseButton({ slot = "close", ...props }) {
|
|
|
2759
2803
|
});
|
|
2760
2804
|
}
|
|
2761
2805
|
var PopoverTrigger = DialogTriggerPart;
|
|
2762
|
-
var PopoverContent = ariaPart(Popover$
|
|
2806
|
+
var PopoverContent = ariaPart(Popover$1, "popover__panel");
|
|
2763
2807
|
function PopoverDialog(props) {
|
|
2764
2808
|
return /* @__PURE__ */ jsx(DescribedDialog, {
|
|
2765
2809
|
...props,
|
|
@@ -2790,7 +2834,7 @@ function DropdownRoot({ open, defaultOpen, ...props }) {
|
|
|
2790
2834
|
});
|
|
2791
2835
|
}
|
|
2792
2836
|
var DropdownTrigger = DialogTriggerPart;
|
|
2793
|
-
var DropdownPopover = ariaPart(Popover$
|
|
2837
|
+
var DropdownPopover = ariaPart(Popover$1, "menu__panel");
|
|
2794
2838
|
function DropdownList(props) {
|
|
2795
2839
|
return /* @__PURE__ */ jsx(Menu, {
|
|
2796
2840
|
...props,
|
|
@@ -3575,6 +3619,7 @@ function CompactDialog(props) {
|
|
|
3575
3619
|
/* @__PURE__ */ jsxs("div", {
|
|
3576
3620
|
className: partClass("overlay__header", classNames?.header),
|
|
3577
3621
|
"data-close-button": showCloseButton || void 0,
|
|
3622
|
+
"data-divided": props.dividedHeader || void 0,
|
|
3578
3623
|
children: [
|
|
3579
3624
|
/* @__PURE__ */ jsx(Heading, {
|
|
3580
3625
|
level: 2,
|
|
@@ -3601,6 +3646,7 @@ function CompactDialog(props) {
|
|
|
3601
3646
|
}),
|
|
3602
3647
|
(footer || showFooterClose) && /* @__PURE__ */ jsxs("div", {
|
|
3603
3648
|
className: partClass("overlay__footer", classNames?.footer),
|
|
3649
|
+
"data-divided": props.dividedFooter || void 0,
|
|
3604
3650
|
children: [footer, showFooterClose && /* @__PURE__ */ jsx(Button$1, {
|
|
3605
3651
|
className: partClass("button button--secondary", classNames?.footerClose),
|
|
3606
3652
|
onPress: () => change(false),
|
|
@@ -3725,7 +3771,7 @@ function CompactDropdownMenu(props) {
|
|
|
3725
3771
|
shouldCloseOnSelect: closeOnSelect,
|
|
3726
3772
|
children: content(item)
|
|
3727
3773
|
}, item.id);
|
|
3728
|
-
return item.children?.length ? /* @__PURE__ */ jsxs(SubmenuTrigger, { children: [row, /* @__PURE__ */ jsx(Popover$
|
|
3774
|
+
return item.children?.length ? /* @__PURE__ */ jsxs(SubmenuTrigger, { children: [row, /* @__PURE__ */ jsx(Popover$1, {
|
|
3729
3775
|
className: partClass("menu__panel", classNames?.panel),
|
|
3730
3776
|
offset: 4,
|
|
3731
3777
|
containerPadding: 16,
|
|
@@ -3754,7 +3800,7 @@ function CompactDropdownMenu(props) {
|
|
|
3754
3800
|
"aria-label": triggerLabel,
|
|
3755
3801
|
isDisabled: isDisabled || !items.length,
|
|
3756
3802
|
children: props.triggerContent ?? triggerLabel
|
|
3757
|
-
}), /* @__PURE__ */ jsx(Popover$
|
|
3803
|
+
}), /* @__PURE__ */ jsx(Popover$1, {
|
|
3758
3804
|
className: partClass("menu__panel", classNames?.panel),
|
|
3759
3805
|
placement: popoverPlacement,
|
|
3760
3806
|
offset: 8,
|
|
@@ -3794,7 +3840,7 @@ function CompactPopover({ className, style, classNames, triggerLabel, title, des
|
|
|
3794
3840
|
className: partClass("button button--secondary", classNames?.trigger),
|
|
3795
3841
|
isDisabled,
|
|
3796
3842
|
children: triggerLabel
|
|
3797
|
-
}), /* @__PURE__ */ jsx(Popover$
|
|
3843
|
+
}), /* @__PURE__ */ jsx(Popover$1, {
|
|
3798
3844
|
className: partClass(partClass(partClass("popover__panel", classNames?.panel), classNames?.root), className),
|
|
3799
3845
|
style,
|
|
3800
3846
|
isNonModal: true,
|
|
@@ -3931,27 +3977,121 @@ function Spinner({ size = "md", color = "current", label, id, className, style,
|
|
|
3931
3977
|
}
|
|
3932
3978
|
//#endregion
|
|
3933
3979
|
//#region src/combobox-composition.tsx
|
|
3934
|
-
var
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3980
|
+
var ComboboxPolicyContext = createContext({
|
|
3981
|
+
disabled: false,
|
|
3982
|
+
selectOnFocus: false,
|
|
3983
|
+
disallowEmptySelection: false,
|
|
3984
|
+
menuTrigger: "input",
|
|
3985
|
+
maxHeight: void 0,
|
|
3986
|
+
manageReset: false,
|
|
3987
|
+
controlled: false,
|
|
3988
|
+
resetting: { current: false },
|
|
3989
|
+
resetLocal: () => {}
|
|
3990
|
+
});
|
|
3991
|
+
function useComboState() {
|
|
3992
|
+
return useContext(ComboBoxStateContext);
|
|
3993
|
+
}
|
|
3994
|
+
function ComboboxComposition({ className, onChange, size = "md", variant = "primary", hideLabel, fullWidth = true, selectOnFocus = false, disallowEmptySelection = false, maxHeight, ...props }) {
|
|
3995
|
+
const [local, setLocal] = useState(props.defaultValue ?? null);
|
|
3996
|
+
const resetting = useRef(false);
|
|
3997
|
+
const resetLocal = useCallback(() => setLocal(props.defaultValue ?? null), [props.defaultValue]);
|
|
3998
|
+
const value = props.value !== void 0 ? props.value : local;
|
|
3999
|
+
return /* @__PURE__ */ jsx(ComboboxPolicyContext.Provider, {
|
|
4000
|
+
value: {
|
|
4001
|
+
disabled: !!props.isDisabled,
|
|
4002
|
+
selectOnFocus,
|
|
4003
|
+
disallowEmptySelection,
|
|
4004
|
+
menuTrigger: props.menuTrigger ?? "input",
|
|
4005
|
+
maxHeight,
|
|
4006
|
+
manageReset: props.inputValue === void 0,
|
|
4007
|
+
controlled: props.value !== void 0,
|
|
4008
|
+
resetting,
|
|
4009
|
+
resetLocal
|
|
4010
|
+
},
|
|
3938
4011
|
children: /* @__PURE__ */ jsx(ComboBox, {
|
|
3939
4012
|
...props,
|
|
3940
|
-
|
|
3941
|
-
|
|
4013
|
+
...disallowEmptySelection ? { value } : {},
|
|
4014
|
+
onChange: (key) => {
|
|
4015
|
+
if (resetting.current) return;
|
|
4016
|
+
if (disallowEmptySelection && key == null) return;
|
|
4017
|
+
const next = key == null ? null : String(key);
|
|
4018
|
+
setLocal(next);
|
|
4019
|
+
onChange?.(next);
|
|
4020
|
+
},
|
|
4021
|
+
onInputChange: (text) => {
|
|
4022
|
+
if (!resetting.current) props.onInputChange?.(text);
|
|
4023
|
+
},
|
|
4024
|
+
className: partClass(`select combobox select--${size} select--${variant}${hideLabel ? " select--label-hidden" : ""}${!fullWidth ? " select--fit" : ""}`, className)
|
|
3942
4025
|
})
|
|
3943
4026
|
});
|
|
3944
4027
|
}
|
|
3945
4028
|
function ComboboxInputGroup({ className, ...props }) {
|
|
3946
|
-
|
|
4029
|
+
const state = useComboState();
|
|
4030
|
+
return /* @__PURE__ */ jsx(Group, {
|
|
3947
4031
|
...props,
|
|
3948
|
-
className: partClass("combobox__control", className)
|
|
4032
|
+
className: partClass("combobox__control", className),
|
|
4033
|
+
onKeyDownCapture: (event) => {
|
|
4034
|
+
props.onKeyDownCapture?.(event);
|
|
4035
|
+
if (!event.defaultPrevented && event.key === "Escape" && state?.isOpen && !event.nativeEvent.isComposing) {
|
|
4036
|
+
event.preventDefault();
|
|
4037
|
+
event.stopPropagation();
|
|
4038
|
+
state.revert();
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
3949
4041
|
});
|
|
3950
4042
|
}
|
|
3951
4043
|
function ComboboxInput({ className, ...props }) {
|
|
4044
|
+
const policy = useContext(ComboboxPolicyContext);
|
|
4045
|
+
const state = useComboState();
|
|
4046
|
+
const inputRef = useRef(null);
|
|
4047
|
+
const selectClick = useRef(false);
|
|
4048
|
+
const forwardedRef = props.ref;
|
|
4049
|
+
const captureRef = useCallback((node) => {
|
|
4050
|
+
inputRef.current = node;
|
|
4051
|
+
if (typeof forwardedRef === "function") return forwardedRef(node);
|
|
4052
|
+
if (forwardedRef) forwardedRef.current = node;
|
|
4053
|
+
}, [forwardedRef]);
|
|
4054
|
+
useEffect(() => {
|
|
4055
|
+
const form = inputRef.current?.form;
|
|
4056
|
+
if (!form || !policy.manageReset || !state) return;
|
|
4057
|
+
const onReset = (event) => {
|
|
4058
|
+
const value = state.value;
|
|
4059
|
+
const text = state.inputValue;
|
|
4060
|
+
policy.resetting.current = true;
|
|
4061
|
+
queueMicrotask(() => {
|
|
4062
|
+
if (event.defaultPrevented || policy.controlled) {
|
|
4063
|
+
state.setValue(value);
|
|
4064
|
+
state.setInputValue(text);
|
|
4065
|
+
} else policy.resetLocal();
|
|
4066
|
+
policy.resetting.current = false;
|
|
4067
|
+
});
|
|
4068
|
+
};
|
|
4069
|
+
form.addEventListener("reset", onReset, true);
|
|
4070
|
+
return () => form.removeEventListener("reset", onReset, true);
|
|
4071
|
+
}, [policy, state]);
|
|
3952
4072
|
return /* @__PURE__ */ jsx(Input$3, {
|
|
3953
4073
|
...props,
|
|
3954
|
-
|
|
4074
|
+
ref: captureRef,
|
|
4075
|
+
className: partClass("combobox__input", className),
|
|
4076
|
+
onFocus: (event) => {
|
|
4077
|
+
props.onFocus?.(event);
|
|
4078
|
+
if (policy.selectOnFocus && !policy.disabled) event.currentTarget.select();
|
|
4079
|
+
},
|
|
4080
|
+
onPointerDown: (event) => {
|
|
4081
|
+
props.onPointerDown?.(event);
|
|
4082
|
+
selectClick.current = policy.selectOnFocus && document.activeElement !== event.currentTarget;
|
|
4083
|
+
if (selectClick.current && !event.defaultPrevented && !policy.disabled) {
|
|
4084
|
+
event.preventDefault();
|
|
4085
|
+
event.currentTarget.focus();
|
|
4086
|
+
event.currentTarget.select();
|
|
4087
|
+
}
|
|
4088
|
+
},
|
|
4089
|
+
onClick: (event) => {
|
|
4090
|
+
props.onClick?.(event);
|
|
4091
|
+
if (selectClick.current && !event.defaultPrevented && !policy.disabled) event.currentTarget.select();
|
|
4092
|
+
selectClick.current = false;
|
|
4093
|
+
if (!event.defaultPrevented && !policy.disabled && policy.menuTrigger === "focus" && !state?.isOpen) state?.open(null, "focus");
|
|
4094
|
+
}
|
|
3955
4095
|
});
|
|
3956
4096
|
}
|
|
3957
4097
|
function ComboboxTrigger({ className, children, ...props }) {
|
|
@@ -3963,14 +4103,17 @@ function ComboboxTrigger({ className, children, ...props }) {
|
|
|
3963
4103
|
});
|
|
3964
4104
|
}
|
|
3965
4105
|
function ComboboxPopover({ className, ...props }) {
|
|
3966
|
-
|
|
4106
|
+
const policy = useContext(ComboboxPolicyContext);
|
|
4107
|
+
return /* @__PURE__ */ jsx(SelectionPopover, {
|
|
4108
|
+
maxHeight: policy.maxHeight,
|
|
3967
4109
|
...props,
|
|
3968
4110
|
className: partClass("select__popover combobox__popover", className)
|
|
3969
4111
|
});
|
|
3970
4112
|
}
|
|
3971
4113
|
function ComboboxClearButton({ className, children, "aria-label": label = "Hapus pilihan", ...props }) {
|
|
3972
4114
|
const state = useContext(ComboBoxStateContext);
|
|
3973
|
-
const disabled = useContext(
|
|
4115
|
+
const { disabled, disallowEmptySelection } = useContext(ComboboxPolicyContext);
|
|
4116
|
+
if (disallowEmptySelection) return null;
|
|
3974
4117
|
return /* @__PURE__ */ jsx("button", {
|
|
3975
4118
|
...props,
|
|
3976
4119
|
type: "button",
|
|
@@ -4015,16 +4158,27 @@ function CompactCombobox(props) {
|
|
|
4015
4158
|
props.onChange?.(next);
|
|
4016
4159
|
setDraft(null);
|
|
4017
4160
|
}
|
|
4018
|
-
const content = /* @__PURE__ */ jsxs(
|
|
4161
|
+
const content = /* @__PURE__ */ jsxs(ComboboxComposition, {
|
|
4019
4162
|
className: partClass(partClass("select combobox", props.classNames?.root), props.className),
|
|
4020
4163
|
style: props.style,
|
|
4164
|
+
size: props.size,
|
|
4165
|
+
variant: props.variant,
|
|
4166
|
+
hideLabel: props.hideLabel,
|
|
4167
|
+
fullWidth: props.fullWidth,
|
|
4168
|
+
maxHeight: props.maxHeight,
|
|
4169
|
+
menuTrigger: props.menuTrigger,
|
|
4170
|
+
selectOnFocus: props.selectOnFocus,
|
|
4171
|
+
disallowEmptySelection: props.disallowEmptySelection,
|
|
4172
|
+
onOpenChange: (open) => {
|
|
4173
|
+
if (!open) setDraft(null);
|
|
4174
|
+
},
|
|
4021
4175
|
value: id,
|
|
4022
4176
|
onChange: change,
|
|
4023
4177
|
inputValue: text,
|
|
4024
4178
|
onInputChange: (text) => {
|
|
4025
4179
|
if (resetting.current) return;
|
|
4026
4180
|
setDraft(text);
|
|
4027
|
-
if (text === "" && id) {
|
|
4181
|
+
if (text === "" && id && !props.disallowEmptySelection) {
|
|
4028
4182
|
setLocal(null);
|
|
4029
4183
|
props.onChange?.(null);
|
|
4030
4184
|
}
|
|
@@ -4046,7 +4200,7 @@ function CompactCombobox(props) {
|
|
|
4046
4200
|
children: [" ", "*"]
|
|
4047
4201
|
})]
|
|
4048
4202
|
}),
|
|
4049
|
-
/* @__PURE__ */ jsxs(
|
|
4203
|
+
/* @__PURE__ */ jsxs(ComboboxInputGroup, {
|
|
4050
4204
|
className: partClass("combobox__control", props.classNames?.control),
|
|
4051
4205
|
"data-invalid": invalid || void 0,
|
|
4052
4206
|
"data-disabled": props.isDisabled || void 0,
|
|
@@ -4056,13 +4210,13 @@ function CompactCombobox(props) {
|
|
|
4056
4210
|
"aria-hidden": "true",
|
|
4057
4211
|
children: props.startContent
|
|
4058
4212
|
}),
|
|
4059
|
-
/* @__PURE__ */ jsx(
|
|
4213
|
+
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
4060
4214
|
ref: input,
|
|
4061
4215
|
className: partClass("combobox__input", props.classNames?.input),
|
|
4062
4216
|
placeholder: props.placeholder,
|
|
4063
4217
|
"aria-describedby": describedBy
|
|
4064
4218
|
}),
|
|
4065
|
-
props.isClearable && /* @__PURE__ */ jsx("button", {
|
|
4219
|
+
props.isClearable && !props.disallowEmptySelection && /* @__PURE__ */ jsx("button", {
|
|
4066
4220
|
type: "button",
|
|
4067
4221
|
className: partClass("combobox__clear", props.classNames?.clearButton),
|
|
4068
4222
|
"data-empty": !id && !text || void 0,
|
|
@@ -4083,7 +4237,7 @@ function CompactCombobox(props) {
|
|
|
4083
4237
|
})
|
|
4084
4238
|
]
|
|
4085
4239
|
}),
|
|
4086
|
-
/* @__PURE__ */ jsx(
|
|
4240
|
+
/* @__PURE__ */ jsx(ComboboxPopover, {
|
|
4087
4241
|
className: partClass("select__popover combobox__popover", props.classNames?.popover),
|
|
4088
4242
|
children: /* @__PURE__ */ jsx(ListBox$3, {
|
|
4089
4243
|
className: partClass("select__list", props.classNames?.list),
|
|
@@ -4261,7 +4415,7 @@ function DateRangeIndicator({ className, children, ...props }) {
|
|
|
4261
4415
|
}
|
|
4262
4416
|
function DateRangePopover({ className, children, ...props }) {
|
|
4263
4417
|
const range = useRange();
|
|
4264
|
-
return /* @__PURE__ */ jsx(Popover$
|
|
4418
|
+
return /* @__PURE__ */ jsx(Popover$1, {
|
|
4265
4419
|
placement: "bottom start",
|
|
4266
4420
|
offset: 8,
|
|
4267
4421
|
dir: range.dir,
|
|
@@ -5243,7 +5397,7 @@ function DateRangePickerRoot(props) {
|
|
|
5243
5397
|
children: panel
|
|
5244
5398
|
})
|
|
5245
5399
|
})
|
|
5246
|
-
}) : /* @__PURE__ */ jsx(Popover$
|
|
5400
|
+
}) : /* @__PURE__ */ jsx(Popover$1, {
|
|
5247
5401
|
className: partClass("date-range__panel", props.classNames?.panel),
|
|
5248
5402
|
placement: "bottom start",
|
|
5249
5403
|
offset: 8,
|
|
@@ -6869,7 +7023,7 @@ function TemporalPickerContent({ children, className, ...props }) {
|
|
|
6869
7023
|
}
|
|
6870
7024
|
function TemporalPickerPopover({ children, className, ...props }) {
|
|
6871
7025
|
const c = usePicker();
|
|
6872
|
-
return /* @__PURE__ */ jsx(Popover$
|
|
7026
|
+
return /* @__PURE__ */ jsx(Popover$1, {
|
|
6873
7027
|
className: partClass("date-range__panel temporal-picker__panel", className),
|
|
6874
7028
|
placement: "bottom start",
|
|
6875
7029
|
offset: 8,
|