@stack-spot/citric-react 0.21.0 → 0.23.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 (261) hide show
  1. package/dist/citric.css +30 -4
  2. package/dist/components/Accordion.d.ts +34 -0
  3. package/dist/components/Accordion.d.ts.map +1 -1
  4. package/dist/components/Accordion.js +34 -0
  5. package/dist/components/Accordion.js.map +1 -1
  6. package/dist/components/Alert.d.ts +8 -0
  7. package/dist/components/Alert.d.ts.map +1 -1
  8. package/dist/components/Alert.js +8 -0
  9. package/dist/components/Alert.js.map +1 -1
  10. package/dist/components/AsyncContent.d.ts +18 -4
  11. package/dist/components/AsyncContent.d.ts.map +1 -1
  12. package/dist/components/AsyncContent.js +18 -4
  13. package/dist/components/AsyncContent.js.map +1 -1
  14. package/dist/components/Avatar.d.ts +9 -0
  15. package/dist/components/Avatar.d.ts.map +1 -1
  16. package/dist/components/Avatar.js +11 -1
  17. package/dist/components/Avatar.js.map +1 -1
  18. package/dist/components/AvatarGroup.d.ts +8 -0
  19. package/dist/components/AvatarGroup.d.ts.map +1 -1
  20. package/dist/components/AvatarGroup.js +8 -0
  21. package/dist/components/AvatarGroup.js.map +1 -1
  22. package/dist/components/Badge.d.ts +13 -2
  23. package/dist/components/Badge.d.ts.map +1 -1
  24. package/dist/components/Badge.js +14 -3
  25. package/dist/components/Badge.js.map +1 -1
  26. package/dist/components/Blockquote.d.ts +8 -0
  27. package/dist/components/Blockquote.d.ts.map +1 -1
  28. package/dist/components/Blockquote.js +8 -0
  29. package/dist/components/Blockquote.js.map +1 -1
  30. package/dist/components/Breadcrumb.d.ts +8 -0
  31. package/dist/components/Breadcrumb.d.ts.map +1 -1
  32. package/dist/components/Breadcrumb.js +10 -1
  33. package/dist/components/Breadcrumb.js.map +1 -1
  34. package/dist/components/Button.d.ts +11 -0
  35. package/dist/components/Button.d.ts.map +1 -1
  36. package/dist/components/Button.js +14 -2
  37. package/dist/components/Button.js.map +1 -1
  38. package/dist/components/Card.d.ts +15 -4
  39. package/dist/components/Card.d.ts.map +1 -1
  40. package/dist/components/Card.js +13 -1
  41. package/dist/components/Card.js.map +1 -1
  42. package/dist/components/Checkbox.d.ts +14 -0
  43. package/dist/components/Checkbox.d.ts.map +1 -1
  44. package/dist/components/Checkbox.js +14 -0
  45. package/dist/components/Checkbox.js.map +1 -1
  46. package/dist/components/CheckboxGroup.d.ts +22 -3
  47. package/dist/components/CheckboxGroup.d.ts.map +1 -1
  48. package/dist/components/CheckboxGroup.js +23 -3
  49. package/dist/components/CheckboxGroup.js.map +1 -1
  50. package/dist/components/Circle.d.ts +16 -0
  51. package/dist/components/Circle.d.ts.map +1 -1
  52. package/dist/components/Circle.js +8 -0
  53. package/dist/components/Circle.js.map +1 -1
  54. package/dist/components/CitricComponent.d.ts +14 -0
  55. package/dist/components/CitricComponent.d.ts.map +1 -1
  56. package/dist/components/CitricComponent.js +14 -0
  57. package/dist/components/CitricComponent.js.map +1 -1
  58. package/dist/components/Divider.d.ts +4 -1
  59. package/dist/components/Divider.d.ts.map +1 -1
  60. package/dist/components/Divider.js +4 -1
  61. package/dist/components/Divider.js.map +1 -1
  62. package/dist/components/ErrorBoundary.d.ts +13 -0
  63. package/dist/components/ErrorBoundary.d.ts.map +1 -1
  64. package/dist/components/ErrorBoundary.js +13 -0
  65. package/dist/components/ErrorBoundary.js.map +1 -1
  66. package/dist/components/ErrorMessage.js +1 -1
  67. package/dist/components/ErrorMessage.js.map +1 -1
  68. package/dist/components/FallbackBoundary.d.ts +12 -1
  69. package/dist/components/FallbackBoundary.d.ts.map +1 -1
  70. package/dist/components/FallbackBoundary.js +12 -1
  71. package/dist/components/FallbackBoundary.js.map +1 -1
  72. package/dist/components/Favorite.d.ts +12 -0
  73. package/dist/components/Favorite.d.ts.map +1 -1
  74. package/dist/components/Favorite.js +12 -0
  75. package/dist/components/Favorite.js.map +1 -1
  76. package/dist/components/FieldGroup.d.ts +13 -0
  77. package/dist/components/FieldGroup.d.ts.map +1 -1
  78. package/dist/components/FieldGroup.js +13 -0
  79. package/dist/components/FieldGroup.js.map +1 -1
  80. package/dist/components/Form.d.ts +18 -0
  81. package/dist/components/Form.d.ts.map +1 -1
  82. package/dist/components/Form.js +18 -0
  83. package/dist/components/Form.js.map +1 -1
  84. package/dist/components/FormGroup.d.ts +12 -0
  85. package/dist/components/FormGroup.d.ts.map +1 -1
  86. package/dist/components/FormGroup.js +12 -0
  87. package/dist/components/FormGroup.js.map +1 -1
  88. package/dist/components/IconBox.d.ts +34 -9
  89. package/dist/components/IconBox.d.ts.map +1 -1
  90. package/dist/components/IconBox.js +37 -11
  91. package/dist/components/IconBox.js.map +1 -1
  92. package/dist/components/ImageBox.d.ts +32 -8
  93. package/dist/components/ImageBox.d.ts.map +1 -1
  94. package/dist/components/ImageBox.js +36 -11
  95. package/dist/components/ImageBox.js.map +1 -1
  96. package/dist/components/ImageWithFallback.d.ts +18 -0
  97. package/dist/components/ImageWithFallback.d.ts.map +1 -1
  98. package/dist/components/ImageWithFallback.js +11 -0
  99. package/dist/components/ImageWithFallback.js.map +1 -1
  100. package/dist/components/Input.d.ts +15 -3
  101. package/dist/components/Input.d.ts.map +1 -1
  102. package/dist/components/Input.js +16 -3
  103. package/dist/components/Input.js.map +1 -1
  104. package/dist/components/Link.d.ts +6 -0
  105. package/dist/components/Link.d.ts.map +1 -1
  106. package/dist/components/Link.js +6 -0
  107. package/dist/components/Link.js.map +1 -1
  108. package/dist/components/MenuOverlay/index.d.ts +20 -0
  109. package/dist/components/MenuOverlay/index.d.ts.map +1 -1
  110. package/dist/components/MenuOverlay/index.js +20 -0
  111. package/dist/components/MenuOverlay/index.js.map +1 -1
  112. package/dist/components/Overlay/index.d.ts +16 -0
  113. package/dist/components/Overlay/index.d.ts.map +1 -1
  114. package/dist/components/Overlay/index.js +16 -0
  115. package/dist/components/Overlay/index.js.map +1 -1
  116. package/dist/components/Pagination.d.ts +27 -8
  117. package/dist/components/Pagination.d.ts.map +1 -1
  118. package/dist/components/Pagination.js +18 -5
  119. package/dist/components/Pagination.js.map +1 -1
  120. package/dist/components/ProgressBar.d.ts +19 -1
  121. package/dist/components/ProgressBar.d.ts.map +1 -1
  122. package/dist/components/ProgressBar.js +15 -1
  123. package/dist/components/ProgressBar.js.map +1 -1
  124. package/dist/components/ProgressCircular.d.ts +14 -0
  125. package/dist/components/ProgressCircular.d.ts.map +1 -1
  126. package/dist/components/ProgressCircular.js +14 -0
  127. package/dist/components/ProgressCircular.js.map +1 -1
  128. package/dist/components/RadioGroup.d.ts +24 -3
  129. package/dist/components/RadioGroup.d.ts.map +1 -1
  130. package/dist/components/RadioGroup.js +25 -3
  131. package/dist/components/RadioGroup.js.map +1 -1
  132. package/dist/components/Rating.d.ts +10 -0
  133. package/dist/components/Rating.d.ts.map +1 -1
  134. package/dist/components/Rating.js +10 -0
  135. package/dist/components/Rating.js.map +1 -1
  136. package/dist/components/Select/RichSelect.d.ts +3 -5
  137. package/dist/components/Select/RichSelect.d.ts.map +1 -1
  138. package/dist/components/Select/RichSelect.js +4 -4
  139. package/dist/components/Select/RichSelect.js.map +1 -1
  140. package/dist/components/Select/SimpleSelect.d.ts +2 -3
  141. package/dist/components/Select/SimpleSelect.d.ts.map +1 -1
  142. package/dist/components/Select/SimpleSelect.js +2 -3
  143. package/dist/components/Select/SimpleSelect.js.map +1 -1
  144. package/dist/components/Select/index.d.ts +25 -2
  145. package/dist/components/Select/index.d.ts.map +1 -1
  146. package/dist/components/Select/index.js +26 -3
  147. package/dist/components/Select/index.js.map +1 -1
  148. package/dist/components/Select/types.d.ts +1 -2
  149. package/dist/components/Select/types.d.ts.map +1 -1
  150. package/dist/components/SelectBox.d.ts +31 -2
  151. package/dist/components/SelectBox.d.ts.map +1 -1
  152. package/dist/components/SelectBox.js +32 -3
  153. package/dist/components/SelectBox.js.map +1 -1
  154. package/dist/components/Skeleton.d.ts +11 -0
  155. package/dist/components/Skeleton.d.ts.map +1 -1
  156. package/dist/components/Skeleton.js +11 -0
  157. package/dist/components/Skeleton.js.map +1 -1
  158. package/dist/components/Slider.d.ts +12 -0
  159. package/dist/components/Slider.d.ts.map +1 -1
  160. package/dist/components/Slider.js +12 -0
  161. package/dist/components/Slider.js.map +1 -1
  162. package/dist/components/SmartTable.d.ts +36 -2
  163. package/dist/components/SmartTable.d.ts.map +1 -1
  164. package/dist/components/SmartTable.js +37 -3
  165. package/dist/components/SmartTable.js.map +1 -1
  166. package/dist/components/Stepper.d.ts +20 -3
  167. package/dist/components/Stepper.d.ts.map +1 -1
  168. package/dist/components/Stepper.js +21 -3
  169. package/dist/components/Stepper.js.map +1 -1
  170. package/dist/components/Table.d.ts +10 -0
  171. package/dist/components/Table.d.ts.map +1 -1
  172. package/dist/components/Table.js +10 -0
  173. package/dist/components/Table.js.map +1 -1
  174. package/dist/components/Tabs/TabController.d.ts +14 -0
  175. package/dist/components/Tabs/TabController.d.ts.map +1 -1
  176. package/dist/components/Tabs/TabController.js +14 -0
  177. package/dist/components/Tabs/TabController.js.map +1 -1
  178. package/dist/components/Tabs/index.d.ts +20 -3
  179. package/dist/components/Tabs/index.d.ts.map +1 -1
  180. package/dist/components/Tabs/index.js +23 -4
  181. package/dist/components/Tabs/index.js.map +1 -1
  182. package/dist/components/Tabs/types.d.ts +6 -0
  183. package/dist/components/Tabs/types.d.ts.map +1 -1
  184. package/dist/components/Text.d.ts +16 -2
  185. package/dist/components/Text.d.ts.map +1 -1
  186. package/dist/components/Text.js +17 -3
  187. package/dist/components/Text.js.map +1 -1
  188. package/dist/components/Textarea.d.ts +11 -1
  189. package/dist/components/Textarea.d.ts.map +1 -1
  190. package/dist/components/Textarea.js +12 -2
  191. package/dist/components/Textarea.js.map +1 -1
  192. package/dist/components/Tooltip.d.ts +14 -1
  193. package/dist/components/Tooltip.d.ts.map +1 -1
  194. package/dist/components/Tooltip.js +13 -0
  195. package/dist/components/Tooltip.js.map +1 -1
  196. package/dist/components/layout.d.ts +41 -7
  197. package/dist/components/layout.d.ts.map +1 -1
  198. package/dist/components/layout.js +44 -9
  199. package/dist/components/layout.js.map +1 -1
  200. package/dist/index.d.ts +0 -1
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +0 -1
  203. package/dist/index.js.map +1 -1
  204. package/package.json +2 -2
  205. package/src/components/Accordion.tsx +34 -0
  206. package/src/components/Alert.tsx +8 -0
  207. package/src/components/AsyncContent.tsx +18 -4
  208. package/src/components/Avatar.tsx +11 -1
  209. package/src/components/AvatarGroup.tsx +8 -0
  210. package/src/components/Badge.tsx +24 -8
  211. package/src/components/Blockquote.tsx +8 -0
  212. package/src/components/Breadcrumb.tsx +10 -1
  213. package/src/components/Button.tsx +17 -2
  214. package/src/components/Card.tsx +34 -14
  215. package/src/components/Checkbox.tsx +14 -0
  216. package/src/components/CheckboxGroup.tsx +61 -40
  217. package/src/components/Circle.tsx +16 -0
  218. package/src/components/CitricComponent.ts +14 -0
  219. package/src/components/Divider.tsx +6 -5
  220. package/src/components/ErrorBoundary.tsx +13 -0
  221. package/src/components/ErrorMessage.tsx +1 -1
  222. package/src/components/FallbackBoundary.tsx +12 -1
  223. package/src/components/Favorite.tsx +12 -0
  224. package/src/components/FieldGroup.tsx +13 -0
  225. package/src/components/Form.tsx +18 -0
  226. package/src/components/FormGroup.tsx +12 -0
  227. package/src/components/IconBox.tsx +62 -31
  228. package/src/components/ImageBox.tsx +60 -30
  229. package/src/components/ImageWithFallback.tsx +18 -0
  230. package/src/components/Input.tsx +28 -14
  231. package/src/components/Link.tsx +6 -0
  232. package/src/components/MenuOverlay/index.tsx +20 -0
  233. package/src/components/Overlay/index.tsx +17 -0
  234. package/src/components/Pagination.tsx +40 -17
  235. package/src/components/ProgressBar.tsx +20 -2
  236. package/src/components/ProgressCircular.tsx +14 -0
  237. package/src/components/RadioGroup.tsx +62 -39
  238. package/src/components/Rating.tsx +10 -0
  239. package/src/components/Select/RichSelect.tsx +183 -182
  240. package/src/components/Select/SimpleSelect.tsx +57 -57
  241. package/src/components/Select/index.tsx +29 -5
  242. package/src/components/Select/types.ts +1 -1
  243. package/src/components/SelectBox.tsx +92 -62
  244. package/src/components/Skeleton.tsx +11 -0
  245. package/src/components/Slider.tsx +12 -0
  246. package/src/components/SmartTable.tsx +91 -56
  247. package/src/components/Stepper.tsx +76 -57
  248. package/src/components/Table.tsx +10 -0
  249. package/src/components/Tabs/TabController.ts +14 -0
  250. package/src/components/Tabs/index.tsx +57 -37
  251. package/src/components/Tabs/types.ts +6 -0
  252. package/src/components/Text.ts +36 -21
  253. package/src/components/Textarea.tsx +14 -4
  254. package/src/components/Tooltip.tsx +14 -1
  255. package/src/components/layout.tsx +56 -13
  256. package/src/index.ts +0 -1
  257. package/dist/components/Switch.d.ts +0 -10
  258. package/dist/components/Switch.d.ts.map +0 -1
  259. package/dist/components/Switch.js +0 -8
  260. package/dist/components/Switch.js.map +0 -1
  261. package/src/components/Switch.tsx +0 -30
