@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.
Files changed (215) hide show
  1. package/LICENSE +379 -0
  2. package/README.md +57 -0
  3. package/dist/chunks/metadata-field-configurator.module.js +17 -0
  4. package/dist/chunks/types.js +34 -0
  5. package/dist/esm/index.js +34 -0
  6. package/dist/esm/lib/components/field-selector/field-selector.js +39 -0
  7. package/dist/esm/lib/components/field-selector/index.js +4 -0
  8. package/dist/esm/lib/components/field-selector/messages.js +14 -0
  9. package/dist/esm/lib/components/field-type-dropdown/field-type-dropdown.js +47 -0
  10. package/dist/esm/lib/components/field-type-dropdown/index.js +4 -0
  11. package/dist/esm/lib/components/field-type-dropdown/messages.js +14 -0
  12. package/dist/esm/lib/components/field-type-tiles/field-type-tiles.js +40 -0
  13. package/dist/esm/lib/components/field-type-tiles/index.js +4 -0
  14. package/dist/esm/lib/components/field-type-tiles/messages.js +14 -0
  15. package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/confirmation-modal.js +46 -0
  16. package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/messages.js +18 -0
  17. package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +80 -0
  18. package/dist/esm/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.js +115 -0
  19. package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +101 -0
  20. package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/chip.js +33 -0
  21. package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/index.js +4 -0
  22. package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.js +118 -0
  23. package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/utils.js +34 -0
  24. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/__mocks__/getInitialValues.js +33 -0
  25. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-default-values.js +15 -0
  26. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-field-configuration.js +66 -0
  27. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/sortable-option-list.js +294 -0
  28. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/index.js +6 -0
  29. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-default-values.js +15 -0
  30. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configuration.js +149 -0
  31. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configurator-initial-state.js +54 -0
  32. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.js +38 -0
  33. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector.js +103 -0
  34. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/useTaxonomySelect.js +19 -0
  35. package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/utils.js +4 -0
  36. package/dist/esm/lib/components/metadata-field-configurator/context/field-configurator-context.js +68 -0
  37. package/dist/esm/lib/components/metadata-field-configurator/context/field-extensions-context.js +9 -0
  38. package/dist/esm/lib/components/metadata-field-configurator/context/taxonomy-options-context.js +23 -0
  39. package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.js +119 -0
  40. package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldValidation.js +68 -0
  41. package/dist/esm/lib/components/metadata-field-configurator/hooks/useTaxonomyFetch.js +27 -0
  42. package/dist/esm/lib/components/metadata-field-configurator/hooks/useTemplateFieldSchema.js +44 -0
  43. package/dist/esm/lib/components/metadata-field-configurator/index.js +11 -0
  44. package/dist/esm/lib/components/metadata-field-configurator/messages/configurator-messages.js +136 -0
  45. package/dist/esm/lib/components/metadata-field-configurator/messages/dropdown-messages.js +38 -0
  46. package/dist/esm/lib/components/metadata-field-configurator/messages/levels-chain-messages.js +18 -0
  47. package/dist/esm/lib/components/metadata-field-configurator/messages/taxonomy-messages.js +38 -0
  48. package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +154 -0
  49. package/dist/esm/lib/components/metadata-field-configurator/utils.js +53 -0
  50. package/dist/esm/lib/components/metadata-field-list/index.js +5 -0
  51. package/dist/esm/lib/components/metadata-field-list/metadata-field-list.js +279 -0
  52. package/dist/esm/lib/components/metadata-template-editor-form/metadata-template-editor-form.js +137 -0
  53. package/dist/esm/lib/components/metadata-template-editor-modal/index.js +4 -0
  54. package/dist/esm/lib/components/metadata-template-editor-modal/metadata-template-editor-modal.js +103 -0
  55. package/dist/esm/lib/hooks/useMetadataTemplateFormSchema.js +16 -0
  56. package/dist/esm/lib/hooks/useTemplateNameSchema.js +12 -0
  57. package/dist/esm/lib/index.js +14 -0
  58. package/dist/esm/lib/messages.js +118 -0
  59. package/dist/esm/lib/metadata-template-editor.js +179 -0
  60. package/dist/esm/lib/utils/constants.js +8 -0
  61. package/dist/esm/lib/utils/field-options/field-type-icon.js +34 -0
  62. package/dist/esm/lib/utils/field-options/index.js +9 -0
  63. package/dist/esm/lib/utils/field-options/messages.js +48 -0
  64. package/dist/esm/lib/utils/field-options/useFieldOptions.js +19 -0
  65. package/dist/esm/lib/utils/key-generation.js +29 -0
  66. package/dist/esm/lib/utils/template-type-conversion/convertLocalConfiguratorToTemplateField.js +78 -0
  67. package/dist/esm/lib/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.js +90 -0
  68. package/dist/esm/lib/utils/template-type-conversion/generateJSONPatchTemplateOperations.js +179 -0
  69. package/dist/esm/lib/utils/template-type-conversion/mapFieldsWithUniqueKeys.js +14 -0
  70. package/dist/i18n/bn-IN.js +108 -0
  71. package/dist/i18n/bn-IN.properties +196 -0
  72. package/dist/i18n/da-DK.js +108 -0
  73. package/dist/i18n/da-DK.properties +196 -0
  74. package/dist/i18n/de-DE.js +108 -0
  75. package/dist/i18n/de-DE.properties +196 -0
  76. package/dist/i18n/en-AU.js +108 -0
  77. package/dist/i18n/en-AU.properties +196 -0
  78. package/dist/i18n/en-CA.js +108 -0
  79. package/dist/i18n/en-CA.properties +196 -0
  80. package/dist/i18n/en-GB.js +108 -0
  81. package/dist/i18n/en-GB.properties +196 -0
  82. package/dist/i18n/en-US.js +108 -0
  83. package/dist/i18n/en-US.properties +212 -0
  84. package/dist/i18n/en-x-pseudo.js +108 -0
  85. package/dist/i18n/en-x-pseudo.properties +196 -0
  86. package/dist/i18n/es-419.js +108 -0
  87. package/dist/i18n/es-419.properties +196 -0
  88. package/dist/i18n/es-ES.js +108 -0
  89. package/dist/i18n/es-ES.properties +196 -0
  90. package/dist/i18n/fi-FI.js +108 -0
  91. package/dist/i18n/fi-FI.properties +196 -0
  92. package/dist/i18n/fr-CA.js +108 -0
  93. package/dist/i18n/fr-CA.properties +196 -0
  94. package/dist/i18n/fr-FR.js +108 -0
  95. package/dist/i18n/fr-FR.properties +196 -0
  96. package/dist/i18n/hi-IN.js +108 -0
  97. package/dist/i18n/hi-IN.properties +196 -0
  98. package/dist/i18n/it-IT.js +108 -0
  99. package/dist/i18n/it-IT.properties +196 -0
  100. package/dist/i18n/ja-JP.js +108 -0
  101. package/dist/i18n/ja-JP.properties +196 -0
  102. package/dist/i18n/json/src/lib/components/field-selector/messages.json +1 -0
  103. package/dist/i18n/json/src/lib/components/field-type-dropdown/messages.json +1 -0
  104. package/dist/i18n/json/src/lib/components/field-type-tiles/messages.json +1 -0
  105. package/dist/i18n/json/src/lib/components/metadata-field-configurator/components/confirmation-modal/messages.json +1 -0
  106. package/dist/i18n/json/src/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.json +1 -0
  107. package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/configurator-messages.json +1 -0
  108. package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/dropdown-messages.json +1 -0
  109. package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/levels-chain-messages.json +1 -0
  110. package/dist/i18n/json/src/lib/components/metadata-field-configurator/messages/taxonomy-messages.json +1 -0
  111. package/dist/i18n/json/src/lib/messages.json +1 -0
  112. package/dist/i18n/json/src/lib/utils/field-options/messages.json +1 -0
  113. package/dist/i18n/ko-KR.js +108 -0
  114. package/dist/i18n/ko-KR.properties +196 -0
  115. package/dist/i18n/nb-NO.js +108 -0
  116. package/dist/i18n/nb-NO.properties +196 -0
  117. package/dist/i18n/nl-NL.js +108 -0
  118. package/dist/i18n/nl-NL.properties +196 -0
  119. package/dist/i18n/pl-PL.js +108 -0
  120. package/dist/i18n/pl-PL.properties +196 -0
  121. package/dist/i18n/pt-BR.js +108 -0
  122. package/dist/i18n/pt-BR.properties +196 -0
  123. package/dist/i18n/ru-RU.js +108 -0
  124. package/dist/i18n/ru-RU.properties +196 -0
  125. package/dist/i18n/sv-SE.js +108 -0
  126. package/dist/i18n/sv-SE.properties +196 -0
  127. package/dist/i18n/tr-TR.js +108 -0
  128. package/dist/i18n/tr-TR.properties +196 -0
  129. package/dist/i18n/zh-CN.js +108 -0
  130. package/dist/i18n/zh-CN.properties +196 -0
  131. package/dist/i18n/zh-TW.js +108 -0
  132. package/dist/i18n/zh-TW.properties +196 -0
  133. package/dist/styles/chip.css +1 -0
  134. package/dist/styles/dropdown-field-configuration.css +1 -0
  135. package/dist/styles/field-context-menu.css +1 -0
  136. package/dist/styles/field-selector.css +1 -0
  137. package/dist/styles/field-type-dropdown.css +1 -0
  138. package/dist/styles/levels-chain.css +1 -0
  139. package/dist/styles/metadata-field-configurator.css +1 -0
  140. package/dist/styles/metadata-field-list.css +1 -0
  141. package/dist/styles/metadata-template-editor-form.css +1 -0
  142. package/dist/styles/metadata-template-editor-modal.css +1 -0
  143. package/dist/styles/metadata-template-editor.css +1 -0
  144. package/dist/styles/sortable-option-list.css +1 -0
  145. package/dist/styles/taxonomy-field-configuration.css +1 -0
  146. package/dist/styles/taxonomy-field-configurator-initial-state.css +1 -0
  147. package/dist/styles/taxonomy-selector.css +1 -0
  148. package/dist/types/index.d.ts +8 -0
  149. package/dist/types/lib/components/field-selector/field-selector.d.ts +16 -0
  150. package/dist/types/lib/components/field-selector/index.d.ts +1 -0
  151. package/dist/types/lib/components/field-selector/messages.d.ts +13 -0
  152. package/dist/types/lib/components/field-type-dropdown/field-type-dropdown.d.ts +15 -0
  153. package/dist/types/lib/components/field-type-dropdown/index.d.ts +2 -0
  154. package/dist/types/lib/components/field-type-dropdown/messages.d.ts +12 -0
  155. package/dist/types/lib/components/field-type-tiles/field-type-tiles.d.ts +12 -0
  156. package/dist/types/lib/components/field-type-tiles/index.d.ts +2 -0
  157. package/dist/types/lib/components/field-type-tiles/messages.d.ts +12 -0
  158. package/dist/types/lib/components/metadata-field-configurator/components/confirmation-modal/confirmation-modal.d.ts +31 -0
  159. package/dist/types/lib/components/metadata-field-configurator/components/confirmation-modal/messages.d.ts +18 -0
  160. package/dist/types/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.d.ts +30 -0
  161. package/dist/types/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.d.ts +23 -0
  162. package/dist/types/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.d.ts +20 -0
  163. package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/chip.d.ts +17 -0
  164. package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/index.d.ts +1 -0
  165. package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.d.ts +31 -0
  166. package/dist/types/lib/components/metadata-field-configurator/components/levels-chain/utils.d.ts +10 -0
  167. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/__mocks__/getInitialValues.d.ts +2 -0
  168. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-default-values.d.ts +2 -0
  169. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-field-configuration.d.ts +1 -0
  170. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/sortable-option-list.d.ts +6 -0
  171. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/index.d.ts +2 -0
  172. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-default-values.d.ts +2 -0
  173. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configuration.d.ts +1 -0
  174. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configurator-initial-state.d.ts +1 -0
  175. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.d.ts +43 -0
  176. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector.d.ts +12 -0
  177. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/useTaxonomySelect.d.ts +5 -0
  178. package/dist/types/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/utils.d.ts +2 -0
  179. package/dist/types/lib/components/metadata-field-configurator/context/field-configurator-context.d.ts +57 -0
  180. package/dist/types/lib/components/metadata-field-configurator/context/field-extensions-context.d.ts +52 -0
  181. package/dist/types/lib/components/metadata-field-configurator/context/taxonomy-options-context.d.ts +21 -0
  182. package/dist/types/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.d.ts +57 -0
  183. package/dist/types/lib/components/metadata-field-configurator/hooks/useFieldValidation.d.ts +27 -0
  184. package/dist/types/lib/components/metadata-field-configurator/hooks/useTaxonomyFetch.d.ts +19 -0
  185. package/dist/types/lib/components/metadata-field-configurator/hooks/useTemplateFieldSchema.d.ts +15 -0
  186. package/dist/types/lib/components/metadata-field-configurator/index.d.ts +6 -0
  187. package/dist/types/lib/components/metadata-field-configurator/messages/configurator-messages.d.ts +164 -0
  188. package/dist/types/lib/components/metadata-field-configurator/messages/dropdown-messages.d.ts +43 -0
  189. package/dist/types/lib/components/metadata-field-configurator/messages/levels-chain-messages.d.ts +18 -0
  190. package/dist/types/lib/components/metadata-field-configurator/messages/taxonomy-messages.d.ts +43 -0
  191. package/dist/types/lib/components/metadata-field-configurator/metadata-field-configurator.d.ts +191 -0
  192. package/dist/types/lib/components/metadata-field-configurator/stories/story-fixtures.d.ts +5 -0
  193. package/dist/types/lib/components/metadata-field-configurator/utils.d.ts +24 -0
  194. package/dist/types/lib/components/metadata-field-list/index.d.ts +2 -0
  195. package/dist/types/lib/components/metadata-field-list/metadata-field-list.d.ts +109 -0
  196. package/dist/types/lib/components/metadata-template-editor-form/metadata-template-editor-form.d.ts +20 -0
  197. package/dist/types/lib/components/metadata-template-editor-modal/index.d.ts +1 -0
  198. package/dist/types/lib/components/metadata-template-editor-modal/metadata-template-editor-modal.d.ts +56 -0
  199. package/dist/types/lib/hooks/useMetadataTemplateFormSchema.d.ts +17 -0
  200. package/dist/types/lib/hooks/useTemplateNameSchema.d.ts +2 -0
  201. package/dist/types/lib/index.d.ts +7 -0
  202. package/dist/types/lib/messages.d.ts +143 -0
  203. package/dist/types/lib/metadata-template-editor.d.ts +290 -0
  204. package/dist/types/lib/types.d.ts +311 -0
  205. package/dist/types/lib/utils/constants.d.ts +9 -0
  206. package/dist/types/lib/utils/field-options/field-type-icon.d.ts +6 -0
  207. package/dist/types/lib/utils/field-options/index.d.ts +4 -0
  208. package/dist/types/lib/utils/field-options/messages.d.ts +60 -0
  209. package/dist/types/lib/utils/field-options/useFieldOptions.d.ts +34 -0
  210. package/dist/types/lib/utils/key-generation.d.ts +24 -0
  211. package/dist/types/lib/utils/template-type-conversion/convertLocalConfiguratorToTemplateField.d.ts +25 -0
  212. package/dist/types/lib/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.d.ts +8 -0
  213. package/dist/types/lib/utils/template-type-conversion/generateJSONPatchTemplateOperations.d.ts +16 -0
  214. package/dist/types/lib/utils/template-type-conversion/mapFieldsWithUniqueKeys.d.ts +8 -0
  215. package/package.json +61 -0
