@box/metadata-template-editor 1.21.11 → 1.22.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.
Files changed (20) hide show
  1. package/README.md +5 -5
  2. package/dist/chunks/field-context-menu.js +35 -32
  3. package/dist/chunks/metadata-field-configurator.module.js +19 -15
  4. package/dist/chunks/metadata-field-list.js +20 -20
  5. package/dist/chunks/metadata-template-editor-form.js +4 -4
  6. package/dist/chunks/sortable-option-list.js +47 -47
  7. package/dist/esm/index.js +3 -3
  8. package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +57 -56
  9. package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +12 -12
  10. package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.js +77 -76
  11. package/dist/esm/lib/components/metadata-field-configurator/index.js +3 -3
  12. package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +79 -76
  13. package/dist/i18n/en-x-pseudo.js +106 -106
  14. package/dist/i18n/en-x-pseudo.properties +106 -106
  15. package/dist/styles/metadata-field-configurator.css +1 -1
  16. package/dist/types/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.d.ts +3 -10
  17. package/dist/types/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.d.ts +5 -1
  18. package/dist/types/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.d.ts +1 -0
  19. package/dist/types/lib/components/metadata-field-configurator/metadata-field-configurator.d.ts +6 -2
  20. package/package.json +6 -6
@@ -1,63 +1,64 @@
1
1
  import { general as e } from "../../messages/configurator-messages.js";
2
2
  import { t } from "../../../../../../chunks/metadata-field-configurator.module.js";
3
3
  import { t as n } from "../../../../../../chunks/field-context-menu.js";
4
- import { Status as r, Tabs as i } from "@box/blueprint-web";
5
- import { useIntl as a } from "react-intl";
6
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
- import { DragDots as l } from "@box/blueprint-web-assets/icons/Fill";
8
- import "react";
4
+ import { Status as r, Tabs as i, Text as a } from "@box/blueprint-web";
5
+ import { useIntl as o } from "react-intl";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { useState as l } from "react";
9
8
  import { SurfaceStatusSurfaceGray as u } from "@box/blueprint-web-assets/tokens/tokens";
10
9
  import { Hidden as d, Pencil as f } from "@box/blueprint-web-assets/icons/Line";
