@box/metadata-editor 0.66.2 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/metadata-editor-field-wrapper.js +65 -60
- package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +70 -69
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +26 -26
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +42 -41
- package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +24 -23
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +37 -36
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +27 -24
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +26 -24
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +25 -23
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +62 -43
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +61 -42
- package/package.json +3 -3
- package/styles/ai-suggestion-field.css +1 -1
- package/styles/metadata-editor-field-wrapper.css +1 -1
- package/styles/metadata-instance-form-header.css +1 -1
- package/styles/metadata-instance-header.css +1 -1
- package/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +1 -0
- package/types/lib/components/combobox-with-api-pagination/types.d.ts +2 -1
- package/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
- package/esm/lib/components/truncated-header-text/truncated-header-text.js +0 -38
- package/styles/truncated-header-text.css +0 -1
- package/types/lib/components/truncated-header-text/truncated-header-text.d.ts +0 -7
@@ -1,80 +1,85 @@
|
|
1
1
|
import "../styles/metadata-editor-field-wrapper.css";
|
2
|
-
import
|
3
|
-
import { useFormikContext as
|
4
|
-
import
|
5
|
-
import { forwardRef as
|
6
|
-
import { AiSuggestionField as
|
7
|
-
import { UpdateModeFieldWrapper as
|
8
|
-
import { editorFieldTypes as
|
9
|
-
import { jsx as s, jsxs as
|
10
|
-
const
|
11
|
-
noAttributesText:
|
12
|
-
fieldWrapper:
|
2
|
+
import N from "clsx";
|
3
|
+
import { useFormikContext as T } from "formik";
|
4
|
+
import C from "lodash/isUndefined";
|
5
|
+
import { forwardRef as v, useState as h } from "react";
|
6
|
+
import { AiSuggestionField as I } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
|
7
|
+
import { UpdateModeFieldWrapper as V } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
8
|
+
import { editorFieldTypes as w } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
|
9
|
+
import { jsx as s, jsxs as E } from "react/jsx-runtime";
|
10
|
+
const P = "_noAttributesText_1kfhf_738", R = "_fieldWrapper_1kfhf_742", U = "_hasSuggestion_1kfhf_747", $ = "_error_1kfhf_755", j = "_dateField_1kfhf_767", q = "_suggestionApplied_1kfhf_771", z = "_comboboxContainer_1kfhf_771", i = {
|
11
|
+
noAttributesText: P,
|
12
|
+
fieldWrapper: R,
|
13
13
|
hasSuggestion: U,
|
14
14
|
error: $,
|
15
|
-
dateField: j
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
dateField: j,
|
16
|
+
suggestionApplied: q,
|
17
|
+
comboboxContainer: z
|
18
|
+
}, Y = /* @__PURE__ */ v(({
|
19
|
+
disableForm: p,
|
20
|
+
portalElement: d,
|
19
21
|
field: e,
|
20
|
-
index:
|
22
|
+
index: A,
|
21
23
|
taxonomyOptionsFetcher: l
|
22
|
-
},
|
23
|
-
var
|
24
|
+
}, u) => {
|
25
|
+
var S;
|
24
26
|
const {
|
25
|
-
setFieldValue:
|
26
|
-
} =
|
27
|
-
|
28
|
-
return null;
|
29
|
-
if (_)
|
30
|
-
return /* @__PURE__ */ s(b, {
|
31
|
-
fieldNamePrefix: t,
|
32
|
-
fieldType: e.type,
|
33
|
-
isTaxonomyMultiSelect: y,
|
34
|
-
children: /* @__PURE__ */ s(r, {
|
35
|
-
ref: d,
|
36
|
-
description: e.description,
|
37
|
-
disableForm: a,
|
38
|
-
fieldNamePrefix: t,
|
39
|
-
label: e.displayName,
|
40
|
-
portalElement: p,
|
41
|
-
taxonomyOptionsFetcher: l
|
42
|
-
})
|
43
|
-
}, e.key);
|
44
|
-
const {
|
45
|
-
aiSuggestion: o,
|
27
|
+
setFieldValue: g
|
28
|
+
} = T(), [x, n] = h(!0), [c, r] = h(!1), a = w[e.type], {
|
29
|
+
aiSuggestion: t,
|
46
30
|
type: f,
|
47
|
-
value:
|
48
|
-
} = e,
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
31
|
+
value: y
|
32
|
+
} = e, b = a && !e.hidden, k = !C(e.updateMode), o = `metadata.fields[${A}]`, F = e.type === "taxonomy" && ((S = e.optionsRules) == null ? void 0 : S.multiSelect), m = t && x, W = N({
|
33
|
+
[i.suggestionApplied]: c,
|
34
|
+
[i.hasSuggestion]: m,
|
35
|
+
[i.dateField]: f === "date"
|
36
|
+
});
|
37
|
+
if (!b)
|
38
|
+
return null;
|
39
|
+
const _ = () => {
|
40
|
+
c && r(!1);
|
41
|
+
};
|
42
|
+
return k ? /* @__PURE__ */ s(V, {
|
43
|
+
fieldNamePrefix: o,
|
44
|
+
fieldType: e.type,
|
45
|
+
isTaxonomyMultiSelect: F,
|
46
|
+
children: /* @__PURE__ */ s(a, {
|
47
|
+
ref: u,
|
48
|
+
description: e.description,
|
49
|
+
disableForm: p,
|
50
|
+
fieldNamePrefix: o,
|
51
|
+
label: e.displayName,
|
52
|
+
onValueEdited: _,
|
53
|
+
portalElement: d,
|
54
|
+
taxonomyOptionsFetcher: l
|
55
|
+
})
|
56
|
+
}, e.key) : /* @__PURE__ */ E("div", {
|
57
|
+
className: i.fieldWrapper,
|
58
|
+
children: [/* @__PURE__ */ s(a, {
|
59
|
+
ref: u,
|
60
|
+
className: W,
|
57
61
|
description: e.description,
|
58
|
-
disableForm:
|
59
|
-
fieldNamePrefix:
|
62
|
+
disableForm: p,
|
63
|
+
fieldNamePrefix: o,
|
60
64
|
label: e.displayName,
|
61
|
-
|
65
|
+
onValueEdited: _,
|
66
|
+
portalElement: d,
|
62
67
|
taxonomyOptionsFetcher: l
|
63
|
-
}), m && /* @__PURE__ */ s(
|
64
|
-
aiSuggestion:
|
68
|
+
}), m && /* @__PURE__ */ s(I, {
|
69
|
+
aiSuggestion: t,
|
65
70
|
onAiSuggestionAppend: () => {
|
66
|
-
const
|
67
|
-
|
71
|
+
const M = e.type === "multiSelect" ? [y, t].flat() : t;
|
72
|
+
g(`${o}.value`, M), n(!1), r(!0);
|
68
73
|
},
|
69
|
-
onAiSuggestionIgnore: () =>
|
74
|
+
onAiSuggestionIgnore: () => n(!1),
|
70
75
|
onAiSuggestionReplace: () => {
|
71
|
-
|
76
|
+
g(`${o}.value`, t), n(!1), r(!0);
|
72
77
|
},
|
73
78
|
type: f
|
74
79
|
})]
|
75
80
|
}, e.key);
|
76
81
|
});
|
77
82
|
export {
|
78
|
-
|
79
|
-
|
83
|
+
Y as M,
|
84
|
+
i as s
|
80
85
|
};
|
@@ -1,49 +1,49 @@
|
|
1
1
|
import "../../../../styles/combobox-with-api-pagination.css";
|
2
|
-
import { ComboboxItemValue as
|
3
|
-
import { Combobox as m, LoadingIndicator as
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import { forwardRef as S, useRef as C, useCallback as
|
2
|
+
import { ComboboxItemValue as oo } from "@ariakit/react";
|
3
|
+
import { Combobox as m, LoadingIndicator as eo, InlineNotice as to, Text as ro } from "@box/blueprint-web";
|
4
|
+
import { Search as no, Loader as ao } from "@box/blueprint-web-assets/icons/Fill";
|
5
|
+
import { IconIconOnLightSecondary as io, Size6 as M, Size1 as so } from "@box/blueprint-web-assets/tokens/tokens";
|
6
|
+
import { useForkRef as lo } from "@box/blueprint-web/lib-esm/utils/useForkRef";
|
7
|
+
import co from "clsx";
|
8
|
+
import { forwardRef as S, useRef as C, useCallback as uo, useMemo as L, useEffect as mo } from "react";
|
9
9
|
import { useIntl as F, FormattedMessage as T } from "react-intl";
|
10
|
-
import
|
11
|
-
import { useAsyncList as
|
12
|
-
import { useControllableState as
|
13
|
-
import { useTrackVisibility as
|
14
|
-
import { jsx as r, jsxs as V, Fragment as
|
15
|
-
const
|
16
|
-
container:
|
17
|
-
disabled:
|
18
|
-
highlightOptionText:
|
19
|
-
option:
|
20
|
-
errorComboboxOption:
|
21
|
-
errorComboboxOptionText:
|
10
|
+
import a from "./messages.js";
|
11
|
+
import { useAsyncList as po } from "./use-async-list.js";
|
12
|
+
import { useControllableState as ho } from "./utils/use-controllable-state.js";
|
13
|
+
import { useTrackVisibility as fo } from "./utils/use-intersection-observer.js";
|
14
|
+
import { jsx as r, jsxs as V, Fragment as bo } from "react/jsx-runtime";
|
15
|
+
const go = "_container_181ao_1", xo = "_disabled_181ao_7", Oo = "_highlightOptionText_181ao_11", _o = "_option_181ao_24", Ro = "_errorComboboxOption_181ao_28", Co = "_errorComboboxOptionText_181ao_33", c = {
|
16
|
+
container: go,
|
17
|
+
disabled: xo,
|
18
|
+
highlightOptionText: Oo,
|
19
|
+
option: _o,
|
20
|
+
errorComboboxOption: Ro,
|
21
|
+
errorComboboxOptionText: Co
|
22
22
|
}, N = /* @__PURE__ */ S(({
|
23
23
|
onTryAgain: y
|
24
24
|
}, p) => {
|
25
25
|
const {
|
26
26
|
formatMessage: h
|
27
27
|
} = F();
|
28
|
-
return /* @__PURE__ */ V(
|
29
|
-
children: [/* @__PURE__ */ r(
|
28
|
+
return /* @__PURE__ */ V(bo, {
|
29
|
+
children: [/* @__PURE__ */ r(to, {
|
30
30
|
variant: "error",
|
31
|
-
variantIconAriaLabel: h(
|
31
|
+
variantIconAriaLabel: h(a.loadingResultsErrorIconLabel),
|
32
32
|
children: /* @__PURE__ */ r(T, {
|
33
|
-
...
|
33
|
+
...a.loadingResultsErrorMessage
|
34
34
|
})
|
35
35
|
}), /* @__PURE__ */ r(m.Option, {
|
36
36
|
ref: p,
|
37
37
|
className: c.errorComboboxOption,
|
38
38
|
onClick: y,
|
39
|
-
children: /* @__PURE__ */ V(
|
39
|
+
children: /* @__PURE__ */ V(ro, {
|
40
40
|
as: "span",
|
41
41
|
className: c.errorComboboxOptionText,
|
42
42
|
color: "textOnLightLink",
|
43
43
|
variant: "bodyDefaultBold",
|
44
44
|
children: [/* @__PURE__ */ r(T, {
|
45
|
-
...
|
46
|
-
}), /* @__PURE__ */ r(
|
45
|
+
...a.loadingResultsErrorAction
|
46
|
+
}), /* @__PURE__ */ r(ao, {
|
47
47
|
color: "currentColor",
|
48
48
|
height: "12px",
|
49
49
|
width: "12px"
|
@@ -51,8 +51,8 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
51
51
|
})
|
52
52
|
})]
|
53
53
|
});
|
54
|
-
}), A = "__LOADING__", E = "__LOADING_ERROR__",
|
55
|
-
color:
|
54
|
+
}), A = "__LOADING__", E = "__LOADING_ERROR__", Lo = "0px 0px 20px 0px", Ao = /* @__PURE__ */ r(no, {
|
55
|
+
color: io,
|
56
56
|
height: M,
|
57
57
|
role: "presentation",
|
58
58
|
style: {
|
@@ -60,7 +60,7 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
60
60
|
boxSizing: "border-box"
|
61
61
|
},
|
62
62
|
width: M
|
63
|
-
}),
|
63
|
+
}), Bo = /* @__PURE__ */ S(function(p, h) {
|
64
64
|
const {
|
65
65
|
defaultFetcher: P,
|
66
66
|
onInputValueChange: f,
|
@@ -71,10 +71,11 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
71
71
|
loadingAriaLabel: W,
|
72
72
|
multiselect: s = !1,
|
73
73
|
disabled: z,
|
74
|
-
|
74
|
+
className: G,
|
75
|
+
...j
|
75
76
|
} = p, {
|
76
77
|
formatMessage: u
|
77
|
-
} = F(), b = C(null), g = C(!0), o =
|
78
|
+
} = F(), b = C(null), g = C(!0), o = po({
|
78
79
|
async load({
|
79
80
|
marker: e,
|
80
81
|
searchInput: t,
|
@@ -90,15 +91,15 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
90
91
|
marker: l.marker
|
91
92
|
};
|
92
93
|
}
|
93
|
-
}), v = C(!1),
|
94
|
+
}), v = C(!1), U = uo(() => {
|
94
95
|
v.current || (o.reload(), v.current = !0);
|
95
|
-
}, []), [n, x] =
|
96
|
+
}, []), [n, x] = ho({
|
96
97
|
prop: k,
|
97
98
|
defaultProp: B,
|
98
99
|
onChange: D
|
99
|
-
}), O = !s && n.length === 1,
|
100
|
+
}), O = !s && n.length === 1, q = (e) => {
|
100
101
|
e === void 0 ? (x([]), g.current || (o.search(""), g.current = !0)) : Array.isArray(e) ? x(e) : x([e]);
|
101
|
-
},
|
102
|
+
}, H = 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]), J = (e) => {
|
102
103
|
const {
|
103
104
|
value: t,
|
104
105
|
displayValue: R,
|
@@ -107,11 +108,11 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
107
108
|
if (t === A)
|
108
109
|
return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
|
109
110
|
...l,
|
110
|
-
ref:
|
111
|
+
ref: X,
|
111
112
|
disabled: !0,
|
112
113
|
value: t,
|
113
|
-
children: /* @__PURE__ */ r(
|
114
|
-
"aria-label": u(
|
114
|
+
children: /* @__PURE__ */ r(eo, {
|
115
|
+
"aria-label": u(a.loadingMoreAriaLabel),
|
115
116
|
style: {
|
116
117
|
position: "unset"
|
117
118
|
}
|
@@ -120,44 +121,44 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
120
121
|
if (t === E && o.hasError && !o.isEmpty)
|
121
122
|
return /* @__PURE__ */ r(N, {
|
122
123
|
onTryAgain: () => {
|
123
|
-
var
|
124
|
-
o.loadMore(), (
|
124
|
+
var i;
|
125
|
+
o.loadMore(), (i = b.current) == null || i.focus();
|
125
126
|
}
|
126
127
|
});
|
127
|
-
if (_.some((
|
128
|
+
if (_.some((i) => i.value === t))
|
128
129
|
return null;
|
129
|
-
const
|
130
|
+
const $ = () => n.some((i) => i.value === t);
|
130
131
|
return /* @__PURE__ */ r(m.Option, {
|
131
132
|
...l,
|
132
133
|
className: c.option,
|
133
|
-
disabled:
|
134
|
+
disabled: $(),
|
134
135
|
value: t,
|
135
|
-
children: /* @__PURE__ */ r(
|
136
|
+
children: /* @__PURE__ */ r(oo, {
|
136
137
|
className: c.highlightOptionText,
|
137
138
|
value: R || t
|
138
139
|
})
|
139
140
|
});
|
140
|
-
},
|
141
|
+
}, K = (e) => {
|
141
142
|
if (f == null || f(e), O && e === "") {
|
142
143
|
g.current = !1;
|
143
144
|
return;
|
144
145
|
}
|
145
146
|
o.search(e);
|
146
|
-
},
|
147
|
+
}, Q = () => {
|
147
148
|
var e;
|
148
149
|
o.reload(), (e = b.current) == null || e.focus();
|
149
150
|
};
|
150
151
|
let d;
|
151
152
|
o.hasError && !o.isLoading ? d = /* @__PURE__ */ r(N, {
|
152
|
-
onTryAgain:
|
153
|
-
}) : o.isEmpty && !o.isLoading ? d = w || u(
|
154
|
-
const [
|
155
|
-
rootRef:
|
153
|
+
onTryAgain: Q
|
154
|
+
}) : o.isEmpty && !o.isLoading ? d = w || u(a.noResults) : d = void 0;
|
155
|
+
const [X, {
|
156
|
+
rootRef: Y,
|
156
157
|
isVisible: I
|
157
|
-
}] =
|
158
|
-
rootMargin:
|
158
|
+
}] = fo({
|
159
|
+
rootMargin: Lo
|
159
160
|
});
|
160
|
-
|
161
|
+
mo(() => {
|
161
162
|
if (!(I && o.hasNextPage))
|
162
163
|
return;
|
163
164
|
const t = setTimeout(() => {
|
@@ -167,7 +168,7 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
167
168
|
clearTimeout(t);
|
168
169
|
};
|
169
170
|
}, [I]);
|
170
|
-
const
|
171
|
+
const Z = L(() => {
|
171
172
|
const e = o.hasNextPage ? {
|
172
173
|
displayValue: A,
|
173
174
|
value: A
|
@@ -179,29 +180,29 @@ const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptio
|
|
179
180
|
}, [o.hasNextPage, o.hasError, o.isEmpty, o.items, _]);
|
180
181
|
return /* @__PURE__ */ r(m, {
|
181
182
|
as: "input",
|
182
|
-
...
|
183
|
-
ref:
|
184
|
-
className:
|
183
|
+
...j,
|
184
|
+
ref: lo(b, h),
|
185
|
+
className: co({
|
185
186
|
[c.disabled]: O
|
186
|
-
}),
|
187
|
-
clearButtonAriaLabel: u(
|
187
|
+
}, G),
|
188
|
+
clearButtonAriaLabel: u(a.clearButtonAriaLabel),
|
188
189
|
disabled: z || O,
|
189
190
|
displayValue: (e) => e.displayValue || e.value,
|
190
|
-
endComboboxIcon:
|
191
|
+
endComboboxIcon: Ao,
|
191
192
|
focusLoop: !1,
|
192
|
-
getPopoverRef:
|
193
|
+
getPopoverRef: Y,
|
193
194
|
loading: o.isReloading,
|
194
|
-
loadingAriaLabel: W || u(
|
195
|
+
loadingAriaLabel: W || u(a.loadingAriaLabel),
|
195
196
|
multiselect: s,
|
196
197
|
noResultMessage: d,
|
197
|
-
onFocus:
|
198
|
-
onInputValueChange:
|
199
|
-
onValueChange:
|
200
|
-
options:
|
201
|
-
renderOption:
|
202
|
-
value:
|
198
|
+
onFocus: U,
|
199
|
+
onInputValueChange: K,
|
200
|
+
onValueChange: q,
|
201
|
+
options: Z,
|
202
|
+
renderOption: J,
|
203
|
+
value: H
|
203
204
|
});
|
204
205
|
});
|
205
206
|
export {
|
206
|
-
|
207
|
+
Bo as ComboboxWithApiPagination
|
207
208
|
};
|
@@ -1,76 +1,76 @@
|
|
1
1
|
import "../../../../../../styles/ai-suggestion-field.css";
|
2
|
-
import { Text as
|
2
|
+
import { Text as p, IconButton as g, DropdownMenu as t } from "@box/blueprint-web";
|
3
3
|
import { Checkmark as u, Ellipsis as S } from "@box/blueprint-web-assets/icons/Fill";
|
4
|
-
import { useIntl as h, FormattedMessage as
|
4
|
+
import { useIntl as h, FormattedMessage as n } from "react-intl";
|
5
5
|
import r from "./messages.js";
|
6
6
|
import { formatSuggestionValue as w } from "./utils.js";
|
7
|
-
import { jsx as e, jsxs as
|
8
|
-
const I = "
|
7
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
8
|
+
const I = "_wrapperGradient_1e3py_1", _ = "_wrapper_1e3py_1", f = "_buttons_1e3py_18", M = "_selectTrigger_1e3py_22", i = {
|
9
9
|
wrapperGradient: I,
|
10
10
|
wrapper: _,
|
11
11
|
buttons: f,
|
12
|
-
selectTrigger:
|
12
|
+
selectTrigger: M
|
13
13
|
};
|
14
14
|
function D({
|
15
|
-
aiSuggestion:
|
15
|
+
aiSuggestion: l,
|
16
16
|
onAiSuggestionAppend: s,
|
17
|
-
onAiSuggestionReplace:
|
17
|
+
onAiSuggestionReplace: c,
|
18
18
|
onAiSuggestionIgnore: d,
|
19
19
|
type: m
|
20
20
|
}) {
|
21
21
|
const o = h();
|
22
22
|
return /* @__PURE__ */ e("div", {
|
23
|
-
className:
|
24
|
-
children: /* @__PURE__ */
|
25
|
-
className:
|
26
|
-
children: [/* @__PURE__ */
|
27
|
-
children: [/* @__PURE__ */ e(
|
23
|
+
className: i.wrapperGradient,
|
24
|
+
children: /* @__PURE__ */ a("div", {
|
25
|
+
className: i.wrapper,
|
26
|
+
children: [/* @__PURE__ */ a("div", {
|
27
|
+
children: [/* @__PURE__ */ e(p, {
|
28
28
|
as: "p",
|
29
29
|
color: "textOnLightSecondary",
|
30
30
|
variant: "caption",
|
31
|
-
children: /* @__PURE__ */ e(
|
31
|
+
children: /* @__PURE__ */ e(n, {
|
32
32
|
...r.aiSuggestionCaption
|
33
33
|
})
|
34
|
-
}), /* @__PURE__ */ e(
|
34
|
+
}), /* @__PURE__ */ e(p, {
|
35
35
|
as: "p",
|
36
|
-
children: w(
|
36
|
+
children: w(l, {
|
37
37
|
type: m,
|
38
38
|
locale: o.locale
|
39
39
|
})
|
40
40
|
})]
|
41
|
-
}), /* @__PURE__ */
|
42
|
-
className:
|
43
|
-
children: [/* @__PURE__ */ e(
|
41
|
+
}), /* @__PURE__ */ a("div", {
|
42
|
+
className: i.buttons,
|
43
|
+
children: [/* @__PURE__ */ e(g, {
|
44
44
|
"aria-label": o.formatMessage(r.aiSuggestionAppend),
|
45
45
|
icon: u,
|
46
46
|
onClick: s,
|
47
47
|
size: "x-small",
|
48
48
|
"data-target-id": "IconButton-aiSuggestionAppend"
|
49
|
-
}), /* @__PURE__ */
|
49
|
+
}), /* @__PURE__ */ a(t.Root, {
|
50
50
|
children: [/* @__PURE__ */ e(t.Trigger, {
|
51
|
-
className:
|
52
|
-
children: /* @__PURE__ */ e(
|
51
|
+
className: i.selectTrigger,
|
52
|
+
children: /* @__PURE__ */ e(g, {
|
53
53
|
"aria-label": o.formatMessage(r.aiSuggestionOptions),
|
54
54
|
icon: S,
|
55
55
|
"data-target-id": "IconButton-aiSuggestionOptions"
|
56
56
|
})
|
57
|
-
}), /* @__PURE__ */
|
57
|
+
}), /* @__PURE__ */ a(t.Content, {
|
58
58
|
children: [/* @__PURE__ */ e(t.Item, {
|
59
59
|
onSelect: s,
|
60
60
|
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
61
|
-
children: /* @__PURE__ */ e(
|
61
|
+
children: /* @__PURE__ */ e(n, {
|
62
62
|
...r.aiSuggestionAppend
|
63
63
|
})
|
64
64
|
}), /* @__PURE__ */ e(t.Item, {
|
65
|
-
onSelect:
|
65
|
+
onSelect: c,
|
66
66
|
"data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
|
67
|
-
children: /* @__PURE__ */ e(
|
67
|
+
children: /* @__PURE__ */ e(n, {
|
68
68
|
...r.aiSuggestionClearAndReplace
|
69
69
|
})
|
70
70
|
}), /* @__PURE__ */ e(t.Separator, {}), /* @__PURE__ */ e(t.Item, {
|
71
71
|
onSelect: d,
|
72
72
|
"data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
|
73
|
-
children: /* @__PURE__ */ e(
|
73
|
+
children: /* @__PURE__ */ e(n, {
|
74
74
|
...r.aiSuggestionIgnore
|
75
75
|
})
|
76
76
|
})]
|
@@ -1,66 +1,67 @@
|
|
1
|
-
import { DateI18nProvider as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { forwardRef as
|
4
|
-
import { useIntl as
|
5
|
-
import { convertToDatePickerValue as
|
6
|
-
import { useDateInternationalization as
|
1
|
+
import { DateI18nProvider as L, DatePicker as T } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as V, getIn as A, Field as C } from "formik";
|
3
|
+
import { forwardRef as w, useMemo as I } from "react";
|
4
|
+
import { useIntl as N } from "react-intl";
|
5
|
+
import { convertToDatePickerValue as z, convertToFormikValue as B } from "./date-conversion-utils.js";
|
6
|
+
import { useDateInternationalization as O } from "./use-date-internationalization.js";
|
7
7
|
import a from "../../../../messages.js";
|
8
|
-
import { getFieldLabel as
|
8
|
+
import { getFieldLabel as $ } from "../../utils.js";
|
9
9
|
import { jsx as r } from "react/jsx-runtime";
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
const K = /* @__PURE__ */ w(({
|
11
|
+
className: s,
|
12
|
+
description: c,
|
13
|
+
disableForm: m,
|
14
|
+
fieldNamePrefix: d,
|
14
15
|
label: i,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
},
|
19
|
-
const o = `${
|
20
|
-
values:
|
21
|
-
setFieldTouched:
|
22
|
-
setFieldValue:
|
23
|
-
} =
|
24
|
-
localTimezone:
|
25
|
-
} =
|
16
|
+
onValueEdited: f,
|
17
|
+
portalElement: u,
|
18
|
+
updateModePrefix: h
|
19
|
+
}, p) => {
|
20
|
+
const o = `${h ?? d}.value`, e = N(), {
|
21
|
+
values: D,
|
22
|
+
setFieldTouched: M,
|
23
|
+
setFieldValue: g
|
24
|
+
} = V(), {
|
25
|
+
localTimezone: k
|
26
|
+
} = O(e.locale), n = A(D, o), v = I(() => z(n), [n]), b = {
|
26
27
|
clearDatePickerAriaLabel: e.formatMessage(a.clearSelectedDate),
|
27
28
|
nextMonthAriaLabel: e.formatMessage(a.switchToNextMonth),
|
28
29
|
openCalendarDropdownAriaLabel: e.formatMessage(a.openCalendar),
|
29
30
|
previousMonthAriaLabel: e.formatMessage(a.switchToNextMonth)
|
30
|
-
},
|
31
|
-
const l =
|
32
|
-
|
33
|
-
},
|
34
|
-
|
31
|
+
}, F = (t) => {
|
32
|
+
const l = B(t, k);
|
33
|
+
g(o, l), f();
|
34
|
+
}, P = () => {
|
35
|
+
M(o, !0);
|
35
36
|
};
|
36
37
|
return /* @__PURE__ */ r("div", {
|
37
38
|
"data-testid": `${i}-field`,
|
38
|
-
children: /* @__PURE__ */ r(
|
39
|
+
children: /* @__PURE__ */ r(L, {
|
39
40
|
locale: e.locale,
|
40
|
-
children: /* @__PURE__ */ r(
|
41
|
+
children: /* @__PURE__ */ r(C, {
|
41
42
|
name: o,
|
42
43
|
children: ({
|
43
44
|
field: t,
|
44
45
|
meta: l
|
45
|
-
}) => /* @__PURE__ */ r(
|
46
|
+
}) => /* @__PURE__ */ r(T, {
|
46
47
|
...t,
|
47
|
-
...
|
48
|
-
ref:
|
48
|
+
...b,
|
49
|
+
ref: p,
|
49
50
|
calendarAriaLabel: e.formatMessage(a.selectDate),
|
50
|
-
className:
|
51
|
+
className: s,
|
51
52
|
error: l.error,
|
52
|
-
isDisabled:
|
53
|
-
label:
|
54
|
-
onBlur: () =>
|
55
|
-
onChange: (
|
56
|
-
portalElement:
|
57
|
-
value:
|
53
|
+
isDisabled: m,
|
54
|
+
label: $(i, c),
|
55
|
+
onBlur: () => P(),
|
56
|
+
onChange: (x) => F(x),
|
57
|
+
portalElement: u,
|
58
|
+
value: v
|
58
59
|
})
|
59
60
|
})
|
60
61
|
})
|
61
62
|
});
|
62
63
|
});
|
63
64
|
export {
|
64
|
-
|
65
|
-
|
65
|
+
K as MetadataDateField,
|
66
|
+
K as default
|
66
67
|
};
|