@box/metadata-editor 0.57.0 → 0.58.1

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.
@@ -1,39 +1,40 @@
1
- import { IconButton as M } from "@box/blueprint-web";
1
+ import { IconButton as S } from "@box/blueprint-web";
2
2
  import { Plus as T } from "@box/blueprint-web-assets/icons/Fill";
3
3
  import { Space2 as E } from "@box/blueprint-web-assets/tokens/px-tokens";
4
- import { useState as w, useMemo as y } from "react";
5
- import { useIntl as C } from "react-intl";
6
- import { TEMPLATE_CUSTOM_PROPERTIES as I } from "../../constants.js";
4
+ import { useState as I, useMemo as L } from "react";
5
+ import { useIntl as w } from "react-intl";
6
+ import { TEMPLATE_CUSTOM_PROPERTIES as y } from "../../constants.js";
7
7
  import { FilterDropdownMenu as t } from "../filter-dropdown-menu/index.js";
8
8
  import s from "./messages.js";
9
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
10
- const L = parseInt(E, 10);
9
+ import { jsxs as d, jsx as a } from "react/jsx-runtime";
10
+ const B = parseInt(E, 10);
11
11
  function j({
12
- availableTemplates: m,
13
- onSelect: d,
12
+ availableTemplates: n,
13
+ onSelect: l,
14
14
  selectedTemplates: c
15
15
  }) {
16
- const o = C(), p = o.formatMessage(s.customMetadataName), n = (e) => e.templateKey === I ? p : e.displayName, [r, u] = w(""), i = y(() => m.filter((e) => n(e).toLowerCase().includes(r.toLowerCase())), [m, r]), f = r.length > 0 && i.length === 0, g = (e) => c.some((S) => S.id === e.id), h = (e) => {
17
- d(e);
16
+ const o = w(), u = o.formatMessage(s.customMetadataName), m = (e) => e.templateKey === y ? u : e.displayName, [r, p] = I(""), i = L(() => n.filter((e) => m(e).toLowerCase().includes(r.toLowerCase())), [n, r]), g = r.length > 0 && i.length === 0, f = (e) => c.some((M) => M.id === e.id), h = (e) => {
17
+ l(e);
18
18
  };
19
- return /* @__PURE__ */ l(t.Root, {
19
+ return /* @__PURE__ */ d(t.Root, {
20
20
  resetValueOnHide: !0,
21
- setValue: u,
21
+ setValue: p,
22
22
  children: [/* @__PURE__ */ a(t.Trigger, {
23
- triggerButton: /* @__PURE__ */ a(M, {
23
+ triggerButton: /* @__PURE__ */ a(S, {
24
24
  "aria-label": o.formatMessage(s.addMetadataTemplatesTriggerButtonLabel),
25
25
  icon: T,
26
- size: "x-small"
26
+ size: "x-small",
27
+ "data-target-id": "IconButton-addMetadataTemplatesTriggerButtonLabel"
27
28
  })
28
- }), /* @__PURE__ */ l(t.Content, {
29
- gutter: L,
29
+ }), /* @__PURE__ */ d(t.Content, {
30
+ gutter: B,
30
31
  children: [/* @__PURE__ */ a(t.Search, {
31
32
  placeholder: o.formatMessage(s.addMetadataTemplatesSearchPlaceholder)
32
33
  }), /* @__PURE__ */ a(t.List, {
33
- children: f ? /* @__PURE__ */ a(t.EmptyState, {}) : i.map((e) => /* @__PURE__ */ a(t.Item, {
34
- disabled: g(e),
34
+ children: g ? /* @__PURE__ */ a(t.EmptyState, {}) : i.map((e) => /* @__PURE__ */ a(t.Item, {
35
+ disabled: f(e),
35
36
  onClick: () => h(e),
36
- value: n(e)
37
+ value: m(e)
37
38
  }, e.id))
38
39
  })]
39
40
  })]
@@ -1,36 +1,37 @@
1
- import { Combobox as c, ComboboxCancel as n } from "@ariakit/react";
1
+ import { Combobox as n, ComboboxCancel as s } from "@ariakit/react";
2
2
  import { IconButton as l, Divider as i } from "@box/blueprint-web";
3
3
  import { Search as m, XMark as p } from "@box/blueprint-web-assets/icons/Fill";
4
- import { IconIconOnLightSecondary as h, IconCtaIcon as u } from "@box/blueprint-web-assets/tokens/tokens";
5
- import { useIntl as d } from "react-intl";
4
+ import { IconIconOnLightSecondary as u, IconCtaIcon as d } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import { useIntl as h } from "react-intl";
6
6
  import { s as o } from "../../../../chunks/filter-dropdown-menu.module.js";
7
- import f from "./messages.js";
8
- import { jsxs as r, Fragment as I, jsx as e } from "react/jsx-runtime";
7
+ import I from "./messages.js";
8
+ import { jsxs as r, Fragment as f, jsx as e } from "react/jsx-runtime";
9
9
  const b = () => /* @__PURE__ */ e(p, {
10
10
  role: "presentation"
11
11
  }), x = (a) => {
12
12
  const {
13
- ...s
14
- } = a, t = d().formatMessage(f.cancelButtonAriaLabel);
15
- return /* @__PURE__ */ r(I, {
13
+ ...t
14
+ } = a, c = h().formatMessage(I.cancelButtonAriaLabel);
15
+ return /* @__PURE__ */ r(f, {
16
16
  children: [/* @__PURE__ */ r("div", {
17
17
  className: o.search,
18
18
  children: [/* @__PURE__ */ e(m, {
19
19
  className: o.searchIcon,
20
- color: h,
20
+ color: u,
21
21
  role: "presentation"
22
- }), /* @__PURE__ */ e(c, {
22
+ }), /* @__PURE__ */ e(n, {
23
23
  "aria-haspopup": "false",
24
24
  autoSelect: !0,
25
25
  className: o.searchInput,
26
- ...s
27
- }), /* @__PURE__ */ e(n, {
26
+ ...t
27
+ }), /* @__PURE__ */ e(s, {
28
28
  render: /* @__PURE__ */ e(l, {
29
- "aria-label": t,
29
+ "aria-label": c,
30
30
  className: o.clearSearchIcon,
31
- color: u,
31
+ color: d,
32
32
  icon: b,
33
- size: "x-small"
33
+ size: "x-small",
34
+ "data-target-id": "IconButton-cancelButtonAriaLabel"
34
35
  })
35
36
  })]
36
37
  }), /* @__PURE__ */ e(i, {
@@ -1,72 +1,77 @@
1
1
  import "../../../../../../styles/ai-suggestion-field.css";
2
- import { Text as l, IconButton as c, DropdownMenu as r } from "@box/blueprint-web";
3
- import { Checkmark as u, Ellipsis as h } from "@box/blueprint-web-assets/icons/Fill";
4
- import { useIntl as S, FormattedMessage as n } from "react-intl";
5
- import t from "./messages.js";
6
- import { formatSuggestionValue as _ } from "./utils.js";
2
+ import { Text as g, IconButton as l, DropdownMenu as t } from "@box/blueprint-web";
3
+ import { Checkmark as u, Ellipsis as S } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { useIntl as h, FormattedMessage as a } from "react-intl";
5
+ import r from "./messages.js";
6
+ import { formatSuggestionValue as w } from "./utils.js";
7
7
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
8
- const f = "_wrapperGradient_1izxt_1", x = "_wrapper_1izxt_1", w = "_buttons_1izxt_18", b = "_selectTrigger_1izxt_22", o = {
9
- wrapperGradient: f,
10
- wrapper: x,
11
- buttons: w,
12
- selectTrigger: b
8
+ const I = "_wrapperGradient_1izxt_1", _ = "_wrapper_1izxt_1", f = "_buttons_1izxt_18", x = "_selectTrigger_1izxt_22", n = {
9
+ wrapperGradient: I,
10
+ wrapper: _,
11
+ buttons: f,
12
+ selectTrigger: x
13
13
  };
14
- function N({
15
- aiSuggestion: p,
14
+ function D({
15
+ aiSuggestion: c,
16
16
  onAiSuggestionAppend: s,
17
- onAiSuggestionReplace: g,
18
- onAiSuggestionIgnore: m,
19
- type: d
17
+ onAiSuggestionReplace: p,
18
+ onAiSuggestionIgnore: d,
19
+ type: m
20
20
  }) {
21
- const a = S();
21
+ const o = h();
22
22
  return /* @__PURE__ */ e("div", {
23
- className: o.wrapperGradient,
23
+ className: n.wrapperGradient,
24
24
  children: /* @__PURE__ */ i("div", {
25
- className: o.wrapper,
25
+ className: n.wrapper,
26
26
  children: [/* @__PURE__ */ i("div", {
27
- children: [/* @__PURE__ */ e(l, {
27
+ children: [/* @__PURE__ */ e(g, {
28
28
  as: "p",
29
29
  color: "textOnLightSecondary",
30
30
  variant: "caption",
31
- children: /* @__PURE__ */ e(n, {
32
- ...t.aiSuggestionCaption
31
+ children: /* @__PURE__ */ e(a, {
32
+ ...r.aiSuggestionCaption
33
33
  })
34
- }), /* @__PURE__ */ e(l, {
34
+ }), /* @__PURE__ */ e(g, {
35
35
  as: "p",
36
- children: _(p, {
37
- type: d,
38
- locale: a.locale
36
+ children: w(c, {
37
+ type: m,
38
+ locale: o.locale
39
39
  })
40
40
  })]
41
41
  }), /* @__PURE__ */ i("div", {
42
- className: o.buttons,
43
- children: [/* @__PURE__ */ e(c, {
44
- "aria-label": a.formatMessage(t.aiSuggestionAppend),
42
+ className: n.buttons,
43
+ children: [/* @__PURE__ */ e(l, {
44
+ "aria-label": o.formatMessage(r.aiSuggestionAppend),
45
45
  icon: u,
46
46
  onClick: s,
47
- size: "x-small"
48
- }), /* @__PURE__ */ i(r.Root, {
49
- children: [/* @__PURE__ */ e(r.Trigger, {
50
- className: o.selectTrigger,
51
- children: /* @__PURE__ */ e(c, {
52
- "aria-label": a.formatMessage(t.aiSuggestionOptions),
53
- icon: h
47
+ size: "x-small",
48
+ "data-target-id": "IconButton-aiSuggestionAppend"
49
+ }), /* @__PURE__ */ i(t.Root, {
50
+ children: [/* @__PURE__ */ e(t.Trigger, {
51
+ className: n.selectTrigger,
52
+ children: /* @__PURE__ */ e(l, {
53
+ "aria-label": o.formatMessage(r.aiSuggestionOptions),
54
+ icon: S,
55
+ "data-target-id": "IconButton-aiSuggestionOptions"
54
56
  })
55
- }), /* @__PURE__ */ i(r.Content, {
56
- children: [/* @__PURE__ */ e(r.Item, {
57
+ }), /* @__PURE__ */ i(t.Content, {
58
+ children: [/* @__PURE__ */ e(t.Item, {
57
59
  onSelect: s,
58
- children: /* @__PURE__ */ e(n, {
59
- ...t.aiSuggestionAppend
60
+ "data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
61
+ children: /* @__PURE__ */ e(a, {
62
+ ...r.aiSuggestionAppend
60
63
  })
61
- }), /* @__PURE__ */ e(r.Item, {
62
- onSelect: g,
63
- children: /* @__PURE__ */ e(n, {
64
- ...t.aiSuggestionClearAndReplace
64
+ }), /* @__PURE__ */ e(t.Item, {
65
+ onSelect: p,
66
+ "data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
67
+ children: /* @__PURE__ */ e(a, {
68
+ ...r.aiSuggestionClearAndReplace
65
69
  })
66
- }), /* @__PURE__ */ e(r.Separator, {}), /* @__PURE__ */ e(r.Item, {
67
- onSelect: m,
68
- children: /* @__PURE__ */ e(n, {
69
- ...t.aiSuggestionIgnore
70
+ }), /* @__PURE__ */ e(t.Separator, {}), /* @__PURE__ */ e(t.Item, {
71
+ onSelect: d,
72
+ "data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
73
+ children: /* @__PURE__ */ e(a, {
74
+ ...r.aiSuggestionIgnore
70
75
  })
71
76
  })]
72
77
  })]
@@ -76,5 +81,5 @@ function N({
76
81
  });
77
82
  }
78
83
  export {
79
- N as AiSuggestionField
84
+ D as AiSuggestionField
80
85
  };
@@ -1,90 +1,91 @@
1
1
  import "../../../../../../styles/update-mode-field-wrapper.css";
2
- import { IconButton as b, Radio as l } from "@box/blueprint-web";
2
+ import { IconButton as F, Radio as l } from "@box/blueprint-web";
3
3
  import { Settings as I, XMark as R } from "@box/blueprint-web-assets/icons/Fill";
4
4
  import w from "clsx";
5
- import { useFormikContext as E, getIn as C, Field as A } from "formik";
6
- import _, { useState as N } from "react";
7
- import { useIntl as S } from "react-intl";
8
- import { U as i } from "../../../../../../chunks/types.js";
5
+ import { useFormikContext as A, getIn as C, Field as E } from "formik";
6
+ import _, { useState as S } from "react";
7
+ import { useIntl as B } from "react-intl";
8
+ import { U as d } from "../../../../../../chunks/types.js";
9
9
  import { messages as n } from "./messages.js";
10
10
  import { jsxs as s, jsx as o } from "react/jsx-runtime";
11
- const $ = "_wrapperContianer_1n09p_1", B = "_fieldContainer_1n09p_6", U = "_field_1n09p_6", k = "_collapseButton_1n09p_13", x = "_radioContainer_1n09p_19", G = "_additionalFieldContainer_1n09p_22", V = "_hidden_1n09p_26", a = {
12
- wrapperContianer: $,
13
- fieldContainer: B,
14
- field: U,
11
+ const N = "_wrapperContianer_1n09p_1", U = "_fieldContainer_1n09p_6", $ = "_field_1n09p_6", k = "_collapseButton_1n09p_13", x = "_radioContainer_1n09p_19", G = "_additionalFieldContainer_1n09p_22", V = "_hidden_1n09p_26", t = {
12
+ wrapperContianer: N,
13
+ fieldContainer: U,
14
+ field: $,
15
15
  collapseButton: k,
16
16
  radioContainer: x,
17
17
  additionalFieldContainer: G,
18
18
  hidden: V
19
- }, j = (e) => e === i.ReplaceEntered, y = (e) => e === "string" || e === "multiSelect", O = ({
19
+ }, j = (e) => e === d.ReplaceEntered, y = (e) => e === "string" || e === "multiSelect", L = ({
20
20
  children: e,
21
- fieldNamePrefix: d,
21
+ fieldNamePrefix: i,
22
22
  fieldType: f
23
23
  }) => {
24
24
  const {
25
25
  setFieldValue: g,
26
26
  values: m
27
- } = E(), [p, M] = N(!0), t = S(), u = `${d}.updateMode.mode`, h = C(m, u), r = e && _.Children.only(e), v = C(m, `${d}.options`, []).map(({
27
+ } = A(), [p, M] = S(!0), a = B(), u = `${i}.updateMode.mode`, h = C(m, u), r = e && _.Children.only(e), v = C(m, `${i}.options`, []).map(({
28
28
  key: c
29
29
  }) => c);
30
30
  return /* @__PURE__ */ s("div", {
31
- className: a.wrapperContianer,
31
+ className: t.wrapperContianer,
32
32
  children: [/* @__PURE__ */ s("div", {
33
- className: a.fieldContainer,
33
+ className: t.fieldContainer,
34
34
  children: [/* @__PURE__ */ o("span", {
35
- className: a.field,
35
+ className: t.field,
36
36
  children: e
37
- }), /* @__PURE__ */ o(b, {
38
- "aria-label": t.formatMessage(n.toggleUpdateModeSelectiorAriaLabel),
39
- className: a.collapseButton,
37
+ }), /* @__PURE__ */ o(F, {
38
+ "aria-label": a.formatMessage(n.toggleUpdateModeSelectiorAriaLabel),
39
+ className: t.collapseButton,
40
40
  "data-testid": `${r.props.label}-update-mode-toggle`,
41
41
  icon: p ? I : R,
42
42
  onClick: () => {
43
43
  M(!p);
44
44
  },
45
- size: "small"
45
+ size: "small",
46
+ "data-target-id": "IconButton-toggleUpdateModeSelectiorAriaLabel"
46
47
  })]
47
48
  }), /* @__PURE__ */ s("div", {
48
- className: w(a.radioContainer, {
49
- [a.hidden]: p
49
+ className: w(t.radioContainer, {
50
+ [t.hidden]: p
50
51
  }),
51
- children: [/* @__PURE__ */ o(A, {
52
- name: `${d}.updateMode.mode`,
52
+ children: [/* @__PURE__ */ o(E, {
53
+ name: `${i}.updateMode.mode`,
53
54
  children: ({
54
55
  field: c
55
56
  }) => /* @__PURE__ */ s(l.Group, {
56
57
  "data-testid": `${r.props.label}-radio-group`,
57
58
  loop: !0,
58
- onValueChange: (F) => g(u, F),
59
+ onValueChange: (b) => g(u, b),
59
60
  orientation: "vertical",
60
61
  value: c.value,
61
62
  children: [y(f) && /* @__PURE__ */ o(l.Item, {
62
- label: t.formatMessage(n.append),
63
- value: i.Append
63
+ label: a.formatMessage(n.append),
64
+ value: d.Append
64
65
  }), /* @__PURE__ */ o(l.Item, {
65
- label: t.formatMessage(n.clearAndReplace),
66
- value: i.ClearAndReplace
66
+ label: a.formatMessage(n.clearAndReplace),
67
+ value: d.ClearAndReplace
67
68
  }), /* @__PURE__ */ o(l.Item, {
68
- label: t.formatMessage(n.removeEntered),
69
- value: i.RemoveEntered
69
+ label: a.formatMessage(n.removeEntered),
70
+ value: d.RemoveEntered
70
71
  }), /* @__PURE__ */ o(l.Item, {
71
- label: t.formatMessage(n.replaceEntered),
72
- value: i.ReplaceEntered
72
+ label: a.formatMessage(n.replaceEntered),
73
+ value: d.ReplaceEntered
73
74
  })]
74
75
  })
75
76
  }), j(h) && r && /* @__PURE__ */ o("div", {
76
- className: a.additionalFieldContainer,
77
+ className: t.additionalFieldContainer,
77
78
  children: /* @__PURE__ */ _.cloneElement(r, {
78
79
  // This field edits ${fieldNamePrefix}.updateMode.value, the '.value' is added by the field component
79
- fieldNamePrefix: `${d}.updateMode`,
80
+ fieldNamePrefix: `${i}.updateMode`,
80
81
  options: v,
81
- label: t.formatMessage(n.with)
82
+ label: a.formatMessage(n.with)
82
83
  })
83
84
  })]
84
85
  })]
85
86
  });
86
87
  };
87
- O.displayName = "UpdateModeFieldWrapper";
88
+ L.displayName = "UpdateModeFieldWrapper";
88
89
  export {
89
- O as UpdateModeFieldWrapper
90
+ L as UpdateModeFieldWrapper
90
91
  };
@@ -1,16 +1,16 @@
1
1
  import "../../../../../../styles/custom-instance.css";
2
2
  import { useFormikContext as A, FieldArray as N, Field as k } from "formik";
3
- import { useState as I, useRef as y, useEffect as v } from "react";
3
+ import { useState as I, useRef as v, useEffect as y } from "react";
4
4
  import { useIntl as C } from "react-intl";
5
- import { TextInput as q, IconButton as w, TextButton as M } from "@box/blueprint-web";
6
- import { Trash as R } from "@box/blueprint-web-assets/icons/Line";
7
- import { CustomInstanceNewField as T } from "../custom-instance-new-field/custom-instance-new-field.js";
8
- import { fieldDefaultProps as V } from "../../../metadata-editor-fields/components/constants.js";
9
- import r from "./messages.js";
5
+ import { TextInput as q, IconButton as B, TextButton as T } from "@box/blueprint-web";
6
+ import { Trash as w } from "@box/blueprint-web-assets/icons/Line";
7
+ import { CustomInstanceNewField as M } from "../custom-instance-new-field/custom-instance-new-field.js";
8
+ import { fieldDefaultProps as R } from "../../../metadata-editor-fields/components/constants.js";
9
+ import d from "./messages.js";
10
10
  import { jsx as t, jsxs as p } from "react/jsx-runtime";
11
- const j = "_customInstance_xq8r7_1", B = "_customInstanceField_xq8r7_7", P = "_customInstanceFieldInput_xq8r7_12", z = "_customInstanceFieldIcon_xq8r7_16", c = {
12
- customInstance: j,
13
- customInstanceField: B,
11
+ const V = "_customInstance_xq8r7_1", j = "_customInstanceField_xq8r7_7", P = "_customInstanceFieldInput_xq8r7_12", z = "_customInstanceFieldIcon_xq8r7_16", c = {
12
+ customInstance: V,
13
+ customInstanceField: j,
14
14
  customInstanceFieldInput: P,
15
15
  customInstanceFieldIcon: z
16
16
  }, Q = (F) => {
@@ -18,19 +18,19 @@ const j = "_customInstance_xq8r7_1", B = "_customInstanceField_xq8r7_7", P = "_c
18
18
  isLoading: l
19
19
  } = F, {
20
20
  values: e
21
- } = A(), i = C(), [d, o] = I(!e.metadata.fields.length), [u, m] = I(0), h = () => {
22
- m(e.metadata.fields.length);
23
- }, _ = (a) => {
24
- m(a === 0 ? 0 : a - 1);
25
- }, f = y(null);
26
- return v(() => {
21
+ } = A(), i = C(), [m, o] = I(!e.metadata.fields.length), [u, r] = I(0), h = () => {
22
+ r(e.metadata.fields.length);
23
+ }, b = (a) => {
24
+ r(a === 0 ? 0 : a - 1);
25
+ }, f = v(null);
26
+ return y(() => {
27
27
  e.metadata.fields.length > 0 ? f.current.focus() : o(!0);
28
28
  }, [u, e.metadata.fields.length]), /* @__PURE__ */ t("div", {
29
29
  children: /* @__PURE__ */ t(N, {
30
30
  name: "metadata.fields",
31
31
  children: ({
32
32
  remove: a,
33
- push: b
33
+ push: _
34
34
  }) => /* @__PURE__ */ p("div", {
35
35
  className: c.customInstance,
36
36
  children: [e == null ? void 0 : e.metadata.fields.map((s, n) => /* @__PURE__ */ p("div", {
@@ -43,40 +43,42 @@ const j = "_customInstance_xq8r7_1", B = "_customInstanceField_xq8r7_7", P = "_c
43
43
  field: g,
44
44
  meta: x
45
45
  }) => /* @__PURE__ */ t(q, {
46
- ...V,
46
+ ...R,
47
47
  ...g,
48
48
  ref: n === u ? f : null,
49
49
  disabled: l,
50
50
  error: x.error,
51
51
  label: s.key,
52
- placeholder: i.formatMessage(r.setValuePlaceholder)
52
+ placeholder: i.formatMessage(d.setValuePlaceholder)
53
53
  })
54
54
  })
55
- }), /* @__PURE__ */ t(w, {
56
- "aria-label": i.formatMessage(r.removeAttribute, {
55
+ }), /* @__PURE__ */ t(B, {
56
+ "aria-label": i.formatMessage(d.removeAttribute, {
57
57
  fieldName: s.key
58
58
  }),
59
59
  className: c.customInstanceFieldIcon,
60
60
  disabled: l,
61
- icon: R,
61
+ icon: w,
62
62
  onClick: () => {
63
- a(n), _(n);
63
+ a(n), b(n);
64
64
  },
65
- size: "x-small"
65
+ size: "x-small",
66
+ "data-target-id": "IconButton-removeAttribute"
66
67
  })]
67
- }, s.key)), d && /* @__PURE__ */ t(T, {
68
+ }, s.key)), m && /* @__PURE__ */ t(M, {
68
69
  formKeys: e.metadata.fields.map((s) => s.key),
69
70
  onAdd: (s, n) => {
70
- b({
71
+ _({
71
72
  key: s,
72
73
  value: n
73
74
  }), h(), o(!1);
74
75
  },
75
76
  onCancel: () => o(!1)
76
- }), !d && /* @__PURE__ */ t(M, {
77
+ }), !m && /* @__PURE__ */ t(T, {
77
78
  disabled: l,
78
79
  onClick: () => o(!0),
79
- children: i.formatMessage(r.addAttribute)
80
+ "data-target-id": "TextButton-addAttribute",
81
+ children: i.formatMessage(d.addAttribute)
80
82
  })]
81
83
  })
82
84
  })
@@ -1,24 +1,24 @@
1
1
  import "../../../../../../styles/custom-instance-new-field.css";
2
- import { Card as v, TextInput as m, Button as u } from "@box/blueprint-web";
2
+ import { Card as y, TextInput as m, Button as u } from "@box/blueprint-web";
3
3
  import { useState as l } from "react";
4
- import { useIntl as w } from "react-intl";
4
+ import { useIntl as v } from "react-intl";
5
5
  import t from "./messages.js";
6
6
  import { jsxs as p, jsx as a } from "react/jsx-runtime";
7
7
  const M = "_customInstanceNewFieldCard_1m7z1_1", _ = "_customInstanceNewFieldFooter_1m7z1_6", b = "_inputWrapper_1m7z1_13", n = {
8
8
  customInstanceNewFieldCard: M,
9
9
  customInstanceNewFieldFooter: _,
10
10
  inputWrapper: b
11
- }, z = (f) => {
11
+ }, E = (g) => {
12
12
  const {
13
- onAdd: g,
14
- onCancel: h,
13
+ onAdd: f,
14
+ onCancel: F,
15
15
  formKeys: c = []
16
- } = f, e = w(), [r, F] = l(""), [i, C] = l(""), [d, o] = l(""), N = c.length !== 0, I = (s) => {
17
- F(s), d && o("");
18
- }, y = () => {
19
- r ? r.startsWith("$") ? o(e.formatMessage(t.customErrorInternalKey)) : c.includes(r) ? o(e.formatMessage(t.customErrorDuplicateKey)) : g(r, i) : o(e.formatMessage(t.keyFieldRequiredError));
16
+ } = g, e = v(), [r, h] = l(""), [i, C] = l(""), [d, o] = l(""), N = c.length !== 0, I = (s) => {
17
+ h(s), d && o("");
18
+ }, w = () => {
19
+ r ? r.startsWith("$") ? o(e.formatMessage(t.customErrorInternalKey)) : c.includes(r) ? o(e.formatMessage(t.customErrorDuplicateKey)) : f(r, i) : o(e.formatMessage(t.keyFieldRequiredError));
20
20
  };
21
- return /* @__PURE__ */ p(v, {
21
+ return /* @__PURE__ */ p(y, {
22
22
  "aria-label": e.formatMessage(t.addAttributeGroupAriaLabel),
23
23
  className: n.customInstanceNewFieldCard,
24
24
  "data-testid": "customInstanceNewField",
@@ -45,17 +45,19 @@ const M = "_customInstanceNewFieldCard_1m7z1_1", _ = "_customInstanceNewFieldFoo
45
45
  }), /* @__PURE__ */ p("div", {
46
46
  className: n.customInstanceNewFieldFooter,
47
47
  children: [N && /* @__PURE__ */ a(u, {
48
- onClick: h,
48
+ onClick: F,
49
49
  variant: "secondary",
50
+ "data-target-id": "Button-cancelCTA",
50
51
  children: e.formatMessage(t.cancelCTA)
51
52
  }), /* @__PURE__ */ a(u, {
52
- onClick: y,
53
+ onClick: w,
53
54
  variant: "primary",
55
+ "data-target-id": "Button-addNewFieldCTA",
54
56
  children: e.formatMessage(t.addNewFieldCTA)
55
57
  })]
56
58
  })]
57
59
  });
58
60
  };
59
61
  export {
60
- z as CustomInstanceNewField
62
+ E as CustomInstanceNewField
61
63
  };
@@ -1,45 +1,48 @@
1
1
  import "../../../../../../styles/metadata-instance-form-footer.css";
2
2
  import { TextButton as b, Button as r } from "@box/blueprint-web";
3
- import { useFormikContext as F } from "formik";
4
- import { useIntl as g } from "react-intl";
3
+ import { useFormikContext as g } from "formik";
4
+ import { useIntl as B } from "react-intl";
5
5
  import o from "./messages.js";
6
6
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
7
- const f = "_metadataInstanceFormFooter_17478_1", _ = "_buttonsContainer_17478_8", C = "_buttons_17478_8", a = {
8
- metadataInstanceFormFooter: f,
9
- buttonsContainer: _,
10
- buttons: C
7
+ const F = "_metadataInstanceFormFooter_17478_1", f = "_buttonsContainer_17478_8", _ = "_buttons_17478_8", n = {
8
+ metadataInstanceFormFooter: F,
9
+ buttonsContainer: f,
10
+ buttons: _
11
11
  }, M = ({
12
- isDeleteButtonDisabled: m,
13
- isLoading: c,
14
- onCancel: l,
15
- onDelete: d
12
+ isDeleteButtonDisabled: d,
13
+ isLoading: m,
14
+ onCancel: c,
15
+ onDelete: l
16
16
  }) => {
17
- const t = g(), {
17
+ const t = B(), {
18
18
  isSubmitting: s,
19
19
  submitForm: u
20
- } = F(), n = c || s;
20
+ } = g(), a = m || s;
21
21
  return /* @__PURE__ */ e("div", {
22
- className: a.metadataInstanceFormFooter,
22
+ className: n.metadataInstanceFormFooter,
23
23
  children: /* @__PURE__ */ i("div", {
24
- className: a.buttonsContainer,
24
+ className: n.buttonsContainer,
25
25
  children: [/* @__PURE__ */ e(b, {
26
- disabled: n || m,
27
- onClick: d,
26
+ disabled: a || d,
27
+ onClick: l,
28
+ "data-target-id": "TextButton-deleteButton",
28
29
  children: t.formatMessage(o.deleteButton)
29
30
  }), /* @__PURE__ */ i("div", {
30
- className: a.buttons,
31
+ className: n.buttons,
31
32
  children: [/* @__PURE__ */ e(r, {
32
- disabled: n,
33
- onClick: l,
33
+ disabled: a,
34
+ onClick: c,
34
35
  size: "large",
35
36
  variant: "secondary",
37
+ "data-target-id": "Button-cancelButton",
36
38
  children: t.formatMessage(o.cancelButton)
37
39
  }), /* @__PURE__ */ e(r, {
38
- disabled: n,
40
+ disabled: a,
39
41
  loading: s,
40
42
  loadingAriaLabel: t.formatMessage(o.loadingAriaLabel),
41
43
  onClick: u,
42
44
  size: "large",
45
+ "data-target-id": "Button-saveButton",
43
46
  children: t.formatMessage(o.saveButton)
44
47
  })]
45
48
  })]
@@ -1,5 +1,5 @@
1
1
  import "../../../../../../styles/metadata-instance-form-header.css";
2
- import { Text as F, Tooltip as x, Button as B } from "@box/blueprint-web";
2
+ import { Text as h, Tooltip as F, Button as x } from "@box/blueprint-web";
3
3
  import { BoxAiLogo as M } from "@box/blueprint-web-assets/icons/Logo";
4
4
  import { useFormikContext as _, getIn as n } from "formik";
5
5
  import { useIntl as y } from "react-intl";
@@ -18,27 +18,28 @@ const v = "_metadataInstanceFormHeader_1b2cc_1", A = "_title_1b2cc_8", i = {
18
18
  const {
19
19
  isSubmitting: d,
20
20
  values: s,
21
- setFieldValue: f
22
- } = _(), t = y(), u = async () => {
23
- const I = n(s, "metadata.fields"), b = n(s, "metadata.templateKey"), h = await c(b, I);
24
- f("metadata.fields", h);
21
+ setFieldValue: u
22
+ } = _(), t = y(), f = async () => {
23
+ const B = n(s, "metadata.fields"), I = n(s, "metadata.templateKey"), b = await c(I, B);
24
+ u("metadata.fields", b);
25
25
  }, g = m ?? t.formatMessage(e.customInstanceTitle), p = !l || d || o;
26
26
  return /* @__PURE__ */ H("div", {
27
27
  className: i.metadataInstanceFormHeader,
28
- children: [/* @__PURE__ */ a(F, {
28
+ children: [/* @__PURE__ */ a(h, {
29
29
  as: "h1",
30
30
  className: i.title,
31
31
  variant: "titleMedium",
32
32
  children: g
33
- }), r && /* @__PURE__ */ a(x, {
33
+ }), r && /* @__PURE__ */ a(F, {
34
34
  content: t.formatMessage(e.autofillButtonTooltip),
35
- children: /* @__PURE__ */ a(B, {
35
+ children: /* @__PURE__ */ a(x, {
36
36
  disabled: p,
37
37
  icon: M,
38
38
  loading: o,
39
39
  loadingAriaLabel: t.formatMessage(e.loadingButtonAriaLabel),
40
- onClick: u,
40
+ onClick: f,
41
41
  variant: "secondary",
42
+ "data-target-id": "Button-autofillButton",
42
43
  children: t.formatMessage(e.autofillButton)
43
44
  })
44
45
  })]
@@ -1,30 +1,32 @@
1
1
  import "../../../../../../styles/metadata-instance-footer.css";
2
- import { TextButton as e } from "@box/blueprint-web";
2
+ import { TextButton as o } from "@box/blueprint-web";
3
3
  import { useIntl as c } from "react-intl";
4
4
  import s from "./messages.js";
5
5
  import { jsx as t } from "react/jsx-runtime";
6
- const i = "_metadataInstanceFooter_6auqo_1", l = "_button_6auqo_5", o = {
6
+ const i = "_metadataInstanceFooter_6auqo_1", u = "_button_6auqo_5", a = {
7
7
  metadataInstanceFooter: i,
8
- button: l
9
- }, _ = ({
8
+ button: u
9
+ }, f = ({
10
10
  isAnyEmptyValueHidden: n,
11
11
  onHideEmptyValues: r,
12
12
  onShowEmptyValues: m
13
13
  }) => {
14
- const a = c();
14
+ const e = c();
15
15
  return /* @__PURE__ */ t("div", {
16
- className: o.metadataInstanceFooter,
17
- children: n ? /* @__PURE__ */ t(e, {
18
- className: o.button,
16
+ className: a.metadataInstanceFooter,
17
+ children: n ? /* @__PURE__ */ t(o, {
18
+ className: a.button,
19
19
  onClick: m,
20
- children: a.formatMessage(s.showEmptyValuesCTA)
21
- }) : /* @__PURE__ */ t(e, {
22
- className: o.button,
20
+ "data-target-id": "TextButton-showEmptyValuesCTA",
21
+ children: e.formatMessage(s.showEmptyValuesCTA)
22
+ }) : /* @__PURE__ */ t(o, {
23
+ className: a.button,
23
24
  onClick: r,
24
- children: a.formatMessage(s.hideEmptyValuesCTA)
25
+ "data-target-id": "TextButton-hideEmptyValuesCTA",
26
+ children: e.formatMessage(s.hideEmptyValuesCTA)
25
27
  })
26
28
  });
27
29
  };
28
30
  export {
29
- _ as MetadataInstanceFooter
31
+ f as MetadataInstanceFooter
30
32
  };
@@ -1,52 +1,54 @@
1
1
  import "../../../../../../styles/metadata-instance-header.css";
2
- import { Text as g, Tooltip as i, IconButton as s } from "@box/blueprint-web";
3
- import { Pencil as B } from "@box/blueprint-web-assets/icons/Line";
2
+ import { Text as f, Tooltip as i, IconButton as s } from "@box/blueprint-web";
3
+ import { Pencil as g } from "@box/blueprint-web-assets/icons/Line";
4
4
  import { BoxAiLogo as b } from "@box/blueprint-web-assets/icons/Logo";
5
- import { useIntl as p } from "react-intl";
5
+ import { useIntl as I } from "react-intl";
6
6
  import o from "./messages.js";
7
- import { jsxs as r, jsx as n } from "react/jsx-runtime";
8
- const _ = "_metadataInstanceHeader_1vbbg_1", I = "_iconButtonsContainer_1vbbg_7", h = "_title_1vbbg_15", a = {
9
- metadataInstanceHeader: _,
10
- iconButtonsContainer: I,
7
+ import { jsxs as r, jsx as a } from "react/jsx-runtime";
8
+ const p = "_metadataInstanceHeader_1vbbg_1", _ = "_iconButtonsContainer_1vbbg_7", h = "_title_1vbbg_15", e = {
9
+ metadataInstanceHeader: p,
10
+ iconButtonsContainer: _,
11
11
  title: h
12
- }, L = ({
12
+ }, T = ({
13
13
  canEdit: c,
14
14
  isAiSuggestionsFeatureEnabled: l,
15
- onEdit: m,
16
- onAutofill: d,
17
- templateName: e
15
+ onEdit: d,
16
+ onAutofill: m,
17
+ templateName: n
18
18
  }) => {
19
- const t = p(), u = e || t.formatMessage(o.customInstanceTitle), f = l && e;
19
+ const t = I(), u = n || t.formatMessage(o.customInstanceTitle), B = l && n;
20
20
  return /* @__PURE__ */ r("div", {
21
- className: a.metadataInstanceHeader,
22
- children: [/* @__PURE__ */ n(g, {
21
+ className: e.metadataInstanceHeader,
22
+ children: [/* @__PURE__ */ a(f, {
23
23
  as: "h1",
24
- className: a.title,
24
+ className: e.title,
25
25
  variant: "titleMedium",
26
26
  children: u
27
27
  }), c && /* @__PURE__ */ r("div", {
28
- className: a.iconButtonsContainer,
29
- children: [f && /* @__PURE__ */ n(i, {
28
+ className: e.iconButtonsContainer,
29
+ children: [B && /* @__PURE__ */ a(i, {
30
30
  content: t.formatMessage(o.autofillButtonTooltip),
31
- children: /* @__PURE__ */ n(s, {
31
+ children: /* @__PURE__ */ a(s, {
32
32
  "aria-label": t.formatMessage(o.autofillButtonAriaLabel),
33
33
  icon: b,
34
- onClick: d,
35
- variant: "icon-logo"
34
+ onClick: m,
35
+ variant: "icon-logo",
36
+ "data-target-id": "IconButton-autofillButtonAriaLabel"
36
37
  })
37
- }), /* @__PURE__ */ n(i, {
38
+ }), /* @__PURE__ */ a(i, {
38
39
  content: t.formatMessage(o.editButtonTooltip),
39
- children: /* @__PURE__ */ n(s, {
40
+ children: /* @__PURE__ */ a(s, {
40
41
  "aria-label": t.formatMessage(o.editButtonAriaLabel, {
41
- templateName: e
42
+ templateName: n
42
43
  }),
43
- icon: B,
44
- onClick: m
44
+ icon: g,
45
+ onClick: d,
46
+ "data-target-id": "IconButton-editButtonAriaLabel"
45
47
  })
46
48
  })]
47
49
  })]
48
50
  });
49
51
  };
50
52
  export {
51
- L as MetadataInstanceHeader
53
+ T as MetadataInstanceHeader
52
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.57.0",
3
+ "version": "0.58.1",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.20.0",
@@ -13,8 +13,9 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.5",
16
- "@box/blueprint-web": "^7.30.1",
17
- "@box/blueprint-web-assets": "^4.25.0",
16
+ "@box/babel-plugin-target-attributes": "1.3.0",
17
+ "@box/blueprint-web": "^7.30.2",
18
+ "@box/blueprint-web-assets": "^4.26.0",
18
19
  "@box/storybook-utils": "^0.6.1",
19
20
  "@testing-library/react": "^15.0.6",
20
21
  "react": "^18.3.0",
@@ -52,5 +53,5 @@
52
53
  "**/*.css"
53
54
  ],
54
55
  "license": "SEE LICENSE IN LICENSE",
55
- "gitHead": "070e08d367f07146160cb5db9832001c9625d59e"
56
+ "gitHead": "fc4d7910edf521a9a5eb4c109c22eb305ff86341"
56
57
  }