@box/metadata-editor 1.53.15 → 1.54.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/dist/chunks/utils2.js +43 -38
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +37 -0
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +4 -0
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +57 -56
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +4 -0
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +4 -0
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +30 -0
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +37 -36
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +32 -31
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +32 -31
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +35 -34
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +26 -25
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +64 -63
- package/dist/esm/lib/components/metadata-editor-fields/messages.js +10 -0
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +89 -85
- package/dist/esm/lib/components/metadata-editor-fields/utils.js +7 -5
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +90 -88
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +5 -5
- package/dist/esm/lib/utils/autofill-context.js +51 -47
- package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +18 -16
- package/dist/esm/lib/utils/confidence-score/messages.js +1 -1
- package/dist/i18n/bn-IN.js +2 -0
- package/dist/i18n/da-DK.js +2 -0
- package/dist/i18n/de-DE.js +2 -0
- package/dist/i18n/en-AU.js +2 -0
- package/dist/i18n/en-CA.js +2 -0
- package/dist/i18n/en-GB.js +2 -0
- package/dist/i18n/en-US.js +3 -1
- package/dist/i18n/en-US.properties +5 -1
- package/dist/i18n/en-x-pseudo.js +2 -0
- package/dist/i18n/es-419.js +2 -0
- package/dist/i18n/es-ES.js +2 -0
- package/dist/i18n/fi-FI.js +2 -0
- package/dist/i18n/fr-CA.js +2 -0
- package/dist/i18n/fr-FR.js +2 -0
- package/dist/i18n/hi-IN.js +2 -0
- package/dist/i18n/it-IT.js +2 -0
- package/dist/i18n/ja-JP.js +2 -0
- package/dist/i18n/json/src/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.json +1 -1
- package/dist/i18n/json/src/lib/components/metadata-editor-fields/messages.json +1 -0
- package/dist/i18n/json/src/lib/utils/confidence-score/messages.json +1 -1
- package/dist/i18n/ko-KR.js +2 -0
- package/dist/i18n/nb-NO.js +2 -0
- package/dist/i18n/nl-NL.js +2 -0
- package/dist/i18n/pl-PL.js +2 -0
- package/dist/i18n/pt-BR.js +2 -0
- package/dist/i18n/ru-RU.js +2 -0
- package/dist/i18n/sv-SE.js +2 -0
- package/dist/i18n/tr-TR.js +2 -0
- package/dist/i18n/zh-CN.js +2 -0
- package/dist/i18n/zh-TW.js +2 -0
- package/dist/types/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.d.ts +5 -0
- package/dist/types/lib/components/metadata-editor-fields/components/ai-logo-badge/index.d.ts +1 -0
- package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.d.ts +5 -0
- package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/types.d.ts +9 -1
- package/dist/types/lib/components/metadata-editor-fields/components/low-confidence-badge/index.d.ts +1 -0
- package/dist/types/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.d.ts +4 -0
- package/dist/types/lib/components/metadata-editor-fields/messages.d.ts +8 -0
- package/dist/types/lib/components/metadata-editor-fields/types.d.ts +2 -1
- package/dist/types/lib/components/metadata-editor-fields/utils.d.ts +2 -1
- package/dist/types/lib/test-utils/confidence-score-fixtures.d.ts +37 -0
- package/dist/types/lib/test-utils/index.d.ts +1 -0
- package/dist/types/lib/test-utils/sample-data.d.ts +1 -3
- package/dist/types/lib/types.d.ts +1 -0
- package/dist/types/lib/utils/autofill-context.d.ts +2 -1
- package/package.json +9 -9
package/dist/chunks/utils2.js
CHANGED
|
@@ -1,50 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import p from "clsx";
|
|
2
|
+
import { convertISOStringtoRFC3339String as d } from "../esm/lib/utils/convertDate.js";
|
|
3
|
+
import u from "../esm/lib/components/interactive-text/interactive-text.js";
|
|
4
|
+
import { jsxs as m, jsx as l } from "react/jsx-runtime";
|
|
5
|
+
import { isConfidenceScoreNeedingReview as T } from "../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";
|
|
6
|
+
import { LowConfidenceBadge as f } from "../esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js";
|
|
7
|
+
import { AiLogoBadge as x } from "../esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js";
|
|
8
|
+
import '../styles/utils.css';const z = "_noAttributesText_6bzgt_2", h = "_fieldWrapper_6bzgt_6", C = "_hasSuggestion_6bzgt_11", N = "_hasConfidenceReview_6bzgt_16", v = "_dateField_6bzgt_44", w = "_suggestionApplied_6bzgt_48", A = "_labelWrapper_6bzgt_95", W = "_labelText_6bzgt_101", I = "_labelTruncated_6bzgt_104", F = "_labelIcon_6bzgt_111", s = {
|
|
9
|
+
noAttributesText: z,
|
|
10
|
+
fieldWrapper: h,
|
|
11
|
+
hasSuggestion: C,
|
|
12
|
+
hasConfidenceReview: N,
|
|
13
|
+
dateField: v,
|
|
14
|
+
suggestionApplied: w,
|
|
15
|
+
labelWrapper: A,
|
|
16
|
+
labelText: W,
|
|
17
|
+
labelTruncated: I,
|
|
18
|
+
labelIcon: F
|
|
19
|
+
}, O = (a, t, r = !1, i = "label", e) => (b) => {
|
|
18
20
|
const {
|
|
19
|
-
className:
|
|
21
|
+
className: g,
|
|
20
22
|
...n
|
|
21
|
-
} =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
} = b, o = p(g || s.labelText, s.labelTruncated), c = !!e && T(e), _ = () => e && c ? /* @__PURE__ */ l(f, {
|
|
24
|
+
confidenceScore: e
|
|
25
|
+
}) : r || e ? /* @__PURE__ */ l(x, {
|
|
26
|
+
className: s.labelIcon,
|
|
27
|
+
confidenceScore: e
|
|
28
|
+
}) : null;
|
|
29
|
+
return /* @__PURE__ */ m("div", {
|
|
30
|
+
className: s.labelWrapper,
|
|
31
|
+
children: [t ? /* @__PURE__ */ l(u, {
|
|
32
|
+
as: i,
|
|
33
|
+
className: o,
|
|
34
|
+
tooltipText: t,
|
|
28
35
|
...n,
|
|
29
|
-
children:
|
|
30
|
-
}) : /* @__PURE__ */
|
|
31
|
-
className:
|
|
36
|
+
children: a
|
|
37
|
+
}) : /* @__PURE__ */ l("label", {
|
|
38
|
+
className: o,
|
|
32
39
|
...n,
|
|
33
|
-
children:
|
|
34
|
-
}),
|
|
35
|
-
className: l.labelIcon
|
|
36
|
-
})]
|
|
40
|
+
children: a
|
|
41
|
+
}), _()]
|
|
37
42
|
});
|
|
38
|
-
},
|
|
43
|
+
}, P = (a) => {
|
|
39
44
|
try {
|
|
40
|
-
const
|
|
41
|
-
return isNaN(
|
|
45
|
+
const t = d(a), r = new Date(t);
|
|
46
|
+
return isNaN(r.getTime()) ? null : t;
|
|
42
47
|
} catch {
|
|
43
48
|
return null;
|
|
44
49
|
}
|
|
45
50
|
};
|
|
46
51
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
O as g,
|
|
53
|
+
s,
|
|
54
|
+
P as t
|
|
50
55
|
};
|
package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Focusable as a, Status as m, Tooltip as f } from "@box/blueprint-web";
|
|
2
|
+
import { BoxAiLogo as r } from "@box/blueprint-web-assets/icons/Logo";
|
|
3
|
+
import { SurfaceStatusSurfaceGray as p } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import { useIntl as u } from "react-intl";
|
|
5
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
6
|
+
import { getConfidenceScoreTooltip as s } from "../../../../utils/confidence-score/get-confidence-score-tooltip.js";
|
|
7
|
+
function S({
|
|
8
|
+
confidenceScore: o,
|
|
9
|
+
className: e
|
|
10
|
+
}) {
|
|
11
|
+
const {
|
|
12
|
+
formatMessage: i
|
|
13
|
+
} = u();
|
|
14
|
+
if (!o)
|
|
15
|
+
return /* @__PURE__ */ t(r, {
|
|
16
|
+
className: e
|
|
17
|
+
});
|
|
18
|
+
const n = s(i, o), c = o.isAccepted ? /* @__PURE__ */ t(a, {
|
|
19
|
+
children: /* @__PURE__ */ t(r, {
|
|
20
|
+
className: e
|
|
21
|
+
})
|
|
22
|
+
}) : /* @__PURE__ */ t(m, {
|
|
23
|
+
hideText: !0,
|
|
24
|
+
icon: r,
|
|
25
|
+
interactive: !0,
|
|
26
|
+
text: "",
|
|
27
|
+
color: p,
|
|
28
|
+
"data-testid": "ai-confidence-badge"
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ t(f, {
|
|
31
|
+
content: n,
|
|
32
|
+
children: c
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
S as AiLogoBadge
|
|
37
|
+
};
|
|
@@ -1,98 +1,99 @@
|
|
|
1
|
-
import { useBlueprintModernization as
|
|
2
|
-
import { Checkmark as
|
|
3
|
-
import
|
|
4
|
-
import { useIntl as
|
|
1
|
+
import { useBlueprintModernization as w, Text as c, IconButton as g, DropdownMenu as a } from "@box/blueprint-web";
|
|
2
|
+
import { Checkmark as u, Ellipsis as x } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import v from "clsx";
|
|
4
|
+
import { useIntl as A, FormattedMessage as s } from "react-intl";
|
|
5
5
|
import { s as l } from "../../../../../../chunks/field-action-bar.module.js";
|
|
6
6
|
import t from "./messages.js";
|
|
7
|
-
import { formatSuggestionValue as
|
|
8
|
-
import { jsx as e, jsxs as
|
|
9
|
-
import '../../../../../../styles/ai-suggestion-field.css';const
|
|
10
|
-
wrapper:
|
|
11
|
-
selectTrigger:
|
|
7
|
+
import { formatSuggestionValue as b } from "./utils.js";
|
|
8
|
+
import { jsx as e, jsxs as r, Fragment as S } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../../../styles/ai-suggestion-field.css';const B = "_wrapper_132y2_1", T = "_selectTrigger_132y2_1", h = {
|
|
10
|
+
wrapper: B,
|
|
11
|
+
selectTrigger: T
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
aiSuggestion:
|
|
13
|
+
function j({
|
|
14
|
+
aiSuggestion: C,
|
|
15
15
|
onAiSuggestionAppend: d,
|
|
16
|
-
onAiSuggestionReplace:
|
|
17
|
-
onAiSuggestionIgnore:
|
|
18
|
-
type:
|
|
19
|
-
isSameValue: f
|
|
16
|
+
onAiSuggestionReplace: m,
|
|
17
|
+
onAiSuggestionIgnore: p,
|
|
18
|
+
type: o,
|
|
19
|
+
isSameValue: f,
|
|
20
|
+
confidenceLevel: n
|
|
20
21
|
}) {
|
|
21
|
-
const
|
|
22
|
-
enableModernizedComponents:
|
|
23
|
-
} =
|
|
22
|
+
const i = A(), {
|
|
23
|
+
enableModernizedComponents: I
|
|
24
|
+
} = w(), M = n ? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase() : void 0;
|
|
24
25
|
return /* @__PURE__ */ e("div", {
|
|
25
26
|
className: l.wrapperGradient,
|
|
26
|
-
"data-modern":
|
|
27
|
+
"data-modern": I,
|
|
27
28
|
children: /* @__PURE__ */ e("div", {
|
|
28
|
-
className:
|
|
29
|
-
children: f ? /* @__PURE__ */
|
|
30
|
-
children: [/* @__PURE__ */ e(
|
|
29
|
+
className: v(l.wrapper, h.wrapper),
|
|
30
|
+
children: f ? /* @__PURE__ */ r(S, {
|
|
31
|
+
children: [/* @__PURE__ */ e(c, {
|
|
31
32
|
as: "p",
|
|
32
33
|
color: "textOnLightSecondary",
|
|
33
34
|
variant: "caption",
|
|
34
|
-
children: /* @__PURE__ */ e(
|
|
35
|
+
children: /* @__PURE__ */ e(s, {
|
|
35
36
|
...t.sameValueAiSuggestionCaption
|
|
36
37
|
})
|
|
37
38
|
}), /* @__PURE__ */ e("div", {
|
|
38
39
|
className: l.buttons,
|
|
39
|
-
children: /* @__PURE__ */ e(
|
|
40
|
-
"aria-label":
|
|
41
|
-
icon:
|
|
42
|
-
onClick:
|
|
40
|
+
children: /* @__PURE__ */ e(g, {
|
|
41
|
+
"aria-label": i.formatMessage(t.aiSuggestionConfirm),
|
|
42
|
+
icon: u,
|
|
43
|
+
onClick: p,
|
|
43
44
|
size: "x-small",
|
|
44
45
|
"data-target-id": "IconButton-aiSuggestionConfirm"
|
|
45
46
|
})
|
|
46
47
|
})]
|
|
47
|
-
}) : /* @__PURE__ */
|
|
48
|
-
children: [/* @__PURE__ */
|
|
49
|
-
children: [/* @__PURE__ */ e(
|
|
48
|
+
}) : /* @__PURE__ */ r(S, {
|
|
49
|
+
children: [/* @__PURE__ */ r("div", {
|
|
50
|
+
children: [/* @__PURE__ */ e(c, {
|
|
50
51
|
as: "p",
|
|
51
52
|
color: "textOnLightSecondary",
|
|
52
53
|
variant: "caption",
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
}), /* @__PURE__ */ e(
|
|
54
|
+
children: n ? i.formatMessage(t.aiSuggestionCaptionWithLevel, {
|
|
55
|
+
level: M
|
|
56
|
+
}) : i.formatMessage(t.aiSuggestionCaption)
|
|
57
|
+
}), /* @__PURE__ */ e(c, {
|
|
57
58
|
as: "p",
|
|
58
|
-
children:
|
|
59
|
-
type:
|
|
60
|
-
locale:
|
|
59
|
+
children: b(C, {
|
|
60
|
+
type: o,
|
|
61
|
+
locale: i.locale
|
|
61
62
|
})
|
|
62
63
|
})]
|
|
63
|
-
}), /* @__PURE__ */
|
|
64
|
+
}), /* @__PURE__ */ r("div", {
|
|
64
65
|
className: l.buttons,
|
|
65
|
-
children: [/* @__PURE__ */ e(
|
|
66
|
-
"aria-label":
|
|
67
|
-
"data-target-id":
|
|
68
|
-
icon:
|
|
69
|
-
onClick:
|
|
66
|
+
children: [/* @__PURE__ */ e(g, {
|
|
67
|
+
"aria-label": i.formatMessage(o === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
|
|
68
|
+
"data-target-id": o === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
|
|
69
|
+
icon: u,
|
|
70
|
+
onClick: o === "multiSelect" ? d : m,
|
|
70
71
|
size: "x-small"
|
|
71
|
-
}), /* @__PURE__ */
|
|
72
|
+
}), /* @__PURE__ */ r(a.Root, {
|
|
72
73
|
children: [/* @__PURE__ */ e(a.Trigger, {
|
|
73
|
-
className:
|
|
74
|
-
children: /* @__PURE__ */ e(
|
|
75
|
-
"aria-label":
|
|
76
|
-
icon:
|
|
74
|
+
className: h.selectTrigger,
|
|
75
|
+
children: /* @__PURE__ */ e(g, {
|
|
76
|
+
"aria-label": i.formatMessage(t.aiSuggestionOptions),
|
|
77
|
+
icon: x,
|
|
77
78
|
"data-target-id": "IconButton-aiSuggestionOptions"
|
|
78
79
|
})
|
|
79
|
-
}), /* @__PURE__ */
|
|
80
|
-
children: [
|
|
80
|
+
}), /* @__PURE__ */ r(a.Content, {
|
|
81
|
+
children: [o === "multiSelect" && /* @__PURE__ */ e(a.Item, {
|
|
81
82
|
onSelect: d,
|
|
82
83
|
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
|
83
|
-
children: /* @__PURE__ */ e(
|
|
84
|
+
children: /* @__PURE__ */ e(s, {
|
|
84
85
|
...t.aiSuggestionAppend
|
|
85
86
|
})
|
|
86
87
|
}), /* @__PURE__ */ e(a.Item, {
|
|
87
|
-
onSelect:
|
|
88
|
+
onSelect: m,
|
|
88
89
|
"data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
|
|
89
|
-
children: /* @__PURE__ */ e(
|
|
90
|
+
children: /* @__PURE__ */ e(s, {
|
|
90
91
|
...t.aiSuggestionClearAndReplace
|
|
91
92
|
})
|
|
92
93
|
}), /* @__PURE__ */ e(a.Separator, {}), /* @__PURE__ */ e(a.Item, {
|
|
93
|
-
onSelect:
|
|
94
|
+
onSelect: p,
|
|
94
95
|
"data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
|
|
95
|
-
children: /* @__PURE__ */ e(
|
|
96
|
+
children: /* @__PURE__ */ e(s, {
|
|
96
97
|
...t.aiSuggestionIgnore
|
|
97
98
|
})
|
|
98
99
|
})]
|
|
@@ -104,5 +105,5 @@ function R({
|
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
export {
|
|
107
|
-
|
|
108
|
+
j as AiSuggestionField
|
|
108
109
|
};
|
package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js
CHANGED
|
@@ -24,6 +24,10 @@ const i = e({
|
|
|
24
24
|
id: "metadataEditor.aiSuggestionField.ignoreLabel",
|
|
25
25
|
defaultMessage: "Ignore"
|
|
26
26
|
},
|
|
27
|
+
aiSuggestionCaptionWithLevel: {
|
|
28
|
+
id: "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel",
|
|
29
|
+
defaultMessage: "Box AI suggestion ({level} confidence)"
|
|
30
|
+
},
|
|
27
31
|
aiSuggestionConfirm: {
|
|
28
32
|
id: "metadataEditor.aiSuggestionField.dismissLabel",
|
|
29
33
|
defaultMessage: "Confirm"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Status as c, Tooltip as m } from "@box/blueprint-web";
|
|
2
|
+
import { AlertCircle as s } from "@box/blueprint-web-assets/icons/Medium";
|
|
3
|
+
import { SurfaceStatusSurfaceGray as f } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import { useIntl as a } from "react-intl";
|
|
5
|
+
import p from "../../../../utils/confidence-score/messages.js";
|
|
6
|
+
import l from "../../messages.js";
|
|
7
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
8
|
+
import { formatConfidenceScorePercent as u } from "../../../../utils/confidence-score/format-confidence-score-percent.js";
|
|
9
|
+
function L({
|
|
10
|
+
confidenceScore: e
|
|
11
|
+
}) {
|
|
12
|
+
const {
|
|
13
|
+
formatMessage: o
|
|
14
|
+
} = a(), r = /* @__PURE__ */ t(c, {
|
|
15
|
+
color: f,
|
|
16
|
+
interactive: !0,
|
|
17
|
+
text: o(l.lowConfidenceBadge).toUpperCase(),
|
|
18
|
+
icon: s,
|
|
19
|
+
iconPosition: "left"
|
|
20
|
+
}), i = u(e.value), n = o(p.tooltipLowConfidence, {
|
|
21
|
+
score: i
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ t(m, {
|
|
24
|
+
content: n,
|
|
25
|
+
children: r
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
L as LowConfidenceBadge
|
|
30
|
+
};
|
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
import { DateI18nProvider as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { convertIsoStringToCalendarDate as
|
|
1
|
+
import { DateI18nProvider as I, DatePicker as L } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as T, getIn as A, Field as w } from "formik";
|
|
3
|
+
import { forwardRef as S, useMemo as V } from "react";
|
|
4
|
+
import { useIntl as N } from "react-intl";
|
|
5
|
+
import { convertIsoStringToCalendarDate as O, convertCalendarDateToISOString as B } from "../../../../utils/convertDate.js";
|
|
6
6
|
import a from "../../../../messages.js";
|
|
7
|
-
import { g as
|
|
7
|
+
import { g as $ } from "../../../../../../chunks/utils2.js";
|
|
8
8
|
import { jsx as r } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
9
|
+
const J = /* @__PURE__ */ S(({
|
|
10
10
|
className: s,
|
|
11
11
|
description: d,
|
|
12
12
|
isAiSuggestionApplied: c,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
confidenceScore: m,
|
|
14
|
+
disableForm: f,
|
|
15
|
+
fieldNamePrefix: u,
|
|
15
16
|
label: n,
|
|
16
|
-
onValueEdited:
|
|
17
|
-
portalElement:
|
|
18
|
-
updateModePrefix:
|
|
19
|
-
},
|
|
20
|
-
const t = `${
|
|
21
|
-
values:
|
|
22
|
-
setFieldTouched:
|
|
23
|
-
setFieldValue:
|
|
24
|
-
} =
|
|
17
|
+
onValueEdited: h,
|
|
18
|
+
portalElement: p,
|
|
19
|
+
updateModePrefix: D
|
|
20
|
+
}, g) => {
|
|
21
|
+
const t = `${D ?? u}.value`, e = N(), {
|
|
22
|
+
values: M,
|
|
23
|
+
setFieldTouched: k,
|
|
24
|
+
setFieldValue: v
|
|
25
|
+
} = T(), i = A(M, t), b = V(() => O(i), [i]), C = {
|
|
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
|
-
},
|
|
30
|
-
const l =
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
30
|
+
}, F = (o) => {
|
|
31
|
+
const l = B(o);
|
|
32
|
+
v(t, l), h();
|
|
33
|
+
}, P = () => {
|
|
34
|
+
k(t, !0);
|
|
34
35
|
};
|
|
35
36
|
return /* @__PURE__ */ r("div", {
|
|
36
37
|
"data-testid": `${n}-field`,
|
|
37
|
-
children: /* @__PURE__ */ r(
|
|
38
|
+
children: /* @__PURE__ */ r(I, {
|
|
38
39
|
locale: e.locale,
|
|
39
|
-
children: /* @__PURE__ */ r(
|
|
40
|
+
children: /* @__PURE__ */ r(w, {
|
|
40
41
|
name: t,
|
|
41
42
|
children: ({
|
|
42
43
|
field: o,
|
|
43
44
|
meta: l
|
|
44
|
-
}) => /* @__PURE__ */ r(
|
|
45
|
+
}) => /* @__PURE__ */ r(L, {
|
|
45
46
|
...o,
|
|
46
|
-
...
|
|
47
|
-
ref:
|
|
47
|
+
...C,
|
|
48
|
+
ref: g,
|
|
48
49
|
calendarAriaLabel: e.formatMessage(a.selectDate),
|
|
49
50
|
className: s,
|
|
50
51
|
dataTargetId: "DatePicker-MetadataEditorDateField",
|
|
51
52
|
error: l.error,
|
|
52
|
-
isDisabled:
|
|
53
|
-
label:
|
|
54
|
-
onBlur: () =>
|
|
55
|
-
onChange: (
|
|
56
|
-
portalElement:
|
|
57
|
-
value:
|
|
53
|
+
isDisabled: f,
|
|
54
|
+
label: $(n, d, c, "span", m),
|
|
55
|
+
onBlur: () => P(),
|
|
56
|
+
onChange: (x) => F(x),
|
|
57
|
+
portalElement: p,
|
|
58
|
+
value: b
|
|
58
59
|
})
|
|
59
60
|
})
|
|
60
61
|
})
|
|
61
62
|
});
|
|
62
63
|
});
|
|
63
64
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
J as MetadataDateField,
|
|
66
|
+
J as default
|
|
66
67
|
};
|
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useIntl as
|
|
2
|
+
import { useFormikContext as A, getIn as C, Field as O } from "formik";
|
|
3
|
+
import { forwardRef as T } from "react";
|
|
4
|
+
import { useIntl as $, FormattedMessage as I } from "react-intl";
|
|
5
5
|
import u from "../../../../messages.js";
|
|
6
|
-
import { g as
|
|
7
|
-
import { messages as
|
|
8
|
-
import { MULTI_VALUE_DEFAULT_VALUE as
|
|
9
|
-
import { jsx as a, jsxs as
|
|
10
|
-
const
|
|
6
|
+
import { g as P } from "../../../../../../chunks/utils2.js";
|
|
7
|
+
import { messages as S } from "../update-mode-field-wrapper/messages.js";
|
|
8
|
+
import { MULTI_VALUE_DEFAULT_VALUE as j } from "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
9
|
+
import { jsx as a, jsxs as w } from "react/jsx-runtime";
|
|
10
|
+
const G = /* @__PURE__ */ T(({
|
|
11
11
|
className: c,
|
|
12
12
|
isAiSuggestionApplied: p,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
confidenceScore: f,
|
|
14
|
+
description: g,
|
|
15
|
+
disableForm: E,
|
|
15
16
|
fieldNamePrefix: s,
|
|
16
|
-
updateModePrefix:
|
|
17
|
+
updateModePrefix: h,
|
|
17
18
|
label: n,
|
|
18
|
-
onValueEdited:
|
|
19
|
-
options:
|
|
20
|
-
portalElement:
|
|
21
|
-
},
|
|
19
|
+
onValueEdited: v,
|
|
20
|
+
options: L,
|
|
21
|
+
portalElement: V
|
|
22
|
+
}, F) => {
|
|
22
23
|
const {
|
|
23
|
-
setFieldValue:
|
|
24
|
-
values:
|
|
25
|
-
} =
|
|
24
|
+
setFieldValue: M,
|
|
25
|
+
values: b
|
|
26
|
+
} = A(), {
|
|
26
27
|
formatMessage: i
|
|
27
|
-
} =
|
|
28
|
+
} = $(), m = `${h ?? s}.value`, x = i(S.multipleValues), U = (L || C(b, `${s}.options`, [])).map((e) => typeof e == "string" ? e : e.key), d = i(u.selectValuePlaceholder), _ = (e) => e === j ? x : e;
|
|
28
29
|
return /* @__PURE__ */ a("div", {
|
|
29
30
|
"data-testid": `${n}-field`,
|
|
30
|
-
children: /* @__PURE__ */ a(
|
|
31
|
+
children: /* @__PURE__ */ a(O, {
|
|
31
32
|
name: m,
|
|
32
33
|
children: ({
|
|
33
34
|
field: e
|
|
34
35
|
}) => /* @__PURE__ */ a(l, {
|
|
35
|
-
ref:
|
|
36
|
+
ref: F,
|
|
36
37
|
className: c,
|
|
37
38
|
"data-target-id": "Select-MetadataEditorEnumField",
|
|
38
|
-
disabled:
|
|
39
|
-
label:
|
|
39
|
+
disabled: E,
|
|
40
|
+
label: P(n, g, p, "label", f),
|
|
40
41
|
onValueChange: (t) => {
|
|
41
|
-
|
|
42
|
+
M(m, t === r ? "" : t), v();
|
|
42
43
|
},
|
|
43
44
|
placeholder: d,
|
|
44
45
|
...e,
|
|
45
46
|
value: e.value === r ? "" : e.value,
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
-
container:
|
|
47
|
+
children: /* @__PURE__ */ w(l.Content, {
|
|
48
|
+
container: V,
|
|
48
49
|
onEscapeKeyDown: (t) => t.stopPropagation(),
|
|
49
50
|
children: [/* @__PURE__ */ a(l.Option, {
|
|
50
51
|
text: d,
|
|
51
52
|
value: r,
|
|
52
|
-
children: /* @__PURE__ */ a(
|
|
53
|
+
children: /* @__PURE__ */ a(I, {
|
|
53
54
|
...u.selectValuePlaceholder
|
|
54
55
|
})
|
|
55
|
-
}),
|
|
56
|
-
const o =
|
|
56
|
+
}), U?.map((t) => {
|
|
57
|
+
const o = _(t);
|
|
57
58
|
return /* @__PURE__ */ a(l.Option, {
|
|
58
59
|
text: o,
|
|
59
60
|
value: t,
|
|
@@ -66,6 +67,6 @@ const B = /* @__PURE__ */ O(({
|
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
G as MetadataEnumField,
|
|
71
|
+
G as default
|
|
71
72
|
};
|
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
import { TextInput as I } from "@box/blueprint-web";
|
|
2
2
|
import { useFormikContext as M, getIn as R, Field as V } from "formik";
|
|
3
|
-
import { forwardRef as $, useRef as
|
|
4
|
-
import { g as
|
|
5
|
-
import { useFloatValidation as
|
|
3
|
+
import { forwardRef as $, useRef as B } from "react";
|
|
4
|
+
import { g as O } from "../../../../../../chunks/utils2.js";
|
|
5
|
+
import { useFloatValidation as j } from "./use-float-validation.js";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
-
const
|
|
8
|
-
className:
|
|
9
|
-
description:
|
|
7
|
+
const y = /* @__PURE__ */ $(({
|
|
8
|
+
className: l,
|
|
9
|
+
description: d,
|
|
10
10
|
isAiSuggestionApplied: i,
|
|
11
|
+
confidenceScore: n,
|
|
11
12
|
label: r,
|
|
12
|
-
fieldNamePrefix:
|
|
13
|
-
disableForm:
|
|
14
|
-
onValueEdited:
|
|
15
|
-
updateModePrefix:
|
|
16
|
-
},
|
|
13
|
+
fieldNamePrefix: s,
|
|
14
|
+
disableForm: u,
|
|
15
|
+
onValueEdited: c,
|
|
16
|
+
updateModePrefix: m
|
|
17
|
+
}, f) => {
|
|
17
18
|
const {
|
|
18
|
-
values:
|
|
19
|
-
setFieldValue:
|
|
20
|
-
setFieldTouched:
|
|
21
|
-
} = M(), t = `${
|
|
22
|
-
validateFloats:
|
|
23
|
-
} =
|
|
24
|
-
o.current = e,
|
|
25
|
-
},
|
|
26
|
-
|
|
19
|
+
values: p,
|
|
20
|
+
setFieldValue: F,
|
|
21
|
+
setFieldTouched: h
|
|
22
|
+
} = M(), t = `${m ?? s}.value`, g = R(p, t), o = B(g), {
|
|
23
|
+
validateFloats: v
|
|
24
|
+
} = j(), x = (e) => {
|
|
25
|
+
o.current = e, F(t, e), c();
|
|
26
|
+
}, T = (e) => {
|
|
27
|
+
h(e, !0);
|
|
27
28
|
};
|
|
28
29
|
return /* @__PURE__ */ a("div", {
|
|
29
30
|
"data-testid": `${r}-field`,
|
|
30
31
|
children: /* @__PURE__ */ a(V, {
|
|
31
32
|
name: `${t}`,
|
|
32
|
-
validate: () =>
|
|
33
|
+
validate: () => v(o.current),
|
|
33
34
|
children: ({
|
|
34
35
|
field: e,
|
|
35
|
-
meta:
|
|
36
|
+
meta: b
|
|
36
37
|
}) => /* @__PURE__ */ a(I, {
|
|
37
38
|
...e,
|
|
38
|
-
ref:
|
|
39
|
-
className:
|
|
39
|
+
ref: f,
|
|
40
|
+
className: l,
|
|
40
41
|
"data-target-id": "TextInput-MetadataEditorFloatField",
|
|
41
|
-
disabled:
|
|
42
|
-
error:
|
|
42
|
+
disabled: u,
|
|
43
|
+
error: b.error,
|
|
43
44
|
inputMode: "decimal",
|
|
44
|
-
label:
|
|
45
|
-
onBlur: () =>
|
|
46
|
-
onChange: (C) =>
|
|
45
|
+
label: O(r, d, i, "label", n),
|
|
46
|
+
onBlur: () => T(t),
|
|
47
|
+
onChange: (C) => x(C.currentTarget.value),
|
|
47
48
|
placeholder: "0"
|
|
48
49
|
})
|
|
49
50
|
})
|
|
50
51
|
});
|
|
51
52
|
});
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
y as MetadataFloatField,
|
|
55
|
+
y as default
|
|
55
56
|
};
|