@uipath/apollo-wind 0.7.2-pr188.4865fad

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 (254) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +188 -0
  3. package/dist/components/forms/data-fetcher.cjs +250 -0
  4. package/dist/components/forms/data-fetcher.d.ts +173 -0
  5. package/dist/components/forms/data-fetcher.js +207 -0
  6. package/dist/components/forms/demo-mocks.cjs +1031 -0
  7. package/dist/components/forms/demo-mocks.d.ts +10 -0
  8. package/dist/components/forms/demo-mocks.js +997 -0
  9. package/dist/components/forms/field-renderer.cjs +595 -0
  10. package/dist/components/forms/field-renderer.d.ts +14 -0
  11. package/dist/components/forms/field-renderer.js +561 -0
  12. package/dist/components/forms/form-designer.cjs +2314 -0
  13. package/dist/components/forms/form-designer.d.ts +1 -0
  14. package/dist/components/forms/form-designer.js +2280 -0
  15. package/dist/components/forms/form-examples.cjs +962 -0
  16. package/dist/components/forms/form-examples.d.ts +46 -0
  17. package/dist/components/forms/form-examples.js +907 -0
  18. package/dist/components/forms/form-plugins.cjs +225 -0
  19. package/dist/components/forms/form-plugins.d.ts +11 -0
  20. package/dist/components/forms/form-plugins.js +176 -0
  21. package/dist/components/forms/form-schema.cjs +56 -0
  22. package/dist/components/forms/form-schema.d.ts +324 -0
  23. package/dist/components/forms/form-schema.js +13 -0
  24. package/dist/components/forms/form-state-viewer.cjs +498 -0
  25. package/dist/components/forms/form-state-viewer.d.ts +15 -0
  26. package/dist/components/forms/form-state-viewer.js +464 -0
  27. package/dist/components/forms/index.cjs +103 -0
  28. package/dist/components/forms/index.d.ts +13 -0
  29. package/dist/components/forms/index.js +9 -0
  30. package/dist/components/forms/metadata-form.cjs +400 -0
  31. package/dist/components/forms/metadata-form.d.ts +16 -0
  32. package/dist/components/forms/metadata-form.js +366 -0
  33. package/dist/components/forms/rules-engine.cjs +343 -0
  34. package/dist/components/forms/rules-engine.d.ts +99 -0
  35. package/dist/components/forms/rules-engine.js +293 -0
  36. package/dist/components/forms/schema-serializer.cjs +250 -0
  37. package/dist/components/forms/schema-serializer.d.ts +27 -0
  38. package/dist/components/forms/schema-serializer.js +213 -0
  39. package/dist/components/forms/schema-viewer.cjs +157 -0
  40. package/dist/components/forms/schema-viewer.d.ts +29 -0
  41. package/dist/components/forms/schema-viewer.js +117 -0
  42. package/dist/components/forms/validation-converter.cjs +154 -0
  43. package/dist/components/forms/validation-converter.d.ts +42 -0
  44. package/dist/components/forms/validation-converter.js +114 -0
  45. package/dist/components/ui/accordion.cjs +82 -0
  46. package/dist/components/ui/accordion.d.ts +7 -0
  47. package/dist/components/ui/accordion.js +39 -0
  48. package/dist/components/ui/alert-dialog.cjs +126 -0
  49. package/dist/components/ui/alert-dialog.d.ts +20 -0
  50. package/dist/components/ui/alert-dialog.js +62 -0
  51. package/dist/components/ui/alert.cjs +77 -0
  52. package/dist/components/ui/alert.d.ts +8 -0
  53. package/dist/components/ui/alert.js +37 -0
  54. package/dist/components/ui/aspect-ratio.cjs +38 -0
  55. package/dist/components/ui/aspect-ratio.d.ts +3 -0
  56. package/dist/components/ui/aspect-ratio.js +4 -0
  57. package/dist/components/ui/avatar.cjs +63 -0
  58. package/dist/components/ui/avatar.d.ts +6 -0
  59. package/dist/components/ui/avatar.js +23 -0
  60. package/dist/components/ui/badge.cjs +63 -0
  61. package/dist/components/ui/badge.d.ts +9 -0
  62. package/dist/components/ui/badge.js +26 -0
  63. package/dist/components/ui/breadcrumb.cjs +118 -0
  64. package/dist/components/ui/breadcrumb.d.ts +19 -0
  65. package/dist/components/ui/breadcrumb.js +66 -0
  66. package/dist/components/ui/button-group.cjs +68 -0
  67. package/dist/components/ui/button-group.d.ts +14 -0
  68. package/dist/components/ui/button-group.js +28 -0
  69. package/dist/components/ui/button.cjs +78 -0
  70. package/dist/components/ui/button.d.ts +11 -0
  71. package/dist/components/ui/button.js +41 -0
  72. package/dist/components/ui/calendar.cjs +144 -0
  73. package/dist/components/ui/calendar.d.ts +8 -0
  74. package/dist/components/ui/calendar.js +107 -0
  75. package/dist/components/ui/card.cjs +89 -0
  76. package/dist/components/ui/card.d.ts +8 -0
  77. package/dist/components/ui/card.js +40 -0
  78. package/dist/components/ui/checkbox.cjs +52 -0
  79. package/dist/components/ui/checkbox.d.ts +6 -0
  80. package/dist/components/ui/checkbox.js +18 -0
  81. package/dist/components/ui/collapsible.cjs +45 -0
  82. package/dist/components/ui/collapsible.d.ts +5 -0
  83. package/dist/components/ui/collapsible.js +5 -0
  84. package/dist/components/ui/combobox.cjs +102 -0
  85. package/dist/components/ui/combobox.d.ts +15 -0
  86. package/dist/components/ui/combobox.js +68 -0
  87. package/dist/components/ui/command.cjs +131 -0
  88. package/dist/components/ui/command.d.ts +80 -0
  89. package/dist/components/ui/command.js +73 -0
  90. package/dist/components/ui/context-menu.cjs +173 -0
  91. package/dist/components/ui/context-menu.d.ts +27 -0
  92. package/dist/components/ui/context-menu.js +97 -0
  93. package/dist/components/ui/data-table.cjs +292 -0
  94. package/dist/components/ui/data-table.d.ts +23 -0
  95. package/dist/components/ui/data-table.js +252 -0
  96. package/dist/components/ui/date-picker.cjs +118 -0
  97. package/dist/components/ui/date-picker.d.ts +21 -0
  98. package/dist/components/ui/date-picker.js +81 -0
  99. package/dist/components/ui/datetime-picker.cjs +154 -0
  100. package/dist/components/ui/datetime-picker.d.ts +9 -0
  101. package/dist/components/ui/datetime-picker.js +120 -0
  102. package/dist/components/ui/dialog.cjs +159 -0
  103. package/dist/components/ui/dialog.d.ts +15 -0
  104. package/dist/components/ui/dialog.js +98 -0
  105. package/dist/components/ui/drawer.cjs +116 -0
  106. package/dist/components/ui/drawer.d.ts +18 -0
  107. package/dist/components/ui/drawer.js +55 -0
  108. package/dist/components/ui/dropdown-menu.cjs +174 -0
  109. package/dist/components/ui/dropdown-menu.d.ts +27 -0
  110. package/dist/components/ui/dropdown-menu.js +98 -0
  111. package/dist/components/ui/editable-cell.cjs +256 -0
  112. package/dist/components/ui/editable-cell.d.ts +24 -0
  113. package/dist/components/ui/editable-cell.js +219 -0
  114. package/dist/components/ui/empty-state.cjs +73 -0
  115. package/dist/components/ui/empty-state.d.ts +16 -0
  116. package/dist/components/ui/empty-state.js +39 -0
  117. package/dist/components/ui/file-upload.cjs +236 -0
  118. package/dist/components/ui/file-upload.d.ts +10 -0
  119. package/dist/components/ui/file-upload.js +202 -0
  120. package/dist/components/ui/hover-card.cjs +55 -0
  121. package/dist/components/ui/hover-card.d.ts +6 -0
  122. package/dist/components/ui/hover-card.js +15 -0
  123. package/dist/components/ui/index.cjs +546 -0
  124. package/dist/components/ui/index.d.ts +55 -0
  125. package/dist/components/ui/index.js +55 -0
  126. package/dist/components/ui/input.cjs +45 -0
  127. package/dist/components/ui/input.d.ts +5 -0
  128. package/dist/components/ui/input.js +11 -0
  129. package/dist/components/ui/label.cjs +47 -0
  130. package/dist/components/ui/label.d.ts +7 -0
  131. package/dist/components/ui/label.js +13 -0
  132. package/dist/components/ui/layout/column.cjs +84 -0
  133. package/dist/components/ui/layout/column.d.ts +21 -0
  134. package/dist/components/ui/layout/column.js +50 -0
  135. package/dist/components/ui/layout/grid.cjs +101 -0
  136. package/dist/components/ui/layout/grid.d.ts +22 -0
  137. package/dist/components/ui/layout/grid.js +67 -0
  138. package/dist/components/ui/layout/index.cjs +44 -0
  139. package/dist/components/ui/layout/index.d.ts +7 -0
  140. package/dist/components/ui/layout/index.js +4 -0
  141. package/dist/components/ui/layout/row.cjs +84 -0
  142. package/dist/components/ui/layout/row.d.ts +21 -0
  143. package/dist/components/ui/layout/row.js +50 -0
  144. package/dist/components/ui/layout/types.cjs +18 -0
  145. package/dist/components/ui/layout/types.d.ts +149 -0
  146. package/dist/components/ui/layout/types.js +0 -0
  147. package/dist/components/ui/layout/utils.cjs +324 -0
  148. package/dist/components/ui/layout/utils.d.ts +76 -0
  149. package/dist/components/ui/layout/utils.js +239 -0
  150. package/dist/components/ui/menubar.cjs +210 -0
  151. package/dist/components/ui/menubar.d.ts +28 -0
  152. package/dist/components/ui/menubar.js +131 -0
  153. package/dist/components/ui/multi-select.cjs +187 -0
  154. package/dist/components/ui/multi-select.d.ts +18 -0
  155. package/dist/components/ui/multi-select.js +153 -0
  156. package/dist/components/ui/navigation-menu.cjs +122 -0
  157. package/dist/components/ui/navigation-menu.d.ts +12 -0
  158. package/dist/components/ui/navigation-menu.js +64 -0
  159. package/dist/components/ui/pagination.cjs +131 -0
  160. package/dist/components/ui/pagination.d.ts +28 -0
  161. package/dist/components/ui/pagination.js +79 -0
  162. package/dist/components/ui/popover.cjs +61 -0
  163. package/dist/components/ui/popover.d.ts +7 -0
  164. package/dist/components/ui/popover.js +18 -0
  165. package/dist/components/ui/progress.cjs +51 -0
  166. package/dist/components/ui/progress.d.ts +4 -0
  167. package/dist/components/ui/progress.js +17 -0
  168. package/dist/components/ui/radio-group.cjs +61 -0
  169. package/dist/components/ui/radio-group.d.ts +5 -0
  170. package/dist/components/ui/radio-group.js +24 -0
  171. package/dist/components/ui/resizable.cjs +60 -0
  172. package/dist/components/ui/resizable.d.ts +23 -0
  173. package/dist/components/ui/resizable.js +20 -0
  174. package/dist/components/ui/scroll-area.cjs +67 -0
  175. package/dist/components/ui/scroll-area.d.ts +5 -0
  176. package/dist/components/ui/scroll-area.js +30 -0
  177. package/dist/components/ui/search.cjs +153 -0
  178. package/dist/components/ui/search.d.ts +19 -0
  179. package/dist/components/ui/search.js +116 -0
  180. package/dist/components/ui/select.cjs +151 -0
  181. package/dist/components/ui/select.d.ts +13 -0
  182. package/dist/components/ui/select.js +90 -0
  183. package/dist/components/ui/separator.cjs +47 -0
  184. package/dist/components/ui/separator.d.ts +4 -0
  185. package/dist/components/ui/separator.js +13 -0
  186. package/dist/components/ui/sheet.cjs +142 -0
  187. package/dist/components/ui/sheet.d.ts +25 -0
  188. package/dist/components/ui/sheet.js +81 -0
  189. package/dist/components/ui/skeleton.cjs +43 -0
  190. package/dist/components/ui/skeleton.d.ts +2 -0
  191. package/dist/components/ui/skeleton.js +9 -0
  192. package/dist/components/ui/slider.cjs +63 -0
  193. package/dist/components/ui/slider.d.ts +4 -0
  194. package/dist/components/ui/slider.js +29 -0
  195. package/dist/components/ui/sonner.cjs +76 -0
  196. package/dist/components/ui/sonner.d.ts +4 -0
  197. package/dist/components/ui/sonner.js +39 -0
  198. package/dist/components/ui/spinner.cjs +78 -0
  199. package/dist/components/ui/spinner.d.ts +11 -0
  200. package/dist/components/ui/spinner.js +41 -0
  201. package/dist/components/ui/stats-card.cjs +102 -0
  202. package/dist/components/ui/stats-card.d.ts +15 -0
  203. package/dist/components/ui/stats-card.js +68 -0
  204. package/dist/components/ui/stepper.cjs +99 -0
  205. package/dist/components/ui/stepper.d.ts +14 -0
  206. package/dist/components/ui/stepper.js +65 -0
  207. package/dist/components/ui/switch.cjs +48 -0
  208. package/dist/components/ui/switch.d.ts +4 -0
  209. package/dist/components/ui/switch.js +14 -0
  210. package/dist/components/ui/table.cjs +110 -0
  211. package/dist/components/ui/table.d.ts +10 -0
  212. package/dist/components/ui/table.js +55 -0
  213. package/dist/components/ui/tabs.cjs +67 -0
  214. package/dist/components/ui/tabs.d.ts +7 -0
  215. package/dist/components/ui/tabs.js +24 -0
  216. package/dist/components/ui/textarea.cjs +44 -0
  217. package/dist/components/ui/textarea.d.ts +4 -0
  218. package/dist/components/ui/textarea.js +10 -0
  219. package/dist/components/ui/toggle-group.cjs +73 -0
  220. package/dist/components/ui/toggle-group.d.ts +12 -0
  221. package/dist/components/ui/toggle-group.js +36 -0
  222. package/dist/components/ui/toggle.cjs +71 -0
  223. package/dist/components/ui/toggle.d.ts +12 -0
  224. package/dist/components/ui/toggle.js +34 -0
  225. package/dist/components/ui/tooltip.cjs +58 -0
  226. package/dist/components/ui/tooltip.d.ts +7 -0
  227. package/dist/components/ui/tooltip.js +15 -0
  228. package/dist/examples/admin-layout-example.d.ts +92 -0
  229. package/dist/examples/app-shell-example.d.ts +52 -0
  230. package/dist/examples/dashboard-example.d.ts +11 -0
  231. package/dist/examples/data-management-example.d.ts +1 -0
  232. package/dist/examples/flow-editor-layout-example.d.ts +22 -0
  233. package/dist/examples/flow-start-example.d.ts +30 -0
  234. package/dist/examples/form-builder-example.d.ts +1 -0
  235. package/dist/examples/new-project-example.d.ts +30 -0
  236. package/dist/examples/settings-example.d.ts +1 -0
  237. package/dist/examples/vscode-example.d.ts +80 -0
  238. package/dist/index.cjs +830 -0
  239. package/dist/index.d.ts +86 -0
  240. package/dist/index.js +67 -0
  241. package/dist/lib/index.cjs +42 -0
  242. package/dist/lib/index.d.ts +1 -0
  243. package/dist/lib/index.js +2 -0
  244. package/dist/lib/utils.cjs +70 -0
  245. package/dist/lib/utils.d.ts +14 -0
  246. package/dist/lib/utils.js +30 -0
  247. package/dist/postcss.config.export.cjs +43 -0
  248. package/dist/postcss.config.export.js +9 -0
  249. package/dist/styles.css +6868 -0
  250. package/dist/tailwind.css +239 -0
  251. package/dist/tailwind.preset.cjs +77 -0
  252. package/dist/tailwind.preset.js +43 -0
  253. package/package.json +157 -0
  254. package/postcss.config.export.js +9 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 UiPath
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # UiPath Wind Design System
2
+
3
+ A modern, accessible React component library with bundled Tailwind CSS.
4
+ Zero-config for quick starts, full Tailwind JIT for advanced needs.
5
+
6
+ ```mermaid
7
+ graph LR
8
+ A[Apollo Wind] --> B[Pre-compiled Styles<br/>Zero Config]
9
+ A --> C[Tailwind JIT<br/>Full Power]
10
+ B --> D[Fast Setup<br/>17KB CSS]
11
+ C --> E[All Features<br/>Custom Classes]
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ npm install @uipath/apollo-wind
18
+ ```
19
+
20
+ **Option 1: Zero Config** (Recommended for quick starts)
21
+
22
+ ```tsx
23
+ import "@uipath/apollo-wind/tailwind.css";
24
+ import { Button } from "@uipath/apollo-wind";
25
+
26
+ <Button>Click me</Button>;
27
+ ```
28
+
29
+ **Option 2: Full Tailwind JIT** (For advanced customization)
30
+
31
+ ```bash
32
+ npm install @uipath/apollo-wind postcss
33
+ ```
34
+
35
+ ```js
36
+ // postcss.config.js
37
+ export { default } from "@uipath/apollo-wind/postcss";
38
+ ```
39
+
40
+ ```css
41
+ /* src/app.css */
42
+ @import "@uipath/apollo-wind/tailwind.css";
43
+
44
+ /* Scan your source files for Tailwind classes */
45
+ @source "./src/**/*.{js,jsx,ts,tsx}";
46
+
47
+ /* Scan wind components to include their styles */
48
+ @source "./node_modules/@uipath/apollo-wind/dist/**/*.js";
49
+ ```
50
+
51
+ ```tsx
52
+ import "./app.css";
53
+ import { Button } from "@uipath/apollo-wind";
54
+
55
+ // ✅ All Tailwind utilities work!
56
+ <Button className="bg-purple-500 hover:scale-105 w-[200px]">
57
+ Custom Tailwind
58
+ </Button>;
59
+ ```
60
+
61
+ ## Comparison
62
+
63
+ | Feature | Pre-compiled | Tailwind JIT |
64
+ | ---------------- | ----------------------- | ------------------------------- |
65
+ | Setup Time | Instant | 5 minutes |
66
+ | Bundle Size | ~17KB CSS | ~varies (JIT) |
67
+ | Custom Classes | ❌ | ✅ |
68
+ | Arbitrary Values | ❌ | ✅ (`w-[200px]`) |
69
+ | Tailwind Plugins | ❌ | ✅ |
70
+ | Best For | Prototypes, Simple Apps | Production, Heavy Customization |
71
+
72
+ ## Architecture
73
+
74
+ ```mermaid
75
+ flowchart TD
76
+ A[Component Library] --> B[CVA Variants]
77
+ A --> C[TypeScript Types]
78
+ B --> D[Tailwind Utilities]
79
+ C --> E[React Components]
80
+
81
+ F[Consumer App] --> G{Choose Approach}
82
+ G -->|Option 1| H[Import styles.css]
83
+ G -->|Option 2| I[Import tailwind.css<br/>+ @source directive]
84
+
85
+ H --> J[Pre-compiled CSS<br/>34KB]
86
+ I --> K[JIT Compiled<br/>Only used utilities]
87
+
88
+ J --> L[Components Rendered]
89
+ K --> L
90
+ ```
91
+
92
+ ## Example
93
+
94
+ ```tsx
95
+ import {
96
+ Button,
97
+ Card,
98
+ CardContent,
99
+ CardHeader,
100
+ CardTitle,
101
+ Input,
102
+ Label,
103
+ } from "@uipath/apollo-wind";
104
+
105
+ function LoginForm() {
106
+ return (
107
+ <Card className="w-full max-w-md">
108
+ <CardHeader>
109
+ <CardTitle>Welcome Back</CardTitle>
110
+ </CardHeader>
111
+ <CardContent className="space-y-4">
112
+ <div>
113
+ <Label htmlFor="email">Email</Label>
114
+ <Input id="email" type="email" placeholder="you@example.com" />
115
+ </div>
116
+ <Button className="w-full">Sign In</Button>
117
+ </CardContent>
118
+ </Card>
119
+ );
120
+ }
121
+ ```
122
+
123
+ ## Utilities
124
+
125
+ ### cn() - Class Merger
126
+
127
+ ```tsx
128
+ import { cn } from "@uipath/apollo-wind";
129
+
130
+ <Button className={cn("base-class", isActive && "active-class")}>
131
+ Button
132
+ </Button>;
133
+ ```
134
+
135
+ ## Development
136
+
137
+ This package is part of a pnpm workspace. All commands should be run using `pnpm`.
138
+
139
+ **From the root of the monorepo:**
140
+ ```bash
141
+ pnpm install # Install all dependencies
142
+ pnpm build # Build apollo packages
143
+ pnpm storybook:wind # Run Storybook on http://localhost:6006
144
+ pnpm test --filter=@uipath/apollo-wind # Run tests
145
+ pnpm lint --filter=@uipath/apollo-wind # Run lint
146
+ pnpm format --filter=@uipath/apollo-wind # Run biome format
147
+ ```
148
+
149
+ **From the `packages/apollo-wind` directory:**
150
+ ```bash
151
+ pnpm install # Install dependencies (from root)
152
+ pnpm build # Build apollo packages
153
+ pnpm storybook # Run Storybook on http://localhost:6006
154
+ pnpm test # Run tests
155
+ pnpm lint # Run lint
156
+ pnpm format # Run biome format
157
+ ```
158
+
159
+ ## Documentation
160
+
161
+ - 📖 [Complete Usage Guide](./docs/USAGE.md) - Detailed consumption guide
162
+ - ♿ [Accessibility Testing Guide](./docs/ACCESSIBILITY_TESTING_GUIDE.md) - WCAG
163
+ 2.1 Level AA compliance and testing
164
+ - 🌍 [Localization Guide](./docs/LOCALIZATION_GUIDE.md) - Internationalization
165
+ (i18n) implementation
166
+
167
+ ## Tech Stack
168
+
169
+ - React 19 + TypeScript 5
170
+ - Tailwind CSS 4 (bundled)
171
+ - CVA (Class Variance Authority)
172
+ - Vitest + Testing Library
173
+ - Storybook 10
174
+ - Vite 7
175
+
176
+ ## Browser Support
177
+
178
+ Modern browsers: Chrome, Firefox, Safari, Edge (latest versions)
179
+
180
+ ## License
181
+
182
+ MIT - see [LICENSE](./LICENSE)
183
+
184
+ ---
185
+
186
+ **Peer Dependencies:** React ≥18.0.0
187
+
188
+ Built with ❤️ by UiPath | Inspired by [shadcn/ui](https://ui.shadcn.com)
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ DataSourceBuilder: ()=>DataSourceBuilder,
28
+ DataFetcher: ()=>DataFetcher,
29
+ DataTransformers: ()=>DataTransformers,
30
+ FetchAdapter: ()=>FetchAdapter
31
+ });
32
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
33
+ class FetchAdapter {
34
+ async fetch(request) {
35
+ const { url, method, params, body } = request;
36
+ const requestOptions = {
37
+ method,
38
+ headers: {
39
+ 'Content-Type': 'application/json',
40
+ ...request.headers
41
+ }
42
+ };
43
+ if ('POST' === method && body) requestOptions.body = JSON.stringify(body);
44
+ let fullUrl = url;
45
+ if ('GET' === method && params) {
46
+ const queryParams = new URLSearchParams(params);
47
+ fullUrl = `${url}?${queryParams}`;
48
+ }
49
+ const response = await fetch(fullUrl, requestOptions);
50
+ return {
51
+ data: await response.json(),
52
+ status: response.status,
53
+ ok: response.ok
54
+ };
55
+ }
56
+ }
57
+ class DataFetcher {
58
+ static cache = new Map();
59
+ static cacheTTL = 300000;
60
+ static adapter = new FetchAdapter();
61
+ static setAdapter(adapter) {
62
+ DataFetcher.adapter = adapter;
63
+ }
64
+ static getAdapter() {
65
+ return DataFetcher.adapter;
66
+ }
67
+ static resetAdapter() {
68
+ DataFetcher.adapter = new FetchAdapter();
69
+ }
70
+ static async fetch(source, formValues) {
71
+ switch(source.type){
72
+ case 'static':
73
+ return DataFetcher.fetchStatic(source);
74
+ case 'fetch':
75
+ return DataFetcher.fetchRemote(source, formValues);
76
+ case 'computed':
77
+ return DataFetcher.fetchComputed(source, formValues);
78
+ case 'remote':
79
+ return DataFetcher.fetchRemote(source, formValues);
80
+ default:
81
+ throw new Error(`Unknown data source type: ${source.type}`);
82
+ }
83
+ }
84
+ static fetchStatic(source) {
85
+ return source.options;
86
+ }
87
+ static async fetchRemote(source, formValues) {
88
+ const url = 'url' in source ? source.url : source.endpoint;
89
+ const method = 'method' in source ? source.method || 'GET' : 'GET';
90
+ const params = 'params' in source ? DataFetcher.resolveParams(source.params || {}, formValues) : {};
91
+ const cacheKey = DataFetcher.buildCacheKey(url, method, source, formValues);
92
+ const cached = DataFetcher.getFromCache(cacheKey);
93
+ if (cached) return cached;
94
+ try {
95
+ const response = await DataFetcher.adapter.fetch({
96
+ url,
97
+ method,
98
+ params,
99
+ body: 'POST' === method ? params : void 0
100
+ });
101
+ if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
102
+ let data = response.data;
103
+ if ('transform' in source && source.transform) data = DataFetcher.applyTransform(source.transform, data, formValues);
104
+ DataFetcher.setCache(cacheKey, data);
105
+ return data;
106
+ } catch (error) {
107
+ console.error('Data fetch error:', error);
108
+ throw error;
109
+ }
110
+ }
111
+ static fetchComputed(source, formValues) {
112
+ const dependencyValues = source.dependency.map((dep)=>(0, index_cjs_namespaceObject.get)(formValues, dep));
113
+ try {
114
+ const computeFn = new Function(...source.dependency, `return ${source.compute}`);
115
+ return computeFn(...dependencyValues);
116
+ } catch (error) {
117
+ console.error('Computed value error:', error);
118
+ return;
119
+ }
120
+ }
121
+ static resolveParams(params, formValues) {
122
+ const resolved = {};
123
+ for (const [key, value] of Object.entries(params))if ('string' == typeof value && value.startsWith('$')) {
124
+ const fieldPath = value.slice(1);
125
+ resolved[key] = (0, index_cjs_namespaceObject.get)(formValues, fieldPath);
126
+ } else resolved[key] = value;
127
+ return resolved;
128
+ }
129
+ static applyTransform(transform, data, formValues) {
130
+ try {
131
+ const transformFn = new Function('data', 'formValues', `return ${transform}`);
132
+ return transformFn(data, formValues);
133
+ } catch (error) {
134
+ console.error('Transform error:', error);
135
+ return data;
136
+ }
137
+ }
138
+ static buildCacheKey(url, method, source, formValues) {
139
+ const params = 'params' in source ? source.params || {} : {};
140
+ const resolvedParams = DataFetcher.resolveParams(params, formValues);
141
+ return `${method}:${url}:${JSON.stringify(resolvedParams)}`;
142
+ }
143
+ static getFromCache(key) {
144
+ const cached = DataFetcher.cache.get(key);
145
+ if (!cached) return null;
146
+ if (Date.now() - cached.timestamp > DataFetcher.cacheTTL) {
147
+ DataFetcher.cache.delete(key);
148
+ return null;
149
+ }
150
+ return cached.data;
151
+ }
152
+ static setCache(key, data) {
153
+ DataFetcher.cache.set(key, {
154
+ data,
155
+ timestamp: Date.now()
156
+ });
157
+ }
158
+ static clearCache(pattern) {
159
+ if (!pattern) return void DataFetcher.cache.clear();
160
+ for (const key of DataFetcher.cache.keys())if (key.includes(pattern)) DataFetcher.cache.delete(key);
161
+ }
162
+ static setCacheTTL(ttl) {
163
+ DataFetcher.cacheTTL = ttl;
164
+ }
165
+ }
166
+ class DataSourceBuilder {
167
+ static static(options) {
168
+ return {
169
+ type: 'static',
170
+ options
171
+ };
172
+ }
173
+ static get(url, params) {
174
+ return {
175
+ type: 'remote',
176
+ endpoint: url,
177
+ params
178
+ };
179
+ }
180
+ static post(url, _params) {
181
+ return {
182
+ type: 'fetch',
183
+ url,
184
+ method: 'POST',
185
+ transform: 'data'
186
+ };
187
+ }
188
+ static computed(dependencies, computeExpression) {
189
+ return {
190
+ type: 'computed',
191
+ dependency: dependencies,
192
+ compute: computeExpression
193
+ };
194
+ }
195
+ static dependent(url, dependencyField, paramName = 'id') {
196
+ return {
197
+ type: 'remote',
198
+ endpoint: url,
199
+ params: {
200
+ [paramName]: `$${dependencyField}`
201
+ }
202
+ };
203
+ }
204
+ static searchable(url, searchParam = 'q') {
205
+ return {
206
+ type: 'remote',
207
+ endpoint: url,
208
+ params: {
209
+ [searchParam]: '$search'
210
+ }
211
+ };
212
+ }
213
+ }
214
+ class DataTransformers {
215
+ static toOptions(labelKey = 'name', valueKey = 'id') {
216
+ return `data.map(item => ({ label: item.${labelKey}, value: item.${valueKey} }))`;
217
+ }
218
+ static filter(predicate) {
219
+ return `data.filter(item => ${predicate})`;
220
+ }
221
+ static sort(key, order = 'asc') {
222
+ const comparator = 'asc' === order ? `(a, b) => a.${key} > b.${key} ? 1 : -1` : `(a, b) => a.${key} < b.${key} ? 1 : -1`;
223
+ return `data.sort(${comparator})`;
224
+ }
225
+ static map(expression) {
226
+ return `data.map(item => ${expression})`;
227
+ }
228
+ static extract(path) {
229
+ return `data.${path}`;
230
+ }
231
+ static pipe(...transforms) {
232
+ return transforms.reduce((acc, transform, index)=>{
233
+ if (0 === index) return transform;
234
+ return transform.replace('data', `(${acc})`);
235
+ });
236
+ }
237
+ }
238
+ exports.DataFetcher = __webpack_exports__.DataFetcher;
239
+ exports.DataSourceBuilder = __webpack_exports__.DataSourceBuilder;
240
+ exports.DataTransformers = __webpack_exports__.DataTransformers;
241
+ exports.FetchAdapter = __webpack_exports__.FetchAdapter;
242
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
243
+ "DataFetcher",
244
+ "DataSourceBuilder",
245
+ "DataTransformers",
246
+ "FetchAdapter"
247
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
248
+ Object.defineProperty(exports, '__esModule', {
249
+ value: true
250
+ });
@@ -0,0 +1,173 @@
1
+ import type { DataSource, FieldOption } from './form-schema';
2
+ /**
3
+ * Request configuration for the adapter
4
+ */
5
+ export interface AdapterRequest {
6
+ url: string;
7
+ method: 'GET' | 'POST';
8
+ params?: Record<string, unknown>;
9
+ headers?: Record<string, string>;
10
+ body?: unknown;
11
+ }
12
+ /**
13
+ * Response from the adapter
14
+ */
15
+ export interface AdapterResponse {
16
+ data: unknown;
17
+ status: number;
18
+ ok: boolean;
19
+ }
20
+ /**
21
+ * Data Adapter interface - implement this to customize how data is fetched
22
+ *
23
+ * @example
24
+ * // Custom adapter with authentication
25
+ * class AuthenticatedAdapter implements DataAdapter {
26
+ * constructor(private token: string) {}
27
+ * async fetch(request: AdapterRequest): Promise<AdapterResponse> {
28
+ * const response = await fetch(request.url, {
29
+ * headers: { Authorization: `Bearer ${this.token}` }
30
+ * });
31
+ * return { data: await response.json(), status: response.status, ok: response.ok };
32
+ * }
33
+ * }
34
+ */
35
+ export interface DataAdapter {
36
+ fetch(request: AdapterRequest): Promise<AdapterResponse>;
37
+ }
38
+ /**
39
+ * Default adapter using the Fetch API
40
+ */
41
+ export declare class FetchAdapter implements DataAdapter {
42
+ fetch(request: AdapterRequest): Promise<AdapterResponse>;
43
+ }
44
+ /**
45
+ * Data Fetcher - Handles various data sources for form fields
46
+ * Supports static, remote, computed, and reactive data sources
47
+ *
48
+ * Uses an adapter pattern for customizable data fetching
49
+ */
50
+ export declare class DataFetcher {
51
+ private static cache;
52
+ private static cacheTTL;
53
+ private static adapter;
54
+ /**
55
+ * Set the data adapter for fetching remote data
56
+ * Use this to customize how HTTP requests are made (e.g., add auth, use mocks)
57
+ */
58
+ static setAdapter(adapter: DataAdapter): void;
59
+ /**
60
+ * Get the current adapter
61
+ */
62
+ static getAdapter(): DataAdapter;
63
+ /**
64
+ * Reset to the default FetchAdapter
65
+ */
66
+ static resetAdapter(): void;
67
+ /**
68
+ * Main fetch method - routes to appropriate handler
69
+ */
70
+ static fetch(source: DataSource, formValues: Record<string, unknown>): Promise<unknown>;
71
+ /**
72
+ * Static data source - returns options directly
73
+ */
74
+ private static fetchStatic;
75
+ /**
76
+ * Remote data fetching with caching
77
+ */
78
+ private static fetchRemote;
79
+ /**
80
+ * Computed data source - derives data from other fields
81
+ *
82
+ * SECURITY NOTE: Uses new Function() for developer-defined computed expressions.
83
+ * This is intentional library design - expressions should only come from trusted
84
+ * configuration files, never from user input. The expressions are defined by
85
+ * developers at build time, not by end users at runtime.
86
+ */
87
+ private static fetchComputed;
88
+ /**
89
+ * Resolve parameter values from form values
90
+ */
91
+ private static resolveParams;
92
+ /**
93
+ * Apply transformation to fetched data
94
+ *
95
+ * SECURITY NOTE: Uses new Function() for developer-defined transform expressions.
96
+ * This is intentional library design - transforms should only come from trusted
97
+ * configuration files, never from user input. The transforms are defined by
98
+ * developers at build time, not by end users at runtime.
99
+ */
100
+ private static applyTransform;
101
+ /**
102
+ * Build cache key
103
+ */
104
+ private static buildCacheKey;
105
+ /**
106
+ * Get from cache
107
+ */
108
+ private static getFromCache;
109
+ /**
110
+ * Set cache
111
+ */
112
+ private static setCache;
113
+ /**
114
+ * Clear cache
115
+ */
116
+ static clearCache(pattern?: string): void;
117
+ /**
118
+ * Set cache TTL
119
+ */
120
+ static setCacheTTL(ttl: number): void;
121
+ }
122
+ export declare class DataSourceBuilder {
123
+ /**
124
+ * Create a static data source
125
+ */
126
+ static static(options: FieldOption[]): DataSource;
127
+ /**
128
+ * Create a remote data source with GET
129
+ */
130
+ static get(url: string, params?: Record<string, unknown>): DataSource;
131
+ /**
132
+ * Create a remote data source with POST
133
+ */
134
+ static post(url: string, _params?: Record<string, unknown>): DataSource;
135
+ /**
136
+ * Create a computed data source
137
+ */
138
+ static computed(dependencies: string[], computeExpression: string): DataSource;
139
+ /**
140
+ * Create a data source that depends on another field
141
+ */
142
+ static dependent(url: string, dependencyField: string, paramName?: string): DataSource;
143
+ /**
144
+ * Create a searchable data source
145
+ */
146
+ static searchable(url: string, searchParam?: string): DataSource;
147
+ }
148
+ export declare class DataTransformers {
149
+ /**
150
+ * Transform array to label/value options
151
+ */
152
+ static toOptions(labelKey?: string, valueKey?: string): string;
153
+ /**
154
+ * Filter data
155
+ */
156
+ static filter(predicate: string): string;
157
+ /**
158
+ * Sort data
159
+ */
160
+ static sort(key: string, order?: 'asc' | 'desc'): string;
161
+ /**
162
+ * Map data
163
+ */
164
+ static map(expression: string): string;
165
+ /**
166
+ * Extract nested property
167
+ */
168
+ static extract(path: string): string;
169
+ /**
170
+ * Combine transformations
171
+ */
172
+ static pipe(...transforms: string[]): string;
173
+ }