@phillips/seldon 1.124.1 → 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.
@@ -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 f, Fragment as k, jsx as o } from "react/jsx-runtime";
2
- import p from "../../node_modules/classnames/index.js";
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(
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: r = v.primary,
9
- children: s,
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] = P(!1);
20
+ const { className: e, ...c } = N(n, "Button"), [B, C] = y(!1);
20
21
  if (t) {
21
- const u = () => /* @__PURE__ */ f(k, { children: [
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__ */ f(k, { children: [
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: p(
33
+ className: f(
33
34
  `${e}`,
34
- `${e}--${r}`,
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: s
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: p(
58
+ className: f(
58
59
  `${e}`,
59
- `${e}--${r}`,
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: s
69
+ children: r
68
70
  }
69
71
  );
70
72
  }
71
73
  );
72
- j.displayName = "Button";
74
+ H.displayName = "Button";
73
75
  export {
74
- j as default
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 R, jsx as s } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import e from "../../node_modules/classnames/index.js";
4
- import { px as i, useNormalizedInputProps as g } from "../../utils/index.js";
5
- const k = o.forwardRef(
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: u,
9
- disabled: $,
10
- hideLabel: m,
8
+ defaultValue: $,
9
+ disabled: m,
10
+ hideLabel: c,
11
11
  id: a,
12
- inline: c,
13
- invalid: _,
14
- invalidText: b,
15
- labelText: h,
16
- onChange: f,
17
- onClick: v,
18
- placeholder: x,
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: w = "md",
21
- type: l = "text",
22
- value: I,
23
- warn: N,
24
- warnText: y,
25
- ...r
26
- }, j) => {
27
- const n = o.useId(), t = g({
28
- disabled: $,
29
- id: a || n,
30
- invalid: _,
31
- invalidText: b,
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: l,
34
- warn: N,
35
- warnText: y
36
- }), P = e(`${i}-${l}-input`, `${i}-input`, `${i}-input--${w}`, {
37
- [`${i}-input--inline`]: c,
38
- [`${i}-input--readonly`]: d,
39
- [`${i}-input--disabled`]: t.disabled,
40
- [`${i}-input--invalid`]: t.invalid,
41
- [`${i}-input--warn`]: t.warn,
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
- [`${i}-input--hidden`]: r.hidden
44
+ [`${t}-input--hidden`]: o.hidden
44
45
  });
45
- return /* @__PURE__ */ R("div", { className: P, children: [
46
+ return /* @__PURE__ */ k("div", { className: R, children: [
46
47
  /* @__PURE__ */ s(
47
48
  "label",
48
49
  {
49
- "data-testid": `label-${a || n}`,
50
- htmlFor: a || n,
51
- className: e(`${i}-input__label`, { [`${i}-input__label--hidden`]: m }),
52
- children: h
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: e(`${i}-input__input`, p),
62
+ className: n(`${t}-input__input`, p, {
63
+ [`${t}-skeleton`]: l
64
+ }),
59
65
  "data-testid": a,
60
- disabled: t.disabled,
61
- id: a || n,
62
- onChange: f,
63
- onClick: v,
64
- placeholder: x,
66
+ disabled: i.disabled,
67
+ id: a || e,
68
+ onChange: v,
69
+ onClick: x,
70
+ placeholder: l ? "" : w,
65
71
  readOnly: d,
66
- ref: j,
67
- type: t.type,
68
- ...t.type !== "checkbox" && t.type !== "radio" ? { value: I, defaultValue: u } : {},
69
- ...r
72
+ ref: P,
73
+ type: i.type,
74
+ ...i.type !== "checkbox" && i.type !== "radio" ? { value: N, defaultValue: $ } : {},
75
+ ...o
70
76
  }
71
77
  ),
72
- t.validation ? t.validation : /* @__PURE__ */ s("p", { className: e(`${i}-input__validation`), children: " " })
78
+ i.validation ? i.validation : /* @__PURE__ */ s("p", { className: n(`${t}-input__validation`), children: " " })
73
79
  ] });
74
80
  }
75
81
  );
76
- k.displayName = "Input";
82
+ C.displayName = "Input";
77
83
  export {
78
- k as default
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 c } from "react/jsx-runtime";
2
- import { getCommonProps as f } from "../../utils/index.js";
3
- import { TextVariants as p } from "./types.js";
4
- import { determineDefaultTextElement as x, determineTextClassName as i } from "./utils.js";
5
- import T from "../../node_modules/classnames/index.js";
6
- const P = ({
7
- children: s,
8
- className: r,
9
- element: a,
10
- variant: e = p.body2,
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 n = a || x(e), { className: o, ...l } = f(t, "Text");
15
- return /* @__PURE__ */ c(
16
- n,
15
+ const p = l || N(e), { className: o, ...x } = f(t, "Text");
16
+ return /* @__PURE__ */ s(
17
+ p,
17
18
  {
18
- ...l,
19
- className: T(o, r, i(e), {
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
- P as default
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
+ }
@@ -19,6 +19,7 @@ $lg: #{$px}-input--lg;
19
19
  color: $pure-black;
20
20
  font-variation-settings: 'wght' 600;
21
21
  margin-bottom: 0.5rem;
22
+ width: fit-content;
22
23
  word-break: break-word;
23
24
 
24
25
  &--hidden {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.124.1",
3
+ "version": "1.125.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"