@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.
@@ -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, truncateLength, linkElement: CustomElement, ...props }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
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 f } from "../../utils/index.js";
3
- import u from "../../node_modules/classnames/index.js";
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 t } from "../../providers/utils.js";
5
+ import { SSRMediaQuery as c } from "../../providers/utils.js";
6
6
  import N from "../../assets/arrowPrev.svg.js";
7
- const M = ({
8
- className: c,
9
- items: e = [],
10
- truncateIndex: n,
11
- truncateLength: s = 10,
12
- linkElement: m = "a",
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: d, ...i } = f(a, "Breadcrumb"), { id: b } = a;
16
- return /* @__PURE__ */ h("nav", { "aria-label": "Breadcrumb", className: u(d, c), ...i, ...a, children: [
17
- /* @__PURE__ */ r(t.Media, { lessThan: "md", children: /* @__PURE__ */ r(
18
- m,
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: e[1].href ? e[1].href : "/",
21
- className: "back-button",
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(t.Media, { greaterThanOrEqual: "md", children: /* @__PURE__ */ r("ol", { children: e.map((l, o) => /* @__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: l.href,
30
- label: l.label,
31
- element: m,
32
- isCurrent: e.length - 1 === o,
33
- isTruncateText: n === o,
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
- l.label
34
+ o.label
37
35
  )) }) })
38
36
  ] });
39
37
  };
40
38
  export {
41
- M as default
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, truncateLength, element: CustomElement, ...props }: BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element;
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 h, jsx as s } from "react/jsx-runtime";
2
- import { getCommonProps as N } from "../../utils/index.js";
3
- import c from "../../node_modules/classnames/index.js";
4
- import g from "../../assets/chevronNext.svg.js";
5
- const B = ({
6
- className: m,
7
- href: t,
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: e = !1,
10
- isTruncateText: n = !1,
11
- truncateLength: a = 30,
12
- element: f = "a",
13
- ...p
9
+ isCurrent: a = !1,
10
+ isTruncateText: t = !1,
11
+ element: n = "a",
12
+ ...l
14
13
  }) => {
15
- const { className: o, ...l } = N(p, "Breadcrumb"), d = e ? "page" : !1, i = e ? "" : t, u = () => r && r.length > a ? `${r.slice(0, a)}...` : r;
16
- return /* @__PURE__ */ h("li", { children: [
17
- e ? /* @__PURE__ */ s("span", { className: c(o, m, { [`${o}--current`]: e }), children: r }) : /* @__PURE__ */ s(
18
- f,
19
- {
20
- "aria-current": d,
21
- className: c(o, m, { [`${o}--current`]: e }),
22
- href: i,
23
- ...l,
24
- children: n ? u() : r
25
- }
26
- ),
27
- e ? null : /* @__PURE__ */ s(g, {})
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
- B as default
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 o from "../../node_modules/classnames/index.js";
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: a = p, children: m, ...t }) => {
9
- const { className: e, ...n } = d(t, "Drawer");
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 || a();
15
+ c || o();
16
16
  },
17
17
  children: /* @__PURE__ */ s(C, { children: [
18
18
  /* @__PURE__ */ r(
19
19
  h,
20
20
  {
21
- onClick: a,
22
- className: o(`${e}__overlay`),
21
+ onClick: o,
22
+ className: e(`${a}__overlay`),
23
23
  "data-testid": "drawer-overlay"
24
24
  }
25
25
  ),
26
- /* @__PURE__ */ s(N, { className: o(e, i), id: t.id, ...n, children: [
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: a,
33
- className: o(`${e}__close`),
32
+ onClick: o,
33
+ className: e(`${a}__close`),
34
34
  "aria-label": "Close",
35
35
  "data-testid": "drawer-close",
36
- variant: g.tertiary,
36
+ variant: g.secondary,
37
37
  children: /* @__PURE__ */ r(y, {})
38
38
  }
39
39
  ) }),
@@ -37,7 +37,7 @@ const g = ({
37
37
  onClick: a,
38
38
  "aria-label": "Close Modal",
39
39
  className: t(`${e}__close`),
40
- variant: v.tertiary,
40
+ variant: v.secondary,
41
41
  children: /* @__PURE__ */ s(y, {})
42
42
  }
43
43
  ),
@@ -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?: string[];
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: string | number;
30
+ value: PaginationOptionValue;
23
31
  /**
24
32
  * `onChange` handler that is called whenever the `<Pagination>` value is changed
25
33
  */
26
- onChange: (selectedValue: string, event?: React.ChangeEvent<HTMLSelectElement>) => void;
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 _, jsx as r } from "react/jsx-runtime";
2
- import s from "../../node_modules/classnames/index.js";
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 C from "../Select/Select.js";
5
- import d from "../../assets/chevronRight.svg.js";
6
- import u from "../IconButton/IconButton.js";
7
- import { ButtonVariants as f } from "../Button/types.js";
8
- const B = ({
9
- className: g,
10
- onChange: e,
11
- variant: p = "inline",
12
- options: t = [],
13
- value: n,
14
- isDisabled: o,
15
- previousLabel: $ = "Previous",
16
- nextLabel: b = "Next",
17
- selectLabel: h = "Select",
18
- ...l
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 x = "pagination", { className: c, ...N } = P(l, "Pagination"), { id: m } = l;
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: s(`${i}-${x}`, { [`${c}__wrapper`]: c }, g),
25
- ...N,
26
- ...l,
25
+ className: u(`${i}-${y}`, { [`${p}__wrapper`]: p }, b),
26
+ ...I,
27
+ ...m,
27
28
  children: [
28
- /* @__PURE__ */ r(
29
- u,
29
+ /* @__PURE__ */ n(
30
+ g,
30
31
  {
31
- className: s(`${i}__pagination-button`, `${i}-left-arrow`),
32
- onClick: () => e(t.at(t.findIndex((a) => a === n) - 1) || ""),
33
- "data-testid": `${m}-previous-button`,
34
- isDisabled: o,
35
- "aria-label": $,
36
- variant: f.tertiary,
37
- children: /* @__PURE__ */ r(d, {})
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__ */ r(
41
- C,
44
+ /* @__PURE__ */ n(
45
+ S,
42
46
  {
43
- className: p === "inline" && `${i}--inline-pagination`,
44
- "aria-label": h,
45
- value: n,
46
- onChange: (a) => e(a == null ? void 0 : a.currentTarget.value, a),
47
- "data-testid": `${m}-select-button`,
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: o,
50
- children: t.map((a) => /* @__PURE__ */ r("option", { value: a, children: a }, a))
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__ */ r(
54
- u,
63
+ /* @__PURE__ */ n(
64
+ g,
55
65
  {
56
66
  className: `${i}__pagination-button`,
57
- onClick: () => e(t[(t.findIndex((a) => a === n) + 1) % t.length] || ""),
58
- "data-testid": `${m}-next-button`,
59
- isDisabled: o,
60
- "aria-label": b,
61
- variant: f.tertiary,
62
- children: /* @__PURE__ */ r(d, {})
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
- B as default
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;
@@ -0,0 +1,7 @@
1
+ const n = (e) => typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e.value, f = (e, r) => e.find(
2
+ (t) => n(t) === r || n(t) === parseInt(r)
3
+ );
4
+ export {
5
+ n as determineOptionValue,
6
+ f as findOptionFromSelectString
7
+ };
@@ -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 i, { useEffect as y } from "react";
3
- import { getCommonProps as V, px as j, encodeURLSearchParams as g } from "../../utils/index.js";
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 D from "../Input/Input.js";
6
- import H from "../Link/Link.js";
7
- import O from "./SearchResults/SearchResults.js";
8
- import { TextVariants as A } from "../Text/types.js";
9
- import F from "../Text/Text.js";
10
- import { useOnClickOutside as K } from "../../node_modules/usehooks-ts/dist/index.js";
11
- import { HeaderContext as M } from "../../site-furniture/Header/Header.js";
12
- import { SearchButton as U } from "./SearchButton.js";
13
- import q from "../../node_modules/react-transition-group/esm/CSSTransition.js";
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: p,
16
- searchResults: C = [],
17
- state: c = "idle",
18
- defaultValue: I = "",
19
- className: E,
20
- placeholder: R = "",
21
- searchButtonText: l = "Search",
22
- loadingText: b = "Search In Progress...",
23
- invalidText: w = "Invalid search",
24
- getAllResultsText: k = (e) => `View all results for ${e}`,
25
- getAllResultsLink: _ = (e) => `/Search?Search=${e}`,
26
- ...S
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: e, "data-testid": d, ...L } = V(S, "Search"), o = i.useContext(M), m = i.useRef(null), h = i.useRef(null), v = i.useRef(null), t = o.isSearchExpanded, n = (N = m.current) == null ? void 0 : N.value, T = p ? (r) => {
30
- p(r.target.value);
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
- K(v, () => $(!1));
33
- const x = (r) => {
34
- var s;
35
- if (r.stopPropagation(), r.key === "Enter") {
36
- if (r.preventDefault(), n && n.length > 2) {
37
- const P = g(_(n));
38
- window.location.href = P;
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
- r.currentTarget instanceof HTMLAnchorElement && r.currentTarget.click();
43
+ e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.click();
41
44
  }
42
- r.key === "Escape" && (o.setIsSearchExpanded(!1), (s = h.current) == null || s.reset());
45
+ e.key === "Escape" && (o.setIsSearchExpanded(!1), (n = p.current) == null || n.reset());
43
46
  };
44
- y(() => {
45
- var r;
47
+ V(() => {
48
+ var e;
46
49
  if (t) {
47
- (r = m.current) == null || r.focus();
50
+ (e = h.current) == null || e.focus();
48
51
  return;
49
52
  }
50
53
  }, [t]);
51
- const $ = (r) => {
52
- var s;
53
- o.setIsSearchExpanded(r), (s = h.current) == null || s.reset();
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: `${e}__container`, children: /* @__PURE__ */ u(
58
+ return /* @__PURE__ */ a("div", { className: `${r}__container`, children: /* @__PURE__ */ u(
56
59
  "div",
57
60
  {
58
61
  onClick: () => o.setIsSearchExpanded(!0),
59
- className: `${e}__container__inner`,
60
- ref: v,
62
+ className: `${r}__container__inner`,
63
+ ref: x,
61
64
  children: [
62
- /* @__PURE__ */ a(F, { variant: A.heading4, className: `${e}__container__inner__label`, children: l }),
65
+ /* @__PURE__ */ a(K, { variant: F.heading4, className: `${r}__container__inner__label`, children: d }),
63
66
  /* @__PURE__ */ a(
64
67
  "div",
65
68
  {
66
- ...L,
67
- className: f(e, E, { [`${e}--active`]: t }),
68
- "data-testid": d,
69
+ ...P,
70
+ className: f(r, b, { [`${r}--active`]: t }),
71
+ "data-testid": m,
69
72
  role: "search",
70
- ...S,
73
+ ...v,
71
74
  children: /* @__PURE__ */ u(
72
75
  "form",
73
76
  {
74
- "data-testid": `${d}-form`,
75
- className: f(`${e}__form`, {
76
- [`${e}__form--active`]: t
77
+ "data-testid": `${m}-form`,
78
+ className: f(`${r}__form`, {
79
+ [`${r}__form--active`]: t
77
80
  }),
78
- ref: h,
81
+ ref: p,
79
82
  children: [
80
83
  /* @__PURE__ */ u(
81
84
  "div",
82
85
  {
83
- className: f(`${e}__content-wrapper`, {
84
- [`${e}__content-wrapper--active`]: t
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
- q,
93
+ z,
91
94
  {
92
95
  in: t,
93
- classNames: `${j}-input`,
96
+ classNames: `${D}-input`,
94
97
  addEndListener: () => {
95
98
  },
96
99
  children: /* @__PURE__ */ a(
97
- D,
100
+ H,
98
101
  {
99
102
  "aria-hidden": !t,
100
- className: `${e}__input`,
103
+ className: `${r}__input`,
101
104
  id: "search-input",
102
105
  hideLabel: !0,
103
- labelText: l,
104
- placeholder: t ? R : "",
106
+ labelText: d,
107
+ placeholder: t ? w : "",
105
108
  type: "text",
106
- defaultValue: I,
107
- invalid: c === "invalid",
108
- invalidText: w,
109
- onKeyDown: x,
109
+ defaultValue: R,
110
+ invalid: l === "invalid",
111
+ invalidText: k,
112
+ onKeyDown: $,
110
113
  onChange: T,
111
- ref: m
114
+ ref: h
112
115
  }
113
116
  )
114
117
  }
115
118
  ),
116
119
  /* @__PURE__ */ a(
117
- U,
120
+ q,
118
121
  {
119
- className: e,
120
- searchButtonText: l,
121
- state: c,
122
- testId: d,
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
- n && n.length > 2 ? /* @__PURE__ */ a(
131
- O,
134
+ s && s.length > 2 ? /* @__PURE__ */ a(
135
+ A,
132
136
  {
133
- autoCompleteResults: C,
134
- isLoading: c === "loading",
135
- loadingText: b,
136
- onKeyDown: x,
137
- userInputValue: n,
138
- children: /* @__PURE__ */ a("li", { className: `${e}__result`, children: /* @__PURE__ */ a(
139
- H,
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: ((r) => g(_(r)))(n),
142
- children: /* @__PURE__ */ a("p", { children: k(n) })
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 n } from "react/jsx-runtime";
2
- import _ from "../../assets/search.svg.js";
3
- import b from "../../assets/close.svg.js";
4
- const m = ({
5
- state: l,
6
- isSearchExpanded: i,
7
- setIsSearchExpanded: u,
8
- searchButtonText: e,
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
- ...a
12
- }) => i ? i ? /* @__PURE__ */ n(
11
+ onCancel: i,
12
+ ...b
13
+ }) => u ? u ? /* @__PURE__ */ r(
13
14
  "button",
14
15
  {
15
- ...a,
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: (r) => {
21
- u(!1), r.stopPropagation();
21
+ onClick: (n) => {
22
+ i == null || i(), _(!1), n.stopPropagation();
22
23
  },
23
- children: /* @__PURE__ */ n(b, { "data-testid": `${o}-form-icon`, className: `${t}__button__icon` })
24
+ children: /* @__PURE__ */ r(l, { "data-testid": `${o}-form-icon`, className: `${t}__button__icon` })
24
25
  }
25
- ) : null : /* @__PURE__ */ n(
26
+ ) : null : /* @__PURE__ */ r(
26
27
  "button",
27
28
  {
28
- ...a,
29
+ ...b,
29
30
  type: "button",
30
31
  "data-testid": `${o}-button`,
31
- "aria-label": e,
32
+ "aria-label": a,
32
33
  className: `${t}__button ${t}__button--search`,
33
- onClick: (r) => {
34
- u(!0), r.stopPropagation();
34
+ onClick: (n) => {
35
+ _(!0), n.stopPropagation();
35
36
  },
36
- children: /* @__PURE__ */ n(_, { "data-testid": `${o}-button-icon`, className: `${t}__button__icon` })
37
+ children: /* @__PURE__ */ r(e, { "data-testid": `${o}-button-icon`, className: `${t}__button__icon` })
37
38
  }
38
39
  );
39
40
  export {
40
- m as SearchButton
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
- @media (max-width: $breakpoint-sm) {
9
- display: none;
8
+ &__back-button {
9
+ svg {
10
+ height: 1rem;
11
+ width: 1rem;
12
+ }
10
13
  }
11
14
 
12
- .back-button {
15
+ &__item {
13
16
  align-items: center;
14
- background-color: transparent;
15
- border: none;
16
- cursor: pointer;
17
17
  display: flex;
18
- height: 44px;
19
- justify-content: center;
20
- width: 44px;
18
+ flex-direction: row;
19
+ flex-shrink: 0;
21
20
 
22
- svg {
23
- height: 24px;
24
- width: 24px;
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
- li {
34
- align-items: center;
35
- display: flex;
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
- &:hover {
50
- color: $button-hover;
51
- text-decoration: none;
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: 100%;
73
- height: 1rem;
73
+ height: 1.25rem;
74
74
  margin-inline-end: unset;
75
75
  position: absolute;
76
- width: 100%;
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;
@@ -6,7 +6,7 @@
6
6
  max-height: 100%;
7
7
  max-width: 100%;
8
8
  overflow: auto;
9
- padding: 2rem;
9
+ padding: $padding-md;
10
10
  position: absolute;
11
11
  top: 50%;
12
12
  transform: translate(-50%, -50%);
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.67.2",
3
+ "version": "1.68.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"