@phillips/seldon 1.124.0 → 1.125.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 +4 -0
- package/dist/components/Button/Button.js +22 -20
- package/dist/components/Button/Button.stories.d.ts +10 -0
- package/dist/components/Input/Input.d.ts +4 -0
- package/dist/components/Input/Input.js +61 -55
- package/dist/components/Text/Text.d.ts +5 -1
- package/dist/components/Text/Text.js +26 -17
- package/dist/components/Text/Text.stories.d.ts +26 -1
- package/dist/scss/_sharedClasses.scss +60 -0
- package/dist/scss/components/Drawer/_drawer.scss +5 -1
- package/dist/scss/components/Input/_input.scss +1 -0
- package/package.json +1 -1
|
@@ -36,6 +36,10 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement | HT
|
|
|
36
36
|
* prefetch the link
|
|
37
37
|
*/
|
|
38
38
|
prefetch?: 'none' | 'intent' | 'render' | 'viewport';
|
|
39
|
+
/**
|
|
40
|
+
* Boolean to specify whether we need to display skeleton loader
|
|
41
|
+
*/
|
|
42
|
+
isSkeletonLoading?: boolean;
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
* ## Overview
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as N } from "../../utils/index.js";
|
|
4
|
-
import { ButtonVariants as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as k, Fragment as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import f from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { getCommonProps as N, px as v } from "../../utils/index.js";
|
|
4
|
+
import { ButtonVariants as P } from "./types.js";
|
|
5
|
+
import { forwardRef as j, useState as y } from "react";
|
|
6
|
+
const H = j(
|
|
7
7
|
({
|
|
8
|
-
variant:
|
|
9
|
-
children:
|
|
8
|
+
variant: s = P.primary,
|
|
9
|
+
children: r,
|
|
10
10
|
className: a,
|
|
11
11
|
isIconLast: l = !1,
|
|
12
12
|
type: $ = "button",
|
|
@@ -14,24 +14,25 @@ const j = x(
|
|
|
14
14
|
href: t,
|
|
15
15
|
target: i,
|
|
16
16
|
prefetch: m = "none",
|
|
17
|
+
isSkeletonLoading: x,
|
|
17
18
|
...n
|
|
18
19
|
}, d) => {
|
|
19
|
-
const { className: e, ...c } = N(n, "Button"), [B, C] =
|
|
20
|
+
const { className: e, ...c } = N(n, "Button"), [B, C] = y(!1);
|
|
20
21
|
if (t) {
|
|
21
|
-
const u = () => /* @__PURE__ */
|
|
22
|
+
const u = () => /* @__PURE__ */ k(p, { children: [
|
|
22
23
|
/* @__PURE__ */ o("link", { "data-testid": "prefetch-link", rel: "prefetch", href: t }),
|
|
23
24
|
/* @__PURE__ */ o("link", { "data-testid": "modulepreload-link", rel: "modulepreload", href: t })
|
|
24
25
|
] });
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ k(p, { children: [
|
|
26
27
|
/* @__PURE__ */ o(
|
|
27
28
|
"a",
|
|
28
29
|
{
|
|
29
30
|
...c,
|
|
30
31
|
ref: d,
|
|
31
32
|
href: t,
|
|
32
|
-
className:
|
|
33
|
+
className: f(
|
|
33
34
|
`${e}`,
|
|
34
|
-
`${e}--${
|
|
35
|
+
`${e}--${s}`,
|
|
35
36
|
{
|
|
36
37
|
[`${e}--icon-last`]: l
|
|
37
38
|
},
|
|
@@ -41,7 +42,7 @@ const j = x(
|
|
|
41
42
|
rel: i === "_blank" ? "noopener noreferrer" : void 0,
|
|
42
43
|
onMouseOver: () => C(!0),
|
|
43
44
|
onClick: n.onClick,
|
|
44
|
-
children:
|
|
45
|
+
children: r
|
|
45
46
|
}
|
|
46
47
|
),
|
|
47
48
|
m === "intent" && B && /* @__PURE__ */ o(u, {}),
|
|
@@ -54,22 +55,23 @@ const j = x(
|
|
|
54
55
|
...c,
|
|
55
56
|
ref: d,
|
|
56
57
|
type: $,
|
|
57
|
-
className:
|
|
58
|
+
className: f(
|
|
58
59
|
`${e}`,
|
|
59
|
-
`${e}--${
|
|
60
|
+
`${e}--${s}`,
|
|
60
61
|
{
|
|
61
|
-
[`${e}--icon-last`]: l
|
|
62
|
+
[`${e}--icon-last`]: l,
|
|
63
|
+
[`${v}-skeleton`]: x
|
|
62
64
|
},
|
|
63
65
|
a
|
|
64
66
|
),
|
|
65
67
|
disabled: b,
|
|
66
68
|
...n,
|
|
67
|
-
children:
|
|
69
|
+
children: r
|
|
68
70
|
}
|
|
69
71
|
);
|
|
70
72
|
}
|
|
71
73
|
);
|
|
72
|
-
|
|
74
|
+
H.displayName = "Button";
|
|
73
75
|
export {
|
|
74
|
-
|
|
76
|
+
H as default
|
|
75
77
|
};
|
|
@@ -29,11 +29,21 @@ export declare const ButtonAsLinkWithPrefetch: {
|
|
|
29
29
|
args: {
|
|
30
30
|
variant: ButtonVariants;
|
|
31
31
|
size: string;
|
|
32
|
+
} | {
|
|
33
|
+
variant: ButtonVariants;
|
|
34
|
+
size: string;
|
|
32
35
|
};
|
|
33
36
|
};
|
|
37
|
+
export declare const ButtonWithSkeleton: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
38
|
export declare const Playground: {
|
|
35
39
|
args: {
|
|
36
40
|
children: string;
|
|
37
41
|
variant: ButtonVariants;
|
|
42
|
+
isSkeletonLoading: boolean;
|
|
43
|
+
};
|
|
44
|
+
argTypes: {
|
|
45
|
+
isSkeletonLoading: {
|
|
46
|
+
control: string;
|
|
47
|
+
};
|
|
38
48
|
};
|
|
39
49
|
};
|
|
@@ -74,6 +74,10 @@ export interface InputProps extends Omit<React.ComponentProps<'input'>, 'size'>
|
|
|
74
74
|
* Text that is displayed when the control is in warning state
|
|
75
75
|
*/
|
|
76
76
|
warnText?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Boolean to specify whether we need to display skeleton loader
|
|
79
|
+
*/
|
|
80
|
+
isSkeletonLoading?: boolean;
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
79
83
|
* ## Overview
|
|
@@ -1,79 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { px as
|
|
5
|
-
const
|
|
1
|
+
import { jsxs as k, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import n from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as t, useNormalizedInputProps as z } from "../../utils/index.js";
|
|
5
|
+
const C = u.forwardRef(
|
|
6
6
|
({
|
|
7
7
|
className: p,
|
|
8
|
-
defaultValue:
|
|
9
|
-
disabled:
|
|
10
|
-
hideLabel:
|
|
8
|
+
defaultValue: $,
|
|
9
|
+
disabled: m,
|
|
10
|
+
hideLabel: c,
|
|
11
11
|
id: a,
|
|
12
|
-
inline:
|
|
13
|
-
invalid:
|
|
14
|
-
invalidText:
|
|
15
|
-
labelText:
|
|
16
|
-
onChange:
|
|
17
|
-
onClick:
|
|
18
|
-
placeholder:
|
|
12
|
+
inline: _,
|
|
13
|
+
invalid: b,
|
|
14
|
+
invalidText: h,
|
|
15
|
+
labelText: f,
|
|
16
|
+
onChange: v,
|
|
17
|
+
onClick: x,
|
|
18
|
+
placeholder: w,
|
|
19
19
|
readOnly: d,
|
|
20
|
-
size:
|
|
21
|
-
type:
|
|
22
|
-
value:
|
|
23
|
-
warn:
|
|
24
|
-
warnText:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
size: I = "md",
|
|
21
|
+
type: r = "text",
|
|
22
|
+
value: N,
|
|
23
|
+
warn: y,
|
|
24
|
+
warnText: j,
|
|
25
|
+
isSkeletonLoading: l,
|
|
26
|
+
...o
|
|
27
|
+
}, P) => {
|
|
28
|
+
const e = u.useId(), i = z({
|
|
29
|
+
disabled: m,
|
|
30
|
+
id: a || e,
|
|
31
|
+
invalid: b,
|
|
32
|
+
invalidText: h,
|
|
32
33
|
readOnly: d,
|
|
33
|
-
type:
|
|
34
|
-
warn:
|
|
35
|
-
warnText:
|
|
36
|
-
}),
|
|
37
|
-
[`${
|
|
38
|
-
[`${
|
|
39
|
-
[`${
|
|
40
|
-
[`${
|
|
41
|
-
[`${
|
|
34
|
+
type: r,
|
|
35
|
+
warn: y,
|
|
36
|
+
warnText: j
|
|
37
|
+
}), R = n(`${t}-${r}-input`, `${t}-input`, `${t}-input--${I}`, {
|
|
38
|
+
[`${t}-input--inline`]: _,
|
|
39
|
+
[`${t}-input--readonly`]: d,
|
|
40
|
+
[`${t}-input--disabled`]: i.disabled,
|
|
41
|
+
[`${t}-input--invalid`]: i.invalid,
|
|
42
|
+
[`${t}-input--warn`]: i.warn,
|
|
42
43
|
[`${p}__wrapper`]: p,
|
|
43
|
-
[`${
|
|
44
|
+
[`${t}-input--hidden`]: o.hidden
|
|
44
45
|
});
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ k("div", { className: R, children: [
|
|
46
47
|
/* @__PURE__ */ s(
|
|
47
48
|
"label",
|
|
48
49
|
{
|
|
49
|
-
"data-testid": `label-${a ||
|
|
50
|
-
htmlFor: a ||
|
|
51
|
-
className:
|
|
52
|
-
|
|
50
|
+
"data-testid": `label-${a || e}`,
|
|
51
|
+
htmlFor: a || e,
|
|
52
|
+
className: n(`${t}-input__label`, {
|
|
53
|
+
[`${t}-input__label--hidden`]: c,
|
|
54
|
+
[`${t}-skeleton`]: l
|
|
55
|
+
}),
|
|
56
|
+
children: f
|
|
53
57
|
}
|
|
54
58
|
),
|
|
55
59
|
/* @__PURE__ */ s(
|
|
56
60
|
"input",
|
|
57
61
|
{
|
|
58
|
-
className:
|
|
62
|
+
className: n(`${t}-input__input`, p, {
|
|
63
|
+
[`${t}-skeleton`]: l
|
|
64
|
+
}),
|
|
59
65
|
"data-testid": a,
|
|
60
|
-
disabled:
|
|
61
|
-
id: a ||
|
|
62
|
-
onChange:
|
|
63
|
-
onClick:
|
|
64
|
-
placeholder:
|
|
66
|
+
disabled: i.disabled,
|
|
67
|
+
id: a || e,
|
|
68
|
+
onChange: v,
|
|
69
|
+
onClick: x,
|
|
70
|
+
placeholder: l ? "" : w,
|
|
65
71
|
readOnly: d,
|
|
66
|
-
ref:
|
|
67
|
-
type:
|
|
68
|
-
...
|
|
69
|
-
...
|
|
72
|
+
ref: P,
|
|
73
|
+
type: i.type,
|
|
74
|
+
...i.type !== "checkbox" && i.type !== "radio" ? { value: N, defaultValue: $ } : {},
|
|
75
|
+
...o
|
|
70
76
|
}
|
|
71
77
|
),
|
|
72
|
-
|
|
78
|
+
i.validation ? i.validation : /* @__PURE__ */ s("p", { className: n(`${t}-input__validation`), children: " " })
|
|
73
79
|
] });
|
|
74
80
|
}
|
|
75
81
|
);
|
|
76
|
-
|
|
82
|
+
C.displayName = "Input";
|
|
77
83
|
export {
|
|
78
|
-
|
|
84
|
+
C as default
|
|
79
85
|
};
|
|
@@ -13,6 +13,10 @@ export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
13
13
|
* The alignment of the text
|
|
14
14
|
*/
|
|
15
15
|
align?: TextAlignments;
|
|
16
|
+
/**
|
|
17
|
+
* Boolean to specify whether we need to display skeleton loader
|
|
18
|
+
*/
|
|
19
|
+
isSkeletonLoading?: boolean;
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* ## Overview
|
|
@@ -23,5 +27,5 @@ export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
23
27
|
*
|
|
24
28
|
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-text--overview)
|
|
25
29
|
*/
|
|
26
|
-
declare const Text: ({ children, className, element: CustomElement, variant, align, ...props }: TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare const Text: ({ children, className, element: CustomElement, variant, align, isSkeletonLoading, ...props }: TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
31
|
export default Text;
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { getCommonProps as f } from "../../utils/index.js";
|
|
3
|
-
import { TextVariants as
|
|
4
|
-
import { determineDefaultTextElement as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
children:
|
|
8
|
-
className:
|
|
9
|
-
element:
|
|
10
|
-
variant: e =
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { getCommonProps as f, px as i } from "../../utils/index.js";
|
|
3
|
+
import { TextVariants as d } from "./types.js";
|
|
4
|
+
import { determineDefaultTextElement as N, determineTextClassName as T } from "./utils.js";
|
|
5
|
+
import r from "../../node_modules/classnames/index.js";
|
|
6
|
+
const h = ({
|
|
7
|
+
children: a,
|
|
8
|
+
className: n,
|
|
9
|
+
element: l,
|
|
10
|
+
variant: e = d.body2,
|
|
11
11
|
align: m,
|
|
12
|
+
isSkeletonLoading: c,
|
|
12
13
|
...t
|
|
13
14
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
15
|
+
const p = l || N(e), { className: o, ...x } = f(t, "Text");
|
|
16
|
+
return /* @__PURE__ */ s(
|
|
17
|
+
p,
|
|
17
18
|
{
|
|
18
|
-
...
|
|
19
|
-
className:
|
|
19
|
+
...x,
|
|
20
|
+
className: r(o, n, T(e), {
|
|
20
21
|
[`${o}--${m}`]: !!m
|
|
21
22
|
}),
|
|
22
23
|
...t,
|
|
23
|
-
children: s
|
|
24
|
+
children: /* @__PURE__ */ s(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
className: r({
|
|
28
|
+
[`${i}-skeleton`]: c
|
|
29
|
+
}),
|
|
30
|
+
children: a
|
|
31
|
+
}
|
|
32
|
+
)
|
|
24
33
|
}
|
|
25
34
|
);
|
|
26
35
|
};
|
|
27
36
|
export {
|
|
28
|
-
|
|
37
|
+
h as default
|
|
29
38
|
};
|
|
@@ -2,7 +2,7 @@ import { TextProps } from './Text';
|
|
|
2
2
|
import { TextAlignments, TextVariants } from './types';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ children, className, element: CustomElement, variant, align, ...props }: TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
component: ({ children, className, element: CustomElement, variant, align, isSkeletonLoading, ...props }: TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
};
|
|
7
7
|
export default meta;
|
|
8
8
|
export declare const Playground: {
|
|
@@ -25,6 +25,31 @@ export declare const Playground: {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
+
export declare const TextWithSkeleton: {
|
|
29
|
+
(props: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
args: {
|
|
31
|
+
children: string;
|
|
32
|
+
variant: TextVariants;
|
|
33
|
+
isSkeletonLoading: boolean;
|
|
34
|
+
};
|
|
35
|
+
argTypes: {
|
|
36
|
+
variant: {
|
|
37
|
+
options: typeof TextVariants;
|
|
38
|
+
control: {
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
align: {
|
|
43
|
+
options: typeof TextAlignments;
|
|
44
|
+
control: {
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
isSkeletonLoading: {
|
|
49
|
+
control: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
28
53
|
export declare const SuperScript: {
|
|
29
54
|
(props: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
30
55
|
args: {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* stylelint-disable order/properties-alphabetical-order */
|
|
2
|
+
/* stylelint-disable declaration-empty-line-before */
|
|
1
3
|
@use './vars' as *;
|
|
2
4
|
@use './utils' as *;
|
|
3
5
|
|
|
@@ -9,3 +11,61 @@
|
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
}
|
|
14
|
+
|
|
15
|
+
.#{$px}-skeleton,
|
|
16
|
+
.#{$px}-skeleton::before,
|
|
17
|
+
.#{$px}-skeleton::after {
|
|
18
|
+
animation: skeleton-pulse 1s infinite alternate-reverse !important;
|
|
19
|
+
background-image: none !important;
|
|
20
|
+
background-clip: initial !important;
|
|
21
|
+
border-radius: 0.1875rem !important;
|
|
22
|
+
|
|
23
|
+
border-color: #0000 !important;
|
|
24
|
+
box-shadow: none !important;
|
|
25
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
26
|
+
-webkit-box-decoration-break: clone !important;
|
|
27
|
+
box-decoration-break: clone !important;
|
|
28
|
+
color: #0000 !important;
|
|
29
|
+
outline: none !important;
|
|
30
|
+
pointer-events: none !important;
|
|
31
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
32
|
+
-webkit-user-select: none !important;
|
|
33
|
+
user-select: none !important;
|
|
34
|
+
cursor: default !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
input[type='checkbox'].#{$px}-skeleton,
|
|
38
|
+
input[type='radio'].#{$px}-skeleton {
|
|
39
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
40
|
+
-webkit-appearance: none;
|
|
41
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
42
|
+
-moz-appearance: none;
|
|
43
|
+
appearance: none;
|
|
44
|
+
padding: 0 !important;
|
|
45
|
+
width: 13px !important;
|
|
46
|
+
height: 13px !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
button.#{$px}-skeleton {
|
|
50
|
+
border-radius: 6.25rem !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.#{$px}-toggle-input {
|
|
54
|
+
.#{$px}-skeleton::before,
|
|
55
|
+
.#{$px}-skeleton::after {
|
|
56
|
+
border-radius: 6.25rem !important;
|
|
57
|
+
}
|
|
58
|
+
.#{$px}-skeleton::after {
|
|
59
|
+
display: none !important;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes skeleton-pulse {
|
|
64
|
+
0% {
|
|
65
|
+
background-color: #0000000f;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
100% {
|
|
69
|
+
background-color: #0000001f;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
background-color: $white;
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
|
-
height:
|
|
8
|
+
height: 100dvh;
|
|
9
9
|
max-width: 600px;
|
|
10
10
|
padding: $padding-xl $padding-md $padding-md;
|
|
11
11
|
position: fixed;
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
max-width: 100%;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
@media (max-width: $breakpoint-md) {
|
|
26
|
+
padding-bottom: $padding-sm;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
&__overlay {
|
|
26
30
|
background-color: $overlay-black;
|
|
27
31
|
inset: 0;
|