@phillips/seldon 1.167.0 → 1.169.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.
Files changed (36) hide show
  1. package/dist/components/Drawer/Drawer.d.ts +9 -1
  2. package/dist/components/Drawer/Drawer.js +67 -35
  3. package/dist/components/Drawer/Drawer.stories.d.ts +1 -1
  4. package/dist/components/Modal/Modal.d.ts +8 -0
  5. package/dist/components/Modal/Modal.js +45 -32
  6. package/dist/components/Modal/Modal.stories.d.ts +1 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +74 -72
  9. package/dist/patterns/FilterMenu/FilterMenu.d.ts +1 -1
  10. package/dist/patterns/FilterMenu/FilterMenu.js +10 -10
  11. package/dist/patterns/FiltersInline/FilterButton.d.ts +28 -0
  12. package/dist/patterns/FiltersInline/FilterButton.js +35 -0
  13. package/dist/patterns/FiltersInline/FilterDropdownMenuDesktop.d.ts +3 -0
  14. package/dist/patterns/FiltersInline/FilterDropdownMenuDesktop.js +92 -0
  15. package/dist/patterns/FiltersInline/FilterDropdownMenuMobile.d.ts +3 -0
  16. package/dist/patterns/FiltersInline/FilterDropdownMenuMobile.js +99 -0
  17. package/dist/patterns/FiltersInline/FiltersInline.d.ts +12 -0
  18. package/dist/patterns/FiltersInline/FiltersInline.js +65 -0
  19. package/dist/patterns/FiltersInline/FiltersInline.stories.d.ts +17 -0
  20. package/dist/patterns/FiltersInline/FiltersInline.test.d.ts +1 -0
  21. package/dist/patterns/FiltersInline/MainFilterDropdown.d.ts +3 -0
  22. package/dist/patterns/FiltersInline/MainFilterDropdown.js +102 -0
  23. package/dist/patterns/FiltersInline/SubFilterDropdown.d.ts +3 -0
  24. package/dist/patterns/FiltersInline/SubFilterDropdown.js +135 -0
  25. package/dist/patterns/FiltersInline/index.d.ts +1 -0
  26. package/dist/patterns/FiltersInline/types.d.ts +191 -0
  27. package/dist/patterns/FiltersInline/types.js +4 -0
  28. package/dist/patterns/FiltersInline/utils.d.ts +61 -0
  29. package/dist/patterns/FiltersInline/utils.js +33 -0
  30. package/dist/scss/componentStyles.scss +3 -0
  31. package/dist/scss/components/Drawer/_drawer.scss +113 -2
  32. package/dist/scss/components/Modal/_modal.scss +5 -0
  33. package/dist/scss/patterns/FiltersInline/_filterButton.scss +26 -0
  34. package/dist/scss/patterns/FiltersInline/_filterDropdownMenu.scss +126 -0
  35. package/dist/scss/patterns/FiltersInline/_filtersInline.scss +15 -0
  36. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ import { jsxs as p, jsx as r, Fragment as C } from "react/jsx-runtime";
