@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,106 @@
1
+ import { HTMLExtension } from '../types.js';
2
+ export interface BaseTableProps {
3
+ /**
4
+ * The overall table's appearance. Includes a default configuration for every other styling related prop.
5
+ *
6
+ * @default 'spaced'
7
+ */
8
+ appearance?: 'stripped' | 'spaced';
9
+ /**
10
+ * Whether or not to color each row a different color. Only valid when appearance is "spaced".
11
+ *
12
+ * @default false
13
+ */
14
+ stripped?: boolean;
15
+ /**
16
+ * If true, there's no spacing between rows. Only valid when appearance is "spaced".
17
+ *
18
+ * @default false
19
+ */
20
+ compressed?: boolean;
21
+ /**
22
+ * Shows an outer border for the whole table.
23
+ *
24
+ * @default "true if appearance is 'stripped', false otherwise"
25
+ */
26
+ showBorders?: boolean;
27
+ /**
28
+ * Shows borders in each of the rows.
29
+ *
30
+ * @default false
31
+ */
32
+ showRowBorders?: boolean;
33
+ /**
34
+ * Shows borders in the header.
35
+ *
36
+ * @default "false if appearance is 'stripped', true otherwise"
37
+ */
38
+ showHeaderBorders?: boolean;
39
+ /**
40
+ * Whether or not the table borders are rounded.
41
+ *
42
+ * @default true
43
+ */
44
+ rounded?: boolean;
45
+ /**
46
+ * Whether or not each row in the table have rounded borders.
47
+ *
48
+ * @default "false if appearance is 'stripped', true otherwise"
49
+ */
50
+ roundedRows?: boolean;
51
+ /**
52
+ * If true, all headers are uppercase.
53
+ *
54
+ * @default false
55
+ */
56
+ uppercaseHeader?: boolean;
57
+ /**
58
+ * Allows rows to act as accordions. To create an accordion row, use `<tbody>` to group two `<tr>` elements, where the first is the actual
59
+ * row and the second is the collapsible content of the row. The row with the collapsible content must be defined as `<Tr accordion>`.
60
+ *
61
+ * @default false
62
+ */
63
+ accordionRows?: boolean;
64
+ }
65
+ export type SortingDirection = 'asc' | 'desc';
66
+ interface BaseThProps {
67
+ /**
68
+ * Which is the current direction of the sorting? Only relevant if 'onSort' is set.
69
+ *
70
+ * @default 'desc'
71
+ */
72
+ direction?: SortingDirection;
73
+ /**
74
+ * What to do when the header is clicked (sorting).
75
+ */
76
+ onSort?: (value: SortingDirection | undefined) => void;
77
+ }
78
+ interface BaseTrProps {
79
+ /**
80
+ * True if this table is an accordion, false otherwise.
81
+ *
82
+ * @default false
83
+ */
84
+ accordion?: boolean;
85
+ /**
86
+ * If the next row is an accordion, what should make it expand or contract? A click on a button in the last column or a click anywhere in
87
+ * the row?
88
+ *
89
+ * @default 'button'
90
+ */
91
+ accordionTrigger?: 'button' | 'row';
92
+ /**
93
+ * Sets the maximum height of this accordion. Only valid if `accordion` is true.
94
+ *
95
+ * @default '200px'
96
+ */
97
+ accordionMaxHeight?: string;
98
+ }
99
+ export type TableProps = HTMLExtension<'table', BaseTableProps>;
100
+ export type ThProps = HTMLExtension<'th', BaseThProps>;
101
+ export type TrProps = HTMLExtension<'tr', BaseTrProps>;
102
+ export declare const Table: ({ appearance, stripped, compressed, showBorders, showHeaderBorders, showRowBorders, rounded, roundedRows, uppercaseHeader, className, children, accordionRows, ...props }: TableProps) => import("react/jsx-runtime").JSX.Element;
103
+ export declare const Th: ({ direction, onSort, children, className, ...props }: ThProps) => import("react/jsx-runtime").JSX.Element;
104
+ export declare const Tr: ({ accordion, accordionTrigger, accordionMaxHeight, children, className, style, onClick, ...props }: TrProps) => import("react/jsx-runtime").JSX.Element;
105
+ export {};
106
+ //# sourceMappingURL=Table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAIxC,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAA;AAE7C,UAAU,WAAW;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,KAAK,IAAI,CAAC;CACxD;AAED,UAAU,WAAW;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACpC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;AAC/D,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AACtD,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AAEtD,eAAO,MAAM,KAAK,GAAI,2KAGnB,UAAU,4CAkBZ,CAAA;AAED,eAAO,MAAM,EAAE,GAAI,sDAAsD,OAAO,4CA0B/E,CAAA;AAED,eAAO,MAAM,EAAE,GAAI,oGAAoG,OAAO,4CA0C7H,CAAA"}
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { useTranslate } from '@stack-spot/portal-translate';
4
+ import { useEffect, useRef } from 'react';
5
+ import { applyCSSVariable } from '../utils/css.js';
6
+ import { CitricComponent } from './CitricComponent.js';
7
+ export const Table = ({ appearance, stripped, compressed, showBorders, showHeaderBorders, showRowBorders, rounded, roundedRows, uppercaseHeader, className, children, accordionRows, ...props }) => {
8
+ const classes = listToClass([
9
+ className,
10
+ stripped && 'stripped',
11
+ compressed && 'compressed',
12
+ showBorders && 'bordered',
13
+ showHeaderBorders === false && 'borderless-header',
14
+ showRowBorders && 'bordered-rows',
15
+ rounded === false && 'square',
16
+ roundedRows === false && 'square-rows',
17
+ uppercaseHeader && 'uppercase-header',
18
+ accordionRows && 'accordion-rows',
19
+ ]);
20
+ return (_jsx(CitricComponent, { tag: "table", component: "table", "data-appearance": appearance, className: classes, ...props, children: children }));
21
+ };
22
+ export const Th = ({ direction, onSort, children, className, ...props }) => {
23
+ const t = useTranslate(dictionary);
24
+ let tip;
25
+ const label = typeof children === 'string' ? children : undefined;
26
+ if (onSort && !direction)
27
+ tip = label ? `${label}. ${t.sortAscending}` : t.sortAscending;
28
+ if (onSort && direction === 'asc')
29
+ tip = label ? `${label}. ${t.sortDescending}` : t.sortDescending;
30
+ if (onSort && direction === 'desc')
31
+ tip = label ? `${label}. ${t.sortNone}` : t.sortNone;
32
+ function handleSort() {
33
+ if (!direction)
34
+ onSort?.('asc');
35
+ else if (direction === 'asc')
36
+ onSort?.('desc');
37
+ else
38
+ onSort?.(undefined);
39
+ }
40
+ return (_jsx("th", { className: listToClass([onSort && 'sortable', direction, className]), onClick: onSort ? handleSort : undefined, onKeyDown: onSort ? (e => e.key === 'Enter' && handleSort()) : undefined, "aria-label": tip, tabIndex: onSort ? 0 : undefined, ...props, children: children }));
41
+ };
42
+ export const Tr = ({ accordion, accordionTrigger, accordionMaxHeight, children, className, style, onClick, ...props }) => {
43
+ const ref = useRef(null);
44
+ useEffect(() => {
45
+ if (!accordion)
46
+ return;
47
+ const checkbox = ref.current?.closest('tbody')?.querySelector('td:last-child input[aria-controls]');
48
+ if (checkbox instanceof HTMLElement) {
49
+ const onChange = (e) => {
50
+ if (!ref.current || !(e.target instanceof HTMLInputElement))
51
+ return;
52
+ if (e.target.checked) {
53
+ ref.current.setAttribute('aria-hidden', 'false');
54
+ ref.current.removeAttribute('inert');
55
+ }
56
+ else {
57
+ ref.current.setAttribute('aria-hidden', 'true');
58
+ ref.current.setAttribute('inert', 'true');
59
+ }
60
+ };
61
+ checkbox.addEventListener('change', onChange);
62
+ return () => checkbox.removeEventListener('change', onChange);
63
+ }
64
+ }, [ref.current]);
65
+ return (_jsx("tr", { ref: ref, ...props, className: listToClass([className, accordion && 'accordion', accordionTrigger === 'row' && 'clickable']), onClick: accordionTrigger === 'row'
66
+ ? (e) => {
67
+ const checkbox = ref.current?.querySelector('td:last-child input[aria-controls]');
68
+ if (checkbox instanceof HTMLInputElement && e.target !== checkbox)
69
+ checkbox.click();
70
+ onClick?.(e);
71
+ }
72
+ : onClick, style: applyCSSVariable(style, 'max-height', accordionMaxHeight), "aria-hidden": accordion, ...(accordion ? { inert: 'true' } : {}), children: children }));
73
+ };
74
+ const dictionary = {
75
+ en: {
76
+ sortAscending: 'Click to sort in ascending order.',
77
+ sortDescending: 'Click to sort in descending order.',
78
+ sortNone: 'Click to remove sorting.',
79
+ },
80
+ pt: {
81
+ sortAscending: 'Clique para ordenar em ordem crescente.',
82
+ sortDescending: 'Clique para ordenar em ordem decrescente.',
83
+ sortNone: 'Clique para remover a ordenação.',
84
+ },
85
+ };
86
+ //# sourceMappingURL=Table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AA2GnD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EACpB,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAClI,QAAQ,EAAE,aAAa,EAAE,GAAG,KAAK,EACtB,EAAE,EAAE;IACf,MAAM,OAAO,GAAG,WAAW,CAAC;QAC1B,SAAS;QACT,QAAQ,IAAI,UAAU;QACtB,UAAU,IAAI,YAAY;QAC1B,WAAW,IAAI,UAAU;QACzB,iBAAiB,KAAK,KAAK,IAAI,mBAAmB;QAClD,cAAc,IAAI,eAAe;QACjC,OAAO,KAAK,KAAK,IAAI,QAAQ;QAC7B,WAAW,KAAK,KAAK,IAAI,aAAa;QACtC,eAAe,IAAI,kBAAkB;QACrC,aAAa,I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AG;IACjB,EAAE,EAAE;QACF,aAAa,EAAE,mCAAmC;QAClD,cAAc,EAAE,oCAAoC;QACpD,QAAQ,EAAE,0BAA0B;KACrC;IACD,EAAE,EAAE;QACF,aAAa,EAAE,yCAAyC;QACxD,cAAc,EAAE,2CAA2C;QAC3D,QAAQ,EAAE,kCAAkC;KAC7C;CACmB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { ValueController } from '../../utils/ValueController.js';
2
+ export declare class TabController<Key extends string> extends ValueController<Key> {
3
+ private tabOrder;
4
+ constructor(tabOrder: Key[], value: Key);
5
+ private getCurrentIndex;
6
+ hasNext(): boolean;
7
+ hasPrevious(): boolean;
8
+ next(): boolean;
9
+ previous(): boolean;
10
+ }
11
+ //# sourceMappingURL=TabController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabController.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/TabController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,qBAAa,aAAa,CAAC,GAAG,SAAS,MAAM,CAAE,SAAQ,eAAe,CAAC,GAAG,CAAC;IACzE,OAAO,CAAC,QAAQ,CAAO;gBAEX,QAAQ,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG;IAKvC,OAAO,CAAC,eAAe;IAIvB,OAAO,IAAI,OAAO;IAKlB,WAAW,IAAI,OAAO;IAKtB,IAAI,IAAI,OAAO;IAQf,QAAQ,IAAI,OAAO;CAOpB"}
@@ -0,0 +1,39 @@
1
+ import { ValueController } from '../../utils/ValueController.js';
2
+ export class TabController extends ValueController {
3
+ constructor(tabOrder, value) {
4
+ super(value);
5
+ Object.defineProperty(this, "tabOrder", {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value: void 0
10
+ });
11
+ this.tabOrder = tabOrder;
12
+ }
13
+ getCurrentIndex() {
14
+ return this.tabOrder.findIndex(t => t === this.value);
15
+ }
16
+ hasNext() {
17
+ const current = this.getCurrentIndex();
18
+ return current > -1 && current + 1 < this.tabOrder.length;
19
+ }
20
+ hasPrevious() {
21
+ const current = this.getCurrentIndex();
22
+ return current > -1 && current - 1 >= 0;
23
+ }
24
+ next() {
25
+ if (this.hasNext()) {
26
+ this.setValue(this.tabOrder[this.getCurrentIndex() + 1]);
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ previous() {
32
+ if (this.hasPrevious()) {
33
+ this.setValue(this.tabOrder[this.getCurrentIndex() - 1]);
34
+ return true;
35
+ }
36
+ return false;
37
+ }
38
+ }
39
+ //# sourceMappingURL=TabController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabController.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,MAAM,OAAO,aAAkC,SAAQ,eAAoB;IAGzE,YAAY,QAAe,EAAE,KAAU;QACrC,KAAK,CAAC,KAAK,CAAC,CAAA;QAHN;;;;;WAAe;QAIrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEO,eAAe;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAA;IACvD,CAAC;IAED,OAAO;QACL,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QACtC,OAAO,OAAO,GAAG,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAA;IAC3D,CAAC;IAED,WAAW;QACT,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QACtC,OAAO,OAAO,GAAG,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;IACzC,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YACxD,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YACxD,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { TabController } from './TabController.js';
2
+ import { TabsProps } from './types.js';
3
+ export declare function Tabs<Key extends string>({ tabs, value, onChange, controller: ctrl, ...props }: TabsProps<Key>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function useTabController<Key extends string = string>(): TabController<Key> | undefined;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKnC,wBAAgB,IAAI,CAAC,GAAG,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,2CAsC7G;AAED,wBAAgB,gBAAgB,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,KAAK,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAE9F"}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslate } from '@stack-spot/portal-translate';
3
+ import { createContext, Suspense, useContext, useEffect, useMemo, useState } from 'react';
4
+ import { CitricComponent } from '../CitricComponent.js';
5
+ import { ErrorBoundary } from '../ErrorBoundary.js';
6
+ import { ProgressCircular } from '../ProgressCircular.js';
7
+ import { Center } from '../layout.js';
8
+ import { TabController } from './TabController.js';
9
+ import { findSelectedIndex } from './utils.js';
10
+ const ctx = createContext(undefined);
11
+ export function Tabs({ tabs, value, onChange, controller: ctrl, ...props }) {
12
+ const controller = useMemo(() => ctrl ?? new TabController(tabs.map(t => t.key), value || tabs[0]?.key), []);
13
+ const t = useTranslate(dictionary);
14
+ const [selectedIndex, setSelectedIndex] = useState(findSelectedIndex(tabs, controller.getValue()));
15
+ useEffect(() => {
16
+ if (value)
17
+ controller.setValue(value);
18
+ }, [value]);
19
+ useEffect(() => controller.onChange((v) => {
20
+ setSelectedIndex(findSelectedIndex(tabs, v));
21
+ onChange?.(v);
22
+ }), [tabs]);
23
+ const nav = useMemo(() => tabs.map(({ key, label, disabled }, index) => (_jsxs("label", { children: [_jsx("input", { type: "radio", role: "tab", checked: index === selectedIndex, onChange: () => controller.setValue(key), disabled: disabled }), label || key] }, key))), [tabs, selectedIndex]);
24
+ return (_jsx(ctx.Provider, { value: controller, children: _jsxs(CitricComponent, { tag: "div", component: "tabs", ...props, children: [_jsx("nav", { children: nav }), _jsx("section", { children: _jsx(ErrorBoundary, { message: t.error, children: _jsx(Suspense, { fallback: _jsx(Center, { style: { padding: '20px' }, children: _jsx(ProgressCircular, {}) }), children: selectedIndex === -1 ? null : tabs[selectedIndex]?.content }) }, selectedIndex) })] }) }));
25
+ }
26
+ export function useTabController() {
27
+ return useContext(ctx);
28
+ }
29
+ const dictionary = {
30
+ en: {
31
+ error: 'Error while loading the tab.',
32
+ },
33
+ pt: {
34
+ error: 'Ocorreu um erro ao carregar a aba.',
35
+ },
36
+ };
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","s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B,GACR,IACM,GACL,CAChB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,8BAA8B;KACtC;IACD,EAAE,EAAE;QACF,KAAK,EAAE,oCAAoC;KAC5C;CACmB,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { HTMLExtension, WithColorPalette, WithColorScheme } from '../../types.js';
2
+ import { TabController } from './TabController.js';
3
+ export interface Tab<Key extends string> {
4
+ /**
5
+ * A unique identifier for the tab.
6
+ */
7
+ key: Key;
8
+ /**
9
+ * The tab's label. Will be the "key" if not provided.
10
+ */
11
+ label?: string;
12
+ /**
13
+ * The tab's content. This can be a suspended component.
14
+ *
15
+ * Attention: consider using React's lazy loading to render the tab view.
16
+ */
17
+ content: React.ReactNode;
18
+ /**
19
+ * Whether or not this tab is disabled.
20
+ *
21
+ * @default false
22
+ */
23
+ disabled?: boolean;
24
+ }
25
+ export interface BaseTabsProps<Key extends string> extends WithColorScheme, WithColorPalette {
26
+ /**
27
+ * The tabs to render.
28
+ */
29
+ tabs: Tab<Key>[];
30
+ /**
31
+ * The key of the current tab. Use this only if you intend to control the tabs from the outside.
32
+ */
33
+ value?: Key;
34
+ /**
35
+ * What to do when the tab changes. Use this only if you intend to control the tabs from the outside.
36
+ *
37
+ * @param key the key of the selected tab.
38
+ */
39
+ onChange?: (key: Key) => void;
40
+ /**
41
+ * A tab-controller, useful if you want to control the tabs outside the component context.
42
+ */
43
+ controller?: TabController<Key>;
44
+ }
45
+ export type TabsProps<Key extends string> = HTMLExtension<'div', BaseTabsProps<Key>, 'children' | 'value' | 'onChange'>;
46
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,WAAW,GAAG,CAAC,GAAG,SAAS,MAAM;IACrC;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IACT;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa,CAAC,GAAG,SAAS,MAAM,CAAE,SAAQ,eAAe,EAAE,gBAAgB;IAC1F;;OAEG;IACH,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,MAAM,IAAI,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Tabs/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { Tab } from './types.js';
2
+ export declare function findSelectedIndex<Key extends string>(tabs: Tab<Key>[], selectedTabKey: Key): number;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAE7B,wBAAgB,iBAAiB,CAAC,GAAG,SAAS,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,UAG1F"}
@@ -0,0 +1,5 @@
1
+ export function findSelectedIndex(tabs, selectedTabKey) {
2
+ const index = tabs.findIndex(t => t.key === selectedTabKey);
3
+ return index === -1 ? 0 : index;
4
+ }
5
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Tabs/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAqB,IAAgB,EAAE,cAAmB;IACzF,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,cAAc,CAAC,CAAA;IAC3D,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AACjC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { HTMLExtension, TextAppearance, WithColor } from '../types.js';
2
+ type SupportedTags = 'span' | 'small' | 'p' | `h${1 | 2 | 3 | 4 | 5 | 6}` | 'pre';
3
+ export interface BaseTextProps<T extends SupportedTags = SupportedTags> extends WithColor {
4
+ /**
5
+ * If "tag" is not defined, it will be based on the value of "appearance".
6
+ * If neither "appearance" or "tag" are defined, the tag will be "p".
7
+ */
8
+ tag?: T;
9
+ /**
10
+ * If "appearance" is not defined, it will be based on the value of "tag".
11
+ * If neither "appearance" or "tag" are defined, the appearance will be inherited from the parent HTML element.
12
+ */
13
+ appearance?: TextAppearance;
14
+ /**
15
+ * Add default margins to the text.
16
+ *
17
+ * @default false
18
+ */
19
+ showMargins?: boolean;
20
+ }
21
+ export type TextProps<T extends SupportedTags> = HTMLExtension<T, BaseTextProps<T>>;
22
+ export declare function Text<T extends SupportedTags>({ tag, appearance, color, showMargins, style, className, children, ...props }: TextProps<T>): import("react").DetailedReactHTMLElement<{
23
+ className: string;
24
+ style: import("react").CSSProperties | undefined;
25
+ } & Omit<TextProps<T>, "style" | "color" | "appearance" | "tag" | "className" | "children" | "showMargins">, HTMLSpanElement>;
26
+ export {};
27
+ //# sourceMappingURL=Text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGnE,KAAK,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,EAAE,GAAG,KAAK,CAAA;AAEvE,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,CAAE,SAAQ,SAAS;IACvF;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,aAAa,IAAI,aAAa,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AAoCnF,wBAAgB,IAAI,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;;;8HAYxI"}
@@ -0,0 +1,45 @@
1
+ import { listToClass } from '@stack-spot/portal-theme';
2
+ import { createElement } from 'react';
3
+ import { applyColor, applyTextAppearance } from '../utils/css.js';
4
+ const tagToAppearance = {
5
+ h1: 'h1',
6
+ h2: 'h2',
7
+ h3: 'h3',
8
+ h4: 'h4',
9
+ h5: 'h5',
10
+ h6: 'h6',
11
+ span: undefined,
12
+ small: 'microtext1',
13
+ p: 'body2',
14
+ pre: 'code2',
15
+ };
16
+ const appearanceToTag = {
17
+ h1: 'h1',
18
+ h2: 'h2',
19
+ h3: 'h3',
20
+ h4: 'h4',
21
+ h5: 'h5',
22
+ h6: 'h6',
23
+ body1: 'p',
24
+ body2: 'p',
25
+ code1: 'pre',
26
+ code2: 'pre',
27
+ display1: 'h1',
28
+ microtext1: 'small',
29
+ overheader1: 'p',
30
+ overheader2: 'p',
31
+ subtitle1: 'p',
32
+ subtitle2: 'p',
33
+ subtitle3: 'p',
34
+ subtitle4: 'p',
35
+ };
36
+ export function Text({ tag, appearance, color, showMargins, style, className, children, ...props }) {
37
+ const renderedTag = tag || appearanceToTag[appearance || 'body2'];
38
+ const renderedAppearance = appearance || (tag ? tagToAppearance[tag] : undefined);
39
+ return createElement(renderedTag, {
40
+ className: applyTextAppearance(listToClass([className, showMargins && 'text-with-margins']), renderedAppearance),
41
+ style: applyColor(style, color),
42
+ ...props,
43
+ }, children);
44
+ }
45
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAyB9D,MAAM,eAAe,GAAsD;IACzE,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,YAAY;IACnB,CAAC,EAAE,OAAO;IACV,GAAG,EAAE,OAAO;CACb,CAAA;AAED,MAAM,eAAe,GAA0C;IAC7D,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,GAAG;IAChB,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;CACf,CAAA;AAED,MAAM,UAAU,IAAI,CAA0B,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB;IACvI,MAAM,WAAW,GAAG,GAAG,IAAI,eAAe,CAAC,UAAU,IAAI,OAAO,CAAC,CAAA;IACjE,MAAM,kBAAkB,GAAG,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IACjF,OAAO,aAAa,CAClB,WAAW,EACX;QACE,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC,SAAS,EAAE,WAAW,IAAI,mBAAmB,CAAC,CAAC,EAAE,kBAAkB,CAAC;QAChH,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;QAC/B,GAAG,KAAK;KACT,EACD,QAAQ,CACT,CAAA;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { HTMLExtension, WithColorScheme } from '../types.js';
2
+ export interface BaseTextareaProps extends WithColorScheme {
3
+ value?: string;
4
+ onChange?: (value: string) => void;
5
+ }
6
+ export type TextareaProps = HTMLExtension<'textarea', BaseTextareaProps, 'onChange'>;
7
+ export declare const Textarea: ({ value, onChange, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=Textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGzD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAA;AAEpF,eAAO,MAAM,QAAQ,GAAI,+BAA+B,aAAa,4CACwD,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CitricComponent } from './CitricComponent.js';
3
+ export const Textarea = ({ value, onChange, ...props }) => _jsx(CitricComponent, { tag: "textarea", component: "textarea", value: value, onChange: e => onChange?.(e.target.value), ...props });
4
+ //# sourceMappingURL=Textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AASnD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE,CACvE,KAAC,eAAe,IAAC,GAAG,EAAC,UAAU,EAAC,SAAS,EAAC,UAAU,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAM,KAAK,GAAI,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types.js';
2
+ import { BaseOverlayProps } from './Overlay/types.js';
3
+ export interface BaseTooltipProps extends Omit<BaseOverlayProps<'div'>, 'tag' | 'onRenderChild' | 'reference'>, WithColorPalette, WithColorScheme {
4
+ /**
5
+ * Whether or not to show the tooltip's arrow.
6
+ *
7
+ * @default true
8
+ */
9
+ showArrow?: boolean;
10
+ /**
11
+ * The unique id of the HTML element to be created to show the tooltip. If not provided, a random number will be used.
12
+ */
13
+ tooltipId?: string;
14
+ /**
15
+ * Makes the tooltip text compact, centering it better when it's a single line.
16
+ *
17
+ * Effectively, it makes the line height equals to 1 and applies a slightly larger padding.
18
+ *
19
+ * @default true
20
+ */
21
+ compact?: boolean;
22
+ }
23
+ export type TooltipProps = HTMLExtension<'div', BaseTooltipProps, 'children' | 'content'>;
24
+ export declare const Tooltip: ({ tooltipId, children, showArrow, compact, attributes, colorScheme, colorPalette, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
25
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,WAAW,gBAAiB,SAChC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe,GAAG,WAAW,CAAC,EAAE,gBAAgB,EAAE,eAAe;IACvG;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAEzF,eAAO,MAAM,OAAO,GAClB,8FAA4G,YAAY,4CAqBzH,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { useRef } from 'react';
4
+ import { Overlay } from './Overlay/index.js';
5
+ export const Tooltip = ({ tooltipId, children, showArrow = true, compact = true, attributes, colorScheme, colorPalette, ...props }) => {
6
+ const id = useRef(tooltipId || `${Math.random()}`);
7
+ return (_jsx(Overlay, { attributes: {
8
+ className: listToClass([attributes?.className, showArrow && 'with-arrow', compact && 'compact']),
9
+ style: { margin: '6px', ...attributes?.style },
10
+ role: 'tooltip',
11
+ id: id.current,
12
+ 'data-citric': 'tooltip',
13
+ 'data-color-scheme': colorScheme,
14
+ 'data-color-palette': colorPalette,
15
+ ...attributes,
16
+ }, onRenderChild: e => e.setAttribute('aria-describedby', id.current), ...props, children: children }));
17
+ };
18
+ //# sourceMappingURL=Tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA2BnC,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,KAAK,EAAgB,EACxH,EAAE;IACF,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAClD,OAAO,CACL,KAAC,OAAO,IACN,UAAU,EAAE;YACV,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,IAAI,YAAY,EAAE,OAAO,IAAI,SAAS,CAAC,CAAC;YAChG,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE;YAC9C,IAAI,EAAE,SAAS;YACf,EAAE,EAAE,EAAE,CAAC,OAAO;YACd,aAAa,EAAE,SAAS;YACxB,mBAAmB,EAAE,WAAW;YAChC,oBAAoB,EAAE,YAAY;YAClC,GAAG,UAAU;SACd,EACD,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAC9D,KAAK,YAER,QAAQ,GACD,CACX,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { HTMLExtension, WithStyleShortcuts } from '../types.js';
2
+ export declare const layout: {
3
+ center: string;
4
+ row: string;
5
+ column: string;
6
+ };
7
+ export interface BaseLayoutProps<T extends keyof React.JSX.IntrinsicElements> extends WithStyleShortcuts {
8
+ /**
9
+ * HTML tag to render.
10
+ *
11
+ * @default 'div'
12
+ */
13
+ tag?: T;
14
+ }
15
+ export interface BaseRowProps<T extends keyof React.JSX.IntrinsicElements> extends BaseLayoutProps<T> {
16
+ /**
17
+ * Whether or not to center items horizontally.
18
+ *
19
+ * @default true
20
+ */
21
+ center?: boolean;
22
+ }
23
+ export interface BaseColumnProps<T extends keyof React.JSX.IntrinsicElements> extends BaseLayoutProps<T> {
24
+ /**
25
+ * Whether or not to center items vertically.
26
+ *
27
+ * @default false
28
+ */
29
+ center?: boolean;
30
+ }
31
+ export type CenterProps<T extends keyof React.JSX.IntrinsicElements> = HTMLExtension<T, BaseLayoutProps<T>>;
32
+ export type RowProps<T extends keyof React.JSX.IntrinsicElements> = HTMLExtension<T, BaseRowProps<T>>;
33
+ export type ColumnProps<T extends keyof React.JSX.IntrinsicElements> = HTMLExtension<T, BaseColumnProps<T>>;
34
+ export declare function Center<T extends keyof React.JSX.IntrinsicElements = 'div'>({ tag, className, ...props }: CenterProps<T>): import("react").ReactElement<{
35
+ style: Partial<import("react").CSSProperties>;
36
+ className: string;
37
+ }, string | import("react").JSXElementConstructor<any>>;
38
+ export declare function Row<T extends keyof React.JSX.IntrinsicElements = 'div'>({ tag, className, center, ...props }: RowProps<T>): import("react").ReactElement<{
39
+ style: Partial<import("react").CSSProperties>;
40
+ className: string;
41
+ }, string | import("react").JSXElementConstructor<any>>;
42
+ export declare function Column<T extends keyof React.JSX.IntrinsicElements = 'div'>({ tag, className, center, ...props }: ColumnProps<T>): import("react").ReactElement<{
43
+ style: Partial<import("react").CSSProperties>;
44
+ className: string;
45
+ }, string | import("react").JSXElementConstructor<any>>;
46
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/components/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAG5D,eAAO,MAAM,MAAM;;;;CAIlB,CAAA;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAE,SAAQ,kBAAkB;IACtG;;;;OAIG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;CACT;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACnG;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC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