package/dist/citric.css CHANGED
@@ -481,6 +481,7 @@
481
481
 
482
482
  > nav {
483
483
  display: flex;
484
+ position: relative;
484
485
  border-bottom: 1px solid var(--light-600);
485
486
  > label {
486
487
  appearance: none;
@@ -515,6 +516,13 @@
515
516
  }
516
517
  }
517
518
 
519
+ &.equally-sized > nav > label {
520
+ padding: 8px 0;
521
+ flex: 1;
522
+ justify-content: center;
523
+ text-align: center;
524
+ }
525
+
518
526
  > section {
519
527
  display: flex;
520
528
  flex-direction: column;
@@ -1462,6 +1470,7 @@ input[type="range"][data-citric="slider"] {
1462
1470
 
1463
1471
 
1464
1472
  [data-citric="progress-bar"] {
1473
+ --speed: 1s;
1465
1474
  border-radius: var(--radius-lg);
1466
1475
  width: 100%;
1467
1476
  height: 2px;
@@ -1477,8 +1486,12 @@ input[type="range"][data-citric="slider"] {
1477
1486
  background-color: var(--scheme-500, var(--palette-500, var(--primary-500)));
1478
1487
  }
1479
1488
 
1489
+ &.fast {
1490
+ --speed: 0.5s;
1491
+ }
1492
+
1480
1493
  &.indeterminate:after {
1481
- animation: progress-indeterminate-bar 1s infinite;
1494
+ animation: progress-indeterminate-bar var(--speed) infinite;
1482
1495
  }
1483
1496
  }
1484
1497
 
@@ -1743,6 +1756,10 @@ nav[data-citric="menu"].rounded-items, [data-citric="menu"].rounded-items nav {
1743
1756
  -webkit-text-fill-color: var(--light-contrastText);
1744
1757
  box-shadow: inset 0 0 0 1000px var(--light-300);
1745
1758
  }
1759
+
1760
+ &::-webkit-scrollbar-corner {
1761
+ background-color: transparent;
1762
+ }
1746
1763
  }
1747
1764
 
1748
1765
 
@@ -2210,6 +2227,10 @@ input[data-citric="favorite"][type="checkbox"] {
2210
2227
  }
2211
2228
  }
