@fpkit/acss 0.5.8 → 0.5.12

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 (245) hide show
  1. package/README.md +425 -18
  2. package/libs/chunk-23ANBDCR.js +8 -0
  3. package/libs/chunk-23ANBDCR.js.map +1 -0
  4. package/libs/chunk-5M57K4SW.js +8 -0
  5. package/libs/chunk-5M57K4SW.js.map +1 -0
  6. package/libs/chunk-5ZM4XL44.js +8 -0
  7. package/libs/chunk-5ZM4XL44.js.map +1 -0
  8. package/libs/chunk-6BVXFW7U.cjs +15 -0
  9. package/libs/chunk-6BVXFW7U.cjs.map +1 -0
  10. package/libs/chunk-6TE5QEVE.cjs +13 -0
  11. package/libs/chunk-6TE5QEVE.cjs.map +1 -0
  12. package/libs/chunk-7K76RW2A.cjs +18 -0
  13. package/libs/chunk-7K76RW2A.cjs.map +1 -0
  14. package/libs/chunk-BHRQBJRY.js +8 -0
  15. package/libs/chunk-BHRQBJRY.js.map +1 -0
  16. package/libs/chunk-BIP2NY53.js +8 -0
  17. package/libs/chunk-BIP2NY53.js.map +1 -0
  18. package/libs/chunk-BSPKFLO4.js +8 -0
  19. package/libs/chunk-BSPKFLO4.js.map +1 -0
  20. package/libs/chunk-BV5CLH44.cjs +18 -0
  21. package/libs/chunk-BV5CLH44.cjs.map +1 -0
  22. package/libs/chunk-DKGJHKGW.js +9 -0
  23. package/libs/chunk-DKGJHKGW.js.map +1 -0
  24. package/libs/chunk-DV56L5YX.cjs +18 -0
  25. package/libs/chunk-DV56L5YX.cjs.map +1 -0
  26. package/libs/chunk-E3XP6BEX.cjs +16 -0
  27. package/libs/chunk-E3XP6BEX.cjs.map +1 -0
  28. package/libs/chunk-ECLD37WN.cjs +16 -0
  29. package/libs/chunk-ECLD37WN.cjs.map +1 -0
  30. package/libs/chunk-EQ67LF46.js +9 -0
  31. package/libs/chunk-EQ67LF46.js.map +1 -0
  32. package/libs/chunk-G55UJ53G.cjs +16 -0
  33. package/libs/chunk-G55UJ53G.cjs.map +1 -0
  34. package/libs/chunk-HYBZBN4G.js +8 -0
  35. package/libs/chunk-HYBZBN4G.js.map +1 -0
  36. package/libs/chunk-ICCKQ2GC.cjs +15 -0
  37. package/libs/chunk-ICCKQ2GC.cjs.map +1 -0
  38. package/libs/chunk-IYUN2EW3.cjs +15 -0
  39. package/libs/chunk-IYUN2EW3.cjs.map +1 -0
  40. package/libs/chunk-KKLTUJFB.cjs +31 -0
  41. package/libs/chunk-KKLTUJFB.cjs.map +1 -0
  42. package/libs/chunk-LHVJKDMA.cjs +15 -0
  43. package/libs/chunk-LHVJKDMA.cjs.map +1 -0
  44. package/libs/chunk-LIQJ7ZZR.js +8 -0
  45. package/libs/chunk-LIQJ7ZZR.js.map +1 -0
  46. package/libs/chunk-LL7HTLMS.cjs +15 -0
  47. package/libs/chunk-LL7HTLMS.cjs.map +1 -0
  48. package/libs/chunk-LT5KZ2QW.cjs +22 -0
  49. package/libs/chunk-LT5KZ2QW.cjs.map +1 -0
  50. package/libs/chunk-M5QL5TAE.cjs +14 -0
  51. package/libs/chunk-M5QL5TAE.cjs.map +1 -0
  52. package/libs/chunk-NE6YXTMC.js +7 -0
  53. package/libs/chunk-NE6YXTMC.js.map +1 -0
  54. package/libs/chunk-NHYXGV3L.js +8 -0
  55. package/libs/chunk-NHYXGV3L.js.map +1 -0
  56. package/libs/chunk-O6QZBB6G.js +9 -0
  57. package/libs/chunk-O6QZBB6G.js.map +1 -0
  58. package/libs/chunk-P7TTEYCD.js +7 -0
  59. package/libs/chunk-P7TTEYCD.js.map +1 -0
  60. package/libs/chunk-PPOOBUOS.js +8 -0
  61. package/libs/chunk-PPOOBUOS.js.map +1 -0
  62. package/libs/chunk-QCMV4VQZ.js +8 -0
  63. package/libs/chunk-QCMV4VQZ.js.map +1 -0
  64. package/libs/chunk-QVV34QEH.cjs +32 -0
  65. package/libs/chunk-QVV34QEH.cjs.map +1 -0
  66. package/libs/chunk-S7BABR7Z.cjs +13 -0
  67. package/libs/chunk-S7BABR7Z.cjs.map +1 -0
  68. package/libs/chunk-SXVZSWX6.js +11 -0
  69. package/libs/chunk-SXVZSWX6.js.map +1 -0
  70. package/libs/chunk-X3EVB7VS.cjs +15 -0
  71. package/libs/chunk-X3EVB7VS.cjs.map +1 -0
  72. package/libs/chunk-YWOYVRFT.js +9 -0
  73. package/libs/chunk-YWOYVRFT.js.map +1 -0
  74. package/libs/component-props-a8a2f97e.d.ts +38 -0
  75. package/libs/components/breadcrumbs/breadcrumb.cjs +20 -0
  76. package/libs/components/breadcrumbs/breadcrumb.cjs.map +1 -0
  77. package/libs/components/breadcrumbs/breadcrumb.d.cts +51 -0
  78. package/libs/components/breadcrumbs/breadcrumb.d.ts +51 -0
  79. package/libs/components/breadcrumbs/breadcrumb.js +5 -0
  80. package/libs/components/breadcrumbs/breadcrumb.js.map +1 -0
  81. package/libs/components/button.cjs +19 -0
  82. package/libs/components/button.cjs.map +1 -0
  83. package/libs/components/button.d.cts +16 -0
  84. package/libs/components/button.d.ts +16 -0
  85. package/libs/components/button.js +4 -0
  86. package/libs/components/button.js.map +1 -0
  87. package/libs/components/card.cjs +31 -0
  88. package/libs/components/card.cjs.map +1 -0
  89. package/libs/components/card.d.cts +58 -0
  90. package/libs/components/card.d.ts +58 -0
  91. package/libs/components/card.js +4 -0
  92. package/libs/components/card.js.map +1 -0
  93. package/libs/components/details/details.css +1 -1
  94. package/libs/components/details/details.css.map +1 -1
  95. package/libs/components/details/details.min.css +2 -2
  96. package/libs/components/dialog/dialog.cjs +22 -0
  97. package/libs/components/dialog/dialog.cjs.map +1 -0
  98. package/libs/components/dialog/dialog.d.cts +51 -0
  99. package/libs/components/dialog/dialog.d.ts +51 -0
  100. package/libs/components/dialog/dialog.js +7 -0
  101. package/libs/components/dialog/dialog.js.map +1 -0
  102. package/libs/components/form/fields.cjs +19 -0
  103. package/libs/components/form/fields.cjs.map +1 -0
  104. package/libs/components/form/fields.d.cts +24 -0
  105. package/libs/components/form/fields.d.ts +24 -0
  106. package/libs/components/form/fields.js +4 -0
  107. package/libs/components/form/fields.js.map +1 -0
  108. package/libs/components/form/inputs.cjs +19 -0
  109. package/libs/components/form/inputs.cjs.map +1 -0
  110. package/libs/components/form/inputs.d.cts +2 -0
  111. package/libs/components/form/inputs.d.ts +2 -0
  112. package/libs/components/form/inputs.js +4 -0
  113. package/libs/components/form/inputs.js.map +1 -0
  114. package/libs/components/form/textarea.cjs +19 -0
  115. package/libs/components/form/textarea.cjs.map +1 -0
  116. package/libs/components/form/textarea.d.cts +29 -0
  117. package/libs/components/form/textarea.d.ts +29 -0
  118. package/libs/components/form/textarea.js +4 -0
  119. package/libs/components/form/textarea.js.map +1 -0
  120. package/libs/components/heading/heading.cjs +10 -0
  121. package/libs/components/heading/heading.cjs.map +1 -0
  122. package/libs/components/heading/heading.d.cts +14 -0
  123. package/libs/components/heading/heading.d.ts +14 -0
  124. package/libs/components/heading/heading.js +4 -0
  125. package/libs/components/heading/heading.js.map +1 -0
  126. package/libs/components/icons/icon.cjs +19 -0
  127. package/libs/components/icons/icon.cjs.map +1 -0
  128. package/libs/{icons-31ace3de.d.ts → components/icons/icon.d.cts} +4 -58
  129. package/libs/components/icons/icon.d.ts +301 -0
  130. package/libs/components/icons/icon.js +4 -0
  131. package/libs/components/icons/icon.js.map +1 -0
  132. package/libs/components/link/link.cjs +19 -0
  133. package/libs/components/link/link.cjs.map +1 -0
  134. package/libs/components/link/link.d.cts +19 -0
  135. package/libs/components/link/link.d.ts +19 -0
  136. package/libs/components/link/link.js +4 -0
  137. package/libs/components/link/link.js.map +1 -0
  138. package/libs/components/list/list.cjs +23 -0
  139. package/libs/components/list/list.cjs.map +1 -0
  140. package/libs/components/list/list.d.cts +39 -0
  141. package/libs/components/list/list.d.ts +39 -0
  142. package/libs/components/list/list.js +4 -0
  143. package/libs/components/list/list.js.map +1 -0
  144. package/libs/components/modal.cjs +14 -0
  145. package/libs/components/modal.cjs.map +1 -0
  146. package/libs/components/modal.d.cts +35 -0
  147. package/libs/components/modal.d.ts +35 -0
  148. package/libs/components/modal.js +5 -0
  149. package/libs/components/modal.js.map +1 -0
  150. package/libs/components/nav/nav.cjs +28 -0
  151. package/libs/components/nav/nav.cjs.map +1 -0
  152. package/libs/components/nav/nav.d.cts +44 -0
  153. package/libs/components/nav/nav.d.ts +44 -0
  154. package/libs/components/nav/nav.js +5 -0
  155. package/libs/components/nav/nav.js.map +1 -0
  156. package/libs/components/popover/popover.cjs +23 -0
  157. package/libs/components/popover/popover.cjs.map +1 -0
  158. package/libs/components/popover/popover.d.cts +40 -0
  159. package/libs/components/popover/popover.d.ts +40 -0
  160. package/libs/components/popover/popover.js +4 -0
  161. package/libs/components/popover/popover.js.map +1 -0
  162. package/libs/components/tables/table.cjs +21 -0
  163. package/libs/components/tables/table.cjs.map +1 -0
  164. package/libs/components/tables/table.d.cts +36 -0
  165. package/libs/components/tables/table.d.ts +36 -0
  166. package/libs/components/tables/table.js +4 -0
  167. package/libs/components/tables/table.js.map +1 -0
  168. package/libs/components/text/text.cjs +23 -0
  169. package/libs/components/text/text.cjs.map +1 -0
  170. package/libs/components/text/text.d.cts +30 -0
  171. package/libs/components/text/text.d.ts +30 -0
  172. package/libs/components/text/text.js +4 -0
  173. package/libs/components/text/text.js.map +1 -0
  174. package/libs/icons.cjs +3 -2
  175. package/libs/icons.d.cts +3 -1
  176. package/libs/icons.d.ts +3 -1
  177. package/libs/icons.js +2 -1
  178. package/libs/index.cjs +152 -61
  179. package/libs/index.cjs.map +1 -1
  180. package/libs/index.css +1 -1
  181. package/libs/index.css.map +1 -1
  182. package/libs/index.d.cts +53 -459
  183. package/libs/index.d.ts +53 -459
  184. package/libs/index.js +24 -7
  185. package/libs/index.js.map +1 -1
  186. package/libs/inputs-f3a216db.d.ts +45 -0
  187. package/libs/ui-9a6f9f8d.d.ts +24 -0
  188. package/package.json +87 -2
  189. package/src/components/README.mdx +1 -1
  190. package/src/components/alert/README.mdx +1 -1
  191. package/src/components/alert/alert.stories.tsx +2 -2
  192. package/src/components/alert/elements/README.mdx +1 -1
  193. package/src/components/alert/elements/dismiss-button.stories.tsx +2 -2
  194. package/src/components/badge/badge.mdx +1 -1
  195. package/src/components/badge/badge.stories.tsx +2 -2
  196. package/src/components/breadcrumbs/README.mdx +91 -0
  197. package/src/components/breadcrumbs/breadcrumb.stories.tsx +2 -2
  198. package/src/components/breadcrumbs/breadcrumb.tsx +92 -87
  199. package/src/components/button.ts +2 -0
  200. package/src/components/buttons/README.mdx +1 -1
  201. package/src/components/buttons/button.stories.tsx +2 -2
  202. package/src/components/buttons/button.test.tsx +1 -1
  203. package/src/components/card.ts +2 -0
  204. package/src/components/cards/card.stories.tsx +2 -2
  205. package/src/components/details/README.mdx +1 -1
  206. package/src/components/details/details.scss +7 -0
  207. package/src/components/details/details.stories.tsx +2 -2
  208. package/src/components/dialog/README.mdx +1 -1
  209. package/src/components/dialog/dialog-modal.stories.tsx +2 -2
  210. package/src/components/dialog/dialog-modal.tsx +1 -1
  211. package/src/components/dialog/dialog.stories.tsx +2 -2
  212. package/src/components/dialog/views/README.mdx +1 -1
  213. package/src/components/dialog/views/dialog-header.stories.tsx +2 -2
  214. package/src/components/form/form.stories.tsx +2 -2
  215. package/src/components/form/input.stories.tsx +2 -2
  216. package/src/components/form/inputs.tsx +18 -24
  217. package/src/components/form/select.stories.tsx +2 -2
  218. package/src/components/fp.test.tsx +52 -50
  219. package/src/components/heading/heading.stories.tsx +2 -2
  220. package/src/components/icons/icon.stories.tsx +1 -1
  221. package/src/components/images/figure.stories.tsx +2 -2
  222. package/src/components/images/img.stories.tsx +2 -2
  223. package/src/components/layout/footer.stories.tsx +10 -19
  224. package/src/components/layout/landmarks.stories.tsx +22 -24
  225. package/src/components/layout/main.stories.tsx +21 -25
  226. package/src/components/link/link.stories.tsx +2 -2
  227. package/src/components/list/list.stories.tsx +2 -2
  228. package/src/components/modal.ts +1 -0
  229. package/src/components/nav/nav.stories.tsx +2 -2
  230. package/src/components/popover/popover.stories.tsx +2 -2
  231. package/src/components/progress/progress.stories.tsx +1 -1
  232. package/src/components/tag/tag.stories.tsx +2 -2
  233. package/src/components/text/text.stories.tsx +2 -2
  234. package/src/components/text-to-speech/TextToSpeech.stories.tsx +1 -1
  235. package/src/decorators/instructions.tsx +2 -1
  236. package/src/index.ts +43 -19
  237. package/src/patterns/page/page-header.stories.tsx +2 -2
  238. package/src/styles/details/details.css +8 -0
  239. package/src/styles/details/details.css.map +1 -1
  240. package/src/styles/index.css +8 -0
  241. package/src/styles/index.css.map +1 -1
  242. package/libs/chunk-PWVRDQ3R.js +0 -8
  243. package/libs/chunk-PWVRDQ3R.js.map +0 -1
  244. package/libs/chunk-SVS4MX3U.cjs +0 -31
  245. package/libs/chunk-SVS4MX3U.cjs.map +0 -1