11
- var p = ({ isExpanded: p, isHidden: m, index: h, maxIndex: g, dndDragHandleProps: _, onDragStart: v, onDragEnd: y, onTouchStart: b, onReorderFields: x, onToggleVisibility: S, onRequestDelete: C, onRequestDuplicate: w, extensions: T }) => {
12
- let E = a();
13
- return /* @__PURE__ */ c(o, { children: [
14
- m && /* @__PURE__ */ s(r, {
15
- icon: d,
16
- iconPosition: "left",
17
- color: u,
18
- text: E.formatMessage(e.hiddenStatus).toUpperCase()
19
- }),
20
- p === !1 && /* @__PURE__ */ s("div", {
21
- draggable: !_,
22
- className: t.dragHandle,
23
- onDragStart: !_ && v ? (e) => v(e, h) : void 0,
24
- onDragEnd: !_ && y ? (e) => y(e, h) : void 0,
25
- onTouchStart: !_ && b ? (e) => b(e, h) : void 0,
26
- ..._?.listeners ?? {},
27
- ..._?.attributes ?? {},
28
- "aria-label": E.formatMessage(e.dragAndDropFieldAriaLabel),
29
- tabIndex: _ ? void 0 : -1,
30
- children: /* @__PURE__ */ s(l, {
31
- fontSize: 20,
32
- "aria-label": E.formatMessage(e.dragAndDropFieldAriaLabel)
33
- })
34
- }),
35
- /* @__PURE__ */ c("div", {
36
- className: t.expandedToolbarActions,
37
- children: [T.length > 0 && /* @__PURE__ */ c(i.TabList, {
38
- variant: "contentSwitcher",
39
- containerClassname: t.extensionTabsContainer,
40
- children: [/* @__PURE__ */ s(i.Tab, {
41
- id: "edit",
42
- variant: "contentSwitcher",
43
- "aria-label": E.formatMessage(e.editTabAriaLabel),
44
- children: /* @__PURE__ */ s(f, { "aria-hidden": "true" })
45
- }), T.map((e, t) => /* @__PURE__ */ s(i.Tab, {
46
- id: `ext-${t}`,
10
+ import p from "clsx";
11
+ var m = ({ isHidden: m, isExpanded: h, index: g, maxIndex: _, onReorderFields: v, onToggleVisibility: y, onRequestDelete: b, onRequestDuplicate: x, extensions: S, fieldCollapsedText: C }) => {
12
+ let w = o(), [T, E] = l(!1);
13
+ return /* @__PURE__ */ c("div", {
14
+ className: t.fieldActionSlot,
15
+ children: [
16
+ m && /* @__PURE__ */ s(r, {
17
+ icon: d,
18
+ iconPosition: "left",
19
+ color: u,
20
+ text: w.formatMessage(e.hiddenStatus).toUpperCase(),
21
+ className: t.hiddenBadge
22
+ }),
23
+ C && !h && /* @__PURE__ */ s(a, {
24
+ as: "span",
25
+ variant: "bodySmall",
26
+ color: "textOnLightSecondary",
27
+ className: p(t.fieldCollapsedText, { [t.menuOpen]: T }),
28
+ children: C
29
+ }),
30
+ /* @__PURE__ */ c("div", {
31
+ className: p(t.expandedToolbarActions, { [t.menuOpen]: T }),
32
+ children: [S.length > 0 && /* @__PURE__ */ c(i.TabList, {
47
33
  variant: "contentSwitcher",
48
- "aria-label": e.label,
49
- children: /* @__PURE__ */ s(e.icon, { "aria-hidden": "true" })
50
- }, e.label))]
51
- }), /* @__PURE__ */ s(n, {
52
- index: h,
53
- maxIndex: g,
54
- isHidden: m,
55
- onReorderFields: x,
56
- onToggleVisibility: S,
57
- onRequestDelete: C,
58
- onRequestDuplicate: w
59
- })]
60
- })
61
- ] });
34
+ containerClassname: t.extensionTabsContainer,
35
+ children: [/* @__PURE__ */ s(i.Tab, {
36
+ id: "edit",
37
+ variant: "contentSwitcher",
38
+ "aria-label": w.formatMessage(e.editTabAriaLabel),
39
+ children: /* @__PURE__ */ s(f, { "aria-hidden": "true" })
40
+ }), S.map((e, t) => /* @__PURE__ */ s(i.Tab, {
41
+ id: `ext-${t}`,
42
+ variant: "contentSwitcher",
43
+ "aria-label": e.label,
44
+ children: /* @__PURE__ */ s(e.icon, { "aria-hidden": "true" })
45
+ }, e.label))]
46
+ }), /* @__PURE__ */ s(n, {
47
+ className: p(t.fieldContextMenu, {
48
+ [t.menuOpen]: T,
49
+ [t.contextMenuWithCollapsedText]: !!C && !h
50
+ }),
51
+ index: g,
52
+ maxIndex: _,
53
+ isHidden: m,
54
+ onReorderFields: v,
55
+ onToggleVisibility: y,
56
+ onRequestDelete: b,
57
+ onRequestDuplicate: x,
58
+ onOpenChange: E
59
+ })]
60
+ })
61
+ ]
62
+ });
62
63
  };
63
- export { p as FieldActionSlot };
64
+ export { m as FieldActionSlot };
@@ -1,15 +1,15 @@
1
1
  import { a as e } from "../../../../../../chunks/types.js";
2
2
  import { useFieldOptions as t } from "../../../../utils/field-options/useFieldOptions.js";
3
3
  import { general as n } from "../../messages/configurator-messages.js";
4
- import { useFieldConfigurator as r } from "../../context/field-configurator-context.js";
5
- import { getConfigurationByType as i } from "../../utils.js";
6
- import { t as a } from "../../../../../../chunks/metadata-field-configurator.module.js";
4
+ import { t as r } from "../../../../../../chunks/metadata-field-configurator.module.js";
5
+ import { useFieldConfigurator as i } from "../../context/field-configurator-context.js";
6
+ import { getConfigurationByType as a } from "../../utils.js";
7
7
  import { Select as o, TextInput as s, TextWithInfoBadge as c, TooltipProvider as l } from "@box/blueprint-web";
8
8
  import { useIntl as u } from "react-intl";
9
9
  import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
10
  import { useMemo as p } from "react";
11
11
  var m = ({ nameInputId: m, descriptionInputId: h, isTypeEditable: g, externalErrors: _, externalTouched: v, handleTypeChange: y }) => {
12
- let b = u(), x = t(), { values: S, errors: C, touched: w, handleChange: T, handleBlur: E } = r(), D = (e) => {
12
+ let b = u(), x = t(), { values: S, errors: C, touched: w, handleChange: T, handleBlur: E } = i(), D = (e) => {
13
13
  if (_ && v?.[e]) return _[e];
14
14
  let t = C[e];
15
15
  if (w[e] && t != null && typeof t == "string") return t;
@@ -17,19 +17,19 @@ var m = ({ nameInputId: m, descriptionInputId: h, isTypeEditable: g, externalErr
17
17
  infoBadgeAriaLabel: b.formatMessage(n.descriptionLearnMoreBadgeAriaLabel),
18
18
  infoText: b.formatMessage(n.descriptionInfoTooltip),
19
19
  children: /* @__PURE__ */ d("label", {
20
- className: a.labelWithTooltip,
20
+ className: r.labelWithTooltip,
21
21
  htmlFor: h,
22
22
  children: b.formatMessage(n.fieldDescriptionLabel)
23
23
  })
24
24
  }) }), [b, h]);
25
25
  return /* @__PURE__ */ d("fieldset", {
26
26
  disabled: S.isFieldReadOnly,
27
- className: a.fieldset,
27
+ className: r.fieldset,
28
28
  children: /* @__PURE__ */ f("div", {
29
- className: a.expandedContent,
29
+ className: r.expandedContent,
30
30
  children: [
31
31
  /* @__PURE__ */ f("div", {
32
- className: a.basic,
32
+ className: r.basic,
33
33
  children: [/* @__PURE__ */ d(s, {
34
34
  name: "name",
35
35
  id: m,
@@ -50,7 +50,7 @@ var m = ({ nameInputId: m, descriptionInputId: h, isTypeEditable: g, externalErr
50
50
  readonly: !g,
51
51
  disabled: S.isFieldReadOnly,
52
52
  onValueChange: y,
53
- className: a.fieldTypeSelect,
53
+ className: r.fieldTypeSelect,
54
54
  required: !0,
55
55
  children: /* @__PURE__ */ d(o.Content, { children: x.availableFieldTypes.map((e) => /* @__PURE__ */ d(o.Option, {
56
56
  text: typeof e.label == "string" ? e.label : String(e.label),
@@ -59,11 +59,11 @@ var m = ({ nameInputId: m, descriptionInputId: h, isTypeEditable: g, externalErr
59
59
  })]
60
60
  }),
61
61
  [e.Dropdown, e.Taxonomy].includes(S.type) && /* @__PURE__ */ d("div", {
62
- className: a.typeSpecific,
63
- children: i(S.type)
62
+ className: r.typeSpecific,
63
+ children: a(S.type)
64
64
  }),
65
65
  /* @__PURE__ */ d("div", {
66
- className: a.description,
66
+ className: r.description,
67
67
  children: /* @__PURE__ */ d(s, {
68
68
  name: "description",
69
69
  id: h,
@@ -1,100 +1,101 @@
1
1
  import { FieldTypeIcon as e } from "../../../utils/field-options/field-type-icon.js";
2
2
  import { general as t } from "../messages/configurator-messages.js";
3
- import { useFieldExtensions as n } from "../context/field-extensions-context.js";
4
- import { createDefaultFieldValues as r, hasVisibleErrors as i } from "../utils.js";
3
+ import { createDefaultFieldValues as n, hasVisibleErrors as r } from "../utils.js";
4
+ import { useFieldExtensions as i } from "../context/field-extensions-context.js";
5
5
  import { useFieldValidation as a } from "./useFieldValidation.js";
6
6
  import { useTaxonomyFetch as o } from "./useTaxonomyFetch.js";
7
7
  import { useIntl as s } from "react-intl";
8
8
  import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
9
9
  import p from "lodash/cloneDeep";
10
10
  import m from "lodash/set";
11
- function h({ values: h, onValuesChange: g, onDelete: _, isExpanded: v, onExpandedChange: y, submitAttemptCount: b, taxonomyOptions: x, fetchTaxonomies: S, fieldExtensionsProp: C, onValidationChange: w }) {
12
- let T = s(), { errors: E, touched: D, isValid: O, validateForm: k, touchAll: A, setFieldTouched: j, setTouched: ee, handleBlur: te } = a(h), ne = o(S, x), M = n(), N = C ?? M, [P, F] = f(() => h.isFieldNew === !0), [I, L] = f(!1), [R, z] = f("edit"), B = v === void 0 ? P : v, V = !h.isFieldReadOnly && h.isFieldNew, H = h.id, U = `field-name-${H}`, W = `field-description-${H}`, G = c((e, t) => {
13
- g({
14
- ...h,
11
+ var h = "edit";
12
+ function g({ values: g, onValuesChange: _, onDelete: v, isExpanded: y, onExpandedChange: b, submitAttemptCount: x, taxonomyOptions: S, fetchTaxonomies: C, fieldExtensionsProp: w, onValidationChange: T }) {
13
+ let E = s(), { errors: D, touched: O, isValid: k, validateForm: A, touchAll: j, setFieldTouched: M, setTouched: ee, handleBlur: te } = a(g), ne = o(C, S), N = i(), P = w ?? N, [F, I] = f(() => g.isFieldNew === !0), [L, R] = f(!1), [z, B] = f(h), V = y === void 0 ? F : y, H = !g.isFieldReadOnly && g.isFieldNew, U = g.id, W = `field-name-${U}`, G = `field-description-${U}`, K = c((e, t) => {
14
+ _({
15
+ ...g,
15
16
  [e]: t
16
17
  });
17
- }, [h, g]), K = c((e) => {
18
- let { name: t, value: n } = e.target, r = p(h);
19
- m(r, t, n), g(r);
20
- }, [h, g]), q = u(() => ({
21
- values: h,
22
- errors: E,
23
- touched: D,
24
- isValid: O,
25
- setFieldValue: G,
26
- setValues: g,
27
- setFieldTouched: j,
18
+ }, [g, _]), q = c((e) => {
19
+ let { name: t, value: n } = e.target, r = p(g);
20
+ m(r, t, n), _(r);
21
+ }, [g, _]), J = u(() => ({
22
+ values: g,
23
+ errors: D,
24
+ touched: O,
25
+ isValid: k,
26
+ setFieldValue: K,
27
+ setValues: _,
28
+ setFieldTouched: M,
28
29
  setTouched: ee,
29
- handleChange: K,
30
+ handleChange: q,
30
31
  handleBlur: te,
31
- validateForm: k
32
+ validateForm: A
32
33
  }), [
33
- h,
34
- E,
34
+ g,
35
35
  D,
36
36
  O,
37
- G,
38
- g,
37
+ k,
39
38
  K,
40
- k
41
- ]), J = d(B);
39
+ _,
40
+ q,
41
+ A
42
+ ]), Y = d(V);
42
43
  l(() => {
43
- let e = J.current;
44
- J.current = B, e && !B && (A(), z("edit"));
45
- }, [B]);
46
- let Y = d(b);
44
+ let e = Y.current;
45
+ Y.current = V, e && !V && (j(), B("edit"));
46
+ }, [V]);
47
+ let X = d(x);
47
48
  l(() => {
48
- !b || b === Y.current || A();
49
- }, [b]);
50
- let X = d(w);
51
- X.current = w, l(() => {
52
- X.current?.(O);
53
- }, [O]), l(() => {
54
- h.isFieldNew && (v === void 0 ? F(!0) : y?.(!0));
55
- }, [h.isFieldNew]);
56
- let re = c((e) => G("hidden", e), [G]), Z = c(() => {
57
- _?.(h.key), L(!1);
58
- }, [_, h.key]), Q = c(() => {
59
- h.isFieldNew ? Z() : L(!0);
60
- }, [Z, h.isFieldNew]), ie = c(() => L(!1), []), ae = c((e) => F(e === H), [H]), oe = c((e) => {
61
- g({
62
- ...r(e),
63
- key: h.key,
64
- hidden: h.hidden,
65
- isFieldNew: h.isFieldNew,
66
- isFieldReadOnly: h.isFieldReadOnly,
67
- name: h.name,
68
- description: h.description
49
+ !x || x === X.current || j();
50
+ }, [x]);
51
+ let Z = d(T);
52
+ Z.current = T, l(() => {
53
+ Z.current?.(k);
54
+ }, [k]), l(() => {
55
+ g.isFieldNew && (y === void 0 ? I(!0) : b?.(!0));
56
+ }, [g.isFieldNew]);
57
+ let re = c((e) => K("hidden", e), [K]), Q = c(() => {
58
+ v?.(g.key), R(!1);
59
+ }, [v, g.key]), ie = c(() => {
60
+ g.isFieldNew ? Q() : R(!0);
61
+ }, [Q, g.isFieldNew]), ae = c(() => R(!1), []), oe = c((e) => I(e === U), [U]), se = c((e) => {
62
+ _({
63
+ ...n(e),
64
+ key: g.key,
65
+ hidden: g.hidden,
66
+ isFieldNew: g.isFieldNew,
67
+ isFieldReadOnly: g.isFieldReadOnly,
68
+ name: g.name,
69
+ description: g.description
69
70
  });
70
- }, [g, h]), se = u(() => `${h.name || T.formatMessage(t.fieldNameInputPlaceholder)}${h.type === "dropdown" ? ` (${h.dropdown?.options?.length ?? 0})` : ""}`, [
71
- h.name,
72
- h.type,
73
- h.dropdown?.options?.length,
74
- T
75
- ]), ce = u(() => e(h.type), [h.type]), $ = R === "edit" ? 0 : Number(R.replace("ext-", "")) + 1;
71
+ }, [_, g]), ce = u(() => `${g.name || E.formatMessage(t.fieldNameInputPlaceholder)}${g.type === "dropdown" ? ` (${g.dropdown?.options?.length ?? 0})` : ""}`, [
72
+ g.name,
73
+ g.type,
74
+ g.dropdown?.options?.length,
75
+ E
76
+ ]), le = u(() => e(g.type), [g.type]), $ = z === "edit" ? 0 : Number(z.replace("ext-", "")) + 1;
76
77
  return {
77
- contextValue: q,
78
+ contextValue: J,
78
79
  taxonomyContextValue: ne,
79
- extensions: N,
80
- isActive: B,
81
- handleAccordionValueChange: ae,
82
- isDeleteConfirmationModalOpen: I,
83
- openConfirmationModal: Q,
84
- closeConfirmationModal: ie,
85
- handleDeleteField: Z,
86
- activeTabId: R,
87
- setActiveTabId: z,
88
- activeExtension: $ > 0 ? N[$ - 1] ?? null : null,
89
- isTypeEditable: V,
90
- uniqueKey: H,
91
- nameInputId: U,
92
- descriptionInputId: W,
93
- accordionTitle: se,
94
- TitleIcon: ce,
95
- hasErrors: i(E, D),
96
- handleTypeChange: oe,
80
+ extensions: P,
81
+ isActive: V,
82
+ handleAccordionValueChange: oe,
83
+ isDeleteConfirmationModalOpen: L,
84
+ openConfirmationModal: ie,
85
+ closeConfirmationModal: ae,
86
+ handleDeleteField: Q,
87
+ activeTabId: z,
88
+ setActiveTabId: B,
89
+ activeExtension: $ > 0 ? P[$ - 1] ?? null : null,
90
+ isTypeEditable: H,
91
+ uniqueKey: U,
92
+ nameInputId: W,
93
+ descriptionInputId: G,
94
+ accordionTitle: ce,
95
+ TitleIcon: le,
96
+ hasErrors: r(D, O),
97
+ handleTypeChange: se,
97
98
  handleChangeVisibility: re
98
99
  };
99
100
  }
100
- export { h as useFieldConfiguratorBehavior };
101
+ export { h as EDIT_TAB_ID, g as useFieldConfiguratorBehavior };
@@ -1,5 +1,5 @@
1
1
  import { useTemplateFieldSchema as e } from "./hooks/useTemplateFieldSchema.js";
2
- import { FieldExtensionsContext as t, useFieldExtensions as n } from "./context/field-extensions-context.js";
3
- import { createDefaultFieldValues as r } from "./utils.js";
2
+ import { createDefaultFieldValues as t } from "./utils.js";
3
+ import { FieldExtensionsContext as n, useFieldExtensions as r } from "./context/field-extensions-context.js";
4
4
  import { MetadataFieldConfigurator as i } from "./metadata-field-configurator.js";
5
- export { t as FieldExtensionsContext, i as MetadataFieldConfigurator, r as createDefaultFieldValues, n as useFieldExtensions, e as useTemplateFieldSchema };
5
+ export { n as FieldExtensionsContext, i as MetadataFieldConfigurator, t as createDefaultFieldValues, r as useFieldExtensions, e as useTemplateFieldSchema };
@@ -1,96 +1,99 @@
1
1
  import { general as e } from "./messages/configurator-messages.js";
2
- import { FieldConfiguratorContext as t } from "./context/field-configurator-context.js";
3
- import { TaxonomyOptionsContext as n } from "./context/taxonomy-options-context.js";
4
- import { FieldExtensionsContext as r } from "./context/field-extensions-context.js";
5
- import i from "./components/confirmation-modal/confirmation-modal.js";
6
- import { useFieldConfiguratorBehavior as a } from "./hooks/useFieldConfiguratorBehavior.js";
7
- import { t as o } from "../../../../chunks/metadata-field-configurator.module.js";
8
- import { FieldEditContent as s } from "./components/field-edit-content/field-edit-content.js";
9
- import { FieldActionSlot as c } from "./components/field-action-slot/field-action-slot.js";
10
- import { Accordion as l, Tabs as u } from "@box/blueprint-web";
11
- import { useIntl as d } from "react-intl";
12
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
2
+ import t from "./components/confirmation-modal/confirmation-modal.js";
3
+ import { t as n } from "../../../../chunks/metadata-field-configurator.module.js";
4
+ import { FieldActionSlot as ee } from "./components/field-action-slot/field-action-slot.js";
5
+ import { FieldConfiguratorContext as te } from "./context/field-configurator-context.js";
6
+ import { TaxonomyOptionsContext as r } from "./context/taxonomy-options-context.js";
7
+ import { FieldEditContent as i } from "./components/field-edit-content/field-edit-content.js";
8
+ import { FieldExtensionsContext as a } from "./context/field-extensions-context.js";
9
+ import { EDIT_TAB_ID as o, useFieldConfiguratorBehavior as ne } from "./hooks/useFieldConfiguratorBehavior.js";
10
+ import { Accordion as s, Tabs as c } from "@box/blueprint-web";
11
+ import { useIntl as l } from "react-intl";
12
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
13
13
  import "react";
14
- var h = ({ index: h, maxIndex: g, values: _, onValuesChange: ee, onDelete: te, onDuplicate: ne, onReorderFields: re, onTouchStart: ie, onDragStart: v, onDragEnd: y, externalErrors: b, externalTouched: x, dndDragHandleProps: S, isExpanded: C, onExpandedChange: w, taxonomyOptions: T, fetchTaxonomies: E, submitAttemptCount: D, fieldExtensions: O, onValidationChange: k }) => {
15
- let A = d(), { contextValue: j, taxonomyContextValue: M, extensions: N, isActive: P, handleAccordionValueChange: F, isDeleteConfirmationModalOpen: I, openConfirmationModal: ae, closeConfirmationModal: L, handleDeleteField: R, activeTabId: z, setActiveTabId: B, isTypeEditable: V, uniqueKey: H, nameInputId: U, descriptionInputId: W, accordionTitle: G, TitleIcon: K, hasErrors: q, handleTypeChange: J, handleChangeVisibility: oe } = a({
16
- values: _,
17
- onValuesChange: ee,
18
- onDelete: te,
19
- isExpanded: C,
20
- onExpandedChange: w,
21
- submitAttemptCount: D,
22
- taxonomyOptions: T,
23
- fetchTaxonomies: E,
24
- fieldExtensionsProp: O,
25
- onValidationChange: k
26
- }), Y = /* @__PURE__ */ p(s, {
27
- nameInputId: U,
28
- descriptionInputId: W,
29
- isTypeEditable: V,
30
- externalErrors: b,
31
- externalTouched: x,
32
- handleTypeChange: J
33
- }), se = N.length > 0 ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(u.TabPanel, {
34
- tabId: "edit",
35
- children: Y
36
- }), N.map((e, t) => /* @__PURE__ */ p(u.TabPanel, {
14
+ var p = ({ index: p, maxIndex: m, values: h, onValuesChange: g, onDelete: _, onDuplicate: v, onReorderFields: re, onTouchStart: y, onDragStart: b, onDragEnd: x, externalErrors: ie, externalTouched: ae, dndDragHandleProps: S, fieldCollapsedText: C, isExpanded: w, onExpandedChange: T, taxonomyOptions: E, fetchTaxonomies: D, submitAttemptCount: O, fieldExtensions: k, onValidationChange: A }) => {
15
+ let j = l(), { contextValue: M, taxonomyContextValue: N, extensions: P, isActive: F, handleAccordionValueChange: I, isDeleteConfirmationModalOpen: L, openConfirmationModal: oe, closeConfirmationModal: R, handleDeleteField: z, activeTabId: B, setActiveTabId: V, isTypeEditable: H, uniqueKey: U, nameInputId: W, descriptionInputId: G, accordionTitle: K, TitleIcon: q, hasErrors: se, handleTypeChange: ce, handleChangeVisibility: le } = ne({
16
+ values: h,
17
+ onValuesChange: g,
18
+ onDelete: _,
19
+ isExpanded: w,
20
+ onExpandedChange: T,
21
+ submitAttemptCount: O,
22
+ taxonomyOptions: E,
23
+ fetchTaxonomies: D,
24
+ fieldExtensionsProp: k,
25
+ onValidationChange: A
26
+ }), J = /* @__PURE__ */ d(i, {
27
+ nameInputId: W,
28
+ descriptionInputId: G,
29
+ isTypeEditable: H,
30
+ externalErrors: ie,
31
+ externalTouched: ae,
32
+ handleTypeChange: ce
33
+ }), ue = P.length > 0 ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(c.TabPanel, {
34
+ tabId: o,
35
+ children: J
36
+ }), P.map((e, t) => /* @__PURE__ */ d(c.TabPanel, {
37
37
  tabId: `ext-${t}`,
38
- className: o.extensionContent,
39
- children: e.renderContent(_)
40
- }, e.label))] }) : Y, X = /* @__PURE__ */ p(l.Item, {
38
+ className: n.extensionContent,
39
+ children: e.renderContent(h)
40
+ }, e.label))] }) : J, Y = w === !1, X = /* @__PURE__ */ d(s.Item, {
41
41
  highlighted: !0,
42
- startElement: /* @__PURE__ */ p(K, {
42
+ startElement: /* @__PURE__ */ d(q, {
43
43
  fontSize: "20px",
44
44
  role: "presentation"
45
45
  }),
46
- value: H,
47
- title: G,
48
- action: /* @__PURE__ */ p(c, {
49
- isExpanded: C,
50
- isHidden: _.hidden,
51
- index: h,
52
- maxIndex: g,
53
- dndDragHandleProps: S,
54
- onDragStart: v,
55
- onDragEnd: y,
56
- onTouchStart: ie,
46
+ value: U,
47
+ title: K,
48
+ action: /* @__PURE__ */ d(ee, {
49
+ fieldCollapsedText: C,
50
+ isHidden: h.hidden,
51
+ isExpanded: F,
52
+ index: p,
53
+ maxIndex: m,
57
54
  onReorderFields: re,
58
- onToggleVisibility: oe,
59
- onRequestDelete: ae,
60
- onRequestDuplicate: ne,
61
- extensions: N
55
+ onToggleVisibility: le,
56
+ onRequestDelete: oe,
57
+ onRequestDuplicate: v,
58
+ extensions: P
62
59
  }),
63
- className: o.fieldAccordionItem,
64
- iconVariant: q ? "alert-error" : void 0,
65
- children: se
66
- }), Z = N.length > 0 ? /* @__PURE__ */ p(u, {
67
- selectedId: z,
68
- setSelectedId: (e) => B(e ?? "edit"),
60
+ className: n.fieldAccordionItem,
61
+ iconVariant: se ? "alert-error" : void 0,
62
+ children: ue
63
+ }), Z = P.length > 0 ? /* @__PURE__ */ d(c, {
64
+ selectedId: B,
65
+ setSelectedId: (e) => V(e ?? "edit"),
69
66
  children: X
70
- }) : X, Q = /* @__PURE__ */ m(t.Provider, {
71
- value: j,
72
- children: [/* @__PURE__ */ p("div", {
73
- className: o.fieldAccordionWrapper,
74
- children: C === void 0 ? /* @__PURE__ */ p(l, {
67
+ }) : X, Q = /* @__PURE__ */ f(te.Provider, {
68
+ value: M,
69
+ children: [/* @__PURE__ */ d("div", {
70
+ className: n.fieldAccordionWrapper,
71
+ draggable: Y && !S,
72
+ onDragStart: Y && !S && b ? (e) => b(e, p) : void 0,
73
+ onDragEnd: Y && !S && x ? (e) => x(e, p) : void 0,
74
+ onTouchStart: Y && !S && y ? (e) => y(e, p) : void 0,
75
+ ...Y ? S?.listeners ?? {} : {},
76
+ ...Y ? S?.attributes ?? {} : {},
77
+ children: w === void 0 ? /* @__PURE__ */ d(s, {
75
78
  type: "single",
76
79
  collapsible: !0,
77
- value: P ? H : "",
78
- onValueChange: F,
80
+ value: F ? U : "",
81
+ onValueChange: I,
79
82
  children: Z
80
83
  }) : Z
81
- }), I && /* @__PURE__ */ p(i, {
82
- onClose: L,
83
- onConfirm: R,
84
- title: A.formatMessage(e.deleteFieldTitle, { fieldName: _.name }),
85
- body: A.formatMessage(e.deleteFieldDescription)
84
+ }), L && /* @__PURE__ */ d(t, {
85
+ onClose: R,
86
+ onConfirm: z,
87
+ title: j.formatMessage(e.deleteFieldTitle, { fieldName: h.name }),
88
+ body: j.formatMessage(e.deleteFieldDescription)
86
89
  })]
87
- }), $ = T !== void 0 || E !== void 0 ? /* @__PURE__ */ p(n.Provider, {
88
- value: M,
90
+ }), $ = E !== void 0 || D !== void 0 ? /* @__PURE__ */ d(r.Provider, {
91
+ value: N,
89
92
  children: Q
90
93
  }) : Q;
91
- return O === void 0 ? $ : /* @__PURE__ */ p(r.Provider, {
92
- value: O,
94
+ return k === void 0 ? $ : /* @__PURE__ */ d(a.Provider, {
95
+ value: k,
93
96
  children: $
94
97
  });
95
98
  };
96
- export { h as MetadataFieldConfigurator };
99
+ export { p as MetadataFieldConfigurator };