@adam-milo/ui 1.0.33 → 1.0.34

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.
Files changed (152) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +57 -23
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +94 -56
  5. package/dist/index11.cjs +1 -1
  6. package/dist/index11.js +199 -40
  7. package/dist/index12.cjs +1 -1
  8. package/dist/index12.js +305 -105
  9. package/dist/index13.cjs +1 -1
  10. package/dist/index13.js +260 -74
  11. package/dist/index14.cjs +1 -1
  12. package/dist/index14.js +135 -27
  13. package/dist/index15.cjs +1 -1
  14. package/dist/index15.js +52 -469
  15. package/dist/index16.cjs +1 -1
  16. package/dist/index16.js +57 -111
  17. package/dist/index17.cjs +1 -1
  18. package/dist/index17.js +101 -20
  19. package/dist/index18.cjs +1 -1
  20. package/dist/index18.js +76 -21
  21. package/dist/index19.cjs +1 -1
  22. package/dist/index19.js +25 -29
  23. package/dist/index2.cjs +1 -1
  24. package/dist/index2.js +6 -4
  25. package/dist/index20.cjs +1 -1
  26. package/dist/index20.js +468 -31
  27. package/dist/index21.cjs +1 -1
  28. package/dist/index21.js +155 -39
  29. package/dist/index22.cjs +1 -1
  30. package/dist/index22.js +16 -27
  31. package/dist/index23.cjs +1 -1
  32. package/dist/index23.js +36 -12
  33. package/dist/index24.cjs +1 -0
  34. package/dist/index24.js +46 -0
  35. package/dist/index25.cjs +1 -1
  36. package/dist/index25.js +80 -263
  37. package/dist/index26.cjs +1 -1
  38. package/dist/index26.js +52 -13
  39. package/dist/index27.cjs +1 -0
  40. package/dist/index27.js +45 -0
  41. package/dist/index28.cjs +1 -0
  42. package/dist/index28.js +53 -0
  43. package/dist/index29.cjs +1 -0
  44. package/dist/index29.js +55 -0
  45. package/dist/index3.cjs +1 -1
  46. package/dist/index3.js +33 -33
  47. package/dist/index30.cjs +1 -0
  48. package/dist/index30.js +72 -0
  49. package/dist/index31.cjs +1 -0
  50. package/dist/index31.js +14 -0
  51. package/dist/index32.cjs +1 -0
  52. package/dist/index32.js +332 -0
  53. package/dist/index36.cjs +1 -1
  54. package/dist/index36.js +383 -6
  55. package/dist/index37.cjs +1 -0
  56. package/dist/index37.js +16 -0
  57. package/dist/index4.cjs +1 -1
  58. package/dist/index4.js +59 -11
  59. package/dist/index5.cjs +1 -1
  60. package/dist/index5.js +19 -35
  61. package/dist/index50.cjs +1 -0
  62. package/dist/index50.js +9 -0
  63. package/dist/index6.cjs +1 -1
  64. package/dist/index6.js +11 -101
  65. package/dist/index62.cjs +1 -0
  66. package/dist/index62.js +502 -0
  67. package/dist/index64.cjs +1 -0
  68. package/dist/index64.js +11 -0
  69. package/dist/index65.cjs +1 -0
  70. package/dist/index65.js +39 -0
  71. package/dist/index66.cjs +1 -0
  72. package/dist/index66.js +64 -0
  73. package/dist/index67.cjs +1 -0
  74. package/dist/index67.js +212 -0
  75. package/dist/index68.cjs +1 -0
  76. package/dist/index68.js +14 -0
  77. package/dist/index69.cjs +1 -0
  78. package/dist/index69.js +293 -0
  79. package/dist/index7.cjs +1 -1
  80. package/dist/index7.js +46 -97
  81. package/dist/index70.cjs +1 -0
  82. package/dist/index70.js +18 -0
  83. package/dist/index71.cjs +1 -0
  84. package/dist/index71.js +129 -0
  85. package/dist/index72.cjs +1 -0
  86. package/dist/index72.js +43 -0
  87. package/dist/index73.cjs +1 -0
  88. package/dist/index73.js +99 -0
  89. package/dist/index74.cjs +1 -0
  90. package/dist/index74.js +71 -0
  91. package/dist/index75.cjs +1 -0
  92. package/dist/index75.js +36 -0
  93. package/dist/index76.cjs +1 -0
  94. package/dist/index76.js +14 -0
  95. package/dist/index77.cjs +1 -0
  96. package/dist/index77.js +17 -0
  97. package/dist/index78.cjs +1 -0
  98. package/dist/index78.js +6 -0
  99. package/dist/index79.cjs +1 -0
  100. package/dist/index79.js +297 -0
  101. package/dist/index8.cjs +1 -1
  102. package/dist/index8.js +97 -88
  103. package/dist/index80.cjs +1 -0
  104. package/dist/index80.js +25 -0
  105. package/dist/index81.cjs +1 -0
  106. package/dist/index81.js +39 -0
  107. package/dist/index82.cjs +1 -0
  108. package/dist/index82.js +625 -0
  109. package/dist/index83.cjs +1 -0
  110. package/dist/index83.js +721 -0
  111. package/dist/index84.cjs +1 -0
  112. package/dist/index84.js +154 -0
  113. package/dist/index85.cjs +1 -0
  114. package/dist/index85.js +173 -0
  115. package/dist/index9.cjs +1 -1
  116. package/dist/index9.js +55 -197
  117. package/dist/src/components/core/button/Button.component.d.ts +13 -7
  118. package/dist/src/components/core/button/Button.component.d.ts.map +1 -1
  119. package/dist/src/components/core/icon/Icon.component.d.ts +1 -1
  120. package/dist/src/components/core/icon/Icon.component.d.ts.map +1 -1
  121. package/dist/src/components/core/icon-button/IconButton.component.d.ts +36 -0
  122. package/dist/src/components/core/icon-button/IconButton.component.d.ts.map +1 -0
  123. package/dist/src/components/core/menu-icon-button/MenuIconButton.component.d.ts +79 -0
  124. package/dist/src/components/core/menu-icon-button/MenuIconButton.component.d.ts.map +1 -0
  125. package/dist/src/components/feedback/spinner/Spinner.component.d.ts +62 -0
  126. package/dist/src/components/feedback/spinner/Spinner.component.d.ts.map +1 -0
  127. package/dist/src/components/forms/input/Input.component.d.ts +5 -0
  128. package/dist/src/components/forms/input/Input.component.d.ts.map +1 -1
  129. package/dist/src/components/forms/otp-input/OTPInput.component.d.ts +82 -0
  130. package/dist/src/components/forms/otp-input/OTPInput.component.d.ts.map +1 -0
  131. package/dist/src/components/forms/phone-input/PhoneInput.component.d.ts +96 -0
  132. package/dist/src/components/forms/phone-input/PhoneInput.component.d.ts.map +1 -0
  133. package/dist/src/components/forms/phone-input/countries.d.ts +93 -0
  134. package/dist/src/components/forms/phone-input/countries.d.ts.map +1 -0
  135. package/dist/src/components/forms/select/Select.component.d.ts +5 -1
  136. package/dist/src/components/forms/select/Select.component.d.ts.map +1 -1
  137. package/dist/src/components/forms/toggle/Toggle.component.d.ts +80 -0
  138. package/dist/src/components/forms/toggle/Toggle.component.d.ts.map +1 -0
  139. package/dist/src/components/layout/auth-layout/AuthLayout.component.d.ts +86 -0
  140. package/dist/src/components/layout/auth-layout/AuthLayout.component.d.ts.map +1 -0
  141. package/dist/src/components/overlays/dialog/Dialog.component.d.ts +36 -2
  142. package/dist/src/components/overlays/dialog/Dialog.component.d.ts.map +1 -1
  143. package/dist/src/components/typography/heading/Heading.component.d.ts +3 -2
  144. package/dist/src/components/typography/heading/Heading.component.d.ts.map +1 -1
  145. package/dist/src/components/typography/link/Link.component.d.ts +80 -0
  146. package/dist/src/components/typography/link/Link.component.d.ts.map +1 -0
  147. package/dist/src/index.d.ts +22 -5
  148. package/dist/src/index.d.ts.map +1 -1
  149. package/dist/style.css +1 -1
  150. package/package.json +2 -1
  151. /package/dist/{index44.cjs → index61.cjs} +0 -0
  152. /package/dist/{index44.js → index61.js} +0 -0
