@phillips/seldon 1.125.1 → 1.126.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.
|
@@ -1,77 +1,81 @@
|
|
|
1
|
-
import { jsxs as k, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import { ButtonVariants as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as k, Fragment as $, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import v from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { getCommonProps as b, px as P } from "../../utils/index.js";
|
|
4
|
+
import { ButtonVariants as j } from "./types.js";
|
|
5
|
+
import { forwardRef as y, useState as H } from "react";
|
|
6
|
+
const L = y(
|
|
7
7
|
({
|
|
8
|
-
variant: s =
|
|
9
|
-
children:
|
|
8
|
+
variant: s = j.primary,
|
|
9
|
+
children: l,
|
|
10
10
|
className: a,
|
|
11
|
-
isIconLast:
|
|
12
|
-
type:
|
|
13
|
-
isDisabled:
|
|
11
|
+
isIconLast: i = !1,
|
|
12
|
+
type: x = "button",
|
|
13
|
+
isDisabled: n = !1,
|
|
14
14
|
href: t,
|
|
15
|
-
target:
|
|
16
|
-
prefetch:
|
|
17
|
-
isSkeletonLoading:
|
|
18
|
-
...
|
|
19
|
-
},
|
|
20
|
-
const { className: e, ...c } =
|
|
15
|
+
target: m,
|
|
16
|
+
prefetch: d = "none",
|
|
17
|
+
isSkeletonLoading: B,
|
|
18
|
+
...r
|
|
19
|
+
}, u) => {
|
|
20
|
+
const { className: e, ...c } = b(r, "Button"), [C, N] = H(!1);
|
|
21
21
|
if (t) {
|
|
22
|
-
const
|
|
22
|
+
const f = () => /* @__PURE__ */ k($, { children: [
|
|
23
23
|
/* @__PURE__ */ o("link", { "data-testid": "prefetch-link", rel: "prefetch", href: t }),
|
|
24
24
|
/* @__PURE__ */ o("link", { "data-testid": "modulepreload-link", rel: "modulepreload", href: t })
|
|
25
25
|
] });
|
|
26
|
-
return /* @__PURE__ */ k(
|
|
26
|
+
return /* @__PURE__ */ k($, { children: [
|
|
27
27
|
/* @__PURE__ */ o(
|
|
28
28
|
"a",
|
|
29
29
|
{
|
|
30
30
|
...c,
|
|
31
|
-
ref:
|
|
31
|
+
ref: u,
|
|
32
32
|
href: t,
|
|
33
|
-
className:
|
|
33
|
+
className: v(
|
|
34
34
|
`${e}`,
|
|
35
35
|
`${e}--${s}`,
|
|
36
36
|
{
|
|
37
|
-
[`${e}--icon-last`]:
|
|
37
|
+
[`${e}--icon-last`]: i
|
|
38
38
|
},
|
|
39
39
|
a
|
|
40
40
|
),
|
|
41
|
-
target:
|
|
42
|
-
rel:
|
|
43
|
-
onMouseOver: () =>
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
target: m,
|
|
42
|
+
rel: m === "_blank" ? "noopener noreferrer" : void 0,
|
|
43
|
+
onMouseOver: () => {
|
|
44
|
+
n || N(!0);
|
|
45
|
+
},
|
|
46
|
+
onClick: (p) => {
|
|
47
|
+
n ? p.preventDefault() : r.onClick?.(p);
|
|
48
|
+
},
|
|
49
|
+
children: l
|
|
46
50
|
}
|
|
47
51
|
),
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
d === "intent" && C && /* @__PURE__ */ o(f, {}),
|
|
53
|
+
d === "render" && /* @__PURE__ */ o(f, {})
|
|
50
54
|
] });
|
|
51
55
|
} else
|
|
52
56
|
return /* @__PURE__ */ o(
|
|
53
57
|
"button",
|
|
54
58
|
{
|
|
55
59
|
...c,
|
|
56
|
-
ref:
|
|
57
|
-
type:
|
|
58
|
-
className:
|
|
60
|
+
ref: u,
|
|
61
|
+
type: x,
|
|
62
|
+
className: v(
|
|
59
63
|
`${e}`,
|
|
60
64
|
`${e}--${s}`,
|
|
61
65
|
{
|
|
62
|
-
[`${e}--icon-last`]:
|
|
63
|
-
[`${
|
|
66
|
+
[`${e}--icon-last`]: i,
|
|
67
|
+
[`${P}-skeleton`]: B
|
|
64
68
|
},
|
|
65
69
|
a
|
|
66
70
|
),
|
|
67
|
-
disabled:
|
|
68
|
-
...
|
|
69
|
-
children:
|
|
71
|
+
disabled: n,
|
|
72
|
+
...r,
|
|
73
|
+
children: l
|
|
70
74
|
}
|
|
71
75
|
);
|
|
72
76
|
}
|
|
73
77
|
);
|
|
74
|
-
|
|
78
|
+
L.displayName = "Button";
|
|
75
79
|
export {
|
|
76
|
-
|
|
80
|
+
L as default
|
|
77
81
|
};
|
|
@@ -1,90 +1,94 @@
|
|
|
1
|
-
import { jsxs as k, jsx as
|
|
1
|
+
import { jsxs as k, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as B } from "react";
|
|
3
|
-
import
|
|
4
|
-
import { getCommonProps as T, px as
|
|
3
|
+
import u from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { getCommonProps as T, px as b } from "../../utils/index.js";
|
|
5
5
|
import F from "../Select/Select.js";
|
|
6
6
|
import x from "../../assets/chevronRight.svg.js";
|
|
7
|
-
import
|
|
8
|
-
import { ButtonVariants as
|
|
9
|
-
import { determineOptionValue as
|
|
7
|
+
import $ from "../IconButton/IconButton.js";
|
|
8
|
+
import { ButtonVariants as y } from "../Button/types.js";
|
|
9
|
+
import { determineOptionValue as f, findOptionFromSelectString as M } from "./utils.js";
|
|
10
10
|
import { usePendingState as R } from "../../utils/hooks.js";
|
|
11
|
-
const
|
|
12
|
-
className:
|
|
13
|
-
onChange:
|
|
14
|
-
variant:
|
|
15
|
-
options:
|
|
11
|
+
const Q = ({
|
|
12
|
+
className: P,
|
|
13
|
+
onChange: _,
|
|
14
|
+
variant: S = "inline",
|
|
15
|
+
options: o = [],
|
|
16
16
|
value: g,
|
|
17
|
-
isDisabled:
|
|
18
|
-
previousLabel:
|
|
19
|
-
nextLabel:
|
|
17
|
+
isDisabled: c,
|
|
18
|
+
previousLabel: j = "Previous",
|
|
19
|
+
nextLabel: C = "Next",
|
|
20
20
|
selectLabel: v = "Select",
|
|
21
21
|
...s
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
w(
|
|
23
|
+
const N = "pagination", { className: a, ...O } = T(s, "Pagination"), { id: p } = s, { pendingState: I, setPendingState: w } = R(f(g)), l = I || g, d = (e, r) => {
|
|
24
|
+
const m = f(e);
|
|
25
|
+
w(m), _(m, r);
|
|
26
26
|
}, [t, n] = B(() => {
|
|
27
|
-
const e =
|
|
27
|
+
const e = o.findIndex((h) => f(h) === l) - 1, r = o.at(e) || "", m = (o.findIndex((h) => f(h) === l) + 1) % o.length, V = o[m];
|
|
28
28
|
return [r, V];
|
|
29
|
-
}, [
|
|
29
|
+
}, [o, l]);
|
|
30
30
|
return /* @__PURE__ */ k(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
|
-
className:
|
|
34
|
-
...
|
|
33
|
+
className: u(`${b}-${N}`, { [`${a}__wrapper`]: a }, P),
|
|
34
|
+
...O,
|
|
35
35
|
...s,
|
|
36
36
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
37
|
+
/* @__PURE__ */ i(
|
|
38
|
+
$,
|
|
39
39
|
{
|
|
40
|
-
className:
|
|
40
|
+
className: u(`${a}__button`, `${b}-left-arrow`, {
|
|
41
|
+
[`${a}__button--is-disabled`]: c
|
|
42
|
+
}),
|
|
41
43
|
onClick: (e) => {
|
|
42
44
|
typeof t == "object" && t.href && e.preventDefault(), d(t);
|
|
43
45
|
},
|
|
44
46
|
"data-testid": `${p}-previous-button`,
|
|
45
|
-
isDisabled:
|
|
46
|
-
"aria-label":
|
|
47
|
-
variant:
|
|
47
|
+
isDisabled: c,
|
|
48
|
+
"aria-label": j,
|
|
49
|
+
variant: y.primary,
|
|
48
50
|
href: typeof t == "object" && t.href ? t.href : void 0,
|
|
49
51
|
prefetch: typeof t == "object" && t.prefetch ? t.prefetch : void 0,
|
|
50
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ i(x, {})
|
|
51
53
|
}
|
|
52
54
|
),
|
|
53
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ i(
|
|
54
56
|
F,
|
|
55
57
|
{
|
|
56
|
-
className:
|
|
58
|
+
className: S === "inline" ? `${b}--inline-pagination` : void 0,
|
|
57
59
|
"aria-label": v,
|
|
58
|
-
value:
|
|
60
|
+
value: l,
|
|
59
61
|
onChange: (e) => {
|
|
60
|
-
const r = M(
|
|
62
|
+
const r = M(o, e?.currentTarget.value);
|
|
61
63
|
r && d(r, e);
|
|
62
64
|
},
|
|
63
65
|
"data-testid": `${p}-select-button`,
|
|
64
66
|
hideLabel: !0,
|
|
65
67
|
labelText: v,
|
|
66
|
-
disabled:
|
|
68
|
+
disabled: c,
|
|
67
69
|
showIcon: !1,
|
|
68
|
-
children:
|
|
69
|
-
const r =
|
|
70
|
-
return /* @__PURE__ */
|
|
70
|
+
children: o.map((e) => {
|
|
71
|
+
const r = f(e);
|
|
72
|
+
return /* @__PURE__ */ i("option", { value: r, children: typeof e == "string" || typeof e == "number" ? e : e.label }, r);
|
|
71
73
|
})
|
|
72
74
|
}
|
|
73
75
|
),
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
76
|
+
/* @__PURE__ */ i(
|
|
77
|
+
$,
|
|
76
78
|
{
|
|
77
|
-
className: `${
|
|
79
|
+
className: u(`${a}__button`, {
|
|
80
|
+
[`${a}__button--is-disabled`]: c
|
|
81
|
+
}),
|
|
78
82
|
onClick: (e) => {
|
|
79
83
|
typeof n == "object" && n.href && e.preventDefault(), d(n);
|
|
80
84
|
},
|
|
81
85
|
"data-testid": `${p}-next-button`,
|
|
82
|
-
isDisabled:
|
|
83
|
-
"aria-label":
|
|
84
|
-
variant:
|
|
86
|
+
isDisabled: c,
|
|
87
|
+
"aria-label": C,
|
|
88
|
+
variant: y.primary,
|
|
85
89
|
href: typeof n == "object" && n.href ? n.href : void 0,
|
|
86
90
|
prefetch: typeof n == "object" && n.prefetch ? n.prefetch : void 0,
|
|
87
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ i(x, {})
|
|
88
92
|
}
|
|
89
93
|
)
|
|
90
94
|
]
|
|
@@ -92,5 +96,5 @@ const L = ({
|
|
|
92
96
|
);
|
|
93
97
|
};
|
|
94
98
|
export {
|
|
95
|
-
|
|
99
|
+
Q as default
|
|
96
100
|
};
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
border: unset;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
&--is-disabled {
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
&:hover:not(:disabled) {
|
|
15
19
|
background-color: inherit;
|
|
16
20
|
|
|
@@ -27,28 +31,20 @@
|
|
|
27
31
|
|
|
28
32
|
appearance: none;
|
|
29
33
|
border: none;
|
|
34
|
+
border-bottom: 1px solid $pure-black;
|
|
35
|
+
border-radius: 0;
|
|
30
36
|
font-variation-settings: 'wght' 600;
|
|
31
|
-
line-height: 1.75rem;
|
|
32
37
|
margin-bottom: 0;
|
|
33
38
|
outline: none;
|
|
34
|
-
padding: 0 $spacing-
|
|
39
|
+
padding: 0 $spacing-micro $spacing-micro;
|
|
35
40
|
text-align: center;
|
|
36
41
|
text-align-last: center;
|
|
37
|
-
text-decoration: underline;
|
|
38
|
-
text-underline-offset: 6px;
|
|
39
|
-
|
|
40
|
-
@include isHeaderDesktop {
|
|
41
|
-
line-height: 2.5rem;
|
|
42
|
-
text-underline-offset: 10px;
|
|
43
|
-
}
|
|
44
42
|
|
|
45
43
|
&:disabled {
|
|
46
|
-
border:
|
|
44
|
+
border-color: transparent;
|
|
47
45
|
margin: auto;
|
|
48
46
|
max-height: 3.5rem;
|
|
49
47
|
max-width: 5rem;
|
|
50
|
-
padding: 0.5rem;
|
|
51
|
-
text-decoration: none;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
&:hover {
|