@caspeco/casper-ui-library 11.4.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion-item.js +10 -10
- package/dist/components/accordion/accordion-panel.js +4 -4
- package/dist/components/accordion/accordion.js +4 -4
- package/dist/components/alert/alert.js +10 -10
- package/dist/components/badge/badge.js +18 -18
- package/dist/components/box/box.js +3 -3
- package/dist/components/breadcrumbs/breadcrumb-item.js +4 -4
- package/dist/components/breadcrumbs/breadcrumb-link.js +3 -3
- package/dist/components/breadcrumbs/breadcrumbs.js +22 -22
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +5 -5
- package/dist/components/checkbox/checkbox-icon.js +3 -3
- package/dist/components/checkbox/checkbox.js +7 -7
- package/dist/components/checkbox-group/checkbox-group.js +3 -3
- package/dist/components/collapsible/collapsible.d.ts +1 -1
- package/dist/components/collapsible/collapsible.d.ts.map +1 -1
- package/dist/components/collapsible/collapsible.js +30 -29
- package/dist/components/collapsible/collapsible.translations.d.ts +6 -0
- package/dist/components/collapsible/collapsible.translations.d.ts.map +1 -0
- package/dist/components/collapsible/collapsible.translations.js +54 -0
- package/dist/components/collapsible/types.d.ts +0 -6
- package/dist/components/collapsible/types.d.ts.map +1 -1
- package/dist/components/combobox/combobox-button.d.ts +1 -1
- package/dist/components/combobox/combobox-button.d.ts.map +1 -1
- package/dist/components/combobox/combobox-button.js +66 -64
- package/dist/components/combobox/combobox-item.js +8 -8
- package/dist/components/combobox/combobox-menu.d.ts.map +1 -1
- package/dist/components/combobox/combobox-menu.js +95 -94
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +91 -91
- package/dist/components/combobox/combobox.translations.d.ts +10 -0
- package/dist/components/combobox/combobox.translations.d.ts.map +1 -0
- package/dist/components/combobox/combobox.translations.js +102 -0
- package/dist/components/combobox/index.d.ts +1 -1
- package/dist/components/combobox/index.d.ts.map +1 -1
- package/dist/components/combobox/types.d.ts +0 -15
- package/dist/components/combobox/types.d.ts.map +1 -1
- package/dist/components/date-picker/base-date-picker.d.ts +1 -1
- package/dist/components/date-picker/base-date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/base-date-picker.js +163 -162
- package/dist/components/date-picker/date-multi-picker.d.ts +1 -1
- package/dist/components/date-picker/date-multi-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-multi-picker.js +20 -21
- package/dist/components/date-picker/date-picker-date-cell.js +27 -27
- package/dist/components/date-picker/date-picker-header.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-header.js +84 -116
- package/dist/components/date-picker/date-picker-week-cell.js +4 -4
- package/dist/components/date-picker/date-picker.composition.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +1 -1
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.js +20 -21
- package/dist/components/date-picker/date-picker.translations.d.ts +6 -0
- package/dist/components/date-picker/date-picker.translations.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.translations.js +54 -0
- package/dist/components/date-picker/date-range-picker.d.ts +1 -1
- package/dist/components/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-range-picker.js +15 -16
- package/dist/components/date-picker/date-week-picker.d.ts +1 -1
- package/dist/components/date-picker/date-week-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-week-picker.js +13 -14
- package/dist/components/date-picker/types.d.ts +4 -10
- package/dist/components/date-picker/types.d.ts.map +1 -1
- package/dist/components/divider/divider.js +3 -3
- package/dist/components/drawer/drawer.js +6 -6
- package/dist/components/drawer/inline-drawer.js +4 -4
- package/dist/components/fieldset/fieldset-error-text.js +3 -3
- package/dist/components/fieldset/fieldset-helper-text.js +3 -3
- package/dist/components/fieldset/fieldset-legend.js +3 -3
- package/dist/components/fieldset/fieldset.js +3 -3
- package/dist/components/flex/flex.js +3 -3
- package/dist/components/form-control/form-control.js +3 -3
- package/dist/components/form-control/form-error-message.js +3 -3
- package/dist/components/form-control/form-helper-text.js +3 -3
- package/dist/components/form-control/form-label.js +5 -5
- package/dist/components/grid/grid-item.js +3 -3
- package/dist/components/grid/grid.js +3 -3
- package/dist/components/heading/heading.js +3 -3
- package/dist/components/highlight/highlight.js +3 -3
- package/dist/components/icon/create-icon.js +7 -7
- package/dist/components/icon-button/icon-button.js +4 -4
- package/dist/components/image/image.js +3 -3
- package/dist/components/image-upload/image-upload-dropzone.d.ts +1 -3
- package/dist/components/image-upload/image-upload-dropzone.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-dropzone.js +75 -74
- package/dist/components/image-upload/image-upload-icons.js +11 -11
- package/dist/components/image-upload/image-upload-modal.d.ts +2 -3
- package/dist/components/image-upload/image-upload-modal.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-modal.js +69 -69
- package/dist/components/image-upload/image-upload.d.ts +1 -1
- package/dist/components/image-upload/image-upload.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload.js +43 -44
- package/dist/components/image-upload/image-upload.translations.d.ts +12 -0
- package/dist/components/image-upload/image-upload.translations.d.ts.map +1 -0
- package/dist/components/image-upload/image-upload.translations.js +126 -0
- package/dist/components/image-upload/types.d.ts +0 -3
- package/dist/components/image-upload/types.d.ts.map +1 -1
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/input.js +5 -5
- package/dist/components/link/link.js +3 -3
- package/dist/components/list/list-item.js +3 -3
- package/dist/components/list/list.js +3 -3
- package/dist/components/menu/menu-box-button.js +4 -4
- package/dist/components/menu/menu-button.js +4 -4
- package/dist/components/menu/menu-group.js +11 -11
- package/dist/components/menu/menu-icon-button.js +4 -4
- package/dist/components/menu/menu-item.js +7 -7
- package/dist/components/menu/menu-list.js +3 -3
- package/dist/components/menu/menu.js +4 -4
- package/dist/components/message/message.js +8 -8
- package/dist/components/modal/modal-body.js +3 -3
- package/dist/components/modal/modal-close-button.js +5 -5
- package/dist/components/modal/modal-footer.js +3 -3
- package/dist/components/modal/modal-header.js +3 -3
- package/dist/components/modal/modal.js +8 -8
- package/dist/components/navigation-list/navigation-list-item.js +10 -10
- package/dist/components/navigation-list/navigation-list.js +4 -4
- package/dist/components/paginator/paginator.composition.d.ts.map +1 -1
- package/dist/components/paginator/paginator.d.ts +1 -4
- package/dist/components/paginator/paginator.d.ts.map +1 -1
- package/dist/components/paginator/paginator.js +31 -30
- package/dist/components/paginator/paginator.translations.d.ts +7 -0
- package/dist/components/paginator/paginator.translations.d.ts.map +1 -0
- package/dist/components/paginator/paginator.translations.js +66 -0
- package/dist/components/phone-input/country-data.d.ts +2 -2
- package/dist/components/phone-input/country-data.d.ts.map +1 -1
- package/dist/components/phone-input/country-list.js +6 -6
- package/dist/components/phone-input/country-selector.d.ts +1 -4
- package/dist/components/phone-input/country-selector.d.ts.map +1 -1
- package/dist/components/phone-input/country-selector.js +86 -84
- package/dist/components/phone-input/phone-input-helpers.d.ts +4 -5
- package/dist/components/phone-input/phone-input-helpers.d.ts.map +1 -1
- package/dist/components/phone-input/phone-input-helpers.js +33 -34
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/phone-input/phone-input.js +38 -38
- package/dist/components/phone-input/phone-input.translations.d.ts +10 -0
- package/dist/components/phone-input/phone-input.translations.d.ts.map +1 -0
- package/dist/components/phone-input/phone-input.translations.js +102 -0
- package/dist/components/phone-input/types.d.ts +0 -3
- package/dist/components/phone-input/types.d.ts.map +1 -1
- package/dist/components/phone-input/use-phone-input.d.ts +0 -3
- package/dist/components/phone-input/use-phone-input.d.ts.map +1 -1
- package/dist/components/phone-input/use-phone-input.js +82 -81
- package/dist/components/quantity-button/quantity-button.js +12 -12
- package/dist/components/radio/radio-group.js +4 -4
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +14 -14
- package/dist/components/radio-card/radio-card-group.js +3 -3
- package/dist/components/radio-card/radio-card.d.ts +1 -1
- package/dist/components/radio-card/radio-card.js +7 -7
- package/dist/components/rich-text-editor/index.d.ts +1 -1
- package/dist/components/rich-text-editor/index.d.ts.map +1 -1
- package/dist/components/rich-text-editor/rich-text-editor-context.d.ts +0 -2
- package/dist/components/rich-text-editor/rich-text-editor-context.d.ts.map +1 -1
- package/dist/components/rich-text-editor/rich-text-editor-control.d.ts.map +1 -1
- package/dist/components/rich-text-editor/rich-text-editor-control.js +129 -128
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +22 -25
- package/dist/components/rich-text-editor/{translations.d.ts → rich-text-editor.translations.d.ts} +3 -5
- package/dist/components/rich-text-editor/rich-text-editor.translations.d.ts.map +1 -0
- package/dist/components/rich-text-editor/rich-text-editor.translations.js +234 -0
- package/dist/components/rich-text-editor/rich-text-renderer.js +4 -4
- package/dist/components/rich-text-editor/types.d.ts +0 -2
- package/dist/components/rich-text-editor/types.d.ts.map +1 -1
- package/dist/components/segmented-control/segmented-control.js +5 -5
- package/dist/components/select/select.js +5 -5
- package/dist/components/skeleton/skeleton-text.js +3 -3
- package/dist/components/skeleton/skeleton.js +3 -3
- package/dist/components/spinner/spinner.js +5 -5
- package/dist/components/stack/stack.d.ts +1 -1
- package/dist/components/stack/stack.js +3 -3
- package/dist/components/stepper/step.js +25 -25
- package/dist/components/stepper/stepper.js +8 -8
- package/dist/components/switch/switch.js +6 -6
- package/dist/components/table/table-cell.d.ts +1 -3
- package/dist/components/table/table-cell.d.ts.map +1 -1
- package/dist/components/table/table-cell.js +43 -46
- package/dist/components/table/table-column-resize-handle.d.ts.map +1 -1
- package/dist/components/table/table-column-resize-handle.js +22 -21
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-content.js +81 -79
- package/dist/components/table/table-context-provider.d.ts +1 -4
- package/dist/components/table/table-context-provider.d.ts.map +1 -1
- package/dist/components/table/table-context-provider.js +137 -140
- package/dist/components/table/table-drag-accessibility.d.ts +3 -3
- package/dist/components/table/table-drag-accessibility.d.ts.map +1 -1
- package/dist/components/table/table-drag-accessibility.js +10 -14
- package/dist/components/table/table-filter.d.ts.map +1 -1
- package/dist/components/table/table-filter.js +59 -59
- package/dist/components/table/table-header-dropdown.d.ts +0 -2
- package/dist/components/table/table-header-dropdown.d.ts.map +1 -1
- package/dist/components/table/table-header-dropdown.js +28 -27
- package/dist/components/table/table-header-row.d.ts.map +1 -1
- package/dist/components/table/table-header-row.js +53 -56
- package/dist/components/table/table-row-drag-handle.d.ts +1 -3
- package/dist/components/table/table-row-drag-handle.d.ts.map +1 -1
- package/dist/components/table/table-row-drag-handle.js +10 -9
- package/dist/components/table/table-row-expand-toggle-button.d.ts +1 -3
- package/dist/components/table/table-row-expand-toggle-button.d.ts.map +1 -1
- package/dist/components/table/table-row-expand-toggle-button.js +9 -8
- package/dist/components/table/table-row.d.ts.map +1 -1
- package/dist/components/table/table-row.js +5 -6
- package/dist/components/table/table-sorted-reorder-prompt.d.ts +1 -3
- package/dist/components/table/table-sorted-reorder-prompt.d.ts.map +1 -1
- package/dist/components/table/table-sorted-reorder-prompt.js +26 -25
- package/dist/components/table/table-toolbar-actions.d.ts.map +1 -1
- package/dist/components/table/table-toolbar-actions.js +4 -4
- package/dist/components/table/table-toolbar-add-button.d.ts.map +1 -1
- package/dist/components/table/table-toolbar-add-button.js +4 -4
- package/dist/components/table/table-toolbar-settings.d.ts.map +1 -1
- package/dist/components/table/table-toolbar-settings.js +110 -108
- package/dist/components/table/table-toolbar.js +11 -11
- package/dist/components/table/table.composition.d.ts.map +1 -1
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +31 -32
- package/dist/components/table/table.translations.d.ts +45 -0
- package/dist/components/table/table.translations.d.ts.map +1 -0
- package/dist/components/table/table.translations.js +522 -0
- package/dist/components/table/types.d.ts +0 -5
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/components/tabs/tab-list.js +3 -3
- package/dist/components/tabs/tab-panel.js +3 -3
- package/dist/components/tabs/tab-panels.js +3 -3
- package/dist/components/tabs/tab-with-image.js +10 -10
- package/dist/components/tabs/tab.js +4 -4
- package/dist/components/tabs/tabs.js +3 -3
- package/dist/components/tag/tag.js +28 -28
- package/dist/components/text/text.js +3 -3
- package/dist/components/textarea/textarea.js +3 -3
- package/dist/components/toaster/toaster.js +9 -9
- package/dist/components/toggle-button/toggle-button.js +3 -3
- package/dist/components/toggle-button/use-button-children.js +10 -10
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +8 -8
- package/dist/index.js +404 -402
- package/dist/node_modules/libphonenumber-js/metadata.mobile.json.js +13 -19
- package/dist/test-utils/render-with-theme.d.ts +5 -1
- package/dist/test-utils/render-with-theme.d.ts.map +1 -1
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/locale-provider.d.ts +9 -0
- package/dist/theme/locale-provider.d.ts.map +1 -0
- package/dist/theme/locale-provider.js +14 -0
- package/dist/theme/locale-provider.spec.d.ts +2 -0
- package/dist/theme/locale-provider.spec.d.ts.map +1 -0
- package/dist/theme/theme-locale.d.ts +7 -0
- package/dist/theme/theme-locale.d.ts.map +1 -0
- package/dist/theme/theme-locale.js +8 -0
- package/dist/theme/theme-provider.d.ts +4 -1
- package/dist/theme/theme-provider.d.ts.map +1 -1
- package/dist/theme/theme-provider.js +30 -25
- package/dist/theme/translations.d.ts +14 -0
- package/dist/theme/translations.d.ts.map +1 -0
- package/dist/theme/translations.js +10 -0
- package/dist/theme/translations.spec.d.ts +2 -0
- package/dist/theme/translations.spec.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/components/collapsible/translations.d.ts +0 -32
- package/dist/components/collapsible/translations.d.ts.map +0 -1
- package/dist/components/collapsible/translations.js +0 -30
- package/dist/components/combobox/translations.d.ts +0 -9
- package/dist/components/combobox/translations.d.ts.map +0 -1
- package/dist/components/combobox/translations.js +0 -57
- package/dist/components/image-upload/translations.d.ts +0 -73
- package/dist/components/image-upload/translations.d.ts.map +0 -1
- package/dist/components/image-upload/translations.js +0 -66
- package/dist/components/paginator/translations.d.ts +0 -9
- package/dist/components/paginator/translations.d.ts.map +0 -1
- package/dist/components/paginator/translations.js +0 -36
- package/dist/components/phone-input/translations.d.ts +0 -60
- package/dist/components/phone-input/translations.d.ts.map +0 -1
- package/dist/components/phone-input/translations.js +0 -54
- package/dist/components/rich-text-editor/translations.d.ts.map +0 -1
- package/dist/components/rich-text-editor/translations.js +0 -120
- package/dist/components/table/translations.d.ts +0 -308
- package/dist/components/table/translations.d.ts.map +0 -1
- package/dist/components/table/translations.js +0 -267
|
@@ -4,29 +4,30 @@ import { BackIcon as c } from "../icon/icons/back-icon.js";
|
|
|
4
4
|
import { ForwardIcon as l } from "../icon/icons/forward-icon.js";
|
|
5
5
|
import { Text as u } from "../text/text.js";
|
|
6
6
|
import { Checkbox as d } from "../checkbox/checkbox.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { Fragment as
|
|
7
|
+
import { useComponentTranslations as f } from "../../theme/translations.js";
|
|
8
|
+
import { ComboboxItem as p } from "./combobox-item.js";
|
|
9
|
+
import { comboboxTranslations as m } from "./combobox.translations.js";
|
|
10
|
+
import { Radio as h } from "../radio/radio.js";
|
|
11
|
+
import { RadioGroup as g } from "../radio/radio-group.js";
|
|
12
|
+
import { autoUpdate as _, computePosition as v, flip as y } from "../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
13
|
+
import { Fragment as b, useEffect as x, useState as S } from "react";
|
|
14
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
15
|
+
import { Box as E, Flex as D } from "@chakra-ui/react";
|
|
15
16
|
//#region lib/components/combobox/combobox-menu.tsx
|
|
16
|
-
var
|
|
17
|
-
let a = (0,
|
|
17
|
+
var O = e(), k = (e, t, n, r, i) => {
|
|
18
|
+
let a = (0, O.c)(8), o;
|
|
18
19
|
a[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
|
|
19
20
|
transform: "translate(0, 0)",
|
|
20
21
|
minWidth: 0
|
|
21
22
|
}, a[0] = o) : o = a[0];
|
|
22
|
-
let [s, c] =
|
|
23
|
+
let [s, c] = S(o), l, u;
|
|
23
24
|
return a[1] !== n || a[2] !== e || a[3] !== i || a[4] !== r || a[5] !== t ? (l = () => {
|
|
24
|
-
if (!e.current || !t.current || !n) return
|
|
25
|
+
if (!e.current || !t.current || !n) return F;
|
|
25
26
|
let a = async () => {
|
|
26
27
|
if (e.current && t.current && n) {
|
|
27
|
-
let { width: n } = e.current.getBoundingClientRect(), { x: a, y: o } = await
|
|
28
|
+
let { width: n } = e.current.getBoundingClientRect(), { x: a, y: o } = await v(e.current, t.current, {
|
|
28
29
|
placement: i || "bottom-start",
|
|
29
|
-
middleware: [
|
|
30
|
+
middleware: [y()]
|
|
30
31
|
});
|
|
31
32
|
c({
|
|
32
33
|
transform: `translate(${a}px, ${o}px)`,
|
|
@@ -34,7 +35,7 @@ var D = e(), O = (e, t, n, r, i) => {
|
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
return
|
|
38
|
+
return _(e.current, t.current, () => {
|
|
38
39
|
a().catch(console.error);
|
|
39
40
|
});
|
|
40
41
|
}, u = [
|
|
@@ -43,72 +44,72 @@ var D = e(), O = (e, t, n, r, i) => {
|
|
|
43
44
|
n,
|
|
44
45
|
i,
|
|
45
46
|
r
|
|
46
|
-
], a[1] = n, a[2] = e, a[3] = i, a[4] = r, a[5] = t, a[6] = l, a[7] = u) : (l = a[6], u = a[7]),
|
|
47
|
+
], a[1] = n, a[2] = e, a[3] = i, a[4] = r, a[5] = t, a[6] = l, a[7] = u) : (l = a[6], u = a[7]), x(l, u), s;
|
|
47
48
|
};
|
|
48
|
-
function
|
|
49
|
-
let t = (0,
|
|
50
|
-
return t[0] !== r || t[1] !== n ? (i = n ? /* @__PURE__ */
|
|
49
|
+
function A(e) {
|
|
50
|
+
let t = (0, O.c)(3), { isSingleSelect: n, isChecked: r } = e, i;
|
|
51
|
+
return t[0] !== r || t[1] !== n ? (i = n ? /* @__PURE__ */ w(g, {
|
|
51
52
|
value: r ? "true" : "false",
|
|
52
|
-
children: /* @__PURE__ */
|
|
53
|
-
}) : /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ w(h, { value: "true" })
|
|
54
|
+
}) : /* @__PURE__ */ w(d, { isChecked: r }), t[0] = r, t[1] = n, t[2] = i) : i = t[2], i;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
let i = (0,
|
|
57
|
-
i[0] === d ?
|
|
56
|
+
function j(e) {
|
|
57
|
+
let i = (0, O.c)(32), { inputValue: c, displayItems: l, highlightState: d, openState: p, isSingleSelect: h, isSearching: g, isHidingItems: _, popoverWidth: v, popoverPlacement: y, parentRef: b, popupRef: x, footerContent: S, folderStyle: C } = e, A = f(m), j = k(b, x, p.isOpen, v, y), M;
|
|
58
|
+
i[0] === d ? M = i[1] : (M = (e) => {
|
|
58
59
|
d.set(e);
|
|
59
|
-
}, i[0] = d, i[1] =
|
|
60
|
-
let
|
|
61
|
-
i[2] !==
|
|
62
|
-
e.preventDefault(), e.stopPropagation(),
|
|
63
|
-
}, i[2] =
|
|
64
|
-
let
|
|
65
|
-
i[5] !== l || i[6] !== c || i[7] !==
|
|
60
|
+
}, i[0] = d, i[1] = M);
|
|
61
|
+
let F = M, I = p.isOpen ? "block" : "none", L;
|
|
62
|
+
i[2] !== h || i[3] !== p ? (L = (e) => {
|
|
63
|
+
e.preventDefault(), e.stopPropagation(), h && p.close();
|
|
64
|
+
}, i[2] = h, i[3] = p, i[4] = L) : L = i[4];
|
|
65
|
+
let R = !h, z;
|
|
66
|
+
i[5] !== l || i[6] !== c || i[7] !== g || i[8] !== A ? (z = g && l.length === 0 && c.length > 0 && /* @__PURE__ */ w(u, {
|
|
66
67
|
px: s.Small,
|
|
67
68
|
color: n.OnSurfaceSubdued,
|
|
68
|
-
children:
|
|
69
|
-
}), i[5] = l, i[6] = c, i[7] =
|
|
70
|
-
let z;
|
|
71
|
-
i[10] !== k || i[11] !== P || i[12] !== e ? (z = T(k === "stacked" ? M : N, {
|
|
72
|
-
...e,
|
|
73
|
-
onHover: P
|
|
74
|
-
}), i[10] = k, i[11] = P, i[12] = e, i[13] = z) : z = i[13];
|
|
69
|
+
children: A.noMatchFor(c)
|
|
70
|
+
}), i[5] = l, i[6] = c, i[7] = g, i[8] = A, i[9] = z) : z = i[9];
|
|
75
71
|
let B;
|
|
76
|
-
i[
|
|
72
|
+
i[10] !== C || i[11] !== F || i[12] !== e ? (B = w(C === "stacked" ? N : P, {
|
|
73
|
+
...e,
|
|
74
|
+
onHover: F
|
|
75
|
+
}), i[10] = C, i[11] = F, i[12] = e, i[13] = B) : B = i[13];
|
|
76
|
+
let V;
|
|
77
|
+
i[14] !== l || i[15] !== _ || i[16] !== A ? (V = _ && /* @__PURE__ */ w(u, {
|
|
77
78
|
px: s.Small,
|
|
78
79
|
py: s.Small,
|
|
79
80
|
color: n.OnSurfaceSubdued,
|
|
80
81
|
fontSize: r.Small,
|
|
81
|
-
children:
|
|
82
|
-
}), i[14] = l, i[15] =
|
|
83
|
-
let
|
|
84
|
-
i[18] !==
|
|
82
|
+
children: A.showMaxItems(l.length)
|
|
83
|
+
}), i[14] = l, i[15] = _, i[16] = A, i[17] = V) : V = i[17];
|
|
84
|
+
let H;
|
|
85
|
+
i[18] !== R || i[19] !== z || i[20] !== B || i[21] !== V ? (H = /* @__PURE__ */ T(D, {
|
|
85
86
|
as: "ul",
|
|
86
87
|
flexDirection: "column",
|
|
87
88
|
maxHeight: "300px",
|
|
88
89
|
overflowY: "auto",
|
|
89
90
|
overflowX: "hidden",
|
|
90
91
|
role: "listbox",
|
|
91
|
-
"aria-multiselectable":
|
|
92
|
+
"aria-multiselectable": R,
|
|
92
93
|
padding: `${s.Small} 0`,
|
|
93
94
|
children: [
|
|
94
|
-
R,
|
|
95
95
|
z,
|
|
96
|
-
B
|
|
96
|
+
B,
|
|
97
|
+
V
|
|
97
98
|
]
|
|
98
|
-
}), i[18] =
|
|
99
|
-
let
|
|
100
|
-
i[23] ===
|
|
99
|
+
}), i[18] = R, i[19] = z, i[20] = B, i[21] = V, i[22] = H) : H = i[22];
|
|
100
|
+
let U;
|
|
101
|
+
i[23] === S ? U = i[24] : (U = S && /* @__PURE__ */ w(E, {
|
|
101
102
|
position: "sticky",
|
|
102
103
|
bottom: "0",
|
|
103
104
|
backgroundColor: n.Surface,
|
|
104
105
|
padding: `${s.Small} ${s.Medium}`,
|
|
105
106
|
borderTop: `${t.XSmall} ${n.OnSurfaceBorder}`,
|
|
106
107
|
tabIndex: -1,
|
|
107
|
-
children:
|
|
108
|
-
}), i[23] =
|
|
109
|
-
let
|
|
110
|
-
return i[25] !==
|
|
111
|
-
display:
|
|
108
|
+
children: S
|
|
109
|
+
}), i[23] = S, i[24] = U);
|
|
110
|
+
let W;
|
|
111
|
+
return i[25] !== j || i[26] !== x || i[27] !== I || i[28] !== L || i[29] !== H || i[30] !== U ? (W = /* @__PURE__ */ T(E, {
|
|
112
|
+
display: I,
|
|
112
113
|
inset: "0 auto auto 0",
|
|
113
114
|
position: "fixed",
|
|
114
115
|
zIndex: "50",
|
|
@@ -118,16 +119,16 @@ function A(e) {
|
|
|
118
119
|
boxShadow: o.Medium,
|
|
119
120
|
color: n.OnSurface,
|
|
120
121
|
overflow: "hidden",
|
|
121
|
-
style:
|
|
122
|
-
ref:
|
|
122
|
+
style: j,
|
|
123
|
+
ref: x,
|
|
123
124
|
maxW: "90%",
|
|
124
|
-
onClick:
|
|
125
|
-
children: [
|
|
126
|
-
}), i[25] =
|
|
125
|
+
onClick: L,
|
|
126
|
+
children: [H, U]
|
|
127
|
+
}), i[25] = j, i[26] = x, i[27] = I, i[28] = L, i[29] = H, i[30] = U, i[31] = W) : W = i[31], W;
|
|
127
128
|
}
|
|
128
|
-
var
|
|
129
|
-
let t = (0,
|
|
130
|
-
return t[0] !== r || t[1] !== o || t[2] !== i || t[3] !== a || t[4] !== c || t[5] !== l ? (u = /* @__PURE__ */
|
|
129
|
+
var M = (e) => {
|
|
130
|
+
let t = (0, O.c)(7), { children: r, isChecked: i, onClick: a, isActive: o, onHover: c } = e, l = o ? n.AccentHoverAlpha : "", u;
|
|
131
|
+
return t[0] !== r || t[1] !== o || t[2] !== i || t[3] !== a || t[4] !== c || t[5] !== l ? (u = /* @__PURE__ */ w(D, {
|
|
131
132
|
as: "li",
|
|
132
133
|
role: "option",
|
|
133
134
|
width: "100%",
|
|
@@ -144,94 +145,94 @@ var j = (e) => {
|
|
|
144
145
|
"aria-selected": i,
|
|
145
146
|
children: r
|
|
146
147
|
}), t[0] = r, t[1] = o, t[2] = i, t[3] = a, t[4] = c, t[5] = l, t[6] = u) : u = t[6], u;
|
|
147
|
-
},
|
|
148
|
-
let u = (e, t) => e.children && e.children.length > 0 ? e.children.every((e) => u(e, t)) : t.some((t) => t.id === e.id),
|
|
148
|
+
}, N = ({ displayItems: e, selectedItems: t, toggleItem: r, onHover: i, parentSelectsChildren: a, highlightState: o, inputValue: c, isSingleSelect: l }) => {
|
|
149
|
+
let u = (e, t) => e.children && e.children.length > 0 ? e.children.every((e) => u(e, t)) : t.some((t) => t.id === e.id), f = (e) => e.children && e.children.length > 0 ? e.children.some((e) => f(e)) : t.some((t) => t.id === e.id), m = 0, h = (e, t, g = []) => e.map((e) => {
|
|
149
150
|
let _ = (t) => {
|
|
150
151
|
t.stopPropagation(), t.preventDefault(), r(e);
|
|
151
152
|
};
|
|
152
153
|
g.length > 0 && --g[g.length - 1];
|
|
153
|
-
let v = m++,
|
|
154
|
-
return a &&
|
|
154
|
+
let v = m++, y = e.children && e.children.length > 0, x = !y || e.isSelectableParent, S = t.some((t) => t.id === e.id);
|
|
155
|
+
return a && y && !e.isSelectableParent && u(e, t) && (S = !0), /* @__PURE__ */ T(b, { children: [/* @__PURE__ */ T(M, {
|
|
155
156
|
isActive: o.index === v,
|
|
156
|
-
isChecked:
|
|
157
|
+
isChecked: S,
|
|
157
158
|
onClick: _,
|
|
158
159
|
onHover: () => i(v),
|
|
159
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ T(D, {
|
|
160
161
|
alignItems: "center",
|
|
161
162
|
whiteSpace: "nowrap",
|
|
162
163
|
minW: 0,
|
|
163
164
|
children: [g.map((t, r, i) => {
|
|
164
165
|
let a = i.length === r + 1, o = t > 0, c = t === 0, l = o || a;
|
|
165
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ T(D, {
|
|
166
167
|
w: s.Medium,
|
|
167
168
|
minW: s.Medium,
|
|
168
169
|
alignItems: "center",
|
|
169
170
|
my: "-0.5rem",
|
|
170
171
|
h: "2.5rem",
|
|
171
|
-
children: [l && /* @__PURE__ */
|
|
172
|
+
children: [l && /* @__PURE__ */ w(E, {
|
|
172
173
|
w: "1px",
|
|
173
174
|
h: c ? "52%" : "100%",
|
|
174
175
|
backgroundColor: n.OnSurface,
|
|
175
176
|
mb: "auto"
|
|
176
|
-
}), a && /* @__PURE__ */
|
|
177
|
+
}), a && /* @__PURE__ */ w(E, {
|
|
177
178
|
w: "inherit",
|
|
178
179
|
height: "1px",
|
|
179
180
|
backgroundColor: n.OnSurface,
|
|
180
181
|
mr: s.XSmall
|
|
181
182
|
})]
|
|
182
183
|
}, `${e.id}_${r}`);
|
|
183
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ w(p, {
|
|
184
185
|
item: e,
|
|
185
186
|
asPlainText: !0,
|
|
186
187
|
highlightQuery: c
|
|
187
188
|
})]
|
|
188
|
-
}), x ? /* @__PURE__ */
|
|
189
|
+
}), x ? /* @__PURE__ */ w(A, {
|
|
189
190
|
isSingleSelect: l,
|
|
190
|
-
isChecked:
|
|
191
|
-
}) : a && !l && /* @__PURE__ */
|
|
192
|
-
isIndeterminate:
|
|
193
|
-
isChecked:
|
|
191
|
+
isChecked: S
|
|
192
|
+
}) : a && !l && /* @__PURE__ */ w(d, {
|
|
193
|
+
isIndeterminate: f(e),
|
|
194
|
+
isChecked: S
|
|
194
195
|
})]
|
|
195
196
|
}), e.children && h(e.children, t, [...g, e.children.length])] }, e.id);
|
|
196
197
|
});
|
|
197
198
|
return h(e, t);
|
|
198
|
-
},
|
|
199
|
+
}, P = ({ displayItems: e, selectedItems: t, toggleItem: r, onHover: a, highlightState: o, isSingleSelect: u, subMenuState: d, parentStrings: f, asPlainText: m, isSearching: h, isReadOnly: g, previousSelectedItems: _ }) => {
|
|
199
200
|
let v = (e, t) => {
|
|
200
201
|
e.stopPropagation(), e.preventDefault(), r(t);
|
|
201
202
|
};
|
|
202
|
-
return e.map((r,
|
|
203
|
-
let x = t.some((e) => e.id === r.id),
|
|
203
|
+
return e.map((r, y) => {
|
|
204
|
+
let x = t.some((e) => e.id === r.id), S = r.children?.length, O = r.id === "_back", k = d.opened[d.opened.length - 1], j = r.id === k?.id, N = O ? /* @__PURE__ */ T(D, {
|
|
204
205
|
gap: s.XSmall,
|
|
205
206
|
alignItems: "center",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
207
|
-
}) : /* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ w(c, { size: i.Small }), r.label]
|
|
208
|
+
}) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T(D, {
|
|
208
209
|
gap: s.XSmall,
|
|
209
210
|
alignItems: "center",
|
|
210
211
|
whiteSpace: "nowrap",
|
|
211
|
-
children: [
|
|
212
|
+
children: [f[r.id]?.map((e) => /* @__PURE__ */ T(b, { children: [/* @__PURE__ */ w(E, {
|
|
212
213
|
color: n.OnSurfaceSubdued,
|
|
213
214
|
children: e
|
|
214
|
-
}), /* @__PURE__ */
|
|
215
|
+
}), /* @__PURE__ */ w(E, {
|
|
215
216
|
color: n.OnSurfaceSubdued,
|
|
216
217
|
children: "/"
|
|
217
|
-
})] }, e)), /* @__PURE__ */
|
|
218
|
+
})] }, e)), /* @__PURE__ */ w(p, {
|
|
218
219
|
item: r,
|
|
219
220
|
asPlainText: m
|
|
220
221
|
})]
|
|
221
|
-
}), g ? void 0 :
|
|
222
|
+
}), g ? void 0 : S && !j && !h ? /* @__PURE__ */ w(l, {
|
|
222
223
|
size: i.Small,
|
|
223
224
|
color: n.OnBackgroundSubdued
|
|
224
|
-
}) : /* @__PURE__ */
|
|
225
|
+
}) : /* @__PURE__ */ w(A, {
|
|
225
226
|
isSingleSelect: u,
|
|
226
227
|
isChecked: x
|
|
227
|
-
})] }), P = _.length > 0 && _.length - 1 ===
|
|
228
|
-
return /* @__PURE__ */
|
|
229
|
-
isActive: o.index ===
|
|
228
|
+
})] }), P = _.length > 0 && _.length - 1 === y && _.length < e.length, F = !g && !h && (P || O || j);
|
|
229
|
+
return /* @__PURE__ */ T(b, { children: [/* @__PURE__ */ w(M, {
|
|
230
|
+
isActive: o.index === y,
|
|
230
231
|
isChecked: x,
|
|
231
232
|
onClick: (e) => v(e, r),
|
|
232
|
-
onHover: () => a(
|
|
233
|
+
onHover: () => a(y),
|
|
233
234
|
children: N
|
|
234
|
-
}), F && /* @__PURE__ */
|
|
235
|
+
}), F && /* @__PURE__ */ w(E, {
|
|
235
236
|
margin: `${s.Small} ${O ? 0 : s.Medium}`,
|
|
236
237
|
height: "1px",
|
|
237
238
|
flexShrink: 0,
|
|
@@ -239,6 +240,6 @@ var j = (e) => {
|
|
|
239
240
|
})] }, r.id);
|
|
240
241
|
});
|
|
241
242
|
};
|
|
242
|
-
function
|
|
243
|
+
function F() {}
|
|
243
244
|
//#endregion
|
|
244
|
-
export {
|
|
245
|
+
export { j as ComboboxMenu };
|
|
@@ -6,5 +6,5 @@ import { ComboboxProps } from './types.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @see Docs https://caspeco.github.io/casper-ui-library/components/combobox
|
|
8
8
|
*/
|
|
9
|
-
export declare function Combobox({ id, label, isSingleSelect, selectedItems,
|
|
9
|
+
export declare function Combobox({ id, label, isSingleSelect, selectedItems, size, variant, asPlainText, onSearch, items, maxVisibleItems, onChange, onBlur, isDisabled, isReadOnly, isRequired, placeholder, footerContent, popoverWidth, popoverPlacement, collapsed, folderStyle, keepSearchAfterSelect, parentSelectsChildren, ...props }: ComboboxProps): import('react').JSX.Element;
|
|
10
10
|
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAIX,aAAa,EAEb,MAAM,SAAS,CAAC;AA6GjB;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EACxB,EAAE,EACF,KAAU,EACV,cAAsB,EACtB,aAAkB,EAClB,IAAW,EACX,OAAmB,EACnB,WAAmB,EACnB,QAAQ,EACR,KAAK,EACL,eAAe,EACf,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,SAAiB,EACjB,WAAuB,EACvB,qBAAiD,EACjD,qBAAqB,EACrB,GAAG,KAAK,EACR,EAAE,aAAa,+BAgWf"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { require_compiler_runtime as e } from "../../node_modules/react/compiler-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { jsx as
|
|
2
|
+
import { useComponentTranslations as t } from "../../theme/translations.js";
|
|
3
|
+
import { comboboxTranslations as n } from "./combobox.translations.js";
|
|
4
|
+
import { ComboboxButton as r } from "./combobox-button.js";
|
|
5
|
+
import { ComboboxMenu as i } from "./combobox-menu.js";
|
|
6
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { Box as u, useFieldContext as d } from "@chakra-ui/react";
|
|
8
9
|
//#region lib/components/combobox/combobox.tsx
|
|
9
|
-
var
|
|
10
|
-
let n = (0,
|
|
10
|
+
var f = e(), p = (e, t) => {
|
|
11
|
+
let n = (0, f.c)(15), [r, i] = s(0), a;
|
|
11
12
|
n[0] === t ? a = n[1] : (a = (e) => {
|
|
12
13
|
if (!t.current) return;
|
|
13
14
|
let n = [...t.current.querySelectorAll("li")];
|
|
@@ -16,86 +17,86 @@ var d = e(), f = (e, t) => {
|
|
|
16
17
|
block: "nearest"
|
|
17
18
|
}), i(e));
|
|
18
19
|
}, n[0] = t, n[1] = a);
|
|
19
|
-
let
|
|
20
|
-
n[2] !== r || n[3] !== e || n[4] !==
|
|
20
|
+
let o = a, c;
|
|
21
|
+
n[2] !== r || n[3] !== e || n[4] !== o ? (c = () => o((r + 1) % e.length), n[2] = r, n[3] = e, n[4] = o, n[5] = c) : c = n[5];
|
|
21
22
|
let l = c, u;
|
|
22
|
-
n[6] !== r || n[7] !== e || n[8] !==
|
|
23
|
-
let
|
|
24
|
-
return n[10] !== r || n[11] !==
|
|
23
|
+
n[6] !== r || n[7] !== e || n[8] !== o ? (u = () => o((r - 1 + e.length) % e.length), n[6] = r, n[7] = e, n[8] = o, n[9] = u) : u = n[9];
|
|
24
|
+
let d = u, p;
|
|
25
|
+
return n[10] !== r || n[11] !== o || n[12] !== l || n[13] !== d ? (p = {
|
|
25
26
|
index: r,
|
|
26
|
-
set:
|
|
27
|
+
set: o,
|
|
27
28
|
next: l,
|
|
28
|
-
previous:
|
|
29
|
-
}, n[10] = r, n[11] =
|
|
30
|
-
},
|
|
31
|
-
let
|
|
32
|
-
|
|
29
|
+
previous: d
|
|
30
|
+
}, n[10] = r, n[11] = o, n[12] = l, n[13] = d, n[14] = p) : p = n[14], p;
|
|
31
|
+
}, m = (e, t, n, r, i, a) => {
|
|
32
|
+
let o = (0, f.c)(13), [c, l] = s(!1), u = c && !r, d;
|
|
33
|
+
o[0] !== t || o[1] !== i || o[2] !== n ? (d = () => {
|
|
33
34
|
t || (n(""), i?.("")), l(!1);
|
|
34
|
-
},
|
|
35
|
-
let p =
|
|
36
|
-
|
|
35
|
+
}, o[0] = t, o[1] = i, o[2] = n, o[3] = d) : d = o[3];
|
|
36
|
+
let p = d, m;
|
|
37
|
+
o[4] !== e || o[5] !== r || o[6] !== u || o[7] !== a ? (m = () => {
|
|
37
38
|
u || r || (l(!0), e.set(0), a?.());
|
|
38
|
-
},
|
|
39
|
+
}, o[4] = e, o[5] = r, o[6] = u, o[7] = a, o[8] = m) : m = o[8];
|
|
39
40
|
let h = m, g;
|
|
40
|
-
return
|
|
41
|
+
return o[9] !== p || o[10] !== u || o[11] !== h ? (g = {
|
|
41
42
|
isOpen: u,
|
|
42
43
|
close: p,
|
|
43
44
|
open: h
|
|
44
|
-
},
|
|
45
|
-
},
|
|
45
|
+
}, o[9] = p, o[10] = u, o[11] = h, o[12] = g) : g = o[12], g;
|
|
46
|
+
}, h = (e, t) => {
|
|
46
47
|
for (let n of e) {
|
|
47
48
|
if (n.id === t) return [];
|
|
48
49
|
if (n.children) {
|
|
49
|
-
let e =
|
|
50
|
+
let e = h(n.children, t);
|
|
50
51
|
if (e !== void 0) return [n, ...e];
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
},
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
let [
|
|
57
|
-
if (!
|
|
54
|
+
}, g = (e) => {
|
|
55
|
+
let r = (0, f.c)(14), i = t(n), a;
|
|
56
|
+
r[0] === Symbol.for("react.memo_cache_sentinel") ? (a = [], r[0] = a) : a = r[0];
|
|
57
|
+
let [o, c] = s(a), l;
|
|
58
|
+
if (!o.length) l = e;
|
|
58
59
|
else {
|
|
59
|
-
let e =
|
|
60
|
-
|
|
60
|
+
let e = o[o.length - 1], t;
|
|
61
|
+
r[1] === i.back ? t = r[2] : (t = {
|
|
61
62
|
id: "_back",
|
|
62
|
-
label:
|
|
63
|
-
},
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
label: i.back
|
|
64
|
+
}, r[1] = i.back, r[2] = t);
|
|
65
|
+
let n = t, a;
|
|
66
|
+
r[3] === e?.children ? a = r[4] : (a = e?.children || [], r[3] = e?.children, r[4] = a);
|
|
67
|
+
let s = a, c;
|
|
68
|
+
r[5] !== n || r[6] !== s || r[7] !== e ? (c = e?.isSelectableParent ? [
|
|
69
|
+
n,
|
|
69
70
|
e,
|
|
70
|
-
...
|
|
71
|
-
] : [
|
|
71
|
+
...s
|
|
72
|
+
] : [n, ...s], r[5] = n, r[6] = s, r[7] = e, r[8] = c) : c = r[8], l = c;
|
|
72
73
|
}
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
let
|
|
80
|
-
return
|
|
81
|
-
open:
|
|
82
|
-
back:
|
|
83
|
-
setPath:
|
|
84
|
-
opened:
|
|
85
|
-
current:
|
|
86
|
-
},
|
|
87
|
-
},
|
|
74
|
+
let u, d;
|
|
75
|
+
r[9] === Symbol.for("react.memo_cache_sentinel") ? (u = (e) => {
|
|
76
|
+
c((t) => [...t, e]);
|
|
77
|
+
}, d = () => {
|
|
78
|
+
c(v);
|
|
79
|
+
}, r[9] = u, r[10] = d) : (u = r[9], d = r[10]);
|
|
80
|
+
let p;
|
|
81
|
+
return r[11] !== l || r[12] !== o ? (p = {
|
|
82
|
+
open: u,
|
|
83
|
+
back: d,
|
|
84
|
+
setPath: c,
|
|
85
|
+
opened: o,
|
|
86
|
+
current: l
|
|
87
|
+
}, r[11] = l, r[12] = o, r[13] = p) : p = r[13], p;
|
|
88
|
+
}, ee = (e) => {
|
|
88
89
|
let t = {};
|
|
89
90
|
function n(e, r) {
|
|
90
91
|
t[e.id] = [...r], e.children && e.children.forEach((t) => n(t, [...r, e.label]));
|
|
91
92
|
}
|
|
92
93
|
return e.forEach((e) => n(e, [])), t;
|
|
93
94
|
};
|
|
94
|
-
function _({ id: e, label:
|
|
95
|
-
let [M, N] =
|
|
95
|
+
function _({ id: e, label: f = "", isSingleSelect: _ = !1, selectedItems: v = [], size: te = "md", variant: ne = "outline", asPlainText: y = !1, onSearch: b, items: x, maxVisibleItems: S, onChange: C, onBlur: w, isDisabled: T, isReadOnly: E, isRequired: re, placeholder: ie, footerContent: ae, popoverWidth: oe, popoverPlacement: se, collapsed: D = !1, folderStyle: O = "grouped", keepSearchAfterSelect: k = O === "stacked", parentSelectsChildren: A, ...j }) {
|
|
96
|
+
let [M, N] = s(y ? v[0]?.label ?? "" : ""), [ce, P] = s(!1), le = t(n), F = o(null), I = o(null), L = g(x), R = M.toLowerCase() === v[0]?.label.toLowerCase(), z = M.length > 0 && !(y && R), B = d(), V = B?.invalid ?? !1, H = T ?? B?.disabled ?? !1, U = E ?? B?.readOnly ?? !1, W = re ?? B?.required ?? !1, G = L.current;
|
|
96
97
|
if (z) {
|
|
97
98
|
let e = [], t = M.toLowerCase();
|
|
98
|
-
if (
|
|
99
|
+
if (O === "stacked") {
|
|
99
100
|
let e = (n) => n.map((n) => {
|
|
100
101
|
let r = n.label.toLowerCase().includes(t), i = n.children && n.children.length > 0;
|
|
101
102
|
if (r) return n;
|
|
@@ -118,16 +119,16 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
|
-
let K =
|
|
122
|
-
if (
|
|
122
|
+
let K = p(G, I), [q, ue] = s([]), J = m(K, y, N, H, b, () => {
|
|
123
|
+
if (O !== "stacked") {
|
|
123
124
|
if (_) {
|
|
124
|
-
let e = v[0]?.id, t = e ?
|
|
125
|
-
|
|
125
|
+
let e = v[0]?.id, t = e ? h(x, e) ?? [] : [];
|
|
126
|
+
L.setPath(t);
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
128
129
|
ue(v);
|
|
129
130
|
}
|
|
130
|
-
}), [Y, de] =
|
|
131
|
+
}), [Y, de] = s({
|
|
131
132
|
isOpen: J.isOpen,
|
|
132
133
|
selectedItems: v,
|
|
133
134
|
asPlainText: y
|
|
@@ -139,10 +140,10 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
139
140
|
}), y && !J.isOpen && N(v[0]?.label ?? "")), z || (G = [...q, ...G.filter((e) => !q.find((t) => t.label === e.label))]);
|
|
140
141
|
let X = !1;
|
|
141
142
|
U ? G = v : (X = G.length > (S ?? Infinity), G = G.slice(0, S));
|
|
142
|
-
let Z =
|
|
143
|
-
let t =
|
|
143
|
+
let Z = ee(x), fe = (e) => {
|
|
144
|
+
let t = L.opened.length > 0 && L.opened[L.opened.length - 1]?.id === e.id, n = e.children && e.children.length > 0;
|
|
144
145
|
if (!z && !t && n) {
|
|
145
|
-
|
|
146
|
+
L.open(e), requestAnimationFrame(() => K.set(1));
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
148
149
|
return _ ? [e] : Q(e);
|
|
@@ -160,17 +161,17 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
160
161
|
}
|
|
161
162
|
let he = (e) => {
|
|
162
163
|
if (!e || U || H) return;
|
|
163
|
-
if (
|
|
164
|
-
|
|
164
|
+
if (I.current?.parentNode?.querySelector("input")?.focus(), e.id === "_back") {
|
|
165
|
+
L.back();
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
168
|
let t;
|
|
168
|
-
t =
|
|
169
|
+
t = O === "grouped" ? fe(e) : pe(e), t && (y ? N(t[0]?.label ?? "") : k || (N(""), b?.("")), _ && (t.length === 0 ? J.open() : J.close()), C && C(t));
|
|
169
170
|
}, ge = () => {
|
|
170
|
-
U || H || W || v.length === 0 || (
|
|
171
|
-
}, _e = v.length === 0 ? ie ??
|
|
172
|
-
|
|
173
|
-
let e =
|
|
171
|
+
U || H || W || v.length === 0 || (F.current?.querySelector("input")?.focus(), N(""), b?.(""), C?.([]));
|
|
172
|
+
}, _e = v.length === 0 ? ie ?? le.search : void 0;
|
|
173
|
+
a(() => {
|
|
174
|
+
let e = I.current?.querySelector("[role='listbox']");
|
|
174
175
|
if (!e || !J.isOpen) return;
|
|
175
176
|
let t = (t) => {
|
|
176
177
|
t.target === e && t.preventDefault();
|
|
@@ -180,7 +181,7 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
180
181
|
};
|
|
181
182
|
}, [J.isOpen]);
|
|
182
183
|
let ve = (e) => {
|
|
183
|
-
|
|
184
|
+
F.current?.contains(e.relatedTarget) || (J.close(), P(!1), w && w(v));
|
|
184
185
|
}, $ = {
|
|
185
186
|
id: e,
|
|
186
187
|
asPlainText: y,
|
|
@@ -194,13 +195,13 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
194
195
|
parentStrings: Z,
|
|
195
196
|
size: te,
|
|
196
197
|
variant: ne,
|
|
197
|
-
label:
|
|
198
|
+
label: f,
|
|
198
199
|
placeHolderText: _e,
|
|
199
200
|
isDisabled: H,
|
|
200
201
|
isReadOnly: U,
|
|
201
202
|
isInvalid: V,
|
|
202
203
|
isRequired: W,
|
|
203
|
-
collapsed:
|
|
204
|
+
collapsed: D,
|
|
204
205
|
hasPendingDelete: ce,
|
|
205
206
|
setHasPendingDelete: P,
|
|
206
207
|
setInputValue: N,
|
|
@@ -208,22 +209,21 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
208
209
|
isSingleSelect: _,
|
|
209
210
|
isSearching: z,
|
|
210
211
|
isHidingItems: X,
|
|
211
|
-
popoverWidth:
|
|
212
|
-
popoverPlacement:
|
|
212
|
+
popoverWidth: oe,
|
|
213
|
+
popoverPlacement: se,
|
|
213
214
|
previousSelectedItems: q,
|
|
214
|
-
parentRef:
|
|
215
|
-
popupRef:
|
|
216
|
-
footerContent:
|
|
217
|
-
subMenuState:
|
|
218
|
-
|
|
219
|
-
folderStyle: k,
|
|
215
|
+
parentRef: F,
|
|
216
|
+
popupRef: I,
|
|
217
|
+
footerContent: ae,
|
|
218
|
+
subMenuState: L,
|
|
219
|
+
folderStyle: O,
|
|
220
220
|
parentSelectsChildren: A
|
|
221
221
|
};
|
|
222
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ c(u, {
|
|
223
223
|
role: "combobox",
|
|
224
224
|
asChild: !0,
|
|
225
225
|
className: "combobox",
|
|
226
|
-
ref:
|
|
226
|
+
ref: F,
|
|
227
227
|
onClick: J.open,
|
|
228
228
|
onBlur: ve,
|
|
229
229
|
overflow: "visible",
|
|
@@ -234,9 +234,9 @@ function _({ id: e, label: d = "", isSingleSelect: _ = !1, selectedItems: v = []
|
|
|
234
234
|
"aria-readonly": U,
|
|
235
235
|
"aria-invalid": V,
|
|
236
236
|
...j,
|
|
237
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ l("label", {
|
|
238
238
|
htmlFor: e,
|
|
239
|
-
children: [/* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ c(r, { ...$ }), J.isOpen && /* @__PURE__ */ c(i, { ...$ })]
|
|
240
240
|
})
|
|
241
241
|
});
|
|
242
242
|
}
|