@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,67 @@
1
+ import { OverlayOptions } from '../../overlay.js';
2
+ import { HTMLExtension } from '../../types.js';
3
+ export type TriggerOn = 'hover' | 'click';
4
+ export interface BaseOverlayProps<T extends keyof React.JSX.IntrinsicElements> extends Omit<OverlayOptions<T>, 'target'> {
5
+ /**
6
+ * When should the overlay element be created? When the child is clicked or when the child is hovered?
7
+ *
8
+ * Accessibility:
9
+ * Click = focus + press enter to open; focus + enter to close OR esc.
10
+ * Hover = focus to open; blur to close.
11
+ *
12
+ * @default 'hover'
13
+ */
14
+ triggerOn?: TriggerOn;
15
+ /**
16
+ * TODO: not implemented yet.
17
+ *
18
+ * Only valid if `triggerOn` is "hover".
19
+ *
20
+ * If the overlay is hidden right after the mouse leaves the element, then it becomes impossible to interact with anything inside the
21
+ * tooltip. This sets a delay for the overlay to disappear, giving it time for the user to hover the overlay or gocus one of its children,
22
+ * which will prevent it from closing.
23
+ *
24
+ * When `hoverDelayMS` is greater then zero, the hover effect is also applied to the overlay itself instead of just the child element.
25
+ *
26
+ * When set to "auto", a hover delay of 1 second will be used if the overlay contains any focusable element.
27
+ *
28
+ * @default 'auto'
29
+ */
30
+ hoverDelayMS?: number | 'auto';
31
+ /**
32
+ * TODO: not implemented yet.
33
+ *
34
+ * - Never: the focus won't changes when the overlay opens.
35
+ * - All: the focus always changes when the overlay opens (given there's a focusable element in the overlay).
36
+ * - Keyboard (default): the focus only changes when the overlay is opened via the keyboard.
37
+ *
38
+ * The first focusable element in the overlay will be focused as soon as it's rendered. When it's closed, the child element
39
+ * (`children`) regains focus.
40
+ *
41
+ * The focus control will be such that, after the last element in the overlay is focused, the next focus will move to the child element
42
+ * (`children`).
43
+ *
44
+ * If the overlay has no focusable element, this properties makes no difference.
45
+ *
46
+ * Attention: focusable elements inside the overlay can be ignored by setting `auto-focus` to false.
47
+ *
48
+ * @default 'keyboard'
49
+ */
50
+ autoFocusBehavior?: 'never' | 'always' | 'keyboard';
51
+ /**
52
+ * The element to receive the overlay.
53
+ */
54
+ children: React.ReactElement;
55
+ /**
56
+ * Function to run when the child is rendered. It receives the child element as a parameter.
57
+ *
58
+ * This is useful for easily adding attributes to the element (mainly accessibility ones).
59
+ * @param element the child element, the one that receives the overlay.
60
+ */
61
+ onRenderChild?: (element: HTMLElement) => void;
62
+ }
63
+ export type OverlayProps<T extends keyof React.JSX.IntrinsicElements> = HTMLExtension<'div', BaseOverlayProps<T>, 'children' | 'content'>;
64
+ export interface OverlayController {
65
+ close: () => Promise<void>;
66
+ }
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Overlay/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAEzC,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAE,SAAQ,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;IACtH;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;;;;OAcG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,IAClE,aAAa,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAEnE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Overlay/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import { HTMLExtension } from '../types.js';
2
+ export interface BasePaginationProps {
3
+ /**
4
+ * The options for the page size.
5
+ *
6
+ * @default [10, 20, 30]
7
+ */
8
+ pageSizeOptions?: number[];
9
+ /**
10
+ * Total number of pages
11
+ */
12
+ totalPages: number;
13
+ /**
14
+ * The first page is 1. If "0" is provided, it will be treated as if it was "1".
15
+ */
16
+ page: number;
17
+ /**
18
+ * The current number of items in a page.
19
+ */
20
+ pageSize: number;
21
+ /**
22
+ * Function to run whenever the page size or current page changes.
23
+ */
24
+ onChange: (page: number, size: number) => void;
25
+ }
26
+ export type PaginationProps = HTMLExtension<'div', BasePaginationProps, 'children' | 'onChange'>;
27
+ export declare const Pagination: ({ pageSizeOptions, pageSize, totalPages, page, onChange, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=Pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/components/Pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAIxC,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,UAAU,GAAG,UAAU,CAAC,CAAA;AAEhG,eAAO,MAAM,UAAU,GACrB,qEAAoF,eAAe,4CA0CpG,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { interpolate, useTranslate } from '@stack-spot/portal-translate';
3
+ import { useMemo } from 'react';
4
+ import { CitricComponent } from './CitricComponent.js';
5
+ import { IconButton } from './IconBox.js';
6
+ export const Pagination = ({ pageSizeOptions = [10, 20, 30], pageSize, totalPages, page, onChange, ...props }) => {
7
+ const t = useTranslate(dictionary);
8
+ const sizeOptions = useMemo(() => pageSizeOptions.map(o => _jsx("option", { selected: pageSize === o, children: o }, o)), [pageSizeOptions]);
9
+ const pageOptions = useMemo(() => {
10
+ const options = [];
11
+ for (let i = 1; i <= totalPages; i++) {
12
+ options.push(_jsx("option", { value: i, selected: page === i, children: i }, i));
13
+ }
14
+ return options;
15
+ }, [page, totalPages]);
16
+ return (_jsxs(CitricComponent, { tag: "div", component: "pagination", ...props, children: [_jsx("div", { className: "page-size", children: _jsxs("label", { children: [t.itemsPerPage, ":", _jsx("select", { name: "itemsPerPage", onChange: e => onChange(page, parseInt(e.target.value)), children: sizeOptions })] }) }), _jsxs("div", { className: "page-number", children: [_jsx("label", { children: _jsx("select", { name: "page", onChange: e => onChange(parseInt(e.target.value), pageSize), children: pageOptions }) }), totalPages > 1 ? interpolate(t.ofTotalPlural, totalPages) : t.ofTotalSingular, _jsx(IconButton, { icon: "ChevronLeft", "aria-label": "previous", title: "previous", disabled: page === 1, onClick: () => onChange(page - 1, pageSize) }), _jsx(IconButton, { icon: "ChevronRight", "aria-label": "next", title: "next", disabled: page === totalPages, onClick: () => onChange(page + 1, pageSize) })] })] }));
17
+ };
18
+ const dictionary = {
19
+ en: {
20
+ itemsPerPage: 'Items per page',
21
+ ofTotalSingular: 'of 1 page',
22
+ ofTotalPlural: 'of $0 pages',
23
+ },
24
+ pt: {
25
+ itemsPerPage: 'Itens por página',
26
+ ofTotalSingular: 'de 1 página',
27
+ ofTotalPlural: 'de $0 páginas',
28
+ },
29
+ };
30
+ //# sourceMappingURL=Pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../src/components/Pagination.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AA6BtC,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,EAAE,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,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,YAAG,WAAW,GAAU,GACjG,EACP,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAC9E,KAAC,UAAU,IACT,IAAI,EAAC,aAAa,gBACP,UAAU,EACrB,KAAK,EAAC,UAAU,EAChB,QAAQ,EAAE,IAAI,KAAK,CAAC,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAC3C,EACF,KAAC,UAAU,IACT,IAAI,EAAC,cAAc,gBACR,MAAM,EACjB,KAAK,EAAC,MAAM,EACZ,QAAQ,EAAE,IAAI,KAAK,UAAU,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAC3C,IACE,IACU,CACnB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,YAAY,EAAE,gBAAgB;QAC9B,eAAe,EAAE,WAAW;QAC5B,aAAa,EAAE,aAAa;KAC7B;IACD,EAAE,EAAE;QACF,YAAY,EAAE,kBAAkB;QAChC,eAAe,EAAE,aAAa;QAC9B,aAAa,EAAE,eAAe;KAC/B;CACmB,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types.js';
2
+ export interface BaseProgressBarProps extends WithColorScheme, WithColorPalette {
3
+ /**
4
+ * A number varying from 0 to 100.
5
+ *
6
+ * If not provided, the progress will be indeterminate, causing an animation loop.
7
+ */
8
+ progress?: number;
9
+ }
10
+ export type ProgressBarProps = HTMLExtension<'div', BaseProgressBarProps>;
11
+ export declare const ProgressBar: ({ progress, style, className, ...props }: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=ProgressBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI3E,MAAM,WAAW,oBAAqB,SAAQ,eAAe,EAAE,gBAAgB;IAC7E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAA;AAEzE,eAAO,MAAM,WAAW,GAAI,0CAA0C,gBAAgB,4CAOlF,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { isNil } from 'lodash';
4
+ import { applyCSSVariable } from '../utils/css.js';
5
+ import { CitricComponent } from './CitricComponent.js';
6
+ export const ProgressBar = ({ progress, style, className, ...props }) => _jsx(CitricComponent, { tag: "div", component: "progress-bar", className: listToClass([className, isNil(progress) && 'indeterminate']), style: progress === undefined ? style : applyCSSVariable(style, 'progress', progress), ...props });
7
+ //# sourceMappingURL=ProgressBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAanD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE,CACxF,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,eAAe,CAAC,CAAC,EACvE,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,KACjF,KAAK,GACT,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types.js';
2
+ export interface BaseProgressCircularProps extends WithColorScheme, WithColorPalette {
3
+ /**
4
+ * A number varying from 0 to 100.
5
+ *
6
+ * If not provided, the progress will be indeterminate, causing an animation loop.
7
+ */
8
+ progress?: number;
9
+ /**
10
+ * @default 'md'
11
+ */
12
+ size?: 'xs' | 'sm' | 'md' | 'lg';
13
+ }
14
+ export type ProgressCircularProps = HTMLExtension<'div', BaseProgressCircularProps>;
15
+ export declare const ProgressCircular: ({ progress, size, style, className, ...props }: ProgressCircularProps) => import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=ProgressCircular.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressCircular.d.ts","sourceRoot":"","sources":["../../src/components/ProgressCircular.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI3E,MAAM,WAAW,yBAA0B,SAAQ,eAAe,EAAE,gBAAgB;IAClF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAA;AAEnF,eAAO,MAAM,gBAAgB,GAAI,gDAAgD,qBAAqB,4CAOlG,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { isNil } from 'lodash';
4
+ import { applyCSSVariable } from '../utils/css.js';
5
+ import { CitricComponent } from './CitricComponent.js';
6
+ export const ProgressCircular = ({ progress, size, style, className, ...props }) => _jsx(CitricComponent, { tag: "div", component: "progress-circular", className: listToClass([size, className, isNil(progress) && 'indeterminate']), style: progress === undefined ? style : applyCSSVariable(style, 'progress', progress), ...props });
7
+ //# sourceMappingURL=ProgressCircular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressCircular.js","sourceRoot":"","sources":["../../src/components/ProgressCircular.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAiBnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB,EAAE,EAAE,CACxG,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,mBAAmB,EAC7B,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,eAAe,CAAC,CAAC,EAC7E,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,KACjF,KAAK,GACT,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { HTMLExtension, WithColorScheme } from '../types.js';
2
+ export interface BaseRadioGroupProps<T> extends WithColorScheme {
3
+ /**
4
+ * The field name.
5
+ */
6
+ name?: string;
7
+ /**
8
+ * The current value.
9
+ */
10
+ value?: T;
11
+ /**
12
+ * All the items (radio buttons) to render.
13
+ */
14
+ options: T[];
15
+ /**
16
+ * Called whenever the selected radio button changes.
17
+ * @param value the currently selected item.
18
+ */
19
+ onChange?: (value: T) => void;
20
+ /**
21
+ * A function to render the item label.
22
+ * @example
23
+ * `(option) => option.name`
24
+ * @default "the item's toString() result."
25
+ * @param option the item to render.
26
+ * @returns a React Node to render.
27
+ */
28
+ renderLabel?: (option: T) => React.ReactNode;
29
+ /**
30
+ * A function to render the item value, a unique identifier for the option.
31
+ * @example
32
+ * `(option) => option.id`
33
+ * @default "if the item is a string or a number, the stringified item. Otherwise, undefined."
34
+ * @param option the item to compute a key for.
35
+ * @returns a string key.
36
+ */
37
+ renderKey?: (option: T) => string | number | undefined;
38
+ /**
39
+ * If this function returns true for the item, this option is disabled.
40
+ * @default "nothing is disabled"
41
+ * @param option the item to calculate "disabled" for.
42
+ * @returns true if the item should be disabled, false otherwise.
43
+ */
44
+ isDisabled?: (option: T) => boolean;
45
+ }
46
+ export type RadioGroupProps<T> = HTMLExtension<'div', BaseRadioGroupProps<T>, 'onChange'>;
47
+ export declare function RadioGroup<T>({ name, value, options, onChange, renderLabel, renderKey, isDisabled, colorScheme, style, ...props }: RadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
48
+ //# sourceMappingURL=RadioGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAKzD,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,eAAe;IAC7D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IACV;;OAEG;IACH,OAAO,EAAE,CAAC,EAAE,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B;;;;;;;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,eAAe,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;AAEzF,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAC5B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAgC,EAChC,SAA4B,EAC5B,UAAU,EACV,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,CAAC,CAAC,2CAqBpB"}
@@ -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 RadioGroup({ name, value, options, onChange, renderLabel = defaultRenderLabel, renderKey = defaultRenderKey, isDisabled, colorScheme, style, ...props }) {
8
+ const items = useMemo(() => {
9
+ const valueKey = value ? renderKey(value) : undefined;
10
+ return options.map((o) => {
11
+ const key = renderKey(o);
12
+ return (_jsxs(CitricComponent, { tag: "label", component: "radio-row", colorScheme: colorScheme, children: [_jsx("input", { type: "radio", name: name, value: key, checked: value === o || (!isNil(key) && valueKey === key), onChange: () => onChange?.(o), disabled: isDisabled?.(o) }), renderLabel(o)] }, key));
13
+ });
14
+ }, [options, value, name, colorScheme]);
15
+ return _jsx(Column, { ...props, style: { gap: '8px', ...style }, children: items });
16
+ }
17
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../src/components/RadioGroup.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;AAiDjC,MAAM,UAAU,UAAU,CAAI,EAC5B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,GAAG,kBAAkB,EAChC,SAAS,GAAG,gBAAgB,EAC5B,UAAU,EACV,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACW;IACnB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACrD,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,EAAC,WAAW,EAAW,WAAW,EAAE,WAAW,aACnF,gBACE,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC,EACzD,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAC7B,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,GACzB,EACD,WAAW,CAAC,CAAC,CAAC,KATuC,GAAG,CAUzC,CACnB,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAA;IACvC,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,13 @@
1
+ import { HTMLExtension } from '../types.js';
2
+ export type RatingValue = 1 | 2 | 3 | 4 | 5;
3
+ export interface BaseRatingProps {
4
+ value: RatingValue | undefined;
5
+ onChange: (value: RatingValue) => void;
6
+ /**
7
+ * The name of this input.
8
+ */
9
+ name?: string;
10
+ }
11
+ export type RatingProps = HTMLExtension<'div', BaseRatingProps, 'children' | 'onChange'>;
12
+ export declare const Rating: ({ value, onChange, name, ...props }: RatingProps) => import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=Rating.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rating.d.ts","sourceRoot":"","sources":["../../src/components/Rating.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE3C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,GAAG,UAAU,CAAC,CAAA;AAExF,eAAO,MAAM,MAAM,GAAI,qCAAqC,WAAW,4CAQtE,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CitricComponent } from './CitricComponent.js';
3
+ export const Rating = ({ value, onChange, name, ...props }) => (_jsxs(CitricComponent, { tag: "div", component: "rating", ...props, children: [_jsx("input", { type: "radio", value: "1", name: name, checked: value === 5, onChange: () => onChange(5) }), _jsx("input", { type: "radio", value: "2", name: name, checked: value === 4, onChange: () => onChange(4) }), _jsx("input", { type: "radio", value: "3", name: name, checked: value === 3, onChange: () => onChange(3) }), _jsx("input", { type: "radio", value: "4", name: name, checked: value === 2, onChange: () => onChange(2) }), _jsx("input", { type: "radio", value: "5", name: name, checked: value === 1, onChange: () => onChange(1) })] }));
4
+ //# sourceMappingURL=Rating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rating.js","sourceRoot":"","sources":["../../src/components/Rating.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAenD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE,CAAC,CAC1E,MAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,QAAQ,KAAK,KAAK,aACrD,gBAAO,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAI,EAC/F,gBAAO,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAI,EAC/F,gBAAO,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAI,EAC/F,gBAAO,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAI,EAC/F,gBAAO,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAI,IAC/E,CACnB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { SelectProps } from './types.js';
2
+ export declare function RichSelect<T>({ options, value, onChange, renderLabel, renderKey, required, disabled, loading, renderOption, renderHeader, searchable, maxHeight, style, className, onFocus, onBlur, showArrow, ...props }: SelectProps<T> & {
3
+ type?: 'rich';
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=RichSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichSelect.d.ts","sourceRoot":"","sources":["../../../src/components/Select/RichSelect.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAC5B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAAgC,EAChC,SAA4B,EAC5B,QAAe,EACf,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,KAAK,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2CA8KpC"}
@@ -0,0 +1,152 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { useTranslate } from '@stack-spot/portal-translate';
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
+ import { applyCSSVariable } from '../../utils/css.js';
6
+ import { defaultRenderKey, defaultRenderLabel } from '../../utils/options.js';
7
+ import { CitricComponent } from '../CitricComponent.js';
8
+ import { Input } from '../Input.js';
9
+ import { ProgressCircular } from '../ProgressCircular.js';
10
+ import { SimpleSelect } from './SimpleSelect.js';
11
+ export function RichSelect({ options, value, onChange, renderLabel = defaultRenderLabel, renderKey = defaultRenderKey, required = true, disabled, loading, renderOption, renderHeader, searchable, maxHeight, style, className, onFocus, onBlur, showArrow, ...props }) {
12
+ const [search, setSearch] = useState('');
13
+ const element = useRef(null);
14
+ const [open, setOpen] = useState(false);
15
+ const [focused, setFocused] = useState(false);
16
+ const t = useTranslate(dictionary);
17
+ const change = useCallback((option) => () => {
18
+ onChange?.(option);
19
+ setOpen(false);
20
+ }, []);
21
+ const renderedOptions = useMemo(() => {
22
+ const items = required ? [] : [_jsx("li", { className: "empty", onClick: change(undefined), children: t.empty }, "")];
23
+ options.forEach((o) => {
24
+ const key = renderKey(o);
25
+ const label = renderLabel(o);
26
+ if (!search.trim() || label.toLocaleLowerCase().includes(search.trim().toLocaleLowerCase())) {
27
+ items.push(_jsx("li", { onClick: change(o), children: renderOption?.(o) ?? label }, key));
28
+ }
29
+ });
30
+ return items;
31
+ }, [options, value, required, search]);
32
+ /* this runs whenever the selection panel is opened */
33
+ useEffect(() => {
34
+ if (open) {
35
+ setSearch('');
36
+ const selectionPanel = element.current?.querySelector('.selection-panel');
37
+ selectionPanel?.querySelector('ul')?.scrollTo({ top: 0 });
38
+ const getCurrent = () => selectionPanel?.querySelector('li.focused');
39
+ const scrollTo = (li) => {
40
+ const ul = li.closest('ul');
41
+ if (!ul)
42
+ return;
43
+ const { top: ulTop, height: ulHeight } = ul.getBoundingClientRect();
44
+ const { height: liHeight, top: liTop } = li.getBoundingClientRect();
45
+ const offset = liTop + ul.scrollTop - ulTop;
46
+ if ((ul.scrollTop + ulHeight < offset + liHeight) || ul.scrollTop > offset) {
47
+ ul.scrollTo({ top: offset });
48
+ }
49
+ };
50
+ /* keyboard and mouse controls */
51
+ const listenToMouse = (event) => {
52
+ if (!selectionPanel?.contains(event.target)) {
53
+ setOpen(false);
54
+ }
55
+ };
56
+ const listenToKeyboard = (event) => {
57
+ const isCharacter = event.key.length === 1;
58
+ if (['Escape', 'ArrowUp', 'ArrowDown', 'Enter'].includes(event.key) || (searchable && (isCharacter || event.key === 'Backspace'))) {
59
+ event.preventDefault();
60
+ event.stopPropagation();
61
+ }
62
+ if (event.key === 'Escape')
63
+ setOpen(false);
64
+ if (searchable) {
65
+ if (isCharacter)
66
+ setSearch(v => `${v}${event.key}`);
67
+ if (event.key === 'Backspace')
68
+ setSearch(v => v.substring(0, v.length - 1));
69
+ }
70
+ if (event.key === 'ArrowDown') {
71
+ const current = getCurrent();
72
+ const next = (current?.nextElementSibling ?? selectionPanel?.querySelector('li'));
73
+ if (next) {
74
+ current?.classList.remove('focused');
75
+ next.classList.add('focused');
76
+ scrollTo(next);
77
+ }
78
+ }
79
+ if (event.key === 'ArrowUp') {
80
+ const current = getCurrent();
81
+ const prev = (current?.previousElementSibling ?? selectionPanel?.querySelector('li:last-child'));
82
+ if (prev) {
83
+ current?.classList.remove('focused');
84
+ prev.classList.add('focused');
85
+ scrollTo(prev);
86
+ }
87
+ }
88
+ if (event.key === 'Enter') {
89
+ setTimeout(() => getCurrent()?.click(), 0);
90
+ }
91
+ };
92
+ document.addEventListener('click', listenToMouse);
93
+ document.addEventListener('keydown', listenToKeyboard);
94
+ return () => {
95
+ document.removeEventListener('click', listenToMouse);
96
+ document.removeEventListener('keydown', listenToKeyboard);
97
+ getCurrent()?.classList.remove('focused');
98
+ };
99
+ }
100
+ }, [open]);
101
+ /* this runs whenever the select is focused */
102
+ useEffect(() => {
103
+ if (focused) {
104
+ const listenToMouse = (event) => {
105
+ if (!element.current?.contains(event.target)) {
106
+ setFocused(false);
107
+ }
108
+ };
109
+ const listenToKeyboard = (event) => {
110
+ if (['Enter', 'ArrowDown', 'ArrowUp'].includes(event.key)) {
111
+ event.preventDefault();
112
+ if (!element.current?.classList.contains('open'))
113
+ setOpen(true);
114
+ }
115
+ if (event.key === 'Tab') {
116
+ setFocused(false);
117
+ if (element.current?.classList.contains('open'))
118
+ setOpen(false);
119
+ }
120
+ };
121
+ document.addEventListener('click', listenToMouse);
122
+ document.addEventListener('keydown', listenToKeyboard);
123
+ return () => {
124
+ document.removeEventListener('click', listenToMouse);
125
+ document.removeEventListener('keydown', listenToKeyboard);
126
+ };
127
+ }
128
+ }, [focused]);
129
+ useEffect(() => {
130
+ if (disabled) {
131
+ setOpen(false);
132
+ setFocused(false);
133
+ }
134
+ }, [disabled]);
135
+ return (_jsxs(CitricComponent, { tag: "div", component: "rich-select", style: maxHeight ? applyCSSVariable(style, 'max-height', `${maxHeight}px`) : style, className: listToClass([className, showArrow === false && 'hide-arrow', open && 'open', focused && 'focused']), ref: element, "aria-busy": loading, ...props, children: [_jsx(SimpleSelect, { options: options, value: value, renderLabel: renderLabel, renderKey: renderKey, required: required, disabled: disabled, onChange: onChange, onFocus: onFocus, onBlur: onBlur, wrap: false }), _jsxs("header", { onClick: (e) => {
136
+ if (disabled)
137
+ return;
138
+ if (!open)
139
+ e.stopPropagation();
140
+ setFocused(true);
141
+ setOpen(true);
142
+ }, "aria-hidden": true, children: [renderHeader?.(value) ?? (value ? (renderOption?.(value) ?? renderLabel(value)) : _jsx("span", {})), loading && _jsx(ProgressCircular, { size: "xs", className: "loader" })] }), _jsxs("div", { className: "selection-panel", "aria-hidden": true, children: [searchable && _jsx("div", { className: "search-bar", children: _jsxs("div", { "data-citric": "field-group", className: "auto", children: [_jsx("i", { "data-citric": "icon-box", className: "citric-icon outline Search" }), _jsx(Input, { type: "search", value: search, onChange: setSearch, tabIndex: -1 })] }) }), _jsx("ul", { children: renderedOptions })] })] }));
143
+ }
144
+ const dictionary = {
145
+ en: {
146
+ empty: 'Empty',
147
+ },
148
+ pt: {
149
+ empty: 'Vazio',
150
+ },
151
+ };
152
+ //# sourceMappingURL=RichSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichSelect.js","sourceRoot":"","sources":["../../../src/components/Select/RichSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,MAAM,UAAU,UAAU,CAAI,EAC5B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAAW,GAAG,kBAAkB,EAChC,SAAS,GAAG,gBAAgB,EAC5B,QAAQ,GAAG,IAAI,EAC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gBACf,CAAC,kCAGA,YAAY,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAa,CAAC,EAChG,OAAO,IAAI,KAAC,gBAAgB,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,QAAQ,GAAG,IACtD,EACT,eAAK,SAAS,EAAC,iBAAiB,kCAC7B,UAAU,IAAI,cAAK,SAAS,EAAC,YAAY,YACxC,8BAAiB,aAAa,EAAC,SAAS,EAAC,MAAM,aAC7C,2BAAe,UAAU,EAAC,SAAS,EAAC,4BAA4B,GAAK,EACrE,KAAC,KAAK,IAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAI,IACrE,GACF,EACN,uBAAK,eAAe,GAAM,IACtB,IACU,CACnB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;KACf;CACF,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { SelectProps } from './types.js';
2
+ export declare function SimpleSelect<T>({ options, value, onChange, renderLabel, renderKey, required, loading, disabled, onBlur, onFocus, wrap, ...props }: SelectProps<T> & {
3
+ wrap?: boolean;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=SimpleSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleSelect.d.ts","sourceRoot":"","sources":["../../../src/components/Select/SimpleSelect.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAAgC,EAChC,SAA4B,EAC5B,QAAe,EACf,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,2CA6CrC"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isNil } from 'lodash';
3
+ import { useCallback, useMemo } from 'react';
4
+ import { defaultRenderKey, defaultRenderLabel } from '../../utils/options.js';
5
+ import { CitricComponent } from '../CitricComponent.js';
6
+ import { ProgressCircular } from '../ProgressCircular.js';
7
+ export function SimpleSelect({ options, value, onChange, renderLabel = defaultRenderLabel, renderKey = defaultRenderKey, required = true, loading, disabled, onBlur, onFocus, wrap, ...props }) {
8
+ const handleChange = useCallback((e) => {
9
+ const selectedIndex = e.target.options.selectedIndex + (required ? 0 : 1);
10
+ onChange?.(options[selectedIndex]);
11
+ }, [options]);
12
+ const renderedOptions = useMemo(() => {
13
+ const valueKey = value ? renderKey(value) : undefined;
14
+ const items = (!value || !required) ? [_jsx("option", {}, "")] : [];
15
+ options.forEach((o) => {
16
+ const key = renderKey(o);
17
+ items.push(_jsx("option", { value: key, selected: o === value || (!isNil(key) && key === valueKey), children: renderLabel(o) }, key));
18
+ });
19
+ return items;
20
+ }, [options, value, required]);
21
+ const children = _jsxs(_Fragment, { children: [required ? undefined : _jsx("option", {}), renderedOptions] });
22
+ return wrap === false ? (_jsx(CitricComponent, { required: required, onChange: handleChange, disabled: disabled || loading, tag: "select", component: "select", onFocus: onFocus, onBlur: onBlur, children: children })) : (_jsxs(CitricComponent, { tag: "div", component: "select", "aria-busy": loading, ...props, children: [_jsx("select", { required: required, onChange: handleChange, disabled: disabled || loading, onFocus: onFocus, onBlur: onBlur, children: children }), loading && _jsx(ProgressCircular, { className: "loader", size: "xs" })] }));
23
+ }
24
+ //# source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B,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { SelectProps } from './types.js';
2
+ export type * from './types.js';
3
+ export declare function Select<T>(props: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,mBAAmB,SAAS,CAAA;AAE5B,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,2CAE9C"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RichSelect } from './RichSelect.js';
3
+ import { SimpleSelect } from './SimpleSelect.js';
4
+ export function Select(props) {
5
+ return props.type === 'simple' ? _jsx(SimpleSelect, { ...props }) : _jsx(RichSelect, { ...props });
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAI7C,MAAM,UAAU,MAAM,CAAI,KAAqB;IAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,YAAY,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,UAAU,OAAK,KAAK,GAAI,CAAA;AAC1F,CAAC"}