@box/box-item-type-selector 1.30.2 → 1.30.4
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,72 +1,72 @@
|
|
|
1
|
-
import { Checkbox as f, Text as
|
|
1
|
+
import { Checkbox as f, Text as S } from "@box/blueprint-web";
|
|
2
2
|
import d from "clsx";
|
|
3
|
-
import { forwardRef as
|
|
3
|
+
import { forwardRef as T, useCallback as b } from "react";
|
|
4
4
|
import { useIntl as v } from "react-intl";
|
|
5
5
|
import { b as _, I as x } from "../../chunks/constants.js";
|
|
6
|
-
import { jsx as
|
|
7
|
-
import '../../styles/box-item-type-selector.css';const
|
|
8
|
-
boxItemTypeSelectorContainer:
|
|
9
|
-
parentItemTypeSelectorContainer:
|
|
10
|
-
itemTypeSelector:
|
|
11
|
-
selectorLabel:
|
|
12
|
-
disabled:
|
|
13
|
-
childItemTypeSelectorContainer:
|
|
14
|
-
}, M = (
|
|
6
|
+
import { jsx as s, jsxs as y } from "react/jsx-runtime";
|
|
7
|
+
import '../../styles/box-item-type-selector.css';const N = "_boxItemTypeSelectorContainer_9ahmf_2", k = "_parentItemTypeSelectorContainer_9ahmf_6", g = "_itemTypeSelector_9ahmf_16", E = "_selectorLabel_9ahmf_22", L = "_disabled_9ahmf_36", w = "_childItemTypeSelectorContainer_9ahmf_39", i = {
|
|
8
|
+
boxItemTypeSelectorContainer: N,
|
|
9
|
+
parentItemTypeSelectorContainer: k,
|
|
10
|
+
itemTypeSelector: g,
|
|
11
|
+
selectorLabel: E,
|
|
12
|
+
disabled: L,
|
|
13
|
+
childItemTypeSelectorContainer: w
|
|
14
|
+
}, M = (a, o) => {
|
|
15
15
|
const r = [...o];
|
|
16
|
-
return
|
|
16
|
+
return a.forEach((l) => {
|
|
17
17
|
r.includes(l.value) || r.push(l.value);
|
|
18
18
|
}), r;
|
|
19
|
-
}, R = (
|
|
19
|
+
}, R = (a, o) => {
|
|
20
20
|
const r = [...o];
|
|
21
|
-
return
|
|
21
|
+
return a.forEach((l) => {
|
|
22
22
|
const n = r.indexOf(l.value);
|
|
23
23
|
n >= 0 && r.splice(n, 1);
|
|
24
24
|
}), r;
|
|
25
|
-
}, $ = (
|
|
25
|
+
}, $ = (a, o, r) => {
|
|
26
26
|
let l = [...r];
|
|
27
|
-
return
|
|
28
|
-
}, W = /* @__PURE__ */
|
|
27
|
+
return a ? l.push(o) : l = l.filter((n) => n !== o), l;
|
|
28
|
+
}, W = /* @__PURE__ */ T((a, o) => {
|
|
29
29
|
const {
|
|
30
30
|
className: r,
|
|
31
31
|
onSelectionChange: l,
|
|
32
32
|
selected: n,
|
|
33
33
|
disabled: m = !1,
|
|
34
|
-
...
|
|
35
|
-
} =
|
|
34
|
+
...C
|
|
35
|
+
} = a, I = v(), h = (e) => e.children ? e.children.every((t) => n.includes(t.value)) ? !0 : e.children.every((t) => !n.includes(t.value)) ? !1 : x : n.includes(e.value), p = b((e, t) => {
|
|
36
36
|
let c = [...n];
|
|
37
37
|
t.children ? e ? c = M(t.children, c) : c = R(t.children, c) : c = $(e, t.value, c), l(c);
|
|
38
|
-
}, [l, n]), u = (e) => /* @__PURE__ */
|
|
38
|
+
}, [l, n]), u = (e) => /* @__PURE__ */ y("span", {
|
|
39
39
|
className: d(i.selectorLabel, {
|
|
40
40
|
[i.disabled]: m
|
|
41
41
|
}),
|
|
42
|
-
children: [e.icon, /* @__PURE__ */
|
|
42
|
+
children: [e.icon, /* @__PURE__ */ s(S, {
|
|
43
43
|
as: "span",
|
|
44
|
-
children:
|
|
44
|
+
children: I.formatMessage(e.title)
|
|
45
45
|
})]
|
|
46
46
|
});
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ s("div", {
|
|
48
48
|
ref: o,
|
|
49
49
|
className: d(r, i.boxItemTypeSelectorContainer),
|
|
50
|
-
...
|
|
51
|
-
children: /* @__PURE__ */
|
|
52
|
-
children: _.map((e) => /* @__PURE__ */
|
|
50
|
+
...C,
|
|
51
|
+
children: /* @__PURE__ */ s("ul", {
|
|
52
|
+
children: _.map((e) => /* @__PURE__ */ y("li", {
|
|
53
53
|
className: d(i.parentItemTypeSelectorContainer),
|
|
54
|
-
children: [/* @__PURE__ */
|
|
55
|
-
checked:
|
|
54
|
+
children: [/* @__PURE__ */ s(f.Item, {
|
|
55
|
+
checked: h(e),
|
|
56
56
|
className: d(i.itemTypeSelector),
|
|
57
57
|
disabled: m,
|
|
58
58
|
label: u(e),
|
|
59
|
-
onCheckedChange: (t) =>
|
|
59
|
+
onCheckedChange: (t) => p(t, e),
|
|
60
60
|
value: e.value
|
|
61
|
-
}, `box-item-type-selector-${e.value}`), e.children && /* @__PURE__ */
|
|
61
|
+
}, `box-item-type-selector-${e.value}`), e.children && /* @__PURE__ */ s("ul", {
|
|
62
62
|
className: d(i.childItemTypeSelectorContainer),
|
|
63
|
-
children: e.children.map((t) => /* @__PURE__ */
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
checked:
|
|
63
|
+
children: e.children.map((t) => /* @__PURE__ */ s("li", {
|
|
64
|
+
children: /* @__PURE__ */ s(f.Item, {
|
|
65
|
+
checked: h(t),
|
|
66
66
|
className: d(i.itemTypeSelector),
|
|
67
67
|
disabled: m,
|
|
68
68
|
label: u(t),
|
|
69
|
-
onCheckedChange: (c) =>
|
|
69
|
+
onCheckedChange: (c) => p(c, t),
|
|
70
70
|
value: t.value
|
|
71
71
|
})
|
|
72
72
|
}, `box-item-type-selector-${t.value}`))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._boxItemTypeSelectorContainer_9ahmf_2{display:flex;flex-direction:column}._boxItemTypeSelectorContainer_9ahmf_2 ._parentItemTypeSelectorContainer_9ahmf_6{display:flex;flex-direction:column;min-height:0}@container (min-width: 374px){._boxItemTypeSelectorContainer_9ahmf_2 ._parentItemTypeSelectorContainer_9ahmf_6{max-height:255px}}._boxItemTypeSelectorContainer_9ahmf_2 ._itemTypeSelector_9ahmf_16{margin:var(--space-1) 0}._boxItemTypeSelectorContainer_9ahmf_2 ._itemTypeSelector_9ahmf_16 label{gap:var(--space-2)}._boxItemTypeSelectorContainer_9ahmf_2 ._selectorLabel_9ahmf_22{font-weight:var(--body-default-font-weight);font-size:var(--body-default-font-size);font-family:var(--body-default-font-family);line-height:var(--body-default-line-height);letter-spacing:var(--body-default-letter-spacing);text-transform:var(--body-default-text-case);text-decoration:var(--body-default-text-decoration);display:flex}._boxItemTypeSelectorContainer_9ahmf_2 ._selectorLabel_9ahmf_22 svg{margin-inline-end:var(--space-2);font-size:var(--size-5)}._boxItemTypeSelectorContainer_9ahmf_2 ._selectorLabel_9ahmf_22._disabled_9ahmf_36{opacity:60%}._boxItemTypeSelectorContainer_9ahmf_2 ._childItemTypeSelectorContainer_9ahmf_39{margin-inline-start:var(--space-7);display:flex;flex-flow:column wrap;min-height:0}._boxItemTypeSelectorContainer_9ahmf_2 ul,._boxItemTypeSelectorContainer_9ahmf_2 li{display:contents;margin:0;padding:0}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-item-type-selector",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@box/blueprint-web": "^12.
|
|
6
|
-
"@box/blueprint-web-assets": "^4.101.
|
|
5
|
+
"@box/blueprint-web": "^12.136.0",
|
|
6
|
+
"@box/blueprint-web-assets": "^4.101.3",
|
|
7
7
|
"react": "^17.0.0 || ^18.0.0",
|
|
8
8
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
9
9
|
"react-intl": "6.4.2"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@box/blueprint-web": "^12.
|
|
13
|
-
"@box/blueprint-web-assets": "^4.101.
|
|
14
|
-
"@box/storybook-utils": "^0.16.
|
|
12
|
+
"@box/blueprint-web": "^12.136.0",
|
|
13
|
+
"@box/blueprint-web-assets": "^4.101.3",
|
|
14
|
+
"@box/storybook-utils": "^0.16.40",
|
|
15
15
|
"react": "^18.3.0",
|
|
16
16
|
"react-dom": "^18.3.0",
|
|
17
17
|
"react-intl": "6.4.2"
|