@fluidattacks/design 9.3.3 → 9.5.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/drawer/index.d.ts +1 -1
- package/dist/components/drawer/index.js +128 -95
- package/dist/components/drawer/types.d.ts +2 -0
- package/dist/components/inputs/fields/combobox/option/index.js +26 -25
- package/dist/components/inputs/fields/text-input/index.d.ts +1 -1
- package/dist/components/inputs/fields/text-input/index.js +80 -69
- package/dist/components/inputs/outline-container/index.d.ts +1 -1
- package/dist/components/inputs/outline-container/index.js +62 -50
- package/dist/components/inputs/styles.js +16 -8
- package/dist/components/inputs/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { IDrawerProps } from './types';
|
|
3
|
-
declare const Drawer: ({ _containerId, _portal, actions, children, dismissable, footer, footerMessage, header, id, modalRef, side, size, tabs, title, titleIcon, titleTag, onClose, }: Readonly<PropsWithChildren<IDrawerProps>>) => JSX.Element | null;
|
|
3
|
+
declare const Drawer: ({ _containerId, _portal, actions, children, dismissable, footer, footerMessage, header, id, modalRef, side, size, subtitle, tabs, title, titleIcon, titleTag, onClose, }: Readonly<PropsWithChildren<IDrawerProps>>) => JSX.Element | null;
|
|
4
4
|
export { Drawer };
|
|
5
5
|
export type { IDrawerProps } from './types';
|
|
@@ -1,85 +1,86 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { DrawerWrapper as
|
|
6
|
-
import { Button as
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as u, useEffect as O } from "react";
|
|
3
|
+
import { createPortal as L } from "react-dom";
|
|
4
|
+
import { useTheme as P } from "styled-components";
|
|
5
|
+
import { DrawerWrapper as K, DrawerPanel as q, DrawerBody as A } from "./styles.js";
|
|
6
|
+
import { Button as F } from "../button/index.js";
|
|
7
7
|
import { Container as i } from "../container/index.js";
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { IconButton as
|
|
10
|
-
import { Tabs as
|
|
8
|
+
import { Icon as G } from "../icon/index.js";
|
|
9
|
+
import { IconButton as $ } from "../icon-button/index.js";
|
|
10
|
+
import { Tabs as H } from "../tabs/index.js";
|
|
11
11
|
import "../typography/heading/index.js";
|
|
12
12
|
import "../typography/span/index.js";
|
|
13
|
-
import { Text as
|
|
13
|
+
import { Text as k } from "../typography/text/index.js";
|
|
14
14
|
const re = ({
|
|
15
|
-
_containerId:
|
|
16
|
-
_portal:
|
|
17
|
-
actions:
|
|
18
|
-
children:
|
|
19
|
-
dismissable:
|
|
15
|
+
_containerId: C = "portals",
|
|
16
|
+
_portal: T = !0,
|
|
17
|
+
actions: D = void 0,
|
|
18
|
+
children: S = void 0,
|
|
19
|
+
dismissable: a = !0,
|
|
20
20
|
footer: m = void 0,
|
|
21
21
|
footerMessage: h = void 0,
|
|
22
|
-
header:
|
|
23
|
-
id:
|
|
24
|
-
modalRef:
|
|
25
|
-
side:
|
|
26
|
-
size:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
header: W = void 0,
|
|
23
|
+
id: d = "drawer-container",
|
|
24
|
+
modalRef: l,
|
|
25
|
+
side: f = "right",
|
|
26
|
+
size: z = "md",
|
|
27
|
+
subtitle: y = void 0,
|
|
28
|
+
tabs: g = void 0,
|
|
29
|
+
title: B,
|
|
30
|
+
titleIcon: v = void 0,
|
|
31
|
+
titleTag: I = void 0,
|
|
32
|
+
onClose: w = void 0
|
|
32
33
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
}, [
|
|
34
|
+
const o = P(), p = u(() => {
|
|
35
|
+
l.close(), w?.();
|
|
36
|
+
}, [l, w]), b = u(
|
|
36
37
|
(r) => {
|
|
37
|
-
|
|
38
|
+
a && r.target === r.currentTarget && p();
|
|
38
39
|
},
|
|
39
|
-
[
|
|
40
|
+
[a, p]
|
|
40
41
|
);
|
|
41
|
-
|
|
42
|
-
if (!
|
|
42
|
+
O(() => {
|
|
43
|
+
if (!a || !l.isOpen)
|
|
43
44
|
return () => {
|
|
44
45
|
};
|
|
45
|
-
const r = (
|
|
46
|
-
|
|
46
|
+
const r = (n) => {
|
|
47
|
+
n.key === "Escape" && p();
|
|
47
48
|
};
|
|
48
49
|
return window.addEventListener("keydown", r), () => {
|
|
49
50
|
window.removeEventListener("keydown", r);
|
|
50
51
|
};
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
}, [a, p, l.isOpen]);
|
|
53
|
+
const x = /* @__PURE__ */ e(
|
|
54
|
+
K,
|
|
54
55
|
{
|
|
55
|
-
$side:
|
|
56
|
-
id: `${
|
|
57
|
-
onClick:
|
|
56
|
+
$side: f,
|
|
57
|
+
id: `${d}-wrapper`,
|
|
58
|
+
onClick: b,
|
|
58
59
|
role: "presentation",
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
|
|
60
|
+
children: /* @__PURE__ */ t(
|
|
61
|
+
q,
|
|
61
62
|
{
|
|
62
|
-
$side:
|
|
63
|
-
$size:
|
|
64
|
-
"aria-label":
|
|
63
|
+
$side: f,
|
|
64
|
+
$size: z,
|
|
65
|
+
"aria-label": l.name,
|
|
65
66
|
"aria-modal": "true",
|
|
66
|
-
"data-testid":
|
|
67
|
-
id:
|
|
67
|
+
"data-testid": d,
|
|
68
|
+
id: d,
|
|
68
69
|
role: "dialog",
|
|
69
70
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ t(
|
|
71
72
|
i,
|
|
72
73
|
{
|
|
73
74
|
alignItems: "flex-start",
|
|
74
75
|
alignSelf: "stretch",
|
|
75
|
-
borderBottom: `1px solid ${
|
|
76
|
+
borderBottom: `1px solid ${o.palette.gray[300]}`,
|
|
76
77
|
display: "flex",
|
|
77
78
|
gap: 0.25,
|
|
78
79
|
justify: "space-between",
|
|
79
80
|
px: 1.25,
|
|
80
81
|
py: 1,
|
|
81
82
|
children: [
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ t(
|
|
83
84
|
i,
|
|
84
85
|
{
|
|
85
86
|
display: "flex",
|
|
@@ -87,7 +88,7 @@ const re = ({
|
|
|
87
88
|
gap: 0.25,
|
|
88
89
|
minWidth: "0",
|
|
89
90
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ t(
|
|
91
92
|
i,
|
|
92
93
|
{
|
|
93
94
|
alignItems: "center",
|
|
@@ -95,11 +96,11 @@ const re = ({
|
|
|
95
96
|
gap: 0.5,
|
|
96
97
|
minWidth: "0",
|
|
97
98
|
children: [
|
|
98
|
-
|
|
99
|
+
v === void 0 ? void 0 : /* @__PURE__ */ e(
|
|
99
100
|
i,
|
|
100
101
|
{
|
|
101
102
|
alignItems: "center",
|
|
102
|
-
bgColor:
|
|
103
|
+
bgColor: o.palette.gray[100],
|
|
103
104
|
borderRadius: "4px",
|
|
104
105
|
display: "flex",
|
|
105
106
|
height: "2rem",
|
|
@@ -107,71 +108,103 @@ const re = ({
|
|
|
107
108
|
minWidth: "2rem",
|
|
108
109
|
width: "2rem",
|
|
109
110
|
children: /* @__PURE__ */ e(
|
|
110
|
-
|
|
111
|
+
G,
|
|
111
112
|
{
|
|
112
|
-
icon:
|
|
113
|
-
iconColor:
|
|
113
|
+
icon: v,
|
|
114
|
+
iconColor: o.palette.gray[700],
|
|
114
115
|
iconSize: "md",
|
|
115
116
|
iconType: "fa-solid"
|
|
116
117
|
}
|
|
117
118
|
)
|
|
118
119
|
}
|
|
119
120
|
),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
121
|
+
/* @__PURE__ */ t(
|
|
122
|
+
i,
|
|
122
123
|
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
display: "flex",
|
|
125
|
+
flexDirection: "column",
|
|
126
|
+
minWidth: "0",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ t(
|
|
129
|
+
i,
|
|
130
|
+
{
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
display: "flex",
|
|
133
|
+
gap: 0.5,
|
|
134
|
+
minWidth: "0",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ e(
|
|
137
|
+
k,
|
|
138
|
+
{
|
|
139
|
+
color: o.palette.gray[800],
|
|
140
|
+
display: "inline-block",
|
|
141
|
+
fontWeight: "bold",
|
|
142
|
+
overflow: "hidden",
|
|
143
|
+
size: "lg",
|
|
144
|
+
textOverflow: "ellipsis",
|
|
145
|
+
whiteSpace: "nowrap",
|
|
146
|
+
children: B
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
I
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
y === void 0 ? void 0 : /* @__PURE__ */ e(
|
|
154
|
+
k,
|
|
155
|
+
{
|
|
156
|
+
color: o.palette.gray[400],
|
|
157
|
+
overflow: "hidden",
|
|
158
|
+
size: "md",
|
|
159
|
+
textOverflow: "ellipsis",
|
|
160
|
+
whiteSpace: "nowrap",
|
|
161
|
+
children: y
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
]
|
|
131
165
|
}
|
|
132
|
-
)
|
|
133
|
-
S
|
|
166
|
+
)
|
|
134
167
|
]
|
|
135
168
|
}
|
|
136
169
|
),
|
|
137
|
-
|
|
170
|
+
W
|
|
138
171
|
]
|
|
139
172
|
}
|
|
140
173
|
),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
|
|
174
|
+
/* @__PURE__ */ t(i, { display: "flex", gap: 0.25, children: [
|
|
175
|
+
D?.map(
|
|
143
176
|
({
|
|
144
177
|
disabled: r,
|
|
145
|
-
icon:
|
|
178
|
+
icon: n,
|
|
146
179
|
iconColor: s,
|
|
147
180
|
shadow: c,
|
|
148
|
-
tooltip:
|
|
181
|
+
tooltip: j,
|
|
149
182
|
onClick: E
|
|
150
183
|
}) => /* @__PURE__ */ e(
|
|
151
|
-
|
|
184
|
+
$,
|
|
152
185
|
{
|
|
153
186
|
disabled: r,
|
|
154
|
-
icon:
|
|
155
|
-
iconColor: s ??
|
|
187
|
+
icon: n ?? "paper-plane",
|
|
188
|
+
iconColor: s ?? o.palette.gray[400],
|
|
156
189
|
iconSize: "sm",
|
|
157
190
|
iconType: "fa-light",
|
|
158
191
|
onClick: E,
|
|
159
192
|
shadow: c,
|
|
160
|
-
tooltip:
|
|
193
|
+
tooltip: j,
|
|
161
194
|
variant: "ghost"
|
|
162
195
|
},
|
|
163
|
-
`${
|
|
196
|
+
`${d}-${n}`
|
|
164
197
|
)
|
|
165
198
|
),
|
|
166
|
-
|
|
167
|
-
|
|
199
|
+
a ? /* @__PURE__ */ e(
|
|
200
|
+
$,
|
|
168
201
|
{
|
|
169
202
|
icon: "xmark",
|
|
170
|
-
iconColor:
|
|
203
|
+
iconColor: o.palette.gray[400],
|
|
171
204
|
iconSize: "sm",
|
|
172
205
|
iconType: "fa-light",
|
|
173
|
-
id: `${
|
|
174
|
-
onClick:
|
|
206
|
+
id: `${d}-close`,
|
|
207
|
+
onClick: p,
|
|
175
208
|
variant: "ghost"
|
|
176
209
|
}
|
|
177
210
|
) : void 0
|
|
@@ -179,13 +212,13 @@ const re = ({
|
|
|
179
212
|
]
|
|
180
213
|
}
|
|
181
214
|
),
|
|
182
|
-
|
|
183
|
-
/* @__PURE__ */ e(
|
|
184
|
-
m || h ? /* @__PURE__ */
|
|
215
|
+
g ? /* @__PURE__ */ e(i, { display: "flex", pt: 0.25, width: "100%", children: /* @__PURE__ */ e(H, { items: g }) }) : void 0,
|
|
216
|
+
/* @__PURE__ */ e(A, { children: S }),
|
|
217
|
+
m || h ? /* @__PURE__ */ t(
|
|
185
218
|
i,
|
|
186
219
|
{
|
|
187
220
|
alignSelf: "stretch",
|
|
188
|
-
borderTop: `1px solid ${
|
|
221
|
+
borderTop: `1px solid ${o.palette.gray[300]}`,
|
|
189
222
|
display: "flex",
|
|
190
223
|
flexDirection: "column",
|
|
191
224
|
gap: 0.75,
|
|
@@ -200,16 +233,16 @@ const re = ({
|
|
|
200
233
|
gap: 0.5,
|
|
201
234
|
justify: "end",
|
|
202
235
|
width: "100%",
|
|
203
|
-
children: m.map(({ icon: r, text:
|
|
204
|
-
|
|
236
|
+
children: m.map(({ icon: r, text: n, onClick: s }, c) => /* @__PURE__ */ e(
|
|
237
|
+
F,
|
|
205
238
|
{
|
|
206
239
|
icon: r,
|
|
207
240
|
onClick: s,
|
|
208
241
|
variant: c === 0 ? "primary" : "tertiary",
|
|
209
242
|
width: "100%",
|
|
210
|
-
children:
|
|
243
|
+
children: n
|
|
211
244
|
},
|
|
212
|
-
`${c}-${
|
|
245
|
+
`${c}-${n}`
|
|
213
246
|
))
|
|
214
247
|
}
|
|
215
248
|
) : void 0
|
|
@@ -221,10 +254,10 @@ const re = ({
|
|
|
221
254
|
)
|
|
222
255
|
}
|
|
223
256
|
);
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
document.getElementById(
|
|
227
|
-
) :
|
|
257
|
+
return l.isOpen ? T ? L(
|
|
258
|
+
x,
|
|
259
|
+
document.getElementById(C) ?? document.body
|
|
260
|
+
) : x : null;
|
|
228
261
|
};
|
|
229
262
|
export {
|
|
230
263
|
re as Drawer
|
|
@@ -46,6 +46,7 @@ interface IDrawerButtonProps extends Partial<IIconModifiable> {
|
|
|
46
46
|
* @property { IUseModal } modalRef - The drawer reference.
|
|
47
47
|
* @property { TDrawerSide } [side] - Viewport edge the drawer docks to.
|
|
48
48
|
* @property { TDrawerSize } [size] - The size of the drawer.
|
|
49
|
+
* @property { string } [subtitle] - Text shown under the title, beside the title icon.
|
|
49
50
|
* @property { ITabProps[] } [tabs] - The tab items.
|
|
50
51
|
* @property { string } title - The title of the drawer.
|
|
51
52
|
* @property { IIconModifiable["icon"] } [titleIcon] - Icon shown beside the title.
|
|
@@ -64,6 +65,7 @@ interface IDrawerProps {
|
|
|
64
65
|
modalRef: IUseModal;
|
|
65
66
|
side?: TDrawerSide;
|
|
66
67
|
size?: TDrawerSize;
|
|
68
|
+
subtitle?: string;
|
|
67
69
|
tabs?: ITabProps[];
|
|
68
70
|
title: string;
|
|
69
71
|
titleIcon?: IIconModifiable["icon"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as l, jsxs as G } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as H, useMemo as
|
|
2
|
+
import { useRef as H, useMemo as k, useCallback as f } from "react";
|
|
3
3
|
import { useOption as J } from "../../../../../node_modules/react-aria/dist/private/listbox/useOption.js";
|
|
4
4
|
import { useTheme as Q } from "styled-components";
|
|
5
5
|
import { StyledOption as W } from "../styles.js";
|
|
@@ -13,7 +13,7 @@ import "../../../../typography/span/index.js";
|
|
|
13
13
|
import { Text as I } from "../../../../typography/text/index.js";
|
|
14
14
|
import { useClickOutside as V } from "../../../../../hooks/use-click-outside.js";
|
|
15
15
|
import { openUrl as oo } from "../../../../../utils/open-url.js";
|
|
16
|
-
const
|
|
16
|
+
const $o = ({
|
|
17
17
|
allItemKeys: a,
|
|
18
18
|
containerRef: D,
|
|
19
19
|
item: o,
|
|
@@ -23,52 +23,52 @@ const Co = ({
|
|
|
23
23
|
setInputValue: i,
|
|
24
24
|
setValue: n,
|
|
25
25
|
state: c,
|
|
26
|
-
tag:
|
|
26
|
+
tag: $,
|
|
27
27
|
watch: h
|
|
28
28
|
}) => {
|
|
29
|
-
const z = Q(), y = H(null), d = o.props.hrefLang, g = c.disabledKeys,
|
|
29
|
+
const z = Q(), y = H(null), d = o.props.hrefLang, g = c.disabledKeys, C = a.filter(
|
|
30
30
|
(r) => !Array.from(g).includes(r) && r !== "All"
|
|
31
|
-
), { optionProps: F, isSelected:
|
|
31
|
+
), { optionProps: F, isSelected: A, isFocused: q, isDisabled: O } = J(
|
|
32
32
|
{ key: o.key },
|
|
33
33
|
c,
|
|
34
34
|
y
|
|
35
|
-
),
|
|
36
|
-
|
|
35
|
+
), b = k(() => c.collection.getItem("All")?.rendered?.toString(), [c.collection]), B = [
|
|
36
|
+
A ? "selected" : "",
|
|
37
37
|
q ? "focused" : "",
|
|
38
38
|
O ? "disabled" : ""
|
|
39
|
-
].join(" "),
|
|
39
|
+
].join(" "), S = f(
|
|
40
40
|
(r) => {
|
|
41
41
|
const { allSelected: t, text: p } = X(
|
|
42
42
|
r,
|
|
43
43
|
a,
|
|
44
44
|
g,
|
|
45
|
-
|
|
45
|
+
b
|
|
46
46
|
);
|
|
47
47
|
n?.(`${e}CheckAll`, t ? p : ""), i(p);
|
|
48
48
|
},
|
|
49
|
-
[a,
|
|
50
|
-
), K =
|
|
49
|
+
[a, b, g, e, i, n]
|
|
50
|
+
), K = f(
|
|
51
51
|
(r) => {
|
|
52
52
|
if (r.target.checked) {
|
|
53
|
-
const t = [...
|
|
53
|
+
const t = [...C].sort();
|
|
54
54
|
n?.(`${e}Options`, t), n?.(`${e}CheckAll`, r.target.value), i(r.target.value);
|
|
55
55
|
} else
|
|
56
56
|
n?.(`${e}Options`, []), n?.(`${e}CheckAll`, ""), i("");
|
|
57
57
|
},
|
|
58
|
-
[
|
|
59
|
-
), M =
|
|
58
|
+
[C, e, i, n]
|
|
59
|
+
), M = f(
|
|
60
60
|
(r) => {
|
|
61
61
|
const t = r.target.value, p = j(h?.(`${e}Options`)), T = r.target.checked ? [...p, t] : p.filter((E) => E !== t);
|
|
62
|
-
n?.(`${e}Options`, T),
|
|
62
|
+
n?.(`${e}Options`, T), S(T);
|
|
63
63
|
},
|
|
64
|
-
[e, n, h,
|
|
65
|
-
),
|
|
66
|
-
() => j(
|
|
67
|
-
[
|
|
68
|
-
), N =
|
|
64
|
+
[e, n, h, S]
|
|
65
|
+
), m = h?.(`${e}Options`), v = k(
|
|
66
|
+
() => j(m),
|
|
67
|
+
[m]
|
|
68
|
+
), N = k(
|
|
69
69
|
() => v.includes(o.key.toString()),
|
|
70
70
|
[v, o.key]
|
|
71
|
-
), x = h?.(`${e}CheckAll`), P =
|
|
71
|
+
), x = h?.(`${e}CheckAll`), P = k(() => !!x, [x]), R = o.key === "All" ? /* @__PURE__ */ l(
|
|
72
72
|
u,
|
|
73
73
|
{
|
|
74
74
|
checked: P,
|
|
@@ -95,7 +95,7 @@ const Co = ({
|
|
|
95
95
|
whiteSpace: "nowrap",
|
|
96
96
|
children: o.rendered
|
|
97
97
|
}
|
|
98
|
-
), U =
|
|
98
|
+
), U = f(
|
|
99
99
|
(r) => {
|
|
100
100
|
r.preventDefault(), i(o.rendered?.toString() ?? ""), c.setSelectedKey(o.key), requestAnimationFrame(() => {
|
|
101
101
|
c.setOpen(!1);
|
|
@@ -111,15 +111,16 @@ const Co = ({
|
|
|
111
111
|
...!s && !d ? F : {},
|
|
112
112
|
$multiSelection: s,
|
|
113
113
|
className: B,
|
|
114
|
+
"data-testid": `${e}-option-${o.key}`,
|
|
114
115
|
ref: y,
|
|
115
116
|
children: [
|
|
116
117
|
d ? /* @__PURE__ */ l(Z, { href: d, onClick: U, children: L }) : L,
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
A && !O && !s ? /* @__PURE__ */ l(Y, { icon: "check", iconSize: "sm", iconType: "fa-light" }) : void 0,
|
|
119
|
+
$ === void 0 ? void 0 : /* @__PURE__ */ l(_, { tagLabel: $, variant: "inactive" })
|
|
119
120
|
]
|
|
120
121
|
}
|
|
121
122
|
);
|
|
122
123
|
};
|
|
123
124
|
export {
|
|
124
|
-
|
|
125
|
+
$o as Option
|
|
125
126
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IInputProps } from '../../types';
|
|
2
|
-
declare const TextInput: ({ disabled, hasIcon, helpLink, helpLinkText, helpText, error, id, indexArray, isValid, isTouched, label, name, maskValue, maxLength, onPaste, placeholder, removeItemArray, register, suggestions, tooltip, type, weight, ...rest }: Readonly<IInputProps>) => JSX.Element;
|
|
2
|
+
declare const TextInput: ({ disabled, hasIcon, helpLink, helpLinkText, helpText, error, id, indexArray, isValid, isTouched, label, name, maskValue, maxLength, onPaste, placeholder, removeItemArray, register, suggestions, tooltip, type, warning, weight, ...rest }: Readonly<IInputProps>) => JSX.Element;
|
|
3
3
|
export { TextInput };
|
|
@@ -1,125 +1,136 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTheme as
|
|
4
|
-
import { OutlineContainer as
|
|
5
|
-
import { StyledTextInputContainer as
|
|
6
|
-
import { Icon as
|
|
1
|
+
import { jsxs as m, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useCallback as w } from "react";
|
|
3
|
+
import { useTheme as P } from "styled-components";
|
|
4
|
+
import { OutlineContainer as Q } from "../../outline-container/index.js";
|
|
5
|
+
import { StyledTextInputContainer as U } from "../../styles.js";
|
|
6
|
+
import { Icon as c } from "../../../icon/index.js";
|
|
7
7
|
import { IconButton as x } from "../../../icon-button/index.js";
|
|
8
|
-
const
|
|
8
|
+
const eo = ({
|
|
9
9
|
disabled: t = !1,
|
|
10
|
-
hasIcon:
|
|
11
|
-
helpLink:
|
|
10
|
+
hasIcon: S = !1,
|
|
11
|
+
helpLink: T,
|
|
12
12
|
helpLinkText: $,
|
|
13
|
-
helpText:
|
|
14
|
-
error:
|
|
15
|
-
id:
|
|
16
|
-
indexArray:
|
|
17
|
-
isValid:
|
|
18
|
-
isTouched:
|
|
19
|
-
label:
|
|
20
|
-
name:
|
|
21
|
-
maskValue:
|
|
22
|
-
maxLength:
|
|
23
|
-
onPaste:
|
|
24
|
-
placeholder:
|
|
25
|
-
removeItemArray:
|
|
26
|
-
register:
|
|
27
|
-
suggestions:
|
|
13
|
+
helpText: z,
|
|
14
|
+
error: I,
|
|
15
|
+
id: k,
|
|
16
|
+
indexArray: d = 0,
|
|
17
|
+
isValid: R,
|
|
18
|
+
isTouched: j,
|
|
19
|
+
label: q,
|
|
20
|
+
name: e,
|
|
21
|
+
maskValue: u = !1,
|
|
22
|
+
maxLength: B,
|
|
23
|
+
onPaste: D,
|
|
24
|
+
placeholder: M,
|
|
25
|
+
removeItemArray: h,
|
|
26
|
+
register: g,
|
|
27
|
+
suggestions: l,
|
|
28
28
|
tooltip: N,
|
|
29
29
|
type: _ = "text",
|
|
30
|
-
|
|
30
|
+
warning: E,
|
|
31
|
+
weight: F,
|
|
31
32
|
...f
|
|
32
33
|
}) => {
|
|
33
|
-
const { required:
|
|
34
|
-
|
|
34
|
+
const { required: s, onBlur: K, onChange: O } = f, n = P(), a = t ? void 0 : I, r = t || a ? void 0 : E, [V, b] = y(""), [p, G] = y(!1), H = u ? p ? "text" : "password" : _, J = w(() => {
|
|
35
|
+
G((o) => !o);
|
|
35
36
|
}, []), v = (o) => {
|
|
36
|
-
|
|
37
|
-
},
|
|
37
|
+
b(o.target.value), O?.(o);
|
|
38
|
+
}, C = R && j && !t && r === void 0 && V.trim() !== "", L = w(
|
|
38
39
|
(o) => {
|
|
39
40
|
o.key === "Enter" && o.preventDefault();
|
|
40
41
|
},
|
|
41
42
|
[]
|
|
42
43
|
);
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
|
|
44
|
+
return /* @__PURE__ */ m(
|
|
45
|
+
Q,
|
|
45
46
|
{
|
|
46
47
|
error: a,
|
|
47
|
-
helpLink:
|
|
48
|
+
helpLink: T,
|
|
48
49
|
helpLinkText: $,
|
|
49
|
-
helpText:
|
|
50
|
-
htmlFor:
|
|
51
|
-
label:
|
|
52
|
-
required:
|
|
50
|
+
helpText: z,
|
|
51
|
+
htmlFor: e,
|
|
52
|
+
label: q,
|
|
53
|
+
required: s,
|
|
53
54
|
tooltip: N,
|
|
54
|
-
|
|
55
|
+
warning: r,
|
|
56
|
+
weight: F,
|
|
55
57
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
58
|
+
/* @__PURE__ */ m(
|
|
59
|
+
U,
|
|
58
60
|
{
|
|
59
61
|
className: `
|
|
60
|
-
${t ? "disabled" : ""} ${a ? "error" : ""} ${
|
|
62
|
+
${t ? "disabled" : ""} ${a ? "error" : ""} ${r ? "warning" : ""} ${C ? "success" : ""}
|
|
61
63
|
`,
|
|
62
64
|
children: [
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
+
S ? /* @__PURE__ */ i(c, { icon: "user", iconSize: "xl", iconType: "fa-light" }) : void 0,
|
|
66
|
+
/* @__PURE__ */ i(
|
|
65
67
|
"input",
|
|
66
68
|
{
|
|
67
69
|
"aria-hidden": !1,
|
|
68
70
|
"aria-invalid": a ? "true" : "false",
|
|
69
|
-
"aria-label":
|
|
70
|
-
"aria-required":
|
|
71
|
+
"aria-label": e,
|
|
72
|
+
"aria-required": s,
|
|
71
73
|
autoComplete: "off",
|
|
72
|
-
"data-testid": `${
|
|
74
|
+
"data-testid": `${e}-input`,
|
|
73
75
|
disabled: t,
|
|
74
|
-
id:
|
|
75
|
-
list:
|
|
76
|
-
maxLength:
|
|
77
|
-
onKeyDown:
|
|
78
|
-
onPaste:
|
|
79
|
-
placeholder:
|
|
80
|
-
type:
|
|
81
|
-
...
|
|
76
|
+
id: e,
|
|
77
|
+
list: l ? `list_${e}` : void 0,
|
|
78
|
+
maxLength: B,
|
|
79
|
+
onKeyDown: L,
|
|
80
|
+
onPaste: D,
|
|
81
|
+
placeholder: M,
|
|
82
|
+
type: H,
|
|
83
|
+
...g ? g(e, { required: s, onBlur: K, onChange: v }) : { ...f, onChange: v }
|
|
82
84
|
}
|
|
83
85
|
),
|
|
84
|
-
a ? /* @__PURE__ */
|
|
85
|
-
|
|
86
|
+
a ? /* @__PURE__ */ i(
|
|
87
|
+
c,
|
|
86
88
|
{
|
|
87
89
|
icon: "exclamation-circle",
|
|
88
90
|
iconClass: "error-icon",
|
|
89
|
-
iconColor:
|
|
91
|
+
iconColor: n.palette.error[500],
|
|
90
92
|
iconSize: "lg"
|
|
91
93
|
}
|
|
92
94
|
) : void 0,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
r ? /* @__PURE__ */ i(
|
|
96
|
+
c,
|
|
97
|
+
{
|
|
98
|
+
icon: "triangle-exclamation",
|
|
99
|
+
iconClass: "warning-icon",
|
|
100
|
+
iconColor: n.palette.warning[500],
|
|
101
|
+
iconSize: "lg"
|
|
102
|
+
}
|
|
103
|
+
) : void 0,
|
|
104
|
+
C ? /* @__PURE__ */ i(
|
|
105
|
+
c,
|
|
95
106
|
{
|
|
96
107
|
icon: "check-circle",
|
|
97
108
|
iconClass: "success-icon",
|
|
98
|
-
iconColor:
|
|
109
|
+
iconColor: n.palette.success[500],
|
|
99
110
|
iconSize: "lg"
|
|
100
111
|
}
|
|
101
112
|
) : void 0,
|
|
102
|
-
|
|
113
|
+
k === "array" && d > 0 ? /* @__PURE__ */ i(
|
|
103
114
|
x,
|
|
104
115
|
{
|
|
105
|
-
color:
|
|
116
|
+
color: n.palette.gray[400],
|
|
106
117
|
icon: "trash",
|
|
107
118
|
iconSize: "sm",
|
|
108
119
|
iconType: "fa-light",
|
|
109
|
-
onClick:
|
|
120
|
+
onClick: h ? h(d) : void 0,
|
|
110
121
|
variant: "ghost"
|
|
111
122
|
}
|
|
112
123
|
) : void 0,
|
|
113
|
-
|
|
124
|
+
u ? /* @__PURE__ */ i(
|
|
114
125
|
x,
|
|
115
126
|
{
|
|
116
|
-
"aria-label":
|
|
127
|
+
"aria-label": p ? "hide password" : "show password",
|
|
117
128
|
className: "toggle-divider",
|
|
118
|
-
icon:
|
|
119
|
-
iconColor:
|
|
129
|
+
icon: p ? "eye-slash" : "eye",
|
|
130
|
+
iconColor: n.palette.gray[800],
|
|
120
131
|
iconSize: "lg",
|
|
121
132
|
iconType: "fa-light",
|
|
122
|
-
onClick:
|
|
133
|
+
onClick: J,
|
|
123
134
|
py: 0,
|
|
124
135
|
variant: "ghost"
|
|
125
136
|
}
|
|
@@ -127,11 +138,11 @@ const oo = ({
|
|
|
127
138
|
]
|
|
128
139
|
}
|
|
129
140
|
),
|
|
130
|
-
|
|
141
|
+
l ? /* @__PURE__ */ i("datalist", { id: `list_${e}`, children: l.map((o) => /* @__PURE__ */ i("option", { value: o }, o)) }) : void 0
|
|
131
142
|
]
|
|
132
143
|
}
|
|
133
144
|
);
|
|
134
145
|
};
|
|
135
146
|
export {
|
|
136
|
-
|
|
147
|
+
eo as TextInput
|
|
137
148
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject, PropsWithChildren } from 'react';
|
|
2
2
|
import { IOutlineContainerProps } from '../types';
|
|
3
|
-
declare const OutlineContainer: ({ children, containerRef, disabled, id, error, helpLink, helpLinkText, helpText, htmlFor, label, linkPosition, maxLength, required, tooltip, value, weight, }: Readonly<PropsWithChildren<IOutlineContainerProps & {
|
|
3
|
+
declare const OutlineContainer: ({ children, containerRef, disabled, id, error, helpLink, helpLinkText, helpText, htmlFor, label, linkPosition, maxLength, required, tooltip, value, warning, weight, }: Readonly<PropsWithChildren<IOutlineContainerProps & {
|
|
4
4
|
containerRef?: MutableRefObject<HTMLDivElement | null>;
|
|
5
5
|
}>>) => JSX.Element;
|
|
6
6
|
export { OutlineContainer };
|
|
@@ -1,109 +1,121 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import { Label as
|
|
4
|
-
import { StyledOutlineContainer as
|
|
5
|
-
import { Container as
|
|
6
|
-
import { Icon as
|
|
1
|
+
import { jsxs as n, jsx as i, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as k } from "styled-components";
|
|
3
|
+
import { Label as x } from "../label/index.js";
|
|
4
|
+
import { StyledOutlineContainer as I } from "../styles.js";
|
|
5
|
+
import { Container as f } from "../../container/index.js";
|
|
6
|
+
import { Icon as N } from "../../icon/index.js";
|
|
7
7
|
import { Link as O } from "../../link/index.js";
|
|
8
8
|
import { Tag as S } from "../../tag/index.js";
|
|
9
9
|
import "../../typography/heading/index.js";
|
|
10
10
|
import "../../typography/span/index.js";
|
|
11
|
-
import { Text as
|
|
12
|
-
const
|
|
13
|
-
children:
|
|
14
|
-
containerRef:
|
|
15
|
-
disabled:
|
|
16
|
-
id:
|
|
11
|
+
import { Text as l } from "../../typography/text/index.js";
|
|
12
|
+
const L = ({
|
|
13
|
+
children: g,
|
|
14
|
+
containerRef: v,
|
|
15
|
+
disabled: y,
|
|
16
|
+
id: w,
|
|
17
17
|
error: o,
|
|
18
|
-
helpLink:
|
|
18
|
+
helpLink: e,
|
|
19
19
|
helpLinkText: h = "Link here",
|
|
20
|
-
helpText:
|
|
21
|
-
htmlFor:
|
|
22
|
-
label:
|
|
23
|
-
linkPosition:
|
|
24
|
-
maxLength:
|
|
20
|
+
helpText: a,
|
|
21
|
+
htmlFor: d,
|
|
22
|
+
label: m,
|
|
23
|
+
linkPosition: s = "down",
|
|
24
|
+
maxLength: c,
|
|
25
25
|
required: u,
|
|
26
|
-
tooltip:
|
|
27
|
-
value:
|
|
28
|
-
|
|
26
|
+
tooltip: b,
|
|
27
|
+
value: p,
|
|
28
|
+
warning: z,
|
|
29
|
+
weight: C
|
|
29
30
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const r = k(), $ = p ? p.length : 0, t = o ? void 0 : z;
|
|
32
|
+
return /* @__PURE__ */ n(I, { id: w, ref: v, children: [
|
|
33
|
+
m === void 0 ? void 0 : /* @__PURE__ */ i(
|
|
34
|
+
x,
|
|
34
35
|
{
|
|
35
|
-
htmlFor:
|
|
36
|
-
label:
|
|
37
|
-
link:
|
|
36
|
+
htmlFor: d,
|
|
37
|
+
label: m,
|
|
38
|
+
link: s === "up" ? e : void 0,
|
|
38
39
|
required: u,
|
|
39
|
-
tooltip:
|
|
40
|
-
weight:
|
|
40
|
+
tooltip: b,
|
|
41
|
+
weight: C
|
|
41
42
|
}
|
|
42
43
|
),
|
|
43
|
-
|
|
44
|
-
o ||
|
|
45
|
-
|
|
44
|
+
g,
|
|
45
|
+
o || t || c ? /* @__PURE__ */ n(
|
|
46
|
+
f,
|
|
46
47
|
{
|
|
47
48
|
display: "flex",
|
|
48
|
-
justify: o === void 0 ? "end" : "space-between",
|
|
49
|
+
justify: o === void 0 && t === void 0 ? "end" : "space-between",
|
|
49
50
|
width: "100%",
|
|
50
51
|
children: [
|
|
51
52
|
o && /* @__PURE__ */ i(
|
|
52
|
-
|
|
53
|
+
l,
|
|
53
54
|
{
|
|
54
55
|
className: "error-msg",
|
|
55
|
-
color:
|
|
56
|
-
"data-testid": `${
|
|
56
|
+
color: r.palette.error[500],
|
|
57
|
+
"data-testid": `${d}-error`,
|
|
57
58
|
display: "block",
|
|
58
59
|
size: "md",
|
|
59
60
|
children: o
|
|
60
61
|
}
|
|
61
62
|
),
|
|
62
|
-
|
|
63
|
+
t && /* @__PURE__ */ i(
|
|
64
|
+
l,
|
|
65
|
+
{
|
|
66
|
+
className: "warning-msg",
|
|
67
|
+
color: r.palette.warning[700],
|
|
68
|
+
"data-testid": `${d}-warning`,
|
|
69
|
+
display: "block",
|
|
70
|
+
size: "md",
|
|
71
|
+
children: t
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
c && /* @__PURE__ */ i(
|
|
63
75
|
S,
|
|
64
76
|
{
|
|
65
77
|
priority: "low",
|
|
66
|
-
tagLabel: `${
|
|
67
|
-
variant:
|
|
78
|
+
tagLabel: `${$}/${c}`,
|
|
79
|
+
variant: y ? "inactive" : "error"
|
|
68
80
|
}
|
|
69
81
|
)
|
|
70
82
|
]
|
|
71
83
|
}
|
|
72
84
|
) : void 0,
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
a || e ? /* @__PURE__ */ n(
|
|
86
|
+
f,
|
|
75
87
|
{
|
|
76
88
|
alignItems: "center",
|
|
77
89
|
display: "flex",
|
|
78
90
|
gap: 0.25,
|
|
79
91
|
width: "100%",
|
|
80
92
|
children: [
|
|
81
|
-
|
|
93
|
+
a && /* @__PURE__ */ n(j, { children: [
|
|
82
94
|
/* @__PURE__ */ i(
|
|
83
|
-
|
|
95
|
+
N,
|
|
84
96
|
{
|
|
85
97
|
icon: "circle-info",
|
|
86
|
-
iconColor:
|
|
98
|
+
iconColor: r.palette.gray[400],
|
|
87
99
|
iconSize: "sm",
|
|
88
100
|
iconType: "fa-light"
|
|
89
101
|
}
|
|
90
102
|
),
|
|
91
103
|
/* @__PURE__ */ i(
|
|
92
|
-
|
|
104
|
+
l,
|
|
93
105
|
{
|
|
94
|
-
color:
|
|
106
|
+
color: r.palette.gray[400],
|
|
95
107
|
display: "inline-block",
|
|
96
108
|
size: "md",
|
|
97
|
-
children:
|
|
109
|
+
children: a
|
|
98
110
|
}
|
|
99
111
|
)
|
|
100
112
|
] }),
|
|
101
|
-
|
|
113
|
+
e && s === "down" ? /* @__PURE__ */ i(O, { href: e, children: h }) : void 0
|
|
102
114
|
]
|
|
103
115
|
}
|
|
104
116
|
) : void 0
|
|
105
117
|
] });
|
|
106
118
|
};
|
|
107
119
|
export {
|
|
108
|
-
|
|
120
|
+
L as OutlineContainer
|
|
109
121
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled as o } from "styled-components";
|
|
2
|
-
const
|
|
2
|
+
const a = o.div`
|
|
3
3
|
${({ theme: t }) => `
|
|
4
4
|
align-items: flex-start;
|
|
5
5
|
display: inline-flex;
|
|
@@ -192,6 +192,14 @@ const n = o.div`
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
&.warning:not(.disabled) {
|
|
196
|
+
border: 1px solid ${t.palette.warning[500]};
|
|
197
|
+
|
|
198
|
+
.toggle-divider {
|
|
199
|
+
border-left-color: ${t.palette.warning[500]};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
195
203
|
&.success:not(.disabled) {
|
|
196
204
|
border: 1px solid ${t.palette.success[500]};
|
|
197
205
|
|
|
@@ -200,7 +208,7 @@ const n = o.div`
|
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
|
|
203
|
-
&:focus-within:not(:has(.toggle-divider:focus)):not(.disabled, .error) {
|
|
211
|
+
&:focus-within:not(:has(.toggle-divider:focus)):not(.disabled, .error, .warning) {
|
|
204
212
|
background: ${t.palette.white};
|
|
205
213
|
border: 1px solid ${t.palette.black};
|
|
206
214
|
box-shadow: 0 0 0 1px ${t.palette.black};
|
|
@@ -219,7 +227,7 @@ const n = o.div`
|
|
|
219
227
|
}
|
|
220
228
|
}
|
|
221
229
|
|
|
222
|
-
&:hover:not(:has(.toggle-divider:hover)):not(:focus-within, .disabled, .error, .success) {
|
|
230
|
+
&:hover:not(:has(.toggle-divider:hover)):not(:focus-within, .disabled, .error, .warning, .success) {
|
|
223
231
|
background: ${t.palette.white};
|
|
224
232
|
border: 1px solid ${t.palette.gray[600]};
|
|
225
233
|
|
|
@@ -228,18 +236,18 @@ const n = o.div`
|
|
|
228
236
|
}
|
|
229
237
|
}
|
|
230
238
|
`}
|
|
231
|
-
`,
|
|
239
|
+
`, l = o.div`
|
|
232
240
|
height: 1px;
|
|
233
241
|
background-color: ${({ theme: t }) => t.palette.gray[300]};
|
|
234
242
|
flex-shrink: 0;
|
|
235
243
|
transition: background-color 0.2s ease;
|
|
236
244
|
|
|
237
|
-
${e}:hover:not(:has(.toggle-divider:hover)):not(:focus-within, .disabled, .error, .success) & {
|
|
245
|
+
${e}:hover:not(:has(.toggle-divider:hover)):not(:focus-within, .disabled, .error, .warning, .success) & {
|
|
238
246
|
background-color: ${({ theme: t }) => t.palette.gray[600]};
|
|
239
247
|
transition: none;
|
|
240
248
|
}
|
|
241
249
|
|
|
242
|
-
${e}:focus-within:not(:has(.toggle-divider:focus)):not(.disabled, .error) & {
|
|
250
|
+
${e}:focus-within:not(:has(.toggle-divider:focus)):not(.disabled, .error, .warning) & {
|
|
243
251
|
border: 1px solid ${({ theme: t }) => t.palette.black};
|
|
244
252
|
}
|
|
245
253
|
`, p = o.div`
|
|
@@ -258,7 +266,7 @@ const n = o.div`
|
|
|
258
266
|
`;
|
|
259
267
|
export {
|
|
260
268
|
p as ErrorMessage,
|
|
261
|
-
|
|
262
|
-
|
|
269
|
+
l as StyledNumberFieldSeparator,
|
|
270
|
+
a as StyledOutlineContainer,
|
|
263
271
|
e as StyledTextInputContainer
|
|
264
272
|
};
|
|
@@ -41,6 +41,7 @@ interface ILabelProps {
|
|
|
41
41
|
* @property {string} [helpLinkText] - The help link text of the input.
|
|
42
42
|
* @property {string} [helpText] - The help text of the input.
|
|
43
43
|
* @property {number} [maxLength] - The max length of the input.
|
|
44
|
+
* @property {string} [warning] - A non-blocking message shown when there is no error.
|
|
44
45
|
*/
|
|
45
46
|
interface IOutlineContainerProps extends ILabelProps {
|
|
46
47
|
disabled?: boolean;
|
|
@@ -52,6 +53,7 @@ interface IOutlineContainerProps extends ILabelProps {
|
|
|
52
53
|
helpText?: string;
|
|
53
54
|
maxLength?: number;
|
|
54
55
|
value?: string;
|
|
56
|
+
warning?: string;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
59
|
* Input text component props.
|
package/package.json
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
58
58
|
"eslint-plugin-storybook": "10.4.0",
|
|
59
59
|
"jsdom": "27.4.0",
|
|
60
|
-
"next": "16.3.
|
|
60
|
+
"next": "16.3.8",
|
|
61
61
|
"playwright": "1.60.0",
|
|
62
62
|
"postcss-styled-syntax": "0.7.1",
|
|
63
63
|
"prettier": "3.9.6",
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"./dist/index.js"
|
|
136
136
|
],
|
|
137
137
|
"typings": "./dist/index.d.ts",
|
|
138
|
-
"version": "9.
|
|
138
|
+
"version": "9.5.0"
|
|
139
139
|
}
|