@@ -0,0 +1,40 @@
1
+ import { RadioTiles as l } from "@box/blueprint-web";
2
+ import { SurfaceSurfaceBrand as p } from "@box/blueprint-web-assets/tokens/tokens";
3
+ import { useIntl as d } from "react-intl";
4
+ import { emptyStateMessages as m } from "./messages.js";
5
+ import { jsx as t } from "react/jsx-runtime";
6
+ import { useFieldOptions as c } from "../../utils/field-options/useFieldOptions.js";
7
+ function g({
8
+ onFieldAdd: o
9
+ }) {
10
+ const {
11
+ formatMessage: r
12
+ } = d(), a = c(), n = (e) => {
13
+ const i = a.availableFieldTypes.find((s) => s.type === e.target.value);
14
+ i && o(i);
15
+ };
16
+ return /* @__PURE__ */ t("div", {
17
+ "data-testid": "md-template-type-picker-tiles",
18
+ children: /* @__PURE__ */ t(l, {
19
+ name: "field-type-picker",
20
+ value: void 0,
21
+ columns: 5,
22
+ "aria-label": r(m.selectFieldTypeAriaLabel),
23
+ onChange: n,
24
+ children: a.availableFieldTypes.map((e) => /* @__PURE__ */ t(l.Option, {
25
+ value: e.type,
26
+ label: e.label,
27
+ icon: /* @__PURE__ */ t(e.Icon, {
28
+ height: 32,
29
+ width: 32,
30
+ color: p,
31
+ "aria-hidden": !0
32
+ })
33
+ }, e.type))
34
+ })
35
+ });
36
+ }
37
+ export {
38
+ g as FieldTypeTiles,
39
+ g as default
40
+ };
@@ -0,0 +1,4 @@
1
+ import { FieldTypeTiles as l } from "./field-type-tiles.js";
2
+ export {
3
+ l as FieldTypeTiles
4
+ };
@@ -0,0 +1,14 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const a = e({
3
+ heading: {
4
+ id: "groupSharedFeatures.metadataTemplateEditor.emptyState.heading",
5
+ defaultMessage: "Add your first field"
6
+ },
7
+ selectFieldTypeAriaLabel: {
8
+ id: "groupSharedFeatures.metadataTemplateEditor.emptyState.selectFieldTypeAriaLabel",
9
+ defaultMessage: "Select the field type."
10
+ }
11
+ });
12
+ export {
13
+ a as emptyStateMessages
14
+ };
@@ -0,0 +1,46 @@
1
+ import { Modal as e } from "@box/blueprint-web";
2
+ import { useIntl as m } from "react-intl";
3
+ import n from "./messages.js";
4
+ import { jsx as o, jsxs as l } from "react/jsx-runtime";
5
+ const B = ({
6
+ onClose: t,
7
+ onConfirm: a,
8
+ title: i,
9
+ body: c,
10
+ confirmLabel: s,
11
+ cancelLabel: d
12
+ }) => {
13
+ const {
14
+ formatMessage: r
15
+ } = m();
16
+ return /* @__PURE__ */ o(e, {
17
+ onOpenChange: t,
18
+ open: !0,
19
+ children: /* @__PURE__ */ l(e.Content, {
20
+ size: "small",
21
+ children: [/* @__PURE__ */ o(e.Header, {
22
+ children: i
23
+ }), /* @__PURE__ */ o(e.ScrollableContainer, {
24
+ children: /* @__PURE__ */ o(e.Body, {
25
+ className: "confirmationModal-body",
26
+ children: c
27
+ })
28
+ }), /* @__PURE__ */ l(e.Footer, {
29
+ children: [/* @__PURE__ */ o(e.Footer.SecondaryButton, {
30
+ onClick: t,
31
+ size: "large",
32
+ children: d ?? r(n.cancelButtonText)
33
+ }), /* @__PURE__ */ o(e.Footer.PrimaryButton, {
34
+ onClick: a,
35
+ size: "large",
36
+ children: s ?? r(n.confirmButtonText)
37
+ })]
38
+ }), /* @__PURE__ */ o(e.Close, {
39
+ "aria-label": r(n.closeButtonAriaLabel)
40
+ })]
41
+ })
42
+ });
43
+ };
44
+ export {
45
+ B as default
46
+ };
@@ -0,0 +1,18 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const t = e({
3
+ cancelButtonText: {
4
+ id: "groupSharedFeatures.metadataTemplateEditor.confirmationModal.cancelButtonText",
5
+ defaultMessage: "Cancel"
6
+ },
7
+ closeButtonAriaLabel: {
8
+ id: "groupSharedFeatures.metadataTemplateEditor.confirmationModal.closeButtonAriaLabel",
9
+ defaultMessage: "Close"
10
+ },
11
+ confirmButtonText: {
12
+ id: "groupSharedFeatures.metadataTemplateEditor.confirmationModal.confirmButtonText",
13
+ defaultMessage: "Confirm"
14
+ }
15
+ });
16
+ export {
17
+ t as default
18
+ };
@@ -0,0 +1,80 @@
1
+ import { useIntl as T } from "react-intl";
2
+ import { Status as F, Tabs as l } from "@box/blueprint-web";
3
+ import { Hidden as M, Pencil as C } from "@box/blueprint-web-assets/icons/Line";
4
+ import { DragDots as L } from "@box/blueprint-web-assets/icons/Fill";
5
+ import { SurfaceStatusSurfaceGray as w } from "@box/blueprint-web-assets/tokens/tokens";
6
+ import { FieldContextMenu as x } from "../field-context-menu/field-context-menu.js";
7
+ import { general as o } from "../../messages/configurator-messages.js";
8
+ import { s as n } from "../../../../../../chunks/metadata-field-configurator.module.js";
9
+ import { jsxs as s, Fragment as j, jsx as t } from "react/jsx-runtime";
10
+ const B = ({
11
+ isExpanded: h,
12
+ isHidden: m,
13
+ index: i,
14
+ maxIndex: u,
15
+ dndDragHandleProps: e,
16
+ onDragStart: c,
17
+ onDragEnd: b,
18
+ onTouchStart: f,
19
+ onReorderFields: p,
20
+ onToggleVisibility: S,
21
+ onRequestDelete: v,
22
+ onRequestDuplicate: g,
23
+ extensions: d
24
+ }) => {
25
+ const r = T();
26
+ return /* @__PURE__ */ s(j, {
27
+ children: [m && /* @__PURE__ */ t(F, {
28
+ icon: M,
29
+ iconPosition: "left",
30
+ color: w,
31
+ text: r.formatMessage(o.hiddenStatus).toUpperCase()
32
+ }), h === !1 && /* @__PURE__ */ t("div", {
33
+ draggable: !e,
34
+ className: n.dragHandle,
35
+ onDragStart: !e && c ? (a) => c(a, i) : void 0,
36
+ onDragEnd: !e && b ? (a) => b(a, i) : void 0,
37
+ onTouchStart: !e && f ? (a) => f(a, i) : void 0,
38
+ ...e?.listeners ?? {},
39
+ ...e?.attributes ?? {},
40
+ "aria-label": r.formatMessage(o.dragAndDropFieldAriaLabel),
41
+ tabIndex: e ? void 0 : -1,
42
+ children: /* @__PURE__ */ t(L, {
43
+ fontSize: 20,
44
+ "aria-label": r.formatMessage(o.dragAndDropFieldAriaLabel)
45
+ })
46
+ }), /* @__PURE__ */ s("div", {
47
+ className: n.expandedToolbarActions,
48
+ children: [d.length > 0 && /* @__PURE__ */ s(l.TabList, {
49
+ variant: "contentSwitcher",
50
+ containerClassname: n.extensionTabsContainer,
51
+ children: [/* @__PURE__ */ t(l.Tab, {
52
+ id: "edit",
53
+ variant: "contentSwitcher",
54
+ "aria-label": r.formatMessage(o.editTabAriaLabel),
55
+ children: /* @__PURE__ */ t(C, {
56
+ "aria-hidden": "true"
57
+ })
58
+ }), d.map((a, A) => /* @__PURE__ */ t(l.Tab, {
59
+ id: `ext-${A}`,
60
+ variant: "contentSwitcher",
61
+ "aria-label": a.label,
62
+ children: /* @__PURE__ */ t(a.icon, {
63
+ "aria-hidden": "true"
64
+ })
65
+ }, a.label))]
66
+ }), /* @__PURE__ */ t(x, {
67
+ index: i,
68
+ maxIndex: u,
69
+ isHidden: m,
70
+ onReorderFields: p,
71
+ onToggleVisibility: S,
72
+ onRequestDelete: v,
73
+ onRequestDuplicate: g
74
+ })]
75
+ })]
76
+ });
77
+ };
78
+ export {
79
+ B as FieldActionSlot
80
+ };
@@ -0,0 +1,115 @@
1
+ import { DropdownMenu as t, IconButton as b, Divider as x, Text as _ } from "@box/blueprint-web";
2
+ import { Ellipsis as w } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { ArrowUp as F, ArrowDown as C, TwoFiles as N, Visible as T, Hidden as A, Trash as L } from "@box/blueprint-web-assets/icons/Line";
4
+ import { IconIconErrorOnLight as D } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import m from "react";
6
+ import { useIntl as k, FormattedMessage as l } from "react-intl";
7
+ import { general as n } from "../../messages/configurator-messages.js";
8
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
9
+ import '../../../../../../styles/field-context-menu.css';const O = "_contextMenuTrigger_102vn_1", U = "_menuItem_102vn_5", E = "_contextMenu_102vn_1", R = "_divider_102vn_14", r = {
10
+ contextMenuTrigger: O,
11
+ menuItem: U,
12
+ contextMenu: E,
13
+ divider: R
14
+ }, J = ({
15
+ index: a,
16
+ maxIndex: d,
17
+ isHidden: s,
18
+ onReorderFields: c,
19
+ onToggleVisibility: u,
20
+ onRequestDelete: h,
21
+ onRequestDuplicate: g
22
+ }) => {
23
+ const o = k(), [M, p] = m.useState(!1), f = m.useRef(null), v = () => {
24
+ a > 0 && c(a, a - 1);
25
+ }, I = () => {
26
+ c(a, a + 1);
27
+ };
28
+ return /* @__PURE__ */ i(t.Root, {
29
+ open: M,
30
+ onOpenChange: p,
31
+ modal: !1,
32
+ children: [/* @__PURE__ */ e(t.Trigger, {
33
+ className: r.contextMenuTrigger,
34
+ children: /* @__PURE__ */ e(b, {
35
+ icon: w,
36
+ "aria-label": o.formatMessage(n.contextMenuAriaLabel),
37
+ size: "large"
38
+ })
39
+ }), /* @__PURE__ */ i(t.Content, {
40
+ ref: f,
41
+ align: "end",
42
+ className: r.contextMenu,
43
+ children: [/* @__PURE__ */ e(t.Item, {
44
+ disabled: a === 0,
45
+ onClick: v,
46
+ "aria-label": o.formatMessage(n.moveUpAriaLabel),
47
+ children: /* @__PURE__ */ i("div", {
48
+ className: r.menuItem,
49
+ children: [/* @__PURE__ */ e(F, {
50
+ "aria-hidden": "true"
51
+ }), /* @__PURE__ */ e(l, {
52
+ ...n.moveUp
53
+ })]
54
+ })
55
+ }), /* @__PURE__ */ e(t.Item, {
56
+ disabled: a === d,
57
+ onClick: I,
58
+ "aria-label": o.formatMessage(n.moveDownAriaLabel),
59
+ children: /* @__PURE__ */ i("div", {
60
+ className: r.menuItem,
61
+ children: [/* @__PURE__ */ e(C, {
62
+ "aria-hidden": "true"
63
+ }), /* @__PURE__ */ e(l, {
64
+ ...n.moveDown
65
+ })]
66
+ })
67
+ }), /* @__PURE__ */ e(t.Item, {
68
+ onClick: g,
69
+ "aria-label": o.formatMessage(n.duplicateFieldAriaLabel),
70
+ children: /* @__PURE__ */ i("div", {
71
+ className: r.menuItem,
72
+ children: [/* @__PURE__ */ e(N, {
73
+ "aria-hidden": "true"
74
+ }), /* @__PURE__ */ e(l, {
75
+ ...n.duplicateField
76
+ })]
77
+ })
78
+ }), /* @__PURE__ */ e(t.Item, {
79
+ onClick: () => u(!s),
80
+ "aria-label": o.formatMessage(s ? n.showField : n.hideField),
81
+ children: /* @__PURE__ */ i("div", {
82
+ className: r.menuItem,
83
+ children: [s ? /* @__PURE__ */ e(T, {
84
+ "aria-hidden": "true"
85
+ }) : /* @__PURE__ */ e(A, {
86
+ "aria-hidden": "true"
87
+ }), /* @__PURE__ */ e(l, {
88
+ ...s ? n.showField : n.hideField
89
+ })]
90
+ })
91
+ }), /* @__PURE__ */ e(x, {
92
+ className: r.divider
93
+ }), /* @__PURE__ */ e(t.Item, {
94
+ onClick: h,
95
+ "aria-label": o.formatMessage(n.deleteFieldAriaLabel),
96
+ children: /* @__PURE__ */ i("div", {
97
+ className: r.menuItem,
98
+ children: [/* @__PURE__ */ e(L, {
99
+ color: D,
100
+ "aria-hidden": "true"
101
+ }), /* @__PURE__ */ e(_, {
102
+ as: "span",
103
+ color: "textOnLightError",
104
+ children: /* @__PURE__ */ e(l, {
105
+ ...n.deleteField
106
+ })
107
+ })]
108
+ })
109
+ })]
110
+ })]
111
+ });
112
+ };
113
+ export {
114
+ J as FieldContextMenu
115
+ };
@@ -0,0 +1,101 @@
1
+ import { useMemo as x } from "react";
2
+ import { useIntl as L } from "react-intl";
3
+ import { TooltipProvider as B, TextWithInfoBadge as N, TextInput as u, Select as s } from "@box/blueprint-web";
4
+ import { useFieldConfigurator as O } from "../../context/field-configurator-context.js";
5
+ import { useFieldOptions as P } from "../../../../utils/field-options/useFieldOptions.js";
6
+ import { F as h } from "../../../../../../chunks/types.js";
7
+ import { getConfigurationByType as R } from "../../utils.js";
8
+ import { general as i } from "../../messages/configurator-messages.js";
9
+ import { s as o } from "../../../../../../chunks/metadata-field-configurator.module.js";
10
+ import { jsx as e, jsxs as g } from "react/jsx-runtime";
11
+ const z = ({
12
+ nameInputId: b,
13
+ descriptionInputId: t,
14
+ isTypeEditable: d,
15
+ externalErrors: c,
16
+ externalTouched: y,
17
+ handleTypeChange: v
18
+ }) => {
19
+ const r = L(), F = P(), {
20
+ values: a,
21
+ errors: M,
22
+ touched: C,
23
+ handleChange: m,
24
+ handleBlur: p
25
+ } = O(), f = (l) => {
26
+ if (c && y?.[l])
27
+ return c[l];
28
+ const n = M[l];
29
+ if (C[l] && n != null && typeof n == "string")
30
+ return n;
31
+ }, T = x(() => /* @__PURE__ */ e(B, {
32
+ children: /* @__PURE__ */ e(N, {
33
+ infoBadgeAriaLabel: r.formatMessage(i.descriptionLearnMoreBadgeAriaLabel),
34
+ infoText: r.formatMessage(i.descriptionInfoTooltip),
35
+ children: /* @__PURE__ */ e("label", {
36
+ className: o.labelWithTooltip,
37
+ htmlFor: t,
38
+ children: r.formatMessage(i.fieldDescriptionLabel)
39
+ })
40
+ })
41
+ }), [r, t]);
42
+ return /* @__PURE__ */ e("fieldset", {
43
+ disabled: a.isFieldReadOnly,
44
+ className: o.fieldset,
45
+ children: /* @__PURE__ */ g("div", {
46
+ className: o.expandedContent,
47
+ children: [/* @__PURE__ */ g("div", {
48
+ className: o.basic,
49
+ children: [/* @__PURE__ */ e(u, {
50
+ name: "name",
51
+ id: b,
52
+ label: r.formatMessage(i.fieldNameLabel),
53
+ placeholder: r.formatMessage(i.fieldNameInputPlaceholder),
54
+ value: a.name,
55
+ error: f("name"),
56
+ onChange: m,
57
+ onBlur: p,
58
+ disabled: a.isFieldReadOnly,
59
+ required: !0
60
+ }), /* @__PURE__ */ e(s, {
61
+ name: "type",
62
+ label: r.formatMessage(i.fieldTypeLabel),
63
+ placeholder: r.formatMessage(i.fieldTypePlaceholder),
64
+ value: a.type,
65
+ "aria-readonly": !d,
66
+ readonly: !d,
67
+ disabled: a.isFieldReadOnly,
68
+ onValueChange: v,
69
+ className: o.fieldTypeSelect,
70
+ required: !0,
71
+ children: /* @__PURE__ */ e(s.Content, {
72
+ children: F.availableFieldTypes.map((l) => /* @__PURE__ */ e(s.Option, {
73
+ text: typeof l.label == "string" ? l.label : String(l.label),
74
+ value: l.type
75
+ }, l.type))
76
+ })
77
+ })]
78
+ }), [h.Dropdown, h.Taxonomy].includes(a.type) && /* @__PURE__ */ e("div", {
79
+ className: o.typeSpecific,
80
+ children: R(a.type)
81
+ }), /* @__PURE__ */ e("div", {
82
+ className: o.description,
83
+ children: /* @__PURE__ */ e(u, {
84
+ name: "description",
85
+ id: t,
86
+ label: T,
87
+ placeholder: r.formatMessage(i.fieldDescriptionInputPlaceholder),
88
+ value: a.description ?? "",
89
+ error: f("description"),
90
+ hideLabel: !0,
91
+ disabled: a.isFieldReadOnly,
92
+ onChange: m,
93
+ onBlur: p
94
+ })
95
+ })]
96
+ })
97
+ });
98
+ };
99
+ export {
100
+ z as FieldEditContent
101
+ };
@@ -0,0 +1,33 @@
1
+ import { Text as n } from "@box/blueprint-web";
2
+ import i from "clsx";
3
+ import { useIntl as a } from "react-intl";
4
+ import c from "../../messages/levels-chain-messages.js";
5
+ import { jsx as d } from "react/jsx-runtime";
6
+ import '../../../../../../styles/chip.css';const m = "_chip_x2zx9_1", p = "_selected_x2zx9_12", l = {
7
+ chip: m,
8
+ selected: p
9
+ };
10
+ let o = /* @__PURE__ */ (function(e) {
11
+ return e.Selected = "selected", e.Unselected = "unselected", e;
12
+ })({});
13
+ const S = ({
14
+ value: e,
15
+ selected: t = !1
16
+ }) => {
17
+ const {
18
+ formatMessage: s
19
+ } = a(), r = s(t ? c.chipSelected : c.chipNotSelected);
20
+ return /* @__PURE__ */ d(n, {
21
+ as: "span",
22
+ className: i(l.chip, {
23
+ [l.selected]: t
24
+ }),
25
+ "data-state": t ? o.Selected : o.Unselected,
26
+ "aria-label": `${e}: ${r}`,
27
+ children: e
28
+ });
29
+ };
30
+ export {
31
+ S as Chip,
32
+ o as ChipState
33
+ };
@@ -0,0 +1,4 @@
1
+ import { LevelsChain as r } from "./levels-chain.js";
2
+ export {
3
+ r as LevelsChain
4
+ };
@@ -0,0 +1,118 @@
1
+ import { Tooltip as N, Text as P } from "@box/blueprint-web";
2
+ import { ArrowRight as _ } from "@box/blueprint-web-assets/icons/Line";
3
+ import { IconIconOnLightSecondary as k } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import { useState as u, useRef as b, useMemo as v, useEffect as A, useLayoutEffect as q } from "react";
5
+ import { FormattedMessage as F } from "react-intl";
6
+ import O from "../../messages/levels-chain-messages.js";
7
+ import { Chip as L } from "./chip.js";
8
+ import { getHideCounts as $ } from "./utils.js";
9
+ import { jsx as l, jsxs as m } from "react/jsx-runtime";
10
+ import '../../../../../../styles/levels-chain.css';const D = "_levelsChain_1wuki_1", y = {
11
+ levelsChain: D
12
+ };
13
+ function G(t) {
14
+ const a = Math.ceil(t.length / 2);
15
+ return [t.slice(0, a), t.slice(a)];
16
+ }
17
+ const te = ({
18
+ levels: t = [],
19
+ selectedLevels: a = []
20
+ }) => {
21
+ const [n, h] = G(t), [r, C] = u(!1), [w, E] = u([]), [R, M] = u([]), [W, H] = u(0), [x, I] = u(0), s = b(null), g = b(null), S = v(() => {
22
+ const e = s.current ? window.getComputedStyle(s.current) : {
23
+ gap: "11px"
24
+ };
25
+ return parseInt(e.gap, 10);
26
+ }, [s.current]), f = /* @__PURE__ */ l(_, {
27
+ color: k,
28
+ "aria-hidden": "true"
29
+ });
30
+ A(() => {
31
+ C(!1);
32
+ }, [t]), q(() => {
33
+ if (s.current && !r && t.length > 0) {
34
+ const e = s.current;
35
+ I(e.clientWidth);
36
+ const i = e.querySelectorAll("li"), o = Array.from(i).slice(0, n.length), z = Array.from(i).slice(n.length + 1);
37
+ E(o.map((p) => p.getBoundingClientRect().width)), M(z.map((p) => p.getBoundingClientRect().width)), g.current && H(g.current.getBoundingClientRect().width), C(!0);
38
+ }
39
+ }, [n, h, r, t.length]), A(() => {
40
+ const e = () => {
41
+ s.current && I(s.current.clientWidth);
42
+ };
43
+ return window.addEventListener("resize", e), () => {
44
+ window.removeEventListener("resize", e);
45
+ };
46
+ }, []);
47
+ const [d, c] = v(() => $({
48
+ isMeasured: r,
49
+ leftLevelWidths: w,
50
+ rightLevelWidths: R,
51
+ containerWidthPx: x,
52
+ buttonWidthPx: W,
53
+ gapBetweenItems: S
54
+ }), [r, w, R, x, W, S]), B = v(() => {
55
+ const e = n.slice(n.length - d), i = h.slice(0, c);
56
+ return [...e, ...i];
57
+ }, [d, c, n, h]), T = B.some((e) => a.includes(e.level)), j = () => r ? d > 0 || c > 0 ? {} : {
58
+ display: "none"
59
+ } : {
60
+ position: "absolute",
61
+ visibility: "hidden"
62
+ };
63
+ return t.length === 0 ? /* @__PURE__ */ l("div", {
64
+ role: "alert",
65
+ children: /* @__PURE__ */ l(F, {
66
+ ...O.noLevels
67
+ })
68
+ }) : /* @__PURE__ */ m("ul", {
69
+ ref: s,
70
+ className: y.levelsChain,
71
+ "data-testid": "taxonomy-levels-chain",
72
+ children: [n.map((e, i) => {
73
+ const o = r && i >= n.length - d;
74
+ return /* @__PURE__ */ m("li", {
75
+ className: y.left,
76
+ style: {
77
+ display: o ? "none" : void 0
78
+ },
79
+ "aria-hidden": o,
80
+ children: [/* @__PURE__ */ l(L, {
81
+ value: e.name,
82
+ selected: a.includes(e.level)
83
+ }), n.length + h.length > 1 ? f : null]
84
+ }, e.level);
85
+ }), /* @__PURE__ */ m("li", {
86
+ ref: g,
87
+ style: j(),
88
+ "aria-hidden": !(d > 0 || c > 0),
89
+ tabIndex: r && (d > 0 || c > 0) ? 0 : -1,
90
+ children: [/* @__PURE__ */ l(N, {
91
+ content: B.map((e) => e.name).join(" > "),
92
+ children: /* @__PURE__ */ l(P, {
93
+ as: "span",
94
+ children: /* @__PURE__ */ l(L, {
95
+ value: `+${d + c}`,
96
+ selected: T
97
+ })
98
+ })
99
+ }), f]
100
+ }), h.map((e, i) => {
101
+ const o = r && i < c;
102
+ return /* @__PURE__ */ m("li", {
103
+ className: y.right,
104
+ style: {
105
+ display: o ? "none" : void 0
106
+ },
107
+ "aria-hidden": o,
108
+ children: [/* @__PURE__ */ l(L, {
109
+ value: e.name,
110
+ selected: a.includes(e.level)
111
+ }), i < h.length - 1 && f]
112
+ }, e.level);
113
+ })]
114
+ });
115
+ };
116
+ export {
117
+ te as LevelsChain
118
+ };
@@ -0,0 +1,34 @@
1
+ const C = ({
2
+ isMeasured: h,
3
+ leftLevelWidths: t,
4
+ rightLevelWidths: o,
5
+ containerWidthPx: s,
6
+ buttonWidthPx: r,
7
+ gapBetweenItems: a
8
+ }) => {
9
+ if (!h)
10
+ return [0, 0];
11
+ const b = t.length + o.length;
12
+ if ([...t, ...o].reduce((u, c) => u + c, 0) + (b - 1) * a <= s)
13
+ return [0, 0];
14
+ let n = 0, e = 0, l = 0;
15
+ for (; n < t.length || e < o.length; ) {
16
+ const u = t.slice(0, t.length - n), c = o.slice(e), f = u.length + c.length + 1;
17
+ if (u.reduce((i, g) => i + g, 0) + r + c.reduce((i, g) => i + g, 0) + (f - 1) * a <= s)
18
+ break;
19
+ if (l === 0 && n < t.length)
20
+ n += 1, l = 1;
21
+ else if (l === 1 && e < o.length)
22
+ e += 1, l = 0;
23
+ else if (n < t.length)
24
+ n += 1;
25
+ else if (e < o.length)
26
+ e += 1;
27
+ else
28
+ break;
29
+ }
30
+ return [n, e];
31
+ };
32
+ export {
33
+ C as getHideCounts
34
+ };
@@ -0,0 +1,33 @@
1
+ import { F as e } from "../../../../../../../../chunks/types.js";
2
+ import { taxonomyDefaultValues as o } from "../../taxonomy/taxonomy-default-values.js";
3
+ const i = [{
4
+ id: "option1",
5
+ key: "Option 1",
6
+ isNew: !0
7
+ }, {
8
+ id: "option2",
9
+ key: "Option 2",
10
+ isNew: !0
11
+ }, {
12
+ id: "option3",
13
+ key: "Option 3",
14
+ isNew: !0
15
+ }], l = () => ({
16
+ id: "mock-dropdown-field",
17
+ key: "test",
18
+ type: e.Dropdown,
19
+ name: "Test",
20
+ description: "",
21
+ hidden: !1,
22
+ isFieldNew: !0,
23
+ isFieldReadOnly: !1,
24
+ dropdown: {
25
+ options: i,
26
+ allowMultipleSelections: !1,
27
+ isAllowMultipleSelectionsEnabled: !0
28
+ },
29
+ taxonomy: o.taxonomy
30
+ });
31
+ export {
32
+ l as getInitialValues
33
+ };
@@ -0,0 +1,15 @@
1
+ import e from "lodash/uniqueId";
2
+ const l = () => ({
3
+ dropdown: {
4
+ options: [{
5
+ id: e(),
6
+ key: "Option 1",
7
+ isNew: !0
8
+ }],
9
+ allowMultipleSelections: !1,
10
+ isAllowMultipleSelectionsEnabled: !0
11
+ }
12
+ });
13
+ export {
14
+ l as getDropdownDefaultValues
15
+ };