@box/box-item-type-selector 1.4.0 → 1.4.2
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,16 +1,16 @@
|
|
|
1
|
-
import { Checkbox as f, Text as
|
|
1
|
+
import { Checkbox as f, Text as I } from "@box/blueprint-web";
|
|
2
2
|
import d from "clsx";
|
|
3
|
-
import { forwardRef as
|
|
3
|
+
import { forwardRef as S, useCallback as T } 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 a, jsxs as
|
|
7
|
-
import '../../styles/box-item-type-selector.css';const k = "
|
|
6
|
+
import { jsx as a, jsxs as b } from "react/jsx-runtime";
|
|
7
|
+
import '../../styles/box-item-type-selector.css';const k = "_boxItemTypeSelectorContainer_kpwbf_2", w = "_parentItemTypeSelectorContainer_kpwbf_6", N = "_itemTypeSelector_kpwbf_16", g = "_selectorLabel_kpwbf_22", E = "_disabled_kpwbf_36", L = "_childItemTypeSelectorContainer_kpwbf_39", i = {
|
|
8
8
|
boxItemTypeSelectorContainer: k,
|
|
9
|
-
parentItemTypeSelectorContainer:
|
|
9
|
+
parentItemTypeSelectorContainer: w,
|
|
10
10
|
itemTypeSelector: N,
|
|
11
|
-
selectorLabel:
|
|
12
|
-
disabled:
|
|
13
|
-
childItemTypeSelectorContainer:
|
|
11
|
+
selectorLabel: g,
|
|
12
|
+
disabled: E,
|
|
13
|
+
childItemTypeSelectorContainer: L
|
|
14
14
|
}, M = (s, o) => {
|
|
15
15
|
const r = [...o];
|
|
16
16
|
return s.forEach((l) => {
|
|
@@ -25,48 +25,48 @@ import '../../styles/box-item-type-selector.css';const k = "_boxItemTypeSelector
|
|
|
25
25
|
}, $ = (s, o, r) => {
|
|
26
26
|
let l = [...r];
|
|
27
27
|
return s ? l.push(o) : l = l.filter((n) => n !== o), l;
|
|
28
|
-
}, W = /* @__PURE__ */
|
|
28
|
+
}, W = /* @__PURE__ */ S((s, o) => {
|
|
29
29
|
const {
|
|
30
30
|
className: r,
|
|
31
31
|
onSelectionChange: l,
|
|
32
32
|
selected: n,
|
|
33
33
|
disabled: m = !1,
|
|
34
|
-
...
|
|
35
|
-
} = s,
|
|
34
|
+
...y
|
|
35
|
+
} = s, C = v(), p = (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), h = T((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__ */ b("span", {
|
|
39
39
|
className: d(i.selectorLabel, {
|
|
40
40
|
[i.disabled]: m
|
|
41
41
|
}),
|
|
42
|
-
children: [e.icon, /* @__PURE__ */ a(
|
|
42
|
+
children: [e.icon, /* @__PURE__ */ a(I, {
|
|
43
43
|
as: "span",
|
|
44
|
-
children:
|
|
44
|
+
children: C.formatMessage(e.title)
|
|
45
45
|
})]
|
|
46
46
|
});
|
|
47
47
|
return /* @__PURE__ */ a("div", {
|
|
48
48
|
ref: o,
|
|
49
49
|
className: d(r, i.boxItemTypeSelectorContainer),
|
|
50
|
-
...
|
|
50
|
+
...y,
|
|
51
51
|
children: /* @__PURE__ */ a("ul", {
|
|
52
|
-
children: _.map((e) => /* @__PURE__ */
|
|
52
|
+
children: _.map((e) => /* @__PURE__ */ b("li", {
|
|
53
53
|
className: d(i.parentItemTypeSelectorContainer),
|
|
54
54
|
children: [/* @__PURE__ */ a(f.Item, {
|
|
55
|
-
checked:
|
|
55
|
+
checked: p(e),
|
|
56
56
|
className: d(i.itemTypeSelector),
|
|
57
57
|
disabled: m,
|
|
58
58
|
label: u(e),
|
|
59
|
-
onCheckedChange: (t) =>
|
|
59
|
+
onCheckedChange: (t) => h(t, e),
|
|
60
60
|
value: e.value
|
|
61
61
|
}, `box-item-type-selector-${e.value}`), e.children && /* @__PURE__ */ a("ul", {
|
|
62
62
|
className: d(i.childItemTypeSelectorContainer),
|
|
63
63
|
children: e.children.map((t) => /* @__PURE__ */ a("li", {
|
|
64
64
|
children: /* @__PURE__ */ a(f.Item, {
|
|
65
|
-
checked:
|
|
65
|
+
checked: p(t),
|
|
66
66
|
className: d(i.itemTypeSelector),
|
|
67
67
|
disabled: m,
|
|
68
68
|
label: u(t),
|
|
69
|
-
onCheckedChange: (c) =>
|
|
69
|
+
onCheckedChange: (c) => h(c, t),
|
|
70
70
|
value: t.value
|
|
71
71
|
})
|
|
72
72
|
}, `box-item-type-selector-${t.value}`))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._boxItemTypeSelectorContainer_kpwbf_2{display:flex;flex-direction:column}._boxItemTypeSelectorContainer_kpwbf_2 ._parentItemTypeSelectorContainer_kpwbf_6{display:flex;flex-direction:column;min-height:0}@container (min-width: 374px){._boxItemTypeSelectorContainer_kpwbf_2 ._parentItemTypeSelectorContainer_kpwbf_6{max-height:255px}}._boxItemTypeSelectorContainer_kpwbf_2 ._itemTypeSelector_kpwbf_16{margin:var(--space-1) 0}._boxItemTypeSelectorContainer_kpwbf_2 ._itemTypeSelector_kpwbf_16 label{gap:var(--space-2)}._boxItemTypeSelectorContainer_kpwbf_2 ._selectorLabel_kpwbf_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_kpwbf_2 ._selectorLabel_kpwbf_22 svg{margin-inline-end:var(--space-2);font-size:var(--size-5)}._boxItemTypeSelectorContainer_kpwbf_2 ._selectorLabel_kpwbf_22._disabled_kpwbf_36{opacity:60%}._boxItemTypeSelectorContainer_kpwbf_2 ._childItemTypeSelectorContainer_kpwbf_39{margin-inline-start:var(--space-7);display:flex;flex-direction:column;flex-wrap:wrap;min-height:0}._boxItemTypeSelectorContainer_kpwbf_2 ul,._boxItemTypeSelectorContainer_kpwbf_2 li{display:contents;margin:0;padding:0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-item-type-selector",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"react-intl": "6.4.2"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@box/blueprint-web": "^12.92.
|
|
13
|
-
"@box/blueprint-web-assets": "^4.76.
|
|
14
|
-
"@box/storybook-utils": "^0.14.
|
|
12
|
+
"@box/blueprint-web": "^12.92.2",
|
|
13
|
+
"@box/blueprint-web-assets": "^4.76.2",
|
|
14
|
+
"@box/storybook-utils": "^0.14.13",
|
|
15
15
|
"react": "^18.3.0",
|
|
16
16
|
"react-dom": "^18.3.0",
|
|
17
17
|
"react-intl": "6.4.2"
|