package/README.md CHANGED
@@ -1,37 +1,444 @@
1
- # FP Kit
1
+ # @fpkit/acss
2
2
 
3
- A lightweight React Headless UI library for building modern and accessible components that leverage CSS custom properties for reactive Styles. [FPKIT component storybook](https://fpkit.netlify.app/?path=/story/guides-introduction--page)
3
+ A lightweight React UI library for building modern and accessible components that leverage CSS custom properties for reactive styles. Built with TypeScript and designed for optimal tree-shaking and bundle size optimization.
4
4
 
5
- ## Install
5
+ [![npm version](https://badge.fury.io/js/@fpkit%2Facss.svg)](https://badge.fury.io/js/@fpkit%2Facss)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ [📚 **Storybook Documentation**](https://fpkit.netlify.app/?path=/story/guides-introduction--page) | [🎯 **Component Playground**](https://fpkit.netlify.app/)
9
+
10
+ ## ✨ Features
11
+
12
+ - **🎯 Dual Export Strategy**: Choose between convenience (barrel exports) or optimization (individual imports)
13
+ - **📦 Tree-Shakable**: Import only the components you need
14
+ - **♿ Accessible**: Built with accessibility best practices
15
+ - **🎨 CSS Custom Properties**: Reactive styling with CSS variables
16
+ - **📱 Responsive**: Mobile-first design approach
17
+ - **⚡ TypeScript**: Full type safety and excellent DX
18
+ - **🔧 Headless**: Minimal styling, maximum customization
19
+
20
+ ## 📦 Installation
6
21
 
7
22
  ```bash
8
- npm i @fpkit/react
23
+ npm install @fpkit/acss
24
+ # or
25
+ yarn add @fpkit/acss
26
+ # or
27
+ pnpm add @fpkit/acss
9
28
  ```
10
29
 
11
- ### Usage
30
+ ## 🚀 Quick Start
12
31
 
13
- ```jsx
14
- import { FP, Badge } from @fpkit/fp
32
+ ### Option 1: Barrel Imports (Convenience)
15
33
 
16
- export App () {
34
+ Perfect for rapid prototyping and when bundle size isn't critical:
35
+
36
+ ```tsx
37
+ import { Button, Card, Input, Modal } from '@fpkit/acss';
38
+ import '@fpkit/acss/styles';
39
+
40
+ function App() {
17
41
  return (
18
- <p>
19
- <FP as='h3'>FP KIt <Badge elm="span" role="note">Beta</Badge>
20
- </FP>
21
- </p>
22
- )
42
+ <div>
43
+ <Card>
44
+ <Card.Title>Welcome to FPKit</Card.Title>
45
+ <Card.Content>
46
+ <Input type="text" placeholder="Enter your name" />
47
+ <Button type="button">Submit</Button>
48
+ </Card.Content>
49
+ </Card>
50
+ </div>
51
+ );
23
52
  }
53
+ ```
54
+
55
+ ### Option 2: Individual Imports (Tree-Shaking)
56
+
57
+ Optimal for production builds and bundle size optimization:
58
+
59
+ ```tsx
60
+ import { Button } from '@fpkit/acss/button';
61
+ import { Card } from '@fpkit/acss/card';
62
+ import { Input } from '@fpkit/acss/input';
63
+ import '@fpkit/acss/styles';
64
+
65
+ function App() {
66
+ return (
67
+ <div>
68
+ <Card>
69
+ <Card.Title>Welcome to FPKit</Card.Title>
70
+ <Card.Content>
71
+ <Input type="text" placeholder="Enter your name" />
72
+ <Button type="button">Submit</Button>
73
+ </Card.Content>
74
+ </Card>
75
+ </div>
76
+ );
77
+ }
78
+ ```
79
+
80
+ ## 🧩 Core Components
24
81
 
25
- export default App
82
+ ### Button
83
+
84
+ Accessible button component with multiple variants:
85
+
86
+ ```tsx
87
+ // Barrel import
88
+ import { Button } from '@fpkit/acss';
89
+
90
+ // Individual import
91
+ import { Button } from '@fpkit/acss/button';
92
+
93
+ // Usage
94
+ <Button type="button" onClick={() => console.log('clicked')}>
95
+ Click me
96
+ </Button>
97
+
98
+ // With TypeScript
99
+ import { Button, type ButtonProps } from '@fpkit/acss/button';
100
+
101
+ const buttonProps: ButtonProps = {
102
+ type: 'submit',
103
+ disabled: false,
104
+ children: 'Submit Form'
105
+ };
26
106
  ```
27
107
 
28
- ### Components
108
+ ### Card
109
+
110
+ Flexible card component with composable parts:
111
+
112
+ ```tsx
113
+ // Individual import
114
+ import { Card } from '@fpkit/acss/card';
115
+
116
+ // Usage
117
+ <Card>
118
+ <Card.Title>Card Title</Card.Title>
119
+ <Card.Content>
120
+ <p>This is the card content area.</p>
121
+ </Card.Content>
122
+ <Card.Footer>
123
+ <Button type="button">Action</Button>
124
+ </Card.Footer>
125
+ </Card>
126
+
127
+ // Custom styling
128
+ <Card classes="custom-card" styles={{ padding: '2rem' }}>
129
+ <Card.Title>Styled Card</Card.Title>
130
+ <Card.Content>Content with custom styling</Card.Content>
131
+ </Card>
132
+ ```
133
+
134
+ ### Modal
135
+
136
+ Accessible modal dialog with focus management:
137
+
138
+ ```tsx
139
+ import { Modal } from '@fpkit/acss/modal';
140
+
141
+ <Modal
142
+ openChild="Open Modal"
143
+ closeChild="Close"
144
+ modalHeader={<h2>Modal Title</h2>}
145
+ modalFooter={
146
+ <div>
147
+ <Button type="button">Cancel</Button>
148
+ <Button type="button">Confirm</Button>
149
+ </div>
150
+ }
151
+ >
152
+ <p>Modal content goes here.</p>
153
+ </Modal>
154
+ ```
155
+
156
+ ### Input
157
+
158
+ Form input component with validation support:
159
+
160
+ ```tsx
161
+ import { Input } from '@fpkit/acss/input';
162
+
163
+ <Input
164
+ type="email"
165
+ placeholder="Enter your email"
166
+ required
167
+ aria-label="Email address"
168
+ />
169
+
170
+ // With field wrapper
171
+ import { Field } from '@fpkit/acss';
172
+
173
+ <Field>
174
+ <Field.Label>Email Address</Field.Label>
175
+ <Input type="email" placeholder="you@example.com" />
176
+ <Field.Error>Please enter a valid email</Field.Error>
177
+ </Field>
178
+ ```
179
+
180
+ ### Navigation
181
+
182
+ Semantic navigation components:
183
+
184
+ ```tsx
185
+ import { Nav, NavList, NavItem } from '@fpkit/acss';
186
+
187
+ <Nav>
188
+ <NavList>
189
+ <NavItem>
190
+ <Link href="/">Home</Link>
191
+ </NavItem>
192
+ <NavItem>
193
+ <Link href="/about">About</Link>
194
+ </NavItem>
195
+ <NavItem>
196
+ <Link href="/contact">Contact</Link>
197
+ </NavItem>
198
+ </NavList>
199
+ </Nav>
200
+ ```
201
+
202
+ ### Text & Typography
203
+
204
+ Semantic text components:
205
+
206
+ ```tsx
207
+ import { Text, Heading } from '@fpkit/acss';
208
+
209
+ <Heading as="h1" size="xl">
210
+ Page Title
211
+ </Heading>
212
+
213
+ <Text as="p" size="lg">
214
+ This is a paragraph with large text.
215
+ </Text>
216
+
217
+ <Text as="span" variant="muted">
218
+ Muted text for secondary information.
219
+ </Text>
220
+ ```
221
+
222
+ ## 🎨 Styling & Theming
223
+
224
+ FPKit uses CSS custom properties for theming and styling:
225
+
226
+ ```css
227
+ /* Global theme variables */
228
+ :root {
229
+ --fp-color-primary: #007bff;
230
+ --fp-color-secondary: #6c757d;
231
+ --fp-spacing-sm: 0.5rem;
232
+ --fp-spacing-md: 1rem;
233
+ --fp-spacing-lg: 1.5rem;
234
+ --fp-border-radius: 0.375rem;
235
+ }
236
+
237
+ /* Component-specific styling */
238
+ .custom-button {
239
+ --fp-button-bg: var(--fp-color-primary);
240
+ --fp-button-color: white;
241
+ --fp-button-padding: var(--fp-spacing-md);
242
+ }
243
+ ```
244
+
245
+ ### Component Styling
246
+
247
+ ```tsx
248
+ // Inline styles
249
+ <Button styles={{ backgroundColor: 'red', color: 'white' }}>
250
+ Styled Button
251
+ </Button>
252
+
253
+ // CSS classes
254
+ <Card classes="shadow-lg border-rounded">
255
+ <Card.Content>Styled card</Card.Content>
256
+ </Card>
257
+
258
+ // Data attributes for CSS targeting
259
+ <Button data-variant="primary" data-size="large">
260
+ Data Attribute Styling
261
+ </Button>
262
+ ```
263
+
264
+ ## 🛠️ Framework Integration
265
+
266
+ ### Next.js
267
+
268
+ ```tsx
269
+ // pages/_app.tsx
270
+ import '@fpkit/acss/styles';
271
+ import type { AppProps } from 'next/app';
272
+
273
+ export default function App({ Component, pageProps }: AppProps) {
274
+ return <Component {...pageProps} />;
275
+ }
276
+
277
+ // pages/index.tsx
278
+ import { Button } from '@fpkit/acss/button';
279
+ import { Card } from '@fpkit/acss/card';
280
+
281
+ export default function Home() {
282
+ return (
283
+ <main>
284
+ <Card>
285
+ <Card.Title>Next.js + FPKit</Card.Title>
286
+ <Card.Content>
287
+ <Button type="button">Get Started</Button>
288
+ </Card.Content>
289
+ </Card>
290
+ </main>
291
+ );
292
+ }
293
+ ```
294
+
295
+ ### Vite + React
296
+
297
+ ```tsx
298
+ // main.tsx
299
+ import React from 'react';
300
+ import ReactDOM from 'react-dom/client';
301
+ import '@fpkit/acss/styles';
302
+ import App from './App.tsx';
303
+
304
+ ReactDOM.createRoot(document.getElementById('root')!).render(
305
+ <React.StrictMode>
306
+ <App />
307
+ </React.StrictMode>,
308
+ );
309
+
310
+ // App.tsx
311
+ import { Button, Card } from '@fpkit/acss';
312
+
313
+ function App() {
314
+ return (
315
+ <Card>
316
+ <Card.Title>Vite + React + FPKit</Card.Title>
317
+ <Card.Content>
318
+ <Button type="button">Hello World</Button>
319
+ </Card.Content>
320
+ </Card>
321
+ );
322
+ }
323
+
324
+ export default App;
325
+ ```
326
+
327
+ ## 📋 Available Components
328
+
329
+ ### Core UI Components
330
+
331
+ - **Button** - Accessible button with variants
332
+ - **Card** - Flexible card container with composable parts
333
+ - **Modal** - Accessible modal dialog
334
+ - **Dialog** - General purpose dialog component
335
+ - **Input** - Form input with validation
336
+ - **Field** - Form field wrapper with label and error
337
+ - **Link** - Accessible link component
338
+ - **List** - Semantic list components
339
+
340
+ ### Layout Components
341
+
342
+ - **Box** - Generic container component
343
+ - **Nav** - Navigation components
344
+ - **Landmarks** - Semantic landmark components
345
+
346
+ ### Typography
347
+
348
+ - **Text** - Semantic text component
349
+ - **Heading** - Heading component with sizes
350
+
351
+ ### Media
352
+
353
+ - **Icon** - SVG icon component
354
+ - **Image** - Responsive image component
355
+
356
+ ### Data Display
357
+
358
+ - **Table** - Accessible table components
359
+ - **Tag** - Tag/badge component
360
+ - **Badge** - Status badge component
361
+
362
+ ### Specialized
363
+
364
+ - **TextToSpeech** - Text-to-speech component
365
+ - **Popover** - Popover/tooltip component
366
+ - **Breadcrumb** - Navigation breadcrumbs
367
+
368
+ ## 🎯 Import Strategies
369
+
370
+ ### When to Use Barrel Imports
371
+
372
+ - Rapid prototyping
373
+ - Small applications
374
+ - When using many components
375
+ - Development/testing environments
376
+
377
+ ### When to Use Individual Imports
378
+
379
+ - Production applications
380
+ - Performance-critical apps
381
+ - When using few components
382
+ - Library/package development
383
+
384
+ ### Bundle Size Comparison
385
+
386
+ ```bash
387
+ # Barrel import (all components)
388
+ import { Button, Card, Modal } from '@fpkit/acss';
389
+ # Bundle size: ~45KB (example)
390
+
391
+ # Individual imports (tree-shaken)
392
+ import { Button } from '@fpkit/acss/button';
393
+ import { Card } from '@fpkit/acss/card';
394
+ import { Modal } from '@fpkit/acss/modal';
395
+ # Bundle size: ~12KB (example)
396
+ ```
397
+
398
+ ## 🔧 TypeScript Support
399
+
400
+ Full TypeScript support with comprehensive type definitions:
401
+
402
+ ```tsx
403
+ import { Button, type ButtonProps } from '@fpkit/acss/button';
404
+ import { Card, type CardProps } from '@fpkit/acss/card';
405
+
406
+ // Type-safe props
407
+ const buttonProps: ButtonProps = {
408
+ type: 'button',
409
+ onClick: (e) => console.log(e),
410
+ children: 'Click me'
411
+ };
412
+
413
+ // Component with proper typing
414
+ const MyButton: React.FC<ButtonProps> = (props) => {
415
+ return <Button {...props} />;
416
+ };
417
+ ```
418
+
419
+ ## 🧪 Testing
420
+
421
+ Components are designed for easy testing:
422
+
423
+ ```tsx
424
+ import { render, screen } from '@testing-library/react';
425
+ import { Button } from '@fpkit/acss/button';
426
+
427
+ test('renders button with text', () => {
428
+ render(<Button type="button">Click me</Button>);
429
+ expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument();
430
+ });
431
+ ```
432
+
433
+ ## 🤝 Contributing
434
+
435
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
29
436
 
30
- ### License
437
+ ## 📄 License
31
438
 
32
439
  MIT License
33
440
 
34
- Copyright (c) 2022 Shawn Sandy
441
+ Copyright (c) 2024 Shawn Sandy
35
442
 
36
443
  Permission is hereby granted, free of charge, to any person obtaining a copy
37
444
  of this software and associated documentation files (the "Software"), to deal
@@ -45,7 +452,7 @@ copies or substantial portions of the Software.
45
452
 
46
453
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
454
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
455
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
456
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
457
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
458
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
@@ -0,0 +1,8 @@
1
+ import { b } from './chunk-GCGKYLDG.js';
2
+ import e from 'react';
3
+
4
+ var P={display:"block",position:"absolute",background:"#000",border:"1px solid #010101",padding:"10px",color:"#fff",transition:"opacity .5s ease-in-out"},o=({children:n,popoverTrigger:l,styles:a,...d})=>{let t=e.useRef(null),r=e.useRef(null),{isVisible:p,popoverPosition:s,handlePointerEvent:v,handlePointerLeave:c}=b(t,r),f={opacity:p?1:0,top:s.top,left:s.left,zIndex:999};return e.createElement(e.Fragment,null,e.createElement("div",{ref:t,onPointerEnter:v,onPointerLeave:c,...d},l),p&&e.createElement("div",{ref:r,style:{...f,...a}},n))},x=o;o.displayName="Popover";o.styles=P;
5
+
6
+ export { P as a, o as b, x as c };
7
+ //# sourceMappingURL=out.js.map
8
+ //# sourceMappingURL=chunk-23ANBDCR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/popover/popover.tsx"],"names":["React","defaultStyles","Popover","children","popoverTrigger","styles","props","hoverRef","popOverRef","isVisible","popoverPosition","handlePointerEvent","handlePointerLeave","use_popover_default","popoverStyles","popover_default"],"mappings":"wCAAA,OAAOA,MAAW,QAeX,IAAMC,EAAgB,CAC3B,QAAS,QACT,SAAU,WACV,WAAY,OACZ,OAAQ,oBACR,QAAS,OACT,MAAO,OACP,WAAY,yBACd,EAsBaC,EAAU,CAAC,CACtB,SAAAC,EACA,eAAAC,EACA,OAAAC,EACA,GAAGC,CACL,IAAiC,CAC/B,IAAMC,EAAWP,EAAM,OAAO,IAAI,EAC5BQ,EAAaR,EAAM,OAAO,IAAI,EAC9B,CAAE,UAAAS,EAAW,gBAAAC,EAAiB,mBAAAC,EAAoB,mBAAAC,CAAmB,EACzEC,EAAWN,EAAUC,CAAU,EAC3BM,EAAgB,CACpB,QAASL,EAAY,EAAI,EACzB,IAAKC,EAAgB,IACrB,KAAMA,EAAgB,KAEtB,OAAQ,GACV,EAEA,OACEV,EAAA,cAAAA,EAAA,cACEA,EAAA,cAAC,OACC,IAAKO,EACL,eAAgBI,EAChB,eAAgBC,EACf,GAAGN,GAEHF,CACH,EACCK,GACCT,EAAA,cAAC,OAAI,IAAKQ,EAAY,MAAO,CAAE,GAAGM,EAAe,GAAGT,CAAO,GACxDF,CACH,CAEJ,CAEJ,EAEOY,EAAQb,EACfA,EAAQ,YAAc,UACtBA,EAAQ,OAASD","sourcesContent":["import React from 'react'\nimport usePopover from '#hooks/popover/use-popover'\n\n/**\n * Interface for props accepted by the Popover component\n *\n * @property {ReactNode} children - The content to show in the popover\n * @property {ReactNode} [content] - Optional alternative content for popover\n */\nexport type PopoverProps = {\n children: React.ReactNode\n popoverTrigger: React.ReactNode\n styles?: {}\n}\n\nexport const defaultStyles = {\n display: 'block',\n position: 'absolute',\n background: '#000',\n border: '1px solid #010101',\n padding: '10px',\n color: '#fff',\n transition: 'opacity .5s ease-in-out',\n} as React.CSSProperties\n\n/**\n * Popover component to display popover content.\n *\n * @param props - The props for the component\n * @param props.children - The content to show in the popover\n * @param props.popoverTrigger - The element that triggers the popover on hover\n *\n * @returns JSX.Element - The rendered JSX element for the Popover\n * @example - <Popover popoverTrigger={<button>Hover here</button>}>Popover content</Popover>\n *\n * The component uses the usePopover hook to handle popover visibility and positioning.\n *\n * It renders the triggerElement, and conditionally renders the popover content\n * positioned absolutely when visible.\n *\n * Inline styles handle visuals like background, border, padding, etc.\n *\n * Transforms and opacity animate the enter/exit transition of the popover.\n */\n\nexport const Popover = ({\n children,\n popoverTrigger,\n styles,\n ...props\n}: PopoverProps): JSX.Element => {\n const hoverRef = React.useRef(null)\n const popOverRef = React.useRef(null)\n const { isVisible, popoverPosition, handlePointerEvent, handlePointerLeave } =\n usePopover(hoverRef, popOverRef)\n const popoverStyles = {\n opacity: isVisible ? 1 : 0,\n top: popoverPosition.top,\n left: popoverPosition.left,\n // transform: `translateY(${isVisible ? '0px' : '-50px'})`,\n zIndex: 999,\n } as React.CSSProperties\n\n return (\n <>\n <div\n ref={hoverRef}\n onPointerEnter={handlePointerEvent}\n onPointerLeave={handlePointerLeave}\n {...props}\n >\n {popoverTrigger}\n </div>\n {isVisible && (\n <div ref={popOverRef} style={{ ...popoverStyles, ...styles }}>\n {children}\n </div>\n )}\n </>\n )\n}\n\nexport default Popover\nPopover.displayName = 'Popover'\nPopover.styles = defaultStyles\n"]}
@@ -0,0 +1,8 @@
1
+ import { a } from './chunk-P7TTEYCD.js';
2
+ import r from 'react';
3
+
4
+ var s=({children:o,...e})=>r.createElement(a,{as:"caption",...e},o),m=({children:o,...e})=>r.createElement(a,{as:"thead",...e},o),d=({children:o,...e})=>r.createElement(a,{as:"tbody",...e},o),i=({children:o,...e})=>r.createElement(a,{as:"tr",...e},o),y=({children:o,...e})=>r.createElement(a,{as:"td",...e},o),T=({id:o,dataStyle:e,children:n,...a$1})=>r.createElement(a,{as:"section",id:o,...a$1,"data-style":"table-wrapper"},r.createElement("table",null,n));T.displayName="Table";s.displayName="Caption";m.displayName="Thead";d.displayName="Tbody";i.displayName="Tr";y.displayName="Td";var l=o=>{let e=o.map((n,a)=>r.createElement("th",{key:a},n));return r.createElement("tr",null,e)},b=o=>{let e=o.map((n,a)=>r.createElement("tr",{key:a}));return r.createElement(d,null,e)},P=({tblBody:o,tblCaption:e,tblHead:n})=>r.createElement(T,null,e&&r.createElement(s,null,e),r.createElement(m,null,r.createElement(i,null,n)),r.createElement(d,null,o));P.displayName="TBL";b.displayName="renderBody";l.displayName="renderHead";
5
+
6
+ export { s as a, m as b, d as c, i as d, y as e, T as f, l as g, b as h, P as i };
7
+ //# sourceMappingURL=out.js.map
8
+ //# sourceMappingURL=chunk-5M57K4SW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/tables/table-elements.tsx","../src/components/tables/table.tsx"],"names":["React","Caption","children","props","fp_default","Thead","Tbody","Tr","Td","Table","id","dataStyle","RenderHead","data","head","item","index","RenderBody","rec","RenderTable","tblBody","tblCaption","tblHead"],"mappings":"wCAEA,OAAOA,MAAW,QAGX,IAAMC,EAAU,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,IAEzCH,EAAA,cAACI,EAAA,CAAG,GAAG,UAAW,GAAGD,GAClBD,CACH,EAISG,EAAQ,CAAC,CAAE,SAAAH,EAAU,GAAGC,CAAM,IACzCH,EAAA,cAACI,EAAA,CAAG,GAAG,QAAS,GAAGD,GAChBD,CACH,EAGWI,EAAQ,CAAC,CAAE,SAAAJ,EAAU,GAAGC,CAAM,IACzCH,EAAA,cAACI,EAAA,CAAG,GAAG,QAAS,GAAGD,GAChBD,CACH,EAGWK,EAAK,CAAC,CAAE,SAAAL,EAAU,GAAGC,CAAM,IACtCH,EAAA,cAACI,EAAA,CAAG,GAAG,KAAM,GAAGD,GACbD,CACH,EAGWM,EAAK,CAAC,CAAE,SAAAN,EAAU,GAAGC,CAAM,IACtCH,EAAA,cAACI,EAAA,CAAG,GAAG,KAAM,GAAGD,GACbD,CACH,EAGWO,EAAQ,CAAC,CAAE,GAAAC,EAAI,UAAAC,EAAW,SAAAT,EAAU,GAAGC,CAAM,IAEtDH,EAAA,cAACI,EAAA,CACC,GAAG,UACH,GAAIM,EACH,GAAGP,EACJ,aAAW,iBAEXH,EAAA,cAAC,aAAOE,CAAS,CACnB,EAIJO,EAAM,YAAc,QACpBR,EAAQ,YAAc,UACtBI,EAAM,YAAc,QACpBC,EAAM,YAAc,QACpBC,EAAG,YAAc,KACjBC,EAAG,YAAc,KCpDjB,OAAOR,MAAW,QAaX,IAAMY,EAAcC,GAAa,CACtC,IAAMC,EAAOD,EAAK,IAAI,CAACE,EAAMC,IACpBhB,EAAA,cAAC,MAAG,IAAKgB,GAAQD,CAAK,CAC9B,EACD,OAAOf,EAAA,cAAC,UAAIc,CAAK,CACnB,EAKaG,EAAcJ,GAAe,CACxC,IAAMK,EAAML,EAAK,IAAI,CAACE,EAAMC,IAExBhB,EAAA,cAAC,MAAG,IAAKgB,EAGT,CAEH,EACD,OAAOhB,EAAA,cAACM,EAAA,KAAOY,CAAI,CACrB,EAMaC,EAAc,CAAC,CAAE,QAAAC,EAAS,WAAAC,EAAY,QAAAC,CAAQ,IAEvDtB,EAAA,cAACS,EAAA,KACEY,GAAcrB,EAAA,cAACC,EAAA,KAASoB,CAAW,EACpCrB,EAAA,cAACK,EAAA,KACCL,EAAA,cAACO,EAAA,KAAIe,CAAQ,CACf,EACAtB,EAAA,cAACM,EAAA,KAAOc,CAAQ,CAClB,EAIJD,EAAY,YAAc,MAC1BF,EAAW,YAAc,aACzBL,EAAW,YAAc","sourcesContent":["import FP from '../fp'\nimport { ComponentProps } from '../../types'\nimport React from 'react'\n\n\nexport const Caption = ({ children, ...props }: ComponentProps) => {\n return (\n <FP as=\"caption\" {...props}>\n {children}\n </FP>\n )\n}\n\nexport const Thead = ({ children, ...props }: ComponentProps) => (\n <FP as=\"thead\" {...props}>\n {children}\n </FP>\n)\n\nexport const Tbody = ({ children, ...props }: ComponentProps) => (\n <FP as=\"tbody\" {...props}>\n {children}\n </FP>\n)\n\nexport const Tr = ({ children, ...props }: ComponentProps) => (\n <FP as=\"tr\" {...props}>\n {children}\n </FP>\n)\n\nexport const Td = ({ children, ...props }: ComponentProps) => (\n <FP as=\"td\" {...props}>\n {children}\n </FP>\n)\n\nexport const Table = ({ id, dataStyle, children, ...props }: ComponentProps) => {\n return (\n <FP\n as=\"section\"\n id={id}\n {...props}\n data-style=\"table-wrapper\"\n >\n <table>{children}</table>\n </FP>\n )\n}\n\nTable.displayName = 'Table'\nCaption.displayName = 'Caption'\nThead.displayName = 'Thead'\nTbody.displayName = 'Tbody'\nTr.displayName = 'Tr'\nTd.displayName = 'Td'\n\n","import { Table, Caption, Thead, Tbody, Td, Tr } from './table-elements'\nimport { ComponentProps } from '../../types'\n\nimport React from 'react'\n\nexport interface TableProps extends ComponentProps {\n tblHead: React.ReactNode\n tblBody: React.ReactNode\n tblCaption?: React.ReactNode\n}\n\nexport type dataType = { id: number; items: string[] }[]\n\n/**\n * Render the `thead` by passing an array of names\n */\nexport const RenderHead = (data: []) => {\n const head = data.map((item, index) => {\n return <th key={index}>{item}</th>\n })\n return <tr>{head}</tr>\n}\n\n/**\n * Render the table body `tr`, `td` with the data provided\n */\nexport const RenderBody = (data: {}[]) => {\n const rec = data.map((item, index) => {\n return (\n <tr key={index}>\n {/* <td>{item?.id}</td>\n <td>{item?.items}</td> */}\n </tr>\n )\n })\n return <Tbody>{rec}</Tbody>\n}\n\n/**\n * Render the table placing `caption`, `thead` and `tbody` in the correct order\n * caption is optional\n */\nexport const RenderTable = ({ tblBody, tblCaption, tblHead }: TableProps) => {\n return (\n <Table>\n {tblCaption && <Caption>{tblCaption}</Caption>}\n <Thead>\n <Tr>{tblHead}</Tr>\n </Thead>\n <Tbody>{tblBody}</Tbody>\n </Table>\n )\n}\n\nRenderTable.displayName = 'TBL'\nRenderBody.displayName = 'renderBody'\nRenderHead.displayName = 'renderHead'\n"]}
@@ -0,0 +1,8 @@
1
+ import { a as a$1 } from './chunk-NE6YXTMC.js';
2
+ import m from 'react';
3
+
4
+ var a=({href:i,target:e,rel:p,children:l,styles:s,prefetch:t,btnStyle:c,onPointerDown:n,...f})=>{let r=p;return e==="_blank"&&(r=`noopener noreferrer ${t?"prefetch":""}`),m.createElement(a$1,{as:"a",href:i,target:e,styles:s,rel:r,onPointerDown:h=>{n&&n?.(h);},"data-btn":c,prefetch:t,...f},l)},y=a;a.displayName="Link";
5
+
6
+ export { a, y as b };
7
+ //# sourceMappingURL=out.js.map
8
+ //# sourceMappingURL=chunk-5ZM4XL44.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/link/link.tsx"],"names":["React","Link","href","target","rel","children","styles","prefetch","btnStyle","onPointerDown","props","relValue","ui_default","e","link_default"],"mappings":"wCACA,OAAOA,MAAW,QAqBX,IAAMC,EAAO,CAAC,CACnB,KAAAC,EACA,OAAAC,EACA,IAAAC,EACA,SAAAC,EACA,OAAAC,EACA,SAAAC,EACA,SAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAAiB,CACf,IAAIC,EAAWP,EAEf,OAAID,IAAW,WACbQ,EAAW,uBAAuBJ,EAAW,WAAa,EAAE,IAO5DP,EAAA,cAACY,EAAA,CACC,GAAG,IACH,KAAMV,EACN,OAAQC,EACR,OAAQG,EACR,IAAKK,EACL,cAXyBE,GAA6C,CACpEJ,GAAeA,IAAgBI,CAAC,CACtC,EAUI,WAAUL,EACV,SAAUD,EACT,GAAGG,GAEHL,CACH,CAEJ,EAEOS,EAAQb,EACfA,EAAK,YAAc","sourcesContent":["import UI from \"../ui\";\nimport React from \"react\";\n\nexport type LinkProps = {\n href?: string;\n\n target?: string;\n\n rel?: string;\n\n children: React.ReactNode;\n\n styles?: React.CSSProperties;\n\n prefetch?: boolean;\n\n btnStyle?: string;\n\n onPointerDown?: (event: React.PointerEvent<HTMLAnchorElement>) => void;\n} & React.ComponentProps<typeof UI> &\n React.ComponentProps<\"a\">;\n\nexport const Link = ({\n href,\n target,\n rel,\n children,\n styles,\n prefetch,\n btnStyle,\n onPointerDown,\n ...props\n}: LinkProps) => {\n let relValue = rel;\n\n if (target === \"_blank\")\n relValue = `noopener noreferrer ${prefetch ? \"prefetch\" : \"\"}`;\n\n const handleOnpointerDown = (e: React.PointerEvent<HTMLAnchorElement>) => {\n if (onPointerDown) onPointerDown?.(e);\n };\n\n return (\n <UI\n as=\"a\"\n href={href}\n target={target}\n styles={styles}\n rel={relValue}\n onPointerDown={handleOnpointerDown}\n data-btn={btnStyle}\n prefetch={prefetch}\n {...props}\n >\n {children}\n </UI>\n );\n};\n\nexport default Link;\nLink.displayName = \"Link\";\n"]}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunk6TE5QEVE_cjs = require('./chunk-6TE5QEVE.cjs');
4
+ var t = require('react');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var t__default = /*#__PURE__*/_interopDefault(t);
9
+
10
+ var l=({label:o,labelFor:a,id:r,styles:p,classes:d,children:s,...i})=>t__default.default.createElement(chunk6TE5QEVE_cjs.a,{as:"div",id:r,styles:p,className:d,"data-style":"fields",...i},t__default.default.createElement("label",{htmlFor:a},o),s),n=l;l.displayName="Field";
11
+
12
+ exports.a = l;
13
+ exports.b = n;
14
+ //# sourceMappingURL=out.js.map
15
+ //# sourceMappingURL=chunk-6BVXFW7U.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/form/fields.tsx"],"names":["React","Field","label","labelFor","id","styles","classes","children","props","ui_default","fields_default"],"mappings":"yCAAA,OAAOA,MAAW,QAmBX,IAAMC,EAAQ,CAAC,CACpB,MAAAC,EACA,SAAAC,EACA,GAAAC,EACA,OAAAC,EACA,QAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIR,EAAA,cAACS,EAAA,CACC,GAAG,MACH,GAAIL,EACJ,OAAQC,EACR,UAAWC,EACX,aAAW,SACV,GAAGE,GAEJR,EAAA,cAAC,SAAM,QAASG,GAAWD,CAAM,EAChCK,CACH,EAIGG,EAAQT,EACfA,EAAM,YAAc","sourcesContent":["import React from 'react'\nimport UI from '../ui'\n\nexport type FieldProps = {\n /**\n * The label content\n */\n label: React.ReactNode\n children: React.ReactNode\n} & React.ComponentProps<'label'> &\n Partial<React.ComponentProps<typeof UI>>\n/**\n * Field component that renders a label and children wrapped in a div element.\n * @param labelFor Defines the for attribute of the label element\n * @param styles Custom styles to be applied to the component\n * @param label The label content\n * @param children The children to be rendered inside the component\n * @param props Additional props to be spread to the component\n */\nexport const Field = ({\n label,\n labelFor,\n id,\n styles,\n classes,\n children,\n ...props\n}: FieldProps) => {\n return (\n <UI\n as=\"div\"\n id={id}\n styles={styles}\n className={classes}\n data-style=\"fields\"\n {...props}\n >\n <label htmlFor={labelFor}>{label}</label>\n {children}\n </UI>\n )\n}\n\nexport default Field\nField.displayName = 'Field'\n"]}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var e = require('react');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var e__default = /*#__PURE__*/_interopDefault(e);
8
+
9
+ var t=e__default.default.forwardRef(({as:o,styles:p,classes:n,children:r,defaultStyles:s,...P},m)=>{let C=o??"div",a={...s,...p};return e__default.default.createElement(C,{ref:m,style:a,className:n,...P},r)}),y=t;t.displayName="FP";
10
+
11
+ exports.a = y;
12
+ //# sourceMappingURL=out.js.map
13
+ //# sourceMappingURL=chunk-6TE5QEVE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ui.tsx"],"names":["React","FP","as","styles","classes","children","defaultStyles","props","ref","Component","styleObj","ui_default"],"mappings":"AAEA,OAAOA,MAAW,QAgDlB,IAAMC,EAAkBD,EAAM,WAC5B,CACE,CAAE,GAAAE,EAAI,OAAAC,EAAQ,QAAAC,EAAS,SAAAC,EAAU,cAAAC,EAAe,GAAGC,CAAM,EACzDC,IACG,CACH,IAAMC,EAAYP,GAAM,MAElBQ,EAAgC,CAAE,GAAGJ,EAAe,GAAGH,CAAO,EAEpE,OACEH,EAAA,cAACS,EAAA,CAAU,IAAKD,EAAK,MAAOE,EAAU,UAAWN,EAAU,GAAGG,GAC3DF,CACH,CAEJ,CACF,EAEOM,EAAQV,EAEfA,EAAG,YAAc","sourcesContent":[" \n/* eslint-disable */\nimport React from \"react\";\n\ntype PolymorphicRef<C extends React.ElementType> =\n React.ComponentPropsWithRef<C>[\"ref\"];\n\ntype AsProp<C extends React.ElementType> = {\n as?: C;\n};\n\ntype PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);\n\ntype PolymorphicComponentProp<\n C extends React.ElementType,\n Props = {},\n> = React.PropsWithChildren<Props & AsProp<C>> &\n Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;\n\ntype PolymorphicComponentPropWithRef<\n C extends React.ElementType,\n Props = {},\n> = PolymorphicComponentProp<C, Props> & {\n ref?: PolymorphicRef<C>;\n};\n\ntype FPProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<\n C,\n {\n renderStyles?: boolean;\n styles?: React.CSSProperties;\n classes?: string;\n id?: string;\n children?: React.ReactNode;\n }\n>;\n\n/*\n * FPComponent type definition\n *\n * Defines the component function signature for the FP component.\n *\n * @typeParam C - The HTML element type to render\n * @param props - The component props\n * @returns React component\n */\ntype FPComponent = <C extends React.ElementType = \"span\">(\n props: FPProps<C>\n) => React.ReactElement | (any & { displayName?: String });\n\nconst FP: FPComponent = React.forwardRef(\n <C extends React.ElementType>(\n { as, styles, classes, children, defaultStyles, ...props }: FPProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const Component = as ?? \"div\";\n\n const styleObj: React.CSSProperties = { ...defaultStyles, ...styles };\n\n return (\n <Component ref={ref} style={styleObj} className={classes} {...props}>\n {children}\n </Component>\n );\n }\n);\n\nexport default FP;\n// @ts-expect-error -- React component displayName\nFP.displayName = \"FP\";\n"]}
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var chunkM5QL5TAE_cjs = require('./chunk-M5QL5TAE.cjs');
4
+ var chunkKKLTUJFB_cjs = require('./chunk-KKLTUJFB.cjs');
5
+ var chunkLHVJKDMA_cjs = require('./chunk-LHVJKDMA.cjs');
6
+ var chunk6TE5QEVE_cjs = require('./chunk-6TE5QEVE.cjs');
7
+ var r = require('react');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var r__default = /*#__PURE__*/_interopDefault(r);
12
+
13
+ var k=({dialogTitle:e,onClick:o,type:i="h3"})=>r__default.default.createElement(chunk6TE5QEVE_cjs.a,{as:"div",classes:"dialog-header"},r__default.default.createElement(chunkM5QL5TAE_cjs.a,{type:i,className:"dialog-title"},e||"Dialog"),r__default.default.createElement(chunkLHVJKDMA_cjs.b,{type:"button",onClick:()=>{o();},className:"dialog-close","aria-label":"Close dialog","data-btn":"icon"},r__default.default.createElement(chunkKKLTUJFB_cjs.b,null,r__default.default.createElement(chunkKKLTUJFB_cjs.b.Remove,{size:16})))),y=r__default.default.memo(k);k.displayName="DialogHeader";var E=({onClose:e,onConfirm:o,confirmLabel:i,cancelLabel:t})=>r__default.default.createElement(chunk6TE5QEVE_cjs.a,{as:"section",className:"dialog-footer"},t&&r__default.default.createElement(chunkLHVJKDMA_cjs.b,{type:"button",onClick:e,className:"dialog-button button-secondary","data-btn":"sm"},t),o&&r__default.default.createElement(chunkLHVJKDMA_cjs.b,{type:"button",onClick:o,className:"dialog-button button-primary","data-btn":"sm"},i)),P=E;var H=(e,o)=>r.useCallback(t=>{let l=e.current?.getBoundingClientRect();l&&(t.clientY<l.top||t.clientY>l.bottom||t.clientX<l.left||t.clientX>l.right)&&o();},[e,o]);var x=({showDialog:e,isAlertDialog:o,onClose:i,dialogTitle:t,dialogLabel:l,children:u,onConfirm:h,confirmLabel:I="Confirm",cancelLabel:L="Cancel",className:C="",hideFooter:N,styles:M})=>{let m=r.useRef(null),[g,b]=r__default.default.useState(e);r.useEffect(()=>{b(e);},[e]),r.useEffect(()=>{let n=m.current;n&&(g?o?n.show():n.showModal():n.close());},[g,o]);let c=()=>{i&&i(),b(!1);},U=H(m,c);return r__default.default.createElement(chunk6TE5QEVE_cjs.a,{as:"dialog",role:o?"alertdialog":"dialog",ref:m,onClose:c,onClick:U,"aria-modal":g?"true":void 0,className:`dialog-modal ${C}`,"aria-label":l,style:M},r__default.default.createElement(y,{dialogTitle:t,onClick:c}),r__default.default.createElement(chunk6TE5QEVE_cjs.a,{as:"section",className:`dialog-content ${C}`,onClick:n=>n.stopPropagation()},u,!N&&r__default.default.createElement(P,{onClose:c,onConfirm:h,confirmLabel:I,cancelLabel:L})))},A=r__default.default.memo(x);
14
+
15
+ exports.a = x;
16
+ exports.b = A;
17
+ //# sourceMappingURL=out.js.map
18
+ //# sourceMappingURL=chunk-7K76RW2A.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/dialog/dialog.tsx","../src/components/dialog/views/dialog-header.tsx","../src/components/dialog/views/dialog-footer.tsx","../src/hooks/useDialogClickHandler.ts"],"names":["React","useRef","useEffect","DialogHeader","dialogTitle","onClick","type","ui_default","heading_default","button_default","icon_default","dialog_header_default","DialogFooter","onClose","onConfirm","confirmLabel","cancelLabel","dialog_footer_default","useCallback","useDialogClickHandler","dialogRef","handleClose","e","dialogDimensions","Dialog","showDialog","isAlertDialog","dialogLabel","children","className","hideFooter","styles","isOpen","setIsOpen","dialog","handleClickOutside","dialog_default"],"mappings":"+JAAA,OAAOA,GAAS,UAAAC,EAAQ,aAAAC,MAAgC,QCAxD,OAAOF,MAAW,QA+BlB,IAAMG,EAAe,CAAC,CACpB,YAAAC,EACA,QAAAC,EACA,KAAAC,EAAO,IACT,IAKIN,EAAA,cAACO,EAAA,CAAG,GAAG,MAAM,QAAQ,iBACnBP,EAAA,cAACQ,EAAA,CAAQ,KAAMF,EAAM,UAAU,gBAC5BF,GAAe,QAClB,EACAJ,EAAA,cAACS,EAAA,CACC,KAAK,SACL,QAVc,IAAM,CACxBJ,EAAQ,CACV,EASM,UAAU,eACV,aAAW,eACX,WAAS,QAETL,EAAA,cAACU,EAAA,KACCV,EAAA,cAACU,EAAK,OAAL,CAAY,KAAM,GAAI,CACzB,CACF,CACF,EAIGC,EAAQX,EAAM,KAAKG,CAAY,EACtCA,EAAa,YAAc,eC5D3B,OAAOH,MAAW,QAWlB,IAAMY,EAA4C,CAAC,CACjD,QAAAC,EACA,UAAAC,EACA,aAAAC,EACA,YAAAC,CACF,IAEIhB,EAAA,cAACO,EAAA,CAAG,GAAG,UAAU,UAAU,iBACxBS,GACChB,EAAA,cAACS,EAAA,CACC,KAAK,SACL,QAASI,EACT,UAAU,iCACV,WAAS,MAERG,CACH,EAGDF,GACCd,EAAA,cAACS,EAAA,CACC,KAAK,SACL,QAASK,EACT,UAAU,+BACV,WAAS,MAERC,CACH,CAEJ,EAIGE,EAAQL,EC5Cf,OAAS,eAAAM,MAA8B,QAEhC,IAAMC,EAAwB,CACnCC,EACAC,IAEoBH,EACjBI,GAA2C,CAC1C,IAAMC,EAAmBH,EAAU,SAAS,sBAAsB,EAC9DG,IAEAD,EAAE,QAAUC,EAAiB,KAC7BD,EAAE,QAAUC,EAAiB,QAC7BD,EAAE,QAAUC,EAAiB,MAC7BD,EAAE,QAAUC,EAAiB,QAG7BF,EAAY,CAGlB,EACA,CAACD,EAAWC,CAAW,CACzB,EH8BK,IAAMG,EAAqC,CAAC,CACjD,WAAAC,EACA,cAAAC,EACA,QAAAb,EACA,YAAAT,EACA,YAAAuB,EACA,SAAAC,EACA,UAAAd,EACA,aAAAC,EAAe,UACf,YAAAC,EAAc,SACd,UAAAa,EAAY,GACZ,WAAAC,EACA,OAAAC,CACF,IAAM,CACJ,IAAMX,EAAYnB,EAA0B,IAAI,EAC1C,CAAC+B,EAAQC,CAAS,EAAIjC,EAAM,SAASyB,CAAU,EAErDvB,EAAU,IAAM,CACd+B,EAAUR,CAAU,CACtB,EAAG,CAACA,CAAU,CAAC,EAEfvB,EAAU,IAAM,CACd,IAAMgC,EAASd,EAAU,QACpBc,IAEDF,EACEN,EACFQ,EAAO,KAAK,EAEZA,EAAO,UAAU,EAGnBA,EAAO,MAAM,EAEjB,EAAG,CAACF,EAAQN,CAAa,CAAC,EAE1B,IAAML,EAAc,IAAM,CACpBR,GAASA,EAAQ,EACrBoB,EAAU,EAAK,CACjB,EAEME,EAAqBhB,EAAsBC,EAAWC,CAAW,EAEvE,OACErB,EAAA,cAACO,EAAA,CACC,GAAG,SACH,KAAMmB,EAAgB,cAAgB,SACtC,IAAKN,EACL,QAASC,EACT,QAASc,EACT,aAAYH,EAAS,OAAS,OAC9B,UAAW,gBAAqBH,CAAS,GACzC,aAAYF,EACZ,MAAOI,GAEP/B,EAAA,cAACW,EAAA,CAAa,YAAaP,EAAa,QAASiB,EAAa,EAE9DrB,EAAA,cAACO,EAAA,CACC,GAAG,UACH,UAAW,kBAAkBsB,CAAS,GACtC,QAAUP,GAAwBA,EAAE,gBAAgB,GAEnDM,EACA,CAACE,GACA9B,EAAA,cAACiB,EAAA,CACC,QAASI,EACT,UAAWP,EACX,aAAcC,EACd,YAAaC,EACf,CAEJ,CACF,CAEJ,EACOoB,EAAQpC,EAAM,KAAKwB,CAAM","sourcesContent":["import React, { useRef, useEffect, CSSProperties } from \"react\";\nimport UI from \"#components/ui\";\nimport DialogHeader from \"#components/dialog/views/dialog-header\";\nimport DialogFooter from \"#components/dialog/views/dialog-footer\";\nimport { useDialogClickHandler } from \"#hooks/useDialogClickHandler.js\";\n\n/**\n * Defines the props for the Dialog component.\n *\n * @property {boolean} [showDialog] - Determines whether the dialog should be shown.\n * @property {boolean} [isAlertDialog] - Determines whether the dialog should be displayed as an alert dialog.\n * @property {() => void} [onClose] - A callback function to be called when the dialog is closed.\n * @property {string} dialogTitle - The title of the dialog.\n * @property {string} [dialogLabel] - An optional label for the dialog.\n * @property {React.ReactNode} children - The content to be displayed inside the dialog.\n * @property {() => void | Promise<void>} [onConfirm] - A callback function to be called when the user confirms the dialog.\n * @property {string} [confirmLabel] - The label for the confirm button.\n * @property {string} [cancelLabel] - The label for the cancel button.\n * @property {string} [className] - An optional CSS class name to be applied to the dialog.\n * @property {CSSProperties} [styles] - Optional inline styles to be applied to the dialog.\n */\ntype DialogModalProps = React.ComponentProps<typeof UI> &\n React.ComponentProps<\"dialog\"> & {\n dialogTitle: string;\n dialogLabel?: string;\n children: React.ReactNode;\n showDialog?: boolean;\n isAlertDialog?: boolean;\n onClose?: () => void;\n onConfirm?: () => void | Promise<void>;\n confirmLabel?: string;\n cancelLabel?: string;\n className?: string;\n hideFooter?: boolean;\n styles?: CSSProperties;\n };\n\n/**\n * Renders a dialog modal component with customizable content and behavior.\n *\n * @param showDialog - Determines whether the dialog should be shown.\n * @param isAlertDialog - Determines whether the dialog should be displayed as an alert dialog.\n * @param onClose - A callback function to be called when the dialog is closed.\n * @param dialogTitle - The title of the dialog.\n * @param dialogLabel - An optional label for the dialog.\n * @param children - The content to be displayed inside the dialog.\n * @param onConfirm - A callback function to be called when the user confirms the dialog.\n * @param confirmLabel - The label for the confirm button.\n * @param cancelLabel - The label for the cancel button.\n * @param className - An optional CSS class name to be applied to the dialog.\n * @param styles - Optional inline styles to be applied to the dialog.\n */\nexport const Dialog: React.FC<DialogModalProps> = ({\n showDialog,\n isAlertDialog,\n onClose,\n dialogTitle,\n dialogLabel,\n children,\n onConfirm,\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n className = \"\",\n hideFooter,\n styles,\n}) => {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const [isOpen, setIsOpen] = React.useState(showDialog);\n\n useEffect(() => {\n setIsOpen(showDialog);\n }, [showDialog]);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (isOpen) {\n if (isAlertDialog) {\n dialog.show();\n } else {\n dialog.showModal();\n }\n } else {\n dialog.close();\n }\n }, [isOpen, isAlertDialog]);\n\n const handleClose = () => {\n if (onClose) onClose();\n setIsOpen(false);\n };\n\n const handleClickOutside = useDialogClickHandler(dialogRef, handleClose);\n\n return (\n <UI\n as=\"dialog\"\n role={isAlertDialog ? \"alertdialog\" : \"dialog\"}\n ref={dialogRef}\n onClose={handleClose}\n onClick={handleClickOutside}\n aria-modal={isOpen ? \"true\" : undefined}\n className={`${\"dialog-modal\"} ${className}`}\n aria-label={dialogLabel}\n style={styles}\n >\n <DialogHeader dialogTitle={dialogTitle} onClick={handleClose} />\n\n <UI\n as=\"section\"\n className={`dialog-content ${className}`}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n >\n {children}\n {!hideFooter && (\n <DialogFooter\n onClose={handleClose}\n onConfirm={onConfirm}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n />\n )}\n </UI>\n </UI>\n );\n};\nexport default React.memo(Dialog);\n","import React from \"react\";\nimport UI from \"#components/ui\";\nimport Heading from \"#components/heading/heading\";\nimport Button from \"#components/buttons/button\";\nimport Icon from \"#components/icons/icon\";\n\nexport type DialogHeaderProps = {\n dialogTitle: string;\n onClick: () => void;\n} & React.ComponentProps<typeof Heading>;\n\n/**\n * DialogHeader component displays the header section of a dialog with a title and close button.\n *\n * @component\n * @param {Object} props - Component props\n * @param {string} props.dialogTitle - The title text to display in the dialog header\n * @param {() => void} props.onClick - Callback function triggered when close button is clicked\n * @param {string} [props.type='h3'] - Heading type/level to use for the title\n * @returns {JSX.Element} A dialog header with title and close button\n *\n * @example\n * ```jsx\n * <DialogHeader\n * dialogTitle=\"Confirm Action\"\n * onClick={() => setIsOpen(false)}\n * type=\"h2\"\n * />\n * ```\n */\n\nconst DialogHeader = ({\n dialogTitle,\n onClick,\n type = \"h3\",\n}: DialogHeaderProps): JSX.Element => {\n const handleClose = () => {\n onClick();\n };\n return (\n <UI as=\"div\" classes=\"dialog-header\">\n <Heading type={type} className=\"dialog-title\">\n {dialogTitle || \"Dialog\"}\n </Heading>\n <Button\n type=\"button\"\n onClick={handleClose}\n className=\"dialog-close\"\n aria-label=\"Close dialog\"\n data-btn=\"icon\"\n >\n <Icon>\n <Icon.Remove size={16} />\n </Icon>\n </Button>\n </UI>\n );\n};\n\nexport default React.memo(DialogHeader);\nDialogHeader.displayName = \"DialogHeader\";\n","import React from \"react\";\nimport UI from \"#components/ui\";\nimport Button from \"#components/buttons/button\";\n\ntype DialogFooterProps = {\n onClose: () => void;\n onConfirm?: () => void | Promise<void>;\n confirmLabel: string;\n cancelLabel: string;\n};\n\nconst DialogFooter: React.FC<DialogFooterProps> = ({\n onClose,\n onConfirm,\n confirmLabel,\n cancelLabel,\n}) => {\n return (\n <UI as=\"section\" className=\"dialog-footer\">\n {cancelLabel && (\n <Button\n type=\"button\"\n onClick={onClose}\n className=\"dialog-button button-secondary\"\n data-btn=\"sm\"\n >\n {cancelLabel}\n </Button>\n )}\n\n {onConfirm && (\n <Button\n type=\"button\"\n onClick={onConfirm}\n className=\"dialog-button button-primary\"\n data-btn=\"sm\"\n >\n {confirmLabel}\n </Button>\n )}\n </UI>\n );\n};\n\nexport default DialogFooter;\n","import { useCallback, RefObject } from \"react\";\n\nexport const useDialogClickHandler = (\n dialogRef: RefObject<HTMLDialogElement>,\n handleClose: () => void\n) => {\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLDialogElement>) => {\n const dialogDimensions = dialogRef.current?.getBoundingClientRect();\n if (dialogDimensions) {\n const isClickOutside =\n e.clientY < dialogDimensions.top ||\n e.clientY > dialogDimensions.bottom ||\n e.clientX < dialogDimensions.left ||\n e.clientX > dialogDimensions.right;\n\n if (isClickOutside) {\n handleClose();\n }\n }\n },\n [dialogRef, handleClose]\n );\n\n return handleClick;\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import { a } from './chunk-P7TTEYCD.js';
2
+ import R from 'react';
3
+
4
+ var m=({type:a$1="text",name:c,value:i,placeholder:d,id:f,styles:y,classes:I,isDisabled:p,disabled:t,readonly:r,required:n,ref:h,onChange:o,onBlur:l,onPointerDown:u,...E})=>{let x=e=>{o&&!t&&o?.(e);},v=e=>{l&&!t&&l?.(e);},P=e=>{u&&!t&&(e.preventDefault(),u?.(e));};return R.createElement(a,{as:"input",id:f,type:a$1,placeholder:d||`${n?"*":""} ${a$1} input `,className:I,styles:y,onChange:x,onBlur:v,onKeyDown:P,value:i,name:c,ref:h,"aria-disabled":p,tabIndex:p?-1:void 0,"aria-readonly":r,"aria-required":n,required:n,readOnly:r,...E})};m.displayName="Input";var F=m;
5
+
6
+ export { m as a, F as b };
7
+ //# sourceMappingURL=out.js.map
8
+ //# sourceMappingURL=chunk-BHRQBJRY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/form/inputs.tsx"],"names":["React","Input","type","name","value","placeholder","id","styles","classes","isDisabled","disabled","readonly","required","ref","onChange","onBlur","onPointerDown","props","handleChange","handleBlur","handleKeyDown","fp_default","inputs_default"],"mappings":"wCAAA,OAAOA,MAAW,QAeX,IAAMC,EAAQ,CAAC,CACpB,KAAAC,EAAO,OACP,KAAAC,EACA,MAAAC,EACA,YAAAC,EACA,GAAAC,EACA,OAAAC,EACA,QAAAC,EACA,WAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,IAAAC,EACA,SAAAC,EACA,OAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAA+B,CAC7B,IAAMC,EAAgB,GAA2C,CAC3DJ,GAAY,CAACJ,GACfI,IAAW,CAAC,CAEhB,EAEMK,EAAc,GAA0C,CACxDJ,GAAU,CAACL,GACbK,IAAS,CAAC,CAEd,EAEMK,EAAiB,GAA6C,CAC9DJ,GAAiB,CAACN,IACpB,EAAE,eAAe,EACjBM,IAAgB,CAAC,EAErB,EAEA,OACEhB,EAAA,cAACqB,EAAA,CACC,GAAG,QACH,GAAIf,EACJ,KAAMJ,EACN,YAAaG,GAAe,GAAGO,EAAW,IAAM,EAAE,IAAIV,CAAI,UAC1D,UAAWM,EACX,OAAQD,EACR,SAAUW,EACV,OAAQC,EACR,UAAWC,EACX,MAAOhB,EACP,KAAMD,EACN,IAAKU,EACL,gBAAeJ,EACf,SAAUA,EAAa,GAAK,OAC5B,gBAAeE,EACf,gBAAeC,EACf,SAAUA,EACV,SAAUD,EACT,GAAGM,EACN,CAEJ,EACAhB,EAAM,YAAc,QACpB,IAAOqB,EAAQrB","sourcesContent":["import React from \"react\";\nimport FP from \"../fp\";\n\nexport type InputProps = {\n /**\n * The type of the input.\n */\n type?: \"text\" | \"password\" | \"email\" | \"number\" | \"tel\" | \"url\" | \"search\";\n\n /**\n * Set the element as disabled\n */\n isDisabled?: boolean;\n} & React.ComponentProps<typeof FP>;\n\nexport const Input = ({\n type = \"text\",\n name,\n value,\n placeholder,\n id,\n styles,\n classes,\n isDisabled,\n disabled,\n readonly,\n required,\n ref,\n onChange,\n onBlur,\n onPointerDown,\n ...props\n}: InputProps): JSX.Element => {\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange && !disabled) {\n onChange?.(e);\n }\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur && !disabled) {\n onBlur?.(e);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (onPointerDown && !disabled) {\n e.preventDefault();\n onPointerDown?.(e);\n }\n };\n\n return (\n <FP\n as=\"input\"\n id={id}\n type={type}\n placeholder={placeholder || `${required ? \"*\" : \"\"} ${type} input `}\n className={classes}\n styles={styles}\n onChange={handleChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n value={value}\n name={name}\n ref={ref}\n aria-disabled={isDisabled}\n tabIndex={isDisabled ? -1 : undefined}\n aria-readonly={readonly}\n aria-required={required}\n required={required}\n readOnly={readonly}\n {...props}\n />\n );\n};\nInput.displayName = \"Input\";\nexport default Input;\n"]}
@@ -0,0 +1,8 @@
1
+ import { a } from './chunk-NE6YXTMC.js';
2
+ import t from 'react';
3
+
4
+ var l=({label:o,labelFor:a$1,id:r,styles:p,classes:d,children:s,...i})=>t.createElement(a,{as:"div",id:r,styles:p,className:d,"data-style":"fields",...i},t.createElement("label",{htmlFor:a$1},o),s),n=l;l.displayName="Field";
5
+
6
+ export { l as a, n as b };
7
+ //# sourceMappingURL=out.js.map
8
+ //# sourceMappingURL=chunk-BIP2NY53.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/form/fields.tsx"],"names":["React","Field","label","labelFor","id","styles","classes","children","props","ui_default","fields_default"],"mappings":"wCAAA,OAAOA,MAAW,QAmBX,IAAMC,EAAQ,CAAC,CACpB,MAAAC,EACA,SAAAC,EACA,GAAAC,EACA,OAAAC,EACA,QAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIR,EAAA,cAACS,EAAA,CACC,GAAG,MACH,GAAIL,EACJ,OAAQC,EACR,UAAWC,EACX,aAAW,SACV,GAAGE,GAEJR,EAAA,cAAC,SAAM,QAASG,GAAWD,CAAM,EAChCK,CACH,EAIGG,EAAQT,EACfA,EAAM,YAAc","sourcesContent":["import React from 'react'\nimport UI from '../ui'\n\nexport type FieldProps = {\n /**\n * The label content\n */\n label: React.ReactNode\n children: React.ReactNode\n} & React.ComponentProps<'label'> &\n Partial<React.ComponentProps<typeof UI>>\n/**\n * Field component that renders a label and children wrapped in a div element.\n * @param labelFor Defines the for attribute of the label element\n * @param styles Custom styles to be applied to the component\n * @param label The label content\n * @param children The children to be rendered inside the component\n * @param props Additional props to be spread to the component\n */\nexport const Field = ({\n label,\n labelFor,\n id,\n styles,\n classes,\n children,\n ...props\n}: FieldProps) => {\n return (\n <UI\n as=\"div\"\n id={id}\n styles={styles}\n className={classes}\n data-style=\"fields\"\n {...props}\n >\n <label htmlFor={labelFor}>{label}</label>\n {children}\n </UI>\n )\n}\n\nexport default Field\nField.displayName = 'Field'\n"]}