@box/metadata-template-editor 1.19.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/LICENSE +379 -0
- package/README.md +57 -0
- package/dist/chunks/metadata-field-configurator.module.js +17 -0
- package/dist/chunks/types.js +34 -0
- package/dist/esm/index.js +34 -0
- package/dist/esm/lib/components/field-selector/field-selector.js +39 -0
- package/dist/esm/lib/components/field-selector/index.js +4 -0
- package/dist/esm/lib/components/field-selector/messages.js +14 -0
- package/dist/esm/lib/components/field-type-dropdown/field-type-dropdown.js +47 -0
- package/dist/esm/lib/components/field-type-dropdown/index.js +4 -0
- package/dist/esm/lib/components/field-type-dropdown/messages.js +14 -0
- package/dist/esm/lib/components/field-type-tiles/field-type-tiles.js +40 -0
- package/dist/esm/lib/components/field-type-tiles/index.js +4 -0
- package/dist/esm/lib/components/field-type-tiles/messages.js +14 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/confirmation-modal.js +46 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/messages.js +18 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +80 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.js +115 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +101 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/chip.js +33 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/index.js +4 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.js +118 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/utils.js +34 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/__mocks__/getInitialValues.js +33 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-default-values.js +15 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-field-configuration.js +66 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/sortable-option-list.js +294 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/index.js +6 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-default-values.js +15 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configuration.js +149 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configurator-initial-state.js +54 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.js +38 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector.js +103 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/useTaxonomySelect.js +19 -0
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/utils.js +4 -0
- package/dist/esm/lib/components/metadata-field-configurator/context/field-configurator-context.js +68 -0
- package/dist/esm/lib/components/metadata-field-configurator/context/field-extensions-context.js +9 -0
- package/dist/esm/lib/components/metadata-field-configurator/context/taxonomy-options-context.js +23 -0
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.js +119 -0
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldValidation.js +68 -0
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useTaxonomyFetch.js +27 -0
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useTemplateFieldSchema.js +44 -0
- package/dist/esm/lib/components/metadata-field-configurator/index.js +11 -0
- package/dist/esm/lib/components/metadata-field-configurator/messages/configurator-messages.js +136 -0
- package/dist/esm/lib/components/metadata-field-configurator/messages/dropdown-messages.js +38 -0
- package/dist/esm/lib/components/metadata-field-configurator/messages/levels-chain-messages.js +18 -0
- package/dist/esm/lib/components/metadata-field-configurator/messages/taxonomy-messages.js +38 -0
- package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +154 -0
- package/dist/esm/lib/components/metadata-field-configurator/utils.js +53 -0
- package/dist/esm/lib/components/metadata-field-list/index.js +5 -0
- package/dist/esm/lib/components/metadata-field-list/metadata-field-list.js +279 -0
- package/dist/esm/lib/components/metadata-template-editor-form/metadata-template-editor-form.js +137 -0
- package/dist/esm/lib/components/metadata-template-editor-modal/index.js +4 -0
- package/dist/esm/lib/components/metadata-template-editor-modal/metadata-template-editor-modal.js +103 -0
- package/dist/esm/lib/hooks/useMetadataTemplateFormSchema.js +16 -0
- package/dist/esm/lib/hooks/useTemplateNameSchema.js +12 -0
- package/dist/esm/lib/index.js +14 -0
- package/dist/esm/lib/messages.js +118 -0
- package/dist/esm/lib/metadata-template-editor.js +179 -0
- package/dist/esm/lib/utils/constants.js +8 -0
- package/dist/esm/lib/utils/field-options/field-type-icon.js +34 -0
- package/dist/esm/lib/utils/field-options/index.js +9 -0
- package/dist/esm/lib/utils/field-options/messages.js +48 -0
- package/dist/esm/lib/utils/field-options/useFieldOptions.js +19 -0
- package/dist/esm/lib/utils/key-generation.js +29 -0
- package/dist/esm/lib/utils/template-type-conversion/convertLocalConfiguratorToTemplateField.js +78 -0
- package/dist/esm/lib/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.js +90 -0
- package/dist/esm/lib/utils/template-type-conversion/generateJSONPatchTemplateOperations.js +179 -0
- package/dist/esm/lib/utils/template-type-conversion/mapFieldsWithUniqueKeys.js +14 -0
- package/dist/i18n/bn-IN.js +108 -0
- package/dist/i18n/bn-IN.properties +196 -0
- package/dist/i18n/da-DK.js +108 -0
- package/dist/i18n/da-DK.properties +196 -0
- package/dist/i18n/de-DE.js +108 -0
- package/dist/i18n/de-DE.properties +196 -0
- package/dist/i18n/en-AU.js +108 -0
- package/dist/i18n/en-AU.properties +196 -0
- package/dist/i18n/en-CA.js +108 -0
- package/dist/i18n/en-CA.properties +196 -0
- package/dist/i18n/en-GB.js +108 -0
- package/dist/i18n/en-GB.properties +196 -0
- package/dist/i18n/en-US.js +108 -0
- package/dist/i18n/en-US.properties +212 -0
- package/dist/i18n/en-x-pseudo.js +108 -0
- package/dist/i18n/en-x-pseudo.properties +196 -0
- package/dist/i18n/es-419.js +108 -0
- package/dist/i18n/es-419.properties +196 -0
- package/dist/i18n/es-ES.js +108 -0
- package/dist/i18n/es-ES.properties +196 -0
- package/dist/i18n/fi-FI.js +108 -0
- package/dist/i18n/fi-FI.properties +196 -0
- package/dist/i18n/fr-CA.js +108 -0
- package/dist/i18n/fr-CA.properties +196 -0
- package/dist/i18n/fr-FR.js +108 -0
- package/dist/i18n/fr-FR.properties +196 -0
- package/dist/i18n/hi-IN.js +108 -0
- package/dist/i18n/hi-IN.properties +196 -0
- package/dist/i18n/it-IT.js +108 -0
- package/dist/i18n/it-IT.properties +196 -0
- package/dist/i18n/ja-JP.js +108 -0
- package/dist/i18n/ja-JP.properties +196 -0
- package/dist/i18n/json/src/lib/components/field-selector/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/field-type-dropdown/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/field-type-tiles/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/metadata-field-configurator/components/confirmation-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.json +1 -0
- package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/configurator-messages.json +1 -0
- package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/dropdown-messages.json +1 -0
- package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/levels-chain-messages.json +1 -0
- package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/taxonomy-messages.json +1 -0
- package/dist/i18n/json/src/lib/messages.json +1 -0
- package/dist/i18n/json/src/lib/utils/field-options/messages.json +1 -0
- package/dist/i18n/ko-KR.js +108 -0
- package/dist/i18n/ko-KR.properties +196 -0
- package/dist/i18n/nb-NO.js +108 -0
- package/dist/i18n/nb-NO.properties +196 -0
- package/dist/i18n/nl-NL.js +108 -0
- package/dist/i18n/nl-NL.properties +196 -0
- package/dist/i18n/pl-PL.js +108 -0
- package/dist/i18n/pl-PL.properties +196 -0
- package/dist/i18n/pt-BR.js +108 -0
- package/dist/i18n/pt-BR.properties +196 -0
- package/dist/i18n/ru-RU.js +108 -0
- package/dist/i18n/ru-RU.properties +196 -0
- package/dist/i18n/sv-SE.js +108 -0
- package/dist/i18n/sv-SE.properties +196 -0
- package/dist/i18n/tr-TR.js +108 -0
- package/dist/i18n/tr-TR.properties +196 -0
- package/dist/i18n/zh-CN.js +108 -0
- package/dist/i18n/zh-CN.properties +196 -0
- package/dist/i18n/zh-TW.js +108 -0
- package/dist/i18n/zh-TW.properties +196 -0
- package/dist/styles/chip.css +1 -0
- package/dist/styles/dropdown-field-configuration.css +1 -0
- package/dist/styles/field-context-menu.css +1 -0
- package/dist/styles/field-selector.css +1 -0
- package/dist/styles/field-type-dropdown.css +1 -0
- package/dist/styles/levels-chain.css +1 -0
- package/dist/styles/metadata-field-configurator.css +1 -0
- package/dist/styles/metadata-field-list.css +1 -0
- package/dist/styles/metadata-template-editor-form.css +1 -0
- package/dist/styles/metadata-template-editor-modal.css +1 -0
- package/dist/styles/metadata-template-editor.css +1 -0
- package/dist/styles/sortable-option-list.css +1 -0
- package/dist/styles/taxonomy-field-configuration.css +1 -0
- package/dist/styles/taxonomy-field-configurator-initial-state.css +1 -0
- package/dist/styles/taxonomy-selector.css +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/lib/components/field-selector/field-selector.d.ts +16 -0
- package/dist/types/lib/components/field-selector/index.d.ts +1 -0
- package/dist/types/lib/components/field-selector/messages.d.ts +13 -0
- package/dist/types/lib/components/field-type-dropdown/field-type-dropdown.d.ts +15 -0
- package/dist/types/lib/components/field-type-dropdown/index.d.ts +2 -0
- package/dist/types/lib/components/field-type-dropdown/messages.d.ts +12 -0
- package/dist/types/lib/components/field-type-tiles/field-type-tiles.d.ts +12 -0
- package/dist/types/lib/components/field-type-tiles/index.d.ts +2 -0
- package/dist/types/lib/components/field-type-tiles/messages.d.ts +12 -0
- package/dist/types/lib/components/metadata-field-configurator/components/confirmation-modal/confirmation-modal.d.ts +31 -0
- package/dist/types/lib/components/metadata-field-configurator/components/confirmation-modal/messages.d.ts +18 -0
- package/dist/types/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.d.ts +30 -0
- package/dist/types/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.d.ts +23 -0
- package/dist/types/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.d.ts +20 -0
- package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/chip.d.ts +17 -0
- package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/index.d.ts +1 -0
- package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.d.ts +31 -0
- package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/utils.d.ts +10 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/__mocks__/getInitialValues.d.ts +2 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-default-values.d.ts +2 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-field-configuration.d.ts +1 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/sortable-option-list.d.ts +6 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/index.d.ts +2 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-default-values.d.ts +2 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configuration.d.ts +1 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configurator-initial-state.d.ts +1 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.d.ts +43 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector.d.ts +12 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/useTaxonomySelect.d.ts +5 -0
- package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/utils.d.ts +2 -0
- package/dist/types/lib/components/metadata-field-configurator/context/field-configurator-context.d.ts +57 -0
- package/dist/types/lib/components/metadata-field-configurator/context/field-extensions-context.d.ts +52 -0
- package/dist/types/lib/components/metadata-field-configurator/context/taxonomy-options-context.d.ts +21 -0
- package/dist/types/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.d.ts +57 -0
- package/dist/types/lib/components/metadata-field-configurator/hooks/useFieldValidation.d.ts +27 -0
- package/dist/types/lib/components/metadata-field-configurator/hooks/useTaxonomyFetch.d.ts +19 -0
- package/dist/types/lib/components/metadata-field-configurator/hooks/useTemplateFieldSchema.d.ts +15 -0
- package/dist/types/lib/components/metadata-field-configurator/index.d.ts +6 -0
- package/dist/types/lib/components/metadata-field-configurator/messages/configurator-messages.d.ts +164 -0
- package/dist/types/lib/components/metadata-field-configurator/messages/dropdown-messages.d.ts +43 -0
- package/dist/types/lib/components/metadata-field-configurator/messages/levels-chain-messages.d.ts +18 -0
- package/dist/types/lib/components/metadata-field-configurator/messages/taxonomy-messages.d.ts +43 -0
- package/dist/types/lib/components/metadata-field-configurator/metadata-field-configurator.d.ts +191 -0
- package/dist/types/lib/components/metadata-field-configurator/stories/story-fixtures.d.ts +5 -0
- package/dist/types/lib/components/metadata-field-configurator/utils.d.ts +24 -0
- package/dist/types/lib/components/metadata-field-list/index.d.ts +2 -0
- package/dist/types/lib/components/metadata-field-list/metadata-field-list.d.ts +109 -0
- package/dist/types/lib/components/metadata-template-editor-form/metadata-template-editor-form.d.ts +20 -0
- package/dist/types/lib/components/metadata-template-editor-modal/index.d.ts +1 -0
- package/dist/types/lib/components/metadata-template-editor-modal/metadata-template-editor-modal.d.ts +56 -0
- package/dist/types/lib/hooks/useMetadataTemplateFormSchema.d.ts +17 -0
- package/dist/types/lib/hooks/useTemplateNameSchema.d.ts +2 -0
- package/dist/types/lib/index.d.ts +7 -0
- package/dist/types/lib/messages.d.ts +143 -0
- package/dist/types/lib/metadata-template-editor.d.ts +290 -0
- package/dist/types/lib/types.d.ts +311 -0
- package/dist/types/lib/utils/constants.d.ts +9 -0
- package/dist/types/lib/utils/field-options/field-type-icon.d.ts +6 -0
- package/dist/types/lib/utils/field-options/index.d.ts +4 -0
- package/dist/types/lib/utils/field-options/messages.d.ts +60 -0
- package/dist/types/lib/utils/field-options/useFieldOptions.d.ts +34 -0
- package/dist/types/lib/utils/key-generation.d.ts +24 -0
- package/dist/types/lib/utils/template-type-conversion/convertLocalConfiguratorToTemplateField.d.ts +25 -0
- package/dist/types/lib/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.d.ts +8 -0
- package/dist/types/lib/utils/template-type-conversion/generateJSONPatchTemplateOperations.d.ts +16 -0
- package/dist/types/lib/utils/template-type-conversion/mapFieldsWithUniqueKeys.d.ts +8 -0
- package/package.json +61 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { InlineNotice as g, TextButton as v, Switch as S } from "@box/blueprint-web";
|
|
2
|
+
import k from "lodash/uniqueId";
|
|
3
|
+
import { useState as L, useCallback as l, useEffect as _ } from "react";
|
|
4
|
+
import { useIntl as b } from "react-intl";
|
|
5
|
+
import { useFieldConfigurator as y } from "../../../context/field-configurator-context.js";
|
|
6
|
+
import d from "../../../messages/dropdown-messages.js";
|
|
7
|
+
import { SortableOptionList as B } from "./sortable-option-list.js";
|
|
8
|
+
import { jsxs as E, jsx as i } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../../../../styles/dropdown-field-configuration.css';const I = "_dropdownFieldConfiguration_rjv8w_1", N = "_addOptionButton_rjv8w_7", p = {
|
|
10
|
+
dropdownFieldConfiguration: I,
|
|
11
|
+
addOptionButton: N
|
|
12
|
+
}, R = () => {
|
|
13
|
+
const {
|
|
14
|
+
formatMessage: t
|
|
15
|
+
} = b(), {
|
|
16
|
+
values: o,
|
|
17
|
+
errors: u,
|
|
18
|
+
touched: c,
|
|
19
|
+
setFieldValue: r
|
|
20
|
+
} = y(), [w, a] = L(!1), s = o.dropdown.options.length > 0, m = u.dropdown, f = c.dropdown, h = m?.options?.some((n, C) => n?.key && f?.options?.[C]), e = l((n = !1) => {
|
|
21
|
+
r("dropdown", {
|
|
22
|
+
...o.dropdown,
|
|
23
|
+
options: [...o.dropdown.options, {
|
|
24
|
+
id: k(),
|
|
25
|
+
key: "",
|
|
26
|
+
isNew: !0
|
|
27
|
+
}]
|
|
28
|
+
}), a(n);
|
|
29
|
+
}, [o.dropdown, r]), F = l(() => {
|
|
30
|
+
e(!0);
|
|
31
|
+
}, [e]);
|
|
32
|
+
_(() => {
|
|
33
|
+
s || e(!1);
|
|
34
|
+
}, [s, e]);
|
|
35
|
+
const O = l(() => {
|
|
36
|
+
a(!1);
|
|
37
|
+
}, []);
|
|
38
|
+
return /* @__PURE__ */ E("div", {
|
|
39
|
+
className: p.dropdownFieldConfiguration,
|
|
40
|
+
children: [h && /* @__PURE__ */ i(g, {
|
|
41
|
+
variant: "error",
|
|
42
|
+
variantIconAriaLabel: t(d.optionListValidationError),
|
|
43
|
+
children: t(d.optionListValidationError)
|
|
44
|
+
}), s && /* @__PURE__ */ i(B, {
|
|
45
|
+
shouldFocusLastOption: w,
|
|
46
|
+
onFocusConsumed: O
|
|
47
|
+
}), /* @__PURE__ */ i(v, {
|
|
48
|
+
className: p.addOptionButton,
|
|
49
|
+
onClick: F,
|
|
50
|
+
children: t(d.addOption)
|
|
51
|
+
}), /* @__PURE__ */ i(S.Item, {
|
|
52
|
+
name: "dropdown.allowMultipleSelections",
|
|
53
|
+
checked: o.dropdown.allowMultipleSelections,
|
|
54
|
+
disabled: !o.isFieldNew || o.isFieldReadOnly,
|
|
55
|
+
label: t(d.allowMultipleSelection),
|
|
56
|
+
onCheckedChange: (n) => r("dropdown", {
|
|
57
|
+
...o.dropdown,
|
|
58
|
+
allowMultipleSelections: n
|
|
59
|
+
}),
|
|
60
|
+
value: "true"
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
R as DropdownFieldConfiguration
|
|
66
|
+
};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { TextInput as K, IconButton as $ } from "@box/blueprint-web";
|
|
2
|
+
import { DragDots as F } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { Trash as V } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import { useSensors as te, useSensor as B, PointerSensor as ne, TouchSensor as oe, KeyboardSensor as re, DndContext as ie, closestCenter as ae, DragOverlay as le } from "@dnd-kit/core";
|
|
5
|
+
import { sortableKeyboardCoordinates as de, SortableContext as se, verticalListSortingStrategy as ce, arrayMove as R, useSortable as ue } from "@dnd-kit/sortable";
|
|
6
|
+
import { CSS as pe } from "@dnd-kit/utilities";
|
|
7
|
+
import J from "clsx";
|
|
8
|
+
import me from "lodash/uniqueId";
|
|
9
|
+
import { useState as S, useRef as fe, useEffect as E, useCallback as G } from "react";
|
|
10
|
+
import { useIntl as ge } from "react-intl";
|
|
11
|
+
import { useFieldConfigurator as he } from "../../../context/field-configurator-context.js";
|
|
12
|
+
import v from "../../../messages/dropdown-messages.js";
|
|
13
|
+
import be from "../../confirmation-modal/confirmation-modal.js";
|
|
14
|
+
import { jsxs as L, Fragment as ye, jsx as o } from "react/jsx-runtime";
|
|
15
|
+
import '../../../../../../../styles/sortable-option-list.css';const Ce = "_sortableOptionList_1cieq_1", ve = "_option_1cieq_9", De = "_editable_1cieq_9", _e = "_dragging_1cieq_22", Oe = "_dragHandle_1cieq_26", we = "_input_1cieq_41", Ie = "_deleteButtonContainer_1cieq_52", Se = "_optionDragOverlay_1cieq_58", r = {
|
|
16
|
+
sortableOptionList: Ce,
|
|
17
|
+
option: ve,
|
|
18
|
+
editable: De,
|
|
19
|
+
dragging: _e,
|
|
20
|
+
dragHandle: Oe,
|
|
21
|
+
input: we,
|
|
22
|
+
deleteButtonContainer: Ie,
|
|
23
|
+
optionDragOverlay: Se
|
|
24
|
+
};
|
|
25
|
+
function Ne(a, u, t, s, D, l) {
|
|
26
|
+
const p = (
|
|
27
|
+
// Guard 1: was this option's field interacted with?
|
|
28
|
+
u?.dropdown?.options?.[t] && // Guard 2: errors is a non-null object (required for property access below)
|
|
29
|
+
typeof a == "object" && a !== null && // Guard 3: errors.dropdown is an object (i.e. there are dropdown-level errors)
|
|
30
|
+
typeof a.dropdown == "object" && // Finally: read the `key` validation error for this specific option, if present
|
|
31
|
+
a.dropdown?.options?.[t]?.key
|
|
32
|
+
);
|
|
33
|
+
if (typeof p != "string")
|
|
34
|
+
return "";
|
|
35
|
+
if (l !== null && s.id !== l) {
|
|
36
|
+
const h = D.find((b) => b.id === l)?.key;
|
|
37
|
+
if (
|
|
38
|
+
// Guard 1: lastChangedKey is non-null (i.e. the user has edited an option)
|
|
39
|
+
!!h && // Guard 2: the current option's key matches the last-edited option's key
|
|
40
|
+
s.key === h && // Guard 3: there is at least one other option in the group with the same key
|
|
41
|
+
D.some((b, _) => _ !== t && b.key === h)
|
|
42
|
+
)
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
return p;
|
|
46
|
+
}
|
|
47
|
+
function Te({
|
|
48
|
+
option: a,
|
|
49
|
+
index: u,
|
|
50
|
+
isFieldReadOnly: t,
|
|
51
|
+
onInputChange: s,
|
|
52
|
+
onDelete: D,
|
|
53
|
+
onInputRef: l,
|
|
54
|
+
error: p,
|
|
55
|
+
handleBlur: h,
|
|
56
|
+
canDelete: w,
|
|
57
|
+
dragAriaLabel: b,
|
|
58
|
+
inputPlaceholder: _,
|
|
59
|
+
deleteAriaLabel: I
|
|
60
|
+
}) {
|
|
61
|
+
const {
|
|
62
|
+
attributes: y,
|
|
63
|
+
listeners: n,
|
|
64
|
+
setNodeRef: O,
|
|
65
|
+
transform: N,
|
|
66
|
+
transition: T,
|
|
67
|
+
isDragging: m
|
|
68
|
+
} = ue({
|
|
69
|
+
id: a.id
|
|
70
|
+
}), k = {
|
|
71
|
+
transform: pe.Translate.toString(N),
|
|
72
|
+
transition: T
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ L("li", {
|
|
75
|
+
ref: O,
|
|
76
|
+
style: k,
|
|
77
|
+
className: J(r.option, {
|
|
78
|
+
[r.dragging]: m,
|
|
79
|
+
[r.editable]: !t
|
|
80
|
+
}),
|
|
81
|
+
children: [!t && /* @__PURE__ */ o("div", {
|
|
82
|
+
className: r.dragHandle,
|
|
83
|
+
...n,
|
|
84
|
+
...y,
|
|
85
|
+
"aria-label": b,
|
|
86
|
+
tabIndex: -1,
|
|
87
|
+
children: /* @__PURE__ */ o(F, {
|
|
88
|
+
fontSize: 20,
|
|
89
|
+
"aria-hidden": "true"
|
|
90
|
+
})
|
|
91
|
+
}), /* @__PURE__ */ o(K, {
|
|
92
|
+
disabled: t,
|
|
93
|
+
placeholder: _,
|
|
94
|
+
label: _,
|
|
95
|
+
hideLabel: !0,
|
|
96
|
+
onBlur: h,
|
|
97
|
+
id: `dropdown.options.${u}.key`,
|
|
98
|
+
name: `dropdown.options.${u}.key`,
|
|
99
|
+
value: a.key,
|
|
100
|
+
className: r.input,
|
|
101
|
+
onChange: (C) => s(C, a.id),
|
|
102
|
+
ref: (C) => l(C, u),
|
|
103
|
+
error: p
|
|
104
|
+
}), !t && /* @__PURE__ */ o("div", {
|
|
105
|
+
className: r.deleteButtonContainer,
|
|
106
|
+
children: /* @__PURE__ */ o($, {
|
|
107
|
+
onClick: () => D(a),
|
|
108
|
+
"aria-label": I,
|
|
109
|
+
icon: V,
|
|
110
|
+
size: "x-small",
|
|
111
|
+
variant: "default",
|
|
112
|
+
tabIndex: -1,
|
|
113
|
+
focusable: !0,
|
|
114
|
+
disabled: !w,
|
|
115
|
+
className: r.deleteButton
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function Ke({
|
|
121
|
+
shouldFocusLastOption: a = !1,
|
|
122
|
+
onFocusConsumed: u
|
|
123
|
+
}) {
|
|
124
|
+
const {
|
|
125
|
+
formatMessage: t
|
|
126
|
+
} = ge(), {
|
|
127
|
+
values: s,
|
|
128
|
+
errors: D,
|
|
129
|
+
touched: l,
|
|
130
|
+
setFieldValue: p,
|
|
131
|
+
setFieldTouched: h,
|
|
132
|
+
setTouched: w,
|
|
133
|
+
handleBlur: b
|
|
134
|
+
} = he(), _ = te(B(ne, {
|
|
135
|
+
activationConstraint: {
|
|
136
|
+
distance: 8
|
|
137
|
+
}
|
|
138
|
+
}), B(oe, {
|
|
139
|
+
activationConstraint: {
|
|
140
|
+
delay: 250,
|
|
141
|
+
tolerance: 5
|
|
142
|
+
}
|
|
143
|
+
}), B(re, {
|
|
144
|
+
coordinateGetter: de
|
|
145
|
+
})), {
|
|
146
|
+
options: I
|
|
147
|
+
} = s.dropdown, {
|
|
148
|
+
isFieldReadOnly: y
|
|
149
|
+
} = s, [n, O] = S(I), [N, T] = S(null), m = fe(null), [k, C] = S(null), [Q, q] = S(!1), [M, H] = S(null);
|
|
150
|
+
E(() => {
|
|
151
|
+
O(I);
|
|
152
|
+
}, [I]), E(() => () => {
|
|
153
|
+
m.current && clearTimeout(m.current);
|
|
154
|
+
}, []);
|
|
155
|
+
const x = G((e) => {
|
|
156
|
+
p("dropdown", {
|
|
157
|
+
...s.dropdown,
|
|
158
|
+
options: e
|
|
159
|
+
});
|
|
160
|
+
}, [s.dropdown, p]), U = (e, i) => {
|
|
161
|
+
T(i);
|
|
162
|
+
const c = n.map((d, f) => d.id === i ? (h(`dropdown.options.${f}.key`, !0), {
|
|
163
|
+
...d,
|
|
164
|
+
key: e.target.value
|
|
165
|
+
}) : d);
|
|
166
|
+
O(c), x(c);
|
|
167
|
+
}, j = () => {
|
|
168
|
+
H(null), q(!1);
|
|
169
|
+
}, z = (e) => {
|
|
170
|
+
if (!e)
|
|
171
|
+
return;
|
|
172
|
+
const i = n.filter((f) => f.id !== e);
|
|
173
|
+
O(i), x(i), e === N && T(null);
|
|
174
|
+
const c = {
|
|
175
|
+
...l
|
|
176
|
+
}, d = c.dropdown;
|
|
177
|
+
d?.options && (d.options = d.options.filter((f, g) => n[g]?.id !== e)), w(c), i.length === 0 && p("dropdown", {
|
|
178
|
+
...s.dropdown,
|
|
179
|
+
options: [{
|
|
180
|
+
id: me(),
|
|
181
|
+
key: "",
|
|
182
|
+
isNew: !0
|
|
183
|
+
}]
|
|
184
|
+
}), j();
|
|
185
|
+
}, W = (e) => {
|
|
186
|
+
e.isNew ? z(e.id) : (H(e), q(!0));
|
|
187
|
+
}, X = ({
|
|
188
|
+
active: e
|
|
189
|
+
}) => {
|
|
190
|
+
C(String(e.id));
|
|
191
|
+
}, Y = () => {
|
|
192
|
+
C(null);
|
|
193
|
+
}, Z = (e) => {
|
|
194
|
+
C(null);
|
|
195
|
+
const {
|
|
196
|
+
active: i,
|
|
197
|
+
over: c
|
|
198
|
+
} = e;
|
|
199
|
+
if (c && i.id !== c.id) {
|
|
200
|
+
const d = n.findIndex((g) => g.id === i.id), f = n.findIndex((g) => g.id === c.id);
|
|
201
|
+
if (d !== -1 && f !== -1) {
|
|
202
|
+
const g = R(n, d, f);
|
|
203
|
+
O(g), x(g);
|
|
204
|
+
const A = l?.dropdown?.options;
|
|
205
|
+
A && A.length > 0 && w({
|
|
206
|
+
...l,
|
|
207
|
+
dropdown: {
|
|
208
|
+
...l.dropdown ?? {},
|
|
209
|
+
options: R(A, d, f)
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}, ee = G((e, i) => {
|
|
215
|
+
e && a && i === n.length - 1 && (m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
216
|
+
e.focus(), u(), m.current = null;
|
|
217
|
+
}, 0));
|
|
218
|
+
}, [a, u, n.length]), P = k ? n.find((e) => e.id === k) : null;
|
|
219
|
+
return /* @__PURE__ */ L(ye, {
|
|
220
|
+
children: [/* @__PURE__ */ L(ie, {
|
|
221
|
+
sensors: _,
|
|
222
|
+
collisionDetection: ae,
|
|
223
|
+
onDragStart: X,
|
|
224
|
+
onDragEnd: Z,
|
|
225
|
+
onDragCancel: Y,
|
|
226
|
+
children: [/* @__PURE__ */ o(se, {
|
|
227
|
+
items: n.map((e) => e.id),
|
|
228
|
+
strategy: ce,
|
|
229
|
+
children: /* @__PURE__ */ o("ul", {
|
|
230
|
+
className: r.sortableOptionList,
|
|
231
|
+
children: n.map((e, i) => /* @__PURE__ */ o(Te, {
|
|
232
|
+
option: e,
|
|
233
|
+
index: i,
|
|
234
|
+
isFieldReadOnly: !!y,
|
|
235
|
+
onInputChange: U,
|
|
236
|
+
onDelete: W,
|
|
237
|
+
onInputRef: ee,
|
|
238
|
+
error: Ne(D, l, i, e, n, N),
|
|
239
|
+
handleBlur: b,
|
|
240
|
+
canDelete: n.length >= 2,
|
|
241
|
+
dragAriaLabel: t(v.dragAndDropOptionAriaLabel),
|
|
242
|
+
inputPlaceholder: t(v.addAnOptionOptionPlaceholder),
|
|
243
|
+
deleteAriaLabel: t(v.deleteDropdownOptionAriaLabel)
|
|
244
|
+
}, e.id))
|
|
245
|
+
})
|
|
246
|
+
}), /* @__PURE__ */ o(le, {
|
|
247
|
+
dropAnimation: null,
|
|
248
|
+
children: P ? /* @__PURE__ */ L("li", {
|
|
249
|
+
className: J(r.option, r.optionDragOverlay, {
|
|
250
|
+
[r.editable]: !y
|
|
251
|
+
}),
|
|
252
|
+
children: [!y && /* @__PURE__ */ o("div", {
|
|
253
|
+
className: r.dragHandle,
|
|
254
|
+
children: /* @__PURE__ */ o(F, {
|
|
255
|
+
fontSize: 20,
|
|
256
|
+
"aria-hidden": "true"
|
|
257
|
+
})
|
|
258
|
+
}), /* @__PURE__ */ o(K, {
|
|
259
|
+
disabled: y,
|
|
260
|
+
placeholder: t(v.addAnOptionOptionPlaceholder),
|
|
261
|
+
label: t(v.addAnOptionOptionPlaceholder),
|
|
262
|
+
hideLabel: !0,
|
|
263
|
+
id: "drag-overlay-option",
|
|
264
|
+
name: "drag-overlay-option",
|
|
265
|
+
value: P.key,
|
|
266
|
+
className: r.input
|
|
267
|
+
}), !y && /* @__PURE__ */ o("div", {
|
|
268
|
+
className: r.deleteButtonContainer,
|
|
269
|
+
children: /* @__PURE__ */ o($, {
|
|
270
|
+
icon: V,
|
|
271
|
+
size: "x-small",
|
|
272
|
+
variant: "default",
|
|
273
|
+
tabIndex: -1,
|
|
274
|
+
focusable: !0,
|
|
275
|
+
disabled: n.length < 2,
|
|
276
|
+
className: r.deleteButton,
|
|
277
|
+
"aria-label": ""
|
|
278
|
+
})
|
|
279
|
+
})]
|
|
280
|
+
}) : null
|
|
281
|
+
})]
|
|
282
|
+
}), Q && /* @__PURE__ */ o(be, {
|
|
283
|
+
onClose: j,
|
|
284
|
+
onConfirm: () => z(M?.id ?? null),
|
|
285
|
+
title: t(v.deleteOptionTitle, {
|
|
286
|
+
optionName: M?.key ?? ""
|
|
287
|
+
}),
|
|
288
|
+
body: t(v.deleteOptionDescription)
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
export {
|
|
293
|
+
Ke as SortableOptionList
|
|
294
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DropdownFieldConfiguration as i } from "./dropdown/dropdown-field-configuration.js";
|
|
2
|
+
import { TaxonomyFieldConfiguration as e } from "./taxonomy/taxonomy-field-configuration.js";
|
|
3
|
+
export {
|
|
4
|
+
i as DropdownFieldConfiguration,
|
|
5
|
+
e as TaxonomyFieldConfiguration
|
|
6
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { T as e } from "../../../../../../../chunks/types.js";
|
|
2
|
+
const a = {
|
|
3
|
+
taxonomy: {
|
|
4
|
+
availableTaxonomies: [],
|
|
5
|
+
allowMultipleSelections: !1,
|
|
6
|
+
selection: e.RequireSpecific,
|
|
7
|
+
selectedLevels: [],
|
|
8
|
+
taxonomySearchValue: "",
|
|
9
|
+
taxonomyKey: "",
|
|
10
|
+
namespace: ""
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
a as taxonomyDefaultValues
|
|
15
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { InlineNotice as I, Switch as M, TextButton as h, Radio as y, DropdownMenu as x } from "@box/blueprint-web";
|
|
2
|
+
import { Caret as p } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { useMemo as R, useEffect as V } from "react";
|
|
4
|
+
import { useIntl as A } from "react-intl";
|
|
5
|
+
import { useFieldConfigurator as q } from "../../../context/field-configurator-context.js";
|
|
6
|
+
import { useTaxonomyOptions as N } from "../../../context/taxonomy-options-context.js";
|
|
7
|
+
import t from "../../../messages/taxonomy-messages.js";
|
|
8
|
+
import { TaxonomyFieldConfiguratorInitialState as k } from "./taxonomy-field-configurator-initial-state.js";
|
|
9
|
+
import { TaxonomySelector as E } from "./taxonomy-selector.js";
|
|
10
|
+
import { T as a } from "../../../../../../../chunks/types.js";
|
|
11
|
+
import { useTaxonomySelect as K } from "./useTaxonomySelect.js";
|
|
12
|
+
import { filterTaxonomiesByValue as B } from "./utils.js";
|
|
13
|
+
import { jsxs as c, Fragment as v, jsx as l } from "react/jsx-runtime";
|
|
14
|
+
import { LevelsChain as O } from "../../levels-chain/levels-chain.js";
|
|
15
|
+
import '../../../../../../../styles/taxonomy-field-configuration.css';const _ = "_taxonomyFieldConfiguration_ylhrs_1", j = {
|
|
16
|
+
taxonomyFieldConfiguration: _
|
|
17
|
+
}, oe = () => {
|
|
18
|
+
const {
|
|
19
|
+
formatMessage: n
|
|
20
|
+
} = A(), {
|
|
21
|
+
values: e,
|
|
22
|
+
errors: S,
|
|
23
|
+
touched: g,
|
|
24
|
+
setFieldValue: r
|
|
25
|
+
} = q(), {
|
|
26
|
+
onTaxonomySelect: T
|
|
27
|
+
} = K({
|
|
28
|
+
values: e,
|
|
29
|
+
setFieldValue: r
|
|
30
|
+
}), {
|
|
31
|
+
options: u
|
|
32
|
+
} = N(), i = e.taxonomy.availableTaxonomies.find((o) => o.selected), {
|
|
33
|
+
selectedLevels: f
|
|
34
|
+
} = e.taxonomy, m = R(() => i ? i.levels : [], [i]), C = e.taxonomy.selection === a.RequireSpecific && f.length > 0 ? m[f[0] - 1]?.name : void 0;
|
|
35
|
+
V(
|
|
36
|
+
() => {
|
|
37
|
+
if (u.length > 0) {
|
|
38
|
+
const o = {
|
|
39
|
+
...e.taxonomy,
|
|
40
|
+
availableTaxonomies: u.map((d) => ({
|
|
41
|
+
...d,
|
|
42
|
+
selected: d.taxonomyKey === e.taxonomy.taxonomyKey
|
|
43
|
+
})),
|
|
44
|
+
selectedLevels: e.taxonomy.selectedLevels,
|
|
45
|
+
selection: e.taxonomy.selectedLevels.length > 1 ? a.AllowAny : a.RequireSpecific
|
|
46
|
+
};
|
|
47
|
+
r("taxonomy", o);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
51
|
+
[u]
|
|
52
|
+
);
|
|
53
|
+
const b = (o) => {
|
|
54
|
+
const d = o === a.AllowAny ? m.map((F) => F.level) : [m[0].level];
|
|
55
|
+
r("taxonomy", {
|
|
56
|
+
...e.taxonomy,
|
|
57
|
+
selection: o,
|
|
58
|
+
selectedLevels: d
|
|
59
|
+
});
|
|
60
|
+
}, L = i?.label ?? n(t.chooseTaxonomyLevel), w = !!S.taxonomy?.taxonomyKey && !!g.taxonomy?.taxonomyKey;
|
|
61
|
+
if (!i && e.isFieldNew)
|
|
62
|
+
return /* @__PURE__ */ c(v, {
|
|
63
|
+
children: [w && /* @__PURE__ */ l(I, {
|
|
64
|
+
variant: "error",
|
|
65
|
+
variantIconAriaLabel: n(t.noTaxonomySelectedError),
|
|
66
|
+
children: n(t.noTaxonomySelectedError)
|
|
67
|
+
}), /* @__PURE__ */ l(k, {})]
|
|
68
|
+
});
|
|
69
|
+
const s = e.isFieldReadOnly || !e.isFieldNew;
|
|
70
|
+
return /* @__PURE__ */ c("div", {
|
|
71
|
+
className: j.taxonomyFieldConfiguration,
|
|
72
|
+
children: [/* @__PURE__ */ l(M.Item, {
|
|
73
|
+
name: "allowMultipleSelections",
|
|
74
|
+
disabled: s,
|
|
75
|
+
checked: e.taxonomy.allowMultipleSelections,
|
|
76
|
+
label: n(t.allowMultipleTaxonomySelections),
|
|
77
|
+
onCheckedChange: (o) => {
|
|
78
|
+
r("taxonomy", {
|
|
79
|
+
...e.taxonomy,
|
|
80
|
+
allowMultipleSelections: o
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
value: e.taxonomy.allowMultipleSelections.toString()
|
|
84
|
+
}), /* @__PURE__ */ l("div", {
|
|
85
|
+
children: /* @__PURE__ */ l(E, {
|
|
86
|
+
triggerButton: /* @__PURE__ */ l(h, {
|
|
87
|
+
disabled: s,
|
|
88
|
+
icon: p,
|
|
89
|
+
children: L
|
|
90
|
+
}),
|
|
91
|
+
data: B(e.taxonomy.availableTaxonomies, e.taxonomy.taxonomySearchValue),
|
|
92
|
+
onClick: T,
|
|
93
|
+
onSearchValue: (o) => {
|
|
94
|
+
r("taxonomy", {
|
|
95
|
+
...e.taxonomy,
|
|
96
|
+
taxonomySearchValue: o
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}), m.length > 0 && /* @__PURE__ */ l(O, {
|
|
101
|
+
levels: m,
|
|
102
|
+
selectedLevels: f
|
|
103
|
+
}), i && m.length > 1 && /* @__PURE__ */ l(y.Legend, {
|
|
104
|
+
header: n(t.selection),
|
|
105
|
+
children: /* @__PURE__ */ c(y.Group, {
|
|
106
|
+
disabled: s,
|
|
107
|
+
defaultValue: a.RequireSpecific,
|
|
108
|
+
loop: !0,
|
|
109
|
+
name: "selection",
|
|
110
|
+
onValueChange: b,
|
|
111
|
+
orientation: "vertical",
|
|
112
|
+
value: e.taxonomy.selection,
|
|
113
|
+
children: [/* @__PURE__ */ l(y.Item, {
|
|
114
|
+
label: /* @__PURE__ */ c(v, {
|
|
115
|
+
children: [n(t.requiredSelection), /* @__PURE__ */ c(x.Root, {
|
|
116
|
+
modal: !1,
|
|
117
|
+
children: [/* @__PURE__ */ l(x.Trigger, {
|
|
118
|
+
disabled: e.taxonomy.selection !== a.RequireSpecific || s,
|
|
119
|
+
children: /* @__PURE__ */ l(h, {
|
|
120
|
+
icon: p,
|
|
121
|
+
children: C ?? n(t.chooseTaxonomyLevel)
|
|
122
|
+
})
|
|
123
|
+
}), /* @__PURE__ */ l(x.Content, {
|
|
124
|
+
align: "start",
|
|
125
|
+
children: i?.levels?.map((o) => /* @__PURE__ */ l(x.Item, {
|
|
126
|
+
onClick: () => {
|
|
127
|
+
r("taxonomy", {
|
|
128
|
+
...e.taxonomy,
|
|
129
|
+
selectedLevels: [o.level]
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
children: o.name
|
|
133
|
+
}, o.level))
|
|
134
|
+
})]
|
|
135
|
+
})]
|
|
136
|
+
}),
|
|
137
|
+
value: a.RequireSpecific
|
|
138
|
+
}), /* @__PURE__ */ l(y.Item, {
|
|
139
|
+
disabled: s,
|
|
140
|
+
label: n(t.anyLevelSelection),
|
|
141
|
+
value: a.AllowAny
|
|
142
|
+
})]
|
|
143
|
+
})
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
oe as TaxonomyFieldConfiguration
|
|
149
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Text as a } from "@box/blueprint-web";
|
|
2
|
+
import { FormattedMessage as r } from "react-intl";
|
|
3
|
+
import { useFieldConfigurator as s } from "../../../context/field-configurator-context.js";
|
|
4
|
+
import i from "../../../messages/taxonomy-messages.js";
|
|
5
|
+
import { useTaxonomySelect as u } from "./useTaxonomySelect.js";
|
|
6
|
+
import { filterTaxonomiesByValue as c } from "./utils.js";
|
|
7
|
+
import { TaxonomySelector as d } from "./taxonomy-selector.js";
|
|
8
|
+
import { jsxs as x, jsx as o } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../../../../styles/taxonomy-field-configurator-initial-state.css';const f = "_taxonomyFieldConfiguratorInitialState_il5v7_1", y = "_subheader_il5v7_10", n = {
|
|
10
|
+
taxonomyFieldConfiguratorInitialState: f,
|
|
11
|
+
subheader: y
|
|
12
|
+
}, C = () => {
|
|
13
|
+
const {
|
|
14
|
+
values: t,
|
|
15
|
+
setFieldValue: e
|
|
16
|
+
} = s(), {
|
|
17
|
+
onTaxonomySelect: l
|
|
18
|
+
} = u({
|
|
19
|
+
values: t,
|
|
20
|
+
setFieldValue: e
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ x("div", {
|
|
23
|
+
className: n.taxonomyFieldConfiguratorInitialState,
|
|
24
|
+
children: [/* @__PURE__ */ o(a, {
|
|
25
|
+
as: "h1",
|
|
26
|
+
color: "textOnLightDefault",
|
|
27
|
+
variant: "titleMedium",
|
|
28
|
+
children: /* @__PURE__ */ o(r, {
|
|
29
|
+
...i.callToActionHeader
|
|
30
|
+
})
|
|
31
|
+
}), /* @__PURE__ */ o(a, {
|
|
32
|
+
as: "p",
|
|
33
|
+
className: n.subheader,
|
|
34
|
+
color: "textOnLightDefault",
|
|
35
|
+
variant: "bodyDefault",
|
|
36
|
+
children: /* @__PURE__ */ o(r, {
|
|
37
|
+
...i.callToActionSubheader
|
|
38
|
+
})
|
|
39
|
+
}), /* @__PURE__ */ o(d, {
|
|
40
|
+
data: c(t.taxonomy.availableTaxonomies, t.taxonomy.taxonomySearchValue),
|
|
41
|
+
onClick: l,
|
|
42
|
+
resetValueOnHide: !0,
|
|
43
|
+
onSearchValue: (m) => {
|
|
44
|
+
e("taxonomy", {
|
|
45
|
+
...t.taxonomy,
|
|
46
|
+
taxonomySearchValue: m
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
C as TaxonomyFieldConfiguratorInitialState
|
|
54
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
const o = e({
|
|
3
|
+
taxonomySelectorAriaLabel: {
|
|
4
|
+
id: "groupSharedFeatures.metadataTemplateEditor.taxonomySelectorAriaLabel",
|
|
5
|
+
defaultMessage: "Open taxonomy selector"
|
|
6
|
+
},
|
|
7
|
+
taxonomySelector: {
|
|
8
|
+
id: "groupSharedFeatures.metadataTemplateEditor.taxonomySelector",
|
|
9
|
+
defaultMessage: "Choose a Taxonomy"
|
|
10
|
+
},
|
|
11
|
+
recentlyUsedTaxonomies: {
|
|
12
|
+
id: "groupSharedFeatures.metadataTemplateEditor.recentlyUsedTaxonomies",
|
|
13
|
+
defaultMessage: "Recents"
|
|
14
|
+
},
|
|
15
|
+
allTaxonomies: {
|
|
16
|
+
id: "groupSharedFeatures.metadataTemplateEditor.allTaxonomies",
|
|
17
|
+
defaultMessage: "All taxonomies"
|
|
18
|
+
},
|
|
19
|
+
searchTaxonomiesInputPlaceholder: {
|
|
20
|
+
id: "groupSharedFeatures.metadataTemplateEditor.searchTaxonomiesInputPlaceholder",
|
|
21
|
+
defaultMessage: "Search taxonomies"
|
|
22
|
+
},
|
|
23
|
+
loadingTaxonomies: {
|
|
24
|
+
id: "groupSharedFeatures.metadataTemplateEditor.loadingTaxonomies",
|
|
25
|
+
defaultMessage: "Loading taxonomies…"
|
|
26
|
+
},
|
|
27
|
+
loadTaxonomiesError: {
|
|
28
|
+
id: "groupSharedFeatures.metadataTemplateEditor.loadTaxonomiesError",
|
|
29
|
+
defaultMessage: "Failed to load taxonomies."
|
|
30
|
+
},
|
|
31
|
+
retryLoadTaxonomies: {
|
|
32
|
+
id: "groupSharedFeatures.metadataTemplateEditor.retryLoadTaxonomies",
|
|
33
|
+
defaultMessage: "Retry"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
o as default
|
|
38
|
+
};
|