@axenstudio/axen-form 0.1.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.
Files changed (210) hide show
  1. package/README.md +665 -0
  2. package/dist/adapters/yupAdapter.cjs +61 -0
  3. package/dist/adapters/yupAdapter.d.ts +21 -0
  4. package/dist/adapters/yupAdapter.d.ts.map +1 -0
  5. package/dist/adapters/yupAdapter.js +61 -0
  6. package/dist/adapters/zodAdapter.cjs +59 -0
  7. package/dist/adapters/zodAdapter.d.ts +22 -0
  8. package/dist/adapters/zodAdapter.d.ts.map +1 -0
  9. package/dist/adapters/zodAdapter.js +59 -0
  10. package/dist/core/dateUtils.cjs +69 -0
  11. package/dist/core/dateUtils.d.ts +28 -0
  12. package/dist/core/dateUtils.d.ts.map +1 -0
  13. package/dist/core/dateUtils.js +69 -0
  14. package/dist/core/formStore.cjs +184 -0
  15. package/dist/core/formStore.d.ts +39 -0
  16. package/dist/core/formStore.d.ts.map +1 -0
  17. package/dist/core/formStore.js +184 -0
  18. package/dist/core/numberUtils.cjs +59 -0
  19. package/dist/core/numberUtils.d.ts +26 -0
  20. package/dist/core/numberUtils.d.ts.map +1 -0
  21. package/dist/core/numberUtils.js +59 -0
  22. package/dist/core/pathUtils.cjs +44 -0
  23. package/dist/core/pathUtils.d.ts +15 -0
  24. package/dist/core/pathUtils.d.ts.map +1 -0
  25. package/dist/core/pathUtils.js +44 -0
  26. package/dist/core/payloadUtils.cjs +26 -0
  27. package/dist/core/payloadUtils.d.ts +22 -0
  28. package/dist/core/payloadUtils.d.ts.map +1 -0
  29. package/dist/core/payloadUtils.js +26 -0
  30. package/dist/core/validation.cjs +41 -0
  31. package/dist/core/validation.d.ts +7 -0
  32. package/dist/core/validation.d.ts.map +1 -0
  33. package/dist/core/validation.js +41 -0
  34. package/dist/fields/AutocompleteField/AutocompleteField.cjs +242 -0
  35. package/dist/fields/AutocompleteField/AutocompleteField.d.ts +6 -0
  36. package/dist/fields/AutocompleteField/AutocompleteField.d.ts.map +1 -0
  37. package/dist/fields/AutocompleteField/AutocompleteField.js +242 -0
  38. package/dist/fields/AutocompleteField/AutocompleteField.module.css +168 -0
  39. package/dist/fields/AutocompleteField/AutocompleteField.module.css.cjs +44 -0
  40. package/dist/fields/AutocompleteField/AutocompleteField.module.css.js +44 -0
  41. package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.cjs +286 -0
  42. package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.d.ts +6 -0
  43. package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.d.ts.map +1 -0
  44. package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.js +286 -0
  45. package/dist/fields/AutocompletePredictField/AutocompletePredictField.cjs +289 -0
  46. package/dist/fields/AutocompletePredictField/AutocompletePredictField.d.ts +10 -0
  47. package/dist/fields/AutocompletePredictField/AutocompletePredictField.d.ts.map +1 -0
  48. package/dist/fields/AutocompletePredictField/AutocompletePredictField.js +289 -0
  49. package/dist/fields/CheckboxField/CheckboxField.cjs +60 -0
  50. package/dist/fields/CheckboxField/CheckboxField.d.ts +3 -0
  51. package/dist/fields/CheckboxField/CheckboxField.d.ts.map +1 -0
  52. package/dist/fields/CheckboxField/CheckboxField.js +60 -0
  53. package/dist/fields/CheckboxField/CheckboxField.module.css +29 -0
  54. package/dist/fields/CheckboxField/CheckboxField.module.css.cjs +11 -0
  55. package/dist/fields/CheckboxField/CheckboxField.module.css.js +11 -0
  56. package/dist/fields/ColorField/ColorField.cjs +69 -0
  57. package/dist/fields/ColorField/ColorField.d.ts +3 -0
  58. package/dist/fields/ColorField/ColorField.d.ts.map +1 -0
  59. package/dist/fields/ColorField/ColorField.js +69 -0
  60. package/dist/fields/ColorField/ColorField.module.css +33 -0
  61. package/dist/fields/ColorField/ColorField.module.css.cjs +14 -0
  62. package/dist/fields/ColorField/ColorField.module.css.js +14 -0
  63. package/dist/fields/CurrencyField/CurrencyField.cjs +120 -0
  64. package/dist/fields/CurrencyField/CurrencyField.d.ts +10 -0
  65. package/dist/fields/CurrencyField/CurrencyField.d.ts.map +1 -0
  66. package/dist/fields/CurrencyField/CurrencyField.js +120 -0
  67. package/dist/fields/DateField/DateField.cjs +70 -0
  68. package/dist/fields/DateField/DateField.d.ts +7 -0
  69. package/dist/fields/DateField/DateField.d.ts.map +1 -0
  70. package/dist/fields/DateField/DateField.js +70 -0
  71. package/dist/fields/DateTimeField/DateTimeField.cjs +71 -0
  72. package/dist/fields/DateTimeField/DateTimeField.d.ts +8 -0
  73. package/dist/fields/DateTimeField/DateTimeField.d.ts.map +1 -0
  74. package/dist/fields/DateTimeField/DateTimeField.js +71 -0
  75. package/dist/fields/EmailField/EmailField.cjs +57 -0
  76. package/dist/fields/EmailField/EmailField.d.ts +3 -0
  77. package/dist/fields/EmailField/EmailField.d.ts.map +1 -0
  78. package/dist/fields/EmailField/EmailField.js +57 -0
  79. package/dist/fields/NumberField/NumberField.cjs +110 -0
  80. package/dist/fields/NumberField/NumberField.d.ts +10 -0
  81. package/dist/fields/NumberField/NumberField.d.ts.map +1 -0
  82. package/dist/fields/NumberField/NumberField.js +110 -0
  83. package/dist/fields/PasswordField/PasswordField.cjs +77 -0
  84. package/dist/fields/PasswordField/PasswordField.d.ts +3 -0
  85. package/dist/fields/PasswordField/PasswordField.d.ts.map +1 -0
  86. package/dist/fields/PasswordField/PasswordField.js +77 -0
  87. package/dist/fields/PasswordField/PasswordField.module.css +41 -0
  88. package/dist/fields/PasswordField/PasswordField.module.css.cjs +14 -0
  89. package/dist/fields/PasswordField/PasswordField.module.css.js +14 -0
  90. package/dist/fields/PhoneField/PhoneField.cjs +58 -0
  91. package/dist/fields/PhoneField/PhoneField.d.ts +3 -0
  92. package/dist/fields/PhoneField/PhoneField.d.ts.map +1 -0
  93. package/dist/fields/PhoneField/PhoneField.js +58 -0
  94. package/dist/fields/RadioField/RadioField.cjs +66 -0
  95. package/dist/fields/RadioField/RadioField.d.ts +3 -0
  96. package/dist/fields/RadioField/RadioField.d.ts.map +1 -0
  97. package/dist/fields/RadioField/RadioField.js +66 -0
  98. package/dist/fields/RadioField/RadioField.module.css +34 -0
  99. package/dist/fields/RadioField/RadioField.module.css.cjs +14 -0
  100. package/dist/fields/RadioField/RadioField.module.css.js +14 -0
  101. package/dist/fields/SelectField/SelectField.cjs +58 -0
  102. package/dist/fields/SelectField/SelectField.d.ts +3 -0
  103. package/dist/fields/SelectField/SelectField.d.ts.map +1 -0
  104. package/dist/fields/SelectField/SelectField.js +58 -0
  105. package/dist/fields/SliderField/SliderField.cjs +79 -0
  106. package/dist/fields/SliderField/SliderField.d.ts +7 -0
  107. package/dist/fields/SliderField/SliderField.d.ts.map +1 -0
  108. package/dist/fields/SliderField/SliderField.js +79 -0
  109. package/dist/fields/SliderField/SliderField.module.css +76 -0
  110. package/dist/fields/SliderField/SliderField.module.css.cjs +14 -0
  111. package/dist/fields/SliderField/SliderField.module.css.js +14 -0
  112. package/dist/fields/SwitchField/SwitchField.cjs +65 -0
  113. package/dist/fields/SwitchField/SwitchField.d.ts +3 -0
  114. package/dist/fields/SwitchField/SwitchField.d.ts.map +1 -0
  115. package/dist/fields/SwitchField/SwitchField.js +65 -0
  116. package/dist/fields/SwitchField/SwitchField.module.css +79 -0
  117. package/dist/fields/SwitchField/SwitchField.module.css.cjs +17 -0
  118. package/dist/fields/SwitchField/SwitchField.module.css.js +17 -0
  119. package/dist/fields/TextField/TextField.cjs +56 -0
  120. package/dist/fields/TextField/TextField.d.ts +3 -0
  121. package/dist/fields/TextField/TextField.d.ts.map +1 -0
  122. package/dist/fields/TextField/TextField.js +56 -0
  123. package/dist/fields/TextareaField/TextareaField.cjs +57 -0
  124. package/dist/fields/TextareaField/TextareaField.d.ts +5 -0
  125. package/dist/fields/TextareaField/TextareaField.d.ts.map +1 -0
  126. package/dist/fields/TextareaField/TextareaField.js +57 -0
  127. package/dist/fields/TimeField/TimeField.cjs +67 -0
  128. package/dist/fields/TimeField/TimeField.d.ts +6 -0
  129. package/dist/fields/TimeField/TimeField.d.ts.map +1 -0
  130. package/dist/fields/TimeField/TimeField.js +67 -0
  131. package/dist/fields/defaultComponentMap.cjs +43 -0
  132. package/dist/fields/defaultComponentMap.d.ts +7 -0
  133. package/dist/fields/defaultComponentMap.d.ts.map +1 -0
  134. package/dist/fields/defaultComponentMap.js +43 -0
  135. package/dist/fields/fieldBase.module.css +201 -0
  136. package/dist/fields/fieldBase.module.css.cjs +50 -0
  137. package/dist/fields/fieldBase.module.css.js +50 -0
  138. package/dist/fields/fieldUtils.cjs +26 -0
  139. package/dist/fields/fieldUtils.d.ts +24 -0
  140. package/dist/fields/fieldUtils.d.ts.map +1 -0
  141. package/dist/fields/fieldUtils.js +26 -0
  142. package/dist/index.cjs +99 -0
  143. package/dist/index.d.ts +42 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +99 -0
  146. package/dist/layout/Box/Box.cjs +70 -0
  147. package/dist/layout/Box/Box.d.ts +6 -0
  148. package/dist/layout/Box/Box.d.ts.map +1 -0
  149. package/dist/layout/Box/Box.js +70 -0
  150. package/dist/layout/Box/Box.module.css +3 -0
  151. package/dist/layout/Box/Box.module.css.cjs +8 -0
  152. package/dist/layout/Box/Box.module.css.js +8 -0
  153. package/dist/layout/Divider/Divider.cjs +20 -0
  154. package/dist/layout/Divider/Divider.d.ts +6 -0
  155. package/dist/layout/Divider/Divider.d.ts.map +1 -0
  156. package/dist/layout/Divider/Divider.js +20 -0
  157. package/dist/layout/Divider/Divider.module.css +25 -0
  158. package/dist/layout/Divider/Divider.module.css.cjs +14 -0
  159. package/dist/layout/Divider/Divider.module.css.js +14 -0
  160. package/dist/layout/Grid/Grid.cjs +106 -0
  161. package/dist/layout/Grid/Grid.d.ts +7 -0
  162. package/dist/layout/Grid/Grid.d.ts.map +1 -0
  163. package/dist/layout/Grid/Grid.js +106 -0
  164. package/dist/layout/Grid/Grid.module.css +43 -0
  165. package/dist/layout/Grid/Grid.module.css.cjs +23 -0
  166. package/dist/layout/Grid/Grid.module.css.js +23 -0
  167. package/dist/layout/Spacer/Spacer.cjs +30 -0
  168. package/dist/layout/Spacer/Spacer.d.ts +21 -0
  169. package/dist/layout/Spacer/Spacer.d.ts.map +1 -0
  170. package/dist/layout/Spacer/Spacer.js +30 -0
  171. package/dist/layout/Stack/Stack.cjs +52 -0
  172. package/dist/layout/Stack/Stack.d.ts +7 -0
  173. package/dist/layout/Stack/Stack.d.ts.map +1 -0
  174. package/dist/layout/Stack/Stack.js +52 -0
  175. package/dist/layout/Stack/Stack.module.css +3 -0
  176. package/dist/layout/Stack/Stack.module.css.cjs +8 -0
  177. package/dist/layout/Stack/Stack.module.css.js +8 -0
  178. package/dist/layout/index.d.ts +6 -0
  179. package/dist/layout/index.d.ts.map +1 -0
  180. package/dist/react/AxenArrayField.cjs +80 -0
  181. package/dist/react/AxenArrayField.d.ts +15 -0
  182. package/dist/react/AxenArrayField.d.ts.map +1 -0
  183. package/dist/react/AxenArrayField.js +80 -0
  184. package/dist/react/AxenField.cjs +62 -0
  185. package/dist/react/AxenField.d.ts +13 -0
  186. package/dist/react/AxenField.d.ts.map +1 -0
  187. package/dist/react/AxenField.js +62 -0
  188. package/dist/react/AxenForm.cjs +134 -0
  189. package/dist/react/AxenForm.d.ts +7 -0
  190. package/dist/react/AxenForm.d.ts.map +1 -0
  191. package/dist/react/AxenForm.js +134 -0
  192. package/dist/react/FormContext.cjs +13 -0
  193. package/dist/react/FormContext.d.ts +11 -0
  194. package/dist/react/FormContext.d.ts.map +1 -0
  195. package/dist/react/FormContext.js +13 -0
  196. package/dist/react/useAxenForm.cjs +88 -0
  197. package/dist/react/useAxenForm.d.ts +8 -0
  198. package/dist/react/useAxenForm.d.ts.map +1 -0
  199. package/dist/react/useAxenForm.js +88 -0
  200. package/dist/react/useField.cjs +41 -0
  201. package/dist/react/useField.d.ts +13 -0
  202. package/dist/react/useField.d.ts.map +1 -0
  203. package/dist/react/useField.js +41 -0
  204. package/dist/react/useFieldArray.cjs +74 -0
  205. package/dist/react/useFieldArray.d.ts +5 -0
  206. package/dist/react/useFieldArray.d.ts.map +1 -0
  207. package/dist/react/useFieldArray.js +74 -0
  208. package/dist/types.d.ts +226 -0
  209. package/dist/types.d.ts.map +1 -0
  210. package/package.json +87 -0
