@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,106 @@
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 fieldUtils = require("../../fields/fieldUtils.cjs");
6
+ const Grid_module = require("./Grid.module.css.cjs");
7
+ function toGapValue(value, fallback) {
8
+ if (value == null) return fallback;
9
+ return typeof value === "number" ? `${value * 8}px` : value;
10
+ }
11
+ function buildContainerStyle(columns, spacing, rowSpacing, columnSpacing) {
12
+ const gap = toGapValue(spacing);
13
+ const rGap = toGapValue(rowSpacing, gap);
14
+ const cGap = toGapValue(columnSpacing, gap);
15
+ const s = {
16
+ display: "grid",
17
+ gridTemplateColumns: `repeat(${columns}, 1fr)`
18
+ };
19
+ if (rGap && cGap) {
20
+ s.gap = `${rGap} ${cGap}`;
21
+ } else if (gap) {
22
+ s.gap = gap;
23
+ }
24
+ return s;
25
+ }
26
+ function buildItemStyle(size, xs, columns, offset) {
27
+ const s = {};
28
+ const resolved = size ?? xs ?? columns;
29
+ if (resolved === "auto") {
30
+ s.gridColumn = "auto";
31
+ } else if (resolved === "grow") {
32
+ s.gridColumn = "1 / -1";
33
+ s.flex = "1 1 0";
34
+ } else if (typeof resolved === "number") {
35
+ s.gridColumn = `span ${resolved}`;
36
+ }
37
+ if (offset != null) {
38
+ const off = typeof offset === "number" ? offset : offset.xs ?? 0;
39
+ if (off > 0) {
40
+ s.gridColumnStart = off + 1;
41
+ }
42
+ }
43
+ return s;
44
+ }
45
+ function Grid({
46
+ children,
47
+ container,
48
+ columns = 12,
49
+ spacing,
50
+ rowSpacing,
51
+ columnSpacing,
52
+ size,
53
+ xs,
54
+ sm,
55
+ md,
56
+ lg,
57
+ xl,
58
+ offset,
59
+ className,
60
+ style: userStyle
61
+ }) {
62
+ const style = react.useMemo(() => {
63
+ const base = container ? buildContainerStyle(columns, spacing, rowSpacing, columnSpacing) : buildItemStyle(size, xs, columns, offset);
64
+ return { ...base, ...userStyle };
65
+ }, [
66
+ container,
67
+ columns,
68
+ spacing,
69
+ rowSpacing,
70
+ columnSpacing,
71
+ size,
72
+ xs,
73
+ sm,
74
+ md,
75
+ lg,
76
+ xl,
77
+ offset,
78
+ userStyle
79
+ ]);
80
+ const responsiveClass = react.useMemo(() => {
81
+ if (container) return Grid_module.default.container;
82
+ const classes = [Grid_module.default.item];
83
+ if (sm != null) classes.push(Grid_module.default[`sm`]);
84
+ if (md != null) classes.push(Grid_module.default[`md`]);
85
+ if (lg != null) classes.push(Grid_module.default[`lg`]);
86
+ if (xl != null) classes.push(Grid_module.default[`xl`]);
87
+ return classes.filter(Boolean).join(" ");
88
+ }, [container, sm, md, lg, xl]);
89
+ const cssVars = react.useMemo(() => {
90
+ const vars = {};
91
+ if (sm != null && typeof sm === "number") vars["--axen-grid-sm"] = `${sm}`;
92
+ if (md != null && typeof md === "number") vars["--axen-grid-md"] = `${md}`;
93
+ if (lg != null && typeof lg === "number") vars["--axen-grid-lg"] = `${lg}`;
94
+ if (xl != null && typeof xl === "number") vars["--axen-grid-xl"] = `${xl}`;
95
+ return vars;
96
+ }, [sm, md, lg, xl]);
97
+ return /* @__PURE__ */ jsxRuntime.jsx(
98
+ "div",
99
+ {
100
+ className: fieldUtils.cx(responsiveClass, className),
101
+ style: { ...style, ...cssVars },
102
+ children
103
+ }
104
+ );
105
+ }
106
+ exports.Grid = Grid;
@@ -0,0 +1,7 @@
1
+ import { GridProps } from '../../types';
2
+ /**
3
+ * CSS Grid-based layout component (MUI v7 Grid API).
4
+ * 12-column responsive grid system.
5
+ */
6
+ export declare function Grid({ children, container, columns, spacing, rowSpacing, columnSpacing, size, xs, sm, md, lg, xl, offset, className, style: userStyle, }: Readonly<GridProps>): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=Grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/layout/Grid/Grid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA4D7C;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,OAAY,EACZ,OAAO,EACP,UAAU,EACV,aAAa,EACb,IAAI,EACJ,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,GACjB,EAAE,QAAQ,CAAC,SAAS,CAAC,2CAqDrB"}
@@ -0,0 +1,106 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { cx } from "../../fields/fieldUtils.js";
4
+ import styles from "./Grid.module.css.js";
5
+ function toGapValue(value, fallback) {
6
+ if (value == null) return fallback;
7
+ return typeof value === "number" ? `${value * 8}px` : value;
8
+ }
9
+ function buildContainerStyle(columns, spacing, rowSpacing, columnSpacing) {
10
+ const gap = toGapValue(spacing);
11
+ const rGap = toGapValue(rowSpacing, gap);
12
+ const cGap = toGapValue(columnSpacing, gap);
13
+ const s = {
14
+ display: "grid",
15
+ gridTemplateColumns: `repeat(${columns}, 1fr)`
16
+ };
17
+ if (rGap && cGap) {
18
+ s.gap = `${rGap} ${cGap}`;
19
+ } else if (gap) {
20
+ s.gap = gap;
21
+ }
22
+ return s;
23
+ }
24
+ function buildItemStyle(size, xs, columns, offset) {
25
+ const s = {};
26
+ const resolved = size ?? xs ?? columns;
27
+ if (resolved === "auto") {
28
+ s.gridColumn = "auto";
29
+ } else if (resolved === "grow") {
30
+ s.gridColumn = "1 / -1";
31
+ s.flex = "1 1 0";
32
+ } else if (typeof resolved === "number") {
33
+ s.gridColumn = `span ${resolved}`;
34
+ }
35
+ if (offset != null) {
36
+ const off = typeof offset === "number" ? offset : offset.xs ?? 0;
37
+ if (off > 0) {
38
+ s.gridColumnStart = off + 1;
39
+ }
40
+ }
41
+ return s;
42
+ }
43
+ function Grid({
44
+ children,
45
+ container,
46
+ columns = 12,
47
+ spacing,
48
+ rowSpacing,
49
+ columnSpacing,
50
+ size,
51
+ xs,
52
+ sm,
53
+ md,
54
+ lg,
55
+ xl,
56
+ offset,
57
+ className,
58
+ style: userStyle
59
+ }) {
60
+ const style = useMemo(() => {
61
+ const base = container ? buildContainerStyle(columns, spacing, rowSpacing, columnSpacing) : buildItemStyle(size, xs, columns, offset);
62
+ return { ...base, ...userStyle };
63
+ }, [
64
+ container,
65
+ columns,
66
+ spacing,
67
+ rowSpacing,
68
+ columnSpacing,
69
+ size,
70
+ xs,
71
+ sm,
72
+ md,
73
+ lg,
74
+ xl,
75
+ offset,
76
+ userStyle
77
+ ]);
78
+ const responsiveClass = useMemo(() => {
79
+ if (container) return styles.container;
80
+ const classes = [styles.item];
81
+ if (sm != null) classes.push(styles[`sm`]);
82
+ if (md != null) classes.push(styles[`md`]);
83
+ if (lg != null) classes.push(styles[`lg`]);
84
+ if (xl != null) classes.push(styles[`xl`]);
85
+ return classes.filter(Boolean).join(" ");
86
+ }, [container, sm, md, lg, xl]);
87
+ const cssVars = useMemo(() => {
88
+ const vars = {};
89
+ if (sm != null && typeof sm === "number") vars["--axen-grid-sm"] = `${sm}`;
90
+ if (md != null && typeof md === "number") vars["--axen-grid-md"] = `${md}`;
91
+ if (lg != null && typeof lg === "number") vars["--axen-grid-lg"] = `${lg}`;
92
+ if (xl != null && typeof xl === "number") vars["--axen-grid-xl"] = `${xl}`;
93
+ return vars;
94
+ }, [sm, md, lg, xl]);
95
+ return /* @__PURE__ */ jsx(
96
+ "div",
97
+ {
98
+ className: cx(responsiveClass, className),
99
+ style: { ...style, ...cssVars },
100
+ children
101
+ }
102
+ );
103
+ }
104
+ export {
105
+ Grid
106
+ };
@@ -0,0 +1,43 @@
1
+ /* ═══════════════════════════════════════════════
2
+ Grid Layout — Responsive CSS Grid
3
+ 12-column mobile-first system
4
+ ═══════════════════════════════════════════════ */
5
+
6
+ ._container_1asbx_6 {
7
+ display: grid;
8
+ width: 100%;
9
+ }
10
+
11
+ ._item_1asbx_11 {
12
+ min-width: 0; /* Prevent overflow */
13
+ }
14
+
15
+ /* ── Responsive Breakpoints ──────────────────── */
16
+
17
+ /* sm ≥ 600px */
18
+ @media (min-width: 600px) {
19
+ ._sm_1asbx_19 {
20
+ grid-column: span var(--axen-grid-sm, 12);
21
+ }
22
+ }
23
+
24
+ /* md ≥ 900px */
25
+ @media (min-width: 900px) {
26
+ ._md_1asbx_26 {
27
+ grid-column: span var(--axen-grid-md, 12);
28
+ }
29
+ }
30
+
31
+ /* lg ≥ 1200px */
32
+ @media (min-width: 1200px) {
33
+ ._lg_1asbx_33 {
34
+ grid-column: span var(--axen-grid-lg, 12);
35
+ }
36
+ }
37
+
38
+ /* xl ≥ 1536px */
39
+ @media (min-width: 1536px) {
40
+ ._xl_1asbx_40 {
41
+ grid-column: span var(--axen-grid-xl, 12);
42
+ }
43
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const container = "_container_1asbx_6";
4
+ const item = "_item_1asbx_11";
5
+ const sm = "_sm_1asbx_19";
6
+ const md = "_md_1asbx_26";
7
+ const lg = "_lg_1asbx_33";
8
+ const xl = "_xl_1asbx_40";
9
+ const styles = {
10
+ container,
11
+ item,
12
+ sm,
13
+ md,
14
+ lg,
15
+ xl
16
+ };
17
+ exports.container = container;
18
+ exports.default = styles;
19
+ exports.item = item;
20
+ exports.lg = lg;
21
+ exports.md = md;
22
+ exports.sm = sm;
23
+ exports.xl = xl;
@@ -0,0 +1,23 @@
1
+ const container = "_container_1asbx_6";
2
+ const item = "_item_1asbx_11";
3
+ const sm = "_sm_1asbx_19";
4
+ const md = "_md_1asbx_26";
5
+ const lg = "_lg_1asbx_33";
6
+ const xl = "_xl_1asbx_40";
7
+ const styles = {
8
+ container,
9
+ item,
10
+ sm,
11
+ md,
12
+ lg,
13
+ xl
14
+ };
15
+ export {
16
+ container,
17
+ styles as default,
18
+ item,
19
+ lg,
20
+ md,
21
+ sm,
22
+ xl
23
+ };
@@ -0,0 +1,30 @@
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 SPACING_UNIT = 8;
6
+ function Spacer({
7
+ x = 0,
8
+ y = 0,
9
+ basis = 0,
10
+ grow = false,
11
+ className,
12
+ style: userStyle
13
+ }) {
14
+ const style = react.useMemo(() => {
15
+ const s = {
16
+ flexShrink: 0
17
+ };
18
+ if (x) s.width = `${x * SPACING_UNIT}px`;
19
+ if (y) s.height = `${y * SPACING_UNIT}px`;
20
+ if (basis) s.flexBasis = `${basis * SPACING_UNIT}px`;
21
+ if (grow) {
22
+ s.flexGrow = 1;
23
+ } else {
24
+ s.flexGrow = 0;
25
+ }
26
+ return { ...s, ...userStyle };
27
+ }, [x, y, basis, grow, userStyle]);
28
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style, "aria-hidden": "true" });
29
+ }
30
+ exports.Spacer = Spacer;
@@ -0,0 +1,21 @@
1
+ import { SpacerProps } from '../../types';
2
+ /**
3
+ * Invisible spacing element — creates horizontal, vertical, or flex-basis gaps.
4
+ *
5
+ * Uses the same 8px spacing unit as Box/Grid/Stack.
6
+ *
7
+ * @example
8
+ * // Horizontal gap
9
+ * <Spacer x={2} /> // 16px wide
10
+ *
11
+ * // Vertical gap
12
+ * <Spacer y={3} /> // 24px tall
13
+ *
14
+ * // Flex spacer (push items apart)
15
+ * <Spacer grow />
16
+ *
17
+ * // Flex basis (fixed space in flex container)
18
+ * <Spacer basis={4} /> // 32px flex-basis
19
+ */
20
+ export declare function Spacer({ x, y, basis, grow, className, style: userStyle, }: Readonly<SpacerProps>): import("react/jsx-runtime").JSX.Element;
21
+ //# sourceMappingURL=Spacer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spacer.d.ts","sourceRoot":"","sources":["../../../src/layout/Spacer/Spacer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,EACrB,CAAK,EACL,CAAK,EACL,KAAS,EACT,IAAY,EACZ,SAAS,EACT,KAAK,EAAE,SAAS,GACjB,EAAE,QAAQ,CAAC,WAAW,CAAC,2CAmBvB"}
@@ -0,0 +1,30 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ const SPACING_UNIT = 8;
4
+ function Spacer({
5
+ x = 0,
6
+ y = 0,
7
+ basis = 0,
8
+ grow = false,
9
+ className,
10
+ style: userStyle
11
+ }) {
12
+ const style = useMemo(() => {
13
+ const s = {
14
+ flexShrink: 0
15
+ };
16
+ if (x) s.width = `${x * SPACING_UNIT}px`;
17
+ if (y) s.height = `${y * SPACING_UNIT}px`;
18
+ if (basis) s.flexBasis = `${basis * SPACING_UNIT}px`;
19
+ if (grow) {
20
+ s.flexGrow = 1;
21
+ } else {
22
+ s.flexGrow = 0;
23
+ }
24
+ return { ...s, ...userStyle };
25
+ }, [x, y, basis, grow, userStyle]);
26
+ return /* @__PURE__ */ jsx("div", { className, style, "aria-hidden": "true" });
27
+ }
28
+ export {
29
+ Spacer
30
+ };
@@ -0,0 +1,52 @@
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 fieldUtils = require("../../fields/fieldUtils.cjs");
6
+ const Stack_module = require("./Stack.module.css.cjs");
7
+ const SPACING_UNIT = 8;
8
+ function Stack({
9
+ children,
10
+ direction = "column",
11
+ spacing = 2,
12
+ alignItems,
13
+ justifyContent,
14
+ divider,
15
+ className,
16
+ style: userStyle
17
+ }) {
18
+ const style = react.useMemo(() => {
19
+ const s = {
20
+ display: "flex",
21
+ flexDirection: direction
22
+ };
23
+ if (alignItems) s.alignItems = alignItems;
24
+ if (justifyContent) s.justifyContent = justifyContent;
25
+ if (!divider) {
26
+ s.gap = typeof spacing === "number" ? `${spacing * SPACING_UNIT}px` : spacing;
27
+ }
28
+ return { ...s, ...userStyle };
29
+ }, [direction, spacing, alignItems, justifyContent, divider, userStyle]);
30
+ if (divider) {
31
+ const items = react.Children.toArray(children).filter(Boolean);
32
+ const gapValue = typeof spacing === "number" ? `${spacing * SPACING_UNIT}px` : spacing;
33
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: fieldUtils.cx(Stack_module.default.stack, className), style, children: items.map((child, index) => {
34
+ const itemKey = react.isValidElement(child) ? child.key : `divider-${String(index)}`;
35
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
36
+ child,
37
+ items.indexOf(child) < items.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
38
+ "div",
39
+ {
40
+ style: {
41
+ [direction === "column" ? "marginTop" : "marginLeft"]: gapValue,
42
+ [direction === "column" ? "marginBottom" : "marginRight"]: gapValue
43
+ },
44
+ children: divider
45
+ }
46
+ )
47
+ ] }, itemKey);
48
+ }) });
49
+ }
50
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: fieldUtils.cx(Stack_module.default.stack, className), style, children });
51
+ }
52
+ exports.Stack = Stack;
@@ -0,0 +1,7 @@
1
+ import { StackProps } from '../../types';
2
+ /**
3
+ * Stack component — arranges children in a row or column with spacing.
4
+ * Optionally inserts a divider between items.
5
+ */
6
+ export declare function Stack({ children, direction, spacing, alignItems, justifyContent, divider, className, style: userStyle, }: Readonly<StackProps>): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=Stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/layout/Stack/Stack.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,SAAoB,EACpB,OAAW,EACX,UAAU,EACV,cAAc,EACd,OAAO,EACP,SAAS,EACT,KAAK,EAAE,SAAS,GACjB,EAAE,QAAQ,CAAC,UAAU,CAAC,2CA+CtB"}
@@ -0,0 +1,52 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useMemo, Children, isValidElement } from "react";
3
+ import { cx } from "../../fields/fieldUtils.js";
4
+ import styles from "./Stack.module.css.js";
5
+ const SPACING_UNIT = 8;
6
+ function Stack({
7
+ children,
8
+ direction = "column",
9
+ spacing = 2,
10
+ alignItems,
11
+ justifyContent,
12
+ divider,
13
+ className,
14
+ style: userStyle
15
+ }) {
16
+ const style = useMemo(() => {
17
+ const s = {
18
+ display: "flex",
19
+ flexDirection: direction
20
+ };
21
+ if (alignItems) s.alignItems = alignItems;
22
+ if (justifyContent) s.justifyContent = justifyContent;
23
+ if (!divider) {
24
+ s.gap = typeof spacing === "number" ? `${spacing * SPACING_UNIT}px` : spacing;
25
+ }
26
+ return { ...s, ...userStyle };
27
+ }, [direction, spacing, alignItems, justifyContent, divider, userStyle]);
28
+ if (divider) {
29
+ const items = Children.toArray(children).filter(Boolean);
30
+ const gapValue = typeof spacing === "number" ? `${spacing * SPACING_UNIT}px` : spacing;
31
+ return /* @__PURE__ */ jsx("div", { className: cx(styles.stack, className), style, children: items.map((child, index) => {
32
+ const itemKey = isValidElement(child) ? child.key : `divider-${String(index)}`;
33
+ return /* @__PURE__ */ jsxs("div", { children: [
34
+ child,
35
+ items.indexOf(child) < items.length - 1 && /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ style: {
39
+ [direction === "column" ? "marginTop" : "marginLeft"]: gapValue,
40
+ [direction === "column" ? "marginBottom" : "marginRight"]: gapValue
41
+ },
42
+ children: divider
43
+ }
44
+ )
45
+ ] }, itemKey);
46
+ }) });
47
+ }
48
+ return /* @__PURE__ */ jsx("div", { className: cx(styles.stack, className), style, children });
49
+ }
50
+ export {
51
+ Stack
52
+ };
@@ -0,0 +1,3 @@
1
+ ._stack_1m70l_1 {
2
+ min-width: 0;
3
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const stack = "_stack_1m70l_1";
4
+ const styles = {
5
+ stack
6
+ };
7
+ exports.default = styles;
8
+ exports.stack = stack;
@@ -0,0 +1,8 @@
1
+ const stack = "_stack_1m70l_1";
2
+ const styles = {
3
+ stack
4
+ };
5
+ export {
6
+ styles as default,
7
+ stack
8
+ };
@@ -0,0 +1,6 @@
1
+ export { Box } from './Box/Box';
2
+ export { Divider } from './Divider/Divider';
3
+ export { Grid } from './Grid/Grid';
4
+ export { Spacer } from './Spacer/Spacer';
5
+ export { Stack } from './Stack/Stack';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const FormContext = require("./FormContext.cjs");
5
+ const useFieldArray = require("./useFieldArray.cjs");
6
+ const useField = require("./useField.cjs");
7
+ function AxenArrayField({ name, config, children }) {
8
+ const { fields: items, push, remove, swap, insert, replace, move, length } = useFieldArray.useFieldArray(name);
9
+ const { components, disabled } = FormContext.useFormContext();
10
+ const helpers = { push, remove, swap, insert, replace, move, length };
11
+ const renderField = (index) => {
12
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-axen-array-item": index, children: config.fields.map((fieldConfig) => {
13
+ const fieldName = `${name}.${index}.${fieldConfig.name}`;
14
+ const Component = fieldConfig.component ?? components[fieldConfig.type];
15
+ if (!Component) return null;
16
+ return /* @__PURE__ */ jsxRuntime.jsx(
17
+ ArrayItemField,
18
+ {
19
+ name: fieldName,
20
+ config: fieldConfig,
21
+ Component,
22
+ disabled: disabled || config.disabled
23
+ },
24
+ fieldName
25
+ );
26
+ }) }, index);
27
+ };
28
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children({ fields: items, helpers, renderField }) });
29
+ }
30
+ function ArrayItemField({
31
+ name,
32
+ config,
33
+ Component,
34
+ disabled
35
+ }) {
36
+ const { store } = FormContext.useFormContext();
37
+ const { value, error, touched, onChange, onBlur } = useField.useField(name);
38
+ const showError = touched && !!error;
39
+ return /* @__PURE__ */ jsxRuntime.jsx(
40
+ Component,
41
+ {
42
+ name,
43
+ value,
44
+ onChange,
45
+ onBlur,
46
+ error: showError,
47
+ helperText: showError ? error : config.helperText,
48
+ label: config.label,
49
+ placeholder: config.placeholder,
50
+ disabled: disabled || config.disabled,
51
+ readOnly: config.readOnly,
52
+ required: config.required,
53
+ options: config.options,
54
+ form: {
55
+ values: store.getState().values,
56
+ errors: store.getState().errors,
57
+ touched: store.getState().touched,
58
+ dirty: store.getState().dirty,
59
+ isSubmitting: store.getState().isSubmitting,
60
+ isValid: Object.keys(store.getState().errors).length === 0,
61
+ submitCount: store.getState().submitCount,
62
+ setFieldValue: store.setFieldValue,
63
+ setFieldTouched: store.setFieldTouched,
64
+ setFieldError: store.setFieldError,
65
+ setValues: store.setValues,
66
+ setErrors: store.setErrors,
67
+ handleChange: onChange,
68
+ handleBlur: onBlur,
69
+ handleSubmit: () => {
70
+ void store.submitForm();
71
+ },
72
+ resetForm: store.resetForm,
73
+ submitForm: () => store.submitForm(),
74
+ validateForm: store.validateForm,
75
+ validateField: store.validateField
76
+ }
77
+ }
78
+ );
79
+ }
80
+ exports.AxenArrayField = AxenArrayField;
@@ -0,0 +1,15 @@
1
+ import { ArrayFieldConfig, ArrayHelpers } from '../types';
2
+ export interface AxenArrayFieldProps {
3
+ name: string;
4
+ config: ArrayFieldConfig;
5
+ children: (props: {
6
+ fields: unknown[];
7
+ helpers: ArrayHelpers;
8
+ renderField: (index: number) => React.ReactNode;
9
+ }) => React.ReactNode;
10
+ }
11
+ /**
12
+ * Array field component for repeating field groups.
13
+ */
14
+ export declare function AxenArrayField({ name, config, children }: Readonly<AxenArrayFieldProps>): import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=AxenArrayField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxenArrayField.d.ts","sourceRoot":"","sources":["../../src/react/AxenArrayField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAoC,MAAM,UAAU,CAAC;AAIjG,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,MAAM,EAAE,OAAO,EAAE,CAAC;QAClB,OAAO,EAAE,YAAY,CAAC;QACtB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;KACjD,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CA+BvF"}