@phillips/seldon 1.67.2 → 1.68.1
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.
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -5
- package/dist/components/Breadcrumb/Breadcrumb.js +24 -26
- package/dist/components/Breadcrumb/BreadcrumbItem.d.ts +1 -5
- package/dist/components/Breadcrumb/BreadcrumbItem.js +35 -27
- package/dist/components/Drawer/Drawer.js +10 -10
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Pagination/Pagination.d.ts +11 -3
- package/dist/components/Pagination/Pagination.js +62 -49
- package/dist/components/Pagination/utils.d.ts +3 -0
- package/dist/components/Pagination/utils.js +7 -0
- package/dist/components/Search/Search.d.ts +5 -1
- package/dist/components/Search/Search.js +86 -82
- package/dist/components/Search/SearchButton.d.ts +2 -2
- package/dist/components/Search/SearchButton.js +22 -21
- package/dist/index.d.ts +1 -1
- package/dist/scss/components/Breadcrumb/_breadcrumb.scss +41 -36
- package/dist/scss/components/IconButton/_iconButton.scss +11 -18
- package/dist/scss/components/Modal/_modal.scss +1 -1
- package/dist/scss/components/Pagination/_pagination.scss +1 -11
- package/package.json +1 -1
|
@@ -14,10 +14,6 @@ export interface BreadcrumbProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
14
14
|
* Index of the item to truncate
|
|
15
15
|
*/
|
|
16
16
|
truncateIndex?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Max length for truncation
|
|
19
|
-
*/
|
|
20
|
-
truncateLength?: number;
|
|
21
17
|
/**
|
|
22
18
|
* Custom element to render for the link
|
|
23
19
|
*/
|
|
@@ -32,5 +28,5 @@ export interface BreadcrumbProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
32
28
|
*
|
|
33
29
|
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-breadcrumb--overview)
|
|
34
30
|
*/
|
|
35
|
-
declare const Breadcrumb: ({ className, items, truncateIndex,
|
|
31
|
+
declare const Breadcrumb: ({ className, items, truncateIndex, linkElement: CustomElement, ...props }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
32
|
export default Breadcrumb;
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
import { jsxs as h, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { getCommonProps as
|
|
3
|
-
import
|
|
2
|
+
import { getCommonProps as u, px as t } from "../../utils/index.js";
|
|
3
|
+
import f from "../../node_modules/classnames/index.js";
|
|
4
4
|
import p from "./BreadcrumbItem.js";
|
|
5
|
-
import { SSRMediaQuery as
|
|
5
|
+
import { SSRMediaQuery as c } from "../../providers/utils.js";
|
|
6
6
|
import N from "../../assets/arrowPrev.svg.js";
|
|
7
|
-
const
|
|
8
|
-
className:
|
|
9
|
-
items:
|
|
10
|
-
truncateIndex:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...a
|
|
7
|
+
const v = ({
|
|
8
|
+
className: s,
|
|
9
|
+
items: a = [],
|
|
10
|
+
truncateIndex: d,
|
|
11
|
+
linkElement: l = "a",
|
|
12
|
+
...e
|
|
14
13
|
}) => {
|
|
15
|
-
const { className:
|
|
16
|
-
return /* @__PURE__ */ h("nav", { "aria-label": "Breadcrumb", className:
|
|
17
|
-
/* @__PURE__ */ r(
|
|
18
|
-
|
|
14
|
+
const { className: m, ...i } = u(e, "Breadcrumb"), { id: b } = e;
|
|
15
|
+
return /* @__PURE__ */ h("nav", { "aria-label": "Breadcrumb", className: f(m, s), ...i, ...e, children: [
|
|
16
|
+
/* @__PURE__ */ r(c.Media, { lessThan: "md", children: /* @__PURE__ */ r(
|
|
17
|
+
l,
|
|
19
18
|
{
|
|
20
|
-
href:
|
|
21
|
-
className:
|
|
19
|
+
href: a[1].href ? a[1].href : "/",
|
|
20
|
+
className: `${t}-icon-button ${t}-icon-button--secondary`,
|
|
22
21
|
"data-testid": `${b}-back-button`,
|
|
23
|
-
children: /* @__PURE__ */ r(N, {})
|
|
22
|
+
children: /* @__PURE__ */ r(N, { className: `${m}__back-button` })
|
|
24
23
|
}
|
|
25
24
|
) }),
|
|
26
|
-
/* @__PURE__ */ r(
|
|
25
|
+
/* @__PURE__ */ r(c.Media, { greaterThanOrEqual: "md", children: /* @__PURE__ */ r("ol", { children: a.map((o, n) => /* @__PURE__ */ r(
|
|
27
26
|
p,
|
|
28
27
|
{
|
|
29
|
-
href:
|
|
30
|
-
label:
|
|
31
|
-
element:
|
|
32
|
-
isCurrent:
|
|
33
|
-
isTruncateText:
|
|
34
|
-
truncateLength: s
|
|
28
|
+
href: o.href,
|
|
29
|
+
label: o.label,
|
|
30
|
+
element: l,
|
|
31
|
+
isCurrent: a.length - 1 === n,
|
|
32
|
+
isTruncateText: d === n
|
|
35
33
|
},
|
|
36
|
-
|
|
34
|
+
o.label
|
|
37
35
|
)) }) })
|
|
38
36
|
] });
|
|
39
37
|
};
|
|
40
38
|
export {
|
|
41
|
-
|
|
39
|
+
v as default
|
|
42
40
|
};
|
|
@@ -16,14 +16,10 @@ export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
16
16
|
* truncate text boolean
|
|
17
17
|
* */
|
|
18
18
|
isTruncateText?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Length to which the text should be truncated
|
|
21
|
-
* */
|
|
22
|
-
truncateLength?: number;
|
|
23
19
|
/**
|
|
24
20
|
* Custom element to render for the link
|
|
25
21
|
*/
|
|
26
22
|
element?: React.ElementType<React.ComponentProps<'a'>>;
|
|
27
23
|
}
|
|
28
|
-
declare const BreadcrumbItem: ({ className, href, label, isCurrent, isTruncateText,
|
|
24
|
+
declare const BreadcrumbItem: ({ className, href, label, isCurrent, isTruncateText, element: CustomElement, ...props }: BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
25
|
export default BreadcrumbItem;
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { getCommonProps as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
className:
|
|
7
|
-
href:
|
|
1
|
+
import { jsxs as N, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { getCommonProps as d } from "../../utils/index.js";
|
|
3
|
+
import s from "../../node_modules/classnames/index.js";
|
|
4
|
+
import h from "../../assets/chevronNext.svg.js";
|
|
5
|
+
const g = ({
|
|
6
|
+
className: c,
|
|
7
|
+
href: o,
|
|
8
8
|
label: r,
|
|
9
|
-
isCurrent:
|
|
10
|
-
isTruncateText:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...p
|
|
9
|
+
isCurrent: a = !1,
|
|
10
|
+
isTruncateText: t = !1,
|
|
11
|
+
element: n = "a",
|
|
12
|
+
...l
|
|
14
13
|
}) => {
|
|
15
|
-
const { className:
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const { className: e, ...f } = d(l, "Breadcrumb"), p = a ? "page" : !1, i = a ? "" : o;
|
|
15
|
+
return /* @__PURE__ */ N(
|
|
16
|
+
"li",
|
|
17
|
+
{
|
|
18
|
+
"aria-label": r,
|
|
19
|
+
className: s(`${e}__item`, { [`${e}--truncate`]: t }),
|
|
20
|
+
children: [
|
|
21
|
+
a ? /* @__PURE__ */ m("span", { className: s(e, c, { [`${e}--current`]: a }), children: r }) : /* @__PURE__ */ m(
|
|
22
|
+
n,
|
|
23
|
+
{
|
|
24
|
+
"aria-current": p,
|
|
25
|
+
className: s(e, c, {
|
|
26
|
+
[`${e}--current`]: a
|
|
27
|
+
}),
|
|
28
|
+
href: i,
|
|
29
|
+
...f,
|
|
30
|
+
children: r
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
a ? null : /* @__PURE__ */ m(h, { className: `${e}__chevron` })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
29
37
|
};
|
|
30
38
|
export {
|
|
31
|
-
|
|
39
|
+
g as default
|
|
32
40
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { getCommonProps as d, noOp as p } from "../../utils/index.js";
|
|
3
|
-
import
|
|
3
|
+
import e from "../../node_modules/classnames/index.js";
|
|
4
4
|
import { Root as f, Portal as C, Overlay as h, Content as N, Title as u, Description as v, Close as w } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
|
|
5
5
|
import y from "../../assets/close.svg.js";
|
|
6
6
|
import _ from "../IconButton/IconButton.js";
|
|
7
7
|
import { ButtonVariants as g } from "../Button/types.js";
|
|
8
|
-
const B = ({ className: i, isOpen: l = !1, onClose:
|
|
9
|
-
const { className:
|
|
8
|
+
const B = ({ className: i, isOpen: l = !1, onClose: o = p, children: m, ...t }) => {
|
|
9
|
+
const { className: a, ...n } = d(t, "Drawer");
|
|
10
10
|
return /* @__PURE__ */ r(
|
|
11
11
|
f,
|
|
12
12
|
{
|
|
13
13
|
open: l,
|
|
14
14
|
onOpenChange: (c) => {
|
|
15
|
-
c ||
|
|
15
|
+
c || o();
|
|
16
16
|
},
|
|
17
17
|
children: /* @__PURE__ */ s(C, { children: [
|
|
18
18
|
/* @__PURE__ */ r(
|
|
19
19
|
h,
|
|
20
20
|
{
|
|
21
|
-
onClick:
|
|
22
|
-
className:
|
|
21
|
+
onClick: o,
|
|
22
|
+
className: e(`${a}__overlay`),
|
|
23
23
|
"data-testid": "drawer-overlay"
|
|
24
24
|
}
|
|
25
25
|
),
|
|
26
|
-
/* @__PURE__ */ s(N, { className:
|
|
26
|
+
/* @__PURE__ */ s(N, { className: e(a, i), id: t.id, ...n, children: [
|
|
27
27
|
/* @__PURE__ */ r(u, {}),
|
|
28
28
|
/* @__PURE__ */ r(v, {}),
|
|
29
29
|
/* @__PURE__ */ r(w, { asChild: !0, children: /* @__PURE__ */ r(
|
|
30
30
|
_,
|
|
31
31
|
{
|
|
32
|
-
onClick:
|
|
33
|
-
className:
|
|
32
|
+
onClick: o,
|
|
33
|
+
className: e(`${a}__close`),
|
|
34
34
|
"aria-label": "Close",
|
|
35
35
|
"data-testid": "drawer-close",
|
|
36
|
-
variant: g.
|
|
36
|
+
variant: g.secondary,
|
|
37
37
|
children: /* @__PURE__ */ r(y, {})
|
|
38
38
|
}
|
|
39
39
|
) }),
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
|
+
export type PaginationOptionValue = string | number;
|
|
3
|
+
export interface PaginationOption {
|
|
4
|
+
/**
|
|
5
|
+
* label is translatable
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
value: string | number;
|
|
9
|
+
}
|
|
2
10
|
export interface PaginationProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
3
11
|
/**
|
|
4
12
|
* Unique id for component testing
|
|
@@ -11,7 +19,7 @@ export interface PaginationProps extends Omit<ComponentProps<'div'>, 'onChange'>
|
|
|
11
19
|
/**
|
|
12
20
|
* Options Array of string
|
|
13
21
|
*/
|
|
14
|
-
options
|
|
22
|
+
options: (PaginationOption | PaginationOptionValue)[];
|
|
15
23
|
/**
|
|
16
24
|
* Boolean to specify whether the `<Pagination>` should be disabled
|
|
17
25
|
*/
|
|
@@ -19,11 +27,11 @@ export interface PaginationProps extends Omit<ComponentProps<'div'>, 'onChange'>
|
|
|
19
27
|
/**
|
|
20
28
|
* Current value of the `<Pagination>` component
|
|
21
29
|
*/
|
|
22
|
-
value:
|
|
30
|
+
value: PaginationOptionValue;
|
|
23
31
|
/**
|
|
24
32
|
* `onChange` handler that is called whenever the `<Pagination>` value is changed
|
|
25
33
|
*/
|
|
26
|
-
onChange: (selectedValue:
|
|
34
|
+
onChange: (selectedValue: PaginationOptionValue, event?: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
27
35
|
/**
|
|
28
36
|
* Specify the variant style of the `<Pagination>`
|
|
29
37
|
*/
|
|
@@ -1,65 +1,78 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as O, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import u from "../../node_modules/classnames/index.js";
|
|
3
3
|
import { getCommonProps as P, px as i } from "../../utils/index.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { ButtonVariants as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
import S from "../Select/Select.js";
|
|
5
|
+
import f from "../../assets/chevronRight.svg.js";
|
|
6
|
+
import g from "../IconButton/IconButton.js";
|
|
7
|
+
import { ButtonVariants as x } from "../Button/types.js";
|
|
8
|
+
import { determineOptionValue as r, findOptionFromSelectString as v } from "./utils.js";
|
|
9
|
+
const R = ({
|
|
10
|
+
className: b,
|
|
11
|
+
onChange: o,
|
|
12
|
+
variant: $ = "inline",
|
|
13
|
+
options: e = [],
|
|
14
|
+
value: l,
|
|
15
|
+
isDisabled: c,
|
|
16
|
+
previousLabel: h = "Previous",
|
|
17
|
+
nextLabel: N = "Next",
|
|
18
|
+
selectLabel: _ = "Select",
|
|
19
|
+
...m
|
|
19
20
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
const y = "pagination", { className: p, ...I } = P(m, "Pagination"), { id: s } = m;
|
|
22
|
+
return /* @__PURE__ */ O(
|
|
22
23
|
"div",
|
|
23
24
|
{
|
|
24
|
-
className:
|
|
25
|
-
...
|
|
26
|
-
...
|
|
25
|
+
className: u(`${i}-${y}`, { [`${p}__wrapper`]: p }, b),
|
|
26
|
+
...I,
|
|
27
|
+
...m,
|
|
27
28
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
|
|
29
|
+
/* @__PURE__ */ n(
|
|
30
|
+
g,
|
|
30
31
|
{
|
|
31
|
-
className:
|
|
32
|
-
onClick: () =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
className: u(`${i}__pagination-button`, `${i}-left-arrow`),
|
|
33
|
+
onClick: () => {
|
|
34
|
+
const t = e.findIndex((d) => r(d) === l) - 1, a = e.at(t) || "";
|
|
35
|
+
o(r(a));
|
|
36
|
+
},
|
|
37
|
+
"data-testid": `${s}-previous-button`,
|
|
38
|
+
isDisabled: c,
|
|
39
|
+
"aria-label": h,
|
|
40
|
+
variant: x.tertiary,
|
|
41
|
+
children: /* @__PURE__ */ n(f, {})
|
|
38
42
|
}
|
|
39
43
|
),
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
44
|
+
/* @__PURE__ */ n(
|
|
45
|
+
S,
|
|
42
46
|
{
|
|
43
|
-
className:
|
|
44
|
-
"aria-label":
|
|
45
|
-
value:
|
|
46
|
-
onChange: (
|
|
47
|
-
|
|
47
|
+
className: $ === "inline" && `${i}--inline-pagination`,
|
|
48
|
+
"aria-label": _,
|
|
49
|
+
value: l,
|
|
50
|
+
onChange: (t) => {
|
|
51
|
+
const a = v(e, t == null ? void 0 : t.currentTarget.value);
|
|
52
|
+
a && o(r(a), t);
|
|
53
|
+
},
|
|
54
|
+
"data-testid": `${s}-select-button`,
|
|
48
55
|
hideLabel: !0,
|
|
49
|
-
disabled:
|
|
50
|
-
children:
|
|
56
|
+
disabled: c,
|
|
57
|
+
children: e.map((t) => {
|
|
58
|
+
const a = r(t);
|
|
59
|
+
return /* @__PURE__ */ n("option", { value: a, children: typeof t == "string" || typeof t == "number" ? t : t.label }, a);
|
|
60
|
+
})
|
|
51
61
|
}
|
|
52
62
|
),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
63
|
+
/* @__PURE__ */ n(
|
|
64
|
+
g,
|
|
55
65
|
{
|
|
56
66
|
className: `${i}__pagination-button`,
|
|
57
|
-
onClick: () =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
onClick: () => {
|
|
68
|
+
const t = (e.findIndex((d) => r(d) === l) + 1) % e.length, a = e[t];
|
|
69
|
+
o(r(a));
|
|
70
|
+
},
|
|
71
|
+
"data-testid": `${s}-next-button`,
|
|
72
|
+
isDisabled: c,
|
|
73
|
+
"aria-label": N,
|
|
74
|
+
variant: x.tertiary,
|
|
75
|
+
children: /* @__PURE__ */ n(f, {})
|
|
63
76
|
}
|
|
64
77
|
)
|
|
65
78
|
]
|
|
@@ -67,5 +80,5 @@ const B = ({
|
|
|
67
80
|
);
|
|
68
81
|
};
|
|
69
82
|
export {
|
|
70
|
-
|
|
83
|
+
R as default
|
|
71
84
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PaginationOption, PaginationOptionValue } from './Pagination';
|
|
2
|
+
export declare const determineOptionValue: (option: PaginationOption | PaginationOptionValue) => string | number;
|
|
3
|
+
export declare const findOptionFromSelectString: (options: (PaginationOption | PaginationOptionValue)[], value: string) => PaginationOptionValue | PaginationOption | undefined;
|
|
@@ -7,6 +7,10 @@ export interface SearchProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
* @returns void
|
|
8
8
|
*/
|
|
9
9
|
onSearch?: (searchQuery: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* called when the search is cancelled
|
|
12
|
+
*/
|
|
13
|
+
onCancel?: () => void;
|
|
10
14
|
/**
|
|
11
15
|
* The search results to display
|
|
12
16
|
*/
|
|
@@ -40,5 +44,5 @@ export interface SearchProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
40
44
|
*/
|
|
41
45
|
invalidText?: string;
|
|
42
46
|
}
|
|
43
|
-
declare const Search: ({ onSearch, searchResults, state, defaultValue, className, placeholder, searchButtonText, loadingText, invalidText, getAllResultsText, getAllResultsLink, ...props }: React.PropsWithChildren<SearchProps>) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
declare const Search: ({ onSearch, onCancel, searchResults, state, defaultValue, className, placeholder, searchButtonText, loadingText, invalidText, getAllResultsText, getAllResultsLink, ...props }: React.PropsWithChildren<SearchProps>) => import("react/jsx-runtime").JSX.Element;
|
|
44
48
|
export default Search;
|
|
@@ -1,145 +1,149 @@
|
|
|
1
1
|
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as
|
|
2
|
+
import c, { useEffect as V } from "react";
|
|
3
|
+
import { getCommonProps as j, px as D, encodeURLSearchParams as I } from "../../utils/index.js";
|
|
4
4
|
import f from "../../node_modules/classnames/index.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { TextVariants as
|
|
9
|
-
import
|
|
10
|
-
import { useOnClickOutside as
|
|
11
|
-
import { HeaderContext as
|
|
12
|
-
import { SearchButton as
|
|
13
|
-
import
|
|
5
|
+
import H from "../Input/Input.js";
|
|
6
|
+
import O from "../Link/Link.js";
|
|
7
|
+
import A from "./SearchResults/SearchResults.js";
|
|
8
|
+
import { TextVariants as F } from "../Text/types.js";
|
|
9
|
+
import K from "../Text/Text.js";
|
|
10
|
+
import { useOnClickOutside as M } from "../../node_modules/usehooks-ts/dist/index.js";
|
|
11
|
+
import { HeaderContext as U } from "../../site-furniture/Header/Header.js";
|
|
12
|
+
import { SearchButton as q } from "./SearchButton.js";
|
|
13
|
+
import z from "../../node_modules/react-transition-group/esm/CSSTransition.js";
|
|
14
14
|
const ne = ({
|
|
15
|
-
onSearch:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
onSearch: _,
|
|
16
|
+
onCancel: i,
|
|
17
|
+
searchResults: E = [],
|
|
18
|
+
state: l = "idle",
|
|
19
|
+
defaultValue: R = "",
|
|
20
|
+
className: b,
|
|
21
|
+
placeholder: w = "",
|
|
22
|
+
searchButtonText: d = "Search",
|
|
23
|
+
loadingText: C = "Search In Progress...",
|
|
24
|
+
invalidText: k = "Invalid search",
|
|
25
|
+
getAllResultsText: L = (r) => `View all results for ${r}`,
|
|
26
|
+
getAllResultsLink: S = (r) => `/Search?Search=${r}`,
|
|
27
|
+
...v
|
|
27
28
|
}) => {
|
|
28
29
|
var N;
|
|
29
|
-
const { className:
|
|
30
|
-
|
|
30
|
+
const { className: r, "data-testid": m, ...P } = j(v, "Search"), o = c.useContext(U), h = c.useRef(null), p = c.useRef(null), x = c.useRef(null), t = o.isSearchExpanded, s = (N = h.current) == null ? void 0 : N.value, T = _ ? (e) => {
|
|
31
|
+
_(e.target.value);
|
|
31
32
|
} : void 0;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
M(x, (e) => {
|
|
34
|
+
i == null || i(), g(!1), e.stopPropagation();
|
|
35
|
+
});
|
|
36
|
+
const $ = (e) => {
|
|
37
|
+
var n;
|
|
38
|
+
if (e.stopPropagation(), e.key === "Enter") {
|
|
39
|
+
if (e.preventDefault(), s && s.length > 2) {
|
|
40
|
+
const y = I(S(s));
|
|
41
|
+
window.location.href = y;
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.click();
|
|
41
44
|
}
|
|
42
|
-
|
|
45
|
+
e.key === "Escape" && (o.setIsSearchExpanded(!1), (n = p.current) == null || n.reset());
|
|
43
46
|
};
|
|
44
|
-
|
|
45
|
-
var
|
|
47
|
+
V(() => {
|
|
48
|
+
var e;
|
|
46
49
|
if (t) {
|
|
47
|
-
(
|
|
50
|
+
(e = h.current) == null || e.focus();
|
|
48
51
|
return;
|
|
49
52
|
}
|
|
50
53
|
}, [t]);
|
|
51
|
-
const
|
|
52
|
-
var
|
|
53
|
-
o.setIsSearchExpanded(
|
|
54
|
+
const g = (e) => {
|
|
55
|
+
var n;
|
|
56
|
+
o.setIsSearchExpanded(e), (n = p.current) == null || n.reset();
|
|
54
57
|
};
|
|
55
|
-
return /* @__PURE__ */ a("div", { className: `${
|
|
58
|
+
return /* @__PURE__ */ a("div", { className: `${r}__container`, children: /* @__PURE__ */ u(
|
|
56
59
|
"div",
|
|
57
60
|
{
|
|
58
61
|
onClick: () => o.setIsSearchExpanded(!0),
|
|
59
|
-
className: `${
|
|
60
|
-
ref:
|
|
62
|
+
className: `${r}__container__inner`,
|
|
63
|
+
ref: x,
|
|
61
64
|
children: [
|
|
62
|
-
/* @__PURE__ */ a(
|
|
65
|
+
/* @__PURE__ */ a(K, { variant: F.heading4, className: `${r}__container__inner__label`, children: d }),
|
|
63
66
|
/* @__PURE__ */ a(
|
|
64
67
|
"div",
|
|
65
68
|
{
|
|
66
|
-
...
|
|
67
|
-
className: f(
|
|
68
|
-
"data-testid":
|
|
69
|
+
...P,
|
|
70
|
+
className: f(r, b, { [`${r}--active`]: t }),
|
|
71
|
+
"data-testid": m,
|
|
69
72
|
role: "search",
|
|
70
|
-
...
|
|
73
|
+
...v,
|
|
71
74
|
children: /* @__PURE__ */ u(
|
|
72
75
|
"form",
|
|
73
76
|
{
|
|
74
|
-
"data-testid": `${
|
|
75
|
-
className: f(`${
|
|
76
|
-
[`${
|
|
77
|
+
"data-testid": `${m}-form`,
|
|
78
|
+
className: f(`${r}__form`, {
|
|
79
|
+
[`${r}__form--active`]: t
|
|
77
80
|
}),
|
|
78
|
-
ref:
|
|
81
|
+
ref: p,
|
|
79
82
|
children: [
|
|
80
83
|
/* @__PURE__ */ u(
|
|
81
84
|
"div",
|
|
82
85
|
{
|
|
83
|
-
className: f(`${
|
|
84
|
-
[`${
|
|
86
|
+
className: f(`${r}__content-wrapper`, {
|
|
87
|
+
[`${r}__content-wrapper--active`]: t
|
|
85
88
|
}),
|
|
86
89
|
role: "combobox",
|
|
87
90
|
"aria-haspopup": "listbox",
|
|
88
91
|
children: [
|
|
89
92
|
/* @__PURE__ */ a(
|
|
90
|
-
|
|
93
|
+
z,
|
|
91
94
|
{
|
|
92
95
|
in: t,
|
|
93
|
-
classNames: `${
|
|
96
|
+
classNames: `${D}-input`,
|
|
94
97
|
addEndListener: () => {
|
|
95
98
|
},
|
|
96
99
|
children: /* @__PURE__ */ a(
|
|
97
|
-
|
|
100
|
+
H,
|
|
98
101
|
{
|
|
99
102
|
"aria-hidden": !t,
|
|
100
|
-
className: `${
|
|
103
|
+
className: `${r}__input`,
|
|
101
104
|
id: "search-input",
|
|
102
105
|
hideLabel: !0,
|
|
103
|
-
labelText:
|
|
104
|
-
placeholder: t ?
|
|
106
|
+
labelText: d,
|
|
107
|
+
placeholder: t ? w : "",
|
|
105
108
|
type: "text",
|
|
106
|
-
defaultValue:
|
|
107
|
-
invalid:
|
|
108
|
-
invalidText:
|
|
109
|
-
onKeyDown:
|
|
109
|
+
defaultValue: R,
|
|
110
|
+
invalid: l === "invalid",
|
|
111
|
+
invalidText: k,
|
|
112
|
+
onKeyDown: $,
|
|
110
113
|
onChange: T,
|
|
111
|
-
ref:
|
|
114
|
+
ref: h
|
|
112
115
|
}
|
|
113
116
|
)
|
|
114
117
|
}
|
|
115
118
|
),
|
|
116
119
|
/* @__PURE__ */ a(
|
|
117
|
-
|
|
120
|
+
q,
|
|
118
121
|
{
|
|
119
|
-
className:
|
|
120
|
-
searchButtonText:
|
|
121
|
-
state:
|
|
122
|
-
testId:
|
|
122
|
+
className: r,
|
|
123
|
+
searchButtonText: d,
|
|
124
|
+
state: l,
|
|
125
|
+
testId: m,
|
|
123
126
|
isSearchExpanded: t,
|
|
124
|
-
setIsSearchExpanded:
|
|
127
|
+
setIsSearchExpanded: g,
|
|
128
|
+
onCancel: i
|
|
125
129
|
}
|
|
126
130
|
)
|
|
127
131
|
]
|
|
128
132
|
}
|
|
129
133
|
),
|
|
130
|
-
|
|
131
|
-
|
|
134
|
+
s && s.length > 2 ? /* @__PURE__ */ a(
|
|
135
|
+
A,
|
|
132
136
|
{
|
|
133
|
-
autoCompleteResults:
|
|
134
|
-
isLoading:
|
|
135
|
-
loadingText:
|
|
136
|
-
onKeyDown:
|
|
137
|
-
userInputValue:
|
|
138
|
-
children: /* @__PURE__ */ a("li", { className: `${
|
|
139
|
-
|
|
137
|
+
autoCompleteResults: E,
|
|
138
|
+
isLoading: l === "loading",
|
|
139
|
+
loadingText: C,
|
|
140
|
+
onKeyDown: $,
|
|
141
|
+
userInputValue: s,
|
|
142
|
+
children: /* @__PURE__ */ a("li", { className: `${r}__result`, children: /* @__PURE__ */ a(
|
|
143
|
+
O,
|
|
140
144
|
{
|
|
141
|
-
href: ((
|
|
142
|
-
children: /* @__PURE__ */ a("p", { children:
|
|
145
|
+
href: ((e) => I(S(e)))(s),
|
|
146
|
+
children: /* @__PURE__ */ a("p", { children: L(s) })
|
|
143
147
|
}
|
|
144
148
|
) }, "viewAllSearchResults")
|
|
145
149
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SearchProps } from './Search';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
|
-
export declare const SearchButton: ({ state, isSearchExpanded, setIsSearchExpanded, searchButtonText, className, testId, ...props }: {
|
|
3
|
+
export declare const SearchButton: ({ state, isSearchExpanded, setIsSearchExpanded, searchButtonText, className, testId, onCancel, ...props }: {
|
|
4
4
|
testId: string;
|
|
5
5
|
isSearchExpanded: boolean;
|
|
6
6
|
setIsSearchExpanded: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
-
} & Pick<SearchProps, "state" | "searchButtonText"> & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
} & Pick<SearchProps, "onCancel" | "state" | "searchButtonText"> & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
state:
|
|
6
|
-
isSearchExpanded:
|
|
7
|
-
setIsSearchExpanded:
|
|
8
|
-
searchButtonText:
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import e from "../../assets/search.svg.js";
|
|
3
|
+
import l from "../../assets/close.svg.js";
|
|
4
|
+
const p = ({
|
|
5
|
+
state: $,
|
|
6
|
+
isSearchExpanded: u,
|
|
7
|
+
setIsSearchExpanded: _,
|
|
8
|
+
searchButtonText: a,
|
|
9
9
|
className: t,
|
|
10
10
|
testId: o,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
onCancel: i,
|
|
12
|
+
...b
|
|
13
|
+
}) => u ? u ? /* @__PURE__ */ r(
|
|
13
14
|
"button",
|
|
14
15
|
{
|
|
15
|
-
...
|
|
16
|
+
...b,
|
|
16
17
|
type: "button",
|
|
17
18
|
"data-testid": `${o}-close-button`,
|
|
18
19
|
"aria-label": "Close Search",
|
|
19
20
|
className: `${t}__button ${t}__button--close`,
|
|
20
|
-
onClick: (
|
|
21
|
-
|
|
21
|
+
onClick: (n) => {
|
|
22
|
+
i == null || i(), _(!1), n.stopPropagation();
|
|
22
23
|
},
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ r(l, { "data-testid": `${o}-form-icon`, className: `${t}__button__icon` })
|
|
24
25
|
}
|
|
25
|
-
) : null : /* @__PURE__ */
|
|
26
|
+
) : null : /* @__PURE__ */ r(
|
|
26
27
|
"button",
|
|
27
28
|
{
|
|
28
|
-
...
|
|
29
|
+
...b,
|
|
29
30
|
type: "button",
|
|
30
31
|
"data-testid": `${o}-button`,
|
|
31
|
-
"aria-label":
|
|
32
|
+
"aria-label": a,
|
|
32
33
|
className: `${t}__button ${t}__button--search`,
|
|
33
|
-
onClick: (
|
|
34
|
-
|
|
34
|
+
onClick: (n) => {
|
|
35
|
+
_(!0), n.stopPropagation();
|
|
35
36
|
},
|
|
36
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ r(e, { "data-testid": `${o}-button-icon`, className: `${t}__button__icon` })
|
|
37
38
|
}
|
|
38
39
|
);
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
p as SearchButton
|
|
41
42
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { default as Social, type SocialProps } from './patterns/Social/Social';
|
|
|
29
29
|
export { default as ViewingsList, type ViewingsListProps } from './patterns/ViewingsList/ViewingsList';
|
|
30
30
|
export { default as Modal, type ModalProps } from './components/Modal/Modal';
|
|
31
31
|
export { default as Drawer } from './components/Drawer/Drawer';
|
|
32
|
-
export { default as Pagination, type PaginationProps } from './components/Pagination/Pagination';
|
|
32
|
+
export { default as Pagination, type PaginationProps, type PaginationOption, type PaginationOptionValue, } from './components/Pagination/Pagination';
|
|
33
33
|
export { default as StatefulViewingsList, type StatefulViewingsListProps, } from './patterns/ViewingsList/StatefulViewingsList';
|
|
34
34
|
export * from './components/Text';
|
|
35
35
|
export * from './components/TextSymbol';
|
|
@@ -5,61 +5,66 @@
|
|
|
5
5
|
|
|
6
6
|
color: $pure-black;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
&__back-button {
|
|
9
|
+
svg {
|
|
10
|
+
height: 1rem;
|
|
11
|
+
width: 1rem;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
&__item {
|
|
13
16
|
align-items: center;
|
|
14
|
-
background-color: transparent;
|
|
15
|
-
border: none;
|
|
16
|
-
cursor: pointer;
|
|
17
17
|
display: flex;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
width: 44px;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
flex-shrink: 0;
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
a {
|
|
22
|
+
margin: $margin-sm;
|
|
23
|
+
outline: none;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
text-wrap: nowrap;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
color: $button-hover;
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:focus-visible {
|
|
33
|
+
border-radius: 5px;
|
|
34
|
+
outline: 1px solid $medium-gray;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
span {
|
|
39
|
+
margin: $margin-sm;
|
|
25
40
|
}
|
|
26
41
|
}
|
|
27
42
|
|
|
43
|
+
&__chevron {
|
|
44
|
+
height: 1rem;
|
|
45
|
+
width: 1rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
28
48
|
ol {
|
|
29
49
|
display: flex;
|
|
30
50
|
flex-direction: row;
|
|
31
51
|
padding: 0;
|
|
52
|
+
}
|
|
32
53
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
|
|
38
|
-
svg {
|
|
39
|
-
height: 16px;
|
|
40
|
-
width: 16px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
a {
|
|
44
|
-
margin: $margin-sm;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
text-decoration: none;
|
|
47
|
-
text-wrap: nowrap;
|
|
54
|
+
&--truncate {
|
|
55
|
+
flex-shrink: 1;
|
|
56
|
+
overflow: hidden;
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
span {
|
|
56
|
-
margin: $margin-sm;
|
|
57
|
-
}
|
|
58
|
+
a {
|
|
59
|
+
flex-shrink: 1;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
text-overflow: ellipsis;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
&--current {
|
|
62
66
|
color: $primary-black;
|
|
63
67
|
font-variation-settings: 'wght' 700;
|
|
68
|
+
white-space: nowrap;
|
|
64
69
|
}
|
|
65
70
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
@use '../../allPartials' as *;
|
|
2
2
|
|
|
3
3
|
.#{$px}-icon-button {
|
|
4
|
+
align-items: center;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: center;
|
|
4
7
|
padding: 0;
|
|
5
8
|
|
|
6
|
-
& > svg {
|
|
7
|
-
position: absolute;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
9
|
&:focus-visible {
|
|
11
10
|
&:focus-visible {
|
|
12
11
|
outline: 0.5px solid $soft-black;
|
|
@@ -27,11 +26,8 @@
|
|
|
27
26
|
|
|
28
27
|
& > svg {
|
|
29
28
|
fill: $pure-black;
|
|
30
|
-
height: 100%;
|
|
31
29
|
height: 1.5rem;
|
|
32
30
|
margin-inline-end: unset;
|
|
33
|
-
position: absolute;
|
|
34
|
-
width: 100%;
|
|
35
31
|
width: 1.5rem;
|
|
36
32
|
|
|
37
33
|
path {
|
|
@@ -63,18 +59,21 @@
|
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
&--secondary,
|
|
66
|
-
&--tertiary {
|
|
62
|
+
&--tertiary.#{$px}-icon-button {
|
|
67
63
|
height: 28px;
|
|
64
|
+
padding: $spacing-xsm;
|
|
68
65
|
width: 28px;
|
|
69
66
|
|
|
67
|
+
&:focus-visible {
|
|
68
|
+
border-radius: 100px;
|
|
69
|
+
}
|
|
70
|
+
|
|
70
71
|
& > svg {
|
|
71
72
|
fill: $pure-black;
|
|
72
|
-
height:
|
|
73
|
-
height: 1rem;
|
|
73
|
+
height: 1.25rem;
|
|
74
74
|
margin-inline-end: unset;
|
|
75
75
|
position: absolute;
|
|
76
|
-
width:
|
|
77
|
-
width: 1rem;
|
|
76
|
+
width: 1.25rem;
|
|
78
77
|
|
|
79
78
|
path {
|
|
80
79
|
fill: $pure-black;
|
|
@@ -82,12 +81,6 @@
|
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
&--tertiary {
|
|
86
|
-
&:focus {
|
|
87
|
-
border-radius: 100px;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
84
|
&:disabled {
|
|
92
85
|
background-color: $white;
|
|
93
86
|
border: 1px solid $light-gray;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
cursor: pointer;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
&:focus {
|
|
38
|
+
&:focus-visible {
|
|
39
39
|
outline: 1px solid $medium-gray;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -47,16 +47,6 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.#{$px}__pagination-button {
|
|
51
|
-
svg {
|
|
52
|
-
width: 2rem;
|
|
53
|
-
|
|
54
|
-
@include media($size-md, $type: 'max') {
|
|
55
|
-
width: 1rem;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
.#{$px}-left-arrow {
|
|
61
51
|
transform: scaleX(-1);
|
|
62
52
|
}
|