@@ -0,0 +1,77 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useCallback } from "react";
3
+ import styles from "../fieldBase.module.css.js";
4
+ import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
5
+ import localStyles from "./PasswordField.module.css.js";
6
+ function PasswordField({
7
+ name,
8
+ value,
9
+ onChange,
10
+ onBlur,
11
+ error,
12
+ helperText,
13
+ label,
14
+ placeholder,
15
+ disabled,
16
+ readOnly,
17
+ required
18
+ }) {
19
+ const [visible, setVisible] = useState(false);
20
+ const aria = ariaProps(name, { error, helperText, required, label });
21
+ const toggleVisible = useCallback(() => {
22
+ setVisible((v) => !v);
23
+ }, []);
24
+ return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
25
+ label && /* @__PURE__ */ jsx(
26
+ "label",
27
+ {
28
+ id: labelId(name),
29
+ htmlFor: name,
30
+ className: cx(styles.label, required && styles.labelRequired),
31
+ children: label
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsxs("div", { className: localStyles.inputWrap, children: [
35
+ /* @__PURE__ */ jsx(
36
+ "input",
37
+ {
38
+ ...aria,
39
+ type: visible ? "text" : "password",
40
+ name,
41
+ value: value ?? "",
42
+ onChange,
43
+ onBlur,
44
+ placeholder,
45
+ disabled,
46
+ readOnly,
47
+ autoComplete: "current-password",
48
+ className: cx(styles.input, error && styles.inputError, localStyles.passwordInput)
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsx(
52
+ "button",
53
+ {
54
+ type: "button",
55
+ className: localStyles.toggle,
56
+ onClick: toggleVisible,
57
+ "aria-label": visible ? "Hide password" : "Show password",
58
+ tabIndex: -1,
59
+ disabled,
60
+ children: visible ? "◉" : "○"
61
+ }
62
+ )
63
+ ] }),
64
+ helperText && /* @__PURE__ */ jsx(
65
+ "span",
66
+ {
67
+ id: helperId(name),
68
+ className: cx(styles.helperText, error && styles.helperTextError),
69
+ role: error ? "alert" : void 0,
70
+ children: helperText
71
+ }
72
+ )
73
+ ] });
74
+ }
75
+ export {
76
+ PasswordField
77
+ };
@@ -0,0 +1,41 @@
1
+ ._inputWrap_1nxa7_1 {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ }
6
+
7
+ ._passwordInput_1nxa7_7 {
8
+ padding-right: 2.5rem;
9
+ }
10
+
11
+ ._toggle_1nxa7_11 {
12
+ position: absolute;
13
+ right: 0.5rem;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ width: 2rem;
18
+ height: 2rem;
19
+ padding: 0;
20
+ border: none;
21
+ background: transparent;
22
+ cursor: pointer;
23
+ color: var(--axen-color-text-secondary);
24
+ font-size: var(--axen-font-size-lg);
25
+ border-radius: var(--axen-border-radius-sm);
26
+ transition: color var(--axen-transition-fast);
27
+ }
28
+
29
+ ._toggle_1nxa7_11:hover:not(:disabled) {
30
+ color: var(--axen-color-text);
31
+ }
32
+
33
+ ._toggle_1nxa7_11:focus-visible {
34
+ outline: var(--axen-focus-ring-width) solid var(--axen-focus-ring-color);
35
+ outline-offset: var(--axen-focus-ring-offset);
36
+ }
37
+
38
+ ._toggle_1nxa7_11:disabled {
39
+ cursor: not-allowed;
40
+ opacity: 0.5;
41
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const inputWrap = "_inputWrap_1nxa7_1";
4
+ const passwordInput = "_passwordInput_1nxa7_7";
5
+ const toggle = "_toggle_1nxa7_11";
6
+ const localStyles = {
7
+ inputWrap,
8
+ passwordInput,
9
+ toggle
10
+ };
11
+ exports.default = localStyles;
12
+ exports.inputWrap = inputWrap;
13
+ exports.passwordInput = passwordInput;
14
+ exports.toggle = toggle;
@@ -0,0 +1,14 @@
1
+ const inputWrap = "_inputWrap_1nxa7_1";
2
+ const passwordInput = "_passwordInput_1nxa7_7";
3
+ const toggle = "_toggle_1nxa7_11";
4
+ const localStyles = {
5
+ inputWrap,
6
+ passwordInput,
7
+ toggle
8
+ };
9
+ export {
10
+ localStyles as default,
11
+ inputWrap,
12
+ passwordInput,
13
+ toggle
14
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const fieldBase_module = require("../fieldBase.module.css.cjs");
5
+ const fieldUtils = require("../fieldUtils.cjs");
6
+ function PhoneField({
7
+ name,
8
+ value,
9
+ onChange,
10
+ onBlur,
11
+ error,
12
+ helperText,
13
+ label,
14
+ placeholder,
15
+ disabled,
16
+ readOnly,
17
+ required
18
+ }) {
19
+ const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
20
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
21
+ label && /* @__PURE__ */ jsxRuntime.jsx(
22
+ "label",
23
+ {
24
+ id: fieldUtils.labelId(name),
25
+ htmlFor: name,
26
+ className: fieldUtils.cx(fieldBase_module.default.label, required && fieldBase_module.default.labelRequired),
27
+ children: label
28
+ }
29
+ ),
30
+ /* @__PURE__ */ jsxRuntime.jsx(
31
+ "input",
32
+ {
33
+ ...aria,
34
+ type: "tel",
35
+ name,
36
+ value: value ?? "",
37
+ onChange,
38
+ onBlur,
39
+ placeholder: placeholder ?? "+1 (555) 000-0000",
40
+ disabled,
41
+ readOnly,
42
+ autoComplete: "tel",
43
+ inputMode: "tel",
44
+ className: fieldUtils.cx(fieldBase_module.default.input, error && fieldBase_module.default.inputError)
45
+ }
46
+ ),
47
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(
48
+ "span",
49
+ {
50
+ id: fieldUtils.helperId(name),
51
+ className: fieldUtils.cx(fieldBase_module.default.helperText, error && fieldBase_module.default.helperTextError),
52
+ role: error ? "alert" : void 0,
53
+ children: helperText
54
+ }
55
+ )
56
+ ] });
57
+ }
58
+ exports.PhoneField = PhoneField;
@@ -0,0 +1,3 @@
1
+ import { FieldComponentProps } from '../../types';
2
+ export declare function PhoneField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=PhoneField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneField.d.ts","sourceRoot":"","sources":["../../../src/fields/PhoneField/PhoneField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAuC/B"}
@@ -0,0 +1,58 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import styles from "../fieldBase.module.css.js";
3
+ import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
4
+ function PhoneField({
5
+ name,
6
+ value,
7
+ onChange,
8
+ onBlur,
9
+ error,
10
+ helperText,
11
+ label,
12
+ placeholder,
13
+ disabled,
14
+ readOnly,
15
+ required
16
+ }) {
17
+ const aria = ariaProps(name, { error, helperText, required, label });
18
+ return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
19
+ label && /* @__PURE__ */ jsx(
20
+ "label",
21
+ {
22
+ id: labelId(name),
23
+ htmlFor: name,
24
+ className: cx(styles.label, required && styles.labelRequired),
25
+ children: label
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsx(
29
+ "input",
30
+ {
31
+ ...aria,
32
+ type: "tel",
33
+ name,
34
+ value: value ?? "",
35
+ onChange,
36
+ onBlur,
37
+ placeholder: placeholder ?? "+1 (555) 000-0000",
38
+ disabled,
39
+ readOnly,
40
+ autoComplete: "tel",
41
+ inputMode: "tel",
42
+ className: cx(styles.input, error && styles.inputError)
43
+ }
44
+ ),
45
+ helperText && /* @__PURE__ */ jsx(
46
+ "span",
47
+ {
48
+ id: helperId(name),
49
+ className: cx(styles.helperText, error && styles.helperTextError),
50
+ role: error ? "alert" : void 0,
51
+ children: helperText
52
+ }
53
+ )
54
+ ] });
55
+ }
56
+ export {
57
+ PhoneField
58
+ };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const fieldBase_module = require("../fieldBase.module.css.cjs");
6
+ const fieldUtils = require("../fieldUtils.cjs");
7
+ const RadioField_module = require("./RadioField.module.css.cjs");
8
+ function RadioField({
9
+ name,
10
+ value,
11
+ onChange: _onChange,
12
+ onBlur,
13
+ error,
14
+ helperText,
15
+ label,
16
+ disabled,
17
+ readOnly,
18
+ required,
19
+ options,
20
+ form
21
+ }) {
22
+ const handleChange = react.useCallback(
23
+ (optionValue) => {
24
+ if (readOnly) return;
25
+ form.setFieldValue(name, optionValue);
26
+ },
27
+ [form, name, readOnly]
28
+ );
29
+ return /* @__PURE__ */ jsxRuntime.jsxs(
30
+ "div",
31
+ {
32
+ className: fieldBase_module.default.wrapper,
33
+ role: "radiogroup",
34
+ "aria-labelledby": label ? fieldUtils.labelId(name) : void 0,
35
+ children: [
36
+ label && /* @__PURE__ */ jsxRuntime.jsx("span", { id: fieldUtils.labelId(name), className: fieldUtils.cx(fieldBase_module.default.label, required && fieldBase_module.default.labelRequired), children: label }),
37
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: RadioField_module.default.radioGroup, children: options == null ? void 0 : options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: fieldUtils.cx(fieldBase_module.default.inlineWrapper, RadioField_module.default.radioLabel), children: [
38
+ /* @__PURE__ */ jsxRuntime.jsx(
39
+ "input",
40
+ {
41
+ type: "radio",
42
+ name,
43
+ value: String(opt.value),
44
+ checked: value === opt.value,
45
+ onChange: () => handleChange(opt.value),
46
+ onBlur,
47
+ disabled: disabled || opt.disabled,
48
+ className: RadioField_module.default.radio
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.inlineLabel, children: opt.label })
52
+ ] }, opt.value)) }),
53
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(
54
+ "span",
55
+ {
56
+ id: fieldUtils.helperId(name),
57
+ className: fieldUtils.cx(fieldBase_module.default.helperText, error && fieldBase_module.default.helperTextError),
58
+ role: error ? "alert" : void 0,
59
+ children: helperText
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ }
66
+ exports.RadioField = RadioField;
@@ -0,0 +1,3 @@
1
+ import { FieldComponentProps } from '../../types';
2
+ export declare function RadioField({ name, value, onChange: _onChange, onBlur, error, helperText, label, disabled, readOnly, required, options, form, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=RadioField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioField.d.ts","sourceRoot":"","sources":["../../../src/fields/RadioField/RadioField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,SAAS,EACnB,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,IAAI,GACL,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAgD/B"}
@@ -0,0 +1,66 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import styles from "../fieldBase.module.css.js";
4
+ import { cx, labelId, helperId } from "../fieldUtils.js";
5
+ import localStyles from "./RadioField.module.css.js";
6
+ function RadioField({
7
+ name,
8
+ value,
9
+ onChange: _onChange,
10
+ onBlur,
11
+ error,
12
+ helperText,
13
+ label,
14
+ disabled,
15
+ readOnly,
16
+ required,
17
+ options,
18
+ form
19
+ }) {
20
+ const handleChange = useCallback(
21
+ (optionValue) => {
22
+ if (readOnly) return;
23
+ form.setFieldValue(name, optionValue);
24
+ },
25
+ [form, name, readOnly]
26
+ );
27
+ return /* @__PURE__ */ jsxs(
28
+ "div",
29
+ {
30
+ className: styles.wrapper,
31
+ role: "radiogroup",
32
+ "aria-labelledby": label ? labelId(name) : void 0,
33
+ children: [
34
+ label && /* @__PURE__ */ jsx("span", { id: labelId(name), className: cx(styles.label, required && styles.labelRequired), children: label }),
35
+ /* @__PURE__ */ jsx("div", { className: localStyles.radioGroup, children: options == null ? void 0 : options.map((opt) => /* @__PURE__ */ jsxs("label", { className: cx(styles.inlineWrapper, localStyles.radioLabel), children: [
36
+ /* @__PURE__ */ jsx(
37
+ "input",
38
+ {
39
+ type: "radio",
40
+ name,
41
+ value: String(opt.value),
42
+ checked: value === opt.value,
43
+ onChange: () => handleChange(opt.value),
44
+ onBlur,
45
+ disabled: disabled || opt.disabled,
46
+ className: localStyles.radio
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsx("span", { className: styles.inlineLabel, children: opt.label })
50
+ ] }, opt.value)) }),
51
+ helperText && /* @__PURE__ */ jsx(
52
+ "span",
53
+ {
54
+ id: helperId(name),
55
+ className: cx(styles.helperText, error && styles.helperTextError),
56
+ role: error ? "alert" : void 0,
57
+ children: helperText
58
+ }
59
+ )
60
+ ]
61
+ }
62
+ );
63
+ }
64
+ export {
65
+ RadioField
66
+ };
@@ -0,0 +1,34 @@
1
+ ._radioGroup_1nz5i_1 {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--axen-space-xs);
5
+ }
6
+
7
+ ._radioLabel_1nz5i_7 {
8
+ cursor: pointer;
9
+ }
10
+
11
+ ._radio_1nz5i_1 {
12
+ width: 20px;
13
+ height: 20px;
14
+ margin: 0;
15
+ cursor: pointer;
16
+ accent-color: var(--axen-color-primary);
17
+ }
18
+
19
+ ._radio_1nz5i_1:focus-visible {
20
+ outline: var(--axen-focus-ring-width) solid var(--axen-focus-ring-color);
21
+ outline-offset: var(--axen-focus-ring-offset);
22
+ }
23
+
24
+ ._radio_1nz5i_1:disabled {
25
+ cursor: not-allowed;
26
+ }
27
+
28
+ /* Mobile: larger touch target */
29
+ @media (max-width: 599px) {
30
+ ._radio_1nz5i_1 {
31
+ width: 24px;
32
+ height: 24px;
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const radioGroup = "_radioGroup_1nz5i_1";
4
+ const radioLabel = "_radioLabel_1nz5i_7";
5
+ const radio = "_radio_1nz5i_1";
6
+ const localStyles = {
7
+ radioGroup,
8
+ radioLabel,
9
+ radio
10
+ };
11
+ exports.default = localStyles;
12
+ exports.radio = radio;
13
+ exports.radioGroup = radioGroup;
14
+ exports.radioLabel = radioLabel;
@@ -0,0 +1,14 @@
1
+ const radioGroup = "_radioGroup_1nz5i_1";
2
+ const radioLabel = "_radioLabel_1nz5i_7";
3
+ const radio = "_radio_1nz5i_1";
4
+ const localStyles = {
5
+ radioGroup,
6
+ radioLabel,
7
+ radio
8
+ };
9
+ export {
10
+ localStyles as default,
11
+ radio,
12
+ radioGroup,
13
+ radioLabel
14
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const fieldBase_module = require("../fieldBase.module.css.cjs");
5
+ const fieldUtils = require("../fieldUtils.cjs");
6
+ function SelectField({
7
+ name,
8
+ value,
9
+ onChange,
10
+ onBlur,
11
+ error,
12
+ helperText,
13
+ label,
14
+ placeholder,
15
+ disabled,
16
+ readOnly,
17
+ required,
18
+ options
19
+ }) {
20
+ const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
21
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
22
+ label && /* @__PURE__ */ jsxRuntime.jsx(
23
+ "label",
24
+ {
25
+ id: fieldUtils.labelId(name),
26
+ htmlFor: name,
27
+ className: fieldUtils.cx(fieldBase_module.default.label, required && fieldBase_module.default.labelRequired),
28
+ children: label
29
+ }
30
+ ),
31
+ /* @__PURE__ */ jsxRuntime.jsxs(
32
+ "select",
33
+ {
34
+ ...aria,
35
+ name,
36
+ value: value ?? "",
37
+ onChange,
38
+ onBlur,
39
+ disabled: disabled || readOnly,
40
+ className: fieldUtils.cx(fieldBase_module.default.input, fieldBase_module.default.select, error && fieldBase_module.default.inputError),
41
+ children: [
42
+ placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: placeholder }),
43
+ options == null ? void 0 : options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value))
44
+ ]
45
+ }
46
+ ),
47
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(
48
+ "span",
49
+ {
50
+ id: fieldUtils.helperId(name),
51
+ className: fieldUtils.cx(fieldBase_module.default.helperText, error && fieldBase_module.default.helperTextError),
52
+ role: error ? "alert" : void 0,
53
+ children: helperText
54
+ }
55
+ )
56
+ ] });
57
+ }
58
+ exports.SelectField = SelectField;
@@ -0,0 +1,3 @@
1
+ import { FieldComponentProps } from '../../types';
2
+ export declare function SelectField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=SelectField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../src/fields/SelectField/SelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CA6C/B"}
@@ -0,0 +1,58 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import styles from "../fieldBase.module.css.js";
3
+ import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
4
+ function SelectField({
5
+ name,
6
+ value,
7
+ onChange,
8
+ onBlur,
9
+ error,
10
+ helperText,
11
+ label,
12
+ placeholder,
13
+ disabled,
14
+ readOnly,
15
+ required,
16
+ options
17
+ }) {
18
+ const aria = ariaProps(name, { error, helperText, required, label });
19
+ return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
20
+ label && /* @__PURE__ */ jsx(
21
+ "label",
22
+ {
23
+ id: labelId(name),
24
+ htmlFor: name,
25
+ className: cx(styles.label, required && styles.labelRequired),
26
+ children: label
27
+ }
28
+ ),
29
+ /* @__PURE__ */ jsxs(
30
+ "select",
31
+ {
32
+ ...aria,
33
+ name,
34
+ value: value ?? "",
35
+ onChange,
36
+ onBlur,
37
+ disabled: disabled || readOnly,
38
+ className: cx(styles.input, styles.select, error && styles.inputError),
39
+ children: [
40
+ placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }),
41
+ options == null ? void 0 : options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value))
42
+ ]
43
+ }
44
+ ),
45
+ helperText && /* @__PURE__ */ jsx(
46
+ "span",
47
+ {
48
+ id: helperId(name),
49
+ className: cx(styles.helperText, error && styles.helperTextError),
50
+ role: error ? "alert" : void 0,
51
+ children: helperText
52
+ }
53
+ )
54
+ ] });
55
+ }
56
+ export {
57
+ SelectField
58
+ };