@phillips/seldon 1.34.0 → 1.36.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.
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Button/Button.js +17 -16
- package/dist/components/Button/types.d.ts +5 -0
- package/dist/components/Button/types.js +4 -0
- package/dist/components/Header/Header.js +34 -34
- package/dist/components/IconButton/IconButton.js +13 -12
- package/dist/components/Input/Input.js +24 -24
- package/dist/components/Search/Search.d.ts +44 -3
- package/dist/components/Search/Search.js +113 -43
- package/dist/components/Search/SearchResults/SearchResults.d.ts +13 -0
- package/dist/components/Search/SearchResults/SearchResults.js +16 -0
- package/dist/components/Social/Social.js +14 -13
- package/dist/components/Subscribe/Subscribe.d.ts +5 -1
- package/dist/components/Subscribe/Subscribe.js +48 -35
- package/dist/components/ViewingsList/ViewingsListCard.js +145 -114
- package/dist/index.d.ts +1 -0
- package/dist/index.js +84 -80
- package/dist/scss/components/Input/_input.scss +7 -4
- package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +2 -2
- package/dist/scss/components/Search/_search.scss +54 -5
- package/dist/scss/components/Subscribe/_subscribe.scss +20 -11
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +40 -31
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonVariants } from './types';
|
|
1
2
|
export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
2
3
|
/**
|
|
3
4
|
* Button contents
|
|
@@ -14,7 +15,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
14
15
|
/**
|
|
15
16
|
* Is this the principal call to action on the page?
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
variant?: ButtonVariants;
|
|
18
19
|
/**
|
|
19
20
|
* How large should the button be?
|
|
20
21
|
*/
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import p from "../../node_modules/classnames/index.js";
|
|
3
3
|
import { getCommonProps as u } from "../../utils/index.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { ButtonVariants as d } from "./types.js";
|
|
5
|
+
import { forwardRef as $ } from "react";
|
|
6
|
+
const b = $(
|
|
6
7
|
({
|
|
7
|
-
|
|
8
|
+
variant: s = d.primary,
|
|
8
9
|
size: a = "md",
|
|
9
10
|
children: m,
|
|
10
11
|
className: r,
|
|
11
|
-
isIconLast:
|
|
12
|
-
type:
|
|
13
|
-
isDisabled:
|
|
14
|
-
...
|
|
12
|
+
isIconLast: n = !1,
|
|
13
|
+
type: e = "button",
|
|
14
|
+
isDisabled: i = !1,
|
|
15
|
+
...t
|
|
15
16
|
}, f) => {
|
|
16
|
-
const { className: o, ...
|
|
17
|
+
const { className: o, ...l } = u(t, "Button");
|
|
17
18
|
return /* @__PURE__ */ c(
|
|
18
19
|
"button",
|
|
19
20
|
{
|
|
20
|
-
...
|
|
21
|
+
...l,
|
|
21
22
|
ref: f,
|
|
22
|
-
type:
|
|
23
|
+
type: e,
|
|
23
24
|
className: p(
|
|
24
25
|
`${o}`,
|
|
25
26
|
`${o}--${a}`,
|
|
26
|
-
`${o}--${
|
|
27
|
+
`${o}--${s}`,
|
|
27
28
|
{
|
|
28
|
-
[`${o}--icon-last`]:
|
|
29
|
+
[`${o}--icon-last`]: n
|
|
29
30
|
},
|
|
30
31
|
r
|
|
31
32
|
),
|
|
32
|
-
disabled:
|
|
33
|
-
...
|
|
33
|
+
disabled: i,
|
|
34
|
+
...t,
|
|
34
35
|
children: m
|
|
35
36
|
}
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
);
|
|
39
|
-
|
|
40
|
+
b.displayName = "Button";
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
b as default
|
|
42
43
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as N, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import r from "../../node_modules/classnames/index.js";
|
|
3
|
-
import * as
|
|
4
|
-
import { px as a } from "../../utils/index.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import { findChildrenOfType as _, px as a } from "../../utils/index.js";
|
|
5
|
+
import x from "../Search/Search.js";
|
|
6
|
+
import P from "../../assets/PhillipsLogo.svg.js";
|
|
7
|
+
const j = i.createContext({
|
|
8
8
|
defaultMobileMenuLabel: "",
|
|
9
9
|
expandedItem: "",
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
@@ -14,28 +14,28 @@ const N = c.createContext({
|
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
15
15
|
onSelect: (t) => {
|
|
16
16
|
}
|
|
17
|
-
}),
|
|
17
|
+
}), R = ({
|
|
18
18
|
defaultMobileMenuLabel: t = "Main Menu",
|
|
19
|
-
logo:
|
|
20
|
-
className:
|
|
21
|
-
children:
|
|
22
|
-
toggleOpenText:
|
|
23
|
-
toggleCloseText:
|
|
24
|
-
logoText:
|
|
25
|
-
...
|
|
19
|
+
logo: s = /* @__PURE__ */ e(P, {}),
|
|
20
|
+
className: v,
|
|
21
|
+
children: l,
|
|
22
|
+
toggleOpenText: m = "Open Menu",
|
|
23
|
+
toggleCloseText: h = "Close Menu",
|
|
24
|
+
logoText: f = "Home Page",
|
|
25
|
+
...S
|
|
26
26
|
}) => {
|
|
27
|
-
const [
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
27
|
+
const $ = _(l, x), u = _(l, x, !0), [d, E] = i.useState(!1), [p, c] = i.useState(t), o = d ? h : m, y = p !== t, g = function() {
|
|
28
|
+
E((n) => !n), c(t);
|
|
29
|
+
}, I = function(n) {
|
|
30
|
+
c((C) => C === t ? n : t);
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ N("header", { ...S, className: r(`${a}-header`, v), children: [
|
|
33
33
|
/* @__PURE__ */ e(
|
|
34
34
|
"div",
|
|
35
35
|
{
|
|
36
|
-
className: r(`${a}-header__overlay`, { [`${a}-header__overlay--active`]:
|
|
36
|
+
className: r(`${a}-header__overlay`, { [`${a}-header__overlay--active`]: d }),
|
|
37
37
|
"data-testid": "header-overlay",
|
|
38
|
-
onClick:
|
|
38
|
+
onClick: g
|
|
39
39
|
}
|
|
40
40
|
),
|
|
41
41
|
/* @__PURE__ */ e(
|
|
@@ -44,31 +44,31 @@ const N = c.createContext({
|
|
|
44
44
|
"aria-label": o,
|
|
45
45
|
"data-testid": "mobile-menu-toggle",
|
|
46
46
|
type: "button",
|
|
47
|
-
onClick:
|
|
47
|
+
onClick: g,
|
|
48
48
|
className: r(`${a}-header__toggle-btn`, {
|
|
49
|
-
[`${a}-header__toggle-btn--open`]: o ===
|
|
49
|
+
[`${a}-header__toggle-btn--open`]: o === h
|
|
50
50
|
}),
|
|
51
51
|
children: /* @__PURE__ */ e("span", { children: o })
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
|
-
/* @__PURE__ */ e("h1", { "data-testid": "header-logo", className: `${a}-header__logo`, tabIndex: o ===
|
|
55
|
-
/* @__PURE__ */ e("div", { className: r(`${a}-header__nav`, { [`${a}-header__nav--open`]:
|
|
56
|
-
|
|
54
|
+
/* @__PURE__ */ e("h1", { "data-testid": "header-logo", className: `${a}-header__logo`, tabIndex: o === m ? 0 : -1, children: /* @__PURE__ */ e("a", { href: "/", "aria-label": f, children: typeof s == "object" ? s : /* @__PURE__ */ e("img", { alt: "Phillips", "data-testid": "header-logo-img", src: s, height: "14" }) }) }),
|
|
55
|
+
/* @__PURE__ */ e("div", { className: r(`${a}-header__nav`, { [`${a}-header__nav--open`]: d }), children: /* @__PURE__ */ e(
|
|
56
|
+
j.Provider,
|
|
57
57
|
{
|
|
58
58
|
value: {
|
|
59
59
|
defaultMobileMenuLabel: t,
|
|
60
|
-
expandedItem:
|
|
61
|
-
setExpandedItem: (n) =>
|
|
62
|
-
isExpanded:
|
|
63
|
-
onSelect: (n) =>
|
|
60
|
+
expandedItem: p,
|
|
61
|
+
setExpandedItem: (n) => c(n),
|
|
62
|
+
isExpanded: y,
|
|
63
|
+
onSelect: (n) => I(n)
|
|
64
64
|
},
|
|
65
|
-
children:
|
|
65
|
+
children: u
|
|
66
66
|
}
|
|
67
67
|
) }),
|
|
68
|
-
|
|
68
|
+
$
|
|
69
69
|
] });
|
|
70
70
|
};
|
|
71
71
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
j as HeaderContext,
|
|
73
|
+
R as default
|
|
74
74
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { getCommonProps as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import c from "../../node_modules/classnames/index.js";
|
|
3
|
+
import e from "../Button/Button.js";
|
|
4
|
+
import { getCommonProps as i } from "../../utils/index.js";
|
|
5
|
+
import { ButtonVariants as p } from "../Button/types.js";
|
|
6
|
+
const x = ({ children: m, size: r = "md", className: s, ...o }) => {
|
|
7
|
+
const { className: t, ...a } = i(o, "IconButton");
|
|
8
|
+
return /* @__PURE__ */ n(
|
|
9
|
+
e,
|
|
9
10
|
{
|
|
10
|
-
...
|
|
11
|
-
|
|
12
|
-
className:
|
|
11
|
+
...a,
|
|
12
|
+
variant: p.primary,
|
|
13
|
+
className: c(t, `${t}--${r}`, s),
|
|
13
14
|
...o,
|
|
14
15
|
children: m
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
x as default
|
|
20
21
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as P, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import * as R from "react";
|
|
3
|
-
import
|
|
3
|
+
import t from "../../node_modules/classnames/index.js";
|
|
4
4
|
import { px as i, useNormalizedInputProps as y } from "../../utils/index.js";
|
|
5
5
|
const z = R.forwardRef(
|
|
6
6
|
({
|
|
7
|
-
className:
|
|
7
|
+
className: p,
|
|
8
8
|
defaultValue: r,
|
|
9
9
|
disabled: u,
|
|
10
10
|
hideLabel: o,
|
|
11
|
-
id:
|
|
11
|
+
id: a,
|
|
12
12
|
inline: m,
|
|
13
13
|
invalid: $,
|
|
14
14
|
invalidText: c,
|
|
@@ -16,45 +16,45 @@ const z = R.forwardRef(
|
|
|
16
16
|
onChange: b,
|
|
17
17
|
onClick: f,
|
|
18
18
|
placeholder: h,
|
|
19
|
-
readOnly:
|
|
20
|
-
size:
|
|
19
|
+
readOnly: e,
|
|
20
|
+
size: v = "md",
|
|
21
21
|
type: s = "text",
|
|
22
|
-
value:
|
|
23
|
-
warn:
|
|
24
|
-
warnText:
|
|
25
|
-
...
|
|
26
|
-
},
|
|
27
|
-
const n = y({ disabled: u, id:
|
|
22
|
+
value: w,
|
|
23
|
+
warn: x,
|
|
24
|
+
warnText: N,
|
|
25
|
+
...d
|
|
26
|
+
}, I) => {
|
|
27
|
+
const n = y({ disabled: u, id: a, invalid: $, invalidText: c, readOnly: e, type: s, warn: x, warnText: N }), j = t(`${i}-${s}-input`, `${i}-input`, `${i}-input--${v}`, {
|
|
28
28
|
[`${i}-input--inline`]: m,
|
|
29
|
-
[`${i}-input--readonly`]:
|
|
29
|
+
[`${i}-input--readonly`]: e,
|
|
30
30
|
[`${i}-input--disabled`]: n.disabled,
|
|
31
31
|
[`${i}-input--invalid`]: n.invalid,
|
|
32
32
|
[`${i}-input--warn`]: n.warn,
|
|
33
|
-
[`${
|
|
34
|
-
[`${i}-input--hidden`]:
|
|
33
|
+
[`${p}__wrapper`]: p,
|
|
34
|
+
[`${i}-input--hidden`]: d.hidden
|
|
35
35
|
});
|
|
36
36
|
return /* @__PURE__ */ P("div", { className: j, children: [
|
|
37
|
-
/* @__PURE__ */ l("label", { htmlFor:
|
|
37
|
+
/* @__PURE__ */ l("label", { htmlFor: a, className: t(`${i}-input__label`, { [`${i}-input__label--hidden`]: o }), children: _ }),
|
|
38
38
|
/* @__PURE__ */ l(
|
|
39
39
|
"input",
|
|
40
40
|
{
|
|
41
|
-
className:
|
|
42
|
-
"data-testid":
|
|
41
|
+
className: t(`${i}-input__input`, { className: p }),
|
|
42
|
+
"data-testid": a,
|
|
43
43
|
defaultValue: r,
|
|
44
44
|
disabled: n.disabled,
|
|
45
|
-
id:
|
|
46
|
-
name:
|
|
45
|
+
id: a,
|
|
46
|
+
name: d.name,
|
|
47
47
|
onChange: b,
|
|
48
48
|
onClick: f,
|
|
49
49
|
placeholder: h,
|
|
50
|
-
readOnly:
|
|
51
|
-
ref:
|
|
50
|
+
readOnly: e,
|
|
51
|
+
ref: I,
|
|
52
52
|
type: n.type,
|
|
53
|
-
value:
|
|
54
|
-
...
|
|
53
|
+
value: w,
|
|
54
|
+
...d
|
|
55
55
|
}
|
|
56
56
|
),
|
|
57
|
-
n.validation
|
|
57
|
+
n.validation ? n.validation : /* @__PURE__ */ l("p", { className: t(`${i}-input__validation`), children: " " })
|
|
58
58
|
] });
|
|
59
59
|
}
|
|
60
60
|
);
|
|
@@ -1,7 +1,48 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type SearchResultsProps } from './SearchResults/SearchResults';
|
|
3
|
+
export interface SearchProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* If true will show an icon instead of text in the button
|
|
6
|
+
*/
|
|
4
7
|
useIcon?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param searchQuery called when the search input changes
|
|
11
|
+
* @returns void
|
|
12
|
+
*/
|
|
13
|
+
onSearch?: (searchQuery: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* The search results to display
|
|
16
|
+
*/
|
|
17
|
+
searchResults?: SearchResultsProps['autoCompleteResults'];
|
|
18
|
+
/**
|
|
19
|
+
* additional state information
|
|
20
|
+
*/
|
|
21
|
+
state?: 'loading' | 'invalid' | 'idle';
|
|
22
|
+
/**
|
|
23
|
+
* allows override of the default placeholder (i.e. for internationalization)
|
|
24
|
+
*/
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/**
|
|
27
|
+
* allows override of the search button label (i.e. for internationalization)
|
|
28
|
+
*/
|
|
29
|
+
searchButtonText?: string;
|
|
30
|
+
/**
|
|
31
|
+
* allows override of the default loading text (i.e. for internationalization)
|
|
32
|
+
*/
|
|
33
|
+
loadingText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* allows override of the default allResults text (i.e. for internationalization)
|
|
36
|
+
*/
|
|
37
|
+
getAllResultsText?: (searchQuery: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* allows override of the default allResults link in case this component should not launch not the default all results landing point
|
|
40
|
+
*/
|
|
41
|
+
getAllResultsLink?: (searchQuery: string) => string;
|
|
42
|
+
/**
|
|
43
|
+
* allows override of the default invalid text (i.e. for internationalization)
|
|
44
|
+
*/
|
|
45
|
+
invalidText?: string;
|
|
5
46
|
}
|
|
6
|
-
declare const Search: ({
|
|
47
|
+
declare const Search: ({ useIcon, onSearch, searchResults, state, defaultValue, className, placeholder, searchButtonText, loadingText, invalidText, getAllResultsText, getAllResultsLink, ...props }: React.PropsWithChildren<SearchProps>) => import("react/jsx-runtime").JSX.Element;
|
|
7
48
|
export default Search;
|
|
@@ -1,49 +1,119 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as v from "react";
|
|
3
|
+
import { getCommonProps as L, encodeURLSearchParams as k } from "../../utils/index.js";
|
|
4
4
|
import o from "../../node_modules/classnames/index.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import E from "../Input/Input.js";
|
|
6
|
+
import $ from "../../assets/search.svg.js";
|
|
7
|
+
import P from "../Link/Link.js";
|
|
8
|
+
import j from "./SearchResults/SearchResults.js";
|
|
9
|
+
const V = ({
|
|
10
|
+
useIcon: i = !0,
|
|
11
|
+
onSearch: d,
|
|
12
|
+
searchResults: b = [],
|
|
13
|
+
state: m = "idle",
|
|
14
|
+
defaultValue: N = "",
|
|
15
|
+
className: S,
|
|
16
|
+
placeholder: y = "Type to search",
|
|
17
|
+
searchButtonText: n = "Search",
|
|
18
|
+
loadingText: g = "Loading...",
|
|
19
|
+
invalidText: w = "Invalid search",
|
|
20
|
+
getAllResultsText: R = (e) => `View all results for ${e}`,
|
|
21
|
+
getAllResultsLink: C = (e) => `/Search?Search=${e}`,
|
|
22
|
+
...u
|
|
23
|
+
}) => {
|
|
24
|
+
var _;
|
|
25
|
+
const { className: e, "data-testid": t, ...x } = L(u, "Search"), [s, p] = v.useState(!1), c = v.useRef(null), l = (_ = c.current) == null ? void 0 : _.value, h = () => {
|
|
26
|
+
var r;
|
|
27
|
+
p(!s), s || (r = c.current) == null || r.focus();
|
|
10
28
|
};
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{ [`${a}-search__input-wrapper--active`]: t },
|
|
28
|
-
{ [`${a}-search__input-wrapper--use-icon`]: r }
|
|
29
|
+
return /* @__PURE__ */ f(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
...x,
|
|
33
|
+
className: o(e, S),
|
|
34
|
+
"data-testid": t,
|
|
35
|
+
role: "search",
|
|
36
|
+
...u,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ a(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
"data-testid": `${t}-overlay`,
|
|
42
|
+
className: o(`${e}__overlay`, { [`${e}__overlay--active`]: s }),
|
|
43
|
+
onClick: h
|
|
44
|
+
}
|
|
29
45
|
),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
/* @__PURE__ */ a(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
"data-testid": `${t}-button`,
|
|
50
|
+
"aria-label": n,
|
|
51
|
+
className: `${e}__button`,
|
|
52
|
+
onClick: h,
|
|
53
|
+
children: i ? /* @__PURE__ */ a($, { "data-testid": `${t}-button-icon`, className: `${e}__button__icon` }) : n
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ a(
|
|
57
|
+
"form",
|
|
58
|
+
{
|
|
59
|
+
"data-testid": `${t}-form`,
|
|
60
|
+
className: o(`${e}__form`, { [`${e}__form--active`]: s }),
|
|
61
|
+
"aria-hidden": !s,
|
|
62
|
+
children: /* @__PURE__ */ f(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: o(`${e}__input-wrapper`, {
|
|
66
|
+
[`${e}__input-wrapper--use-icon`]: i
|
|
67
|
+
}),
|
|
68
|
+
role: "combobox",
|
|
69
|
+
"aria-haspopup": "listbox",
|
|
70
|
+
children: [
|
|
71
|
+
i ? /* @__PURE__ */ a($, { "data-testid": `${t}-form-icon`, className: `${e}__input-wrapper__icon` }) : null,
|
|
72
|
+
/* @__PURE__ */ a(
|
|
73
|
+
E,
|
|
74
|
+
{
|
|
75
|
+
className: `${e}__input`,
|
|
76
|
+
id: "search-input",
|
|
77
|
+
hideLabel: !0,
|
|
78
|
+
labelText: n,
|
|
79
|
+
placeholder: y,
|
|
80
|
+
type: "text",
|
|
81
|
+
defaultValue: N,
|
|
82
|
+
invalid: m === "invalid",
|
|
83
|
+
invalidText: w,
|
|
84
|
+
onKeyDown: (r) => {
|
|
85
|
+
r.key === "Escape" && p(!1);
|
|
86
|
+
},
|
|
87
|
+
onChange: d ? (r) => {
|
|
88
|
+
d(r.target.value);
|
|
89
|
+
} : void 0,
|
|
90
|
+
ref: c
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
l && l.length > 2 ? /* @__PURE__ */ a(
|
|
94
|
+
j,
|
|
95
|
+
{
|
|
96
|
+
autoCompleteResults: b,
|
|
97
|
+
isLoading: m === "loading",
|
|
98
|
+
loadingText: g,
|
|
99
|
+
children: /* @__PURE__ */ a("li", { className: `${e}__result`, children: /* @__PURE__ */ a(
|
|
100
|
+
P,
|
|
101
|
+
{
|
|
102
|
+
href: ((r) => k(C(r)))(l),
|
|
103
|
+
children: /* @__PURE__ */ a("p", { children: R(l) })
|
|
104
|
+
}
|
|
105
|
+
) }, "viewAllSearchResults")
|
|
106
|
+
}
|
|
107
|
+
) : null
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
46
116
|
};
|
|
47
117
|
export {
|
|
48
|
-
|
|
118
|
+
V as default
|
|
49
119
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SearchResultsProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
autoCompleteResults?: {
|
|
4
|
+
id: string;
|
|
5
|
+
url: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}[];
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
loadingText?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default SearchResults;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs as h, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { px as e } from "../../../utils/index.js";
|
|
3
|
+
import n from "../../Link/Link.js";
|
|
4
|
+
const _ = ({
|
|
5
|
+
autoCompleteResults: s = [],
|
|
6
|
+
isLoading: l,
|
|
7
|
+
children: i,
|
|
8
|
+
loadingText: c = "Loading..."
|
|
9
|
+
}) => /* @__PURE__ */ h("ul", { "data-testid": "search-results", className: `${e}-search__results`, children: [
|
|
10
|
+
l ? /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: c }) : null,
|
|
11
|
+
Array.isArray(s) && s.length > 0 && s.map((a) => /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: /* @__PURE__ */ r(n, { href: a.url, children: /* @__PURE__ */ r("p", { children: a.label }) }) }, a.id)),
|
|
12
|
+
i
|
|
13
|
+
] });
|
|
14
|
+
export {
|
|
15
|
+
_ as default
|
|
16
|
+
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import l from "../../node_modules/classnames/index.js";
|
|
3
3
|
import { getCommonProps as u } from "../../utils/index.js";
|
|
4
4
|
import N from "../Button/Button.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { ButtonVariants as d } from "../Button/types.js";
|
|
6
|
+
const v = ({
|
|
7
|
+
className: e,
|
|
7
8
|
children: t,
|
|
8
|
-
titleText:
|
|
9
|
-
buttonText:
|
|
10
|
-
onSubscribeClick:
|
|
11
|
-
...
|
|
9
|
+
titleText: a = "Never Miss A Moment",
|
|
10
|
+
buttonText: m = "Subscribe To Our Newsletter",
|
|
11
|
+
onSubscribeClick: i,
|
|
12
|
+
...s
|
|
12
13
|
}) => {
|
|
13
|
-
const { className:
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
14
|
+
const { className: o, ...n } = u(s, "Social");
|
|
15
|
+
return /* @__PURE__ */ c("div", { ...n, className: l(o, e), ...s, children: [
|
|
16
|
+
/* @__PURE__ */ r("h3", { className: `${o}__header`, children: a }),
|
|
17
|
+
/* @__PURE__ */ r(N, { onClick: i, variant: d.ghost, className: `${o}__button`, children: m }),
|
|
17
18
|
t
|
|
18
19
|
] });
|
|
19
20
|
};
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
v as default
|
|
22
23
|
};
|
|
@@ -45,6 +45,10 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
|
|
|
45
45
|
* Subscribe success text
|
|
46
46
|
*/
|
|
47
47
|
successText?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Subscribe privacy text
|
|
50
|
+
*/
|
|
51
|
+
privacyText?: string;
|
|
48
52
|
/**
|
|
49
53
|
* Subscribe state for loading or error
|
|
50
54
|
*/
|
|
@@ -59,5 +63,5 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
|
|
|
59
63
|
*
|
|
60
64
|
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-subscribe--overview)
|
|
61
65
|
*/
|
|
62
|
-
declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, inputLabelText, inputPlaceholder, title, loadingText, invalidText, errorText, successText, subscriptionState, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, inputLabelText, inputPlaceholder, title, loadingText, invalidText, errorText, successText, privacyText, subscriptionState, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
|
|
63
67
|
export default Subscribe;
|