package/dist/index25.js CHANGED
@@ -1,293 +1,110 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { forwardRef, useState, useRef, useId, useMemo, useEffect } from "react";
3
- import { cn } from "./index23.js";
2
+ import { forwardRef } from "react";
3
+ import { cn } from "./index31.js";
4
+ import { MenuIconButton } from "./index4.js";
4
5
  /* empty css */
5
- import { useMergedRef } from "./index26.js";
6
- import { debounce } from "./index44.js";
7
- const Input = forwardRef(
6
+ const AuthLayout = forwardRef(
8
7
  ({
9
- type = "text",
10
- label,
11
- error: externalError,
12
- helperText,
13
- fullWidth = false,
14
- showPasswordToggle = true,
15
- showLastChar = true,
16
- lastCharDelay = 500,
17
- validate,
18
- onValidationChange,
19
- className,
20
- id: providedId,
21
- onChange,
22
- onBlur,
23
- required,
24
- value: controlledValue,
25
- "data-cy": dataCy,
8
+ children,
9
+ cardSize = "lg",
10
+ logo,
11
+ showSettings = true,
12
+ showUserMenu = true,
13
+ userInitials,
14
+ onSettingsClick,
15
+ onUserMenuClick,
16
+ activeMenu = null,
26
17
  "data-testid": dataTestId,
18
+ "data-cy": dataCy,
27
19
  ...props
28
20
  }, ref) => {
29
- const [isPasswordVisible, setIsPasswordVisible] = useState(false);
30
- const [internalError, setInternalError] = useState();
31
- const [isFocused, setIsFocused] = useState(false);
32
- const [isHovered, setIsHovered] = useState(false);
33
- const touchedRef = useRef(false);
34
- const [displayPassword, setDisplayPassword] = useState("");
35
- const actualPasswordRef = useRef("");
36
- const timeoutRef = useRef(null);
37
- const inputRef = useRef(null);
38
- const mergedRef = useMergedRef(ref, inputRef);
39
- const generatedId = useId();
40
- const id = providedId || generatedId;
41
- const errorId = `${id}-error`;
42
- const helperId = `${id}-helper`;
43
- const finalDataCy = dataCy || "input";
44
- const finalTestId = dataTestId || "input";
45
- const isPasswordType = type === "password";
46
- const showToggle = isPasswordType && showPasswordToggle;
47
- const shouldEnableLastCharPreview = isPasswordType && showLastChar && !isPasswordVisible;
48
- const inputType = isPasswordType && (isPasswordVisible || shouldEnableLastCharPreview && actualPasswordRef.current.length > 0) ? "text" : type;
49
- const displayLabel = label && required && !label.includes("*") ? `${label} *` : label;
50
- const togglePasswordVisibility = () => {
51
- setIsPasswordVisible((prev) => !prev);
52
- setTimeout(() => {
53
- var _a;
54
- return (_a = inputRef.current) == null ? void 0 : _a.focus();
55
- }, 0);
56
- };
57
- const debouncedValidate = useMemo(
58
- () => debounce((value) => {
59
- if (validate && touchedRef.current) {
60
- const validationError = validate(value);
61
- setInternalError(validationError);
62
- onValidationChange == null ? void 0 : onValidationChange(!validationError);
63
- }
64
- }, 300),
65
- [validate, onValidationChange]
66
- );
67
- const debouncedValidateRef = useRef(debouncedValidate);
68
- useEffect(() => {
69
- debouncedValidateRef.current = debouncedValidate;
70
- }, [debouncedValidate]);
71
- useEffect(() => {
72
- if (process.env.NODE_ENV === "development") {
73
- if (isPasswordType && showLastChar && controlledValue !== void 0) {
74
- console.warn(
75
- "[Input] Password last character preview (showLastChar) only works in uncontrolled mode. Remove the value prop to use this feature, or set showLastChar={false}."
76
- );
77
- }
78
- }
79
- }, [isPasswordType, showLastChar, controlledValue]);
80
- useEffect(() => {
81
- return () => {
82
- if (timeoutRef.current) {
83
- clearTimeout(timeoutRef.current);
84
- }
85
- debouncedValidateRef.current.cancel();
86
- };
87
- }, []);
88
- const inputValue = shouldEnableLastCharPreview && controlledValue === void 0 ? displayPassword : isPasswordVisible && isPasswordType && controlledValue === void 0 ? actualPasswordRef.current || "" : controlledValue;
89
- const handleChange = (e) => {
90
- onChange == null ? void 0 : onChange(e);
91
- let value = e.target.value;
92
- if (shouldEnableLastCharPreview) {
93
- const input = e.target;
94
- const newValue = input.value;
95
- actualPasswordRef.current = newValue;
96
- const masked = newValue ? "•".repeat(newValue.length - 1) + newValue.slice(-1) : "";
97
- setDisplayPassword(masked);
98
- input.value = masked;
99
- value = newValue;
100
- if (timeoutRef.current) {
101
- clearTimeout(timeoutRef.current);
102
- }
103
- timeoutRef.current = setTimeout(() => {
104
- setDisplayPassword("•".repeat(newValue.length));
105
- }, lastCharDelay);
106
- }
107
- if (touchedRef.current) {
108
- debouncedValidate(value);
109
- }
110
- };
111
- const handleFocus = (e) => {
112
- var _a;
113
- setIsFocused(true);
114
- (_a = props.onFocus) == null ? void 0 : _a.call(props, e);
115
- };
116
- const handleBlur = (e) => {
117
- setIsFocused(false);
118
- touchedRef.current = true;
119
- if (validate) {
120
- const valueToValidate = shouldEnableLastCharPreview ? actualPasswordRef.current : e.target.value;
121
- const validationError = validate(valueToValidate);
122
- setInternalError(validationError);
123
- onValidationChange == null ? void 0 : onValidationChange(!validationError);
124
- }
125
- onBlur == null ? void 0 : onBlur(e);
126
- };
127
- const handleMouseEnter = () => {
128
- setIsHovered(true);
129
- };
130
- const handleMouseLeave = () => {
131
- setIsHovered(false);
132
- };
133
- const displayError = externalError || internalError;
134
- const inputState = props.disabled ? "disabled" : displayError ? "error" : isFocused ? "focus" : isHovered ? "hover" : "idle";
21
+ const finalDataCy = dataCy || "auth-layout";
22
+ const finalTestId = dataTestId || "auth-layout";
135
23
  return /* @__PURE__ */ jsxs(
136
24
  "div",
137
25
  {
138
- className: cn("input-wrapper", fullWidth && "input-wrapper--full-width"),
139
- "data-cy": `${finalDataCy}-wrapper`,
140
- "data-testid": `${finalTestId}-wrapper`,
26
+ ref,
27
+ className: "auth-layout",
28
+ "data-testid": finalTestId,
29
+ "data-cy": finalDataCy,
30
+ ...props,
141
31
  children: [
142
- label && /* @__PURE__ */ jsx(
143
- "label",
32
+ /* @__PURE__ */ jsx(
33
+ "div",
144
34
  {
145
- htmlFor: id,
146
- className: "input__label",
147
- "data-cy": `${finalDataCy}-label`,
148
- "data-testid": `${finalTestId}-label`,
149
- children: displayLabel
35
+ className: "auth-layout__background",
36
+ "data-testid": `${finalTestId}-background`,
37
+ "data-cy": `${finalDataCy}-background`,
38
+ "aria-hidden": "true"
150
39
  }
151
40
  ),
152
- /* @__PURE__ */ jsxs("div", { className: "input__field-container", children: [
153
- /* @__PURE__ */ jsx(
154
- "input",
155
- {
156
- ref: mergedRef,
157
- id,
158
- type: inputType,
159
- value: inputValue,
160
- className: cn(
161
- "input",
162
- displayError && "input--error",
163
- fullWidth && "input--full-width",
164
- showToggle && "input--with-toggle",
165
- className
166
- ),
167
- "aria-invalid": displayError ? "true" : "false",
168
- "aria-required": required ? "true" : void 0,
169
- "aria-describedby": displayError ? errorId : helperText ? helperId : void 0,
170
- "data-cy": finalDataCy,
171
- "data-testid": finalTestId,
172
- "data-state": inputState,
173
- onChange: handleChange,
174
- onFocus: handleFocus,
175
- onBlur: handleBlur,
176
- onMouseEnter: handleMouseEnter,
177
- onMouseLeave: handleMouseLeave,
178
- required,
179
- ...props
180
- }
181
- ),
182
- showToggle && /* @__PURE__ */ jsx(
183
- "button",
184
- {
185
- type: "button",
186
- className: "input__toggle",
187
- onClick: togglePasswordVisibility,
188
- "aria-label": isPasswordVisible ? "Hide password" : "Show password",
189
- "data-cy": `${finalDataCy}-toggle`,
190
- "data-testid": `${finalTestId}-toggle`,
191
- children: isPasswordVisible ? /* @__PURE__ */ jsxs(
192
- "svg",
41
+ /* @__PURE__ */ jsxs(
42
+ "header",
43
+ {
44
+ className: "auth-layout__header",
45
+ "data-testid": `${finalTestId}-header`,
46
+ "data-cy": `${finalDataCy}-header`,
47
+ children: [
48
+ /* @__PURE__ */ jsx(
49
+ "div",
193
50
  {
194
- width: "20",
195
- height: "20",
196
- viewBox: "0 0 20 20",
197
- fill: "none",
198
- xmlns: "http://www.w3.org/2000/svg",
199
- "aria-hidden": "true",
200
- children: [
201
- /* @__PURE__ */ jsx(
202
- "path",
203
- {
204
- d: "M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",
205
- stroke: "currentColor",
206
- strokeWidth: "1.5",
207
- strokeLinecap: "round",
208
- strokeLinejoin: "round",
209
- fill: "none"
210
- }
211
- ),
212
- /* @__PURE__ */ jsx(
213
- "circle",
214
- {
215
- cx: "10",
216
- cy: "10",
217
- r: "2.5",
218
- stroke: "currentColor",
219
- strokeWidth: "1.5",
220
- fill: "none"
221
- }
222
- )
223
- ]
51
+ className: "auth-layout__logo",
52
+ "data-testid": `${finalTestId}-logo`,
53
+ "data-cy": `${finalDataCy}-logo`,
54
+ children: logo
224
55
  }
225
- ) : /* @__PURE__ */ jsxs(
226
- "svg",
56
+ ),
57
+ /* @__PURE__ */ jsxs(
58
+ "div",
227
59
  {
228
- width: "20",
229
- height: "20",
230
- viewBox: "0 0 20 20",
231
- fill: "none",
232
- xmlns: "http://www.w3.org/2000/svg",
233
- "aria-hidden": "true",
60
+ className: "auth-layout__menu",
61
+ "data-testid": `${finalTestId}-menu`,
62
+ "data-cy": `${finalDataCy}-menu`,
234
63
  children: [
235
- /* @__PURE__ */ jsx(
236
- "path",
64
+ showSettings && /* @__PURE__ */ jsx(
65
+ MenuIconButton,
237
66
  {
238
- d: "M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",
239
- stroke: "currentColor",
240
- strokeWidth: "1.5",
241
- strokeLinecap: "round",
242
- strokeLinejoin: "round",
243
- fill: "none"
67
+ variant: "settings",
68
+ selected: activeMenu === "settings",
69
+ onClick: onSettingsClick,
70
+ "aria-label": "Settings",
71
+ "data-testid": `${finalTestId}-settings-btn`,
72
+ "data-cy": `${finalDataCy}-settings-btn`
244
73
  }
245
74
  ),
246
- /* @__PURE__ */ jsx(
247
- "circle",
75
+ showUserMenu && /* @__PURE__ */ jsx(
76
+ MenuIconButton,
248
77
  {
249
- cx: "10",
250
- cy: "10",
251
- r: "2.5",
252
- stroke: "currentColor",
253
- strokeWidth: "1.5",
254
- fill: "none"
255
- }
256
- ),
257
- /* @__PURE__ */ jsx(
258
- "path",
259
- {
260
- d: "M3 3l14 14",
261
- stroke: "currentColor",
262
- strokeWidth: "1.5",
263
- strokeLinecap: "round"
78
+ variant: "user",
79
+ initials: userInitials,
80
+ selected: activeMenu === "user",
81
+ onClick: onUserMenuClick,
82
+ "aria-label": userInitials ? `User menu - ${userInitials}` : "User menu",
83
+ "data-testid": `${finalTestId}-user-btn`,
84
+ "data-cy": `${finalDataCy}-user-btn`
264
85
  }
265
86
  )
266
87
  ]
267
88
  }
268
89
  )
269
- }
270
- )
271
- ] }),
272
- displayError && /* @__PURE__ */ jsx(
273
- "span",
274
- {
275
- id: errorId,
276
- className: "input__error",
277
- role: "alert",
278
- "data-cy": `${finalDataCy}-error`,
279
- "data-testid": `${finalTestId}-error`,
280
- children: displayError
90
+ ]
281
91
  }
282
92
  ),
283
- helperText && !displayError && /* @__PURE__ */ jsx(
284
- "span",
93
+ /* @__PURE__ */ jsx(
94
+ "main",
285
95
  {
286
- id: helperId,
287
- className: "input__helper",
288
- "data-cy": `${finalDataCy}-helper`,
289
- "data-testid": `${finalTestId}-helper`,
290
- children: helperText
96
+ className: "auth-layout__main",
97
+ "data-testid": `${finalTestId}-main`,
98
+ "data-cy": `${finalDataCy}-main`,
99
+ children: /* @__PURE__ */ jsx(
100
+ "div",
101
+ {
102
+ className: cn("auth-layout__card", `auth-layout__card--${cardSize}`),
103
+ "data-testid": `${finalTestId}-card`,
104
+ "data-cy": `${finalDataCy}-card`,
105
+ children
106
+ }
107
+ )
291
108
  }
292
109
  )
293
110
  ]
@@ -295,7 +112,7 @@ const Input = forwardRef(
295
112
  );
296
113
  }
297
114
  );
298
- Input.displayName = "Input";
115
+ AuthLayout.displayName = "AuthLayout";
299
116
  export {
300
- Input
117
+ AuthLayout
301
118
  };
package/dist/index26.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useMergedRef=function(...r){return e.useCallback(e=>{r.forEach(r=>{r&&("function"==typeof r?r(e):r.current=e)})},r)};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("react"),e=require("./index31.cjs");;/* empty css */const t=i.forwardRef(({columns:i=3,rows:t,gap:a="4",rowGap:d,columnGap:s,align:c="stretch",justify:o="stretch",autoFitMinWidth:n="15rem",className:g,children:l,style:u,"data-cy":m,"data-testid":p,...y},$)=>{const f=m||`grid-${i}col`,j=p||`grid-${i}col`,x={...u,..."auto"===i&&{"--grid-auto-fit-min":n}};return r.jsx("div",{ref:$,className:e.cn("grid",`grid--columns-${i}`,t&&`grid--rows-${t}`,`grid--gap-${a}`,d&&`grid--row-gap-${d}`,s&&`grid--column-gap-${s}`,`grid--align-${c}`,`grid--justify-${o}`,g),style:x,"data-cy":f,"data-testid":j,...y,children:l})});t.displayName="Grid",exports.Grid=t;
package/dist/index26.js CHANGED
@@ -1,16 +1,55 @@
1
- import { useCallback } from "react";
2
- function useMergedRef(...refs) {
3
- return useCallback((element) => {
4
- refs.forEach((ref) => {
5
- if (!ref) return;
6
- if (typeof ref === "function") {
7
- ref(element);
8
- } else {
9
- ref.current = element;
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { cn } from "./index31.js";
4
+ /* empty css */
5
+ const Grid = forwardRef(
6
+ ({
7
+ columns = 3,
8
+ rows,
9
+ gap = "4",
10
+ rowGap,
11
+ columnGap,
12
+ align = "stretch",
13
+ justify = "stretch",
14
+ autoFitMinWidth = "15rem",
15
+ className,
16
+ children,
17
+ style,
18
+ "data-cy": dataCy,
19
+ "data-testid": dataTestId,
20
+ ...props
21
+ }, ref) => {
22
+ const finalDataCy = dataCy || `grid-${columns}col`;
23
+ const finalTestId = dataTestId || `grid-${columns}col`;
24
+ const customStyle = {
25
+ ...style,
26
+ ...columns === "auto" && { "--grid-auto-fit-min": autoFitMinWidth }
27
+ };
28
+ return /* @__PURE__ */ jsx(
29
+ "div",
30
+ {
31
+ ref,
32
+ className: cn(
33
+ "grid",
34
+ `grid--columns-${columns}`,
35
+ rows && `grid--rows-${rows}`,
36
+ `grid--gap-${gap}`,
37
+ rowGap && `grid--row-gap-${rowGap}`,
38
+ columnGap && `grid--column-gap-${columnGap}`,
39
+ `grid--align-${align}`,
40
+ `grid--justify-${justify}`,
41
+ className
42
+ ),
43
+ style: customStyle,
44
+ "data-cy": finalDataCy,
45
+ "data-testid": finalTestId,
46
+ ...props,
47
+ children
10
48
  }
11
- });
12
- }, refs);
13
- }
49
+ );
50
+ }
51
+ );
52
+ Grid.displayName = "Grid";
14
53
  export {
15
- useMergedRef
54
+ Grid
16
55
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react");;/* empty css */const r=e.forwardRef(({size:e="md",weight:r="regular",as:a="p",color:i="text",align:s="start",truncate:c=!1,className:o="","data-cy":n,"data-testid":x,children:l,...d},u)=>{const $=n||`text-${e}-${r}`,g=x||`text-${e}-${r}`,m=["text",`text--size-${e}`,`text--weight-${r}`,`text--color-${i}`,`text--align-${s}`,c&&"text--truncate",o].filter(Boolean).join(" ");return t.jsx(a,{ref:u,className:m,"data-cy":$,"data-testid":g,...d,children:l})});r.displayName="Text",exports.Text=r;
@@ -0,0 +1,45 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ /* empty css */
4
+ const Text = forwardRef(
5
+ ({
6
+ size = "md",
7
+ weight = "regular",
8
+ as: Component = "p",
9
+ color = "text",
10
+ align = "start",
11
+ truncate = false,
12
+ className = "",
13
+ "data-cy": dataCy,
14
+ "data-testid": dataTestId,
15
+ children,
16
+ ...props
17
+ }, ref) => {
18
+ const finalDataCy = dataCy || `text-${size}-${weight}`;
19
+ const finalDataTestId = dataTestId || `text-${size}-${weight}`;
20
+ const classes = [
21
+ "text",
22
+ `text--size-${size}`,
23
+ `text--weight-${weight}`,
24
+ `text--color-${color}`,
25
+ `text--align-${align}`,
26
+ truncate && "text--truncate",
27
+ className
28
+ ].filter(Boolean).join(" ");
29
+ return /* @__PURE__ */ jsx(
30
+ Component,
31
+ {
32
+ ref,
33
+ className: classes,
34
+ "data-cy": finalDataCy,
35
+ "data-testid": finalDataTestId,
36
+ ...props,
37
+ children
38
+ }
39
+ );
40
+ }
41
+ );
42
+ Text.displayName = "Text";
43
+ export {
44
+ Text
45
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react");;/* empty css */const i={1:"2xl",2:"xl",3:"lg",4:"md",5:"sm",6:"xs"},t=a.forwardRef(({level:a=2,size:t,weight:r="bold",color:d="text",align:n="start",className:s="","data-cy":l,"data-testid":o,children:c,...g},h)=>{const x=t??i[a],$=l||`heading-h${a}-${x}`,u=o||`heading-h${a}-${x}`,m=["heading",`heading--size-${x}`,`heading--weight-${r}`,`heading--color-${d}`,`heading--align-${n}`,s].filter(Boolean).join(" "),f=`h${a}`;return e.jsx(f,{ref:h,className:m,"data-cy":$,"data-testid":u,...g,children:c})});t.displayName="Heading",exports.Heading=t;
@@ -0,0 +1,53 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ /* empty css */
4
+ const levelToSizeMap = {
5
+ 1: "2xl",
6
+ 2: "xl",
7
+ 3: "lg",
8
+ 4: "md",
9
+ 5: "sm",
10
+ 6: "xs"
11
+ };
12
+ const Heading = forwardRef(
13
+ ({
14
+ level = 2,
15
+ size,
16
+ weight = "bold",
17
+ color = "text",
18
+ align = "start",
19
+ className = "",
20
+ "data-cy": dataCy,
21
+ "data-testid": dataTestId,
22
+ children,
23
+ ...props
24
+ }, ref) => {
25
+ const resolvedSize = size ?? levelToSizeMap[level];
26
+ const finalDataCy = dataCy || `heading-h${level}-${resolvedSize}`;
27
+ const finalDataTestId = dataTestId || `heading-h${level}-${resolvedSize}`;
28
+ const classes = [
29
+ "heading",
30
+ `heading--size-${resolvedSize}`,
31
+ `heading--weight-${weight}`,
32
+ `heading--color-${color}`,
33
+ `heading--align-${align}`,
34
+ className
35
+ ].filter(Boolean).join(" ");
36
+ const Tag = `h${level}`;
37
+ return /* @__PURE__ */ jsx(
38
+ Tag,
39
+ {
40
+ ref,
41
+ className: classes,
42
+ "data-cy": finalDataCy,
43
+ "data-testid": finalDataTestId,
44
+ ...props,
45
+ children
46
+ }
47
+ );
48
+ }
49
+ );
50
+ Heading.displayName = "Heading";
51
+ export {
52
+ Heading
53
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react");;/* empty css */const n=i.forwardRef(({children:i,color:n="action",size:r="md",weight:t="medium",underline:l=!1,disabled:a=!1,href:d,onClick:o,"data-cy":s,"data-testid":c,...u},k)=>{const f=s||"link",m=c||"link",b=["link",`link--color-${n}`,`link--size-${r}`,`link--weight-${t}`,l&&"link--underline",a&&"link--disabled"].filter(Boolean).join(" ");return e.jsx("a",{ref:k,href:a?void 0:d,onClick:e=>{a?e.preventDefault():null==o||o(e)},className:b,"aria-disabled":a,tabIndex:a?-1:void 0,"data-cy":f,"data-testid":m,...u,children:i})});n.displayName="Link",exports.Link=n;
@@ -0,0 +1,55 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ /* empty css */
4
+ const Link = forwardRef(
5
+ ({
6
+ children,
7
+ color = "action",
8
+ size = "md",
9
+ weight = "medium",
10
+ underline = false,
11
+ disabled = false,
12
+ href,
13
+ onClick,
14
+ "data-cy": dataCy,
15
+ "data-testid": dataTestId,
16
+ ...props
17
+ }, ref) => {
18
+ const finalDataCy = dataCy || "link";
19
+ const finalDataTestId = dataTestId || "link";
20
+ const classes = [
21
+ "link",
22
+ `link--color-${color}`,
23
+ `link--size-${size}`,
24
+ `link--weight-${weight}`,
25
+ underline && "link--underline",
26
+ disabled && "link--disabled"
27
+ ].filter(Boolean).join(" ");
28
+ const handleClick = (e) => {
29
+ if (disabled) {
30
+ e.preventDefault();
31
+ return;
32
+ }
33
+ onClick == null ? void 0 : onClick(e);
34
+ };
35
+ return /* @__PURE__ */ jsx(
36
+ "a",
37
+ {
38
+ ref,
39
+ href: disabled ? void 0 : href,
40
+ onClick: handleClick,
41
+ className: classes,
42
+ "aria-disabled": disabled,
43
+ tabIndex: disabled ? -1 : void 0,
44
+ "data-cy": finalDataCy,
45
+ "data-testid": finalDataTestId,
46
+ ...props,
47
+ children
48
+ }
49
+ );
50
+ }
51
+ );
52
+ Link.displayName = "Link";
53
+ export {
54
+ Link
55
+ };
package/dist/index3.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),e=require("react"),t=require("email-validator"),i=require("./index25.cjs"),l=e.forwardRef(({validateEmail:l=!0,invalidEmailMessage:r="Not a valid email address",validate:d,"data-cy":s,"data-testid":u,...n},o)=>{const m=e.useCallback(a=>{if(a)return t.validate(a)?void 0:r},[r]),c=e.useCallback(a=>l?d?m(a)||d(a):m(a):null==d?void 0:d(a),[l,d,m]);return a.jsx(i.Input,{ref:o,type:"email",validate:c,"data-cy":s||"email-input","data-testid":u||"email-input",...n})});l.displayName="EmailInput",exports.EmailInput=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),n=require("./index31.cjs"),a=require("@adam-milo/icons");;/* empty css */const i={sm:"sm",md:"md",lg:"lg"},o=t.forwardRef(({size:t="md",icon:o,children:c,disabled:r,"aria-label":s,"data-testid":d,"data-cy":l,...u},b)=>{const m=n.cn("icon-btn",`icon-btn--${t}`);return e.jsxs("button",{ref:b,type:"button",disabled:r,className:m,"aria-label":c?void 0:s,"data-testid":d||"icon-button","data-cy":l||"icon-button",...u,children:[e.jsx(a.Icon,{name:o,size:i[t],decorative:!!c}),c&&e.jsx("span",{className:"icon-btn__text","data-cy":"icon-button-text",children:c})]})});o.displayName="IconButton",exports.IconButton=o;