@kazee-ds/react 0.8.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/index.js +208 -33
- 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
|
+
Unpublished patch **0.10.1** fixes Combobox repeated-focus/toggle text replacement (React) and locks popover width to the control (styles). Verified npm baseline: **0.10.0**. See [release status](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.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.1** 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.1 @kazee-ds/styles@0.10.1
|
|
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,46 +3977,164 @@ 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
|
+
inputRef: { current: null },
|
|
3982
|
+
disabled: false,
|
|
3983
|
+
selectOnFocus: false,
|
|
3984
|
+
disallowEmptySelection: false,
|
|
3985
|
+
menuTrigger: "input",
|
|
3986
|
+
maxHeight: void 0,
|
|
3987
|
+
manageReset: false,
|
|
3988
|
+
controlled: false,
|
|
3989
|
+
resetting: { current: false },
|
|
3990
|
+
resetLocal: () => {}
|
|
3991
|
+
});
|
|
3992
|
+
function useComboState() {
|
|
3993
|
+
return useContext(ComboBoxStateContext);
|
|
3994
|
+
}
|
|
3995
|
+
function ComboboxComposition({ className, onChange, size = "md", variant = "primary", hideLabel, fullWidth = true, selectOnFocus = false, disallowEmptySelection = false, maxHeight, ...props }) {
|
|
3996
|
+
const [local, setLocal] = useState(props.defaultValue ?? null);
|
|
3997
|
+
const resetting = useRef(false);
|
|
3998
|
+
const inputRef = useRef(null);
|
|
3999
|
+
const resetLocal = useCallback(() => setLocal(props.defaultValue ?? null), [props.defaultValue]);
|
|
4000
|
+
const value = props.value !== void 0 ? props.value : local;
|
|
4001
|
+
return /* @__PURE__ */ jsx(ComboboxPolicyContext.Provider, {
|
|
4002
|
+
value: {
|
|
4003
|
+
inputRef,
|
|
4004
|
+
disabled: !!props.isDisabled,
|
|
4005
|
+
selectOnFocus,
|
|
4006
|
+
disallowEmptySelection,
|
|
4007
|
+
menuTrigger: props.menuTrigger ?? "input",
|
|
4008
|
+
maxHeight,
|
|
4009
|
+
manageReset: props.inputValue === void 0,
|
|
4010
|
+
controlled: props.value !== void 0,
|
|
4011
|
+
resetting,
|
|
4012
|
+
resetLocal
|
|
4013
|
+
},
|
|
3938
4014
|
children: /* @__PURE__ */ jsx(ComboBox, {
|
|
3939
4015
|
...props,
|
|
3940
|
-
|
|
3941
|
-
|
|
4016
|
+
...disallowEmptySelection ? { value } : {},
|
|
4017
|
+
onChange: (key) => {
|
|
4018
|
+
if (resetting.current) return;
|
|
4019
|
+
if (disallowEmptySelection && key == null) return;
|
|
4020
|
+
const next = key == null ? null : String(key);
|
|
4021
|
+
setLocal(next);
|
|
4022
|
+
onChange?.(next);
|
|
4023
|
+
},
|
|
4024
|
+
onInputChange: (text) => {
|
|
4025
|
+
if (!resetting.current) props.onInputChange?.(text);
|
|
4026
|
+
},
|
|
4027
|
+
className: partClass(`select combobox select--${size} select--${variant}${hideLabel ? " select--label-hidden" : ""}${!fullWidth ? " select--fit" : ""}`, className)
|
|
3942
4028
|
})
|
|
3943
4029
|
});
|
|
3944
4030
|
}
|
|
3945
4031
|
function ComboboxInputGroup({ className, ...props }) {
|
|
3946
|
-
|
|
4032
|
+
const state = useComboState();
|
|
4033
|
+
return /* @__PURE__ */ jsx(Group, {
|
|
3947
4034
|
...props,
|
|
3948
|
-
className: partClass("combobox__control", className)
|
|
4035
|
+
className: partClass("combobox__control", className),
|
|
4036
|
+
onKeyDownCapture: (event) => {
|
|
4037
|
+
props.onKeyDownCapture?.(event);
|
|
4038
|
+
if (!event.defaultPrevented && event.key === "Escape" && state?.isOpen && !event.nativeEvent.isComposing) {
|
|
4039
|
+
event.preventDefault();
|
|
4040
|
+
event.stopPropagation();
|
|
4041
|
+
state.revert();
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
3949
4044
|
});
|
|
3950
4045
|
}
|
|
3951
4046
|
function ComboboxInput({ className, ...props }) {
|
|
4047
|
+
const policy = useContext(ComboboxPolicyContext);
|
|
4048
|
+
const state = useComboState();
|
|
4049
|
+
const inputRef = useRef(null);
|
|
4050
|
+
const focused = useRef(false);
|
|
4051
|
+
const selectClick = useRef(false);
|
|
4052
|
+
const forwardedRef = props.ref;
|
|
4053
|
+
const captureRef = useCallback((node) => {
|
|
4054
|
+
inputRef.current = node;
|
|
4055
|
+
policy.inputRef.current = node;
|
|
4056
|
+
if (typeof forwardedRef === "function") return forwardedRef(node);
|
|
4057
|
+
if (forwardedRef) forwardedRef.current = node;
|
|
4058
|
+
}, [forwardedRef, policy.inputRef]);
|
|
4059
|
+
useEffect(() => {
|
|
4060
|
+
const form = inputRef.current?.form;
|
|
4061
|
+
if (!form || !policy.manageReset || !state) return;
|
|
4062
|
+
const onReset = (event) => {
|
|
4063
|
+
const value = state.value;
|
|
4064
|
+
const text = state.inputValue;
|
|
4065
|
+
policy.resetting.current = true;
|
|
4066
|
+
queueMicrotask(() => {
|
|
4067
|
+
if (event.defaultPrevented || policy.controlled) {
|
|
4068
|
+
state.setValue(value);
|
|
4069
|
+
state.setInputValue(text);
|
|
4070
|
+
} else policy.resetLocal();
|
|
4071
|
+
policy.resetting.current = false;
|
|
4072
|
+
});
|
|
4073
|
+
};
|
|
4074
|
+
form.addEventListener("reset", onReset, true);
|
|
4075
|
+
return () => form.removeEventListener("reset", onReset, true);
|
|
4076
|
+
}, [policy, state]);
|
|
3952
4077
|
return /* @__PURE__ */ jsx(Input$3, {
|
|
3953
4078
|
...props,
|
|
3954
|
-
|
|
4079
|
+
ref: captureRef,
|
|
4080
|
+
className: partClass("combobox__input", className),
|
|
4081
|
+
onFocus: (event) => {
|
|
4082
|
+
const wasFocused = focused.current;
|
|
4083
|
+
focused.current = true;
|
|
4084
|
+
props.onFocus?.(event);
|
|
4085
|
+
if (!wasFocused && policy.selectOnFocus && !policy.disabled) event.currentTarget.select();
|
|
4086
|
+
},
|
|
4087
|
+
onBlur: (event) => {
|
|
4088
|
+
focused.current = false;
|
|
4089
|
+
props.onBlur?.(event);
|
|
4090
|
+
},
|
|
4091
|
+
onPointerDown: (event) => {
|
|
4092
|
+
props.onPointerDown?.(event);
|
|
4093
|
+
selectClick.current = policy.selectOnFocus && document.activeElement !== event.currentTarget;
|
|
4094
|
+
if (selectClick.current && !event.defaultPrevented && !policy.disabled) {
|
|
4095
|
+
event.preventDefault();
|
|
4096
|
+
event.currentTarget.focus();
|
|
4097
|
+
event.currentTarget.select();
|
|
4098
|
+
}
|
|
4099
|
+
},
|
|
4100
|
+
onClick: (event) => {
|
|
4101
|
+
props.onClick?.(event);
|
|
4102
|
+
if (selectClick.current && !event.defaultPrevented && !policy.disabled) event.currentTarget.select();
|
|
4103
|
+
selectClick.current = false;
|
|
4104
|
+
if (!event.defaultPrevented && !policy.disabled && policy.menuTrigger === "focus" && !state?.isOpen) state?.open(null, "focus");
|
|
4105
|
+
}
|
|
3955
4106
|
});
|
|
3956
4107
|
}
|
|
3957
4108
|
function ComboboxTrigger({ className, children, ...props }) {
|
|
4109
|
+
const policy = useContext(ComboboxPolicyContext);
|
|
4110
|
+
const state = useComboState();
|
|
3958
4111
|
return /* @__PURE__ */ jsx(Button$5, {
|
|
3959
4112
|
"aria-label": "Buka pilihan",
|
|
3960
4113
|
...props,
|
|
3961
4114
|
className: partClass("combobox__toggle", className),
|
|
4115
|
+
onPressStart: (event) => {
|
|
4116
|
+
props.onPressStart?.(event);
|
|
4117
|
+
if (event.pointerType !== "touch" && !state?.isOpen && policy.selectOnFocus && !policy.disabled) policy.inputRef.current?.select();
|
|
4118
|
+
},
|
|
4119
|
+
onPress: (event) => {
|
|
4120
|
+
props.onPress?.(event);
|
|
4121
|
+
if (event.pointerType === "touch" && !state?.isOpen && policy.selectOnFocus && !policy.disabled) policy.inputRef.current?.select();
|
|
4122
|
+
},
|
|
3962
4123
|
children: children ?? /* @__PURE__ */ jsx(ChevronIcon, { className: "select__icon" })
|
|
3963
4124
|
});
|
|
3964
4125
|
}
|
|
3965
4126
|
function ComboboxPopover({ className, ...props }) {
|
|
3966
|
-
|
|
4127
|
+
const policy = useContext(ComboboxPolicyContext);
|
|
4128
|
+
return /* @__PURE__ */ jsx(SelectionPopover, {
|
|
4129
|
+
maxHeight: policy.maxHeight,
|
|
3967
4130
|
...props,
|
|
3968
4131
|
className: partClass("select__popover combobox__popover", className)
|
|
3969
4132
|
});
|
|
3970
4133
|
}
|
|
3971
4134
|
function ComboboxClearButton({ className, children, "aria-label": label = "Hapus pilihan", ...props }) {
|
|
3972
4135
|
const state = useContext(ComboBoxStateContext);
|
|
3973
|
-
const disabled = useContext(
|
|
4136
|
+
const { disabled, disallowEmptySelection } = useContext(ComboboxPolicyContext);
|
|
4137
|
+
if (disallowEmptySelection) return null;
|
|
3974
4138
|
return /* @__PURE__ */ jsx("button", {
|
|
3975
4139
|
...props,
|
|
3976
4140
|
type: "button",
|
|
@@ -4015,16 +4179,27 @@ function CompactCombobox(props) {
|
|
|
4015
4179
|
props.onChange?.(next);
|
|
4016
4180
|
setDraft(null);
|
|
4017
4181
|
}
|
|
4018
|
-
const content = /* @__PURE__ */ jsxs(
|
|
4182
|
+
const content = /* @__PURE__ */ jsxs(ComboboxComposition, {
|
|
4019
4183
|
className: partClass(partClass("select combobox", props.classNames?.root), props.className),
|
|
4020
4184
|
style: props.style,
|
|
4185
|
+
size: props.size,
|
|
4186
|
+
variant: props.variant,
|
|
4187
|
+
hideLabel: props.hideLabel,
|
|
4188
|
+
fullWidth: props.fullWidth,
|
|
4189
|
+
maxHeight: props.maxHeight,
|
|
4190
|
+
menuTrigger: props.menuTrigger,
|
|
4191
|
+
selectOnFocus: props.selectOnFocus,
|
|
4192
|
+
disallowEmptySelection: props.disallowEmptySelection,
|
|
4193
|
+
onOpenChange: (open) => {
|
|
4194
|
+
if (!open) setDraft(null);
|
|
4195
|
+
},
|
|
4021
4196
|
value: id,
|
|
4022
4197
|
onChange: change,
|
|
4023
4198
|
inputValue: text,
|
|
4024
4199
|
onInputChange: (text) => {
|
|
4025
4200
|
if (resetting.current) return;
|
|
4026
4201
|
setDraft(text);
|
|
4027
|
-
if (text === "" && id) {
|
|
4202
|
+
if (text === "" && id && !props.disallowEmptySelection) {
|
|
4028
4203
|
setLocal(null);
|
|
4029
4204
|
props.onChange?.(null);
|
|
4030
4205
|
}
|
|
@@ -4046,7 +4221,7 @@ function CompactCombobox(props) {
|
|
|
4046
4221
|
children: [" ", "*"]
|
|
4047
4222
|
})]
|
|
4048
4223
|
}),
|
|
4049
|
-
/* @__PURE__ */ jsxs(
|
|
4224
|
+
/* @__PURE__ */ jsxs(ComboboxInputGroup, {
|
|
4050
4225
|
className: partClass("combobox__control", props.classNames?.control),
|
|
4051
4226
|
"data-invalid": invalid || void 0,
|
|
4052
4227
|
"data-disabled": props.isDisabled || void 0,
|
|
@@ -4056,13 +4231,13 @@ function CompactCombobox(props) {
|
|
|
4056
4231
|
"aria-hidden": "true",
|
|
4057
4232
|
children: props.startContent
|
|
4058
4233
|
}),
|
|
4059
|
-
/* @__PURE__ */ jsx(
|
|
4234
|
+
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
4060
4235
|
ref: input,
|
|
4061
4236
|
className: partClass("combobox__input", props.classNames?.input),
|
|
4062
4237
|
placeholder: props.placeholder,
|
|
4063
4238
|
"aria-describedby": describedBy
|
|
4064
4239
|
}),
|
|
4065
|
-
props.isClearable && /* @__PURE__ */ jsx("button", {
|
|
4240
|
+
props.isClearable && !props.disallowEmptySelection && /* @__PURE__ */ jsx("button", {
|
|
4066
4241
|
type: "button",
|
|
4067
4242
|
className: partClass("combobox__clear", props.classNames?.clearButton),
|
|
4068
4243
|
"data-empty": !id && !text || void 0,
|
|
@@ -4076,14 +4251,14 @@ function CompactCombobox(props) {
|
|
|
4076
4251
|
},
|
|
4077
4252
|
children: /* @__PURE__ */ jsx(CloseIcon, { className: partClass("selection__close-icon", props.classNames?.clearIcon) })
|
|
4078
4253
|
}),
|
|
4079
|
-
/* @__PURE__ */ jsx(
|
|
4254
|
+
/* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
4080
4255
|
className: partClass("combobox__toggle", props.classNames?.trigger),
|
|
4081
4256
|
"aria-label": props.toggleLabel ?? "Buka pilihan",
|
|
4082
4257
|
children: /* @__PURE__ */ jsx(ChevronIcon, { className: partClass("select__icon", props.classNames?.indicator) })
|
|
4083
4258
|
})
|
|
4084
4259
|
]
|
|
4085
4260
|
}),
|
|
4086
|
-
/* @__PURE__ */ jsx(
|
|
4261
|
+
/* @__PURE__ */ jsx(ComboboxPopover, {
|
|
4087
4262
|
className: partClass("select__popover combobox__popover", props.classNames?.popover),
|
|
4088
4263
|
children: /* @__PURE__ */ jsx(ListBox$3, {
|
|
4089
4264
|
className: partClass("select__list", props.classNames?.list),
|
|
@@ -4261,7 +4436,7 @@ function DateRangeIndicator({ className, children, ...props }) {
|
|
|
4261
4436
|
}
|
|
4262
4437
|
function DateRangePopover({ className, children, ...props }) {
|
|
4263
4438
|
const range = useRange();
|
|
4264
|
-
return /* @__PURE__ */ jsx(Popover$
|
|
4439
|
+
return /* @__PURE__ */ jsx(Popover$1, {
|
|
4265
4440
|
placement: "bottom start",
|
|
4266
4441
|
offset: 8,
|
|
4267
4442
|
dir: range.dir,
|
|
@@ -5243,7 +5418,7 @@ function DateRangePickerRoot(props) {
|
|
|
5243
5418
|
children: panel
|
|
5244
5419
|
})
|
|
5245
5420
|
})
|
|
5246
|
-
}) : /* @__PURE__ */ jsx(Popover$
|
|
5421
|
+
}) : /* @__PURE__ */ jsx(Popover$1, {
|
|
5247
5422
|
className: partClass("date-range__panel", props.classNames?.panel),
|
|
5248
5423
|
placement: "bottom start",
|
|
5249
5424
|
offset: 8,
|
|
@@ -6869,7 +7044,7 @@ function TemporalPickerContent({ children, className, ...props }) {
|
|
|
6869
7044
|
}
|
|
6870
7045
|
function TemporalPickerPopover({ children, className, ...props }) {
|
|
6871
7046
|
const c = usePicker();
|
|
6872
|
-
return /* @__PURE__ */ jsx(Popover$
|
|
7047
|
+
return /* @__PURE__ */ jsx(Popover$1, {
|
|
6873
7048
|
className: partClass("date-range__panel temporal-picker__panel", className),
|
|
6874
7049
|
placement: "bottom start",
|
|
6875
7050
|
offset: 8,
|