@stack-spot/citric-react 0.1.0

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 (345) hide show
  1. package/dist/citric.css +2580 -0
  2. package/dist/components/Accordion.d.ts +33 -0
  3. package/dist/components/Accordion.d.ts.map +1 -0
  4. package/dist/components/Accordion.js +19 -0
  5. package/dist/components/Accordion.js.map +1 -0
  6. package/dist/components/Alert.d.ts +11 -0
  7. package/dist/components/Alert.d.ts.map +1 -0
  8. package/dist/components/Alert.js +5 -0
  9. package/dist/components/Alert.js.map +1 -0
  10. package/dist/components/AsyncContent.d.ts +30 -0
  11. package/dist/components/AsyncContent.d.ts.map +1 -0
  12. package/dist/components/AsyncContent.js +33 -0
  13. package/dist/components/AsyncContent.js.map +1 -0
  14. package/dist/components/Avatar.d.ts +22 -0
  15. package/dist/components/Avatar.d.ts.map +1 -0
  16. package/dist/components/Avatar.js +9 -0
  17. package/dist/components/Avatar.js.map +1 -0
  18. package/dist/components/AvatarGroup.d.ts +25 -0
  19. package/dist/components/AvatarGroup.d.ts.map +1 -0
  20. package/dist/components/AvatarGroup.js +9 -0
  21. package/dist/components/AvatarGroup.js.map +1 -0
  22. package/dist/components/Badge.d.ts +18 -0
  23. package/dist/components/Badge.d.ts.map +1 -0
  24. package/dist/components/Badge.js +7 -0
  25. package/dist/components/Badge.js.map +1 -0
  26. package/dist/components/Blockquote.d.ts +5 -0
  27. package/dist/components/Blockquote.d.ts.map +1 -0
  28. package/dist/components/Blockquote.js +4 -0
  29. package/dist/components/Blockquote.js.map +1 -0
  30. package/dist/components/Breadcrumb.d.ts +12 -0
  31. package/dist/components/Breadcrumb.d.ts.map +1 -0
  32. package/dist/components/Breadcrumb.js +8 -0
  33. package/dist/components/Breadcrumb.js.map +1 -0
  34. package/dist/components/Button.d.ts +42 -0
  35. package/dist/components/Button.d.ts.map +1 -0
  36. package/dist/components/Button.js +25 -0
  37. package/dist/components/Button.js.map +1 -0
  38. package/dist/components/Card.d.ts +19 -0
  39. package/dist/components/Card.d.ts.map +1 -0
  40. package/dist/components/Card.js +5 -0
  41. package/dist/components/Card.js.map +1 -0
  42. package/dist/components/Checkbox.d.ts +14 -0
  43. package/dist/components/Checkbox.d.ts.map +1 -0
  44. package/dist/components/Checkbox.js +7 -0
  45. package/dist/components/Checkbox.js.map +1 -0
  46. package/dist/components/CheckboxGroup.d.ts +53 -0
  47. package/dist/components/CheckboxGroup.d.ts.map +1 -0
  48. package/dist/components/CheckboxGroup.js +17 -0
  49. package/dist/components/CheckboxGroup.js.map +1 -0
  50. package/dist/components/Circle.d.ts +18 -0
  51. package/dist/components/Circle.d.ts.map +1 -0
  52. package/dist/components/Circle.js +5 -0
  53. package/dist/components/Circle.js.map +1 -0
  54. package/dist/components/CitricComponent.d.ts +14 -0
  55. package/dist/components/CitricComponent.d.ts.map +1 -0
  56. package/dist/components/CitricComponent.js +15 -0
  57. package/dist/components/CitricComponent.js.map +1 -0
  58. package/dist/components/Divider.d.ts +14 -0
  59. package/dist/components/Divider.d.ts.map +1 -0
  60. package/dist/components/Divider.js +5 -0
  61. package/dist/components/Divider.js.map +1 -0
  62. package/dist/components/ErrorBoundary.d.ts +32 -0
  63. package/dist/components/ErrorBoundary.d.ts.map +1 -0
  64. package/dist/components/ErrorBoundary.js +46 -0
  65. package/dist/components/ErrorBoundary.js.map +1 -0
  66. package/dist/components/ErrorMessage.d.ts +4 -0
  67. package/dist/components/ErrorMessage.d.ts.map +1 -0
  68. package/dist/components/ErrorMessage.js +7 -0
  69. package/dist/components/ErrorMessage.js.map +1 -0
  70. package/dist/components/FallbackBoundary.d.ts +13 -0
  71. package/dist/components/FallbackBoundary.d.ts.map +1 -0
  72. package/dist/components/FallbackBoundary.js +11 -0
  73. package/dist/components/FallbackBoundary.js.map +1 -0
  74. package/dist/components/Favorite.d.ts +23 -0
  75. package/dist/components/Favorite.d.ts.map +1 -0
  76. package/dist/components/Favorite.js +5 -0
  77. package/dist/components/Favorite.js.map +1 -0
  78. package/dist/components/FieldGroup.d.ts +14 -0
  79. package/dist/components/FieldGroup.d.ts.map +1 -0
  80. package/dist/components/FieldGroup.js +5 -0
  81. package/dist/components/FieldGroup.js.map +1 -0
  82. package/dist/components/Form.d.ts +5 -0
  83. package/dist/components/Form.d.ts.map +1 -0
  84. package/dist/components/Form.js +6 -0
  85. package/dist/components/Form.js.map +1 -0
  86. package/dist/components/FormGroup.d.ts +22 -0
  87. package/dist/components/FormGroup.d.ts.map +1 -0
  88. package/dist/components/FormGroup.js +8 -0
  89. package/dist/components/FormGroup.js.map +1 -0
  90. package/dist/components/IconBox.d.ts +46 -0
  91. package/dist/components/IconBox.d.ts.map +1 -0
  92. package/dist/components/IconBox.js +29 -0
  93. package/dist/components/IconBox.js.map +1 -0
  94. package/dist/components/Input.d.ts +15 -0
  95. package/dist/components/Input.d.ts.map +1 -0
  96. package/dist/components/Input.js +18 -0
  97. package/dist/components/Input.js.map +1 -0
  98. package/dist/components/Link.d.ts +20 -0
  99. package/dist/components/Link.d.ts.map +1 -0
  100. package/dist/components/Link.js +21 -0
  101. package/dist/components/Link.js.map +1 -0
  102. package/dist/components/LoadingPanel.d.ts +2 -0
  103. package/dist/components/LoadingPanel.d.ts.map +1 -0
  104. package/dist/components/LoadingPanel.js +5 -0
  105. package/dist/components/LoadingPanel.js.map +1 -0
  106. package/dist/components/MenuOverlay/Menu.d.ts +6 -0
  107. package/dist/components/MenuOverlay/Menu.d.ts.map +1 -0
  108. package/dist/components/MenuOverlay/Menu.js +100 -0
  109. package/dist/components/MenuOverlay/Menu.js.map +1 -0
  110. package/dist/components/MenuOverlay/context.d.ts +6 -0
  111. package/dist/components/MenuOverlay/context.d.ts.map +1 -0
  112. package/dist/components/MenuOverlay/context.js +16 -0
  113. package/dist/components/MenuOverlay/context.js.map +1 -0
  114. package/dist/components/MenuOverlay/index.d.ts +3 -0
  115. package/dist/components/MenuOverlay/index.d.ts.map +1 -0
  116. package/dist/components/MenuOverlay/index.js +23 -0
  117. package/dist/components/MenuOverlay/index.js.map +1 -0
  118. package/dist/components/MenuOverlay/keyboard.d.ts +2 -0
  119. package/dist/components/MenuOverlay/keyboard.d.ts.map +1 -0
  120. package/dist/components/MenuOverlay/keyboard.js +66 -0
  121. package/dist/components/MenuOverlay/keyboard.js.map +1 -0
  122. package/dist/components/MenuOverlay/types.d.ts +166 -0
  123. package/dist/components/MenuOverlay/types.d.ts.map +1 -0
  124. package/dist/components/MenuOverlay/types.js +2 -0
  125. package/dist/components/MenuOverlay/types.js.map +1 -0
  126. package/dist/components/Overlay/context.d.ts +4 -0
  127. package/dist/components/Overlay/context.d.ts.map +1 -0
  128. package/dist/components/Overlay/context.js +7 -0
  129. package/dist/components/Overlay/context.js.map +1 -0
  130. package/dist/components/Overlay/index.d.ts +14 -0
  131. package/dist/components/Overlay/index.d.ts.map +1 -0
  132. package/dist/components/Overlay/index.js +120 -0
  133. package/dist/components/Overlay/index.js.map +1 -0
  134. package/dist/components/Overlay/types.d.ts +67 -0
  135. package/dist/components/Overlay/types.d.ts.map +1 -0
  136. package/dist/components/Overlay/types.js +2 -0
  137. package/dist/components/Overlay/types.js.map +1 -0
  138. package/dist/components/Pagination.d.ts +28 -0
  139. package/dist/components/Pagination.d.ts.map +1 -0
  140. package/dist/components/Pagination.js +30 -0
  141. package/dist/components/Pagination.js.map +1 -0
  142. package/dist/components/ProgressBar.d.ts +12 -0
  143. package/dist/components/ProgressBar.d.ts.map +1 -0
  144. package/dist/components/ProgressBar.js +7 -0
  145. package/dist/components/ProgressBar.js.map +1 -0
  146. package/dist/components/ProgressCircular.d.ts +16 -0
  147. package/dist/components/ProgressCircular.d.ts.map +1 -0
  148. package/dist/components/ProgressCircular.js +7 -0
  149. package/dist/components/ProgressCircular.js.map +1 -0
  150. package/dist/components/RadioGroup.d.ts +48 -0
  151. package/dist/components/RadioGroup.d.ts.map +1 -0
  152. package/dist/components/RadioGroup.js +17 -0
  153. package/dist/components/RadioGroup.js.map +1 -0
  154. package/dist/components/Rating.d.ts +13 -0
  155. package/dist/components/Rating.d.ts.map +1 -0
  156. package/dist/components/Rating.js +4 -0
  157. package/dist/components/Rating.js.map +1 -0
  158. package/dist/components/Select/RichSelect.d.ts +5 -0
  159. package/dist/components/Select/RichSelect.d.ts.map +1 -0
  160. package/dist/components/Select/RichSelect.js +152 -0
  161. package/dist/components/Select/RichSelect.js.map +1 -0
  162. package/dist/components/Select/SimpleSelect.d.ts +5 -0
  163. package/dist/components/Select/SimpleSelect.d.ts.map +1 -0
  164. package/dist/components/Select/SimpleSelect.js +24 -0
  165. package/dist/components/Select/SimpleSelect.js.map +1 -0
  166. package/dist/components/Select/index.d.ts +4 -0
  167. package/dist/components/Select/index.d.ts.map +1 -0
  168. package/dist/components/Select/index.js +7 -0
  169. package/dist/components/Select/index.js.map +1 -0
  170. package/dist/components/Select/types.d.ts +118 -0
  171. package/dist/components/Select/types.d.ts.map +1 -0
  172. package/dist/components/Select/types.js +2 -0
  173. package/dist/components/Select/types.js.map +1 -0
  174. package/dist/components/SelectBox.d.ts +65 -0
  175. package/dist/components/SelectBox.d.ts.map +1 -0
  176. package/dist/components/SelectBox.js +26 -0
  177. package/dist/components/SelectBox.js.map +1 -0
  178. package/dist/components/Skeleton.d.ts +30 -0
  179. package/dist/components/Skeleton.d.ts.map +1 -0
  180. package/dist/components/Skeleton.js +5 -0
  181. package/dist/components/Skeleton.js.map +1 -0
  182. package/dist/components/Slider.d.ts +32 -0
  183. package/dist/components/Slider.d.ts.map +1 -0
  184. package/dist/components/Slider.js +19 -0
  185. package/dist/components/Slider.js.map +1 -0
  186. package/dist/components/SmartTable.d.ts +87 -0
  187. package/dist/components/SmartTable.d.ts.map +1 -0
  188. package/dist/components/SmartTable.js +16 -0
  189. package/dist/components/SmartTable.js.map +1 -0
  190. package/dist/components/Stepper.d.ts +52 -0
  191. package/dist/components/Stepper.d.ts.map +1 -0
  192. package/dist/components/Stepper.js +53 -0
  193. package/dist/components/Stepper.js.map +1 -0
  194. package/dist/components/Switch.d.ts +10 -0
  195. package/dist/components/Switch.d.ts.map +1 -0
  196. package/dist/components/Switch.js +7 -0
  197. package/dist/components/Switch.js.map +1 -0
  198. package/dist/components/Table.d.ts +106 -0
  199. package/dist/components/Table.d.ts.map +1 -0
  200. package/dist/components/Table.js +86 -0
  201. package/dist/components/Table.js.map +1 -0
  202. package/dist/components/Tabs/TabController.d.ts +11 -0
  203. package/dist/components/Tabs/TabController.d.ts.map +1 -0
  204. package/dist/components/Tabs/TabController.js +39 -0
  205. package/dist/components/Tabs/TabController.js.map +1 -0
  206. package/dist/components/Tabs/index.d.ts +5 -0
  207. package/dist/components/Tabs/index.d.ts.map +1 -0
  208. package/dist/components/Tabs/index.js +37 -0
  209. package/dist/components/Tabs/index.js.map +1 -0
  210. package/dist/components/Tabs/types.d.ts +46 -0
  211. package/dist/components/Tabs/types.d.ts.map +1 -0
  212. package/dist/components/Tabs/types.js +2 -0
  213. package/dist/components/Tabs/types.js.map +1 -0
  214. package/dist/components/Tabs/utils.d.ts +3 -0
  215. package/dist/components/Tabs/utils.d.ts.map +1 -0
  216. package/dist/components/Tabs/utils.js +5 -0
  217. package/dist/components/Tabs/utils.js.map +1 -0
  218. package/dist/components/Text.d.ts +27 -0
  219. package/dist/components/Text.d.ts.map +1 -0
  220. package/dist/components/Text.js +45 -0
  221. package/dist/components/Text.js.map +1 -0
  222. package/dist/components/Textarea.d.ts +8 -0
  223. package/dist/components/Textarea.d.ts.map +1 -0
  224. package/dist/components/Textarea.js +4 -0
  225. package/dist/components/Textarea.js.map +1 -0
  226. package/dist/components/Tooltip.d.ts +25 -0
  227. package/dist/components/Tooltip.d.ts.map +1 -0
  228. package/dist/components/Tooltip.js +18 -0
  229. package/dist/components/Tooltip.js.map +1 -0
  230. package/dist/components/layout.d.ts +46 -0
  231. package/dist/components/layout.d.ts.map +1 -0
  232. package/dist/components/layout.js +18 -0
  233. package/dist/components/layout.js.map +1 -0
  234. package/dist/context/CitricContext.d.ts +3 -0
  235. package/dist/context/CitricContext.d.ts.map +1 -0
  236. package/dist/context/CitricContext.js +3 -0
  237. package/dist/context/CitricContext.js.map +1 -0
  238. package/dist/context/CitricProvider.d.ts +9 -0
  239. package/dist/context/CitricProvider.d.ts.map +1 -0
  240. package/dist/context/CitricProvider.js +8 -0
  241. package/dist/context/CitricProvider.js.map +1 -0
  242. package/dist/context/hooks.d.ts +2 -0
  243. package/dist/context/hooks.d.ts.map +1 -0
  244. package/dist/context/hooks.js +6 -0
  245. package/dist/context/hooks.js.map +1 -0
  246. package/dist/index.d.ts +48 -0
  247. package/dist/index.d.ts.map +1 -0
  248. package/dist/index.js +48 -0
  249. package/dist/index.js.map +1 -0
  250. package/dist/overlay.d.ts +83 -0
  251. package/dist/overlay.d.ts.map +1 -0
  252. package/dist/overlay.js +199 -0
  253. package/dist/overlay.js.map +1 -0
  254. package/dist/theme.css +419 -0
  255. package/dist/types.d.ts +175 -0
  256. package/dist/types.d.ts.map +1 -0
  257. package/dist/types.js +2 -0
  258. package/dist/types.js.map +1 -0
  259. package/dist/utils/ValueController.d.ts +10 -0
  260. package/dist/utils/ValueController.d.ts.map +1 -0
  261. package/dist/utils/ValueController.js +32 -0
  262. package/dist/utils/ValueController.js.map +1 -0
  263. package/dist/utils/acessibility.d.ts +52 -0
  264. package/dist/utils/acessibility.d.ts.map +1 -0
  265. package/dist/utils/acessibility.js +80 -0
  266. package/dist/utils/acessibility.js.map +1 -0
  267. package/dist/utils/css.d.ts +12 -0
  268. package/dist/utils/css.d.ts.map +1 -0
  269. package/dist/utils/css.js +72 -0
  270. package/dist/utils/css.js.map +1 -0
  271. package/dist/utils/options.d.ts +3 -0
  272. package/dist/utils/options.d.ts.map +1 -0
  273. package/dist/utils/options.js +7 -0
  274. package/dist/utils/options.js.map +1 -0
  275. package/package.json +51 -0
  276. package/scripts/build-css.ts +49 -0
  277. package/src/components/Accordion.tsx +74 -0
  278. package/src/components/Alert.tsx +16 -0
  279. package/src/components/AsyncContent.tsx +54 -0
  280. package/src/components/Avatar.tsx +34 -0
  281. package/src/components/AvatarGroup.tsx +40 -0
  282. package/src/components/Badge.tsx +28 -0
  283. package/src/components/Blockquote.tsx +9 -0
  284. package/src/components/Breadcrumb.tsx +24 -0
  285. package/src/components/Button.tsx +88 -0
  286. package/src/components/Card.tsx +32 -0
  287. package/src/components/Checkbox.tsx +36 -0
  288. package/src/components/CheckboxGroup.tsx +93 -0
  289. package/src/components/Circle.tsx +26 -0
  290. package/src/components/CitricComponent.ts +34 -0
  291. package/src/components/Divider.tsx +22 -0
  292. package/src/components/ErrorBoundary.tsx +62 -0
  293. package/src/components/ErrorMessage.tsx +11 -0
  294. package/src/components/FallbackBoundary.tsx +29 -0
  295. package/src/components/Favorite.tsx +37 -0
  296. package/src/components/FieldGroup.tsx +22 -0
  297. package/src/components/Form.tsx +17 -0
  298. package/src/components/FormGroup.tsx +45 -0
  299. package/src/components/IconBox.tsx +78 -0
  300. package/src/components/Input.tsx +32 -0
  301. package/src/components/Link.tsx +40 -0
  302. package/src/components/LoadingPanel.tsx +8 -0
  303. package/src/components/MenuOverlay/Menu.tsx +157 -0
  304. package/src/components/MenuOverlay/context.ts +20 -0
  305. package/src/components/MenuOverlay/index.tsx +35 -0
  306. package/src/components/MenuOverlay/keyboard.ts +60 -0
  307. package/src/components/MenuOverlay/types.ts +178 -0
  308. package/src/components/Overlay/context.ts +10 -0
  309. package/src/components/Overlay/index.tsx +137 -0
  310. package/src/components/Overlay/types.ts +71 -0
  311. package/src/components/Pagination.tsx +90 -0
  312. package/src/components/ProgressBar.tsx +25 -0
  313. package/src/components/ProgressCircular.tsx +29 -0
  314. package/src/components/RadioGroup.tsx +87 -0
  315. package/src/components/Rating.tsx +25 -0
  316. package/src/components/Select/RichSelect.tsx +214 -0
  317. package/src/components/Select/SimpleSelect.tsx +66 -0
  318. package/src/components/Select/index.tsx +8 -0
  319. package/src/components/Select/types.ts +121 -0
  320. package/src/components/SelectBox.tsx +134 -0
  321. package/src/components/Skeleton.tsx +41 -0
  322. package/src/components/Slider.tsx +77 -0
  323. package/src/components/SmartTable.tsx +148 -0
  324. package/src/components/Stepper.tsx +142 -0
  325. package/src/components/Switch.tsx +29 -0
  326. package/src/components/Table.tsx +219 -0
  327. package/src/components/Tabs/TabController.ts +40 -0
  328. package/src/components/Tabs/index.tsx +64 -0
  329. package/src/components/Tabs/types.ts +48 -0
  330. package/src/components/Tabs/utils.ts +6 -0
  331. package/src/components/Text.ts +75 -0
  332. package/src/components/Textarea.tsx +12 -0
  333. package/src/components/Tooltip.tsx +53 -0
  334. package/src/components/layout.tsx +53 -0
  335. package/src/context/CitricContext.tsx +4 -0
  336. package/src/context/CitricProvider.tsx +14 -0
  337. package/src/context/hooks.ts +6 -0
  338. package/src/index.ts +47 -0
  339. package/src/overlay.ts +276 -0
  340. package/src/types.ts +226 -0
  341. package/src/utils/ValueController.ts +28 -0
  342. package/src/utils/acessibility.ts +92 -0
  343. package/src/utils/css.ts +106 -0
  344. package/src/utils/options.ts +7 -0
  345. package/tsconfig.json +10 -0
