asma-ui-core 3.34.0 → 3.35.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/dist/asma-ui-core.css +1 -1
- package/dist/components/data-display/badge/StyledBadge.js +29 -24
- package/dist/components/data-display/chip/StyledChip.js +45 -60
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +32 -38
- package/dist/components/data-display/tooltip/StyledTooltip.js +50 -33
- package/dist/components/data-display/typography/StyledTypography.js +62 -4
- package/dist/components/feedback/dialog/StyledDialog.js +70 -50
- package/dist/components/feedback/dialog/StyledDialog.module.js +2 -9
- package/dist/components/feedback/dialog/StyledDialogActions.js +16 -16
- package/dist/components/feedback/dialog/StyledDialogContent.js +17 -14
- package/dist/components/feedback/dialog/StyledDialogTitle.js +18 -13
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +56 -57
- package/dist/components/feedback/snack-bar/StyledAlert.js +72 -14
- package/dist/components/feedback/snack-bar/StyledSnackbar.js +34 -8
- package/dist/components/feedback/snack-bar/components/StyledDefaultSnackbar.js +33 -34
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.js +55 -58
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +12 -12
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +1 -1
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +1 -1
- package/dist/components/inputs/field-styles.js +6 -0
- package/dist/components/inputs/input-field/StyledInputField.js +104 -81
- package/dist/components/inputs/input-field/StyledInputField.module.js +4 -0
- package/dist/components/inputs/radio-button/base-ui/RadioGroupContext.js +6 -0
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +40 -29
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +10 -10
- package/dist/components/inputs/radio-button/base-ui/StyledRadioGroup.js +35 -23
- package/dist/components/inputs/select/StyledSelect.js +124 -45
- package/dist/components/inputs/select/StyledSelectItem.js +19 -23
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +181 -151
- package/dist/components/inputs/slider/StyledSlider.js +78 -52
- package/dist/components/inputs/slider/StyledSlider.module.js +10 -0
- package/dist/components/inputs/switch/base-ui/StyledSwitch.js +44 -39
- package/dist/components/miscellaneous/FormControlContext.js +6 -0
- package/dist/components/miscellaneous/StyledFormControl.js +39 -21
- package/dist/components/miscellaneous/StyledFormControlLabel.js +27 -16
- package/dist/components/miscellaneous/StyledFormGroup.js +16 -4
- package/dist/components/miscellaneous/StyledFormHelperText.js +12 -4
- package/dist/components/miscellaneous/StyledInputLabel.js +20 -4
- package/dist/components/mui-compat/Avatar.js +29 -0
- package/dist/components/mui-compat/ClickAwayListener.js +29 -0
- package/dist/components/mui-compat/Container.js +24 -0
- package/dist/components/mui-compat/Fade.js +29 -0
- package/dist/components/mui-compat/Fade.module.js +9 -0
- package/dist/components/mui-compat/FormLabel.js +22 -0
- package/dist/components/mui-compat/Paper.js +44 -0
- package/dist/components/mui-compat/Popper.js +35 -0
- package/dist/components/mui-compat/Skeleton.js +26 -0
- package/dist/components/mui-compat/Stack.js +24 -0
- package/dist/components/navigation/drawer/StyledDrawer.js +42 -4
- package/dist/components/navigation/listbox/Listbox.js +7 -7
- package/dist/components/navigation/menu/StyledMenu.js +27 -11
- package/dist/components/navigation/menu/StyledMenuItem.js +16 -18
- package/dist/components/navigation/menu/StyledMenuList.js +32 -4
- package/dist/components/navigation/tabs/StyledTab.js +25 -13
- package/dist/components/navigation/tabs/StyledTabs.js +112 -64
- package/dist/components/navigation/tabs/TabsContext.js +6 -0
- package/dist/components/utils/accordion/base-ui/AccordionContext.js +10 -0
- package/dist/components/utils/accordion/base-ui/StyledAccordion.js +28 -21
- package/dist/components/utils/accordion/base-ui/StyledAccordion.module.js +7 -7
- package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +28 -14
- package/dist/components/utils/accordion/base-ui/StyledAccordionSummary.js +31 -27
- package/dist/components/utils/popover/StyledPopover.js +43 -15
- package/dist/datetime/components/date-picker/StyledDatePicker.js +6 -6
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +1 -1
- package/dist/datetime/components/date-picker/components/HelperTextWithTooltip.js +6 -6
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +11 -11
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerFooter.js +13 -14
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +14 -14
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +6 -6
- package/dist/datetime/components/date-picker/components/StyledDayPicker.js +4 -5
- package/dist/datetime/components/date-picker/hooks/useDatePickerMask.js +4 -4
- package/dist/datetime/components/time-picker/StyledTimePicker.js +25 -25
- package/dist/datetime/components/time-picker/TimePickerInput.js +15 -16
- package/dist/datetime/components/time-picker/TimePickerPopper.js +21 -19
- package/dist/datetime/helpers/cn.js +4 -5
- package/dist/helpers/arrays.js +4 -0
- package/dist/helpers/cn.js +4 -5
- package/dist/helpers/inputMask.js +45 -0
- package/dist/helpers/sx.js +46 -0
- package/dist/index.js +183 -175
- package/dist/src/api-surface.test.d.ts +1 -0
- package/dist/src/components/data-display/badge/StyledBadge.d.ts +26 -2
- package/dist/src/components/data-display/chip/StyledChip.d.ts +39 -5
- package/dist/src/components/data-display/interactive-chip/StyledInteractiveChip.d.ts +11 -4
- package/dist/src/components/data-display/tooltip/StyledTooltip.d.ts +36 -2
- package/dist/src/components/data-display/typography/StyledTypography.d.ts +19 -1
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +37 -4
- package/dist/src/components/feedback/dialog/StyledDialogActions.d.ts +12 -2
- package/dist/src/components/feedback/dialog/StyledDialogContent.d.ts +12 -2
- package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +10 -2
- package/dist/src/components/feedback/snack-bar/SnackbarProvider.d.ts +1 -1
- package/dist/src/components/feedback/snack-bar/StyledAlert.d.ts +24 -2
- package/dist/src/components/feedback/snack-bar/StyledAlertSnackbar.d.ts +1 -1
- package/dist/src/components/feedback/snack-bar/StyledSnackbar.d.ts +21 -2
- package/dist/src/components/feedback/snack-bar/components/StyledDefaultSnackbar.d.ts +1 -1
- package/dist/src/components/feedback/snack-bar/components/StyledInfoSnackbar.d.ts +1 -1
- package/dist/src/components/feedback/snack-bar/components/types.d.ts +1 -1
- package/dist/src/components/inputs/checkbox/base-ui/StyledCheckbox.d.ts +9 -4
- package/dist/src/components/inputs/dynamic-select/types.d.ts +2 -2
- package/dist/src/components/inputs/field-styles.d.ts +22 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +67 -11
- package/dist/src/components/inputs/input-field/index.d.ts +1 -1
- package/dist/src/components/inputs/radio-button/base-ui/RadioGroupContext.d.ts +10 -0
- package/dist/src/components/inputs/radio-button/base-ui/StyledRadio.d.ts +20 -5
- package/dist/src/components/inputs/radio-button/base-ui/StyledRadioGroup.d.ts +24 -7
- package/dist/src/components/inputs/select/StyledSelect.d.ts +39 -16
- package/dist/src/components/inputs/select/StyledSelectItem.d.ts +14 -2
- package/dist/src/components/inputs/select/index.d.ts +0 -1
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +88 -17
- package/dist/src/components/inputs/slider/StyledSlider.d.ts +55 -3
- package/dist/src/components/inputs/switch/base-ui/StyledSwitch.d.ts +20 -4
- package/dist/src/components/miscellaneous/FormControlContext.d.ts +14 -0
- package/dist/src/components/miscellaneous/StyledFormControl.d.ts +22 -2
- package/dist/src/components/miscellaneous/StyledFormControlLabel.d.ts +21 -2
- package/dist/src/components/miscellaneous/StyledFormGroup.d.ts +11 -2
- package/dist/src/components/miscellaneous/StyledFormHelperText.d.ts +12 -2
- package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +20 -2
- package/dist/src/components/mui-compat/Avatar.d.ts +6 -0
- package/dist/src/components/mui-compat/ClickAwayListener.d.ts +19 -0
- package/dist/src/components/mui-compat/Container.d.ts +6 -0
- package/dist/src/components/mui-compat/Fade.d.ts +21 -0
- package/dist/src/components/mui-compat/FormLabel.d.ts +6 -0
- package/dist/src/components/mui-compat/Paper.d.ts +6 -0
- package/dist/src/components/mui-compat/Popper.d.ts +29 -0
- package/dist/src/components/mui-compat/Skeleton.d.ts +7 -0
- package/dist/src/components/mui-compat/Stack.d.ts +7 -0
- package/dist/src/components/mui-compat/index.d.ts +9 -0
- package/dist/src/components/mui-compat/types.d.ts +46 -0
- package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +21 -2
- package/dist/src/components/navigation/menu/StyledMenu.d.ts +25 -2
- package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +21 -2
- package/dist/src/components/navigation/menu/StyledMenuList.d.ts +16 -2
- package/dist/src/components/navigation/menu/index.d.ts +0 -1
- package/dist/src/components/navigation/tabs/StyledTab.d.ts +17 -3
- package/dist/src/components/navigation/tabs/StyledTabs.d.ts +16 -7
- package/dist/src/components/navigation/tabs/TabsContext.d.ts +11 -0
- package/dist/src/components/utils/accordion/base-ui/AccordionContext.d.ts +10 -0
- package/dist/src/components/utils/accordion/base-ui/StyledAccordion.d.ts +9 -3
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +5 -0
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionSummary.d.ts +8 -4
- package/dist/src/components/utils/copy-wrapper/CopyWrapper.d.ts +1 -1
- package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +2 -2
- package/dist/src/components/utils/popover/StyledPopover.d.ts +31 -2
- package/dist/src/datetime/components/date-picker/components/StyledCalendarPicker.d.ts +1 -1
- package/dist/src/datetime/components/date-picker/components/StyledDayPicker.d.ts +1 -1
- package/dist/src/datetime/components/date-picker/hooks/useDatePickerMask.d.ts +1 -2
- package/dist/src/datetime/components/time-picker/TimePickerInput.d.ts +1 -1
- package/dist/src/datetime/components/time-picker/TimePickerPopper.d.ts +1 -1
- package/dist/src/datetime/components/time-picker/types.d.ts +1 -2
- package/dist/src/datetime/shared-components/StyledFormControl.d.ts +1 -2
- package/dist/src/datetime/shared-components/StyledInputField.d.ts +1 -12
- package/dist/src/datetime/shared-components/StyledSelect.d.ts +1 -16
- package/dist/src/datetime/shared-components/StyledSelectItem.d.ts +1 -2
- package/dist/src/datetime/shared-components/StyledTooltip.d.ts +1 -2
- package/dist/src/helpers/arrays.d.ts +2 -0
- package/dist/src/helpers/arrays.test.d.ts +1 -0
- package/dist/src/helpers/inputMask.d.ts +29 -0
- package/dist/src/helpers/inputMask.test.d.ts +1 -0
- package/dist/src/helpers/sx.d.ts +2 -0
- package/dist/src/helpers/sx.test.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/table/shared-components/StyledCheckbox.d.ts +7 -4
- package/dist/src/table/shared-components/StyledMenuItem.d.ts +18 -2
- package/dist/src/table/shared-components/menu-item/index.d.ts +13 -2
- package/dist/src/table/shared-components/tooltip/index.d.ts +5 -1
- package/dist/src/table/types.d.ts +1 -1
- package/dist/table/components/Fetching.js +4 -4
- package/dist/table/components/TableRow.js +7 -7
- package/dist/table/components/TableSkeleton.js +6 -6
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +24 -24
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +26 -25
- package/dist/table/components/table-footer/TablePagination.js +27 -24
- package/dist/table/components/table-footer/TableRowCountSelect.js +30 -27
- package/dist/table/helpers/cn.js +4 -5
- package/dist/table/shared-components/StyledCheckbox.js +54 -55
- package/dist/table/shared-components/StyledCheckbox.module.js +10 -10
- package/dist/table/shared-components/StyledMenuItem.js +12 -18
- package/dist/table/shared-components/menu-item/index.js +13 -17
- package/dist/table/shared-components/tooltip/index.js +4 -23
- package/package.json +9 -16
- package/dist/components/feedback/dialog/StyledDialogActions.module.js +0 -8
- package/dist/components/feedback/dialog/StyledDialogContent.module.js +0 -4
- package/dist/components/feedback/dialog/StyledDialogTitle.module.js +0 -4
- package/dist/components/inputs/checkbox/StyledCheckbox.js +0 -20
- package/dist/components/inputs/radio-button/StyledRadio.js +0 -17
- package/dist/datetime/shared-components/ExpandIcon.js +0 -18
- package/dist/datetime/shared-components/StyledFormControl.js +0 -23
- package/dist/datetime/shared-components/StyledInputField.js +0 -47
- package/dist/datetime/shared-components/StyledSelect.js +0 -47
- package/dist/datetime/shared-components/StyledSelectItem.js +0 -13
- package/dist/datetime/shared-components/StyledTooltip.js +0 -32
- package/dist/src/components/inputs/checkbox/StyledCheckbox.d.ts +0 -4
- package/dist/src/components/inputs/radio-button/StyledRadio.d.ts +0 -4
- package/dist/src/components/inputs/radio-button/StyledRadioGroup.d.ts +0 -4
- package/dist/src/components/inputs/switch/StyledSwitch.d.ts +0 -5
- package/dist/src/components/utils/accordion/StyledAccordion.d.ts +0 -2
- package/dist/src/components/utils/accordion/StyledAccordionDetails.d.ts +0 -2
- package/dist/src/components/utils/accordion/StyledAccordionSummary.d.ts +0 -8
|
@@ -1,48 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { cn as a } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as oe } from "../../../helpers/sx.js";
|
|
3
|
+
import { ChevronDownIcon as re } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
|
+
import { CloseIcon as se } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { ErrorOutlineIcon as le } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
6
|
+
import { outlineClass as ne } from "../field-styles.js";
|
|
7
|
+
import { useFormControlContext as ie } from "../../miscellaneous/FormControlContext.js";
|
|
8
|
+
import { StyledFormHelperText as ae } from "../../miscellaneous/StyledFormHelperText.js";
|
|
9
|
+
import { Children as D, cloneElement as ce, isValidElement as R, useEffect as F, useRef as de, useState as S } from "react";
|
|
10
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
11
|
+
import { FloatingPortal as fe, autoUpdate as me, flip as ue, offset as pe, shift as xe, size as ge, useClick as he, useDismiss as be, useFloating as we, useInteractions as ye, useMergeRefs as E, useRole as ve } from "@floating-ui/react";
|
|
12
|
+
var Ve = ({ dataTest: x, value: g, defaultValue: A, onChange: I, size: z, error: V, errorText: j, allowClear: P, disabled: _, readOnly: d, name: h, placeholder: f, displayEmpty: m, renderValue: b, fullWidth: U, className: q, style: B, sx: K, children: w, MenuProps: M }) => {
|
|
13
|
+
const r = ie(), $ = z ?? r?.size ?? "medium", y = V ?? r?.error ?? !1, l = _ ?? r?.disabled ?? !1, [s, v] = S(!1), [H, O] = S(A), C = g !== void 0, n = C ? g : H, i = n !== void 0 && n !== "" && n !== null, u = de(null), { refs: N, floatingStyles: W, context: p } = we({
|
|
14
|
+
open: s,
|
|
15
|
+
onOpenChange: v,
|
|
16
|
+
placement: "bottom-start",
|
|
17
|
+
whileElementsMounted: me,
|
|
18
|
+
middleware: [
|
|
19
|
+
pe(4),
|
|
20
|
+
ue({ padding: 8 }),
|
|
21
|
+
xe({ padding: 8 }),
|
|
22
|
+
ge({ apply({ rects: e, elements: t }) {
|
|
23
|
+
t.floating.style.minWidth = `${e.reference.width}px`;
|
|
24
|
+
} })
|
|
25
|
+
]
|
|
26
|
+
}), { getReferenceProps: G, getFloatingProps: J } = ye([
|
|
27
|
+
he(p, { enabled: !l && !d }),
|
|
28
|
+
be(p),
|
|
29
|
+
ve(p, { role: "listbox" })
|
|
30
|
+
]), L = E([N.setReference]), Q = E([N.setFloating, u]);
|
|
31
|
+
F(() => r?.setFocused(s), [s, r]), F(() => r?.setFilled(i || !!f || !!m), [
|
|
32
|
+
i,
|
|
33
|
+
f,
|
|
34
|
+
m,
|
|
35
|
+
r
|
|
36
|
+
]);
|
|
37
|
+
const k = (e, t) => {
|
|
38
|
+
C || O(e), I?.({ target: {
|
|
39
|
+
value: e,
|
|
40
|
+
name: h
|
|
41
|
+
} }, t), v(!1);
|
|
42
|
+
}, T = D.map(w, (e) => {
|
|
43
|
+
if (!R(e)) return e;
|
|
44
|
+
const t = e.props.value;
|
|
45
|
+
return ce(e, {
|
|
46
|
+
selected: t === n,
|
|
47
|
+
onClick: () => k(t, e.props.children)
|
|
48
|
+
});
|
|
49
|
+
}), X = D.toArray(w).find((e) => R(e) && e.props.value === n), Y = b ? b(n) : X?.props.children, Z = (e) => {
|
|
50
|
+
const t = u.current ? Array.from(u.current.querySelectorAll('[role="option"]:not([aria-disabled="true"])')) : [];
|
|
51
|
+
if (t.length === 0) return;
|
|
52
|
+
const ee = t.findIndex((te) => te === document.activeElement);
|
|
53
|
+
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(ee + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), document.activeElement?.click());
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ c("div", {
|
|
56
|
+
className: a("group relative inline-flex flex-col", U && "w-full", q),
|
|
57
|
+
style: {
|
|
58
|
+
...oe(K),
|
|
59
|
+
...B
|
|
23
60
|
},
|
|
24
|
-
children:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ c("button", {
|
|
63
|
+
ref: L,
|
|
64
|
+
type: "button",
|
|
65
|
+
"data-testid": x,
|
|
66
|
+
role: "combobox",
|
|
67
|
+
"aria-haspopup": "listbox",
|
|
68
|
+
"aria-expanded": s,
|
|
69
|
+
"aria-disabled": l ? !0 : void 0,
|
|
70
|
+
disabled: l,
|
|
71
|
+
...G(),
|
|
72
|
+
className: a("relative flex w-full items-center justify-between rounded-lg bg-transparent px-3 text-left text-delta-800 outline-none", $ === "small" ? "h-9 text-sm" : "h-12 text-base", l && "cursor-not-allowed text-delta-300", d && "pointer-events-none"),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ o("span", {
|
|
75
|
+
className: a("min-w-0 flex-1 truncate", !i && "text-delta-500"),
|
|
76
|
+
children: i || m ? Y : f
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ c("span", {
|
|
79
|
+
className: "flex items-center gap-1",
|
|
80
|
+
children: [P && i && !l && /* @__PURE__ */ o("span", {
|
|
81
|
+
role: "button",
|
|
82
|
+
"data-testid": `${x}-clear`,
|
|
83
|
+
className: "flex items-center justify-center rounded-full p-[2px] hover:bg-gama-100",
|
|
84
|
+
onClick: (e) => {
|
|
85
|
+
e.stopPropagation(), k("", null);
|
|
86
|
+
},
|
|
87
|
+
children: /* @__PURE__ */ o(se, {
|
|
88
|
+
width: 18,
|
|
89
|
+
height: 18
|
|
90
|
+
})
|
|
91
|
+
}), /* @__PURE__ */ o(re, {
|
|
92
|
+
width: 24,
|
|
93
|
+
height: 24,
|
|
94
|
+
className: a("transition-transform", s && "rotate-180")
|
|
95
|
+
})]
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ o("div", { className: ne({
|
|
98
|
+
focused: s,
|
|
99
|
+
error: y,
|
|
100
|
+
disabled: l,
|
|
101
|
+
readOnly: d
|
|
102
|
+
}) })
|
|
103
|
+
]
|
|
104
|
+
}),
|
|
105
|
+
s && /* @__PURE__ */ o(fe, { children: /* @__PURE__ */ o("ul", {
|
|
106
|
+
ref: Q,
|
|
107
|
+
role: "listbox",
|
|
108
|
+
"aria-label": h,
|
|
109
|
+
style: W,
|
|
110
|
+
...J(),
|
|
111
|
+
onKeyDown: Z,
|
|
112
|
+
className: a("z-[1300] max-h-72 overflow-auto rounded-lg border border-delta-300 bg-white py-1 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", M?.className),
|
|
113
|
+
children: T
|
|
114
|
+
}) }),
|
|
115
|
+
y && /* @__PURE__ */ c(ae, {
|
|
116
|
+
className: "m-0 flex items-center gap-1 pt-1 text-sm text-error-500",
|
|
117
|
+
children: [/* @__PURE__ */ o(le, {
|
|
118
|
+
width: 20,
|
|
119
|
+
height: 20
|
|
120
|
+
}), j ?? "Required"]
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
46
125
|
export {
|
|
47
|
-
|
|
126
|
+
Ve as StyledSelect
|
|
48
127
|
};
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
children: [/* @__PURE__ */ r("span", {
|
|
15
|
-
style: {
|
|
16
|
-
width: "24px",
|
|
17
|
-
justifyContent: "center",
|
|
18
|
-
display: "flex"
|
|
19
|
-
},
|
|
20
|
-
children: e.selected && /* @__PURE__ */ r(t, {
|
|
1
|
+
import { cn as n } from "../../../helpers/cn.js";
|
|
2
|
+
import { CheckIcon as l } from "../../icons/check-icon/CheckIcon.js";
|
|
3
|
+
import { jsx as a, jsxs as m } from "react/jsx-runtime";
|
|
4
|
+
var x = ({ children: r, selected: e, disabled: t, className: o, onClick: i }) => /* @__PURE__ */ m("li", {
|
|
5
|
+
role: "option",
|
|
6
|
+
"aria-selected": e ? !0 : void 0,
|
|
7
|
+
"aria-disabled": t ? !0 : void 0,
|
|
8
|
+
tabIndex: -1,
|
|
9
|
+
onClick: t ? void 0 : i,
|
|
10
|
+
className: n("flex items-center gap-1 px-2 py-2.5 text-sm outline-none", t ? "cursor-not-allowed text-delta-300" : "cursor-pointer hover:bg-delta-50", e && "bg-gama-50", o),
|
|
11
|
+
children: [/* @__PURE__ */ a("span", {
|
|
12
|
+
className: "flex w-6 justify-center",
|
|
13
|
+
children: e && /* @__PURE__ */ a(l, {
|
|
21
14
|
width: 22,
|
|
22
15
|
height: 22,
|
|
23
|
-
|
|
16
|
+
className: "text-gama-500"
|
|
24
17
|
})
|
|
25
|
-
}), /* @__PURE__ */
|
|
18
|
+
}), /* @__PURE__ */ a("span", {
|
|
19
|
+
className: "min-w-0 flex-1 truncate",
|
|
20
|
+
children: r
|
|
21
|
+
})]
|
|
26
22
|
});
|
|
27
23
|
export {
|
|
28
|
-
|
|
24
|
+
x as StyledSelectItem
|
|
29
25
|
};
|
|
@@ -1,162 +1,192 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { CheckIcon as
|
|
5
|
-
import { PlusIconCircle as
|
|
6
|
-
import { StyledChip as
|
|
7
|
-
import { StyledCheckbox as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}) :
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"& li[aria-selected=true]": { background: "var(--colors-gama-50) !important" },
|
|
80
|
-
"& li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" },
|
|
81
|
-
"&:has([data-select-all-header]:hover) .MuiAutocomplete-option.Mui-focused": { background: "transparent !important" },
|
|
82
|
-
"&:has([data-select-all-header]:hover) li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" }
|
|
83
|
-
},
|
|
84
|
-
children: [l && d.length > 0 && /* @__PURE__ */ L("div", {
|
|
85
|
-
"data-select-all-header": !0,
|
|
86
|
-
className: "flex items-center gap-x-[10px] border-[1px] border-b border-solid border-delta-200 bg-delta-50 py-2 pl-3 text-xs",
|
|
87
|
-
onMouseDown: (t) => t.preventDefault(),
|
|
88
|
-
role: "presentation",
|
|
89
|
-
children: [/* @__PURE__ */ o(R, {
|
|
90
|
-
size: "small",
|
|
91
|
-
dataTest: `${s}-select-all`,
|
|
92
|
-
checked: $,
|
|
93
|
-
indeterminate: ee,
|
|
94
|
-
hideWrapper: !0,
|
|
95
|
-
onChange: te,
|
|
96
|
-
"aria-label": C ?? "Select all"
|
|
97
|
-
}), /* @__PURE__ */ o("span", {
|
|
98
|
-
className: "truncate text-[10px] font-semibold uppercase text-delta-600",
|
|
99
|
-
children: C ?? "Select all"
|
|
100
|
-
})]
|
|
101
|
-
}), e]
|
|
102
|
-
})
|
|
103
|
-
},
|
|
104
|
-
renderOption: G ?? ((e, t, { selected: r }) => {
|
|
105
|
-
const a = e, m = e.id ?? i(t);
|
|
106
|
-
return n ? /* @__PURE__ */ A("li", {
|
|
107
|
-
...a,
|
|
108
|
-
key: m,
|
|
109
|
-
className: v(e.className, "flex items-center gap-x-[10px] border-0 border-b border-solid border-delta-200")
|
|
110
|
-
}, /* @__PURE__ */ o(R, {
|
|
111
|
-
dataTest: `${s}-${i(t)}-checkbox`,
|
|
112
|
-
checked: r,
|
|
113
|
-
size: "small",
|
|
114
|
-
hideWrapper: !0
|
|
115
|
-
}), /* @__PURE__ */ o("span", {
|
|
116
|
-
className: "flex-1 truncate py-2 text-sm text-delta-700",
|
|
117
|
-
children: u?.(t) ?? i(t)
|
|
118
|
-
})) : /* @__PURE__ */ A("li", {
|
|
119
|
-
...a,
|
|
120
|
-
key: m,
|
|
121
|
-
className: v(e.className, "flex items-center gap-x-1")
|
|
122
|
-
}, /* @__PURE__ */ o("span", {
|
|
123
|
-
className: "w-5",
|
|
124
|
-
children: r && /* @__PURE__ */ o(se, {
|
|
125
|
-
width: 20,
|
|
126
|
-
height: 20,
|
|
127
|
-
style: { color: "var(--colors-gama-500)" }
|
|
128
|
-
})
|
|
129
|
-
}), /* @__PURE__ */ o("span", {
|
|
130
|
-
className: "flex-1 truncate py-2 text-sm text-delta-700",
|
|
131
|
-
children: u?.(t) ?? i(t)
|
|
132
|
-
}));
|
|
1
|
+
import { cn as x } from "../../../helpers/cn.js";
|
|
2
|
+
import { ChevronDownIcon as ve } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { CloseIcon as Ie } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { CheckIcon as Ce } from "../../icons/check-icon/CheckIcon.js";
|
|
5
|
+
import { PlusIconCircle as Se } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
6
|
+
import { StyledChip as $e } from "../../data-display/chip/StyledChip.js";
|
|
7
|
+
import { StyledCheckbox as De } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
8
|
+
import { LoadingIcon as Ae } from "../../../table/shared-components/LoadingIcon.js";
|
|
9
|
+
import U from "./StyledSelectAutocomplete.module.js";
|
|
10
|
+
import { useMemo as Re, useRef as Fe, useState as $ } from "react";
|
|
11
|
+
import { jsx as s, jsxs as D } from "react/jsx-runtime";
|
|
12
|
+
import { FloatingFocusManager as ke, FloatingPortal as je, autoUpdate as Le, flip as Me, offset as Pe, shift as _e, size as ze, useDismiss as We, useFloating as Ue, useInteractions as Ve, useListNavigation as Ee, useMergeRefs as V, useRole as Ke } from "@floating-ui/react";
|
|
13
|
+
var Be = (r) => typeof r == "object" && r !== null && "label" in r ? String(r.label) : String(r), E = (r) => typeof r == "object" && r !== null && "disabled" in r && !!r.disabled;
|
|
14
|
+
function lt({ dataTest: r, options: A, renderInput: K, value: w, onChange: y, getOptionLabel: B, isOptionEqualToValue: R, renderOption: F, renderValue: k, filterOptions: N, loading: j, loadingText: H = "Loading…", noOptionsText: O = "No options", disabled: L, readOnly: u, size: q = "small", disableClearable: G, popupIcon: J, multiple: Q, fullWidth: X, classes: Y, inputValue: M, onInputChange: Z, open: P, onOpen: T, onClose: ee, className: te, wrapperClassName: le }) {
|
|
15
|
+
const o = Q === !0, a = B ?? Be, p = (e, t) => R ? R(e, t) : e === t, [se, re] = $(!1), n = P ?? se, m = (e) => {
|
|
16
|
+
P === void 0 && re(e), e ? T?.() : ee?.();
|
|
17
|
+
}, [oe, ae] = $(""), c = M ?? oe, v = (e, t, l) => {
|
|
18
|
+
M === void 0 && ae(t), Z?.(e, t, l);
|
|
19
|
+
}, [f, ne] = $(null), _ = Fe([]), i = o ? Array.isArray(w) ? w : [] : [], I = o ? null : w ?? null, z = (e) => o ? i.some((t) => p(e, t)) : I !== null && p(e, I), h = Re(() => {
|
|
20
|
+
const e = [...A];
|
|
21
|
+
if (N) return N(e, { inputValue: c });
|
|
22
|
+
if (!c || o) return e;
|
|
23
|
+
const t = c.toLowerCase();
|
|
24
|
+
return e.filter((l) => a(l).toLowerCase().includes(t));
|
|
25
|
+
}, [
|
|
26
|
+
A,
|
|
27
|
+
c,
|
|
28
|
+
o,
|
|
29
|
+
N
|
|
30
|
+
]), { refs: W, floatingStyles: ie, context: g } = Ue({
|
|
31
|
+
open: n,
|
|
32
|
+
onOpenChange: m,
|
|
33
|
+
placement: "bottom-start",
|
|
34
|
+
whileElementsMounted: Le,
|
|
35
|
+
middleware: [
|
|
36
|
+
Pe(4),
|
|
37
|
+
Me({ padding: 8 }),
|
|
38
|
+
_e({ padding: 8 }),
|
|
39
|
+
ze({ apply({ rects: e, elements: t, availableHeight: l }) {
|
|
40
|
+
t.floating.style.minWidth = `${e.reference.width}px`, t.floating.style.maxHeight = `${Math.min(l - 8, 320)}px`;
|
|
41
|
+
} })
|
|
42
|
+
]
|
|
43
|
+
}), { getReferenceProps: ce, getFloatingProps: de, getItemProps: ue } = Ve([
|
|
44
|
+
We(g),
|
|
45
|
+
Ke(g, { role: "listbox" }),
|
|
46
|
+
Ee(g, {
|
|
47
|
+
listRef: _,
|
|
48
|
+
activeIndex: f,
|
|
49
|
+
onNavigate: ne,
|
|
50
|
+
virtual: !0,
|
|
51
|
+
loop: !0
|
|
52
|
+
})
|
|
53
|
+
]), me = V([W.setReference]), fe = V([W.setFloating]), C = (e, t) => {
|
|
54
|
+
if (o) {
|
|
55
|
+
const l = i.some((d) => p(t, d)), b = l ? i.filter((d) => !p(t, d)) : [...i, t];
|
|
56
|
+
y?.(e, b, l ? "removeOption" : "selectOption", { option: t });
|
|
57
|
+
} else
|
|
58
|
+
y?.(e, t, "selectOption", { option: t }), v(e, a(t), "reset"), m(!1);
|
|
59
|
+
}, pe = (e) => {
|
|
60
|
+
y?.(e, o ? [] : null, "clear", void 0), v(e, "", "clear");
|
|
61
|
+
}, he = (e) => {
|
|
62
|
+
if (e.key === "Enter" && n && f != null && h[f] != null) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
const t = h[f];
|
|
65
|
+
E(t) || C(e, t);
|
|
66
|
+
} else e.key === "ArrowDown" && !n && m(!0);
|
|
67
|
+
}, ge = !G && !u && !L && (o ? i.length > 0 : I !== null), be = o ? k ? k(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ s($e, {
|
|
68
|
+
dataTest: `selected-chip-${a(e)}`,
|
|
69
|
+
label: a(e),
|
|
70
|
+
readOnly: u,
|
|
71
|
+
onDelete: u ? void 0 : (l) => C(l, e)
|
|
72
|
+
}, `${a(e)}-${t}`)) : void 0, xe = /* @__PURE__ */ D("span", {
|
|
73
|
+
className: "flex items-center",
|
|
74
|
+
children: [
|
|
75
|
+
j && /* @__PURE__ */ s(Ae, {
|
|
76
|
+
width: 20,
|
|
77
|
+
height: 20,
|
|
78
|
+
className: "animate-spin"
|
|
133
79
|
}),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
"& .select-custom-icon": { marginTop: "-0.5px !important" },
|
|
138
|
-
"& .MuiInputBase-inputSizeSmall": { minHeight: "23px !important" }
|
|
139
|
-
},
|
|
140
|
-
slotProps: {
|
|
141
|
-
...g,
|
|
142
|
-
clearIndicator: {
|
|
143
|
-
disableRipple: !0,
|
|
144
|
-
disableFocusRipple: !0,
|
|
145
|
-
...g?.clearIndicator ?? {}
|
|
146
|
-
},
|
|
147
|
-
listbox: he(g?.listbox, oe)
|
|
148
|
-
},
|
|
149
|
-
clearIcon: /* @__PURE__ */ o("span", {
|
|
80
|
+
ge && /* @__PURE__ */ s("span", {
|
|
81
|
+
role: "button",
|
|
82
|
+
"data-testid": `${r}-clear`,
|
|
150
83
|
className: "flex min-h-6 min-w-6 cursor-pointer items-center justify-center rounded-full bg-delta-50",
|
|
151
|
-
|
|
84
|
+
onMouseDown: (e) => {
|
|
85
|
+
e.preventDefault(), pe(e);
|
|
86
|
+
},
|
|
87
|
+
children: /* @__PURE__ */ s(Ie, {
|
|
152
88
|
width: 20,
|
|
153
89
|
height: 20,
|
|
154
90
|
className: "text-delta-700"
|
|
155
91
|
})
|
|
92
|
+
}),
|
|
93
|
+
u ? null : J ?? (o ? /* @__PURE__ */ s(Se, {
|
|
94
|
+
width: 24,
|
|
95
|
+
height: 24
|
|
96
|
+
}) : /* @__PURE__ */ s(ve, {
|
|
97
|
+
width: 24,
|
|
98
|
+
height: 24,
|
|
99
|
+
className: x(U["select-custom-icon"], "transition-transform", n && "rotate-180")
|
|
100
|
+
}))
|
|
101
|
+
]
|
|
102
|
+
}), we = {
|
|
103
|
+
disabled: L,
|
|
104
|
+
size: q,
|
|
105
|
+
fullWidth: !0,
|
|
106
|
+
value: c,
|
|
107
|
+
onChange: (e) => {
|
|
108
|
+
v(e, e.target.value, "input"), n || m(!0);
|
|
109
|
+
},
|
|
110
|
+
onFocus: () => m(!0),
|
|
111
|
+
onKeyDown: he,
|
|
112
|
+
slotProps: {
|
|
113
|
+
htmlInput: {
|
|
114
|
+
...ce(),
|
|
115
|
+
ref: me,
|
|
116
|
+
role: "combobox",
|
|
117
|
+
"aria-autocomplete": "list",
|
|
118
|
+
"aria-expanded": n,
|
|
119
|
+
autoComplete: "off",
|
|
120
|
+
readOnly: u
|
|
121
|
+
},
|
|
122
|
+
input: {
|
|
123
|
+
startAdornment: be,
|
|
124
|
+
endAdornment: xe
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, ye = (e, t, l) => /* @__PURE__ */ D("li", {
|
|
128
|
+
...e,
|
|
129
|
+
className: x("flex cursor-pointer items-center gap-x-1 px-2 text-sm text-delta-700", "aria-selected:bg-gama-50 data-[active]:bg-delta-50", o && "border-0 border-b border-solid border-delta-200"),
|
|
130
|
+
children: [o ? /* @__PURE__ */ s(De, {
|
|
131
|
+
dataTest: `${r}-${a(t)}-checkbox`,
|
|
132
|
+
checked: l.selected,
|
|
133
|
+
size: "small",
|
|
134
|
+
hideWrapper: !0
|
|
135
|
+
}) : /* @__PURE__ */ s("span", {
|
|
136
|
+
className: "w-5",
|
|
137
|
+
children: l.selected && /* @__PURE__ */ s(Ce, {
|
|
138
|
+
width: 20,
|
|
139
|
+
height: 20,
|
|
140
|
+
className: "text-gama-500"
|
|
156
141
|
})
|
|
157
|
-
})
|
|
142
|
+
}), /* @__PURE__ */ s("span", {
|
|
143
|
+
className: "flex-1 truncate py-2",
|
|
144
|
+
children: a(t)
|
|
145
|
+
})]
|
|
146
|
+
}), Ne = (e, t) => {
|
|
147
|
+
const l = E(e), b = {
|
|
148
|
+
...ue({ onClick: (S) => {
|
|
149
|
+
l || C(S, e);
|
|
150
|
+
} }),
|
|
151
|
+
key: `${a(e)}-${t}`,
|
|
152
|
+
ref: (S) => {
|
|
153
|
+
_.current[t] = S;
|
|
154
|
+
},
|
|
155
|
+
role: "option",
|
|
156
|
+
id: `${r}-option-${t}`,
|
|
157
|
+
"aria-selected": z(e),
|
|
158
|
+
"aria-disabled": l || void 0,
|
|
159
|
+
"data-active": f === t ? "" : void 0
|
|
160
|
+
}, d = {
|
|
161
|
+
selected: z(e),
|
|
162
|
+
index: t,
|
|
163
|
+
inputValue: c
|
|
164
|
+
};
|
|
165
|
+
return F ? F(b, e, d) : ye(b, e, d);
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ D("div", {
|
|
168
|
+
className: x(U.styledSelectAutocompleteWrapper, !X && "w-auto", le, te),
|
|
169
|
+
children: [K(we), n && /* @__PURE__ */ s(je, { children: /* @__PURE__ */ s(ke, {
|
|
170
|
+
context: g,
|
|
171
|
+
modal: !1,
|
|
172
|
+
initialFocus: -1,
|
|
173
|
+
returnFocus: !1,
|
|
174
|
+
children: /* @__PURE__ */ s("ul", {
|
|
175
|
+
ref: fe,
|
|
176
|
+
style: ie,
|
|
177
|
+
...de(),
|
|
178
|
+
className: x("z-[1300] m-0 list-none overflow-auto rounded-lg border border-delta-200 bg-white py-0 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", Y?.listbox),
|
|
179
|
+
children: j ? /* @__PURE__ */ s("li", {
|
|
180
|
+
className: "px-3 py-2 text-sm text-delta-600",
|
|
181
|
+
children: H
|
|
182
|
+
}) : h.length === 0 ? /* @__PURE__ */ s("li", {
|
|
183
|
+
className: "px-3 py-2 text-sm text-delta-600",
|
|
184
|
+
children: O
|
|
185
|
+
}) : h.map(Ne)
|
|
186
|
+
})
|
|
187
|
+
}) })]
|
|
158
188
|
});
|
|
159
189
|
}
|
|
160
190
|
export {
|
|
161
|
-
|
|
191
|
+
lt as StyledSelectAutocomplete
|
|
162
192
|
};
|