@box/metadata-editor 0.62.0 → 0.64.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 (64) hide show
  1. package/chunks/metadata-editor-field-wrapper.js +55 -50
  2. package/esm/index.js +26 -26
  3. package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +140 -135
  4. package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +37 -43
  5. package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +38 -44
  6. package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +30 -36
  7. package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +39 -47
  8. package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +28 -34
  9. package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +54 -0
  10. package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +49 -48
  11. package/esm/lib/components/metadata-editor-fields/editor-field-types.js +19 -15
  12. package/esm/lib/components/metadata-editor-fields/utils.js +13 -0
  13. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +48 -46
  14. package/esm/lib/defaults.js +2 -1
  15. package/esm/lib/messages.js +4 -0
  16. package/i18n/bn-IN.js +1 -0
  17. package/i18n/da-DK.js +1 -0
  18. package/i18n/de-DE.js +1 -0
  19. package/i18n/en-AU.js +1 -0
  20. package/i18n/en-CA.js +1 -0
  21. package/i18n/en-GB.js +1 -0
  22. package/i18n/en-US.js +1 -0
  23. package/i18n/en-US.properties +2 -0
  24. package/i18n/en-x-pseudo.js +1 -0
  25. package/i18n/es-419.js +1 -0
  26. package/i18n/es-ES.js +1 -0
  27. package/i18n/fi-FI.js +1 -0
  28. package/i18n/fr-CA.js +1 -0
  29. package/i18n/fr-FR.js +1 -0
  30. package/i18n/hi-IN.js +1 -0
  31. package/i18n/it-IT.js +1 -0
  32. package/i18n/ja-JP.js +1 -0
  33. package/i18n/json/src/lib/messages.json +1 -1
  34. package/i18n/ko-KR.js +1 -0
  35. package/i18n/nb-NO.js +1 -0
  36. package/i18n/nl-NL.js +1 -0
  37. package/i18n/pl-PL.js +1 -0
  38. package/i18n/pt-BR.js +1 -0
  39. package/i18n/ru-RU.js +1 -0
  40. package/i18n/sv-SE.js +1 -0
  41. package/i18n/tr-TR.js +1 -0
  42. package/i18n/zh-CN.js +1 -0
  43. package/i18n/zh-TW.js +1 -0
  44. package/package.json +2 -2
  45. package/types/index.d.ts +1 -1
  46. package/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +16 -2
  47. package/types/lib/components/combobox-with-api-pagination/index.d.ts +1 -1
  48. package/types/lib/components/combobox-with-api-pagination/types.d.ts +5 -8
  49. package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.d.ts +3 -0
  50. package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.d.ts +6 -21
  51. package/types/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.d.ts +2 -1
  52. package/types/lib/components/metadata-editor-fields/editor-field-types.d.ts +1 -0
  53. package/types/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.d.ts +1 -0
  54. package/types/lib/components/metadata-editor-fields/types.d.ts +5 -0
  55. package/types/lib/components/metadata-editor-fields/utils.d.ts +3 -0
  56. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +4 -2
  57. package/types/lib/components/metadata-instance-editor/types.d.ts +2 -4
  58. package/types/lib/messages.d.ts +5 -0
  59. package/types/lib/test-utils/sample-data.d.ts +4 -1
  60. package/types/lib/types.d.ts +11 -3
  61. package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/index.js +0 -4
  62. package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.js +0 -8
  63. package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/index.d.ts +0 -2
  64. package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.d.ts +0 -5
@@ -1,75 +1,80 @@
1
1
  import "../styles/metadata-editor-field-wrapper.css";