@@ -0,0 +1,33 @@
1
+ import { HTMLExtension } from '../types.js';
2
+ export interface BaseAccordionProps {
3
+ /**
4
+ * A unique id for this accordion.
5
+ */
6
+ id?: string;
7
+ /**
8
+ * The Accordion's appearance. If unset, the appearance is customizable.
9
+ */
10
+ appearance?: 'card';
11
+ /**
12
+ * Controls the expansion state of the accordion.
13
+ */
14
+ expanded?: boolean;
15
+ /**
16
+ * Controls the expansion state of the accordion. Called when the accordion is expanded or collapsed.
17
+ */
18
+ onChange?: (expanded: boolean) => void;
19
+ /**
20
+ * The header for the accordion, i.e. the part that is always rendered. You can use either a simple title or a custom set of components,
21
+ * in the second case, you may pass a function that receives the "expand/collapse" button as parameter.
22
+ */
23
+ header: React.ReactNode | ((expandButton: React.ReactElement) => React.ReactNode);
24
+ /**
25
+ * The maximum height for the accordion.
26
+ *
27
+ * @default 300
28
+ */
29
+ maxHeight?: number;
30
+ }
31
+ export type AccordionProps = HTMLExtension<'div', BaseAccordionProps, 'onChange'>;
32
+ export declare const Accordion: ({ id, appearance, expanded, onChange, header, maxHeight, className, style, children, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
33
+ //# sourceMappingURL=Accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAIxC,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAClF;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAA;AAEjF,eAAO,MAAM,SAAS,GACpB,iGAAuG,cAAc,4CAkCtH,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { useEffect, useMemo, useState } from 'react';
4
+ import { applyCSSVariable } from '../utils/css.js';
5
+ import { CitricComponent } from './CitricComponent.js';
6
+ export const Accordion = ({ id, appearance, expanded, onChange, header, maxHeight = 300, className, style, children, ...props }) => {
7
+ const [ariaHidden, setAriaHidden] = useState(!expanded);
8
+ const accordionId = useMemo(() => id || `${Math.random()}`, [id]);
9
+ useEffect(() => {
10
+ setAriaHidden(!expanded);
11
+ }, [expanded]);
12
+ const expandBtn = _jsx("input", { type: "checkbox", checked: expanded, onChange: () => {
13
+ setAriaHidden(!ariaHidden);
14
+ onChange?.(!expanded);
15
+ }, onKeyDown: e => e.key === 'Enter' && e.target.click?.(), "aria-controls": accordionId });
16
+ const headerContent = typeof header === 'function' ? header(expandBtn) : _jsxs("label", { children: [header, expandBtn] });
17
+ return (_jsxs(CitricComponent, { tag: "div", component: "accordion", className: listToClass([appearance, className]), style: applyCSSVariable(style, 'max-height', `${maxHeight}px`), ...props, children: [_jsx("header", { children: headerContent }), _jsx("section", { id: accordionId, "aria-hidden": ariaHidden, ...(ariaHidden ? { inert: 'true' } : {}), children: appearance === 'card' ? _jsx("div", { className: "content", children: children }) : children })] }));
18
+ };
19
+ //# sourceMappingURL=Accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAkCnD,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB,EACrH,EAAE;IACF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC1B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,MAAM,SAAS,GAAG,gBAChB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,GAAG,EAAE;YACb,aAAa,CAAC,CAAC,UAAU,CAAC,CAAA;YAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;QACvB,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,IAAK,CAAC,CAAC,MAAsB,CAAC,KAAK,EAAE,EAAE,mBACzD,WAAW,GAC1B,CAAA;IACF,MAAM,aAAa,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,4BAAQ,MAAM,EAAE,SAAS,IAAS,CAAA;IAC3G,OAAO,CACL,MAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,WAAW,EACrB,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,EAC/C,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,SAAS,IAAI,CAAC,KAC1D,KAAK,aAET,2BAAS,aAAa,GAAU,EAChC,kBAAS,EAAE,EAAE,WAAW,iBAAe,UAAU,KAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,YACzF,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,SAAS,YAAE,QAAQ,GAAO,CAAC,CAAC,CAAC,QAAQ,GACrE,IACM,CACnB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { HTMLExtension } from '../types.js';
2
+ export interface BaseAlertProps {
3
+ /**
4
+ * Type of the message.
5
+ * @default 'warning'
6
+ */
7
+ type?: 'error' | 'info' | 'warning';
8
+ }
9
+ export type AlertProps = HTMLExtension<'div', BaseAlertProps>;
10
+ export declare const Alert: ({ type, className, children, ...props }: AlertProps) => import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=Alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,CAAA;AAE7D,eAAO,MAAM,KAAK,GAAI,yCAAyC,UAAU,4CACwD,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { CitricComponent } from './CitricComponent.js';
4
+ export const Alert = ({ type, className, children, ...props }) => _jsx(CitricComponent, { tag: "div", component: "alert", className: listToClass([type, className]), ...props, children: children });
5
+ //# sourceMappingURL=Alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAYnD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAc,EAAE,EAAE,CAC3E,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,KAAM,KAAK,YAAG,QAAQ,GAAmB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { MutableRefObject } from 'react';
2
+ interface Props {
3
+ /**
4
+ * Whether or not to show the loading feedback.
5
+ */
6
+ loading: boolean;
7
+ /**
8
+ * A javascript error. Used to show error feedbacks.
9
+ */
10
+ error?: any;
11
+ /**
12
+ * If provided, this element will receive focus as soon as the content is loaded and has no errors.
13
+ * Can be either a React Ref Object or a query selector.
14
+ */
15
+ autofocus?: string | MutableRefObject<HTMLElement>;
16
+ /**
17
+ * The content to show if it's not loading or has errors.
18
+ */
19
+ children: React.ReactNode;
20
+ }
21
+ /**
22
+ * Renders a component that provides user feedback on async requests.
23
+ * It renders either a loading component, an error component (which is received as prop)
24
+ * or the received children props.
25
+ *
26
+ * @param options the props for rendering the component: {@link Props}.
27
+ */
28
+ export declare const AsyncContent: ({ loading, error, autofocus, children }: Props) => string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
29
+ export {};
30
+ //# sourceMappingURL=AsyncContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncContent.d.ts","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA8B,MAAM,OAAO,CAAA;AAKpE,UAAU,KAAK;IACb;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY,GAAI,yCAAyC,KAAK,iIAoB1E,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useLayoutEffect } from 'react';
3
+ import { useCitricController } from '../context/hooks.js';
4
+ import { ErrorMessage } from './ErrorMessage.js';
5
+ import { LoadingPanel } from './LoadingPanel.js';
6
+ /**
7
+ * Renders a component that provides user feedback on async requests.
8
+ * It renders either a loading component, an error component (which is received as prop)
9
+ * or the received children props.
10
+ *
11
+ * @param options the props for rendering the component: {@link Props}.
12
+ */
13
+ export const AsyncContent = ({ loading, error, autofocus, children }) => {
14
+ const citric = useCitricController();
15
+ useEffect(() => {
16
+ if (error) {
17
+ citric?.onError?.(error);
18
+ // eslint-disable-next-line no-console
19
+ console.error(error);
20
+ }
21
+ }, [error]);
22
+ useLayoutEffect(() => {
23
+ if (!loading && !error) {
24
+ typeof autofocus === 'string' ? document.querySelector(autofocus)?.focus?.() : autofocus?.current?.focus();
25
+ }
26
+ }, [loading, error]);
27
+ if (loading)
28
+ return _jsx(LoadingPanel, {});
29
+ if (error)
30
+ return citric?.renderError ? citric.renderError(error) : _jsx(ErrorMessage, { error: error });
31
+ return children;
32
+ };
33
+ //# sourceMappingURL=AsyncContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncContent.js","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAoB,SAAS,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAsB7C;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAS,EAAE,EAAE;IAC7E,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IAEpC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;YACxB,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;YACvB,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAiB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;QAC7H,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IAEpB,IAAI,OAAO;QAAE,OAAO,KAAC,YAAY,KAAG,CAAA;IACpC,IAAI,KAAK;QAAE,OAAO,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CAAA;IAClG,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { HTMLExtension, WithColorPalette } from '../types.js';
2
+ export interface BaseAvatarProps extends WithColorPalette {
3
+ /**
4
+ * @default 'lg'
5
+ */
6
+ size?: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7
+ /**
8
+ * This name will be reduced to a maximum of 2 capital letters (first letter of each word).
9
+ */
10
+ name?: string;
11
+ /**
12
+ * @default 'circle'
13
+ */
14
+ appearance?: 'square' | 'circle';
15
+ /**
16
+ * If instead of the name you want to use an image, this should be the image's url.
17
+ */
18
+ image?: string;
19
+ }
20
+ export type AvatarProps = HTMLExtension<'div', BaseAvatarProps, 'children'>;
21
+ export declare const Avatar: ({ size, name, appearance, className, image, ...props }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=Avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG1D,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAA;AAE3E,eAAO,MAAM,MAAM,GAAI,wDAAwD,WAAW,4CAQzF,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { CitricComponent } from './CitricComponent.js';
4
+ export const Avatar = ({ size, name, appearance, className, image, ...props }) => {
5
+ const parts = name?.split(' ') ?? [''];
6
+ const acronym = parts.length >= 2 ? `${parts[0][0]}${parts[1][0]}` : parts[0][0];
7
+ return (_jsx(CitricComponent, { tag: "div", component: "avatar", className: listToClass([size, appearance, className]), ...props, children: image ? _jsx("img", { src: image }) : acronym }));
8
+ };
9
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAuBnD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE;IAC5F,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAChF,OAAO,CACL,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,KAAM,KAAK,YAC3G,KAAK,CAAC,CAAC,CAAC,cAAK,GAAG,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,OAAO,GACtB,CACnB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { HTMLExtension, WithColorPalette } from '../types.js';
2
+ export interface BaseAvatarGroupProps extends WithColorPalette {
3
+ /**
4
+ * @default 'lg'
5
+ */
6
+ size?: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7
+ /**
8
+ * @default 'circle'
9
+ */
10
+ appearance?: 'square' | 'circle';
11
+ /**
12
+ * The avatars in the group. Use "image" for rendering images instead of the avatar.
13
+ */
14
+ items: {
15
+ name?: string;
16
+ image?: string;
17
+ }[];
18
+ /**
19
+ * A maximum number of avatars to show in the group.
20
+ **/
21
+ maxItems?: number;
22
+ }
23
+ export type AvatarGroupProps = HTMLExtension<'div', BaseAvatarGroupProps, 'children'>;
24
+ export declare const AvatarGroup: ({ size, items, appearance, maxItems, className, ...props }: AvatarGroupProps) => import("react/jsx-runtime").JSX.Element;
25
+ //# sourceMappingURL=AvatarGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/components/AvatarGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAI1D,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C;;QAEI;IACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,KAAK,EAAE,oBAAoB,EAAE,UAAU,CAAC,CAAA;AAErF,eAAO,MAAM,WAAW,GAAI,4DAA4D,gBAAgB,4CAavG,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { Avatar } from './Avatar.js';
4
+ import { CitricComponent } from './CitricComponent.js';
5
+ export const AvatarGroup = ({ size, items, appearance, maxItems, className, ...props }) => {
6
+ const avatars = items.map(({ name, image }) => _jsx(Avatar, { name: name, image: image }, name), [items]);
7
+ return (_jsx(CitricComponent, { tag: "div", component: "avatar-group", className: listToClass([size, appearance, className]), "data-max-items": maxItems, ...props, children: avatars }));
8
+ };
9
+ //# sourceMappingURL=AvatarGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarGroup.js","sourceRoot":"","sources":["../../src/components/AvatarGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAuBnD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE;IAC1G,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAC,MAAM,IAAY,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,IAA9B,IAAI,CAA8B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACxG,OAAO,CACL,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,oBACrC,QAAQ,KACpB,KAAK,YAER,OAAO,GACQ,CACnB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { HTMLExtension, WithColorPalette } from '../types.js';
2
+ type ValidTags = 'a' | 'button' | 'li' | 'div' | 'span';
3
+ export interface BaseBadgeProps<T extends ValidTags = ValidTags> extends WithColorPalette {
4
+ /**
5
+ * @default 'div'
6
+ */
7
+ tag?: T;
8
+ /**
9
+ * Determines how round the corners are.
10
+ *
11
+ * @default 'circle'
12
+ */
13
+ appearance?: 'square' | 'circle';
14
+ }
15
+ export type BadgeProps<T extends ValidTags> = HTMLExtension<T, BaseBadgeProps<T>>;
16
+ export declare function Badge<T extends ValidTags>({ tag, appearance, className, children, ...props }: BadgeProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG1D,KAAK,SAAS,GAAG,GAAG,GAAG,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAA;AAEvD,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,gBAAgB;IACvF;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAClC;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,IAAI,aAAa,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAEjF,wBAAgB,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,2CAM3G"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { CitricComponent } from './CitricComponent.js';
4
+ export function Badge({ tag, appearance, className, children, ...props }) {
5
+ return (_jsx(CitricComponent, { tag: tag || 'div', component: "badge", className: listToClass([appearance, className]), ...props, children: children }));
6
+ }
7
+ //# sourceMappingURL=Badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAmBnD,MAAM,UAAU,KAAK,CAAsB,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IAC1G,OAAO,CACL,KAAC,eAAe,IAAC,GAAG,EAAE,GAAG,IAAI,KAAK,EAAE,SAAS,EAAC,OAAO,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,KAAM,KAAY,YACpH,QAAQ,GACO,CACnB,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types.js';
2
+ export type BaseBlockquoteProps = WithColorScheme & WithColorPalette;
3
+ export type BlockquoteProps = HTMLExtension<'blockquote', BaseBlockquoteProps>;
4
+ export declare const Blockquote: ({ children, ...props }: BlockquoteProps) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=Blockquote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Blockquote.d.ts","sourceRoot":"","sources":["../../src/components/Blockquote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG3E,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;AAE9E,eAAO,MAAM,UAAU,GAAI,wBAAwB,eAAe,4CACgC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CitricComponent } from './CitricComponent.js';
3
+ export const Blockquote = ({ children, ...props }) => _jsx(CitricComponent, { tag: "blockquote", component: "blockquote", ...props, children: children });
4
+ //# sourceMappingURL=Blockquote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Blockquote.js","sourceRoot":"","sources":["../../src/components/Blockquote.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAMnD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE,CACpE,KAAC,eAAe,IAAC,GAAG,EAAC,YAAY,EAAC,SAAS,EAAC,YAAY,KAAK,KAAK,YAAG,QAAQ,GAAmB,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { HTMLExtension } from '../types.js';
2
+ interface BreadCrumbItem {
3
+ label: string;
4
+ href?: string;
5
+ }
6
+ export interface BaseBreadcrumbProps {
7
+ items: BreadCrumbItem[];
8
+ }
9
+ export type BreadcrumbProps = HTMLExtension<'nav', BaseBreadcrumbProps, 'children'>;
10
+ export declare const Breadcrumb: ({ items, ...props }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=Breadcrumb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumb.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAA;AAEnF,eAAO,MAAM,UAAU,GAAI,qBAAqB,eAAe,4CAQ9D,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { CitricComponent } from './CitricComponent.js';
4
+ export const Breadcrumb = ({ items, ...props }) => {
5
+ const children = useMemo(() => items.map((item, index) => item.href ? _jsx("li", { children: _jsx("a", { href: item.href, children: item.label }) }, index) : _jsx("li", { children: item.label }, index)), [items]);
6
+ return _jsx(CitricComponent, { tag: "nav", component: "breadcrumb", ...props, children: _jsx("ul", { children: children }) });
7
+ };
8
+ //# sourceMappingURL=Breadcrumb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.js","sourceRoot":"","sources":["../../src/components/Breadcrumb.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAanD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CACb,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAgB,YAAG,IAAI,EAAE,IAAI,CAAC,IAAI,YAAG,IAAI,CAAC,KAAK,GAAK,IAA3C,KAAK,CAA2C,CAAC,CAAC,CAAC,uBAAiB,IAAI,CAAC,KAAK,IAAlB,KAAK,CAAmB,CAC3H,EACD,CAAC,KAAK,CAAC,CACR,CAAA;IACD,OAAO,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,YAAY,KAAK,KAAK,YAAE,uBAAK,QAAQ,GAAM,GAAkB,CAAA;AAC3G,CAAC,CAAA"}
@@ -0,0 +1,42 @@
1
+ import { HTMLExtension, WithColorScheme } from '../types.js';
2
+ export interface BaseButtonProps extends WithColorScheme {
3
+ /**
4
+ * - contained for buttons with background;
5
+ * - outlined for transparent buttons with borders;
6
+ * - text for buttons with no borders or background.
7
+ * @default 'contained'
8
+ */
9
+ appearance?: 'outlined' | 'text' | 'contained';
10
+ /**
11
+ * Size of the button.
12
+ * @default 'md'
13
+ */
14
+ size?: 'sm' | 'md' | 'lg';
15
+ /**
16
+ * Animated text to show on when the button is clicked.
17
+ */
18
+ feedback?: string;
19
+ /**
20
+ * Whether or not to show a loading feedback instead of the button's content.
21
+ *
22
+ * Buttons in the loading state are also disabled.
23
+ */
24
+ loading?: boolean;
25
+ /**
26
+ * Function to run when the button is clicked. If this function returns a promise, the button will automatically show a loading feedback
27
+ * until the promise completes.
28
+ */
29
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => any;
30
+ /**
31
+ * Whether or not a click in this button should generate analytics data.
32
+ *
33
+ * This only takes effect if there's a CitricController in React's context. The value of `analytics` is passed to the function
34
+ * `onClickButton` of the controller.
35
+ *
36
+ * @default false
37
+ */
38
+ analytics?: boolean;
39
+ }
40
+ export type ButtonProps = HTMLExtension<'button', BaseButtonProps, 'onClick'>;
41
+ export declare const Button: ({ appearance, size, feedback, loading, disabled, onClick, className, children, type, analytics, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
42
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAIzD,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IAC/C;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC;IAC1E;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,CAAC,CAAA;AAE7E,eAAO,MAAM,MAAM,GACjB,4GAAuH,WAAW,4CAsCnI,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { useState } from 'react';
4
+ import { useCitricController } from '../context/hooks.js';
5
+ import { CitricComponent } from './CitricComponent.js';
6
+ import { ProgressCircular } from './ProgressCircular.js';
7
+ export const Button = ({ appearance, size, feedback, loading, disabled, onClick, className, children, type = 'button', analytics, ...props }) => {
8
+ const citric = useCitricController();
9
+ const [waiting, setWaiting] = useState(false);
10
+ const busy = loading || waiting;
11
+ async function handleClick(e) {
12
+ const result = onClick?.(e);
13
+ citric?.onClickButton?.(e, analytics ?? false);
14
+ if (result instanceof Promise) {
15
+ setWaiting(true);
16
+ try {
17
+ await result;
18
+ }
19
+ catch { /* empty */ }
20
+ setWaiting(false);
21
+ }
22
+ }
23
+ return (_jsxs(CitricComponent, { tag: "button", component: "button", className: listToClass([size, appearance, className]), "data-feedback": feedback, onClick: handleClick, "aria-busy": busy, disabled: disabled || busy, type: type, ...props, children: [busy ? _jsx("div", { children: children }) : children, busy && (_jsx("div", { className: "loader", children: _jsx(ProgressCircular, { size: "sm" }) }))] }));
24
+ };
25
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AA2CrD,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAe,EAClI,EAAE;IACF,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IACpC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,IAAI,GAAG,OAAO,IAAI,OAAO,CAAA;IAE/B,KAAK,UAAU,WAAW,CAAC,CAAkD;QAC3E,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;QAC3B,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,SAAS,IAAI,KAAK,CAAC,CAAA;QAC9C,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,CAAA;YAChB,IAAI,CAAC;gBACH,MAAM,MAAM,CAAA;YACd,CAAC;YAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;YACvB,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;IAED,OAAO,CACL,MAAC,eAAe,IACd,GAAG,EAAC,QAAQ,EACZ,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,mBACtC,QAAQ,EACvB,OAAO,EAAE,WAAW,eACT,IAAI,EACf,QAAQ,EAAE,QAAQ,IAAI,IAAI,EAC1B,IAAI,EAAE,IAAI,KACN,KAAK,aAER,IAAI,CAAC,CAAC,CAAC,wBAAM,QAAQ,GAAO,CAAC,CAAC,CAAC,QAAQ,EACvC,IAAI,IAAI,CACP,cAAK,SAAS,EAAC,QAAQ,YACrB,KAAC,gBAAgB,IAAC,IAAI,EAAC,IAAI,GAAG,GAC1B,CACP,IACe,CACnB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { HTMLExtension, WithColorScheme } from '../types.js';
2
+ export interface BaseCardProps extends WithColorScheme {
3
+ onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
4
+ /**
5
+ * The size of the card.
6
+ *
7
+ * @default 'md'
8
+ */
9
+ size?: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
10
+ /**
11
+ * The background color level. The main color will depend on the "colorScheme", which is "light" by default.
12
+ *
13
+ * @default 300
14
+ */
15
+ bgLevel?: 300 | 400 | 500 | 600;
16
+ }
17
+ export type CardProps = HTMLExtension<'div', BaseCardProps>;
18
+ export declare const Card: ({ onClick, size, bgLevel, className, children, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=Card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGzD,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;;;OAIG;IACH,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CACjC;AAED,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;AAE3D,eAAO,MAAM,IAAI,GAAI,2DAA2D,SAAS,4CASxF,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { CitricComponent } from './CitricComponent.js';
4
+ export const Card = ({ onClick, size, bgLevel, className, children, ...props }) => (_jsx(CitricComponent, { tag: "div", component: "card", className: listToClass([onClick && 'clickable', size, bgLevel && `bg-${bgLevel}`, className]), ...props, children: children }));
5
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAoBnD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE,CAAC,CAC5F,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,MAAM,EAChB,SAAS,EAAE,WAAW,CAAC,CAAC,OAAO,IAAI,WAAW,EAAE,IAAI,EAAE,OAAO,IAAI,MAAM,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC,KACzF,KAAK,YAER,QAAQ,GACO,CACnB,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { HTMLExtension, WithColorScheme } from '../types.js';
2
+ export interface BaseCheckboxProps extends WithColorScheme {
3
+ /**
4
+ * "checkbox" for common check boxes, "switch" for toggles.
5
+ * @default 'checkbox'
6
+ */
7
+ appearance?: 'checkbox' | 'switch';
8
+ value?: boolean;
9
+ onChange?: (value: boolean) => void;
10
+ children?: React.ReactNode;
11
+ }
12
+ export type CheckboxProps = HTMLExtension<'input', BaseCheckboxProps, 'type' | 'onChange' | 'value'>;
13
+ export declare const Checkbox: ({ appearance, value, onChange, colorScheme, children, className, style, ...props }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGzD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,CAAA;AAEpG,eAAO,MAAM,QAAQ,GACnB,oFAAiG,aAAa,4CAkB/G,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CitricComponent } from './CitricComponent.js';
3
+ export const Checkbox = ({ appearance = 'checkbox', value, onChange, colorScheme, children, className, style, ...props }) => {
4
+ const handleChange = onChange ? () => onChange(!value) : undefined;
5
+ return children ? (_jsxs(CitricComponent, { tag: "label", component: `${appearance}-row`, colorScheme: colorScheme, style: style, className: className, children: [_jsx("input", { type: "checkbox", checked: value, onChange: handleChange, ...props }), children] })) : _jsx(CitricComponent, { tag: "input", type: "checkbox", component: appearance, checked: value, onChange: handleChange, className: className, style: style, ...props });
6
+ };
7
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAenD,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,EAAE,UAAU,GAAG,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAiB,EAC9G,EAAE;IACF,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAClE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAChB,MAAC,eAAe,IAAC,GAAG,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,UAAU,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,aACvH,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,KAAM,KAAK,GAAI,EAC3E,QAAQ,IACO,CACnB,CAAC,CAAC,CAAC,KAAC,eAAe,IAClB,GAAG,EAAC,OAAO,EACX,IAAI,EAAC,UAAU,EACf,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,KACR,KAAK,GACT,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { HTMLExtension, WithColorScheme } from '../types.js';
2
+ export interface BaseCheckboxGroupProps<T = any> extends WithColorScheme {
3
+ /**
4
+ * "checkbox" for common check boxes, "switch" for toggles.
5
+ * @default 'checkbox'
6
+ */
7
+ appearance?: 'checkbox' | 'switch';
8
+ /**
9
+ * The field name.
10
+ */
11
+ name?: string;
12
+ /**
13
+ * All items corresponding to the selected checkboxes.
14
+ */
15
+ value: T[];
16
+ /**
17
+ * All the items (checkboxes) to render.
18
+ */
19
+ options: T[];
20
+ /**
21
+ * Called whenever the selected checkboxes changes.
22
+ * @param value the currently selected items.
23
+ */
24
+ onChange: (value: T[]) => void;
25
+ /**
26
+ * A function to render the item label.
27
+ * @example
28
+ * `(option) => option.name`
29
+ * @default "the item's toString() result."
30
+ * @param option the item to render.
31
+ * @returns a React Node to render.
32
+ */
33
+ renderLabel?: (option: T) => React.ReactNode;
34
+ /**
35
+ * A function to render the item value, a unique identifier for the option.
36
+ * @example
37
+ * `(option) => option.id`
38
+ * @default "if the item is a string or a number, the stringified item. Otherwise, undefined."
39
+ * @param option the item to compute a key for.
40
+ * @returns a string key.
41
+ */
42
+ renderKey?: (option: T) => string | number | undefined;
43
+ /**
44
+ * If this function returns true for the item, this option is disabled.
45
+ * @default "nothing is disabled"
46
+ * @param option the item to calculate "disabled" for.
47
+ * @returns true if the item should be disabled, false otherwise.
48
+ */
49
+ isDisabled?: (option: T) => boolean;
50
+ }
51
+ export type CheckboxGroupProps<T> = HTMLExtension<'div', BaseCheckboxGroupProps<T>, 'onChange'>;
52
+ export declare function CheckboxGroup<T>({ appearance, name, value, options, onChange, renderLabel, renderKey, isDisabled, colorScheme, style, ...props }: CheckboxGroupProps<T>): import("react/jsx-runtime").JSX.Element;
53
+ //# sourceMappingURL=CheckboxGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../src/components/CheckboxGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAKzD,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,eAAe;IACtE;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,CAAC,EAAE,CAAC;IACX;;OAEG;IACH,OAAO,EAAE,CAAC,EAAE,CAAC;IACb;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC7C;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;CACrC;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;AAE/F,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAC/B,UAAuB,EACvB,IAAI,EACJ,KAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAgC,EAChC,SAA4B,EAC5B,UAAU,EACV,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAqBvB"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isNil } from 'lodash';
3
+ import { useMemo } from 'react';
4
+ import { defaultRenderKey, defaultRenderLabel } from '../utils/options.js';
5
+ import { CitricComponent } from './CitricComponent.js';
6
+ import { Column } from './layout.js';
7
+ export function CheckboxGroup({ appearance = 'checkbox', name, value = [], options, onChange, renderLabel = defaultRenderLabel, renderKey = defaultRenderKey, isDisabled, colorScheme, style, ...props }) {
8
+ const items = useMemo(() => {
9
+ const valueKeys = value.map(renderKey);
10
+ return options.map((o) => {
11
+ const key = renderKey(o);
12
+ return (_jsxs(CitricComponent, { tag: "label", component: `${appearance}-row`, colorScheme: colorScheme, children: [_jsx("input", { type: "checkbox", name: name, value: key, checked: value.includes(o) || (!isNil(key) && valueKeys.includes(key)), onChange: (e) => onChange?.(e.target.checked ? [...(value ?? []), o] : (value?.filter(item => item != o) ?? [])), disabled: isDisabled?.(o) }), renderLabel(o)] }, key));
13
+ });
14
+ }, [options, value, name, colorScheme, appearance]);
15
+ return _jsx(Column, { ...props, style: { gap: '8px', ...style }, children: items });
16
+ }
17
+ //# sourceMappingURL=CheckboxGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../src/components/CheckboxGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAsDjC,MAAM,UAAU,aAAa,CAAI,EAC/B,UAAU,GAAG,UAAU,EACvB,IAAI,EACJ,KAAK,GAAG,EAAE,EACV,OAAO,EACP,QAAQ,EACR,WAAW,GAAG,kBAAkB,EAChC,SAAS,GAAG,gBAAgB,EAC5B,UAAU,EACV,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACc;IACtB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QACtC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACvB,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;YACxB,OAAO,CACL,MAAC,eAAe,IAAC,GAAG,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,UAAU,MAAM,EAAY,WAAW,EAAE,WAAW,aAC7F,gBACE,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EACtE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAChH,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,GACzB,EACD,WAAW,CAAC,CAAC,CAAC,KATiD,GAAG,CAUnD,CACnB,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAA;IACnD,OAAO,KAAC,MAAM,OAAK,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,YAAG,KAAK,GAAU,CAAA;AAC7E,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types.js';
2
+ export interface BaseCircleProps extends WithColorPalette, WithColorScheme {
3
+ /**
4
+ * Whether or not to show borders.
5
+ *
6
+ * @default false
7
+ */
8
+ showBorders?: boolean;
9
+ /**
10
+ * The size of the circle.
11
+ *
12
+ * @default 'xs'
13
+ */
14
+ size?: 'xxs' | 'xs' | 'sm' | 'lg' | 'xl' | 'xxl';
15
+ }
16
+ export type CircleProps = HTMLExtension<'div', BaseCircleProps>;
17
+ export declare const Circle: ({ showBorders, className, size, children, ...props }: CircleProps) => import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=Circle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../src/components/Circle.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG3E,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,eAAe;IACxE;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;CAClD;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;AAE/D,eAAO,MAAM,MAAM,GAAI,sDAAsD,WAAW,4CAIvF,CAAA"}