@phillips/seldon 1.131.0 → 1.132.1
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/assets/icons.d.ts +1 -0
- package/dist/assets/menu.svg.js +5 -0
- package/dist/components/Carousel/Carousel.stories.d.ts +4 -0
- package/dist/components/Carousel/CarouselDots.d.ts +4 -0
- package/dist/components/Carousel/CarouselDots.js +24 -24
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/components/Input/Input.js +53 -53
- package/dist/components/Pagination/Pagination.js +13 -12
- package/dist/components/Select/Select.d.ts +4 -0
- package/dist/components/Select/Select.js +43 -43
- package/dist/components/TextArea/TextArea.d.ts +26 -0
- package/dist/components/TextArea/TextArea.js +43 -0
- package/dist/components/TextArea/TextArea.stories.d.ts +44 -0
- package/dist/components/TextArea/TextArea.test.d.ts +1 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +199 -195
- package/dist/patterns/Subscribe/Subscribe.d.ts +5 -1
- package/dist/patterns/Subscribe/Subscribe.js +47 -45
- package/dist/patterns/Subscribe/Subscribe.stories.d.ts +1 -1
- package/dist/scss/_vars.scss +3 -4
- package/dist/scss/componentStyles.scss +1 -0
- package/dist/scss/components/TextArea/_textArea.scss +67 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/assets/icons.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { default as Reddit } from './icon-footer-red.svg?react';
|
|
|
18
18
|
export { default as FooterWeChat } from './icon-footer-wechat.svg?react';
|
|
19
19
|
export { default as Instagram } from './instagram.svg?react';
|
|
20
20
|
export { default as Lock } from './lock.svg?react';
|
|
21
|
+
export { default as Menu } from './menu.svg?react';
|
|
21
22
|
export { default as Minus } from './minus.svg?react';
|
|
22
23
|
export { default as PhillipsLogo } from './PhillipsLogo.svg?react';
|
|
23
24
|
export { default as Plus } from './plus.svg?react';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const o = (t) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M2 8H22M2 16H22", stroke: "black", strokeWidth: 2 }));
|
|
3
|
+
export {
|
|
4
|
+
o as default
|
|
5
|
+
};
|
|
@@ -21,7 +21,9 @@ export declare const CarouselWithDots: {
|
|
|
21
21
|
(props: CarouselProps & CarouselDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
args: {
|
|
23
23
|
maxDots: number;
|
|
24
|
+
id: string;
|
|
24
25
|
} | {
|
|
26
|
+
id: string;
|
|
25
27
|
maxDots?: undefined;
|
|
26
28
|
};
|
|
27
29
|
argTypes: {};
|
|
@@ -30,6 +32,7 @@ export declare const CarouselWithDotsAndArrows: {
|
|
|
30
32
|
(props: CarouselProps & CarouselDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
31
33
|
args: {
|
|
32
34
|
maxDots: number;
|
|
35
|
+
id: string;
|
|
33
36
|
};
|
|
34
37
|
argTypes: {};
|
|
35
38
|
};
|
|
@@ -37,6 +40,7 @@ export declare const CarouselWithDotsOverflow: {
|
|
|
37
40
|
(props: CarouselProps & CarouselDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
38
41
|
args: {
|
|
39
42
|
maxDots: number;
|
|
43
|
+
id: string;
|
|
40
44
|
};
|
|
41
45
|
argTypes: {};
|
|
42
46
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import E from "../../node_modules/classnames/index.js";
|
|
3
|
-
import { forwardRef as G,
|
|
4
|
-
import { useCarousel as
|
|
5
|
-
import { getCommonProps as
|
|
6
|
-
import { CarouselDot as
|
|
7
|
-
const h = 10, C = 12,
|
|
8
|
-
({ className:
|
|
9
|
-
const { className: c, ...
|
|
10
|
-
Array.from({ length:
|
|
11
|
-
), r =
|
|
3
|
+
import { forwardRef as G, useState as S, useRef as L, useCallback as l, useEffect as M, useMemo as q } from "react";
|
|
4
|
+
import { useCarousel as z } from "./utils.js";
|
|
5
|
+
import { getCommonProps as A } from "../../utils/index.js";
|
|
6
|
+
import { CarouselDot as F } from "./CarouselDot.js";
|
|
7
|
+
const h = 10, C = 12, H = (h + C) / 2, J = G(
|
|
8
|
+
({ className: v, maxDots: g = 9, position: V = "inline", numberOfSlides: b = 0, id: I, ...D }, k) => {
|
|
9
|
+
const { className: c, ...y } = A({ id: I, ...D }, "CarouselDots"), { api: t, onSlideChange: a } = z(), [R, T] = S(0), [i, O] = S(
|
|
10
|
+
Array.from({ length: b }, (e, o) => o)
|
|
11
|
+
), r = L(null), [$, w] = S([]), N = l((e) => {
|
|
12
12
|
r.current && r.current.scrollTo?.({
|
|
13
|
-
left: e * (h + C) - r.current.offsetWidth / 2 +
|
|
13
|
+
left: e * (h + C) - r.current.offsetWidth / 2 + H,
|
|
14
14
|
// Center dot in container
|
|
15
15
|
behavior: "smooth"
|
|
16
16
|
});
|
|
@@ -23,36 +23,36 @@ const h = 10, C = 12, J = (h + C) / 2, K = G(
|
|
|
23
23
|
O(e.scrollSnapList());
|
|
24
24
|
}, []), n = l(
|
|
25
25
|
(e) => {
|
|
26
|
-
T(e.selectedScrollSnap()),
|
|
26
|
+
T(e.selectedScrollSnap()), N(e.selectedScrollSnap());
|
|
27
27
|
},
|
|
28
|
-
[
|
|
28
|
+
[N]
|
|
29
29
|
), u = l(
|
|
30
30
|
(e) => {
|
|
31
31
|
a?.(e.selectedScrollSnap());
|
|
32
32
|
},
|
|
33
33
|
[a]
|
|
34
34
|
);
|
|
35
|
-
|
|
35
|
+
M(() => {
|
|
36
36
|
if (t)
|
|
37
37
|
return f(t), n(t), t.on("reInit", f).on("reInit", n).on("select", n).on("settle", u), () => {
|
|
38
38
|
t.off("reInit", f).off("reInit", n).off("select", n).off("settle", u);
|
|
39
39
|
};
|
|
40
40
|
}, [t, f, n, u]);
|
|
41
|
-
const s =
|
|
41
|
+
const s = q(() => $.sort((e, o) => e - o), [$]);
|
|
42
42
|
return /* @__PURE__ */ m(
|
|
43
43
|
"div",
|
|
44
44
|
{
|
|
45
|
-
ref:
|
|
45
|
+
ref: k,
|
|
46
46
|
role: "group",
|
|
47
47
|
"aria-roledescription": "pagination",
|
|
48
48
|
"aria-label": "pagination",
|
|
49
|
-
className: E(`${c}`,
|
|
50
|
-
...
|
|
51
|
-
...
|
|
49
|
+
className: E(`${c}`, v, `${c}-${V}`),
|
|
50
|
+
...D,
|
|
51
|
+
...y,
|
|
52
52
|
children: /* @__PURE__ */ m("div", { className: `${c}-container`, children: /* @__PURE__ */ m(
|
|
53
53
|
"div",
|
|
54
54
|
{
|
|
55
|
-
style: { "--max-width": `${
|
|
55
|
+
style: { "--max-width": `${g * h + (g - 1) * C + 2}px` },
|
|
56
56
|
className: `${c}-container-inner`,
|
|
57
57
|
ref: r,
|
|
58
58
|
children: i.map((e, o) => {
|
|
@@ -64,17 +64,17 @@ const h = 10, C = 12, J = (h + C) / 2, K = G(
|
|
|
64
64
|
!(o >= i.length - 2 && s.includes(i.length - 1) && s.includes(i.length - 2))
|
|
65
65
|
);
|
|
66
66
|
return /* @__PURE__ */ m(
|
|
67
|
-
|
|
67
|
+
F,
|
|
68
68
|
{
|
|
69
69
|
onClick: () => P(o),
|
|
70
70
|
isSelected: W,
|
|
71
71
|
scrollableContainerRef: r,
|
|
72
72
|
onInViewChange: (j) => {
|
|
73
|
-
|
|
73
|
+
w(j ? (p) => [...p, o] : (p) => p.filter((B) => B !== o));
|
|
74
74
|
},
|
|
75
75
|
variant: _ ? "sm" : "md"
|
|
76
76
|
},
|
|
77
|
-
`${
|
|
77
|
+
`${I}-dot-${o}`
|
|
78
78
|
);
|
|
79
79
|
})
|
|
80
80
|
}
|
|
@@ -83,7 +83,7 @@ const h = 10, C = 12, J = (h + C) / 2, K = G(
|
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
|
-
|
|
86
|
+
J.displayName = "CarouselDots";
|
|
87
87
|
export {
|
|
88
|
-
|
|
88
|
+
J as default
|
|
89
89
|
};
|
|
@@ -19,9 +19,9 @@ export interface InputProps extends Omit<React.ComponentProps<'input'>, 'size'>
|
|
|
19
19
|
*/
|
|
20
20
|
hideLabel?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* A
|
|
22
|
+
* A unique `id` for the `<input>`
|
|
23
23
|
*/
|
|
24
|
-
id
|
|
24
|
+
id: string;
|
|
25
25
|
/**
|
|
26
26
|
* Boolean to dictate whether input is inline with the label or not. `true` to use the inline version.
|
|
27
27
|
*/
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as P, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
3
|
import n from "../../node_modules/classnames/index.js";
|
|
4
|
-
import { px as t, useNormalizedInputProps as
|
|
5
|
-
const
|
|
4
|
+
import { px as t, useNormalizedInputProps as k } from "../../utils/index.js";
|
|
5
|
+
const z = R.forwardRef(
|
|
6
6
|
({
|
|
7
7
|
className: p,
|
|
8
|
-
defaultValue:
|
|
9
|
-
disabled:
|
|
10
|
-
hideLabel:
|
|
8
|
+
defaultValue: o,
|
|
9
|
+
disabled: u,
|
|
10
|
+
hideLabel: $,
|
|
11
11
|
id: a,
|
|
12
|
-
inline:
|
|
13
|
-
invalid:
|
|
14
|
-
invalidText:
|
|
15
|
-
labelText:
|
|
16
|
-
onChange:
|
|
17
|
-
onClick:
|
|
18
|
-
placeholder:
|
|
19
|
-
readOnly:
|
|
20
|
-
size:
|
|
21
|
-
type:
|
|
22
|
-
value:
|
|
23
|
-
warn:
|
|
24
|
-
warnText:
|
|
12
|
+
inline: m,
|
|
13
|
+
invalid: c,
|
|
14
|
+
invalidText: _,
|
|
15
|
+
labelText: b,
|
|
16
|
+
onChange: h,
|
|
17
|
+
onClick: f,
|
|
18
|
+
placeholder: v,
|
|
19
|
+
readOnly: e,
|
|
20
|
+
size: x = "md",
|
|
21
|
+
type: s = "text",
|
|
22
|
+
value: w,
|
|
23
|
+
warn: N,
|
|
24
|
+
warnText: y,
|
|
25
25
|
isSkeletonLoading: l,
|
|
26
|
-
...
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
disabled:
|
|
30
|
-
id: a
|
|
31
|
-
invalid:
|
|
32
|
-
invalidText:
|
|
33
|
-
readOnly:
|
|
34
|
-
type:
|
|
35
|
-
warn:
|
|
36
|
-
warnText:
|
|
37
|
-
}),
|
|
38
|
-
[`${t}-input--inline`]:
|
|
39
|
-
[`${t}-input--readonly`]:
|
|
26
|
+
...r
|
|
27
|
+
}, I) => {
|
|
28
|
+
const i = k({
|
|
29
|
+
disabled: u,
|
|
30
|
+
id: a,
|
|
31
|
+
invalid: c,
|
|
32
|
+
invalidText: _,
|
|
33
|
+
readOnly: e,
|
|
34
|
+
type: s,
|
|
35
|
+
warn: N,
|
|
36
|
+
warnText: y
|
|
37
|
+
}), j = n(`${t}-${s}-input`, `${t}-input`, `${t}-input--${x}`, {
|
|
38
|
+
[`${t}-input--inline`]: m,
|
|
39
|
+
[`${t}-input--readonly`]: e,
|
|
40
40
|
[`${t}-input--disabled`]: i.disabled,
|
|
41
41
|
[`${t}-input--invalid`]: i.invalid,
|
|
42
42
|
[`${t}-input--warn`]: i.warn,
|
|
43
43
|
[`${p}__wrapper`]: p,
|
|
44
|
-
[`${t}-input--hidden`]:
|
|
44
|
+
[`${t}-input--hidden`]: r.hidden
|
|
45
45
|
});
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ P("div", { className: j, children: [
|
|
47
|
+
/* @__PURE__ */ d(
|
|
48
48
|
"label",
|
|
49
49
|
{
|
|
50
|
-
"data-testid": `label-${a
|
|
51
|
-
htmlFor: a
|
|
50
|
+
"data-testid": `label-${a}`,
|
|
51
|
+
htmlFor: a,
|
|
52
52
|
className: n(`${t}-input__label`, {
|
|
53
|
-
[`${t}-input__label--hidden`]:
|
|
53
|
+
[`${t}-input__label--hidden`]: $,
|
|
54
54
|
[`${t}-skeleton`]: l
|
|
55
55
|
}),
|
|
56
|
-
children:
|
|
56
|
+
children: b
|
|
57
57
|
}
|
|
58
58
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ d(
|
|
60
60
|
"input",
|
|
61
61
|
{
|
|
62
62
|
className: n(`${t}-input__input`, p, {
|
|
@@ -64,22 +64,22 @@ const C = u.forwardRef(
|
|
|
64
64
|
}),
|
|
65
65
|
"data-testid": a,
|
|
66
66
|
disabled: i.disabled,
|
|
67
|
-
id: a
|
|
68
|
-
onChange:
|
|
69
|
-
onClick:
|
|
70
|
-
placeholder: l ? "" :
|
|
71
|
-
readOnly:
|
|
72
|
-
ref:
|
|
67
|
+
id: a,
|
|
68
|
+
onChange: h,
|
|
69
|
+
onClick: f,
|
|
70
|
+
placeholder: l ? "" : v,
|
|
71
|
+
readOnly: e,
|
|
72
|
+
ref: I,
|
|
73
73
|
type: i.type,
|
|
74
|
-
...i.type !== "checkbox" && i.type !== "radio" ? { value:
|
|
75
|
-
...
|
|
74
|
+
...i.type !== "checkbox" && i.type !== "radio" ? { value: w, defaultValue: o } : {},
|
|
75
|
+
...r
|
|
76
76
|
}
|
|
77
77
|
),
|
|
78
|
-
i.validation ? i.validation : /* @__PURE__ */
|
|
78
|
+
i.validation ? i.validation : /* @__PURE__ */ d("p", { className: n(`${t}-input__validation`), children: " " })
|
|
79
79
|
] });
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
|
-
|
|
82
|
+
z.displayName = "Input";
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
z as default
|
|
85
85
|
};
|
|
@@ -18,21 +18,21 @@ const Q = ({
|
|
|
18
18
|
previousLabel: j = "Previous",
|
|
19
19
|
nextLabel: C = "Next",
|
|
20
20
|
selectLabel: v = "Select",
|
|
21
|
-
...
|
|
21
|
+
...d
|
|
22
22
|
}) => {
|
|
23
|
-
const N = "pagination", { className: a, ...O } = T(
|
|
23
|
+
const N = "pagination", { className: a, ...O } = T(d, "Pagination"), { id: l } = d, { pendingState: I, setPendingState: w } = R(f(g)), s = I || g, p = (e, r) => {
|
|
24
24
|
const m = f(e);
|
|
25
25
|
w(m), _(m, r);
|
|
26
26
|
}, [t, n] = B(() => {
|
|
27
|
-
const e = o.findIndex((h) => f(h) ===
|
|
27
|
+
const e = o.findIndex((h) => f(h) === s) - 1, r = o.at(e) || "", m = (o.findIndex((h) => f(h) === s) + 1) % o.length, V = o[m];
|
|
28
28
|
return [r, V];
|
|
29
|
-
}, [o,
|
|
29
|
+
}, [o, s]);
|
|
30
30
|
return /* @__PURE__ */ k(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
className: u(`${b}-${N}`, { [`${a}__wrapper`]: a }, P),
|
|
34
34
|
...O,
|
|
35
|
-
...
|
|
35
|
+
...d,
|
|
36
36
|
children: [
|
|
37
37
|
/* @__PURE__ */ i(
|
|
38
38
|
$,
|
|
@@ -41,9 +41,9 @@ const Q = ({
|
|
|
41
41
|
[`${a}__button--is-disabled`]: c
|
|
42
42
|
}),
|
|
43
43
|
onClick: (e) => {
|
|
44
|
-
typeof t == "object" && t.href && e.preventDefault(),
|
|
44
|
+
typeof t == "object" && t.href && e.preventDefault(), p(t);
|
|
45
45
|
},
|
|
46
|
-
"data-testid": `${
|
|
46
|
+
"data-testid": `${l}-previous-button`,
|
|
47
47
|
isDisabled: c,
|
|
48
48
|
"aria-label": j,
|
|
49
49
|
variant: y.primary,
|
|
@@ -57,16 +57,17 @@ const Q = ({
|
|
|
57
57
|
{
|
|
58
58
|
className: S === "inline" ? `${b}--inline-pagination` : void 0,
|
|
59
59
|
"aria-label": v,
|
|
60
|
-
value:
|
|
60
|
+
value: s,
|
|
61
61
|
onChange: (e) => {
|
|
62
62
|
const r = M(o, e?.currentTarget.value);
|
|
63
|
-
r &&
|
|
63
|
+
r && p(r, e);
|
|
64
64
|
},
|
|
65
|
-
"data-testid": `${
|
|
65
|
+
"data-testid": `${l}-select-button`,
|
|
66
66
|
hideLabel: !0,
|
|
67
67
|
labelText: v,
|
|
68
68
|
disabled: c,
|
|
69
69
|
showIcon: !1,
|
|
70
|
+
id: `${l}-select-button`,
|
|
70
71
|
children: o.map((e) => {
|
|
71
72
|
const r = f(e);
|
|
72
73
|
return /* @__PURE__ */ i("option", { value: r, children: typeof e == "string" || typeof e == "number" ? e : e.label }, r);
|
|
@@ -80,9 +81,9 @@ const Q = ({
|
|
|
80
81
|
[`${a}__button--is-disabled`]: c
|
|
81
82
|
}),
|
|
82
83
|
onClick: (e) => {
|
|
83
|
-
typeof n == "object" && n.href && e.preventDefault(),
|
|
84
|
+
typeof n == "object" && n.href && e.preventDefault(), p(n);
|
|
84
85
|
},
|
|
85
|
-
"data-testid": `${
|
|
86
|
+
"data-testid": `${l}-next-button`,
|
|
86
87
|
isDisabled: c,
|
|
87
88
|
"aria-label": C,
|
|
88
89
|
variant: y.primary,
|
|
@@ -7,6 +7,10 @@ export interface SelectProps extends Merge<InputProps, React.ComponentProps<'sel
|
|
|
7
7
|
* Option elements that are selectable
|
|
8
8
|
*/
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* A unique `id` for the `<Select>`
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
10
14
|
/**
|
|
11
15
|
* Determines if you want to show the icon
|
|
12
16
|
*/
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { jsxs as p, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as k from "react";
|
|
3
|
+
import n from "../../node_modules/classnames/index.js";
|
|
4
4
|
import { px as e, useNormalizedInputProps as z } from "../../utils/index.js";
|
|
5
5
|
import { SelectVariants as c } from "./types.js";
|
|
6
6
|
import D from "../../assets/chevronDown.svg.js";
|
|
7
|
-
const F =
|
|
7
|
+
const F = k.forwardRef(
|
|
8
8
|
({
|
|
9
|
-
children:
|
|
9
|
+
children: d,
|
|
10
10
|
className: i,
|
|
11
|
-
defaultValue:
|
|
12
|
-
disabled:
|
|
13
|
-
hideLabel:
|
|
11
|
+
defaultValue: m,
|
|
12
|
+
disabled: u,
|
|
13
|
+
hideLabel: $,
|
|
14
14
|
id: t,
|
|
15
15
|
showIcon: l = !0,
|
|
16
|
-
variant:
|
|
17
|
-
inline:
|
|
18
|
-
invalid:
|
|
19
|
-
invalidText:
|
|
20
|
-
labelText:
|
|
21
|
-
onChange:
|
|
16
|
+
variant: _ = c.default,
|
|
17
|
+
inline: f,
|
|
18
|
+
invalid: b,
|
|
19
|
+
invalidText: v,
|
|
20
|
+
labelText: h,
|
|
21
|
+
onChange: w,
|
|
22
22
|
onClick: V,
|
|
23
23
|
readOnly: r,
|
|
24
|
-
size:
|
|
25
|
-
value:
|
|
26
|
-
warn:
|
|
27
|
-
warnText:
|
|
28
|
-
...
|
|
24
|
+
size: C = "md",
|
|
25
|
+
value: x,
|
|
26
|
+
warn: y,
|
|
27
|
+
warnText: N,
|
|
28
|
+
...S
|
|
29
29
|
}, j) => {
|
|
30
|
-
const o = "select",
|
|
31
|
-
disabled:
|
|
32
|
-
id: t
|
|
33
|
-
invalid:
|
|
34
|
-
invalidText:
|
|
30
|
+
const o = "select", a = z({
|
|
31
|
+
disabled: u,
|
|
32
|
+
id: t,
|
|
33
|
+
invalid: b,
|
|
34
|
+
invalidText: v,
|
|
35
35
|
readOnly: r,
|
|
36
36
|
type: o,
|
|
37
|
-
warn:
|
|
38
|
-
warnText:
|
|
39
|
-
}), P =
|
|
40
|
-
[`${e}-input--inline`]:
|
|
37
|
+
warn: y,
|
|
38
|
+
warnText: N
|
|
39
|
+
}), P = n(`${e}-${o}-input`, `${e}-input`, `${e}-input--${C}`, {
|
|
40
|
+
[`${e}-input--inline`]: f,
|
|
41
41
|
[`${e}-input--readonly`]: r,
|
|
42
|
-
[`${e}-input--disabled`]:
|
|
43
|
-
[`${e}-input--invalid`]:
|
|
44
|
-
[`${e}-input--warn`]:
|
|
42
|
+
[`${e}-input--disabled`]: a.disabled,
|
|
43
|
+
[`${e}-input--invalid`]: a.invalid,
|
|
44
|
+
[`${e}-input--warn`]: a.warn,
|
|
45
45
|
[`${i}__wrapper`]: i
|
|
46
|
-
}), R =
|
|
47
|
-
[`${e}-input__select--tertiary`]:
|
|
48
|
-
}),
|
|
46
|
+
}), R = n(i, `${e}-input__input`, {
|
|
47
|
+
[`${e}-input__select--tertiary`]: _ === c.tertiary
|
|
48
|
+
}), g = n(`${e}-select-container`, {
|
|
49
49
|
[`${e}-select-container--show__icon`]: l
|
|
50
50
|
});
|
|
51
51
|
return /* @__PURE__ */ p("div", { className: P, children: [
|
|
@@ -54,29 +54,29 @@ const F = d.forwardRef(
|
|
|
54
54
|
{
|
|
55
55
|
"data-testid": `${t}-label`,
|
|
56
56
|
htmlFor: t,
|
|
57
|
-
className:
|
|
58
|
-
children:
|
|
57
|
+
className: n(`${e}-input__label`, { [`${e}-input__label--hidden`]: $ }),
|
|
58
|
+
children: h
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
/* @__PURE__ */ p("div", { className:
|
|
61
|
+
/* @__PURE__ */ p("div", { className: g, children: [
|
|
62
62
|
/* @__PURE__ */ s(
|
|
63
63
|
"select",
|
|
64
64
|
{
|
|
65
65
|
className: R,
|
|
66
66
|
"data-testid": t,
|
|
67
|
-
defaultValue:
|
|
68
|
-
disabled:
|
|
67
|
+
defaultValue: m,
|
|
68
|
+
disabled: a.disabled,
|
|
69
69
|
id: t,
|
|
70
|
-
onChange:
|
|
70
|
+
onChange: w,
|
|
71
71
|
ref: j,
|
|
72
|
-
value:
|
|
73
|
-
...
|
|
74
|
-
children:
|
|
72
|
+
value: x,
|
|
73
|
+
...S,
|
|
74
|
+
children: d
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
77
|
l ? /* @__PURE__ */ s(D, {}) : null
|
|
78
78
|
] }),
|
|
79
|
-
|
|
79
|
+
a.validation
|
|
80
80
|
] });
|
|
81
81
|
}
|
|
82
82
|
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
export interface TextAreaProps extends ComponentProps<'textarea'> {
|
|
3
|
+
/**
|
|
4
|
+
* Optional classnane
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Boolean to specify whether we need to display skeleton loader
|
|
9
|
+
*/
|
|
10
|
+
isSkeletonLoading?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Text that will be read by a screen reader when visiting this control
|
|
13
|
+
*/
|
|
14
|
+
labelText: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* ## Overview
|
|
18
|
+
*
|
|
19
|
+
* Overview of this widget
|
|
20
|
+
*
|
|
21
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=11973-9589&m=dev)
|
|
22
|
+
*
|
|
23
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-textarea--overview)
|
|
24
|
+
*/
|
|
25
|
+
declare const TextArea: import('react').ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
26
|
+
export default TextArea;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as $, useId as u } from "react";
|
|
3
|
+
import l from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as r } from "../../utils/index.js";
|
|
5
|
+
import N from "../../assets/menu.svg.js";
|
|
6
|
+
const _ = $(
|
|
7
|
+
({ className: o, id: e, isSkeletonLoading: m, labelText: i, maxLength: n = 3e3, name: c, rows: d = 2, ...p }, x) => {
|
|
8
|
+
const s = `${r}-text-area`, a = u();
|
|
9
|
+
return /* @__PURE__ */ f("div", { className: l(`${s}__wrapper`), children: [
|
|
10
|
+
/* @__PURE__ */ t(
|
|
11
|
+
"label",
|
|
12
|
+
{
|
|
13
|
+
"data-testid": `text-area-${e ?? a}-label`,
|
|
14
|
+
htmlFor: e ?? a,
|
|
15
|
+
className: l(`${r}-input__label`, {
|
|
16
|
+
[`${r}-skeleton`]: m
|
|
17
|
+
}),
|
|
18
|
+
children: i
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ t(
|
|
22
|
+
"textarea",
|
|
23
|
+
{
|
|
24
|
+
...p,
|
|
25
|
+
className: l(s, o, {
|
|
26
|
+
[`${r}-skeleton`]: m
|
|
27
|
+
}),
|
|
28
|
+
id: e ?? a,
|
|
29
|
+
rows: d,
|
|
30
|
+
maxLength: n,
|
|
31
|
+
name: c,
|
|
32
|
+
ref: x,
|
|
33
|
+
"data-testid": `text-area-${e ?? a}-input`
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ t("div", { className: `${s}-resizer__icon`, children: /* @__PURE__ */ t(N, {}) })
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
_.displayName = "TextArea";
|
|
41
|
+
export {
|
|
42
|
+
_ as default
|
|
43
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TextAreaProps } from './TextArea';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
export declare const Playground: {
|
|
8
|
+
(props: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
args: {
|
|
10
|
+
children: string;
|
|
11
|
+
labelText: string;
|
|
12
|
+
rows: number;
|
|
13
|
+
isSkeletonLoading: boolean;
|
|
14
|
+
name: string;
|
|
15
|
+
maxLength: number;
|
|
16
|
+
};
|
|
17
|
+
argTypes: {
|
|
18
|
+
labelText: {
|
|
19
|
+
control: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
rows: {
|
|
24
|
+
control: {
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
isSkeletonLoading: {
|
|
29
|
+
control: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
maxLength: {
|
|
34
|
+
control: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
name: {
|
|
39
|
+
control: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextArea, type TextAreaProps } from './TextArea';
|
package/dist/index.d.ts
CHANGED