@box/box-item-type-selector 0.62.3 → 0.63.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.
|
@@ -1,82 +1,83 @@
|
|
|
1
|
-
import { BoxItemTypeSelector as
|
|
2
|
-
import { Popover as
|
|
3
|
-
import { FileDefault as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useIntl as
|
|
7
|
-
import { b as
|
|
8
|
-
import
|
|
9
|
-
import { jsx as
|
|
10
|
-
import '../../styles/box-item-type-selector-quick-filter.css';const
|
|
11
|
-
itemTypeSelectorQuickFilterPopoverContainer:
|
|
12
|
-
popoverMainContent:
|
|
13
|
-
boxItemTypeSelectorQuickFilter:
|
|
14
|
-
popoverFooterInline:
|
|
15
|
-
},
|
|
16
|
-
function J(
|
|
1
|
+
import { BoxItemTypeSelector as k } from "./box-item-type-selector.js";
|
|
2
|
+
import { Popover as n, FilterChip as p, Button as y } from "@box/blueprint-web";
|
|
3
|
+
import { FileDefault as x } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import I from "clsx";
|
|
5
|
+
import g from "react";
|
|
6
|
+
import { useIntl as M } from "react-intl";
|
|
7
|
+
import { b as F } from "../../chunks/constants.js";
|
|
8
|
+
import m from "./messages.js";
|
|
9
|
+
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
import '../../styles/box-item-type-selector-quick-filter.css';const _ = "_itemTypeSelectorQuickFilterPopoverContainer_10sjf_1", Q = "_popoverMainContent_10sjf_4", L = "_boxItemTypeSelectorQuickFilter_10sjf_8", j = "_popoverFooterInline_10sjf_11", a = {
|
|
11
|
+
itemTypeSelectorQuickFilterPopoverContainer: _,
|
|
12
|
+
popoverMainContent: Q,
|
|
13
|
+
boxItemTypeSelectorQuickFilter: L,
|
|
14
|
+
popoverFooterInline: j
|
|
15
|
+
}, N = () => F.reduce((t, l) => t + (l.children ? l.children.length : 1), 0), P = (t) => F.map((o) => o.children ? o.children.every((e) => t.includes(e.value)) ? o.title : o.children.filter((e) => t.includes(e.value)).map((e) => e.title) : t.includes(o.value) ? o.title : []).flat(), B = (t, l) => t.length !== l.length ? !1 : t.every((o) => l.includes(o)), A = N();
|
|
16
|
+
function J(t) {
|
|
17
17
|
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
allowAllOptionsSelect: l = !1,
|
|
19
|
+
applyButtonType: o = "button",
|
|
20
|
+
autoFocus: h,
|
|
21
|
+
selected: e,
|
|
22
|
+
onApply: C,
|
|
23
|
+
onFocus: v,
|
|
24
|
+
className: b
|
|
25
|
+
} = t, i = M(), [c, s] = g.useState(e);
|
|
26
|
+
g.useEffect(() => {
|
|
27
|
+
s(e);
|
|
28
|
+
}, [e]);
|
|
29
|
+
const T = () => {
|
|
30
|
+
const d = P(e), f = d.length;
|
|
31
|
+
return f ? f === 1 ? i.formatMessage(d[0]) : i.formatMessage(m.multipleFiles, {
|
|
32
|
+
count: f - 1,
|
|
33
|
+
fileType: i.formatMessage(d[0])
|
|
34
|
+
}) : i.formatMessage(m.fileTypeLabelDropdown);
|
|
35
|
+
}, S = () => {
|
|
36
|
+
!l && c.length === A ? (s([]), C([])) : C(c);
|
|
36
37
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
className:
|
|
39
|
-
children: /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ r("div", {
|
|
39
|
+
className: I(b, a.boxItemTypeSelectorQuickFilterContainer),
|
|
40
|
+
children: /* @__PURE__ */ u(n.Root, {
|
|
40
41
|
modal: !1,
|
|
41
|
-
children: [/* @__PURE__ */
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
autoFocus:
|
|
44
|
-
onClick: () =>
|
|
45
|
-
onFocus:
|
|
46
|
-
selected: !!
|
|
42
|
+
children: [/* @__PURE__ */ r(n.Trigger, {
|
|
43
|
+
children: /* @__PURE__ */ u(p.TriggerChip, {
|
|
44
|
+
autoFocus: h,
|
|
45
|
+
onClick: () => s(e),
|
|
46
|
+
onFocus: v,
|
|
47
|
+
selected: !!e.length,
|
|
47
48
|
value: "trigger-chip",
|
|
48
|
-
children: [/* @__PURE__ */
|
|
49
|
-
icon:
|
|
50
|
-
}), /* @__PURE__ */
|
|
51
|
-
children:
|
|
52
|
-
}), /* @__PURE__ */
|
|
49
|
+
children: [/* @__PURE__ */ r(p.Icon, {
|
|
50
|
+
icon: x
|
|
51
|
+
}), /* @__PURE__ */ r(p.Label, {
|
|
52
|
+
children: T()
|
|
53
|
+
}), /* @__PURE__ */ r(p.DropdownIndicator, {})]
|
|
53
54
|
})
|
|
54
|
-
}), /* @__PURE__ */
|
|
55
|
+
}), /* @__PURE__ */ u(n.ContentContainer, {
|
|
55
56
|
align: "start",
|
|
56
|
-
className:
|
|
57
|
-
children: [/* @__PURE__ */
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
className:
|
|
61
|
-
onSelectionChange:
|
|
62
|
-
selected:
|
|
57
|
+
className: a.itemTypeSelectorQuickFilterPopoverContainer,
|
|
58
|
+
children: [/* @__PURE__ */ r(n.MainContent, {
|
|
59
|
+
className: a.popoverMainContent,
|
|
60
|
+
children: /* @__PURE__ */ r(k, {
|
|
61
|
+
className: a.boxItemTypeSelectorQuickFilter,
|
|
62
|
+
onSelectionChange: s,
|
|
63
|
+
selected: c
|
|
63
64
|
})
|
|
64
|
-
}), /* @__PURE__ */
|
|
65
|
-
className:
|
|
66
|
-
children: [/* @__PURE__ */
|
|
67
|
-
disabled: !
|
|
68
|
-
onClick: () =>
|
|
65
|
+
}), /* @__PURE__ */ u(n.Footer, {
|
|
66
|
+
className: a.popoverFooterInline,
|
|
67
|
+
children: [/* @__PURE__ */ r(y, {
|
|
68
|
+
disabled: !c.length,
|
|
69
|
+
onClick: () => s([]),
|
|
69
70
|
size: "small",
|
|
70
71
|
variant: "secondary",
|
|
71
|
-
children:
|
|
72
|
-
}), /* @__PURE__ */
|
|
73
|
-
children: /* @__PURE__ */
|
|
74
|
-
disabled:
|
|
75
|
-
onClick:
|
|
72
|
+
children: i.formatMessage(m.clear)
|
|
73
|
+
}), /* @__PURE__ */ r(n.Close, {
|
|
74
|
+
children: /* @__PURE__ */ r(y, {
|
|
75
|
+
disabled: B(c, e),
|
|
76
|
+
onClick: S,
|
|
76
77
|
size: "small",
|
|
77
|
-
type:
|
|
78
|
+
type: o,
|
|
78
79
|
variant: "primary",
|
|
79
|
-
children:
|
|
80
|
+
children: i.formatMessage(m.apply)
|
|
80
81
|
})
|
|
81
82
|
})]
|
|
82
83
|
})]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BoxItemSelection } from './types';
|
|
2
2
|
type ButtonType = 'button' | 'submit' | 'reset';
|
|
3
3
|
export interface BoxItemTypeSelectorQuickFilterProps {
|
|
4
|
+
allowAllOptionsSelect?: boolean;
|
|
4
5
|
applyButtonType?: ButtonType;
|
|
5
6
|
autoFocus?: boolean;
|
|
6
7
|
selected: BoxItemSelection;
|