@phillips/seldon 1.112.1 → 1.114.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 +5 -1
- package/dist/components/Button/Button.js +66 -52
- package/dist/components/Button/Button.stories.d.ts +7 -0
- package/dist/components/IconButton/IconButton.d.ts +13 -0
- package/dist/components/Pagination/Pagination.d.ts +9 -0
- package/dist/components/Pagination/Pagination.js +68 -62
- package/dist/components/Pagination/Pagination.stories.d.ts +1 -0
- package/dist/node_modules/exenv/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/scss/patterns/ObjectTile/_objectTile.scss +2 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement | HT
|
|
|
11
11
|
/**
|
|
12
12
|
* Optional click handler
|
|
13
13
|
*/
|
|
14
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
14
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement> | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Is this the principal call to action on the page?
|
|
17
17
|
*/
|
|
@@ -32,6 +32,10 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement | HT
|
|
|
32
32
|
* The target of the link (e.g. _blank). To be combined with href.
|
|
33
33
|
*/
|
|
34
34
|
target?: string;
|
|
35
|
+
/**
|
|
36
|
+
* prefetch the link
|
|
37
|
+
*/
|
|
38
|
+
prefetch?: 'none' | 'intent' | 'render' | 'viewport';
|
|
35
39
|
}
|
|
36
40
|
/**
|
|
37
41
|
* ## Overview
|
|
@@ -1,61 +1,75 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as f, Fragment as k, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import p from "../../node_modules/classnames/index.js";
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import { ButtonVariants as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
const
|
|
3
|
+
import { getCommonProps as N } from "../../utils/index.js";
|
|
4
|
+
import { ButtonVariants as v } from "./types.js";
|
|
5
|
+
import { forwardRef as x, useState as P } from "react";
|
|
6
|
+
const j = x(
|
|
7
7
|
({
|
|
8
|
-
variant:
|
|
9
|
-
children:
|
|
10
|
-
className:
|
|
11
|
-
isIconLast:
|
|
12
|
-
type:
|
|
13
|
-
isDisabled:
|
|
14
|
-
href:
|
|
15
|
-
target:
|
|
8
|
+
variant: r = v.primary,
|
|
9
|
+
children: s,
|
|
10
|
+
className: a,
|
|
11
|
+
isIconLast: l = !1,
|
|
12
|
+
type: $ = "button",
|
|
13
|
+
isDisabled: b = !1,
|
|
14
|
+
href: t,
|
|
15
|
+
target: i,
|
|
16
|
+
prefetch: m = "none",
|
|
16
17
|
...n
|
|
17
|
-
},
|
|
18
|
-
const { className:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`${o}--${s}`,
|
|
18
|
+
}, d) => {
|
|
19
|
+
const { className: e, ...c } = N(n, "Button"), [B, C] = P(!1);
|
|
20
|
+
if (t) {
|
|
21
|
+
const u = () => /* @__PURE__ */ f(k, { children: [
|
|
22
|
+
/* @__PURE__ */ o("link", { "data-testid": "prefetch-link", rel: "prefetch", href: t }),
|
|
23
|
+
/* @__PURE__ */ o("link", { "data-testid": "modulepreload-link", rel: "modulepreload", href: t })
|
|
24
|
+
] });
|
|
25
|
+
return /* @__PURE__ */ f(k, { children: [
|
|
26
|
+
/* @__PURE__ */ o(
|
|
27
|
+
"a",
|
|
28
28
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
...c,
|
|
30
|
+
ref: d,
|
|
31
|
+
href: t,
|
|
32
|
+
className: p(
|
|
33
|
+
`${e}`,
|
|
34
|
+
`${e}--${r}`,
|
|
35
|
+
{
|
|
36
|
+
[`${e}--icon-last`]: l
|
|
37
|
+
},
|
|
38
|
+
a
|
|
39
|
+
),
|
|
40
|
+
target: i,
|
|
41
|
+
rel: i === "_blank" ? "noopener noreferrer" : void 0,
|
|
42
|
+
onMouseOver: () => C(!0),
|
|
43
|
+
onClick: n.onClick,
|
|
44
|
+
children: s
|
|
45
|
+
}
|
|
32
46
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
m === "intent" && B && /* @__PURE__ */ o(u, {}),
|
|
48
|
+
m === "render" && /* @__PURE__ */ o(u, {})
|
|
49
|
+
] });
|
|
50
|
+
} else
|
|
51
|
+
return /* @__PURE__ */ o(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
...c,
|
|
55
|
+
ref: d,
|
|
56
|
+
type: $,
|
|
57
|
+
className: p(
|
|
58
|
+
`${e}`,
|
|
59
|
+
`${e}--${r}`,
|
|
60
|
+
{
|
|
61
|
+
[`${e}--icon-last`]: l
|
|
62
|
+
},
|
|
63
|
+
a
|
|
64
|
+
),
|
|
65
|
+
disabled: b,
|
|
66
|
+
...n,
|
|
67
|
+
children: s
|
|
68
|
+
}
|
|
69
|
+
);
|
|
56
70
|
}
|
|
57
71
|
);
|
|
58
|
-
|
|
72
|
+
j.displayName = "Button";
|
|
59
73
|
export {
|
|
60
|
-
|
|
74
|
+
j as default
|
|
61
75
|
};
|
|
@@ -24,6 +24,13 @@ export declare const ButtonAsLink: {
|
|
|
24
24
|
size: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
export declare const ButtonAsLinkWithPrefetch: {
|
|
28
|
+
(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
args: {
|
|
30
|
+
variant: ButtonVariants;
|
|
31
|
+
size: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
27
34
|
export declare const Playground: {
|
|
28
35
|
args: {
|
|
29
36
|
children: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonProps } from '../Button/Button';
|
|
1
2
|
import { ButtonVariants } from '../Button/types';
|
|
2
3
|
export interface IconButtonProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
3
4
|
/**
|
|
@@ -12,6 +13,18 @@ export interface IconButtonProps extends Omit<React.HTMLAttributes<HTMLButtonEle
|
|
|
12
13
|
* Should the button be disabled?
|
|
13
14
|
*/
|
|
14
15
|
isDisabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The href of the button. This will make the button render as an anchor tag.
|
|
18
|
+
*/
|
|
19
|
+
href?: ButtonProps['href'];
|
|
20
|
+
/**
|
|
21
|
+
* The target of the link (e.g. _blank). To be combined with href.
|
|
22
|
+
*/
|
|
23
|
+
target?: ButtonProps['target'];
|
|
24
|
+
/**
|
|
25
|
+
* The prefetch of the link.
|
|
26
|
+
*/
|
|
27
|
+
prefetch?: ButtonProps['prefetch'];
|
|
15
28
|
}
|
|
16
29
|
declare const IconButton: ({ children, variant, isDisabled, className, ...props }: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
30
|
export default IconButton;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React, ComponentProps } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button/Button';
|
|
2
3
|
export type PaginationOptionValue = string | number;
|
|
3
4
|
export interface PaginationOption {
|
|
4
5
|
/**
|
|
@@ -6,6 +7,14 @@ export interface PaginationOption {
|
|
|
6
7
|
*/
|
|
7
8
|
label: string;
|
|
8
9
|
value: string | number;
|
|
10
|
+
/**
|
|
11
|
+
* The href of the button. This will make the button render as an anchor tag. If included, the button will override prevent the default link behavior and leave navigation up to the consumer.
|
|
12
|
+
*/
|
|
13
|
+
href?: ButtonProps['href'];
|
|
14
|
+
/**
|
|
15
|
+
* The prefetch of the link.
|
|
16
|
+
*/
|
|
17
|
+
prefetch?: ButtonProps['prefetch'];
|
|
9
18
|
}
|
|
10
19
|
export interface PaginationProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
11
20
|
/**
|
|
@@ -1,84 +1,90 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import x from "
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { jsxs as k, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as B } from "react";
|
|
3
|
+
import v from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { getCommonProps as T, px as u } from "../../utils/index.js";
|
|
5
|
+
import F from "../Select/Select.js";
|
|
6
|
+
import x from "../../assets/chevronRight.svg.js";
|
|
7
|
+
import y from "../IconButton/IconButton.js";
|
|
8
|
+
import { ButtonVariants as P } from "../Button/types.js";
|
|
9
|
+
import { determineOptionValue as i, findOptionFromSelectString as M } from "./utils.js";
|
|
10
|
+
import { usePendingState as R } from "../../utils/hooks.js";
|
|
11
|
+
const L = ({
|
|
12
|
+
className: $,
|
|
13
|
+
onChange: S,
|
|
14
|
+
variant: j = "inline",
|
|
15
|
+
options: a = [],
|
|
16
|
+
value: g,
|
|
17
|
+
isDisabled: m,
|
|
18
|
+
previousLabel: C = "Previous",
|
|
19
|
+
nextLabel: N = "Next",
|
|
20
|
+
selectLabel: b = "Select",
|
|
20
21
|
...s
|
|
21
22
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
23
|
+
const O = "pagination", { className: c, ...I } = T(s, "Pagination"), { id: p } = s, { pendingState: _, setPendingState: w } = R(i(g)), f = _ || g, d = (e, r) => {
|
|
24
|
+
const l = i(e);
|
|
25
|
+
w(l), S(l, r);
|
|
26
|
+
}, [t, n] = B(() => {
|
|
27
|
+
const e = a.findIndex((h) => i(h) === f) - 1, r = a.at(e) || "", l = (a.findIndex((h) => i(h) === f) + 1) % a.length, V = a[l];
|
|
28
|
+
return [r, V];
|
|
29
|
+
}, [a, f]);
|
|
30
|
+
return /* @__PURE__ */ k(
|
|
27
31
|
"div",
|
|
28
32
|
{
|
|
29
|
-
className:
|
|
33
|
+
className: v(`${u}-${O}`, { [`${c}__wrapper`]: c }, $),
|
|
30
34
|
...I,
|
|
31
35
|
...s,
|
|
32
36
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
|
+
y,
|
|
35
39
|
{
|
|
36
|
-
className:
|
|
37
|
-
onClick: () => {
|
|
38
|
-
|
|
39
|
-
d(e);
|
|
40
|
+
className: v(`${c}__button`, `${u}-left-arrow`),
|
|
41
|
+
onClick: (e) => {
|
|
42
|
+
typeof t == "object" && t.href && e.preventDefault(), d(t);
|
|
40
43
|
},
|
|
41
|
-
"data-testid": `${
|
|
42
|
-
isDisabled:
|
|
43
|
-
"aria-label":
|
|
44
|
-
variant:
|
|
45
|
-
|
|
44
|
+
"data-testid": `${p}-previous-button`,
|
|
45
|
+
isDisabled: m,
|
|
46
|
+
"aria-label": C,
|
|
47
|
+
variant: P.primary,
|
|
48
|
+
href: typeof t == "object" && t.href ? t.href : void 0,
|
|
49
|
+
prefetch: typeof t == "object" && t.prefetch ? t.prefetch : void 0,
|
|
50
|
+
children: /* @__PURE__ */ o(x, {})
|
|
46
51
|
}
|
|
47
52
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
53
|
+
/* @__PURE__ */ o(
|
|
54
|
+
F,
|
|
50
55
|
{
|
|
51
|
-
className:
|
|
52
|
-
"aria-label":
|
|
53
|
-
value:
|
|
54
|
-
onChange: (
|
|
55
|
-
const
|
|
56
|
-
|
|
56
|
+
className: j === "inline" ? `${u}--inline-pagination` : void 0,
|
|
57
|
+
"aria-label": b,
|
|
58
|
+
value: f,
|
|
59
|
+
onChange: (e) => {
|
|
60
|
+
const r = M(a, e == null ? void 0 : e.currentTarget.value);
|
|
61
|
+
r && d(r, e);
|
|
57
62
|
},
|
|
58
|
-
"data-testid": `${
|
|
63
|
+
"data-testid": `${p}-select-button`,
|
|
59
64
|
hideLabel: !0,
|
|
60
|
-
labelText:
|
|
61
|
-
disabled:
|
|
65
|
+
labelText: b,
|
|
66
|
+
disabled: m,
|
|
62
67
|
showIcon: !1,
|
|
63
|
-
children:
|
|
64
|
-
const
|
|
65
|
-
return /* @__PURE__ */
|
|
68
|
+
children: a.map((e) => {
|
|
69
|
+
const r = i(e);
|
|
70
|
+
return /* @__PURE__ */ o("option", { value: r, children: typeof e == "string" || typeof e == "number" ? e : e.label }, r);
|
|
66
71
|
})
|
|
67
72
|
}
|
|
68
73
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
74
|
+
/* @__PURE__ */ o(
|
|
75
|
+
y,
|
|
71
76
|
{
|
|
72
|
-
className: `${
|
|
73
|
-
onClick: () => {
|
|
74
|
-
|
|
75
|
-
d(e);
|
|
77
|
+
className: `${c}__button`,
|
|
78
|
+
onClick: (e) => {
|
|
79
|
+
typeof n == "object" && n.href && e.preventDefault(), d(n);
|
|
76
80
|
},
|
|
77
|
-
"data-testid": `${
|
|
78
|
-
isDisabled:
|
|
79
|
-
"aria-label":
|
|
80
|
-
variant:
|
|
81
|
-
|
|
81
|
+
"data-testid": `${p}-next-button`,
|
|
82
|
+
isDisabled: m,
|
|
83
|
+
"aria-label": N,
|
|
84
|
+
variant: P.primary,
|
|
85
|
+
href: typeof n == "object" && n.href ? n.href : void 0,
|
|
86
|
+
prefetch: typeof n == "object" && n.prefetch ? n.prefetch : void 0,
|
|
87
|
+
children: /* @__PURE__ */ o(x, {})
|
|
82
88
|
}
|
|
83
89
|
)
|
|
84
90
|
]
|
|
@@ -86,5 +92,5 @@ const G = ({
|
|
|
86
92
|
);
|
|
87
93
|
};
|
|
88
94
|
export {
|
|
89
|
-
|
|
95
|
+
L as default
|
|
90
96
|
};
|
|
@@ -37,6 +37,7 @@ export declare const Playground: {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
+
export declare const PlaygroundWithHrefAndPrefetch: ({ playgroundWidth, onChange, ...args }: StoryProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
41
|
export declare const StringOptionsPlayground: {
|
|
41
42
|
({ playgroundWidth, onChange, ...args }: StoryProps): import("react/jsx-runtime").JSX.Element;
|
|
42
43
|
args: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../_virtual/
|
|
1
|
+
import { __module as e } from "../../../../_virtual/index6.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.js";
|
|
4
4
|
var r;
|