@box/metadata-editor 0.51.1 → 0.52.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 +18 -16
- package/esm/index.js +16 -16
- package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +191 -0
- package/esm/lib/components/combobox-with-api-pagination/index.js +4 -0
- package/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +40 -0
- package/esm/lib/components/interactive-text/interactive-text.js +16 -10
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +57 -50
- package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +39 -30
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +43 -34
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +39 -30
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +37 -28
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.js +8 -0
- package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +8 -8
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +19 -21
- package/package.json +3 -3
- package/styles/interactive-text.css +1 -0
- package/styles/metadata-instance-entry.css +1 -1
- package/types/index.d.ts +1 -1
- package/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +2 -0
- package/types/lib/components/combobox-with-api-pagination/index.d.ts +2 -0
- package/types/lib/components/combobox-with-api-pagination/types.d.ts +35 -0
- package/types/lib/components/combobox-with-api-pagination/utils/use-controllable-state.d.ts +8 -0
- package/types/lib/components/interactive-text/interactive-text.d.ts +2 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.d.ts +21 -0
- package/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
- package/types/lib/test-utils/sample-data.d.ts +1 -1
- package/esm/lib/components/metadata-taxonomy-field/combobox-with-api-pagination.js +0 -188
- package/esm/lib/components/metadata-taxonomy-field/single-level-taxonomy-field.js +0 -19
- package/types/lib/components/metadata-taxonomy-field/combobox-with-api-pagination.d.ts +0 -15
- package/types/lib/components/metadata-taxonomy-field/types.d.ts +0 -41
- /package/esm/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/messages.js +0 -0
- /package/esm/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/request.js +0 -0
- /package/esm/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/use-async-list.js +0 -0
- /package/esm/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/utils/use-intersection-observer.js +0 -0
- /package/esm/lib/components/{metadata-taxonomy-field → metadata-editor-fields/components/metadata-taxonomy-field}/index.js +0 -0
- /package/i18n/json/src/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/messages.json +0 -0
- /package/types/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/messages.d.ts +0 -0
- /package/types/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/request.d.ts +0 -0
- /package/types/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/use-async-list.d.ts +0 -0
- /package/types/lib/components/{metadata-taxonomy-field → combobox-with-api-pagination}/utils/use-intersection-observer.d.ts +0 -0
- /package/types/lib/components/{metadata-taxonomy-field → metadata-editor-fields/components/metadata-taxonomy-field}/index.d.ts +0 -0
- /package/types/lib/components/{metadata-taxonomy-field → metadata-editor-fields/components/metadata-taxonomy-field}/single-level-taxonomy-field.d.ts +0 -0
@@ -1,49 +1,58 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useRef as
|
4
|
-
import
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
import { TextInput as x } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as T, getIn as g, Field as C } from "formik";
|
3
|
+
import { useRef as I } from "react";
|
4
|
+
import V from "../../../interactive-text/interactive-text.js";
|
5
|
+
import { fieldDefaultProps as $ } from "../constants.js";
|
6
|
+
import { useFloatValidation as B } from "./use-float-validation.js";
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
8
|
+
const N = ({
|
9
|
+
className: i,
|
10
|
+
description: l,
|
11
|
+
label: r,
|
12
|
+
fieldNamePrefix: d,
|
13
|
+
disableForm: s
|
12
14
|
}) => {
|
13
15
|
const {
|
14
|
-
values:
|
15
|
-
setFieldValue:
|
16
|
-
setFieldTouched:
|
17
|
-
} =
|
18
|
-
validateFloats:
|
19
|
-
} =
|
20
|
-
|
21
|
-
},
|
22
|
-
|
16
|
+
values: u,
|
17
|
+
setFieldValue: m,
|
18
|
+
setFieldTouched: c
|
19
|
+
} = T(), t = `${d}.value`, f = g(u, t), n = I(f), {
|
20
|
+
validateFloats: p
|
21
|
+
} = B(), h = (e) => {
|
22
|
+
n.current = e, m(t, e);
|
23
|
+
}, F = (e) => {
|
24
|
+
c(e, !0);
|
23
25
|
};
|
24
|
-
return /* @__PURE__ */
|
25
|
-
"data-testid": `${
|
26
|
-
children: /* @__PURE__ */
|
26
|
+
return /* @__PURE__ */ a("div", {
|
27
|
+
"data-testid": `${r}-field`,
|
28
|
+
children: /* @__PURE__ */ a(C, {
|
27
29
|
name: `${t}`,
|
28
|
-
validate: () =>
|
30
|
+
validate: () => p(n.current),
|
29
31
|
children: ({
|
30
32
|
field: e,
|
31
|
-
meta:
|
32
|
-
}) => /* @__PURE__ */
|
33
|
-
|
33
|
+
meta: v
|
34
|
+
}) => /* @__PURE__ */ a(x, {
|
35
|
+
...$,
|
34
36
|
...e,
|
35
37
|
className: i,
|
36
|
-
disabled:
|
37
|
-
error:
|
38
|
-
label:
|
39
|
-
|
40
|
-
|
38
|
+
disabled: s,
|
39
|
+
error: v.error,
|
40
|
+
label: l ? ({
|
41
|
+
...o
|
42
|
+
}) => V({
|
43
|
+
as: "label",
|
44
|
+
tooltipText: l,
|
45
|
+
children: r,
|
46
|
+
...o
|
47
|
+
}) : r,
|
48
|
+
onBlur: () => F(t),
|
49
|
+
onChange: (o) => h(o.currentTarget.value),
|
41
50
|
placeholder: "0"
|
42
51
|
})
|
43
52
|
})
|
44
53
|
});
|
45
54
|
};
|
46
55
|
export {
|
47
|
-
|
48
|
-
|
56
|
+
N as MetadataFloatField,
|
57
|
+
N as default
|
49
58
|
};
|
@@ -1,45 +1,54 @@
|
|
1
|
-
import { TooltipProvider as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useIntl as
|
4
|
-
import
|
5
|
-
import
|
1
|
+
import { TooltipProvider as F, Combobox as g } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as x, getIn as C, Field as b } from "formik";
|
3
|
+
import { useIntl as I } from "react-intl";
|
4
|
+
import M from "../../../../messages.js";
|
5
|
+
import T from "../../../interactive-text/interactive-text.js";
|
6
|
+
import { fieldDefaultProps as $ } from "../constants.js";
|
6
7
|
import { jsx as o } from "react/jsx-runtime";
|
7
|
-
const
|
8
|
+
const O = ({
|
8
9
|
className: s,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
description: a,
|
11
|
+
disableForm: m,
|
12
|
+
fieldNamePrefix: i,
|
13
|
+
label: l,
|
14
|
+
portalElement: u,
|
15
|
+
options: d
|
14
16
|
}) => {
|
15
17
|
const {
|
16
|
-
setFieldValue:
|
17
|
-
values:
|
18
|
-
} =
|
18
|
+
setFieldValue: c,
|
19
|
+
values: p
|
20
|
+
} = x(), f = I(), n = `${i}.value`, h = d || C(p, `${i}.options`, []).map(({
|
19
21
|
key: e
|
20
|
-
}) => e),
|
22
|
+
}) => e), v = (e, t) => t.toLowerCase().includes(e.toLowerCase());
|
21
23
|
return /* @__PURE__ */ o("div", {
|
22
|
-
"data-testid": `${
|
23
|
-
children: /* @__PURE__ */ o(
|
24
|
-
name:
|
24
|
+
"data-testid": `${l}-field`,
|
25
|
+
children: /* @__PURE__ */ o(b, {
|
26
|
+
name: n,
|
25
27
|
children: ({
|
26
28
|
field: e
|
27
29
|
}) => {
|
28
30
|
var t;
|
29
|
-
return /* @__PURE__ */ o(
|
30
|
-
children: /* @__PURE__ */ o(
|
31
|
-
|
31
|
+
return /* @__PURE__ */ o(F, {
|
32
|
+
children: /* @__PURE__ */ o(g, {
|
33
|
+
...$,
|
32
34
|
as: "input",
|
33
35
|
className: s,
|
34
|
-
disabled:
|
35
|
-
filterFn:
|
36
|
-
label:
|
36
|
+
disabled: m,
|
37
|
+
filterFn: v,
|
38
|
+
label: a ? ({
|
39
|
+
...r
|
40
|
+
}) => T({
|
41
|
+
as: "label",
|
42
|
+
tooltipText: a,
|
43
|
+
children: l,
|
44
|
+
...r
|
45
|
+
}) : l,
|
37
46
|
multiselect: !0,
|
38
47
|
name: e.name,
|
39
|
-
onValueChange: (
|
40
|
-
options:
|
41
|
-
placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ?
|
42
|
-
portalElement:
|
48
|
+
onValueChange: (r) => c(n, r),
|
49
|
+
options: h,
|
50
|
+
placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? f.formatMessage(M.multiselectPlaceholder) : "",
|
51
|
+
portalElement: u,
|
43
52
|
value: e.value
|
44
53
|
})
|
45
54
|
});
|
@@ -48,6 +57,6 @@ const k = ({
|
|
48
57
|
});
|
49
58
|
};
|
50
59
|
export {
|
51
|
-
|
52
|
-
|
60
|
+
O as MetadataMultiSelectField,
|
61
|
+
O as default
|
53
62
|
};
|
@@ -1,37 +1,46 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { Field as
|
3
|
-
import { useIntl as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
import { TextInput as n } from "@box/blueprint-web";
|
2
|
+
import { Field as p } from "formik";
|
3
|
+
import { useIntl as c } from "react-intl";
|
4
|
+
import u from "../../../../messages.js";
|
5
|
+
import h from "../../../interactive-text/interactive-text.js";
|
6
|
+
import { fieldDefaultProps as x } from "../constants.js";
|
7
|
+
import { jsx as t } from "react/jsx-runtime";
|
8
|
+
const g = ({
|
9
|
+
description: r,
|
10
|
+
label: e,
|
11
|
+
fieldNamePrefix: a,
|
12
|
+
disableForm: o,
|
13
|
+
className: i
|
12
14
|
}) => {
|
13
|
-
const
|
14
|
-
return /* @__PURE__ */
|
15
|
-
"data-testid": `${
|
16
|
-
children: /* @__PURE__ */
|
15
|
+
const l = c(), d = `${a}.value`;
|
16
|
+
return /* @__PURE__ */ t("div", {
|
17
|
+
"data-testid": `${e}-field`,
|
18
|
+
children: /* @__PURE__ */ t(p, {
|
17
19
|
name: d,
|
18
20
|
children: ({
|
19
|
-
field:
|
20
|
-
meta:
|
21
|
-
}) => /* @__PURE__ */
|
22
|
-
...
|
23
|
-
...
|
24
|
-
className:
|
25
|
-
disabled:
|
26
|
-
error:
|
27
|
-
label: r
|
28
|
-
|
21
|
+
field: m,
|
22
|
+
meta: s
|
23
|
+
}) => /* @__PURE__ */ t(n, {
|
24
|
+
...x,
|
25
|
+
...m,
|
26
|
+
className: i,
|
27
|
+
disabled: o,
|
28
|
+
error: s.error,
|
29
|
+
label: r ? ({
|
30
|
+
...f
|
31
|
+
}) => h({
|
32
|
+
as: "label",
|
33
|
+
tooltipText: r,
|
34
|
+
children: e,
|
35
|
+
...f
|
36
|
+
}) : e,
|
37
|
+
placeholder: l.formatMessage(u.setValuePlaceholder)
|
29
38
|
})
|
30
39
|
})
|
31
40
|
});
|
32
41
|
};
|
33
|
-
|
42
|
+
g.displayName = "MetadataStringField";
|
34
43
|
export {
|
35
|
-
|
36
|
-
|
44
|
+
g as MetadataStringField,
|
45
|
+
g as default
|
37
46
|
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { ComboboxWithApiPagination as i } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
3
|
+
const m = (o) => /* @__PURE__ */ r(i, {
|
4
|
+
...o
|
5
|
+
});
|
6
|
+
export {
|
7
|
+
m as SingleLevelTaxonomyField
|
8
|
+
};
|
@@ -18,13 +18,13 @@ const $ = "_wrapperContianer_1n09p_1", B = "_fieldContainer_1n09p_6", U = "_fiel
|
|
18
18
|
hidden: V
|
19
19
|
}, j = (e) => e === i.ReplaceEntered, y = (e) => e === "string" || e === "multiSelect", O = ({
|
20
20
|
children: e,
|
21
|
-
fieldNamePrefix:
|
21
|
+
fieldNamePrefix: d,
|
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 = `${
|
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(({
|
28
28
|
key: c
|
29
29
|
}) => c);
|
30
30
|
return /* @__PURE__ */ s("div", {
|
@@ -37,7 +37,7 @@ const $ = "_wrapperContianer_1n09p_1", B = "_fieldContainer_1n09p_6", U = "_fiel
|
|
37
37
|
}), /* @__PURE__ */ o(b, {
|
38
38
|
"aria-label": t.formatMessage(n.toggleUpdateModeSelectiorAriaLabel),
|
39
39
|
className: a.collapseButton,
|
40
|
-
"data-testid": `${
|
40
|
+
"data-testid": `${r.props.label}-update-mode-toggle`,
|
41
41
|
icon: p ? I : R,
|
42
42
|
onClick: () => {
|
43
43
|
M(!p);
|
@@ -49,11 +49,11 @@ const $ = "_wrapperContianer_1n09p_1", B = "_fieldContainer_1n09p_6", U = "_fiel
|
|
49
49
|
[a.hidden]: p
|
50
50
|
}),
|
51
51
|
children: [/* @__PURE__ */ o(A, {
|
52
|
-
name: `${
|
52
|
+
name: `${d}.updateMode.mode`,
|
53
53
|
children: ({
|
54
54
|
field: c
|
55
55
|
}) => /* @__PURE__ */ s(l.Group, {
|
56
|
-
"data-testid": `${
|
56
|
+
"data-testid": `${r.props.label}-radio-group`,
|
57
57
|
loop: !0,
|
58
58
|
onValueChange: (F) => g(u, F),
|
59
59
|
orientation: "vertical",
|
@@ -72,11 +72,11 @@ const $ = "_wrapperContianer_1n09p_1", B = "_fieldContainer_1n09p_6", U = "_fiel
|
|
72
72
|
value: i.ReplaceEntered
|
73
73
|
})]
|
74
74
|
})
|
75
|
-
}), j(h) &&
|
75
|
+
}), j(h) && r && /* @__PURE__ */ o("div", {
|
76
76
|
className: a.additionalFieldContainer,
|
77
|
-
children: /* @__PURE__ */ _.cloneElement(
|
77
|
+
children: /* @__PURE__ */ _.cloneElement(r, {
|
78
78
|
// This field edits ${fieldNamePrefix}.updateMode.value, the '.value' is added by the field component
|
79
|
-
fieldNamePrefix: `${
|
79
|
+
fieldNamePrefix: `${d}.updateMode`,
|
80
80
|
options: v,
|
81
81
|
label: t.formatMessage(n.with)
|
82
82
|
})
|
@@ -1,17 +1,16 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-entry.css";
|
2
2
|
import { Text as o } from "@box/blueprint-web";
|
3
|
-
import { FormattedDate as
|
4
|
-
import { convertISOStringToUTCDate as
|
5
|
-
import
|
6
|
-
import { jsxs as
|
7
|
-
const
|
8
|
-
metadataInstanceEntry:
|
9
|
-
|
10
|
-
|
11
|
-
description: r,
|
3
|
+
import { FormattedDate as s } from "react-intl";
|
4
|
+
import { convertISOStringToUTCDate as d } from "./convertDate.js";
|
5
|
+
import f from "../../../interactive-text/interactive-text.js";
|
6
|
+
import { jsxs as y, jsx as r } from "react/jsx-runtime";
|
7
|
+
const l = "_metadataInstanceEntry_gwoh6_1", p = {
|
8
|
+
metadataInstanceEntry: l
|
9
|
+
}, S = ({
|
10
|
+
description: a,
|
12
11
|
name: e,
|
13
12
|
shouldHideEmptyValues: i,
|
14
|
-
type:
|
13
|
+
type: c,
|
15
14
|
value: t
|
16
15
|
}) => {
|
17
16
|
const n = (() => {
|
@@ -21,9 +20,9 @@ const I = "_metadataInstanceEntry_1qhk8_1", p = "_metadataInstanceEntryInteracti
|
|
21
20
|
return null;
|
22
21
|
if (Array.isArray(t))
|
23
22
|
return t.join(", ");
|
24
|
-
if (
|
25
|
-
const m =
|
26
|
-
return /* @__PURE__ */
|
23
|
+
if (c === "date" && typeof t == "string") {
|
24
|
+
const m = d(t);
|
25
|
+
return /* @__PURE__ */ r(s, {
|
27
26
|
day: "numeric",
|
28
27
|
month: "long",
|
29
28
|
value: m,
|
@@ -32,26 +31,25 @@ const I = "_metadataInstanceEntry_1qhk8_1", p = "_metadataInstanceEntryInteracti
|
|
32
31
|
}
|
33
32
|
return t;
|
34
33
|
})();
|
35
|
-
return i && !n ? null : /* @__PURE__ */
|
36
|
-
className:
|
37
|
-
children: [/* @__PURE__ */
|
34
|
+
return i && !n ? null : /* @__PURE__ */ y("div", {
|
35
|
+
className: p.metadataInstanceEntry,
|
36
|
+
children: [/* @__PURE__ */ r(o, {
|
38
37
|
as: "p",
|
39
38
|
color: "textOnLightSecondary",
|
40
39
|
variant: "bodyDefaultBold",
|
41
|
-
children:
|
40
|
+
children: a ? /* @__PURE__ */ r(f, {
|
42
41
|
as: "span",
|
43
|
-
className: c.metadataInstanceEntryInteractiveLabel,
|
44
42
|
color: "textOnLightSecondary",
|
45
|
-
tooltipText:
|
43
|
+
tooltipText: a,
|
46
44
|
variant: "bodyDefaultBold",
|
47
45
|
children: e
|
48
46
|
}) : e
|
49
|
-
}), n && /* @__PURE__ */
|
47
|
+
}), n && /* @__PURE__ */ r(o, {
|
50
48
|
as: "p",
|
51
49
|
children: n
|
52
50
|
})]
|
53
51
|
});
|
54
52
|
};
|
55
53
|
export {
|
56
|
-
|
54
|
+
S as MetadataInstanceEntry
|
57
55
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.52.0",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.20.0",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
},
|
14
14
|
"devDependencies": {
|
15
15
|
"@ariakit/react": "0.4.5",
|
16
|
-
"@box/blueprint-web": "^7.
|
16
|
+
"@box/blueprint-web": "^7.26.0",
|
17
17
|
"@box/blueprint-web-assets": "^4.23.0",
|
18
18
|
"@box/storybook-utils": "^0.6.1",
|
19
19
|
"@testing-library/react": "^15.0.6",
|
@@ -52,5 +52,5 @@
|
|
52
52
|
"**/*.css"
|
53
53
|
],
|
54
54
|
"license": "SEE LICENSE IN LICENSE",
|
55
|
-
"gitHead": "
|
55
|
+
"gitHead": "e065ce29641de99f4dd47486a9f6928da2cfaa74"
|
56
56
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
._interactiveText_2jv0p_1{text-decoration:dashed underline var(--gray-50) .5px!important;text-underline-offset:2px;width:fit-content}._interactiveText_2jv0p_1:hover{color:var(--gray-100);text-decoration-color:var(--gray-100)!important}
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._metadataInstanceEntry_gwoh6_1{display:flex;flex-direction:column;gap:var(--space-2)}
|
package/types/index.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
export * from './lib/components/add-metadata-template-dropdown';
|
2
2
|
export * from './lib/components/filter-dropdown-menu';
|
3
|
+
export * from './lib/components/metadata-editor-fields/components/metadata-taxonomy-field';
|
3
4
|
export * from './lib/components/metadata-empty-state/metadata-empty-state';
|
4
5
|
export * from './lib/components/metadata-instance-editor';
|
5
6
|
export * from './lib/components/metadata-instance-list';
|
6
|
-
export * from './lib/components/metadata-taxonomy-field';
|
7
7
|
export * from './lib/components/unsaved-changes-modal';
|
8
8
|
export * from './lib/defaults';
|
9
9
|
export * from './lib/metadata-editor';
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { type ReactElement } from 'react';
|
2
|
+
export interface PaginationQueryInput {
|
3
|
+
marker?: string;
|
4
|
+
searchInput?: string;
|
5
|
+
/**
|
6
|
+
* Abort signal that will be used to cancel the request in your fetching function
|
7
|
+
*/
|
8
|
+
signal?: AbortSignal;
|
9
|
+
}
|
10
|
+
export interface FetcherResponse<T> {
|
11
|
+
marker?: string;
|
12
|
+
options: T[];
|
13
|
+
}
|
14
|
+
export interface BaseOptionType {
|
15
|
+
id?: string;
|
16
|
+
value: string;
|
17
|
+
}
|
18
|
+
interface BaseComboboxProps<T extends BaseOptionType, M extends boolean> {
|
19
|
+
defaultFetcher(input: PaginationQueryInput): Promise<FetcherResponse<T>>;
|
20
|
+
includeTextInputOption?: boolean;
|
21
|
+
noResultMessage?: ReactElement | string;
|
22
|
+
onInputValueChange?: (inputValue: string) => void;
|
23
|
+
multiselect: M;
|
24
|
+
onValueChange?: (selectedOptions: M extends true ? T[] : T) => void;
|
25
|
+
value?: M extends true ? T[] : T;
|
26
|
+
defaultValue?: M extends true ? T[] : T;
|
27
|
+
label: string;
|
28
|
+
loadingAriaLabel?: string;
|
29
|
+
portalElement?: HTMLElement | (() => HTMLElement);
|
30
|
+
experimentalVirtualization?: boolean;
|
31
|
+
}
|
32
|
+
export type SingleSelectComboboxWithApiPaginationProps<T extends BaseOptionType> = BaseComboboxProps<T, false>;
|
33
|
+
export type MultiselectComboboxWithApiPaginationProps<T extends BaseOptionType> = BaseComboboxProps<T, true>;
|
34
|
+
export type ComboboxWithApiPaginationProps<T extends BaseOptionType> = SingleSelectComboboxWithApiPaginationProps<T> | MultiselectComboboxWithApiPaginationProps<T>;
|
35
|
+
export {};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface UseControllableStateParams<T> {
|
3
|
+
prop?: T | undefined;
|
4
|
+
defaultProp?: T | undefined;
|
5
|
+
onChange?: (state: T) => void;
|
6
|
+
}
|
7
|
+
declare function useControllableState<T>({ prop, defaultProp, onChange }: UseControllableStateParams<T>): readonly [T, React.Dispatch<React.SetStateAction<T>>];
|
8
|
+
export { useControllableState };
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { type TextProps } from '@box/blueprint-web';
|
2
2
|
export type InteractiveTextProps = TextProps & {
|
3
|
+
className?: string;
|
3
4
|
tooltipText: string;
|
4
5
|
};
|
5
6
|
/**
|
6
7
|
* Wrapper component for displaying tooltip content on focusing text nodes
|
7
8
|
*/
|
8
|
-
declare const InteractiveText: ({ tooltipText, children, ...props }: InteractiveTextProps) => import("react/jsx-runtime").JSX.Element;
|
9
|
+
declare const InteractiveText: ({ tooltipText, className, children, ...props }: InteractiveTextProps) => import("react/jsx-runtime").JSX.Element;
|
9
10
|
export default InteractiveText;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { type MetadataFieldProps } from '../../types';
|
2
|
-
export declare const MetadataDateField: ({ disableForm, fieldNamePrefix, label, portalElement, className, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
2
|
+
export declare const MetadataDateField: ({ description, disableForm, fieldNamePrefix, label, portalElement, className, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default MetadataDateField;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { type MetadataFieldProps } from '../../types';
|
2
|
-
export declare const MetadataEnumField: ({ className, disableForm, fieldNamePrefix, label, options, portalElement, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
2
|
+
export declare const MetadataEnumField: ({ className, description, disableForm, fieldNamePrefix, label, options, portalElement, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default MetadataEnumField;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { type MetadataFieldProps } from '../../types';
|
2
|
-
export declare const MetadataFloatField: ({ label, fieldNamePrefix, disableForm,
|
2
|
+
export declare const MetadataFloatField: ({ className, description, label, fieldNamePrefix, disableForm, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default MetadataFloatField;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { type MetadataFieldProps } from '../../types';
|
2
|
-
export declare const MetadataMultiSelectField: ({ className, disableForm, fieldNamePrefix, label, portalElement, options, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
2
|
+
export declare const MetadataMultiSelectField: ({ className, description, disableForm, fieldNamePrefix, label, portalElement, options, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default MetadataMultiSelectField;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type MetadataFieldProps } from '../../types';
|
2
2
|
export declare const MetadataStringField: {
|
3
|
-
({ label, fieldNamePrefix, disableForm, className }: MetadataFieldProps): import("react/jsx-runtime").JSX.Element;
|
3
|
+
({ description, label, fieldNamePrefix, disableForm, className, }: MetadataFieldProps): import("react/jsx-runtime").JSX.Element;
|
4
4
|
displayName: string;
|
5
5
|
};
|
6
6
|
export default MetadataStringField;
|
package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.d.ts
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
import { type ComboboxWithApiPaginationProps } from '../../../combobox-with-api-pagination';
|
2
|
+
export interface PaginationQueryInput {
|
3
|
+
marker?: string;
|
4
|
+
searchInput?: string;
|
5
|
+
/**
|
6
|
+
* Abort signal that will be used to cancel the request in your fetching function
|
7
|
+
*/
|
8
|
+
signal?: AbortSignal;
|
9
|
+
}
|
10
|
+
export interface TaxonomyFetcherResponse {
|
11
|
+
marker?: string;
|
12
|
+
options: TaxonomyComboboxOption[];
|
13
|
+
}
|
14
|
+
export interface TaxonomyComboboxOption {
|
15
|
+
id?: string;
|
16
|
+
value: string;
|
17
|
+
level?: number;
|
18
|
+
parentId?: string;
|
19
|
+
disabled?: boolean;
|
20
|
+
}
|
21
|
+
export type SingleLevelTaxonomyFieldProps = ComboboxWithApiPaginationProps<TaxonomyComboboxOption>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type MetadataTemplate, type MetadataTemplateField, type MetadataTemplateInstance, type MetadataTemplateOption
|
1
|
+
import { type AutofillSuggestions, type MetadataTemplate, type MetadataTemplateField, type MetadataTemplateInstance, type MetadataTemplateOption } from '../types';
|
2
2
|
declare const stringField: MetadataTemplateField;
|
3
3
|
declare const dateField: MetadataTemplateField;
|
4
4
|
declare const enumField: MetadataTemplateField;
|