2212
2229
 
2230
+ button[data-citric="card"] {
2231
+ font: inherit;
2232
+ }
2233
+
2213
2234
 
2214
2235
  .apply-citric button:not(.citric-icon),
2215
2236
  .apply-citric input[type="button"]:not(.citric-icon),
@@ -2222,8 +2243,7 @@ input[data-citric="favorite"][type="checkbox"] {
2222
2243
  align-items: center;
2223
2244
  background-color: var(--scheme-500, var(--primary-500));
2224
2245
  color: var(--scheme-contrastText, var(--primary-contrastText));
2225
- padding-inline: var(--spacing-3);
2226
- padding-block: var(--spacing-2);
2246
+ padding: 4px 8px;
2227
2247
  font: var(--font-body2);
2228
2248
  font-weight: 500;
2229
2249
  border-radius: var(--radius-xs);
@@ -2231,11 +2251,17 @@ input[data-citric="favorite"][type="checkbox"] {
2231
2251
  justify-content: center;
2232
2252
  cursor: pointer;
2233
2253
  border: 1px solid var(--scheme-500, var(--primary-500));
2234
- gap: var(--spacing-2);
2254
+ gap: var(--spacing-3);
2235
2255
  position: relative;
2236
2256
  text-decoration: none;
2237
2257
  outline: none;
2238
2258
 
2259
+ /* Fixes alignment for buttons with icons */
2260
+ &:not(.short-text):has(.citric-icon) {
2261
+ padding: 5px 8px 3px;
2262
+ .citric-icon { margin-top: -2px; }
2263
+ }
2264
+
2239
2265
  /* Appearances */
2240
2266
 
2241
2267
  &.outlined, &.text {
@@ -28,5 +28,39 @@ export interface BaseAccordionProps {
28
28
  maxHeight?: number;
29
29
  }
30
30
  export type AccordionProps = Omit<React.JSX.IntrinsicElements['div'], 'onChange'> & BaseAccordionProps;
31
+ /**
32
+ * Creates an accordion, showing/hiding the children according to the state of the expand/collapse checkbox.
33
+ *
34
+ * The accordion must define a max height, which is 300 by default (measured in pixels). Whenever the content surpasses "maxHeight", a
35
+ * vertical scroll is created. If your content is much shorter than "maxHeight", consider reducing its value for a better animation.
36
+ *
37
+ * @example
38
+ * A simple accordion, styled like a card:
39
+ * ```
40
+ * <Accordion appearance="card" header="This is the title of the accordion" maxHeight={80}>
41
+ * <p>This is the content of the accordion</p>
42
+ * </Accordion>
43
+ * ```
44
+ *
45
+ * A more complex accordion:
46
+ * ```
47
+ * const header = (toggle: React.ReactElement) => (
48
+ * <Row justifyContent="space-between" bg="cyan.500" border="cyan.700" radius="sm">
49
+ * <ImageBox><img src="/my-image.png" /></ImageBox>
50
+ * <Text>Joseph Clinton</Text>
51
+ * <Text>40 years old</Text>
52
+ * {toggle}
53
+ * </Row>
54
+ * )
55
+ * return (
56
+ * <Accordion header={header}>
57
+ * <Center>
58
+ * <img src="/an-image.png" />
59
+ * <p>This is the content of the accordion</p>
60
+ * </Center>
61
+ * </Accordion>
62
+ * )
63
+ * ```
64
+ */
31
65
  export declare const Accordion: ({ id, appearance, expanded, onChange, header, maxHeight, className, style, children, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
32
66
  //# sourceMappingURL=Accordion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAClF;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,kBAAkB,CAAA;AAEtG,eAAO,MAAM,SAAS,oGACmF,cAAc,4CAqCrH,CAAA"}
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAClF;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,kBAAkB,CAAA;AAEtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,SAAS,oGACmF,cAAc,4CAqCrH,CAAA"}
@@ -5,6 +5,40 @@ import { useEffect, useMemo, useState } from 'react';
5
5
  import { applyCSSVariable } from '../utils/css.js';
6
6
  import { withRef } from '../utils/react.js';
7
7
  import { CitricComponent } from './CitricComponent.js';
8
+ /**
9
+ * Creates an accordion, showing/hiding the children according to the state of the expand/collapse checkbox.
10
+ *
11
+ * The accordion must define a max height, which is 300 by default (measured in pixels). Whenever the content surpasses "maxHeight", a
12
+ * vertical scroll is created. If your content is much shorter than "maxHeight", consider reducing its value for a better animation.
13
+ *
14
+ * @example
15
+ * A simple accordion, styled like a card:
16
+ * ```
17
+ * <Accordion appearance="card" header="This is the title of the accordion" maxHeight={80}>
18
+ * <p>This is the content of the accordion</p>
19
+ * </Accordion>
20
+ * ```
21
+ *
22
+ * A more complex accordion:
23
+ * ```
24
+ * const header = (toggle: React.ReactElement) => (
25
+ * <Row justifyContent="space-between" bg="cyan.500" border="cyan.700" radius="sm">
26
+ * <ImageBox><img src="/my-image.png" /></ImageBox>
27
+ * <Text>Joseph Clinton</Text>
28
+ * <Text>40 years old</Text>
29
+ * {toggle}
30
+ * </Row>
31
+ * )
32
+ * return (
33
+ * <Accordion header={header}>
34
+ * <Center>
35
+ * <img src="/an-image.png" />
36
+ * <p>This is the content of the accordion</p>
37
+ * </Center>
38
+ * </Accordion>
39
+ * )
40
+ * ```
41
+ */
8
42
  export const Accordion = withRef(({ id, appearance, expanded, onChange, header, maxHeight = 300, className, style, children, ...props }) => {
9
43
  const t = useTranslate(dictionary);
10
44
  const [ariaHidden, setAriaHidden] = useState(!expanded);
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,gBA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W,GAC1B,CAAA;IACF,MAAM,aAAa,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,4BAAQ,MAAM,EAAE,SAAS,IAAS,CAAA;IAC3G,OAAO,CACL,MAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,WAAW,EACrB,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,EAC/C,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,SAAS,IAAI,CAAC,KAC1D,KAAK,aAET,2BAAS,aAAa,GAAU,EAChC,kBAAS,EAAE,EAAE,WAAW,iBAAe,UAAU,KAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,YACzF,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,SAAS,YAAE,QAAQ,GAAO,CAAC,CAAC,CAAC,QAAQ,GACrE,IACM,CACnB,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,QAAQ;KAChB;CACmB,CAAA"}
@@ -6,5 +6,13 @@ export interface BaseAlertProps {
6
6
  type?: 'error' | 'info' | 'warning';
7
7
  }
8
8
  export type AlertProps = React.JSX.IntrinsicElements['div'] & BaseAlertProps;
9
+ /**
10
+ * Renders an alert message with an icon and a background. This may be an error, warning or a success feedback.
11
+ *
12
+ * @example
13
+ * ```
14
+ * <Alert type="warning">My warning!</Alert>
15
+ * ```
16
+ */
9
17
  export declare const Alert: ({ type, className, children, ...props }: AlertProps) => import("react/jsx-runtime").JSX.Element;
10
18
  //# sourceMappingURL=Alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,cAAc,CAAA;AAE5E,eAAO,MAAM,KAAK,4CAAqD,UAAU,4CACiD,CAAA"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,cAAc,CAAA;AAE5E;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,4CAAqD,UAAU,4CACiD,CAAA"}
@@ -2,5 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { listToClass } from '@stack-spot/portal-theme';
3
3
  import { withRef } from '../utils/react.js';
4
4
  import { CitricComponent } from './CitricComponent.js';
5
+ /**
6
+ * Renders an alert message with an icon and a background. This may be an error, warning or a success feedback.
7
+ *
8
+ * @example
9
+ * ```
10
+ * <Alert type="warning">My warning!</Alert>
11
+ * ```
12
+ */
5
13
  export const Alert = withRef(({ type, className, children, ...props }) => _jsx(CitricComponent, { tag: "div", component: "alert", className: listToClass([type, className]), ...props, children: children }));
6
14
  //# sourceMappingURL=Alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAYnD,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAc,EAAE,EAAE,CACnF,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,KAAM,KAAK,YAAG,QAAQ,GAAmB,CAAC,CAAA"}
1
+ {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAYnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAc,EAAE,EAAE,CACnF,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,KAAM,KAAK,YAAG,QAAQ,GAAmB,CAAC,CAAA"}
@@ -19,11 +19,25 @@ interface Props {
19
19
  children: React.ReactNode;
20
20
  }
21
21
  /**
22
- * Renders a component that provides user feedback on async requests.
23
- * It renders either a loading component, an error component (which is received as prop)
24
- * or the received children props.
22
+ * Renders a component that provides user feedback on async requests. It renders either a loading component, an error component or its
23
+ * children.
25
24
  *
26
- * @param options the props for rendering the component: {@link Props}.
25
+ * The loading and error views can be customized through a CitricController.
26
+ *
27
+ * Errors can be watched through the function `onError` of a CitricController.
28
+ *
29
+ * Attention: for React Suspense, use the component "FallbackBoundary" instead.
30
+ *
31
+ * @example
32
+ * ```
33
+ * const [data, isLoading, error] = useRemoteData()
34
+ *
35
+ * return (
36
+ * <AsyncContent loading={isLoading} error={error}>
37
+ * {data}
38
+ * </AsyncContent>
39
+ * )
40
+ * ```
27
41
  */
28
42
  export declare const AsyncContent: ({ loading, error, autofocus, children }: Props) => string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
29
43
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncContent.d.ts","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA8B,MAAM,OAAO,CAAA;AAMpE,UAAU,KAAK;IACb;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY,4CAAqD,KAAK,iIAoBjF,CAAA"}
1
+ {"version":3,"file":"AsyncContent.d.ts","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA8B,MAAM,OAAO,CAAA;AAMpE,UAAU,KAAK;IACb;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,YAAY,4CAAqD,KAAK,iIAoBjF,CAAA"}
@@ -5,11 +5,25 @@ import { withRef } from '../utils/react.js';
5
5
  import { ErrorMessage } from './ErrorMessage.js';
6
6
  import { LoadingPanel } from './LoadingPanel.js';
7
7
  /**
8
- * Renders a component that provides user feedback on async requests.
9
- * It renders either a loading component, an error component (which is received as prop)
10
- * or the received children props.
8
+ * Renders a component that provides user feedback on async requests. It renders either a loading component, an error component or its
9
+ * children.
11
10
  *
12
- * @param options the props for rendering the component: {@link Props}.
11
+ * The loading and error views can be customized through a CitricController.
12
+ *
13
+ * Errors can be watched through the function `onError` of a CitricController.
14
+ *
15
+ * Attention: for React Suspense, use the component "FallbackBoundary" instead.
16
+ *
17
+ * @example
18
+ * ```
19
+ * const [data, isLoading, error] = useRemoteData()
20
+ *
21
+ * return (
22
+ * <AsyncContent loading={isLoading} error={error}>
23
+ * {data}
24
+ * </AsyncContent>
25
+ * )
26
+ * ```
13
27
  */
14
28
  export const AsyncContent = withRef(({ loading, error, autofocus, children }) => {
15
29
  const citric = useCitricController();
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncContent.js","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAoB,SAAS,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAsB7C;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAS,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IAEpC,SAAS,CAAC,GAAG,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,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAS,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IAEpC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;YACxB,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;YACvB,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAiB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;QAC7H,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IAEpB,IAAI,OAAO;QAAE,OAAO,KAAC,YAAY,KAAG,CAAA;IACpC,IAAI,KAAK;QAAE,OAAO,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CAAA;IAClG,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -18,5 +18,14 @@ export interface BaseAvatarProps extends WithColorPalette {
18
18
  image?: string;
19
19
  }
20
20
  export type AvatarProps = React.JSX.IntrinsicElements['div'] & BaseAvatarProps;
21
+ /**
22
+ * Renders an avatar. If an image is provided it's rendered within the space reserved to the avatar, otherwise, the initial of the names
23
+ * are used.
24
+ *
25
+ * @example
26
+ * ```
27
+ * <Avatar name="Rick Sanchez" />
28
+ * ```
29
+ */
21
30
  export declare const Avatar: ({ size, name, appearance, className, image, ...props }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
22
31
  //# sourceMappingURL=Avatar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAI3C,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,CAAA;AAE9E,eAAO,MAAM,MAAM,2DAAoE,WAAW,4CAQhG,CAAA"}
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAK3C,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,CAAA;AAE9E;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,2DAAoE,WAAW,4CAQhG,CAAA"}
@@ -2,9 +2,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { listToClass } from '@stack-spot/portal-theme';
3
3
  import { withRef } from '../utils/react.js';
4
4
  import { CitricComponent } from './CitricComponent.js';
5
+ import { ImageWithFallback } from './ImageWithFallback.js';
6
+ /**
7
+ * Renders an avatar. If an image is provided it's rendered within the space reserved to the avatar, otherwise, the initial of the names
8
+ * are used.
9
+ *
10
+ * @example
11
+ * ```
12
+ * <Avatar name="Rick Sanchez" />
13
+ * ```
14
+ */
5
15
  export const Avatar = withRef(({ size, name, appearance, className, image, ...props }) => {
6
16
  const parts = name?.split(' ') ?? [''];
7
17
  const acronym = parts.length >= 2 ? `${parts[0][0]}${parts[1][0]}` : parts[0][0];
8
- return (_jsx(CitricComponent, { tag: "div", component: "avatar", className: listToClass([size, appearance, className]), ...props, children: image ? _jsx("img", { src: image }) : acronym }));
18
+ return (_jsx(CitricComponent, { tag: "div", component: "avatar", className: listToClass([size, appearance, className]), ...props, children: _jsx(ImageWithFallback, { src: image, fallback: acronym }) }));
9
19
  });
10
20
  //# sourceMappingURL=Avatar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAuBnD,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE;IACpG,MAAM,KAAK,GAA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAChF,OAAO,CACL,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,KAAM,KAAK,YAC5G,KAAC,iBAAiB,IAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAI,GACpC,CACnB,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -21,5 +21,13 @@ export interface BaseAvatarGroupProps extends WithColorPalette {
21
21
  maxItems?: number;
22
22
  }
23
23
  export type AvatarGroupProps = React.JSX.IntrinsicElements['div'] & BaseAvatarGroupProps;
24
+ /**
25
+ * Stacks a group of avatars horizontally.
26
+ *
27
+ * @example
28
+ * ```
29
+ * <AvatarGroup items={[{ name: 'John Smith' }, { name: 'Mary Anne', image: 'https://profile.com/123.png' }]} />
30
+ * ```
31
+ */
24
32
  export declare const AvatarGroup: ({ size, items, appearance, maxItems, className, ...props }: AvatarGroupProps) => import("react/jsx-runtime").JSX.Element;
25
33
  //# sourceMappingURL=AvatarGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/components/AvatarGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAK3C,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C;;QAEI;IACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAA;AAExF,eAAO,MAAM,WAAW,+DAAwE,gBAAgB,4CAa9G,CAAA"}
1
+ {"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/components/AvatarGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAK3C,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACxD;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C;;QAEI;IACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAA;AAExF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,+DAAwE,gBAAgB,4CAa9G,CAAA"}
@@ -3,6 +3,14 @@ import { listToClass } from '@stack-spot/portal-theme';
3
3
  import { withRef } from '../utils/react.js';
4
4
  import { Avatar } from './Avatar.js';
5
5
  import { CitricComponent } from './CitricComponent.js';
6
+ /**
7
+ * Stacks a group of avatars horizontally.
8
+ *
9
+ * @example
10
+ * ```
11
+ * <AvatarGroup items={[{ name: 'John Smith' }, { name: 'Mary Anne', image: 'https://profile.com/123.png' }]} />
12
+ * ```
13
+ */
6
14
  export const AvatarGroup = withRef(({ size, items, appearance, maxItems, className, ...props }) => {
7
15
  const avatars = items.map(({ name, image }) => _jsx(Avatar, { name: name, image: image }, name), [items]);
8
16
  return (_jsx(CitricComponent, { tag: "div", component: "avatar-group", className: listToClass([size, appearance, className]), "data-max-items": maxItems, ...props, children: avatars }));
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarGroup.js","sourceRoot":"","sources":["../../src/components/AvatarGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAuBnD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE;IAClH,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAC,MAAM,IAAY,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,IAA9B,IAAI,CAA8B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACxG,OAAO,CACL,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,oBACrC,QAAQ,KACpB,KAAK,YAER,OAAO,GACQ,CACnB,CAAA;AACH,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"AvatarGroup.js","sourceRoot":"","sources":["../../src/components/AvatarGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAuBnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE;IAClH,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAC,MAAM,IAAY,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,IAA9B,IAAI,CAA8B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACxG,OAAO,CACL,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,oBACrC,QAAQ,KACpB,KAAK,YAER,OAAO,GACQ,CACnB,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -13,7 +13,18 @@ export interface BaseBadgeProps<T extends ValidTags = ValidTags> extends WithCol
13
13
  appearance?: 'square' | 'circle';
14
14
  }
15
15
  export type BadgeProps<T extends ValidTags> = HTMLTag[T] & BaseBadgeProps<T>;
16
- declare function _Badge<T extends ValidTags>({ tag, appearance, className, children, ...props }: BadgeProps<T>): import("react/jsx-runtime").JSX.Element;
17
- export declare const Badge: typeof _Badge;
16
+ /**
17
+ * Renders a badge. Badges have different color grades depending if they're focusable or not. Use `colorPalette` do determine the main
18
+ * color.
19
+ *
20
+ * @example
21
+ * ```
22
+ * <Badge>
23
+ * <Icon icon="PlusMini" />
24
+ * My first badge
25
+ * </Badge>
26
+ * ```
27
+ */
28
+ export declare const Badge: <T extends ValidTags>({ tag, appearance, className, children, ...props }: BadgeProps<T>) => import("react/jsx-runtime").JSX.Element;
18
29
  export {};
19
30
  //# sourceMappingURL=Badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIpD,KAAK,SAAS,GAAG,GAAG,GAAG,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAA;AAEvD,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,gBAAgB;IACvF;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAClC;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;AAE5E,iBAAS,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,2CAMrG;AAED,eAAO,MAAM,KAAK,eAAkB,CAAA"}
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIpD,KAAK,SAAS,GAAG,GAAG,GAAG,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAA;AAEvD,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,gBAAgB;IACvF;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAClC;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;AAE5E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,GACD,CAAC,SAAS,SAAS,sDAAsD,UAAU,CAAC,CAAC,CAAC,4CAOtG,CAAA"}
@@ -2,8 +2,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { listToClass } from '@stack-spot/portal-theme';
3
3
  import { withRef } from '../utils/react.js';
4
4
  import { CitricComponent } from './CitricComponent.js';
5
- function _Badge({ tag, appearance, className, children, ...props }) {
5
+ /**
6
+ * Renders a badge. Badges have different color grades depending if they're focusable or not. Use `colorPalette` do determine the main
7
+ * color.
8
+ *
9
+ * @example
10
+ * ```
11
+ * <Badge>
12
+ * <Icon icon="PlusMini" />
13
+ * My first badge
14
+ * </Badge>
15
+ * ```
16
+ */
17
+ export const Badge = withRef(function Badge({ tag, appearance, className, children, ...props }) {
6
18
  return (_jsx(CitricComponent, { tag: tag || 'div', component: "badge", className: listToClass([appearance, className]), ...props, children: children }));
7
- }
8
- export const Badge = withRef(_Badge);
19
+ });
9
20
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAmBnD,SAAS,MAAM,CAAsB,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACpG,OAAO,CACL,KAAC,eAAe,IAAC,GAAG,EAAE,GAAG,IAAI,KAAK,EAAE,SAAS,EAAC,OAAO,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,KAAM,KAAY,YACpH,QAAQ,GACO,CACnB,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAmBnD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAC1B,SAAS,KAAK,CAAsB,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACnG,OAAO,CACL,KAAC,eAAe,IAAC,GAAG,EAAE,GAAG,IAAI,KAAK,EAAE,SAAS,EAAC,OAAO,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,KAAM,KAAY,YACpH,QAAQ,GACO,CACnB,CAAA;AACH,CAAC,CACF,CAAA"}
@@ -1,5 +1,13 @@
1
1
  import { WithColorPalette, WithColorScheme } from '../types.js';
2
2
  export type BaseBlockquoteProps = WithColorScheme & WithColorPalette;
3
3
  export type BlockquoteProps = React.JSX.IntrinsicElements['blockquote'] & BaseBlockquoteProps;
4
+ /**
5
+ * Renders a quote.
6
+ *
7
+ * @example
8
+ * ```
9
+ * <Blockquote>To be or not to be, that's the question</Blockquote>
10
+ * ```
11
+ */
4
12
  export declare const Blockquote: ({ children, ...props }: BlockquoteProps) => import("react/jsx-runtime").JSX.Element;
5
13
  //# sourceMappingURL=Blockquote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Blockquote.d.ts","sourceRoot":"","sources":["../../src/components/Blockquote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI5D,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAAA;AAE7F,eAAO,MAAM,UAAU,2BAAoC,eAAe,4CACyB,CAAA"}
1
+ {"version":3,"file":"Blockquote.d.ts","sourceRoot":"","sources":["../../src/components/Blockquote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI5D,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAAA;AAE7F;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,2BAAoC,eAAe,4CACyB,CAAA"}
@@ -1,5 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { withRef } from '../utils/react.js';
3
3
  import { CitricComponent } from './CitricComponent.js';
4
+ /**
5
+ * Renders a quote.
6
+ *
7
+ * @example
8
+ * ```
9
+ * <Blockquote>To be or not to be, that's the question</Blockquote>
10
+ * ```
11
+ */
4
12
  export const Blockquote = withRef(({ children, ...props }) => _jsx(CitricComponent, { tag: "blockquote", component: "blockquote", ...props, children: children }));
5
13
  //# sourceMappingURL=Blockquote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Blockquote.js","sourceRoot":"","sources":["../../src/components/Blockquote.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAMnD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE,CAC5E,KAAC,eAAe,IAAC,GAAG,EAAC,YAAY,EAAC,SAAS,EAAC,YAAY,KAAK,KAAK,YAAG,QAAQ,GAAmB,CAAC,CAAA"}
1
+ {"version":3,"file":"Blockquote.js","sourceRoot":"","sources":["../../src/components/Blockquote.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAMnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE,CAC5E,KAAC,eAAe,IAAC,GAAG,EAAC,YAAY,EAAC,SAAS,EAAC,YAAY,KAAK,KAAK,YAAG,QAAQ,GAAmB,CAAC,CAAA"}
@@ -6,6 +6,14 @@ export interface BaseBreadcrumbProps {
6
6
  items: BreadCrumbItem[];
7
7
  }
8
8
  export type BreadcrumbProps = React.JSX.IntrinsicElements['nav'] & BaseBreadcrumbProps;
9
+ /**
10
+ * Renders a simple navigation bar with links to the previous pages.
11
+ *
12
+ * @example
13
+ * ```
14
+ * <Breadcrumb items={[{ label: 'Home', href: '/' }, { label: 'Settings', href: '/settings' }, { label: 'Profile' }]} />
15
+ * ```
16
+ */
9
17
  export declare const Breadcrumb: ({ items, ...props }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
10
18
  export {};
11
19
  //# sourceMappingURL=Breadcrumb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumb.tsx"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAA;AAEtF,eAAO,MAAM,UAAU,wBAAiC,eAAe,4CAQrE,CAAA"}
1
+ {"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumb.tsx"],"names":[],"mappings":"AAKA,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAA;AAEtF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,wBAAiC,eAAe,4CAQrE,CAAA"}
@@ -2,8 +2,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { withRef } from '../utils/react.js';
4
4
  import { CitricComponent } from './CitricComponent.js';
5
+ import { Link } from './Link.js';
6
+ /**
7
+ * Renders a simple navigation bar with links to the previous pages.
8
+ *
9
+ * @example
10
+ * ```
11
+ * <Breadcrumb items={[{ label: 'Home', href: '/' }, { label: 'Settings', href: '/settings' }, { label: 'Profile' }]} />
12
+ * ```
13
+ */
5
14
  export const Breadcrumb = withRef(({ items, ...props }) => {
6
- const children = useMemo(() => items.map((item, index) => item.href ? _jsx("li", { children: _jsx("a", { href: item.href, children: item.label }) }, index) : _jsx("li", { children: item.label }, index)), [items]);
15
+ const children = useMemo(() => items.map((item, index) => item.href ? _jsx("li", { children: _jsx(Link, { href: item.href, children: item.label }) }, index) : _jsx("li", { children: item.label }, index)), [items]);
7
16
  return _jsx(CitricComponent, { tag: "nav", component: "breadcrumb", ...props, children: _jsx("ul", { children: children }) });
8
17
  });
9
18
  //# sourceMappingURL=Breadcrumb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.js","sourceRoot":"","sources":["../../src/components/Breadcrumb.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAanD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACzE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CACb,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAgB,YAAG,IAAI,EAAE,IAAI,CAAC,IAAI,YAAG,IAAI,CAAC,KAAK,GAAK,IAA3C,KAAK,CAA2C,CAAC,CAAC,CAAC,uBAAiB,IAAI,CAAC,KAAK,IAAlB,KAAK,CAAmB,CAC3H,EACD,CAAC,KAAK,CAAC,CACR,CAAA;IACD,OAAO,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,YAAY,KAAK,KAAK,YAAE,uBAAK,QAAQ,GAAM,GAAkB,CAAA;AAC3G,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"Breadcrumb.js","sourceRoot":"","sources":["../../src/components/Breadcrumb.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAa7B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACzE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CACb,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAgB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,YAAG,IAAI,CAAC,KAAK,GAAQ,IAAjD,KAAK,CAAiD,CAAC,CAAC,CAAC,uBAAiB,IAAI,CAAC,KAAK,IAAlB,KAAK,CAAmB,CACjI,EACD,CAAC,KAAK,CAAC,CACR,CAAA;IACD,OAAO,KAAC,eAAe,IAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,YAAY,KAAK,KAAK,YAAE,uBAAK,QAAQ,GAAM,GAAkB,CAAA;AAC3G,CAAC,CAAC,CAAA"}
@@ -39,5 +39,16 @@ export interface BaseButtonProps extends WithColorScheme {
39
39
  analytics?: boolean;
40
40
  }
41
41
  export type ButtonProps = Omit<React.JSX.IntrinsicElements['button'], 'onClick'> & BaseButtonProps;
42
+ /**
43
+ * Renders a button. The type is "button" by default.
44
+ *
45
+ * Whenever a button is clicked, the function `onClickButton` of the nearest CitricController is called with the event and the value of the
46
+ * prop `analytics`.
47
+ *
48
+ * @example
49
+ * ```
50
+ * <Button>My Button</MyButton>
51
+ * ```
52
+ */
42
53
  export declare const Button: ({ appearance, size, feedback, loading, disabled, onClick, className, children, type, analytics, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
43
54
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"m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iB,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC;IAC1E;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GAAG,eAAe,CAAA;AAElG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,+GACsG,WAAW,4CA0ClI,CAAA"}
@@ -1,14 +1,26 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { listToClass } from '@stack-spot/portal-theme';
3
- import { useState } from 'react';
3
+ import { Children, useMemo, useState } from 'react';
4
4
  import { useCitricController } from '../context/hooks.js';
5
5
  import { withRef } from '../utils/react.js';
6
6
  import { CitricComponent } from './CitricComponent.js';
7
7
  import { ProgressCircular } from './ProgressCircular.js';
8
+ /**
9
+ * Renders a button. The type is "button" by default.
10
+ *
11
+ * Whenever a button is clicked, the function `onClickButton` of the nearest CitricController is called with the event and the value of the
12
+ * prop `analytics`.
13
+ *
14
+ * @example
15
+ * ```
16
+ * <Button>My Button</MyButton>
17
+ * ```
18
+ */
8
19
  export const Button = withRef(({ appearance, size, feedback, loading, disabled, onClick, className, children, type = 'button', analytics, ...props }) => {
9
20
  const citric = useCitricController();
10
21
  const [waiting, setWaiting] = useState(false);
11
22
  const busy = loading || waiting;
23
+ const isAllLowercase = useMemo(() => !Children.toArray(children).some(c => typeof c === 'string' && c.toLocaleLowerCase() !== c), [children]);
12
24
  async function handleClick(e) {
13
25
  const result = onClick?.(e);
14
26
  citric?.onClickButton?.(e, analytics ?? false);
@@ -21,6 +33,6 @@ export const Button = withRef(({ appearance, size, feedback, loading, disabled,
21
33
  setWaiting(false);
22
34
  }
23
35
  }
24
- return (_jsxs(CitricComponent, { tag: "button", component: "button", className: listToClass([size, appearance, className]), "data-feedback": feedback || undefined, onClick: handleClick, "aria-busy": busy, disabled: disabled || busy, type: type, ...props, children: [busy ? _jsx("div", { children: children }) : children, busy && (_jsx("div", { className: "loader", children: _jsx(ProgressCircular, { size: "sm" }) }))] }));
36
+ return (_jsxs(CitricComponent, { tag: "button", component: "button", className: listToClass([size, appearance, isAllLowercase && 'short-text', className]), "data-feedback": feedback || undefined, onClick: handleClick, "aria-busy": busy, disabled: disabled || busy, type: type, ...props, children: [busy ? _jsx("div", { children: children }) : children, busy && (_jsx("div", { className: "loader", children: _jsx(ProgressCircular, { size: "sm" }) }))] }));
25
37
  });
26
38
  //# sourceMappingURL=Button.js.map