2
+ import e from "../../node_modules/classnames/index.js";
3
+ import F from "react";
4
+ import n from "../../components/Button/Button.js";
5
+ import { ButtonVariants as s } from "../../components/Button/types.js";
6
+ import v from "../../components/Filter/FilterHeader.js";
7
+ import D from "../../components/Filter/FilterInput.js";
8
+ import m from "../../components/Text/Text.js";
9
+ import { TextVariants as c } from "../../components/Text/types.js";
10
+ import { px as B } from "../../utils/index.js";
11
+ import { getFilterButtonLabel as S, getFilterDimensions as j, handleInputChange as A } from "./utils.js";
12
+ const I = F.forwardRef(
13
+ ({
14
+ className: f,
15
+ buttonType: i,
16
+ filters: _,
17
+ filterIndex: h,
18
+ onSelectFilter: b,
19
+ onClickClear: u,
20
+ onApplyFilter: d,
21
+ resultsCount: $,
22
+ ariaLabels: N,
23
+ filterButtonLabel: x,
24
+ filterButtonLabelTranslated: g,
25
+ dropdownMenuTranslation: o
26
+ }, k) => {
27
+ const l = i === "Sort", t = `${B}-filter-dropdown-menu`;
28
+ return /* @__PURE__ */ p(
29
+ "div",
30
+ {
31
+ className: e(t, f),
32
+ ref: k,
33
+ "data-testid": "filter-dropdown-desktop",
34
+ "aria-label": N || `${i} dropdown desktop`,
35
+ children: [
36
+ /* @__PURE__ */ r(
37
+ v,
38
+ {
39
+ heading: S(x, null, g || null),
40
+ className: e(`${t}__header`)
41
+ }
42
+ ),
43
+ /* @__PURE__ */ r("div", { className: e(`${t}__filters`), children: j(_, h).map((a) => /* @__PURE__ */ r(
44
+ D,
45
+ {
46
+ id: a.label,
47
+ labelText: a.label,
48
+ name: a.label,
49
+ type: l ? "radio" : "checkbox",
50
+ checked: a.active,
51
+ disabled: a?.disabled,
52
+ onChange: (w) => A(w, i ?? "", b)
53
+ },
54
+ a.label
55
+ )) }),
56
+ /* @__PURE__ */ r("div", { className: e(l ? `${t}__button-wrap` : `${t}__buttons-wrap`), children: l ? /* @__PURE__ */ r(
57
+ n,
58
+ {
59
+ className: e(`${t}__button`),
60
+ variant: s.primary,
61
+ onClick: () => d?.(!1),
62
+ children: /* @__PURE__ */ r(m, { variant: c.string2, className: `${t}__button-text`, children: o?.confirm || "Confirm" })
63
+ }
64
+ ) : /* @__PURE__ */ p(C, { children: [
65
+ /* @__PURE__ */ r(
66
+ n,
67
+ {
68
+ className: e(`${t}__buttons`),
69
+ variant: s.secondary,
70
+ onClick: () => u?.(i ?? ""),
71
+ children: /* @__PURE__ */ r(m, { variant: c.string2, children: o?.clearAll || "Clear all" })
72
+ }
73
+ ),
74
+ /* @__PURE__ */ r(
75
+ n,
76
+ {
77
+ className: e(`${t}__buttons`),
78
+ variant: s.primary,
79
+ onClick: () => d?.(!1),
80
+ children: /* @__PURE__ */ r(m, { variant: c.string2, className: `${t}__button-text`, children: o?.showAuctions || `Show ${$} Auctions` })
81
+ }
82
+ )
83
+ ] }) })
84
+ ]
85
+ }
86
+ );
87
+ }
88
+ );
89
+ I.displayName = "FilterDropdownMenuDesktop";
90
+ export {
91
+ I as FilterDropdownMenuDesktop
92
+ };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { FilterDropdownMenuProps } from './types';
3
+ export declare const FilterDropdownMenuMobile: React.ForwardRefExoticComponent<FilterDropdownMenuProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,99 @@
1
+ import { jsxs as d, jsx as r, Fragment as g } from "react/jsx-runtime";
2
+ import e from "../../node_modules/classnames/index.js";
3
+ import C from "react";
4
+ import n from "../../components/Button/Button.js";
5
+ import { ButtonVariants as s } from "../../components/Button/types.js";
6
+ import k from "../../components/Filter/FilterInput.js";
7
+ import m from "../../components/Text/Text.js";
8
+ import { TextVariants as c } from "../../components/Text/types.js";
9
+ import { px as v } from "../../utils/index.js";
10
+ import { getFilterDimensions as F, handleInputChange as B } from "./utils.js";
11
+ const D = C.forwardRef(
12
+ ({
13
+ className: b,
14
+ buttonType: o,
15
+ filters: f,
16
+ filterIndex: p,
17
+ onApplyFilter: _,
18
+ onClickClear: $,
19
+ onSelectFilter: h,
20
+ resultsCount: u,
21
+ ariaLabels: x,
22
+ dropdownMenuTranslation: a
23
+ }, N) => {
24
+ const l = o === "Sort", t = `${v}-filter-dropdown-menu`;
25
+ return /* @__PURE__ */ d(
26
+ "div",
27
+ {
28
+ className: e(`${t}`, b, `${t}--mobile`),
29
+ ref: N,
30
+ "data-testid": "filter-dropdown-mobile",
31
+ "aria-label": x || `${o} dropdown mobile`,
32
+ children: [
33
+ /* @__PURE__ */ r("div", { className: e(`${t}__filters`, `${t}__filters--mobile`), children: F(f, p).map((i) => /* @__PURE__ */ r(
34
+ k,
35
+ {
36
+ id: i.label,
37
+ labelText: i.label,
38
+ name: i.label,
39
+ type: l ? "radio" : "checkbox",
40
+ checked: i.active,
41
+ disabled: i?.disabled,
42
+ onChange: (w) => B(w, o ?? "", h)
43
+ },
44
+ i.label
45
+ )) }),
46
+ /* @__PURE__ */ r(
47
+ "div",
48
+ {
49
+ className: e(
50
+ l ? `${t}__button-wrap` : `${t}__buttons-wrap`,
51
+ `${t}__mobile-wrap`
52
+ ),
53
+ children: l ? /* @__PURE__ */ r(
54
+ n,
55
+ {
56
+ className: e(`${t}__button`, `${t}__button--mobile`),
57
+ variant: s.primary,
58
+ onClick: () => _?.(!1),
59
+ children: /* @__PURE__ */ r(m, { variant: c.string1, className: `${t}__button-text`, children: a?.confirm || "Confirm" })
60
+ }
61
+ ) : /* @__PURE__ */ d(g, { children: [
62
+ /* @__PURE__ */ r(
63
+ n,
64
+ {
65
+ className: e(
66
+ `${t}__buttons`,
67
+ `${t}__buttons--mobile`,
68
+ `${t}__buttons--left`
69
+ ),
70
+ variant: s.secondary,
71
+ onClick: () => $?.(o ?? ""),
72
+ children: /* @__PURE__ */ r(m, { variant: c.string2, children: a?.clearAll || "Clear all" })
73
+ }
74
+ ),
75
+ /* @__PURE__ */ r(
76
+ n,
77
+ {
78
+ className: e(
79
+ `${t}__buttons`,
80
+ `${t}__buttons--mobile`,
81
+ `${t}__buttons--right`
82
+ ),
83
+ variant: s.primary,
84
+ onClick: () => _?.(!1),
85
+ children: /* @__PURE__ */ r(m, { variant: c.string2, className: `${t}__button-text`, children: a?.showAuctions || `Show ${u} Auctions` })
86
+ }
87
+ )
88
+ ] })
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ );
96
+ D.displayName = "FilterDropdownMenuMobile";
97
+ export {
98
+ D as FilterDropdownMenuMobile
99
+ };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { FiltersInlineProps } from './types';
3
+ /**
4
+ * ## Overview
5
+ *
6
+ * FiltersInline component for rendering a row of filter buttons.
7
+ *
8
+ * [Figma Link](https://www.figma.com/design/H1kCh6MXU8jasYbQuCbyBt/Calendar?node-id=55-487568&p=f&m=dev)
9
+ * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-filters-inline--overview)
10
+ */
11
+ declare const FiltersInline: React.ForwardRefExoticComponent<FiltersInlineProps & React.RefAttributes<HTMLDivElement>>;
12
+ export default FiltersInline;
@@ -0,0 +1,65 @@
1
+ import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
+ import N from "../../node_modules/classnames/index.js";
3
+ import h from "react";
4
+ import { getCommonProps as x } from "../../utils/index.js";
5
+ import { MainFilterDropdown as T } from "./MainFilterDropdown.js";
6
+ import { SubFilterDropdown as j } from "./SubFilterDropdown.js";
7
+ const w = h.forwardRef(
8
+ ({
9
+ id: o,
10
+ className: c,
11
+ filtersListState: n,
12
+ setFiltersLabelListState: r,
13
+ filters: a,
14
+ onSelectFilter: e,
15
+ onApplyFilter: l,
16
+ onClickClear: s,
17
+ resultsCount: b,
18
+ mainFilterLabel: m,
19
+ dropdownMenuTranslation: p,
20
+ ...d
21
+ }, f) => {
22
+ const { className: $, ...i } = x({ id: o, ...d }, "FiltersInline");
23
+ return /* @__PURE__ */ I("div", { ref: f, className: N($, c), ...i, id: o, children: [
24
+ /* @__PURE__ */ u(
25
+ T,
26
+ {
27
+ id: `${o}-${m}-button`,
28
+ filterButtonLabel: m,
29
+ handleClick: r,
30
+ filtersListState: n,
31
+ filters: a,
32
+ onSelectFilter: e,
33
+ onApplyFilter: l,
34
+ onClickClear: s,
35
+ resultsCount: b,
36
+ dropdownMenuTranslation: p
37
+ },
38
+ `${o}-${m}-button`
39
+ ),
40
+ a?.map((t, B) => /* @__PURE__ */ u(
41
+ j,
42
+ {
43
+ id: `${o}-${t.label}-button`,
44
+ filterButtonLabel: t.label,
45
+ buttonType: t.buttonType,
46
+ handleClick: r,
47
+ filtersListState: n,
48
+ filterId: B + 1,
49
+ filters: a,
50
+ onSelectFilter: e,
51
+ onApplyFilter: l,
52
+ onClickClear: s,
53
+ resultsCount: b,
54
+ filterButtonLabelTranslated: t.filterButtonLabelTranslated,
55
+ dropdownMenuTranslation: p
56
+ },
57
+ `${o}-${t.label}-button`
58
+ ))
59
+ ] });
60
+ }
61
+ );
62
+ w.displayName = "FiltersInline";
63
+ export {
64
+ w as default
65
+ };
@@ -0,0 +1,17 @@
1
+ import { FilterDropdownMenuProps, FilterType } from './types';
2
+ /**
3
+ * Storybook: https://storybook.js.org/docs/react/writing-stories/introduction
4
+ */
5
+ declare const meta: {
6
+ title: string;
7
+ component: import('react').ForwardRefExoticComponent<import('./types').FiltersInlineProps & import('react').RefAttributes<HTMLDivElement>>;
8
+ };
9
+ export default meta;
10
+ export declare const Playground: {
11
+ (props: FilterDropdownMenuProps): import("react/jsx-runtime").JSX.Element;
12
+ args: {
13
+ id: string;
14
+ filters: FilterType[];
15
+ };
16
+ argTypes: {};
17
+ };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { FilterDropdownProps } from './types';
3
+ export declare const MainFilterDropdown: React.ForwardRefExoticComponent<FilterDropdownProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,102 @@
1
+ import { jsxs as n, Fragment as A, jsx as o } from "react/jsx-runtime";
2
+ import N from "../../node_modules/classnames/index.js";
3
+ import x from "react";
4
+ import p from "../../components/Button/Button.js";
5
+ import { ButtonVariants as g } from "../../components/Button/types.js";
6
+ import k from "../../components/Drawer/Drawer.js";
7
+ import D from "../../components/Filter/Filter.js";
8
+ import M from "../../components/Filter/FilterHeader.js";
9
+ import j from "../../components/Filter/FilterInput.js";
10
+ import { px as t } from "../../utils/index.js";
11
+ import B from "../FilterMenu/FilterMenu.js";
12
+ import { FilterButton as H } from "./FilterButton.js";
13
+ import { countActiveFilters as O, getFilterButtonClickHandler as R, resetAllFilters as S } from "./utils.js";
14
+ const I = x.forwardRef(
15
+ ({
16
+ className: f,
17
+ filterButtonLabel: l,
18
+ handleClick: i,
19
+ filtersListState: a,
20
+ filters: m,
21
+ onSelectFilter: u,
22
+ onApplyFilter: w,
23
+ onClickClear: b,
24
+ resultsCount: F,
25
+ dropdownMenuTranslation: d,
26
+ ariaLabels: s = {},
27
+ id: h
28
+ }, _) => {
29
+ const c = a?.[0] ?? !1, { totalCount: C, filterCount: $ } = O(m, l);
30
+ return /* @__PURE__ */ n(A, { children: [
31
+ /* @__PURE__ */ o(
32
+ H,
33
+ {
34
+ ref: _,
35
+ className: f,
36
+ isSelected: c,
37
+ count: $,
38
+ label: l,
39
+ totalCount: C,
40
+ id: h,
41
+ ariaLabel: s.button || `${l} button`,
42
+ onClick: R(a, i, 0),
43
+ isMobile: !1,
44
+ type: l
45
+ }
46
+ ),
47
+ /* @__PURE__ */ n(
48
+ k,
49
+ {
50
+ isOpen: c,
51
+ drawerOpenSide: "left",
52
+ onClose: () => S(a, i),
53
+ className: `${t}-filter-drawer`,
54
+ "aria-label": s.drawer || "Filter drawer",
55
+ children: [
56
+ /* @__PURE__ */ o(B, { className: `${t}-filter-drawer-menu`, children: m?.map((r) => /* @__PURE__ */ n(D, { name: r.label, children: [
57
+ /* @__PURE__ */ o(M, { heading: r.label }),
58
+ Array.from(r.filterDimensions).map((e) => /* @__PURE__ */ o(
59
+ j,
60
+ {
61
+ id: e.label,
62
+ labelText: e.label,
63
+ onChange: (y) => u?.(y, r.label),
64
+ type: r.type,
65
+ disabled: e?.disabled,
66
+ name: e.label,
67
+ checked: e.active
68
+ },
69
+ e.label
70
+ ))
71
+ ] }, r.id)) }),
72
+ /* @__PURE__ */ n(
73
+ "div",
74
+ {
75
+ className: N(
76
+ `${t}-filter-dropdown-menu__buttons-wrap`,
77
+ `${t}-filter-dropdown-menu__buttons-wrap--drawer`
78
+ ),
79
+ children: [
80
+ /* @__PURE__ */ o(
81
+ p,
82
+ {
83
+ className: `${t}-filter-dropdown-menu__button`,
84
+ variant: g.secondary,
85
+ onClick: () => b?.("all"),
86
+ children: d?.clearAll || "Clear all"
87
+ }
88
+ ),
89
+ /* @__PURE__ */ o(p, { className: `${t}-filter-dropdown-menu__button`, onClick: () => w?.(!1), children: d?.showAuctions || `Show ${F} Auctions` })
90
+ ]
91
+ }
92
+ )
93
+ ]
94
+ }
95
+ )
96
+ ] });
97
+ }
98
+ );
99
+ I.displayName = "MainFilterDropdown";
100
+ export {
101
+ I as MainFilterDropdown
102
+ };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { FilterDropdownProps } from './types';
3
+ export declare const SubFilterDropdown: React.ForwardRefExoticComponent<FilterDropdownProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,135 @@
1
+ import { jsxs as g, Fragment as R, jsx as o } from "react/jsx-runtime";
2
+ import { Root as S, Trigger as j, Portal as v, Content as P } from "../../node_modules/@radix-ui/react-popover/dist/index.js";
3
+ import _ from "react";
4
+ import f from "../../components/Drawer/Drawer.js";
5
+ import { SSRMediaQuery as D } from "../../providers/SeldonProvider/utils.js";
6
+ import { px as q } from "../../utils/index.js";
7
+ import { FilterButton as O } from "./FilterButton.js";
8
+ import { FilterDropdownMenuDesktop as E } from "./FilterDropdownMenuDesktop.js";
9
+ import { FilterDropdownMenuMobile as H } from "./FilterDropdownMenuMobile.js";
10
+ import { countActiveFilters as N, getFilterButtonClickHandler as t, getFilterButtonLabel as Q } from "./utils.js";
11
+ const k = _.forwardRef(
12
+ ({
13
+ filterId: e = 0,
14
+ className: u,
15
+ filterButtonLabel: r,
16
+ buttonType: i,
17
+ handleClick: m,
18
+ filtersListState: a,
19
+ filters: c,
20
+ onSelectFilter: w,
21
+ onApplyFilter: h,
22
+ onClickClear: F,
23
+ resultsCount: $,
24
+ filterButtonLabelTranslated: l,
25
+ dropdownMenuTranslation: M,
26
+ ariaLabels: n = {},
27
+ id: p
28
+ }, x) => {
29
+ const d = a?.[e] ?? !1, { totalCount: C, filterCount: s } = N(c, i), b = Q(r, s, l || null);
30
+ return /* @__PURE__ */ g(R, { children: [
31
+ /* @__PURE__ */ g(D.Media, { lessThan: "md", children: [
32
+ /* @__PURE__ */ o(
33
+ O,
34
+ {
35
+ ref: x,
36
+ className: u,
37
+ isSelected: d,
38
+ count: s,
39
+ label: b,
40
+ id: p,
41
+ totalCount: C,
42
+ ariaLabel: n.button || `${r} button`,
43
+ onClick: t(a, m, e),
44
+ isMobile: !0,
45
+ type: i
46
+ }
47
+ ),
48
+ /* @__PURE__ */ o(
49
+ f,
50
+ {
51
+ drawerOpenSide: "bottom",
52
+ isOpen: d,
53
+ onClose: t(a, m, e),
54
+ "aria-label": n.drawer || `${r} drawer`,
55
+ className: `${q}-filter-drawer-mobile`,
56
+ bottomContentLabel: `${b} Filter`,
57
+ children: /* @__PURE__ */ o(
58
+ H,
59
+ {
60
+ buttonType: i,
61
+ filters: c,
62
+ filterIndex: e,
63
+ onSelectFilter: w,
64
+ onApplyFilter: h,
65
+ onClickClear: F,
66
+ resultsCount: $,
67
+ ariaLabels: n?.ariaLabel,
68
+ filterButtonLabel: r,
69
+ filterButtonLabelTranslated: l,
70
+ dropdownMenuTranslation: M
71
+ }
72
+ )
73
+ }
74
+ )
75
+ ] }),
76
+ /* @__PURE__ */ o(D.Media, { greaterThanOrEqual: "md", children: /* @__PURE__ */ g(
77
+ S,
78
+ {
79
+ open: d,
80
+ onOpenChange: t(a, m, e),
81
+ children: [
82
+ /* @__PURE__ */ o(j, { asChild: !0, children: /* @__PURE__ */ o(
83
+ O,
84
+ {
85
+ ref: x,
86
+ className: u,
87
+ isSelected: d,
88
+ count: s,
89
+ label: b,
90
+ totalCount: C,
91
+ id: p,
92
+ ariaLabel: n.ariaLabel || `${r} button`,
93
+ onClick: t(a, m, e),
94
+ isMobile: !1,
95
+ type: i
96
+ }
97
+ ) }),
98
+ /* @__PURE__ */ o(v, { children: /* @__PURE__ */ o(
99
+ P,
100
+ {
101
+ avoidCollisions: !0,
102
+ collisionPadding: 10,
103
+ sideOffset: 5,
104
+ align: "start",
105
+ alignOffset: 5,
106
+ "aria-label": n.ariaLabel || `${r} dropdown`,
107
+ children: /* @__PURE__ */ o(
108
+ E,
109
+ {
110
+ buttonType: i,
111
+ filters: c,
112
+ filterIndex: e,
113
+ onSelectFilter: w,
114
+ onApplyFilter: h,
115
+ onClickClear: F,
116
+ resultsCount: $,
117
+ ariaLabels: n?.ariaLabel,
118
+ filterButtonLabel: r,
119
+ filterButtonLabelTranslated: l,
120
+ dropdownMenuTranslation: M
121
+ }
122
+ )
123
+ }
124
+ ) })
125
+ ]
126
+ },
127
+ `${p}-${r}-button`
128
+ ) })
129
+ ] });
130
+ }
131
+ );
132
+ k.displayName = "SubFilterDropdown";
133
+ export {
134
+ k as SubFilterDropdown
135
+ };
@@ -0,0 +1 @@
1
+ export { default as FiltersInline } from './FiltersInline';