2
- import y from "clsx";
3
- import { useFormikContext as F } from "formik";
4
- import h from "lodash/isUndefined";
5
- import { forwardRef as A, useState as W } from "react";
6
- import { AiSuggestionField as M } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
7
- import { UpdateModeFieldWrapper as N } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
8
- import { editorFieldTypes as q } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
9
- import { jsx as o, jsxs as T } from "react/jsx-runtime";
10
- const b = "_noAttributesText_1xlmq_1", v = "_fieldWrapper_1xlmq_5", P = "_hasSuggestion_1xlmq_5", $ = "_error_1xlmq_13", k = "_dateField_1xlmq_25", a = {
11
- noAttributesText: b,
12
- fieldWrapper: v,
13
- hasSuggestion: P,
2
+ import A from "clsx";
3
+ import { useFormikContext as M } from "formik";
4
+ import W from "lodash/isUndefined";
5
+ import { forwardRef as T, useState as q } from "react";
6
+ import { AiSuggestionField as N } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
7
+ import { UpdateModeFieldWrapper as b } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
8
+ import { editorFieldTypes as v } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
9
+ import { jsx as s, jsxs as k } from "react/jsx-runtime";
10
+ const w = "_noAttributesText_1xlmq_1", P = "_fieldWrapper_1xlmq_5", U = "_hasSuggestion_1xlmq_5", $ = "_error_1xlmq_13", j = "_dateField_1xlmq_25", n = {
11
+ noAttributesText: w,
12
+ fieldWrapper: P,
13
+ hasSuggestion: U,
14
14
  error: $,
15
- dateField: k
16
- }, B = /* @__PURE__ */ A(({
17
- disableForm: n,
15
+ dateField: j
16
+ }, H = /* @__PURE__ */ T(({
17
+ disableForm: a,
18
18
  portalElement: p,
19
19
  field: e,
20
- index: d
21
- }, l) => {
20
+ index: g,
21
+ taxonomyOptionsFetcher: l
22
+ }, d) => {
23
+ var c;
22
24
  const {
23
- setFieldValue: m
24
- } = F(), [c, i] = W(!0), r = q[e.type], g = r && !e.hidden, f = !h(e.updateMode), s = `metadata.fields[${d}]`;
25
- if (!g)
25
+ setFieldValue: u
26
+ } = M(), [S, i] = q(!0), r = v[e.type], x = r && !e.hidden, _ = !W(e.updateMode), t = `metadata.fields[${g}]`, y = e.type === "taxonomy" && ((c = e.optionsRules) == null ? void 0 : c.multiSelect);
27
+ if (!x)
26
28
  return null;
27
- if (f)
28
- return /* @__PURE__ */ o(N, {
29
- fieldNamePrefix: s,
29
+ if (_)
30
+ return /* @__PURE__ */ s(b, {
31
+ fieldNamePrefix: t,
30
32
  fieldType: e.type,
31
- children: /* @__PURE__ */ o(r, {
32
- ref: l,
33
+ isTaxonomyMultiSelect: y,
34
+ children: /* @__PURE__ */ s(r, {
35
+ ref: d,
33
36
  description: e.description,
34
- disableForm: n,
35
- fieldNamePrefix: s,
37
+ disableForm: a,
38
+ fieldNamePrefix: t,
36
39
  label: e.displayName,
37
- portalElement: p
40
+ portalElement: p,
41
+ taxonomyOptionsFetcher: l
38
42
  })
39
43
  }, e.key);
40
44
  const {
41
- aiSuggestion: t,
42
- type: _,
43
- value: x
44
- } = e, u = t && c;
45
- return /* @__PURE__ */ T("div", {
46
- className: a.fieldWrapper,
47
- children: [/* @__PURE__ */ o(r, {
48
- ref: l,
49
- className: y({
50
- [a.hasSuggestions]: u,
51
- [a.dateField]: e.type === "date"
45
+ aiSuggestion: o,
46
+ type: f,
47
+ value: F
48
+ } = e, m = o && S;
49
+ return /* @__PURE__ */ k("div", {
50
+ className: n.fieldWrapper,
51
+ children: [/* @__PURE__ */ s(r, {
52
+ ref: d,
53
+ className: A({
54
+ [n.hasSuggestions]: m,
55
+ [n.dateField]: e.type === "date"
52
56
  }),
53
57
  description: e.description,
54
- disableForm: n,
55
- fieldNamePrefix: `metadata.fields[${d}]`,
58
+ disableForm: a,
59
+ fieldNamePrefix: t,
56
60
  label: e.displayName,
57
- portalElement: p
58
- }), u && /* @__PURE__ */ o(M, {
59
- aiSuggestion: t,
61
+ portalElement: p,
62
+ taxonomyOptionsFetcher: l
63
+ }), m && /* @__PURE__ */ s(N, {
64
+ aiSuggestion: o,
60
65
  onAiSuggestionAppend: () => {
61
- const S = e.type === "multiSelect" ? [x, t].flat() : t;
62
- m(`${s}.value`, S), i(!1);
66
+ const h = e.type === "multiSelect" ? [F, o].flat() : o;
67
+ u(`${t}.value`, h), i(!1);
63
68
  },
64
69
  onAiSuggestionIgnore: () => i(!1),
65
70
  onAiSuggestionReplace: () => {
66
- m(`${s}.value`, t), i(!1);
71
+ u(`${t}.value`, o), i(!1);
67
72
  },
68
- type: _
73
+ type: f
69
74
  })]
70
75
  }, e.key);
71
76
  });
72
77
  export {
73
- B as M,
74
- a as s
78
+ H as M,
79
+ n as s
75
80
  };
package/esm/index.js CHANGED
@@ -1,37 +1,37 @@
1
1
  import { AddMetadataTemplateDropdown as o } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
2
- import { FilterDropdownMenu as r } from "./lib/components/filter-dropdown-menu/index.js";
3
- import { SingleLevelTaxonomyField as p } from "./lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.js";
2
+ import { ComboboxWithApiPagination as r } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
3
+ import { FilterDropdownMenu as d } from "./lib/components/filter-dropdown-menu/index.js";
4
4
  import { MetadataEmptyState as f } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
5
- import { DeleteConfirmationModal as l } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
6
- import { MetadataInstanceFormHeader as i } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
5
+ import { DeleteConfirmationModal as x } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
6
+ import { MetadataInstanceFormHeader as l } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
7
7
  import { CustomInstanceNewField as s } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
8
- import { MetadataInstanceForm as I } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
9
- import { MetadataInstanceList as A } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
10
- import { MetadataInstanceHeader as F } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
11
- import { UnsavedChangesModal as v } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
12
- import { defaultInitialValues as U, defaultMetadataValueMap as g } from "./lib/defaults.js";
13
- import { MetadataEditor as y } from "./lib/metadata-editor.js";
8
+ import { MetadataInstanceForm as A } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
9
+ import { MetadataInstanceList as I } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
10
+ import { MetadataInstanceHeader as w } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
11
+ import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
12
+ import { defaultInitialValues as U, defaultMetadataValueMap as b } from "./lib/defaults.js";
13
+ import { MetadataEditor as v } from "./lib/metadata-editor.js";
14
14
  import { U as H } from "../chunks/types.js";
15
- import { AutofillContext as S, AutofillContextProvider as T, useAutofill as V } from "./lib/utils/autofill-context.js";
16
- import { withApiWrapper as P } from "./lib/utils/api-wrapper.js";
15
+ import { AutofillContext as V, AutofillContextProvider as W, useAutofill as y } from "./lib/utils/autofill-context.js";
16
+ import { withApiWrapper as N } from "./lib/utils/api-wrapper.js";
17
17
  export {
18
18
  o as AddMetadataTemplateDropdown,
19
- S as AutofillContext,
20
- T as AutofillContextProvider,
19
+ V as AutofillContext,
20
+ W as AutofillContextProvider,
21
+ r as ComboboxWithApiPagination,
21
22
  s as CustomInstanceNewField,
22
- l as DeleteConfirmationModal,
23
- r as FilterDropdownMenu,
24
- y as MetadataEditor,
23
+ x as DeleteConfirmationModal,
24
+ d as FilterDropdownMenu,
25
+ v as MetadataEditor,
25
26
  f as MetadataEmptyState,
26
- I as MetadataInstanceForm,
27
- i as MetadataInstanceFormHeader,
28
- F as MetadataInstanceHeader,
29
- A as MetadataInstanceList,
30
- p as SingleLevelTaxonomyField,
31
- v as UnsavedChangesModal,
27
+ A as MetadataInstanceForm,
28
+ l as MetadataInstanceFormHeader,
29
+ w as MetadataInstanceHeader,
30
+ I as MetadataInstanceList,
31
+ h as UnsavedChangesModal,
32
32
  H as UpdateMode,
33
33
  U as defaultInitialValues,
34
- g as defaultMetadataValueMap,
35
- V as useAutofill,
36
- P as withApiWrapper
34
+ b as defaultMetadataValueMap,
35
+ y as useAutofill,
36
+ N as withApiWrapper
37
37
  };
@@ -1,48 +1,49 @@
1
1
  import "../../../../styles/combobox-with-api-pagination.css";
2
- import { ComboboxItemValue as Q } from "@ariakit/react";
3
- import { Combobox as p, LoadingIndicator as X, InlineNotice as Y, Text as Z } from "@box/blueprint-web";
4
- import { Search as $, Loader as oo } from "@box/blueprint-web-assets/icons/Fill";
5
- import { IconIconOnLightSecondary as eo, Size6 as y, Size1 as to } from "@box/blueprint-web-assets/tokens/tokens";
6
- import ro from "clsx";
7
- import { useRef as v, useCallback as no, useMemo as _, useEffect as ao, forwardRef as io } from "react";
8
- import { useIntl as V, FormattedMessage as I } from "react-intl";
9
- import a from "./messages.js";
10
- import { useAsyncList as so } from "./use-async-list.js";
11
- import { useControllableState as lo } from "./utils/use-controllable-state.js";
12
- import { useTrackVisibility as co } from "./utils/use-intersection-observer.js";
13
- import { jsx as r, jsxs as M, Fragment as uo } from "react/jsx-runtime";
14
- const mo = "_container_181ao_1", po = "_disabled_181ao_7", bo = "_highlightOptionText_181ao_11", ho = "_option_181ao_24", go = "_errorComboboxOption_181ao_28", fo = "_errorComboboxOptionText_181ao_33", u = {
15
- container: mo,
16
- disabled: po,
17
- highlightOptionText: bo,
18
- option: ho,
19
- errorComboboxOption: go,
20
- errorComboboxOptionText: fo
21
- }, T = /* @__PURE__ */ io(({
22
- onTryAgain: b
23
- }, h) => {
2
+ import { ComboboxItemValue as $ } from "@ariakit/react";
3
+ import { Combobox as m, LoadingIndicator as oo, InlineNotice as eo, Text as to } from "@box/blueprint-web";
4
+ import { useForkRef as ro } from "@box/blueprint-web/lib-esm/utils/useForkRef";
5
+ import { Search as no, Loader as io } from "@box/blueprint-web-assets/icons/Fill";
6
+ import { IconIconOnLightSecondary as ao, Size6 as M, Size1 as so } from "@box/blueprint-web-assets/tokens/tokens";
7
+ import lo from "clsx";
8
+ import { forwardRef as S, useRef as C, useCallback as co, useMemo as L, useEffect as uo } from "react";
9
+ import { useIntl as F, FormattedMessage as T } from "react-intl";
10
+ import i from "./messages.js";
11
+ import { useAsyncList as mo } from "./use-async-list.js";
12
+ import { useControllableState as po } from "./utils/use-controllable-state.js";
13
+ import { useTrackVisibility as ho } from "./utils/use-intersection-observer.js";
14
+ import { jsx as r, jsxs as V, Fragment as fo } from "react/jsx-runtime";
15
+ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptionText_181ao_11", Oo = "_option_181ao_24", _o = "_errorComboboxOption_181ao_28", Ro = "_errorComboboxOptionText_181ao_33", c = {
16
+ container: bo,
17
+ disabled: go,
18
+ highlightOptionText: xo,
19
+ option: Oo,
20
+ errorComboboxOption: _o,
21
+ errorComboboxOptionText: Ro
22
+ }, N = /* @__PURE__ */ S(({
23
+ onTryAgain: y
24
+ }, p) => {
24
25
  const {
25
- formatMessage: s
26
- } = V();
27
- return /* @__PURE__ */ M(uo, {
28
- children: [/* @__PURE__ */ r(Y, {
26
+ formatMessage: h
27
+ } = F();
28
+ return /* @__PURE__ */ V(fo, {
29
+ children: [/* @__PURE__ */ r(eo, {
29
30
  variant: "error",
30
- variantIconAriaLabel: s(a.loadingResultsErrorIconLabel),
31
- children: /* @__PURE__ */ r(I, {
32
- ...a.loadingResultsErrorMessage
31
+ variantIconAriaLabel: h(i.loadingResultsErrorIconLabel),
32
+ children: /* @__PURE__ */ r(T, {
33
+ ...i.loadingResultsErrorMessage
33
34
  })
34
- }), /* @__PURE__ */ r(p.Option, {
35
- ref: h,
36
- className: u.errorComboboxOption,
37
- onClick: b,
38
- children: /* @__PURE__ */ M(Z, {
35
+ }), /* @__PURE__ */ r(m.Option, {
36
+ ref: p,
37
+ className: c.errorComboboxOption,
38
+ onClick: y,
39
+ children: /* @__PURE__ */ V(to, {
39
40
  as: "span",
40
- className: u.errorComboboxOptionText,
41
+ className: c.errorComboboxOptionText,
41
42
  color: "textOnLightLink",
42
43
  variant: "bodyDefaultBold",
43
- children: [/* @__PURE__ */ r(I, {
44
- ...a.loadingResultsErrorAction
45
- }), /* @__PURE__ */ r(oo, {
44
+ children: [/* @__PURE__ */ r(T, {
45
+ ...i.loadingResultsErrorAction
46
+ }), /* @__PURE__ */ r(io, {
46
47
  color: "currentColor",
47
48
  height: "12px",
48
49
  width: "12px"
@@ -50,110 +51,114 @@ const mo = "_container_181ao_1", po = "_disabled_181ao_7", bo = "_highlightOptio
50
51
  })
51
52
  })]
52
53
  });
53
- }), R = "__LOADING__", L = "__LOADING_ERROR__", xo = "0px 0px 20px 0px", Oo = /* @__PURE__ */ r($, {
54
- color: eo,
55
- height: y,
54
+ }), A = "__LOADING__", E = "__LOADING_ERROR__", Co = "0px 0px 20px 0px", Lo = /* @__PURE__ */ r(no, {
55
+ color: ao,
56
+ height: M,
56
57
  role: "presentation",
57
58
  style: {
58
- padding: to,
59
+ padding: so,
59
60
  boxSizing: "border-box"
60
61
  },
61
- width: y
62
- }), So = (b) => {
62
+ width: M
63
+ }), wo = /* @__PURE__ */ S(function(p, h) {
63
64
  const {
64
- defaultFetcher: h,
65
- onInputValueChange: s,
66
- value: N,
67
- onValueChange: S,
68
- noResultMessage: D,
69
- defaultValue: P = [],
70
- loadingAriaLabel: k,
71
- multiselect: l = !1,
72
- disabled: F,
73
- ...w
74
- } = b, {
75
- formatMessage: d
76
- } = V(), g = v(null), o = so({
65
+ defaultFetcher: P,
66
+ onInputValueChange: f,
67
+ value: k,
68
+ onValueChange: D,
69
+ noResultMessage: w,
70
+ defaultValue: B = [],
71
+ loadingAriaLabel: W,
72
+ multiselect: s = !1,
73
+ disabled: z,
74
+ ...G
75
+ } = p, {
76
+ formatMessage: u
77
+ } = F(), b = C(null), g = C(!0), o = mo({
77
78
  async load({
78
79
  marker: e,
79
80
  searchInput: t,
80
- signal: O
81
+ signal: R
81
82
  }) {
82
- const c = await h({
83
- signal: O,
83
+ const l = await P({
84
+ signal: R,
84
85
  marker: e,
85
86
  searchInput: t
86
87
  });
87
88
  return {
88
- items: c.options,
89
- marker: c.marker
89
+ items: l.options,
90
+ marker: l.marker
90
91
  };
91
92
  }
92
- }), C = v(!1), B = no(() => {
93
- C.current || (o.reload(), C.current = !0);
94
- }, []), [n, f] = lo({
95
- prop: N,
96
- defaultProp: P,
97
- onChange: S
98
- }), z = (e) => {
99
- e === void 0 ? f([]) : Array.isArray(e) ? f(e) : f([e]);
100
- }, G = _(() => n.length === 0 ? l ? [] : void 0 : l ? n : n[0], [l, n]), x = _(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), W = (e) => {
93
+ }), v = C(!1), j = co(() => {
94
+ v.current || (o.reload(), v.current = !0);
95
+ }, []), [n, x] = po({
96
+ prop: k,
97
+ defaultProp: B,
98
+ onChange: D
99
+ }), O = !s && n.length === 1, U = (e) => {
100
+ e === void 0 ? (x([]), g.current || (o.search(""), g.current = !0)) : Array.isArray(e) ? x(e) : x([e]);
101
+ }, q = L(() => n.length === 0 ? s ? [] : void 0 : s ? n : n[0], [s, n]), _ = L(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), H = (e) => {
101
102
  const {
102
103
  value: t,
103
- displayValue: O,
104
- ...c
104
+ displayValue: R,
105
+ ...l
105
106
  } = e;
106
- if (t === R)
107
- return o.hasNextPage ? /* @__PURE__ */ r(p.Option, {
108
- ...c,
109
- ref: q,
107
+ if (t === A)
108
+ return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
109
+ ...l,
110
+ ref: Q,
110
111
  disabled: !0,
111
112
  value: t,
112
- children: /* @__PURE__ */ r(X, {
113
- "aria-label": d(a.loadingMoreAriaLabel),
113
+ children: /* @__PURE__ */ r(oo, {
114
+ "aria-label": u(i.loadingMoreAriaLabel),
114
115
  style: {
115
116
  position: "unset"
116
117
  }
117
118
  })
118
119
  }) : null;
119
- if (t === L && o.hasError && !o.isEmpty)
120
- return /* @__PURE__ */ r(T, {
120
+ if (t === E && o.hasError && !o.isEmpty)
121
+ return /* @__PURE__ */ r(N, {
121
122
  onTryAgain: () => {
122
- var i;
123
- o.loadMore(), (i = g.current) == null || i.focus();
123
+ var a;
124
+ o.loadMore(), (a = b.current) == null || a.focus();
124
125
  }
125
126
  });
126
- if (x.some((i) => i.value === t))
127
+ if (_.some((a) => a.value === t))
127
128
  return null;
128
- const K = () => n.some((i) => i.value === t);
129
- return /* @__PURE__ */ r(p.Option, {
130
- ...c,
131
- className: u.option,
132
- disabled: K(),
129
+ const Z = () => n.some((a) => a.value === t);
130
+ return /* @__PURE__ */ r(m.Option, {
131
+ ...l,
132
+ className: c.option,
133
+ disabled: Z(),
133
134
  value: t,
134
- children: /* @__PURE__ */ r(Q, {
135
- className: u.highlightOptionText,
136
- value: O || t
135
+ children: /* @__PURE__ */ r($, {
136
+ className: c.highlightOptionText,
137
+ value: R || t
137
138
  })
138
139
  });
139
- }, j = (e) => {
140
- s == null || s(e), o.search(e);
141
- }, U = () => {
140
+ }, J = (e) => {
141
+ if (f == null || f(e), O && e === "") {
142
+ g.current = !1;
143
+ return;
144
+ }
145
+ o.search(e);
146
+ }, K = () => {
142
147
  var e;
143
- o.reload(), (e = g.current) == null || e.focus();
148
+ o.reload(), (e = b.current) == null || e.focus();
144
149
  };
145
- let m;
146
- o.hasError && !o.isLoading ? m = /* @__PURE__ */ r(T, {
147
- onTryAgain: U
148
- }) : o.isEmpty && !o.isLoading ? m = D || d(a.noResults) : m = void 0;
149
- const [q, {
150
- rootRef: H,
151
- isVisible: A
152
- }] = co({
153
- rootMargin: xo
150
+ let d;
151
+ o.hasError && !o.isLoading ? d = /* @__PURE__ */ r(N, {
152
+ onTryAgain: K
153
+ }) : o.isEmpty && !o.isLoading ? d = w || u(i.noResults) : d = void 0;
154
+ const [Q, {
155
+ rootRef: X,
156
+ isVisible: I
157
+ }] = ho({
158
+ rootMargin: Co
154
159
  });
155
- ao(() => {
156
- if (!(A && o.hasNextPage))
160
+ uo(() => {
161
+ if (!(I && o.hasNextPage))
157
162
  return;
158
163
  const t = setTimeout(() => {
159
164
  o.loadMore();
@@ -161,42 +166,42 @@ const mo = "_container_181ao_1", po = "_disabled_181ao_7", bo = "_highlightOptio
161
166
  return () => {
162
167
  clearTimeout(t);
163
168
  };
164
- }, [A]);
165
- const J = _(() => {
169
+ }, [I]);
170
+ const Y = L(() => {
166
171
  const e = o.hasNextPage ? {
167
- displayValue: R,
168
- value: R
172
+ displayValue: A,
173
+ value: A
169
174
  } : null, t = !e && o.hasError && !o.isEmpty ? {
170
- displayValue: L,
171
- value: L
175
+ displayValue: E,
176
+ value: E
172
177
  } : null;
173
- return [...o.items, ...x, e, t].filter(Boolean);
174
- }, [o.hasNextPage, o.hasError, o.isEmpty, o.items, x]), E = !l && n.length === 1;
175
- return /* @__PURE__ */ r(p, {
178
+ return [...o.items, ..._, e, t].filter(Boolean);
179
+ }, [o.hasNextPage, o.hasError, o.isEmpty, o.items, _]);
180
+ return /* @__PURE__ */ r(m, {
176
181
  as: "input",
177
- ...w,
178
- ref: g,
179
- className: ro({
180
- [u.disabled]: E
182
+ ...G,
183
+ ref: ro(b, h),
184
+ className: lo({
185
+ [c.disabled]: O
181
186
  }),
182
- clearButtonAriaLabel: d(a.clearButtonAriaLabel),
183
- disabled: F || E,
187
+ clearButtonAriaLabel: u(i.clearButtonAriaLabel),
188
+ disabled: z || O,
184
189
  displayValue: (e) => e.displayValue || e.value,
185
- endComboboxIcon: Oo,
190
+ endComboboxIcon: Lo,
186
191
  focusLoop: !1,
187
- getPopoverRef: H,
192
+ getPopoverRef: X,
188
193
  loading: o.isReloading,
189
- loadingAriaLabel: k || d(a.loadingAriaLabel),
190
- multiselect: l,
191
- noResultMessage: m,
192
- onFocus: B,
193
- onInputValueChange: j,
194
- onValueChange: z,
195
- options: J,
196
- renderOption: W,
197
- value: G
194
+ loadingAriaLabel: W || u(i.loadingAriaLabel),
195
+ multiselect: s,
196
+ noResultMessage: d,
197
+ onFocus: j,
198
+ onInputValueChange: J,
199
+ onValueChange: U,
200
+ options: Y,
201
+ renderOption: H,
202
+ value: q
198
203
  });
199
- };
204
+ });
200
205
  export {
201
- So as ComboboxWithApiPagination
206
+ wo as ComboboxWithApiPagination
202
207
  };
@@ -1,65 +1,59 @@
1
- import { DateI18nProvider as P, DatePicker as F } from "@box/blueprint-web";
2
- import { useFormikContext as V, getIn as b, Field as A } from "formik";
3
- import { forwardRef as C, useMemo as I } from "react";
4
- import { useIntl as L } from "react-intl";
5
- import { convertToDatePickerValue as w, convertToFormikValue as N } from "./date-conversion-utils.js";
6
- import { useDateInternationalization as z } from "./use-date-internationalization.js";
1
+ import { DateI18nProvider as x, DatePicker as L } from "@box/blueprint-web";
2
+ import { useFormikContext as T, getIn as V, Field as A } from "formik";
3
+ import { forwardRef as C, useMemo as w } from "react";
4
+ import { useIntl as I } from "react-intl";
5
+ import { convertToDatePickerValue as N, convertToFormikValue as z } from "./date-conversion-utils.js";
6
+ import { useDateInternationalization as B } from "./use-date-internationalization.js";
7
7
  import a from "../../../../messages.js";
8
- import B from "../../../interactive-text/interactive-text.js";
9
- import { jsx as o } from "react/jsx-runtime";
10
- const H = /* @__PURE__ */ C(({
8
+ import { getFieldLabel as O } from "../../utils.js";
9
+ import { jsx as r } from "react/jsx-runtime";
10
+ const J = /* @__PURE__ */ C(({
11
11
  description: s,
12
- disableForm: m,
13
- fieldNamePrefix: d,
14
- label: r,
15
- portalElement: f,
12
+ disableForm: c,
13
+ fieldNamePrefix: m,
14
+ label: i,
15
+ portalElement: d,
16
+ updateModePrefix: f,
16
17
  className: u
17
18
  }, h) => {
18
- const t = `${d}.value`, e = L(), {
19
+ const o = `${f ?? m}.value`, e = I(), {
19
20
  values: p,
20
21
  setFieldTouched: D,
21
22
  setFieldValue: M
22
- } = V(), {
23
+ } = T(), {
23
24
  localTimezone: g
24
- } = z(e.locale), c = b(p, t), k = I(() => w(c), [c]), v = {
25
+ } = B(e.locale), n = V(p, o), k = w(() => N(n), [n]), v = {
25
26
  clearDatePickerAriaLabel: e.formatMessage(a.clearSelectedDate),
26
27
  nextMonthAriaLabel: e.formatMessage(a.switchToNextMonth),
27
28
  openCalendarDropdownAriaLabel: e.formatMessage(a.openCalendar),
28
29
  previousMonthAriaLabel: e.formatMessage(a.switchToNextMonth)
29
- }, x = (n) => {
30
- const l = N(n, g);
31
- M(t, l);
32
- }, T = () => {
33
- D(t, !0);
30
+ }, b = (t) => {
31
+ const l = z(t, g);
32
+ M(o, l);
33
+ }, F = () => {
34
+ D(o, !0);
34
35
  };
35
- return /* @__PURE__ */ o("div", {
36
- "data-testid": `${r}-field`,
37
- children: /* @__PURE__ */ o(P, {
36
+ return /* @__PURE__ */ r("div", {
37
+ "data-testid": `${i}-field`,
38
+ children: /* @__PURE__ */ r(x, {
38
39
  locale: e.locale,
39
- children: /* @__PURE__ */ o(A, {
40
- name: t,
40
+ children: /* @__PURE__ */ r(A, {
41
+ name: o,
41
42
  children: ({
42
- field: n,
43
+ field: t,
43
44
  meta: l
44
- }) => /* @__PURE__ */ o(F, {
45
- ...n,
45
+ }) => /* @__PURE__ */ r(L, {
46
+ ...t,
46
47
  ...v,
47
48
  ref: h,
48
49
  calendarAriaLabel: e.formatMessage(a.selectDate),
49
50
  className: u,
50
51
  error: l.error,
51
- isDisabled: m,
52
- label: s ? ({
53
- ...i
54
- }) => B({
55
- as: "span",
56
- tooltipText: s,
57
- children: r,
58
- ...i
59
- }) : r,
60
- onBlur: () => T(),
61
- onChange: (i) => x(i),
62
- portalElement: f,
52
+ isDisabled: c,
53
+ label: O(i, s),
54
+ onBlur: () => F(),
55
+ onChange: (P) => b(P),
56
+ portalElement: d,
63
57
  value: k
64
58
  })
65
59
  })
@@ -67,6 +61,6 @@ const H = /* @__PURE__ */ C(({
67
61
  });
68
62
  });
69
63
  export {
70
- H as MetadataDateField,
71
- H as default
64
+ J as MetadataDateField,
65
+ J as default
72
66
  };