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