@fluidattacks/design 9.4.0 → 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.
@@ -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 C, jsx as e } from "react/jsx-runtime";
2
- import { useState as g, useCallback as y } from "react";
3
- import { useTheme as J } from "styled-components";
4
- import { OutlineContainer as L } from "../../outline-container/index.js";
5
- import { StyledTextInputContainer as P } from "../../styles.js";
6
- import { Icon as s } from "../../../icon/index.js";
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 oo = ({
8
+ const eo = ({
9
9
  disabled: t = !1,
10
- hasIcon: T = !1,
11
- helpLink: S,
10
+ hasIcon: S = !1,
11
+ helpLink: T,
12
12
  helpLinkText: $,
13
- helpText: w,
14
- error: z,
15
- id: I,
16
- indexArray: p = 0,
17
- isValid: k,
18
- isTouched: R,
19
- label: j,
20
- name: i,
21
- maskValue: d = !1,
22
- maxLength: q,
23
- onPaste: B,
24
- placeholder: D,
25
- removeItemArray: u,
26
- register: h,
27
- suggestions: n,
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
- weight: b,
30
+ warning: E,
31
+ weight: F,
31
32
  ...f
32
33
  }) => {
33
- const { required: l, onBlur: E, onChange: F } = f, r = J(), a = t ? void 0 : z, [K, M] = g(""), [c, O] = g(!1), V = d ? c ? "text" : "password" : _, G = y(() => {
34
- O((o) => !o);
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
- M(o.target.value), F?.(o);
37
- }, m = k && R && !t && K.trim() !== "", H = y(
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__ */ C(
44
- L,
44
+ return /* @__PURE__ */ m(
45
+ Q,
45
46
  {
46
47
  error: a,
47
- helpLink: S,
48
+ helpLink: T,
48
49
  helpLinkText: $,
49
- helpText: w,
50
- htmlFor: i,
51
- label: j,
52
- required: l,
50
+ helpText: z,
51
+ htmlFor: e,
52
+ label: q,
53
+ required: s,
53
54
  tooltip: N,
54
- weight: b,
55
+ warning: r,
56
+ weight: F,
55
57
  children: [
56
- /* @__PURE__ */ C(
57
- P,
58
+ /* @__PURE__ */ m(
59
+ U,
58
60
  {
59
61
  className: `
60
- ${t ? "disabled" : ""} ${a ? "error" : ""} ${m ? "success" : ""}
62
+ ${t ? "disabled" : ""} ${a ? "error" : ""} ${r ? "warning" : ""} ${C ? "success" : ""}
61
63
  `,
62
64
  children: [
63
- T ? /* @__PURE__ */ e(s, { icon: "user", iconSize: "xl", iconType: "fa-light" }) : void 0,
64
- /* @__PURE__ */ e(
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": i,
70
- "aria-required": l,
71
+ "aria-label": e,
72
+ "aria-required": s,
71
73
  autoComplete: "off",
72
- "data-testid": `${i}-input`,
74
+ "data-testid": `${e}-input`,
73
75
  disabled: t,
74
- id: i,
75
- list: n ? `list_${i}` : void 0,
76
- maxLength: q,
77
- onKeyDown: H,
78
- onPaste: B,
79
- placeholder: D,
80
- type: V,
81
- ...h ? h(i, { required: l, onBlur: E, onChange: v }) : { ...f, onChange: v }
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__ */ e(
85
- s,
86
+ a ? /* @__PURE__ */ i(
87
+ c,
86
88
  {
87
89
  icon: "exclamation-circle",
88
90
  iconClass: "error-icon",
89
- iconColor: r.palette.error[500],
91
+ iconColor: n.palette.error[500],
90
92
  iconSize: "lg"
91
93
  }
92
94
  ) : void 0,
93
- m ? /* @__PURE__ */ e(
94
- s,
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: r.palette.success[500],
109
+ iconColor: n.palette.success[500],
99
110
  iconSize: "lg"
100
111
  }
101
112
  ) : void 0,
102
- I === "array" && p > 0 ? /* @__PURE__ */ e(
113
+ k === "array" && d > 0 ? /* @__PURE__ */ i(
103
114
  x,
104
115
  {
105
- color: r.palette.gray[400],
116
+ color: n.palette.gray[400],
106
117
  icon: "trash",
107
118
  iconSize: "sm",
108
119
  iconType: "fa-light",
109
- onClick: u ? u(p) : void 0,
120
+ onClick: h ? h(d) : void 0,
110
121
  variant: "ghost"
111
122
  }
112
123
  ) : void 0,
113
- d ? /* @__PURE__ */ e(
124
+ u ? /* @__PURE__ */ i(
114
125
  x,
115
126
  {
116
- "aria-label": c ? "hide password" : "show password",
127
+ "aria-label": p ? "hide password" : "show password",
117
128
  className: "toggle-divider",
118
- icon: c ? "eye-slash" : "eye",
119
- iconColor: r.palette.gray[800],
129
+ icon: p ? "eye-slash" : "eye",
130
+ iconColor: n.palette.gray[800],
120
131
  iconSize: "lg",
121
132
  iconType: "fa-light",
122
- onClick: G,
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
- n ? /* @__PURE__ */ e("datalist", { id: `list_${i}`, children: n.map((o) => /* @__PURE__ */ e("option", { value: o }, o)) }) : void 0
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
- oo as TextInput
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 e, jsx as i, Fragment as j } from "react/jsx-runtime";
2
- import { useTheme as z } from "styled-components";
3
- import { Label as $ } from "../label/index.js";
4
- import { StyledOutlineContainer as x } from "../styles.js";
5
- import { Container as s } from "../../container/index.js";
6
- import { Icon as I } from "../../icon/index.js";
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 p } from "../../typography/text/index.js";
12
- const J = ({
13
- children: f,
14
- containerRef: y,
15
- disabled: g,
16
- id: v,
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: r,
18
+ helpLink: e,
19
19
  helpLinkText: h = "Link here",
20
- helpText: t,
21
- htmlFor: m,
22
- label: a,
23
- linkPosition: c = "down",
24
- maxLength: n,
20
+ helpText: a,
21
+ htmlFor: d,
22
+ label: m,
23
+ linkPosition: s = "down",
24
+ maxLength: c,
25
25
  required: u,
26
- tooltip: w,
27
- value: l,
28
- weight: b
26
+ tooltip: b,
27
+ value: p,
28
+ warning: z,
29
+ weight: C
29
30
  }) => {
30
- const d = z(), C = l ? l.length : 0;
31
- return /* @__PURE__ */ e(x, { id: v, ref: y, children: [
32
- a === void 0 ? void 0 : /* @__PURE__ */ i(
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: m,
36
- label: a,
37
- link: c === "up" ? r : void 0,
36
+ htmlFor: d,
37
+ label: m,
38
+ link: s === "up" ? e : void 0,
38
39
  required: u,
39
- tooltip: w,
40
- weight: b
40
+ tooltip: b,
41
+ weight: C
41
42
  }
42
43
  ),
43
- f,
44
- o || n ? /* @__PURE__ */ e(
45
- s,
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
- p,
53
+ l,
53
54
  {
54
55
  className: "error-msg",
55
- color: d.palette.error[500],
56
- "data-testid": `${m}-error`,
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
- n && /* @__PURE__ */ i(
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: `${C}/${n}`,
67
- variant: g ? "inactive" : "error"
78
+ tagLabel: `${$}/${c}`,
79
+ variant: y ? "inactive" : "error"
68
80
  }
69
81
  )
70
82
  ]
71
83
  }
72
84
  ) : void 0,
73
- t || r ? /* @__PURE__ */ e(
74
- s,
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
- t && /* @__PURE__ */ e(j, { children: [
93
+ a && /* @__PURE__ */ n(j, { children: [
82
94
  /* @__PURE__ */ i(
83
- I,
95
+ N,
84
96
  {
85
97
  icon: "circle-info",
86
- iconColor: d.palette.gray[400],
98
+ iconColor: r.palette.gray[400],
87
99
  iconSize: "sm",
88
100
  iconType: "fa-light"
89
101
  }
90
102
  ),
91
103
  /* @__PURE__ */ i(
92
- p,
104
+ l,
93
105
  {
94
- color: d.palette.gray[400],
106
+ color: r.palette.gray[400],
95
107
  display: "inline-block",
96
108
  size: "md",
97
- children: t
109
+ children: a
98
110
  }
99
111
  )
100
112
  ] }),
101
- r && c === "down" ? /* @__PURE__ */ i(O, { href: r, children: h }) : void 0
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
- J as OutlineContainer
120
+ L as OutlineContainer
109
121
  };
@@ -1,5 +1,5 @@
1
1
  import { styled as o } from "styled-components";
2
- const n = o.div`
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
- `, s = o.div`
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
- s as StyledNumberFieldSeparator,
262
- n as StyledOutlineContainer,
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
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "9.4.0"
138
+ "version": "9.5.0"
139
139
  }