@box/metadata-editor 0.78.5 → 0.78.7
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/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +22 -22
- package/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +35 -39
- package/package.json +2 -2
- package/styles/filter-instances-dropdown.css +1 -1
- package/types/lib/test-utils/sample-data.d.ts +2 -2
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/use-date-internationalization.js +0 -13
- package/types/lib/components/metadata-editor-fields/components/metadata-date-field/use-date-internationalization.d.ts +0 -6
@@ -1,16 +1,16 @@
|
|
1
1
|
import "../../../../styles/filter-instances-dropdown.css";
|
2
|
-
import { TriggerButton as v, Text as C, ScrollableContainer as N, Divider as
|
3
|
-
import { useIntl as
|
4
|
-
import { SelectProvider as
|
5
|
-
import { Space1 as
|
6
|
-
import { useEffect as
|
7
|
-
import
|
2
|
+
import { TriggerButton as v, Text as C, ScrollableContainer as N, Divider as x } from "@box/blueprint-web";
|
3
|
+
import { useIntl as B } from "react-intl";
|
4
|
+
import { SelectProvider as b, Select as I, SelectPopover as k, SelectItem as g, SelectItemCheck as M } from "@ariakit/react";
|
5
|
+
import { Space1 as S } from "@box/blueprint-web-assets/tokens/px-tokens";
|
6
|
+
import { useEffect as y } from "react";
|
7
|
+
import D from "clsx";
|
8
8
|
import { Checkmark as p } from "@box/blueprint-web-assets/icons/Fill";
|
9
|
-
import { getVisibleTemplates as
|
9
|
+
import { getVisibleTemplates as j, getTemplateDisplayName as _ } from "../../utils/utils.js";
|
10
10
|
import s from "./messages.js";
|
11
11
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
12
|
-
const
|
13
|
-
details:
|
12
|
+
const w = "_details_19fcm_1", F = "_triggerContainer_19fcm_5", O = "_triggerButton_19fcm_10", P = "_popover_19fcm_16", L = "_divider_19fcm_33", V = "_scrollableContainer_19fcm_36", z = "_item_19fcm_40", E = "_indicator_19fcm_67", G = "_indicatorIcon_19fcm_76", R = "_testContainer_19fcm_80", t = {
|
13
|
+
details: w,
|
14
14
|
triggerContainer: F,
|
15
15
|
triggerButton: O,
|
16
16
|
popover: P,
|
@@ -20,26 +20,26 @@ const j = "_details_w5gf4_1", F = "_triggerContainer_w5gf4_5", O = "_triggerButt
|
|
20
20
|
indicator: E,
|
21
21
|
indicatorIcon: G,
|
22
22
|
testContainer: R
|
23
|
-
}, q = parseInt(
|
23
|
+
}, q = parseInt(S, 10);
|
24
24
|
function tt({
|
25
25
|
appliedTemplates: f,
|
26
26
|
selectedTemplates: c,
|
27
27
|
setSelectedTemplates: l
|
28
28
|
}) {
|
29
|
-
const a =
|
29
|
+
const a = B(), d = a.formatMessage(s.customMetadataName), n = j(f), i = c.length, m = n.length, u = i === 0 ? a.formatMessage(s.allTemplatesTriggerButtonText) : a.formatMessage(s.selectedTemplatesTriggerButtonText, {
|
30
30
|
selectedTemplatesNumber: i,
|
31
31
|
visibleTemplatesNumber: m
|
32
32
|
}), h = () => {
|
33
33
|
l([]);
|
34
34
|
};
|
35
|
-
return
|
35
|
+
return y(() => {
|
36
36
|
i === m && l([]);
|
37
|
-
}, [i, m]), /* @__PURE__ */ o(
|
37
|
+
}, [i, m]), /* @__PURE__ */ o(b, {
|
38
38
|
setValue: l,
|
39
39
|
value: c,
|
40
40
|
children: [/* @__PURE__ */ o("div", {
|
41
41
|
className: t.triggerContainer,
|
42
|
-
children: [/* @__PURE__ */ e(
|
42
|
+
children: [/* @__PURE__ */ e(I, {
|
43
43
|
render: /* @__PURE__ */ e(v, {
|
44
44
|
caretDirection: "down",
|
45
45
|
className: t.triggerButton,
|
@@ -54,28 +54,28 @@ function tt({
|
|
54
54
|
color: "textOnLightSecondary",
|
55
55
|
"data-testid": "detailsList",
|
56
56
|
variant: "caption",
|
57
|
-
children: n.filter((r) => c.some((T) => T === r.id)).map((r) => _(r,
|
57
|
+
children: n.filter((r) => c.some((T) => T === r.id)).map((r) => _(r, d)).join(", ")
|
58
58
|
})]
|
59
|
-
}), /* @__PURE__ */ e(
|
59
|
+
}), /* @__PURE__ */ e(k, {
|
60
60
|
className: t.popover,
|
61
61
|
gutter: q,
|
62
62
|
children: /* @__PURE__ */ o(N, {
|
63
63
|
className: t.scrollableContainer,
|
64
|
-
children: [/* @__PURE__ */ o(
|
64
|
+
children: [/* @__PURE__ */ o(g, {
|
65
65
|
autoFocus: i === 0,
|
66
66
|
className: t.item,
|
67
67
|
hideOnClick: !0,
|
68
68
|
onClick: h,
|
69
69
|
children: [i === 0 && /* @__PURE__ */ e(p, {
|
70
|
-
className:
|
70
|
+
className: D(t.indicator, t.indicatorIcon)
|
71
71
|
}), a.formatMessage(s.allTemplatesTriggerButtonText)]
|
72
|
-
}), /* @__PURE__ */ e(
|
72
|
+
}), /* @__PURE__ */ e(x, {
|
73
73
|
className: t.divider
|
74
|
-
}), n.map((r) => /* @__PURE__ */ o(
|
74
|
+
}), n.map((r) => /* @__PURE__ */ o(g, {
|
75
75
|
className: t.item,
|
76
76
|
hideOnClick: !0,
|
77
77
|
value: r.id,
|
78
|
-
children: [/* @__PURE__ */ e(
|
78
|
+
children: [/* @__PURE__ */ e(M, {
|
79
79
|
className: t.indicator,
|
80
80
|
style: {
|
81
81
|
width: "none",
|
@@ -84,7 +84,7 @@ function tt({
|
|
84
84
|
children: /* @__PURE__ */ e(p, {
|
85
85
|
className: t.indicatorIcon
|
86
86
|
})
|
87
|
-
}), _(r,
|
87
|
+
}), _(r, d)]
|
88
88
|
}, r.id))]
|
89
89
|
})
|
90
90
|
})]
|
@@ -1,83 +1,79 @@
|
|
1
1
|
import I from "clsx";
|
2
|
-
import { useFormikContext as
|
3
|
-
import
|
4
|
-
import { forwardRef as
|
2
|
+
import { useFormikContext as V } from "formik";
|
3
|
+
import v from "lodash/isUndefined";
|
4
|
+
import { forwardRef as C, useState as F, useCallback as P, useEffect as R } from "react";
|
5
5
|
import { AiSuggestionField as T } from "./components/ai-suggestion-field/ai-suggestion-field.js";
|
6
6
|
import { UpdateModeFieldWrapper as U } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
7
7
|
import { editorFieldTypes as b } from "./editor-field-types.js";
|
8
|
-
import {
|
9
|
-
import { jsx as a, jsxs as
|
10
|
-
const
|
11
|
-
disableForm:
|
8
|
+
import { s as n } from "../../../../chunks/utils.js";
|
9
|
+
import { jsx as a, jsxs as j } from "react/jsx-runtime";
|
10
|
+
const L = /* @__PURE__ */ C(({
|
11
|
+
disableForm: d,
|
12
12
|
portalElement: u,
|
13
13
|
field: e,
|
14
14
|
index: M,
|
15
|
-
taxonomyOptionsFetcher:
|
16
|
-
},
|
15
|
+
taxonomyOptionsFetcher: g
|
16
|
+
}, c) => {
|
17
17
|
var x;
|
18
18
|
const {
|
19
|
-
setFieldValue:
|
20
|
-
} =
|
21
|
-
|
19
|
+
setFieldValue: m
|
20
|
+
} = V(), [N, f] = F(!0), [p, S] = F(!1), r = b[e.type], {
|
21
|
+
aiSuggestion: t,
|
22
|
+
type: A,
|
22
23
|
value: y
|
23
|
-
} = e
|
24
|
-
|
25
|
-
aiSuggestion: t
|
26
|
-
} = e;
|
27
|
-
l === "date" && typeof t == "string" && (t = j(t));
|
28
|
-
const W = p && !e.hidden, k = !V(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
|
29
|
-
[n.suggestionApplied]: r,
|
24
|
+
} = e, W = r && !e.hidden, k = !v(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
|
25
|
+
[n.suggestionApplied]: p,
|
30
26
|
[n.hasSuggestion]: i,
|
31
|
-
[n.dateField]:
|
32
|
-
}), o =
|
33
|
-
|
34
|
-
}, [s,
|
27
|
+
[n.dateField]: A === "date"
|
28
|
+
}), o = P((l) => {
|
29
|
+
m(`${s}.value`, l), f(!1), S(!0);
|
30
|
+
}, [s, m]);
|
35
31
|
R(() => {
|
36
32
|
!i || y || o(t);
|
37
33
|
}, [i, t, o]);
|
38
34
|
const h = () => {
|
39
|
-
|
35
|
+
p && S(!1);
|
40
36
|
};
|
41
37
|
return W ? k ? /* @__PURE__ */ a(U, {
|
42
38
|
fieldNamePrefix: s,
|
43
39
|
fieldType: e.type,
|
44
40
|
isTaxonomyMultiSelect: w,
|
45
|
-
children: /* @__PURE__ */ a(
|
46
|
-
ref:
|
41
|
+
children: /* @__PURE__ */ a(r, {
|
42
|
+
ref: c,
|
47
43
|
description: e.description,
|
48
|
-
disableForm:
|
44
|
+
disableForm: d,
|
49
45
|
fieldNamePrefix: s,
|
50
46
|
isAiSuggestionApplied: !1,
|
51
47
|
label: e.displayName,
|
52
48
|
onValueEdited: h,
|
53
49
|
portalElement: u,
|
54
|
-
taxonomyOptionsFetcher:
|
50
|
+
taxonomyOptionsFetcher: g
|
55
51
|
})
|
56
|
-
}, e.key) : /* @__PURE__ */
|
52
|
+
}, e.key) : /* @__PURE__ */ j("div", {
|
57
53
|
className: n.fieldWrapper,
|
58
|
-
children: [/* @__PURE__ */ a(
|
59
|
-
ref:
|
54
|
+
children: [/* @__PURE__ */ a(r, {
|
55
|
+
ref: c,
|
60
56
|
className: E,
|
61
57
|
description: e.description,
|
62
|
-
disableForm:
|
58
|
+
disableForm: d,
|
63
59
|
fieldNamePrefix: s,
|
64
|
-
isAiSuggestionApplied:
|
60
|
+
isAiSuggestionApplied: p,
|
65
61
|
label: e.displayName,
|
66
62
|
onValueEdited: h,
|
67
63
|
portalElement: u,
|
68
|
-
taxonomyOptionsFetcher:
|
64
|
+
taxonomyOptionsFetcher: g
|
69
65
|
}), i && /* @__PURE__ */ a(T, {
|
70
66
|
aiSuggestion: t,
|
71
67
|
onAiSuggestionAppend: () => {
|
72
|
-
const
|
73
|
-
o(
|
68
|
+
const l = [...new Set([y, t].flat().filter(Boolean))];
|
69
|
+
o(l);
|
74
70
|
},
|
75
|
-
onAiSuggestionIgnore: () =>
|
71
|
+
onAiSuggestionIgnore: () => f(!1),
|
76
72
|
onAiSuggestionReplace: () => o(t),
|
77
|
-
type:
|
73
|
+
type: A
|
78
74
|
})]
|
79
75
|
}, e.key) : null;
|
80
76
|
});
|
81
77
|
export {
|
82
|
-
|
78
|
+
L as MetadataEditorFieldWrapper
|
83
79
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.78.
|
3
|
+
"version": "0.78.7",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.14",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "fc7471f2055ee977d4caf07e744e3a86070d2411"
|
57
57
|
}
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._details_19fcm_1{padding-inline:var(--size-1)}._triggerContainer_19fcm_5{display:flex;flex-direction:column}._triggerButton_19fcm_10{min-height:var(--size-6)!important;max-width:max-content;padding:0 var(--space-1)!important}._popover_19fcm_16{font-weight:400;font-size:.875rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.25rem;letter-spacing:.01875rem;text-transform:none;text-decoration:none;z-index:var(--z-index-popover);box-sizing:border-box;max-width:17.75rem;padding:0;background-color:var(--surface-menu-surface);border:var(--border-1) solid var(--border-card-border);border-radius:var(--radius-3);box-shadow:var(--dropshadow-3)}._popover_19fcm_16 ._divider_19fcm_33{margin-block:var(--space-2)}._popover_19fcm_16 ._scrollableContainer_19fcm_36{padding:var(--space-3);max-height:22.5rem}._popover_19fcm_16 ._item_19fcm_40{position:relative;align-items:center;padding:var(--border-8) var(--space-2) var(--border-8) var(--space-10);border:var(--border-2) solid transparent;border-radius:var(--radius-3);outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}._popover_19fcm_16 ._item_19fcm_40[aria-disabled]{color:var(--gray-65);pointer-events:none}._popover_19fcm_16 ._item_19fcm_40[data-active-item]:not(:hover),._popover_19fcm_16 ._item_19fcm_40[data-highlighted]:not(:hover){background-color:var(--surface-menu-surface-hover);border:var(--border-2) solid var(--border-input-border-focus)}._popover_19fcm_16 ._item_19fcm_40[data-state=open],._popover_19fcm_16 ._item_19fcm_40:hover{background-color:var(--surface-menu-surface-hover)}._popover_19fcm_16 ._indicator_19fcm_67{position:absolute;top:0;left:var(--space-2);display:flex;align-items:center;justify-content:center;height:var(--size-9)}._popover_19fcm_16 ._indicatorIcon_19fcm_76 path{fill:var(--icon-icon-on-light)}._testContainer_19fcm_80{border:2px #9f3fed dashed;height:56px;width:340px;display:flex;align-items:center}
|
@@ -22,7 +22,7 @@ declare const templateOptions: MetadataTemplateOption[];
|
|
22
22
|
declare const fields: MetadataTemplateField[];
|
23
23
|
declare const floatInstanceField: MetadataTemplateField;
|
24
24
|
declare const allFieldsTemplateInstance: MetadataTemplateInstance;
|
25
|
-
declare const
|
25
|
+
declare const dateSuggestionTemplateInstance: MetadataTemplateInstance;
|
26
26
|
declare const templateInstanceWithoutEmptyValues: MetadataTemplateInstance;
|
27
27
|
declare const emptyTemplateInstance: MetadataTemplateInstance;
|
28
28
|
declare const templateInstanceWithAllFieldsEmpty: MetadataTemplateInstance;
|
@@ -43,4 +43,4 @@ declare const firstTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[
|
|
43
43
|
declare const secondTemplateInstance: MetadataTemplate;
|
44
44
|
declare const secondTemplateSuggestions: AutofillSuggestions;
|
45
45
|
declare const secondTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[];
|
46
|
-
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField,
|
46
|
+
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, dateSuggestionTemplateInstance, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, hiddenTemplate, hiddenTemplateInstance, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, onlyRequiredPropsTemplateInstance, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { DateFormatter as a, getLocalTimeZone as n } from "@box/blueprint-web";
|
2
|
-
import { useMemo as m } from "react";
|
3
|
-
const D = (t) => {
|
4
|
-
const o = m(() => new a(t), [t]), e = n();
|
5
|
-
return {
|
6
|
-
locale: t,
|
7
|
-
localTimezone: e,
|
8
|
-
formatCalendarDate: (r) => o.format(r.toDate(e))
|
9
|
-
};
|
10
|
-
};
|
11
|
-
export {
|
12
|
-
D as useDateInternationalization
|
13
|
-
};
|