@box/metadata-editor 1.64.4 → 1.64.6
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/chunks/ai-suggestion-field.js +83 -0
- package/dist/chunks/autofill-overlay.js +63 -0
- package/dist/chunks/combobox-with-api-pagination.js +162 -0
- package/dist/chunks/custom-instance-new-field.js +60 -0
- package/dist/chunks/custom-instance.js +74 -0
- package/dist/chunks/delete-confirmation-modal.js +76 -0
- package/dist/chunks/field-action-bar.module.js +6 -8
- package/dist/chunks/filter-dropdown-menu.module.js +14 -13
- package/dist/chunks/filter-instances-dropdown.js +84 -0
- package/dist/chunks/interactive-header-text.js +19 -0
- package/dist/chunks/interactive-text.js +17 -0
- package/dist/chunks/metadata-editor.js +9 -0
- package/dist/chunks/metadata-instance-content.js +29 -0
- package/dist/chunks/metadata-instance-entry.js +82 -0
- package/dist/chunks/metadata-instance-footer.js +25 -0
- package/dist/chunks/metadata-instance-form-autofill-button.js +113 -0
- package/dist/chunks/metadata-instance-form-card-wrapper.js +47 -70
- package/dist/chunks/metadata-instance-form-footer.js +43 -0
- package/dist/chunks/metadata-instance-form-header.js +45 -0
- package/dist/chunks/metadata-instance-header.js +52 -0
- package/dist/chunks/metadata-instance-list.js +19 -0
- package/dist/chunks/metadata-instance.js +59 -0
- package/dist/chunks/shared-field-styles.module.js +5 -7
- package/dist/chunks/taxonomy-ancestor-status-pill.js +88 -109
- package/dist/chunks/types.js +8 -12
- package/dist/chunks/update-mode-field-wrapper.js +80 -0
- package/dist/chunks/utils.js +57 -54
- package/dist/chunks/utils2.js +50 -70
- package/dist/esm/index.js +27 -52
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +31 -43
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +1 -3
- package/dist/esm/lib/components/add-metadata-template-dropdown/messages.js +15 -17
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +2 -205
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +2 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +31 -33
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +4 -6
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +113 -128
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +8 -10
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +32 -34
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +72 -82
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-content.js +13 -18
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +16 -19
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-item.js +12 -17
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +15 -20
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-root.js +13 -18
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +36 -44
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-trigger.js +7 -12
- package/dist/esm/lib/components/filter-dropdown-menu/index.js +16 -18
- package/dist/esm/lib/components/filter-dropdown-menu/messages.js +10 -12
- package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +2 -93
- package/dist/esm/lib/components/filter-instances-dropdown/index.js +2 -4
- package/dist/esm/lib/components/filter-instances-dropdown/messages.js +18 -20
- package/dist/esm/lib/components/interactive-header-text/interactive-header-text.js +2 -28
- package/dist/esm/lib/components/interactive-text/interactive-text.js +2 -30
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +20 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +2 -110
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +50 -52
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +12 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/constants.js +2 -6
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +20 -24
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +66 -75
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/messages.js +30 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +43 -60
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +47 -71
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +32 -54
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +8 -14
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +40 -62
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +28 -44
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +66 -95
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js +30 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js +7 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +2 -92
- package/dist/esm/lib/components/metadata-editor-fields/editor-field-types.js +30 -34
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-memoized-field-label.js +11 -7
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +35 -40
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-view-reference-tooltip.js +39 -34
- package/dist/esm/lib/components/metadata-editor-fields/messages.js +5 -9
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +186 -176
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +30 -42
- package/dist/esm/lib/components/metadata-editor-fields/utils.js +2 -13
- package/dist/esm/lib/components/metadata-empty-state/messages.js +42 -44
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +46 -62
- package/dist/esm/lib/components/metadata-instance-editor/index.js +7 -14
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +2 -64
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js +39 -41
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js +21 -26
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +2 -86
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js +15 -17
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js +2 -62
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js +42 -44
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js +2 -91
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js +50 -52
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/constants.js +2 -7
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/messages.js +0 -1
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +2 -10
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +126 -155
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +2 -9
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +23 -25
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +2 -128
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/messages.js +19 -21
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +2 -53
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +6 -10
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +2 -58
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/messages.js +18 -20
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +30 -37
- package/dist/esm/lib/components/metadata-instance-list/index.js +4 -8
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +2 -35
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +2 -79
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.js +2 -40
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js +5 -9
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +14 -24
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +2 -112
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js +22 -24
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-ancestor-status-pill.js +2 -11
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +24 -36
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/messages.js +10 -12
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/metadata-instance-footer.js +2 -31
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +15 -17
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +2 -63
- package/dist/esm/lib/components/metadata-instance-review-notice/messages.js +30 -32
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +22 -32
- package/dist/esm/lib/components/unsaved-changes-modal/index.js +2 -4
- package/dist/esm/lib/components/unsaved-changes-modal/messages.js +23 -25
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +41 -57
- package/dist/esm/lib/components/unsaved-changes-modal/utils.js +3 -5
- package/dist/esm/lib/constants.js +14 -18
- package/dist/esm/lib/defaults.js +14 -17
- package/dist/esm/lib/mappers.js +22 -28
- package/dist/esm/lib/messages.js +123 -126
- package/dist/esm/lib/metadata-editor.js +2 -14
- package/dist/esm/lib/utils/api-wrapper.js +12 -18
- package/dist/esm/lib/utils/autofill-context.js +65 -67
- package/dist/esm/lib/utils/check-if-has-bounding-boxes.js +2 -4
- package/dist/esm/lib/utils/confidence-score/format-confidence-score-percent.js +3 -5
- package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +12 -19
- package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +5 -7
- package/dist/esm/lib/utils/confidence-score/index.js +5 -10
- package/dist/esm/lib/utils/confidence-score/is-confidence-score-needing-review.js +4 -6
- package/dist/esm/lib/utils/confidence-score/messages.js +14 -16
- package/dist/esm/lib/utils/convertDate.js +20 -31
- package/dist/esm/lib/utils/is-interactive-form-element.js +2 -4
- package/dist/esm/lib/utils/utils.js +4 -9
- package/dist/styles/autofill-overlay.css +1 -1
- package/dist/styles/combobox-with-api-pagination.css +1 -1
- package/dist/styles/custom-instance-new-field.css +1 -1
- package/dist/styles/custom-instance.css +1 -1
- package/dist/styles/delete-confirmation-modal.css +1 -1
- package/dist/styles/field-action-bar.css +1 -1
- package/dist/styles/filter-dropdown-menu.css +1 -1
- package/dist/styles/filter-instances-dropdown.css +1 -1
- package/dist/styles/interactive-header-text.css +1 -1
- package/dist/styles/interactive-text.css +1 -1
- package/dist/styles/metadata-editor.css +1 -0
- package/dist/styles/metadata-instance-content.css +1 -1
- package/dist/styles/metadata-instance-entry.css +1 -1
- package/dist/styles/metadata-instance-footer.css +1 -1
- package/dist/styles/metadata-instance-form-autofill-button.css +1 -1
- package/dist/styles/metadata-instance-form-card-wrapper.css +1 -1
- package/dist/styles/metadata-instance-form-footer.css +1 -1
- package/dist/styles/metadata-instance-form-header.css +1 -1
- package/dist/styles/metadata-instance-header.css +1 -1
- package/dist/styles/metadata-instance-list.css +1 -1
- package/dist/styles/shared-field-styles.css +1 -1
- package/dist/styles/taxonomy-ancestor-status-pill.css +1 -1
- package/dist/styles/update-mode-field-wrapper.css +1 -1
- package/dist/styles/utils.css +1 -1
- package/dist/types/lib/test-utils/index.d.ts +1 -0
- package/dist/types/lib/test-utils/pending-promise.d.ts +19 -0
- package/package.json +10 -10
package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js
CHANGED
|
@@ -1,45 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plus as T } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
-
import { Space2 as w } from "@box/blueprint-web-assets/tokens/px-tokens";
|
|
4
|
-
import { useState as y, useMemo as B } from "react";
|
|
5
|
-
import { useIntl as I } from "react-intl";
|
|
6
|
-
import { getTemplateDisplayName as d } from "../../utils/utils.js";
|
|
1
|
+
import { getTemplateDisplayName as e } from "../../utils/utils.js";
|
|
7
2
|
import { FilterDropdownMenu as t } from "../filter-dropdown-menu/index.js";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
value: d(e, m)
|
|
38
|
-
}, e.id))
|
|
39
|
-
})]
|
|
40
|
-
})]
|
|
41
|
-
});
|
|
3
|
+
import n from "./messages.js";
|
|
4
|
+
import { IconButton as r } from "@box/blueprint-web";
|
|
5
|
+
import { Plus as i } from "@box/blueprint-web-assets/icons/Fill";
|
|
6
|
+
import { Space2 as a } from "@box/blueprint-web-assets/tokens/px-tokens";
|
|
7
|
+
import { useMemo as o, useState as s } from "react";
|
|
8
|
+
import { useIntl as c } from "react-intl";
|
|
9
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
var d = parseInt(a, 10);
|
|
11
|
+
function f({ availableTemplates: a, onSelect: f, selectedTemplates: p }) {
|
|
12
|
+
let m = c(), h = m.formatMessage(n.customMetadataName), [g, _] = s(""), v = o(() => a.filter((t) => e(t, h).toLowerCase().includes(g.toLowerCase())), [a, g]), y = g.length > 0 && v.length === 0, b = (e) => p.some((t) => t.scope === e.scope && t.templateKey === e.templateKey), x = (e) => {
|
|
13
|
+
f(e);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ u(t.Root, {
|
|
16
|
+
resetValueOnHide: !0,
|
|
17
|
+
setValue: _,
|
|
18
|
+
children: [/* @__PURE__ */ l(t.Trigger, { triggerButton: /* @__PURE__ */ l(r, {
|
|
19
|
+
"aria-label": m.formatMessage(n.addMetadataTemplatesTriggerButtonLabel),
|
|
20
|
+
icon: i,
|
|
21
|
+
size: "x-small",
|
|
22
|
+
"data-target-id": "IconButton-addMetadataTemplatesTriggerButtonLabel"
|
|
23
|
+
}) }), /* @__PURE__ */ u(t.Content, {
|
|
24
|
+
gutter: d,
|
|
25
|
+
children: [/* @__PURE__ */ l(t.Search, { placeholder: m.formatMessage(n.addMetadataTemplatesSearchPlaceholder) }), /* @__PURE__ */ l(t.List, { children: y ? /* @__PURE__ */ l(t.EmptyState, {}) : v.map((n) => /* @__PURE__ */ l(t.Item, {
|
|
26
|
+
disabled: b(n),
|
|
27
|
+
onClick: () => x(n),
|
|
28
|
+
value: e(n, h)
|
|
29
|
+
}, n.id)) })]
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
42
32
|
}
|
|
43
|
-
export {
|
|
44
|
-
P as AddMetadataTemplateDropdown
|
|
45
|
-
};
|
|
33
|
+
export { f as AddMetadataTemplateDropdown };
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { defineMessages as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
customMetadataName: {
|
|
4
|
+
id: "metadataEditor.addMetadataTemplate.customMetadataName",
|
|
5
|
+
defaultMessage: "Custom Metadata"
|
|
6
|
+
},
|
|
7
|
+
addMetadataTemplatesSearchPlaceholder: {
|
|
8
|
+
id: "metadataEditor.addMetadataTemplate.search.placeholder",
|
|
9
|
+
defaultMessage: "Search templates"
|
|
10
|
+
},
|
|
11
|
+
addMetadataTemplatesTriggerButtonLabel: {
|
|
12
|
+
id: "metadataEditor.addMetadataTemplate.trigger.label",
|
|
13
|
+
defaultMessage: "Add template"
|
|
14
|
+
}
|
|
15
15
|
});
|
|
16
|
-
export {
|
|
17
|
-
t as default
|
|
18
|
-
};
|
|
16
|
+
export { t as default };
|
package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js
CHANGED
|
@@ -1,205 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Search as ae, Loader as le } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
-
import { Size6 as M, Size1 as ce, IconIconOnLightSecondary as ue } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import V from "clsx";
|
|
6
|
-
import { forwardRef as k, useRef as C, useCallback as de, useMemo as R, useEffect as pe } from "react";
|
|
7
|
-
import { useIntl as F, FormattedMessage as T } from "react-intl";
|
|
8
|
-
import i from "./messages.js";
|
|
9
|
-
import { useAsyncList as me } from "./use-async-list.js";
|
|
10
|
-
import { useControllableState as he } from "./utils/use-controllable-state.js";
|
|
11
|
-
import { useTrackVisibility as fe } from "./utils/use-intersection-observer.js";
|
|
12
|
-
import { jsx as r, jsxs as S, Fragment as ge } from "react/jsx-runtime";
|
|
13
|
-
import '../../../../styles/combobox-with-api-pagination.css';const be = "_disabled_19k3s_8", xe = "_highlightOptionText_19k3s_12", Oe = "_selected_19k3s_24", _e = "_option_19k3s_35", Ce = "_errorComboboxOption_19k3s_39", Re = "_errorComboboxOptionText_19k3s_44", s = {
|
|
14
|
-
disabled: be,
|
|
15
|
-
highlightOptionText: xe,
|
|
16
|
-
selected: Oe,
|
|
17
|
-
option: _e,
|
|
18
|
-
errorComboboxOption: Ce,
|
|
19
|
-
errorComboboxOptionText: Re
|
|
20
|
-
}, N = /* @__PURE__ */ k(({
|
|
21
|
-
onTryAgain: y
|
|
22
|
-
}, p) => {
|
|
23
|
-
const {
|
|
24
|
-
formatMessage: m
|
|
25
|
-
} = F();
|
|
26
|
-
return /* @__PURE__ */ S(ge, {
|
|
27
|
-
children: [/* @__PURE__ */ r(ie, {
|
|
28
|
-
variant: "error",
|
|
29
|
-
variantIconAriaLabel: m(i.loadingResultsErrorIconLabel),
|
|
30
|
-
children: /* @__PURE__ */ r(T, {
|
|
31
|
-
...i.loadingResultsErrorMessage
|
|
32
|
-
})
|
|
33
|
-
}), /* @__PURE__ */ r(d.Option, {
|
|
34
|
-
ref: p,
|
|
35
|
-
className: s.errorComboboxOption,
|
|
36
|
-
onClick: y,
|
|
37
|
-
children: /* @__PURE__ */ S(se, {
|
|
38
|
-
as: "span",
|
|
39
|
-
className: s.errorComboboxOptionText,
|
|
40
|
-
color: "textOnLightLink",
|
|
41
|
-
variant: "bodyDefaultBold",
|
|
42
|
-
children: [/* @__PURE__ */ r(T, {
|
|
43
|
-
...i.loadingResultsErrorAction
|
|
44
|
-
}), /* @__PURE__ */ r(le, {
|
|
45
|
-
color: "currentColor",
|
|
46
|
-
height: "12px",
|
|
47
|
-
width: "12px"
|
|
48
|
-
})]
|
|
49
|
-
})
|
|
50
|
-
})]
|
|
51
|
-
});
|
|
52
|
-
}), A = "__LOADING__", L = "__LOADING_ERROR__", Ae = "0px 0px 20px 0px", Le = /* @__PURE__ */ r(ae, {
|
|
53
|
-
color: ue,
|
|
54
|
-
height: M,
|
|
55
|
-
role: "presentation",
|
|
56
|
-
style: {
|
|
57
|
-
padding: ce,
|
|
58
|
-
boxSizing: "border-box"
|
|
59
|
-
},
|
|
60
|
-
width: M
|
|
61
|
-
}), De = /* @__PURE__ */ k(function(p, m) {
|
|
62
|
-
const {
|
|
63
|
-
defaultFetcher: P,
|
|
64
|
-
onInputValueChange: D,
|
|
65
|
-
value: w,
|
|
66
|
-
onValueChange: B,
|
|
67
|
-
noResultMessage: W,
|
|
68
|
-
defaultValue: z = [],
|
|
69
|
-
loadingAriaLabel: G,
|
|
70
|
-
multiselect: a = !1,
|
|
71
|
-
disabled: j,
|
|
72
|
-
className: U,
|
|
73
|
-
displaySingleSelectionAsChip: E = !0,
|
|
74
|
-
...q
|
|
75
|
-
} = p, {
|
|
76
|
-
formatMessage: c
|
|
77
|
-
} = F(), h = C(null), f = C(!0), e = me({
|
|
78
|
-
async load({
|
|
79
|
-
marker: o,
|
|
80
|
-
searchInput: t,
|
|
81
|
-
signal: O
|
|
82
|
-
}) {
|
|
83
|
-
const l = await P({
|
|
84
|
-
signal: O,
|
|
85
|
-
marker: o,
|
|
86
|
-
searchInput: t
|
|
87
|
-
});
|
|
88
|
-
return {
|
|
89
|
-
items: l.options,
|
|
90
|
-
marker: l.marker
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}), v = C(!1), H = de(() => {
|
|
94
|
-
v.current || (e.reload(), v.current = !0);
|
|
95
|
-
}, []), [n, g] = he({
|
|
96
|
-
prop: w,
|
|
97
|
-
defaultProp: z,
|
|
98
|
-
onChange: B
|
|
99
|
-
}), b = !a && n.length === 1, J = (o) => {
|
|
100
|
-
o === void 0 ? (g([]), (!f.current || !E) && (e.search(""), f.current = !0)) : Array.isArray(o) ? g(o) : g([o]);
|
|
101
|
-
}, K = R(() => n.length === 0 ? a ? [] : void 0 : a ? n : n[0], [a, n]), x = R(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), Q = (o) => {
|
|
102
|
-
const {
|
|
103
|
-
value: t,
|
|
104
|
-
displayValue: O,
|
|
105
|
-
...l
|
|
106
|
-
} = o;
|
|
107
|
-
if (t === A)
|
|
108
|
-
return e.hasNextPage ? /* @__PURE__ */ r(d.Option, {
|
|
109
|
-
...l,
|
|
110
|
-
ref: Z,
|
|
111
|
-
disabled: !0,
|
|
112
|
-
value: t,
|
|
113
|
-
children: /* @__PURE__ */ r(ne, {
|
|
114
|
-
"aria-label": c(i.loadingMoreAriaLabel),
|
|
115
|
-
style: {
|
|
116
|
-
position: "unset"
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
}) : null;
|
|
120
|
-
if (t === L && e.hasError && !e.isEmpty)
|
|
121
|
-
return /* @__PURE__ */ r(N, {
|
|
122
|
-
onTryAgain: () => {
|
|
123
|
-
e.loadMore(), h.current?.focus();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
if (x.some((_) => _.value === t))
|
|
127
|
-
return null;
|
|
128
|
-
const oe = n.some((_) => _.value === t);
|
|
129
|
-
return /* @__PURE__ */ r(d.Option, {
|
|
130
|
-
...l,
|
|
131
|
-
className: s.option,
|
|
132
|
-
value: t,
|
|
133
|
-
children: /* @__PURE__ */ r(te, {
|
|
134
|
-
className: V(s.highlightOptionText, oe && s.selected),
|
|
135
|
-
value: O || t
|
|
136
|
-
})
|
|
137
|
-
});
|
|
138
|
-
}, X = (o) => {
|
|
139
|
-
if (D?.(o), b && o === "") {
|
|
140
|
-
f.current = !1;
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
e.search(o);
|
|
144
|
-
}, Y = () => {
|
|
145
|
-
e.reload(), h.current?.focus();
|
|
146
|
-
};
|
|
147
|
-
let u;
|
|
148
|
-
e.hasError && !e.isLoading ? u = /* @__PURE__ */ r(N, {
|
|
149
|
-
onTryAgain: Y
|
|
150
|
-
}) : e.isEmpty && !e.isLoading ? u = W || c(i.noResults) : u = void 0;
|
|
151
|
-
const [Z, {
|
|
152
|
-
rootRef: $,
|
|
153
|
-
isVisible: I
|
|
154
|
-
}] = fe({
|
|
155
|
-
rootMargin: Ae
|
|
156
|
-
});
|
|
157
|
-
pe(() => {
|
|
158
|
-
if (!(I && e.hasNextPage))
|
|
159
|
-
return;
|
|
160
|
-
const t = setTimeout(() => {
|
|
161
|
-
e.loadMore();
|
|
162
|
-
}, 100);
|
|
163
|
-
return () => {
|
|
164
|
-
clearTimeout(t);
|
|
165
|
-
};
|
|
166
|
-
}, [I]);
|
|
167
|
-
const ee = R(() => {
|
|
168
|
-
const o = e.hasNextPage ? {
|
|
169
|
-
displayValue: A,
|
|
170
|
-
value: A
|
|
171
|
-
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
172
|
-
displayValue: L,
|
|
173
|
-
value: L
|
|
174
|
-
} : null;
|
|
175
|
-
return [...e.items, ...x, o, t].filter(Boolean);
|
|
176
|
-
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items, x]);
|
|
177
|
-
return /* @__PURE__ */ r(d, {
|
|
178
|
-
as: "input",
|
|
179
|
-
...q,
|
|
180
|
-
ref: re(h, m),
|
|
181
|
-
className: V({
|
|
182
|
-
[s.disabled]: b
|
|
183
|
-
}, U),
|
|
184
|
-
clearButtonAriaLabel: c(i.clearButtonAriaLabel),
|
|
185
|
-
disabled: j || b,
|
|
186
|
-
displaySingleSelectionAsChip: E,
|
|
187
|
-
displayValue: (o) => o.displayValue || o.value,
|
|
188
|
-
endComboboxIcon: Le,
|
|
189
|
-
focusLoop: !1,
|
|
190
|
-
getPopoverRef: $,
|
|
191
|
-
loading: e.isReloading,
|
|
192
|
-
loadingAriaLabel: G || c(i.loadingAriaLabel),
|
|
193
|
-
multiselect: a,
|
|
194
|
-
noResultMessage: u,
|
|
195
|
-
onFocus: H,
|
|
196
|
-
onInputValueChange: X,
|
|
197
|
-
onValueChange: J,
|
|
198
|
-
options: ee,
|
|
199
|
-
renderOption: Q,
|
|
200
|
-
value: K
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
export {
|
|
204
|
-
De as ComboboxWithApiPagination
|
|
205
|
-
};
|
|
1
|
+
import { t as e } from "../../../../chunks/combobox-with-api-pagination.js";
|
|
2
|
+
export { e as ComboboxWithApiPagination };
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import { defineMessages as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
loadingResultsErrorAction: {
|
|
4
|
+
id: "comboboxWithApiPagination.errorAction",
|
|
5
|
+
defaultMessage: "Reload"
|
|
6
|
+
},
|
|
7
|
+
loadingResultsErrorMessage: {
|
|
8
|
+
id: "comboboxWithApiPagination.errorMessage",
|
|
9
|
+
defaultMessage: "Failed to load options"
|
|
10
|
+
},
|
|
11
|
+
loadingResultsErrorIconLabel: {
|
|
12
|
+
id: "comboboxWithApiPagination.errorIconLabel",
|
|
13
|
+
defaultMessage: "Error"
|
|
14
|
+
},
|
|
15
|
+
loadingAriaLabel: {
|
|
16
|
+
id: "comboboxWithApiPagination.loadingAriaLabel",
|
|
17
|
+
defaultMessage: "Loading..."
|
|
18
|
+
},
|
|
19
|
+
loadingMoreAriaLabel: {
|
|
20
|
+
id: "comboboxWithApiPagination.loadingMoreAriaLabel",
|
|
21
|
+
defaultMessage: "Loading more..."
|
|
22
|
+
},
|
|
23
|
+
noResults: {
|
|
24
|
+
id: "comboboxWithApiPagination.noResults",
|
|
25
|
+
defaultMessage: "No results found"
|
|
26
|
+
},
|
|
27
|
+
clearButtonAriaLabel: {
|
|
28
|
+
id: "comboboxWithApiPagination.clearButtonAriaLabel",
|
|
29
|
+
defaultMessage: "Clear input and selection"
|
|
30
|
+
}
|
|
31
31
|
});
|
|
32
|
-
export {
|
|
33
|
-
e as default
|
|
34
|
-
};
|
|
32
|
+
export { t as default };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export {
|
|
5
|
-
C as RequestStates
|
|
6
|
-
};
|
|
1
|
+
var e = /* @__PURE__ */ function(e) {
|
|
2
|
+
return e.NOT_STARTED = "NOT_STARTED", e.IN_PROGRESS = "IN_PROGRESS", e.ERROR = "ERROR", e.SUCCESS = "SUCCESS", e.CANCELLED = "CANCELLED", e;
|
|
3
|
+
}({});
|
|
4
|
+
export { e as RequestStates };
|