aidos-ui 4.0.4 → 4.0.6

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 (376) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -3
  3. package/dist/index.d.ts +801 -68
  4. package/dist/index.js +3934 -68
  5. package/dist/index.js.map +1 -1
  6. package/dist/jsx-dev-runtime.d.ts +6 -2
  7. package/dist/jsx-dev-runtime.js +87 -42
  8. package/dist/jsx-dev-runtime.js.map +1 -1
  9. package/dist/jsx-runtime.d.ts +1 -1
  10. package/dist/jsx-runtime.js +2 -2
  11. package/dist/jsx-runtime.js.map +1 -1
  12. package/dist/vite-plugin-jss-debug.d.ts +3 -1
  13. package/dist/vite-plugin-jss-debug.js +57 -74
  14. package/dist/vite-plugin-jss-debug.js.map +1 -1
  15. package/package.json +61 -27
  16. package/.prettierrc +0 -4
  17. package/CLAUDE.md +0 -72
  18. package/dist/Badge.d.ts +0 -6
  19. package/dist/Badge.js +0 -22
  20. package/dist/Badge.js.map +0 -1
  21. package/dist/BaseButton.d.ts +0 -14
  22. package/dist/BaseButton.js +0 -23
  23. package/dist/BaseButton.js.map +0 -1
  24. package/dist/BaseInput.d.ts +0 -14
  25. package/dist/BaseInput.js +0 -15
  26. package/dist/BaseInput.js.map +0 -1
  27. package/dist/BaseLink.d.ts +0 -18
  28. package/dist/BaseLink.js +0 -29
  29. package/dist/BaseLink.js.map +0 -1
  30. package/dist/BaseList.d.ts +0 -6
  31. package/dist/BaseList.js +0 -14
  32. package/dist/BaseList.js.map +0 -1
  33. package/dist/BaseListAddOn.d.ts +0 -5
  34. package/dist/BaseListAddOn.js +0 -7
  35. package/dist/BaseListAddOn.js.map +0 -1
  36. package/dist/BaseListItem.d.ts +0 -26
  37. package/dist/BaseListItem.js +0 -29
  38. package/dist/BaseListItem.js.map +0 -1
  39. package/dist/BaseView.d.ts +0 -12
  40. package/dist/BaseView.js +0 -26
  41. package/dist/BaseView.js.map +0 -1
  42. package/dist/Box.d.ts +0 -4
  43. package/dist/Box.js +0 -6
  44. package/dist/Box.js.map +0 -1
  45. package/dist/Button.d.ts +0 -20
  46. package/dist/Button.js +0 -19
  47. package/dist/Button.js.map +0 -1
  48. package/dist/Calendar.d.ts +0 -18
  49. package/dist/Calendar.js +0 -57
  50. package/dist/Calendar.js.map +0 -1
  51. package/dist/Card.d.ts +0 -4
  52. package/dist/Card.js +0 -14
  53. package/dist/Card.js.map +0 -1
  54. package/dist/Checkbox.d.ts +0 -11
  55. package/dist/Checkbox.js +0 -32
  56. package/dist/Checkbox.js.map +0 -1
  57. package/dist/Circle.d.ts +0 -5
  58. package/dist/Circle.js +0 -12
  59. package/dist/Circle.js.map +0 -1
  60. package/dist/Column.d.ts +0 -6
  61. package/dist/Column.js +0 -7
  62. package/dist/Column.js.map +0 -1
  63. package/dist/DarkMode.d.ts +0 -13
  64. package/dist/DarkMode.js +0 -62
  65. package/dist/DarkMode.js.map +0 -1
  66. package/dist/DateInput.d.ts +0 -13
  67. package/dist/DateInput.js +0 -29
  68. package/dist/DateInput.js.map +0 -1
  69. package/dist/DatePicker.d.ts +0 -11
  70. package/dist/DatePicker.js +0 -34
  71. package/dist/DatePicker.js.map +0 -1
  72. package/dist/DatetimeInput.d.ts +0 -13
  73. package/dist/DatetimeInput.js +0 -31
  74. package/dist/DatetimeInput.js.map +0 -1
  75. package/dist/DesignBook.d.ts +0 -1
  76. package/dist/DesignBook.js +0 -55
  77. package/dist/DesignBook.js.map +0 -1
  78. package/dist/Dialog.d.ts +0 -17
  79. package/dist/Dialog.js +0 -92
  80. package/dist/Dialog.js.map +0 -1
  81. package/dist/Dropdown.d.ts +0 -14
  82. package/dist/Dropdown.js +0 -65
  83. package/dist/Dropdown.js.map +0 -1
  84. package/dist/Emitter.d.ts +0 -6
  85. package/dist/Emitter.js +0 -19
  86. package/dist/Emitter.js.map +0 -1
  87. package/dist/FlexLayout.d.ts +0 -11
  88. package/dist/FlexLayout.js +0 -18
  89. package/dist/FlexLayout.js.map +0 -1
  90. package/dist/Icon.d.ts +0 -12
  91. package/dist/Icon.js +0 -60
  92. package/dist/Icon.js.map +0 -1
  93. package/dist/IconButton.d.ts +0 -11
  94. package/dist/IconButton.js +0 -34
  95. package/dist/IconButton.js.map +0 -1
  96. package/dist/IconLink.d.ts +0 -9
  97. package/dist/IconLink.js +0 -32
  98. package/dist/IconLink.js.map +0 -1
  99. package/dist/IconType.d.ts +0 -1
  100. package/dist/IconType.js +0 -2
  101. package/dist/IconType.js.map +0 -1
  102. package/dist/Interactable.d.ts +0 -50
  103. package/dist/Interactable.js +0 -169
  104. package/dist/Interactable.js.map +0 -1
  105. package/dist/JSSComment.d.ts +0 -10
  106. package/dist/JSSComment.js +0 -52
  107. package/dist/JSSComment.js.map +0 -1
  108. package/dist/Link.d.ts +0 -22
  109. package/dist/Link.js +0 -29
  110. package/dist/Link.js.map +0 -1
  111. package/dist/List.d.ts +0 -15
  112. package/dist/List.js +0 -29
  113. package/dist/List.js.map +0 -1
  114. package/dist/ListButtonItem.d.ts +0 -14
  115. package/dist/ListButtonItem.js +0 -11
  116. package/dist/ListButtonItem.js.map +0 -1
  117. package/dist/ListDivider.d.ts +0 -1
  118. package/dist/ListDivider.js +0 -12
  119. package/dist/ListDivider.js.map +0 -1
  120. package/dist/ListHeaderItem.d.ts +0 -10
  121. package/dist/ListHeaderItem.js +0 -15
  122. package/dist/ListHeaderItem.js.map +0 -1
  123. package/dist/ListItem.d.ts +0 -9
  124. package/dist/ListItem.js +0 -9
  125. package/dist/ListItem.js.map +0 -1
  126. package/dist/ListLinkItem.d.ts +0 -16
  127. package/dist/ListLinkItem.js +0 -11
  128. package/dist/ListLinkItem.js.map +0 -1
  129. package/dist/ListSpacer.d.ts +0 -1
  130. package/dist/ListSpacer.js +0 -13
  131. package/dist/ListSpacer.js.map +0 -1
  132. package/dist/MenuIcon.d.ts +0 -5
  133. package/dist/MenuIcon.js +0 -31
  134. package/dist/MenuIcon.js.map +0 -1
  135. package/dist/NextJSRouter.d.ts +0 -1
  136. package/dist/NextJSRouter.js +0 -37
  137. package/dist/NextJSRouter.js.map +0 -1
  138. package/dist/NextJSRouterState.d.ts +0 -38
  139. package/dist/NextJSRouterState.js +0 -111
  140. package/dist/NextJSRouterState.js.map +0 -1
  141. package/dist/OnVisible.d.ts +0 -5
  142. package/dist/OnVisible.js +0 -28
  143. package/dist/OnVisible.js.map +0 -1
  144. package/dist/Popover.d.ts +0 -22
  145. package/dist/Popover.js +0 -90
  146. package/dist/Popover.js.map +0 -1
  147. package/dist/ProgressBar.d.ts +0 -7
  148. package/dist/ProgressBar.js +0 -42
  149. package/dist/ProgressBar.js.map +0 -1
  150. package/dist/ProgressCircle.d.ts +0 -5
  151. package/dist/ProgressCircle.js +0 -12
  152. package/dist/ProgressCircle.js.map +0 -1
  153. package/dist/Providers.d.ts +0 -9
  154. package/dist/Providers.js +0 -16
  155. package/dist/Providers.js.map +0 -1
  156. package/dist/RangeInput.d.ts +0 -14
  157. package/dist/RangeInput.js +0 -32
  158. package/dist/RangeInput.js.map +0 -1
  159. package/dist/ResultOrError.d.ts +0 -13
  160. package/dist/ResultOrError.js +0 -7
  161. package/dist/ResultOrError.js.map +0 -1
  162. package/dist/RootView.d.ts +0 -5
  163. package/dist/RootView.js +0 -35
  164. package/dist/RootView.js.map +0 -1
  165. package/dist/Row.d.ts +0 -6
  166. package/dist/Row.js +0 -7
  167. package/dist/Row.js.map +0 -1
  168. package/dist/Select.d.ts +0 -9
  169. package/dist/Select.js +0 -17
  170. package/dist/Select.js.map +0 -1
  171. package/dist/StackContext.d.ts +0 -8
  172. package/dist/StackContext.js +0 -25
  173. package/dist/StackContext.js.map +0 -1
  174. package/dist/StaticCheckbox.d.ts +0 -16
  175. package/dist/StaticCheckbox.js +0 -48
  176. package/dist/StaticCheckbox.js.map +0 -1
  177. package/dist/Storage.d.ts +0 -13
  178. package/dist/Storage.js +0 -146
  179. package/dist/Storage.js.map +0 -1
  180. package/dist/Stream.d.ts +0 -9
  181. package/dist/Stream.js +0 -36
  182. package/dist/Stream.js.map +0 -1
  183. package/dist/Sublist.d.ts +0 -12
  184. package/dist/Sublist.js +0 -18
  185. package/dist/Sublist.js.map +0 -1
  186. package/dist/SubmitIconInput.d.ts +0 -8
  187. package/dist/SubmitIconInput.js +0 -25
  188. package/dist/SubmitIconInput.js.map +0 -1
  189. package/dist/Tabs.d.ts +0 -23
  190. package/dist/Tabs.js +0 -39
  191. package/dist/Tabs.js.map +0 -1
  192. package/dist/Text.d.ts +0 -25
  193. package/dist/Text.js +0 -52
  194. package/dist/Text.js.map +0 -1
  195. package/dist/TextArea.d.ts +0 -11
  196. package/dist/TextArea.js +0 -27
  197. package/dist/TextArea.js.map +0 -1
  198. package/dist/TextInput.d.ts +0 -15
  199. package/dist/TextInput.js +0 -61
  200. package/dist/TextInput.js.map +0 -1
  201. package/dist/TextInputWithState.d.ts +0 -8
  202. package/dist/TextInputWithState.js +0 -14
  203. package/dist/TextInputWithState.js.map +0 -1
  204. package/dist/TextPairing.d.ts +0 -21
  205. package/dist/TextPairing.js +0 -26
  206. package/dist/TextPairing.js.map +0 -1
  207. package/dist/TimeInput.d.ts +0 -15
  208. package/dist/TimeInput.js +0 -58
  209. package/dist/TimeInput.js.map +0 -1
  210. package/dist/Tooltip.d.ts +0 -11
  211. package/dist/Tooltip.js +0 -73
  212. package/dist/Tooltip.js.map +0 -1
  213. package/dist/aria.d.ts +0 -8
  214. package/dist/aria.js +0 -42
  215. package/dist/aria.js.map +0 -1
  216. package/dist/guid.d.ts +0 -1
  217. package/dist/guid.js +0 -7
  218. package/dist/guid.js.map +0 -1
  219. package/dist/hash.d.ts +0 -1
  220. package/dist/hash.js +0 -20
  221. package/dist/hash.js.map +0 -1
  222. package/dist/isServer.d.ts +0 -1
  223. package/dist/isServer.js +0 -4
  224. package/dist/isServer.js.map +0 -1
  225. package/dist/jss.d.ts +0 -122
  226. package/dist/jss.js +0 -515
  227. package/dist/jss.js.map +0 -1
  228. package/dist/numberToBase.d.ts +0 -1
  229. package/dist/numberToBase.js +0 -44
  230. package/dist/numberToBase.js.map +0 -1
  231. package/dist/stateMachineContextFactory.d.ts +0 -36
  232. package/dist/stateMachineContextFactory.js +0 -48
  233. package/dist/stateMachineContextFactory.js.map +0 -1
  234. package/dist/useCookie.d.ts +0 -9
  235. package/dist/useCookie.js +0 -67
  236. package/dist/useCookie.js.map +0 -1
  237. package/dist/useKeyboard.d.ts +0 -8
  238. package/dist/useKeyboard.js +0 -26
  239. package/dist/useKeyboard.js.map +0 -1
  240. package/dist/useNavigation.d.ts +0 -5
  241. package/dist/useNavigation.js +0 -79
  242. package/dist/useNavigation.js.map +0 -1
  243. package/dist/usePromise.d.ts +0 -1
  244. package/dist/usePromise.js +0 -12
  245. package/dist/usePromise.js.map +0 -1
  246. package/dist/useRefEffect.d.ts +0 -1
  247. package/dist/useRefEffect.js +0 -15
  248. package/dist/useRefEffect.js.map +0 -1
  249. package/jss-debug-loader.mjs +0 -44
  250. package/next-env.d.ts +0 -6
  251. package/next.config.js +0 -33
  252. package/scripts/embeddings.js +0 -93
  253. package/scripts/openai_embeddings.js +0 -100
  254. package/scripts/publish.js +0 -28
  255. package/scripts/test_embeddings.js +0 -47
  256. package/src/Badge.tsx +0 -36
  257. package/src/BaseButton.tsx +0 -62
  258. package/src/BaseInput.tsx +0 -63
  259. package/src/BaseLink.tsx +0 -80
  260. package/src/BaseList.tsx +0 -26
  261. package/src/BaseListAddOn.tsx +0 -10
  262. package/src/BaseListItem.tsx +0 -119
  263. package/src/BaseView.tsx +0 -57
  264. package/src/Box.tsx +0 -20
  265. package/src/Button.tsx +0 -90
  266. package/src/Calendar.tsx +0 -123
  267. package/src/Card.tsx +0 -30
  268. package/src/Checkbox.tsx +0 -63
  269. package/src/Circle.tsx +0 -24
  270. package/src/Column.tsx +0 -12
  271. package/src/DarkMode.tsx +0 -100
  272. package/src/DateInput.tsx +0 -63
  273. package/src/DatePicker.tsx +0 -67
  274. package/src/DatetimeInput.tsx +0 -64
  275. package/src/DesignBook.tsx +0 -677
  276. package/src/Dialog.tsx +0 -150
  277. package/src/Dropdown.tsx +0 -146
  278. package/src/Emitter.ts +0 -26
  279. package/src/FlexLayout.tsx +0 -53
  280. package/src/Icon.tsx +0 -80
  281. package/src/IconButton.tsx +0 -81
  282. package/src/IconLink.tsx +0 -59
  283. package/src/IconType.ts +0 -787
  284. package/src/Interactable.tsx +0 -210
  285. package/src/JSSComment.tsx +0 -56
  286. package/src/Link.tsx +0 -110
  287. package/src/List.tsx +0 -58
  288. package/src/ListButtonItem.tsx +0 -69
  289. package/src/ListDivider.tsx +0 -13
  290. package/src/ListHeaderItem.tsx +0 -45
  291. package/src/ListItem.tsx +0 -24
  292. package/src/ListLinkItem.tsx +0 -76
  293. package/src/ListSpacer.tsx +0 -14
  294. package/src/MenuIcon.tsx +0 -50
  295. package/src/NextJSRouter.tsx +0 -60
  296. package/src/NextJSRouterState.tsx +0 -154
  297. package/src/OnVisible.tsx +0 -42
  298. package/src/Popover.tsx +0 -145
  299. package/src/ProgressBar.tsx +0 -63
  300. package/src/ProgressCircle.tsx +0 -38
  301. package/src/Providers.tsx +0 -33
  302. package/src/RangeInput.tsx +0 -82
  303. package/src/ResultOrError.ts +0 -15
  304. package/src/RootView.tsx +0 -55
  305. package/src/Row.tsx +0 -12
  306. package/src/Select.tsx +0 -39
  307. package/src/StackContext.tsx +0 -52
  308. package/src/StaticCheckbox.tsx +0 -72
  309. package/src/Storage.tsx +0 -198
  310. package/src/Stream.tsx +0 -50
  311. package/src/Sublist.tsx +0 -61
  312. package/src/SubmitIconInput.tsx +0 -45
  313. package/src/Tabs.tsx +0 -110
  314. package/src/Text.tsx +0 -111
  315. package/src/TextArea.tsx +0 -58
  316. package/src/TextInput.tsx +0 -123
  317. package/src/TextInputWithState.tsx +0 -32
  318. package/src/TextPairing.tsx +0 -115
  319. package/src/TimeInput.tsx +0 -109
  320. package/src/Tooltip.tsx +0 -109
  321. package/src/aria.ts +0 -72
  322. package/src/docs/mdx.tsx +0 -137
  323. package/src/docs/pages.ts +0 -115
  324. package/src/docs/searchIndex.ts +0 -1
  325. package/src/examples/ExampleDialog.tsx +0 -28
  326. package/src/guid.ts +0 -7
  327. package/src/hash.ts +0 -21
  328. package/src/index.ts +0 -68
  329. package/src/isServer.ts +0 -3
  330. package/src/jss.tsx +0 -712
  331. package/src/jsx-dev-runtime.ts +0 -74
  332. package/src/jsx-runtime.ts +0 -2
  333. package/src/numberToBase.ts +0 -52
  334. package/src/pages/Badge.mdx +0 -152
  335. package/src/pages/Button.mdx +0 -163
  336. package/src/pages/Calendar.mdx +0 -254
  337. package/src/pages/Card.mdx +0 -147
  338. package/src/pages/Checkbox.mdx +0 -131
  339. package/src/pages/Dialog.mdx +0 -197
  340. package/src/pages/FlexLayout.mdx +0 -211
  341. package/src/pages/Hashing.mdx +0 -211
  342. package/src/pages/Icon.mdx +0 -171
  343. package/src/pages/IconButton.mdx +0 -155
  344. package/src/pages/Link.mdx +0 -160
  345. package/src/pages/List.mdx +0 -262
  346. package/src/pages/ListHeader.mdx +0 -220
  347. package/src/pages/Popover.mdx +0 -223
  348. package/src/pages/ProgressBar.mdx +0 -200
  349. package/src/pages/ProgressCircle.mdx +0 -218
  350. package/src/pages/RangeInput.mdx +0 -237
  351. package/src/pages/Tabs.mdx +0 -281
  352. package/src/pages/Text.mdx +0 -154
  353. package/src/pages/TextInput.mdx +0 -235
  354. package/src/pages/TextPairing.mdx +0 -204
  355. package/src/pages/TimeInput.mdx +0 -178
  356. package/src/pages/Tooltip.mdx +0 -115
  357. package/src/pages/_app.tsx +0 -466
  358. package/src/pages/_document.tsx +0 -30
  359. package/src/pages/css-in-js.mdx +0 -240
  360. package/src/pages/index.mdx +0 -58
  361. package/src/pages/navigation.mdx +0 -158
  362. package/src/pages/prism.css +0 -3
  363. package/src/pages/useCookie.mdx +0 -176
  364. package/src/pages/useKeyboard.mdx +0 -257
  365. package/src/pages/useNavigation.mdx +0 -258
  366. package/src/pages/usePromise.mdx +0 -280
  367. package/src/pages/useRefEffect.mdx +0 -251
  368. package/src/stateMachineContextFactory.tsx +0 -111
  369. package/src/useCookie.tsx +0 -95
  370. package/src/useKeyboard.tsx +0 -43
  371. package/src/useNavigation.tsx +0 -89
  372. package/src/usePromise.tsx +0 -18
  373. package/src/useRefEffect.tsx +0 -18
  374. package/src/vite-plugin-jss-debug.ts +0 -77
  375. package/tsconfig.build.json +0 -23
  376. package/tsconfig.json +0 -38
package/dist/index.js CHANGED
@@ -1,69 +1,3935 @@
1
- export * from "./Badge";
2
- export * from "./BaseButton";
3
- export * from "./BaseInput";
4
- export * from "./BaseLink";
5
- export * from "./BaseList";
6
- export * from "./BaseListAddOn";
7
- export * from "./BaseListItem";
8
- export * from "./BaseView";
9
- export * from "./Box";
10
- export * from "./Button";
11
- export * from "./Calendar";
12
- export * from "./Card";
13
- export * from "./Checkbox";
14
- export * from "./Circle";
15
- export * from "./Column";
16
- export * from "./DarkMode";
17
- export * from "./DateInput";
18
- export * from "./DatePicker";
19
- export * from "./DatetimeInput";
20
- export * from "./Dialog";
21
- export * from "./Dropdown";
22
- export * from "./Emitter";
23
- export * from "./FlexLayout";
24
- export * from "./guid";
25
- export * from "./Icon";
26
- export * from "./IconButton";
27
- export * from "./IconLink";
28
- export * from "./IconType";
29
- export * from "./jss";
30
- export * from "./Link";
31
- export * from "./List";
32
- export * from "./ListButtonItem";
33
- export * from "./ListDivider";
34
- export * from "./ListHeaderItem";
35
- export * from "./ListItem";
36
- export * from "./ListLinkItem";
37
- export * from "./ListSpacer";
38
- export * from "./MenuIcon";
39
- export * from "./numberToBase";
40
- export * from "./OnVisible";
41
- export * from "./Popover";
42
- export * from "./ProgressBar";
43
- export * from "./ProgressCircle";
44
- export * from "./Providers";
45
- export * from "./RangeInput";
46
- export * from "./RootView";
47
- export * from "./Row";
48
- export * from "./Select";
49
- export * from "./StackContext";
50
- export * from "./stateMachineContextFactory";
51
- export * from "./StaticCheckbox";
52
- export * from "./Storage";
53
- export * from "./Stream";
54
- export * from "./Sublist";
55
- export * from "./SubmitIconInput";
56
- export * from "./Tabs";
57
- export * from "./Text";
58
- export * from "./TextArea";
59
- export * from "./TextInput";
60
- export * from "./TextInputWithState";
61
- export * from "./TextPairing";
62
- export * from "./TimeInput";
63
- export * from "./TimeInput";
64
- export * from "./Tooltip";
65
- export * from "./useCookie";
66
- export * from "./useNavigation";
67
- export * from "./usePromise";
68
- export * from "./useRefEffect";
1
+ import React34, { useId, useContext, useMemo, cloneElement, forwardRef, useRef, useCallback, useEffect, useState, createContext, startTransition } from 'react';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { Icon as Icon$1 } from '@iconify/react';
4
+
5
+ // src/BaseView.tsx
6
+
7
+ // src/hash.ts
8
+ function hash(source, modulus) {
9
+ let hash2 = 0;
10
+ let i;
11
+ let chr;
12
+ if (source.length === 0) {
13
+ return hash2;
14
+ }
15
+ for (i = 0; i < source.length; i++) {
16
+ chr = source.charCodeAt(i);
17
+ hash2 = (hash2 << 5) - hash2 + chr;
18
+ hash2 |= 0;
19
+ }
20
+ if (modulus) {
21
+ return Math.abs(hash2) % modulus;
22
+ } else {
23
+ return Math.abs(hash2);
24
+ }
25
+ }
26
+
27
+ // src/isServer.ts
28
+ function isServer() {
29
+ return typeof window === "undefined" || window.document == null;
30
+ }
31
+ var aliases = {
32
+ margin: (value) => {
33
+ if (value == null) {
34
+ return [];
35
+ }
36
+ const matches = typeof value === "string" ? Array.from(value.matchAll(/(.+) (.+)$/g))[0] : null;
37
+ if (matches) {
38
+ return [
39
+ ["margin-top", matches[1]],
40
+ ["margin-bottom", matches[1]],
41
+ ["margin-left", matches[2]],
42
+ ["margin-right", matches[2]]
43
+ ];
44
+ } else {
45
+ return [
46
+ ["margin-top", value],
47
+ ["margin-bottom", value],
48
+ ["margin-left", value],
49
+ ["margin-right", value]
50
+ ];
51
+ }
52
+ },
53
+ padding: (value) => {
54
+ if (value == null) {
55
+ return [];
56
+ }
57
+ const matches = typeof value === "string" ? Array.from(value.matchAll(/(.+) (.+)$/g))[0] : null;
58
+ if (matches) {
59
+ return [
60
+ ["padding-top", matches[1]],
61
+ ["padding-bottom", matches[1]],
62
+ ["padding-left", matches[2]],
63
+ ["padding-right", matches[2]]
64
+ ];
65
+ } else {
66
+ return [
67
+ ["padding-top", value],
68
+ ["padding-bottom", value],
69
+ ["padding-left", value],
70
+ ["padding-right", value]
71
+ ];
72
+ }
73
+ }
74
+ };
75
+ var rawHashMap = /* @__PURE__ */ new Map();
76
+ function createStyleNode(content) {
77
+ if (isServer()) {
78
+ serverStyles.push(content);
79
+ } else {
80
+ const style = document.createElement("style");
81
+ style.appendChild(document.createTextNode(content));
82
+ document.head.appendChild(style);
83
+ }
84
+ }
85
+ var pixelStyles = /* @__PURE__ */ new Set([
86
+ "min-height",
87
+ "height",
88
+ "max-height",
89
+ "min-width",
90
+ "width",
91
+ "max-width",
92
+ "margin",
93
+ "margin-top",
94
+ "margin-bottom",
95
+ "margin-left",
96
+ "margin-right",
97
+ "padding",
98
+ "padding-top",
99
+ "padding-bottom",
100
+ "padding-left",
101
+ "padding-right",
102
+ "border-radius",
103
+ "font-size",
104
+ "top",
105
+ "bottom",
106
+ "left",
107
+ "right",
108
+ "outline-offset",
109
+ "gap",
110
+ "row-gap",
111
+ "column-gap"
112
+ ]);
113
+ var toPixelValue = (key, value) => {
114
+ const sValue = value.toString();
115
+ if (sValue.includes("%") || sValue.includes("v") || sValue.includes("px") || sValue.includes("em") || sValue.includes("rem")) {
116
+ return sValue;
117
+ }
118
+ return pixelStyles.has(key) && Number.isInteger(parseInt(value, 10)) ? `${value}px` : value;
119
+ };
120
+ var getCSS = (key, value) => {
121
+ const cssProp = key.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
122
+ const cssValue = toPixelValue(cssProp, value);
123
+ return [cssProp, cssValue];
124
+ };
125
+ var flattenJSS = (jss) => {
126
+ if (!jss) {
127
+ return {};
128
+ } else if (Array.isArray(jss)) {
129
+ const result = {};
130
+ for (const item of jss) {
131
+ Object.assign(result, flattenJSS(item));
132
+ }
133
+ return result;
134
+ } else {
135
+ return jss;
136
+ }
137
+ };
138
+ var toClassnames = (jss, componentName) => {
139
+ jss = flattenJSS(jss);
140
+ const stylesStack = Object.entries(jss);
141
+ const classNames = [];
142
+ if (componentName) {
143
+ classNames.push(componentName);
144
+ }
145
+ while (stylesStack.length) {
146
+ const [key, value] = stylesStack.pop();
147
+ if (aliases[key]) {
148
+ stylesStack.push(...aliases[key](value));
149
+ continue;
150
+ }
151
+ const inputKey = key + JSON.stringify(value);
152
+ const rawHash = hash(inputKey).toString(32);
153
+ const cached = rawHashMap.get(rawHash);
154
+ if (cached != null) {
155
+ if (cached.key !== inputKey) {
156
+ console.warn(
157
+ `[jss] Hash collision detected: "${inputKey}" collides with "${cached.key}"`
158
+ );
159
+ }
160
+ classNames.push(cached.selector);
161
+ continue;
162
+ }
163
+ const selector = `x${rawHash}`;
164
+ rawHashMap.set(rawHash, { selector, key: inputKey });
165
+ classNames.push(selector);
166
+ if (typeof value === "number" || typeof value === "string") {
167
+ const [cssProp, cssValue] = getCSS(key, value);
168
+ createStyleNode(`.${selector} { ${cssProp}: ${cssValue}; }`);
169
+ } else if (typeof value === "object" && key.startsWith("@media")) {
170
+ const media = key;
171
+ const cssValue = Object.entries(value).map(([key2, value2]) => {
172
+ const [cssProp, cssValue2] = getCSS(key2, value2);
173
+ return `${cssProp}: ${cssValue2}; `;
174
+ }).join(" ");
175
+ createStyleNode(`${media} { .${selector} { ${cssValue} } }`);
176
+ } else if (typeof value === "object" && value != null) {
177
+ const cssValue = Object.entries(value).map(([key2, value2]) => {
178
+ const [cssProp, cssValue2] = getCSS(key2, value2);
179
+ return `${cssProp}: ${cssValue2}; `;
180
+ }).join(" ");
181
+ createStyleNode(`.${selector}${key} { ${cssValue} }`);
182
+ }
183
+ }
184
+ return classNames.join(" ");
185
+ };
186
+ var serverStyles = [];
187
+ function JSSProvider({
188
+ themes,
189
+ children
190
+ }) {
191
+ const stylesRef = useRef(null);
192
+ if (stylesRef.current == null) {
193
+ stylesRef.current = getBaseStyles(themes);
194
+ }
195
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
196
+ stylesRef.current.map((style, i) => /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: style } }, i)),
197
+ children
198
+ ] });
199
+ }
200
+ function JSServerStyles() {
201
+ const stylesRef = useRef(null);
202
+ if (stylesRef.current == null) {
203
+ stylesRef.current = serverStyles;
204
+ }
205
+ return /* @__PURE__ */ jsx(Fragment, { children: stylesRef.current.map((style, i) => /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: style } }, i)) });
206
+ }
207
+ function cssVar(string) {
208
+ return `var(${string})`;
209
+ }
210
+ var sizes = {
211
+ xsmall: cssVar("--spacing-xs"),
212
+ small: cssVar("--spacing-s"),
213
+ medium: cssVar("--spacing-m"),
214
+ large: cssVar("--spacing-l"),
215
+ xlarge: cssVar("--spacing-xl"),
216
+ xxlarge: cssVar("--spacing-xxl"),
217
+ xxxlarge: cssVar("--spacing-xxxl")
218
+ };
219
+ function getSize(size) {
220
+ return sizes[size];
221
+ }
222
+ function getSpacing(spacing) {
223
+ if (spacing === "none") {
224
+ return "0px";
225
+ } else {
226
+ return getSize(spacing);
227
+ }
228
+ }
229
+ function getPadding(padding) {
230
+ if (Array.isArray(padding)) {
231
+ const [vertical, horizontal] = padding;
232
+ return {
233
+ paddingTop: getSpacing(vertical),
234
+ paddingBottom: getSpacing(vertical),
235
+ paddingLeft: getSpacing(horizontal),
236
+ paddingRight: getSpacing(horizontal)
237
+ };
238
+ } else {
239
+ return {
240
+ padding: getSpacing(padding)
241
+ };
242
+ }
243
+ }
244
+ function getMargin(margin) {
245
+ if (Array.isArray(margin)) {
246
+ const [vertical, horizontal] = margin;
247
+ return {
248
+ marginTop: getSpacing(vertical),
249
+ marginBottom: getSpacing(vertical),
250
+ marginLeft: getSpacing(horizontal),
251
+ marginRight: getSpacing(horizontal)
252
+ };
253
+ } else {
254
+ return {
255
+ margin: getSpacing(margin)
256
+ };
257
+ }
258
+ }
259
+ var lightTheme = {
260
+ /* Background */
261
+ ["--overlay-background"]: "rgb(245, 246, 250)",
262
+ ["--primary-background"]: "rgb(239, 239, 244)",
263
+ ["--secondary-background"]: "rgb(232, 232, 234)",
264
+ ["--divider"]: "rgb(200, 200, 200)",
265
+ ["--strong-divider"]: "rgb(100, 100, 100)",
266
+ ["--pressed-background"]: "rgb(220, 222, 224)",
267
+ ["--hovered-background"]: "rgb(232, 235, 237)",
268
+ ["--selected-background"]: "rgb(227, 230, 232)",
269
+ ["--nav-bar"]: "rgb(232, 232, 234)",
270
+ /* Effects */
271
+ ["--warning"]: "rgb(255, 204, 0)",
272
+ ["--highlight"]: "rgb(0, 122, 255)",
273
+ ["--outline"]: "rgb(103, 176, 255)",
274
+ ["--light-highlight"]: "rgb(220, 232, 245)",
275
+ /* Text */
276
+ ["--primary-text"]: "rgb(0, 0, 0)",
277
+ ["--secondary-text"]: "rgb(100, 100, 100)",
278
+ ["--subtle-text"]: "rgb(180, 180, 180)",
279
+ ["--highlight-text"]: "rgb(0, 122, 255)",
280
+ ["--negative-text"]: "rgb(255, 59, 48)",
281
+ ["--light-text"]: "rgb(255, 255, 255)",
282
+ ["--font-xsmall"]: "8px",
283
+ ["--font-small"]: "12px",
284
+ ["--font-medium"]: "14px",
285
+ ["--font-large"]: "18px",
286
+ ["--font-xlarge"]: "22px",
287
+ ["--font-xxlarge"]: "26px",
288
+ ["--font-xxxlarge"]: "34px",
289
+ /* Buttons */
290
+ ["--background-button-positive"]: "rgb(0, 122, 255)",
291
+ ["--background-button-secondary"]: "rgb(218, 218, 223)",
292
+ ["--background-button-negative"]: "rgb(255, 59, 48)",
293
+ ["--background-button-disabled"]: "rgb(218, 218, 223)",
294
+ /* Spacing */
295
+ ["--spacing-xs"]: "2px",
296
+ ["--spacing-s"]: "4px",
297
+ ["--spacing-m"]: "8px",
298
+ ["--spacing-l"]: "12px",
299
+ ["--spacing-xl"]: "16px",
300
+ ["--spacing-xxl"]: "24px",
301
+ ["--spacing-xxxl"]: "32px",
302
+ ["--border-radius-s"]: "2px",
303
+ ["--border-radius-m"]: "4px",
304
+ ["--border-radius-l"]: "8px",
305
+ ["--nav-bar-height"]: "50px",
306
+ /* Shadows */
307
+ ["--shadow-sm"]: "0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1)",
308
+ ["--shadow-md"]: "0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05)",
309
+ ["--shadow-lg"]: "0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1)",
310
+ /* Transitions */
311
+ ["--transition-fast"]: "0.15s ease",
312
+ ["--transition-normal"]: "0.2s ease"
313
+ };
314
+ var darkTheme = {
315
+ /* Background */
316
+ ["--overlay-background"]: "rgb(35, 36, 37)",
317
+ ["--primary-background"]: "rgb(42, 43, 46)",
318
+ ["--secondary-background"]: "rgb(65, 66, 67)",
319
+ ["--divider"]: "rgb(70, 72, 73)",
320
+ ["--strong-divider"]: "rgb(100, 100, 100)",
321
+ ["--pressed-background"]: "rgb(90, 92, 93)",
322
+ ["--hovered-background"]: "rgb(50, 53, 54)",
323
+ ["--selected-background"]: "rgb(65, 68, 69)",
324
+ ["--nav-bar"]: "rgb(34, 35, 36)",
325
+ /* Effects */
326
+ ["--warning"]: "rgb(255, 204, 0)",
327
+ ["--highlight"]: "rgb(50, 140, 220)",
328
+ ["--outline"]: "rgb(91, 170, 255)",
329
+ ["--light-highlight"]: "rgba(49, 57, 63)",
330
+ /* Text */
331
+ ["--primary-text"]: "rgb(255, 255, 255)",
332
+ ["--secondary-text"]: "rgb(200, 200, 200)",
333
+ ["--subtle-text"]: "rgb(140, 140, 140)",
334
+ ["--highlight-text"]: "#4ca7f8",
335
+ ["--negative-text"]: "rgb(255, 59, 48)",
336
+ ["--light-text"]: "rgb(255, 255, 255)",
337
+ ["--font-xsmall"]: "8px",
338
+ ["--font-small"]: "12px",
339
+ ["--font-medium"]: "14px",
340
+ ["--font-large"]: "18px",
341
+ ["--font-xlarge"]: "22px",
342
+ ["--font-xxlarge"]: "26px",
343
+ ["--font-xxxlarge"]: "34px",
344
+ /* Buttons */
345
+ ["--background-button-positive"]: "rgb(50, 140, 220)",
346
+ ["--background-button-secondary"]: "rgb(82, 83, 86)",
347
+ ["--background-button-negative"]: "rgb(255, 59, 48)",
348
+ ["--background-button-disabled"]: "rgb(70, 72, 73)",
349
+ /* Spacing */
350
+ ["--spacing-xs"]: "2px",
351
+ ["--spacing-s"]: "4px",
352
+ ["--spacing-m"]: "8px",
353
+ ["--spacing-l"]: "12px",
354
+ ["--spacing-xl"]: "16px",
355
+ ["--spacing-xxl"]: "24px",
356
+ ["--spacing-xxxl"]: "32px",
357
+ ["--border-radius-s"]: "2px",
358
+ ["--border-radius-m"]: "4px",
359
+ ["--border-radius-l"]: "8px",
360
+ ["--nav-bar-height"]: "50px",
361
+ /* Shadows - stronger for dark mode to be visible */
362
+ ["--shadow-sm"]: "0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3)",
363
+ ["--shadow-md"]: "0 4px 6px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2)",
364
+ ["--shadow-lg"]: "0 10px 25px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.25)",
365
+ /* Transitions */
366
+ ["--transition-fast"]: "0.15s ease",
367
+ ["--transition-normal"]: "0.2s ease"
368
+ };
369
+ var baseStyles = `
370
+ * {
371
+ box-sizing: border-box;
372
+ border: none;
373
+ touch-action: manipulation;
374
+ -webkit-font-smoothing: antialiased;
375
+ -moz-osx-font-smoothing: grayscale;
376
+ }
377
+
378
+ *:focus {
379
+ outline-color: ${cssVar("--highlight")};
380
+ }
381
+
382
+ html,
383
+ body {
384
+ margin: 0;
385
+ height: 100%;
386
+ width: 100%;
387
+ overflow: hidden;
388
+ background-color: ${cssVar("--primary-background")};
389
+ }
390
+
391
+ @keyframes dialogFadeIn {
392
+ from {
393
+ opacity: 0;
394
+ transform: scale(0.95) translateY(-10px);
395
+ }
396
+ to {
397
+ opacity: 1;
398
+ transform: scale(1) translateY(0);
399
+ }
400
+ }
401
+
402
+ @keyframes backdropFadeIn {
403
+ from {
404
+ opacity: 0;
405
+ }
406
+ to {
407
+ opacity: 1;
408
+ }
409
+ }
410
+
411
+ @keyframes popoverFadeIn {
412
+ from {
413
+ opacity: 0;
414
+ transform: scale(0.95);
415
+ }
416
+ to {
417
+ opacity: 1;
418
+ transform: scale(1);
419
+ }
420
+ }
421
+
422
+ `;
423
+ var backgroundStyles = {
424
+ highlight: {
425
+ backgroundColor: cssVar("--highlight")
426
+ },
427
+ light: {
428
+ backgroundColor: cssVar("--light-text")
429
+ },
430
+ dark: {
431
+ backgroundColor: cssVar("--primary-text")
432
+ },
433
+ warning: {
434
+ backgroundColor: cssVar("--warning")
435
+ },
436
+ "primary-background": {
437
+ backgroundColor: cssVar("--primary-background")
438
+ },
439
+ negative: {
440
+ backgroundColor: cssVar("--negative-text")
441
+ },
442
+ "secondary-background": {
443
+ backgroundColor: cssVar("--secondary-background")
444
+ },
445
+ divider: {
446
+ backgroundColor: cssVar("--divider")
447
+ },
448
+ inherit: {
449
+ backgroundColor: "inherit"
450
+ }
451
+ };
452
+ var getBackground = (color) => {
453
+ return backgroundStyles[color];
454
+ };
455
+ var MOBILE = 750;
456
+ var TABLET = 1e3;
457
+ var LAPTOP = 1200;
458
+ var MOBILE_MEDIA = `@media (min-width: 0px) and (max-width: ${MOBILE}px)`;
459
+ var TABLET_MEDIA = `@media (min-width: ${MOBILE}px) and (max-width: ${TABLET}px)`;
460
+ var LAPTOP_MEDIA = `@media (min-width: ${TABLET}px) and (max-width: ${LAPTOP}px)`;
461
+ var DESKTOP_MEDIA = `@media (min-width: ${LAPTOP}px)`;
462
+ function mobile(jss) {
463
+ return {
464
+ [MOBILE_MEDIA]: jss
465
+ };
466
+ }
467
+ function tablet(jss) {
468
+ return {
469
+ [TABLET_MEDIA]: jss
470
+ };
471
+ }
472
+ function laptop(jss) {
473
+ return {
474
+ [LAPTOP_MEDIA]: jss
475
+ };
476
+ }
477
+ function desktop(jss) {
478
+ return {
479
+ [DESKTOP_MEDIA]: jss
480
+ };
481
+ }
482
+ var textColorStyles = {
483
+ primary: {
484
+ color: cssVar("--primary-text")
485
+ },
486
+ secondary: {
487
+ color: cssVar("--secondary-text")
488
+ },
489
+ highlight: {
490
+ color: cssVar("--highlight-text")
491
+ },
492
+ negative: {
493
+ color: cssVar("--negative-text")
494
+ },
495
+ subtle: {
496
+ color: cssVar("--subtle-text")
497
+ },
498
+ light: {
499
+ color: cssVar("--light-text")
500
+ },
501
+ inherit: {
502
+ color: "inherit"
503
+ }
504
+ };
505
+ var getTextColor = (color) => {
506
+ return textColorStyles[color];
507
+ };
508
+ function getBaseStyles(themes) {
509
+ const css = [];
510
+ css.push(baseStyles);
511
+ css.push(`body {
512
+ color-scheme: light;
513
+ ${Object.entries(themes.light).map(([key, value]) => `${key}: ${value};`).join("\n ")}
514
+ }`);
515
+ css.push(`body.dark-mode {
516
+ color-scheme: dark;
517
+ ${Object.entries(themes.dark).map(([key, value]) => `${key}: ${value};`).join("\n ")}
518
+ }`);
519
+ return css;
520
+ }
521
+ var styles = {
522
+ relative: {
523
+ position: "relative"
524
+ },
525
+ grow: {
526
+ flexGrow: 1
527
+ },
528
+ shrink: {
529
+ flexShrink: 1
530
+ }
531
+ };
532
+ var BaseView = React34.forwardRef(
533
+ ({
534
+ jss,
535
+ children,
536
+ tag,
537
+ grow,
538
+ shrink,
539
+ relative,
540
+ ...otherProps
541
+ }, ref) => {
542
+ const Tag = tag ?? "div";
543
+ return (
544
+ // @ts-ignore
545
+ /* @__PURE__ */ jsx(
546
+ Tag,
547
+ {
548
+ ref,
549
+ className: toClassnames([
550
+ jss,
551
+ grow && styles.grow,
552
+ shrink && styles.shrink,
553
+ relative && styles.relative
554
+ ]),
555
+ ...otherProps,
556
+ children
557
+ }
558
+ )
559
+ );
560
+ }
561
+ );
562
+ var sizes2 = {
563
+ xsmall: 4,
564
+ small: 6,
565
+ medium: 12,
566
+ large: 18,
567
+ xlarge: 24,
568
+ xxlarge: 32,
569
+ xxxlarge: 40
570
+ };
571
+ function Badge({
572
+ size = "medium",
573
+ color = "highlight",
574
+ jss
575
+ }) {
576
+ return /* @__PURE__ */ jsx(
577
+ BaseView,
578
+ {
579
+ jss: [
580
+ {
581
+ width: sizes2[size],
582
+ height: sizes2[size],
583
+ borderRadius: sizes2[size] / 2
584
+ },
585
+ getBackground(color),
586
+ jss
587
+ ]
588
+ }
589
+ );
590
+ }
591
+
592
+ // src/Interactable.tsx
593
+ var styles2 = {
594
+ root: {
595
+ cursor: "pointer",
596
+ display: "inline-flex",
597
+ alignItems: "center",
598
+ transition: "opacity 0.1s ease-in",
599
+ outlineColor: cssVar("--outline"),
600
+ "[aria-disabled=true]": {
601
+ color: cssVar("--secondary-text"),
602
+ backgroundColor: cssVar("--background-button-secondary")
603
+ },
604
+ ":focus-visible": {
605
+ outlineWidth: "2px",
606
+ outlineStyle: "solid",
607
+ outlineOffset: -2
608
+ }
609
+ },
610
+ dark: {
611
+ backgroundColor: "black",
612
+ "[aria-disabled=true]": {
613
+ backgroundColor: cssVar("--background-button-disabled")
614
+ }
615
+ },
616
+ light: {
617
+ backgroundColor: "white",
618
+ "[aria-disabled=true]": {
619
+ backgroundColor: cssVar("--background-button-disabled")
620
+ }
621
+ },
622
+ positive: {
623
+ backgroundColor: cssVar("--background-button-positive"),
624
+ "[aria-disabled=true]": {
625
+ backgroundColor: cssVar("--background-button-disabled")
626
+ }
627
+ },
628
+ primary: {
629
+ backgroundColor: cssVar("--background-button-secondary"),
630
+ "[aria-disabled=true]": {
631
+ backgroundColor: cssVar("--background-button-disabled")
632
+ }
633
+ },
634
+ negative: {
635
+ backgroundColor: cssVar("--background-button-negative"),
636
+ "[aria-disabled=true]": {
637
+ backgroundColor: cssVar("--background-button-disabled")
638
+ }
639
+ },
640
+ disabled: {
641
+ cursor: "default"
642
+ },
643
+ bare: {
644
+ backgroundColor: "inherit",
645
+ outlineColor: cssVar("--outline"),
646
+ "[aria-disabled=true]": {
647
+ backgroundColor: "inherit"
648
+ },
649
+ "[aria-disabled=true]:hover": {
650
+ backgroundColor: "inherit"
651
+ }
652
+ },
653
+ opacityHover: {
654
+ ":hover": {
655
+ opacity: 0.8
656
+ },
657
+ "[aria-disabled=true]:hover": {
658
+ opacity: 1
659
+ }
660
+ }};
661
+ function getInteractableJSS({
662
+ color,
663
+ bare,
664
+ disabled,
665
+ animateInteraction,
666
+ padding,
667
+ border
668
+ }) {
669
+ return [
670
+ styles2.root,
671
+ color === "dark" && styles2.dark,
672
+ color === "light" && styles2.light,
673
+ color === "positive" && styles2.positive,
674
+ color === "primary" && styles2.primary,
675
+ color === "negative" && styles2.negative,
676
+ border && {
677
+ border: `1px solid ${getCSSColor(color, disabled, bare)}`
678
+ },
679
+ bare && styles2.bare,
680
+ disabled && styles2.disabled,
681
+ !bare && styles2.opacityHover,
682
+ animateInteraction && !disabled && {
683
+ position: "relative",
684
+ ":active": {
685
+ opacity: 0.95,
686
+ top: 1
687
+ },
688
+ "[aria-disabled=true]:active": {
689
+ top: 0,
690
+ opacity: 1
691
+ }
692
+ },
693
+ getPadding(padding)
694
+ ];
695
+ }
696
+ var getGlyphColor = (color, disabled, bare) => {
697
+ if (disabled) {
698
+ return "subtle";
699
+ }
700
+ switch (color) {
701
+ case "positive":
702
+ return bare ? "highlight" : "light";
703
+ case "negative":
704
+ return bare ? "negative" : "light";
705
+ case "primary":
706
+ return bare ? "primary" : "secondary";
707
+ case "dark":
708
+ return bare ? "primary" : "light";
709
+ case "light":
710
+ return bare ? "light" : "primary";
711
+ }
712
+ };
713
+ var getCSSColor = (color, disabled, bare) => {
714
+ if (disabled) {
715
+ return cssVar("--subtle-text");
716
+ }
717
+ switch (color) {
718
+ case "positive":
719
+ return bare ? cssVar("--highlight") : cssVar("--light-text");
720
+ case "negative":
721
+ return bare ? cssVar("--negative-text") : cssVar("--light-text");
722
+ case "primary":
723
+ return bare ? cssVar("--primary-text") : cssVar("--secondary-text");
724
+ case "dark":
725
+ return bare ? cssVar("--primary-text") : cssVar("--light-text");
726
+ case "light":
727
+ return bare ? cssVar("--light-text") : cssVar("--primary-text");
728
+ }
729
+ };
730
+ var getInteractableListItemJSS = ({
731
+ bare,
732
+ selected
733
+ }) => {
734
+ return [
735
+ {
736
+ overflow: "hidden",
737
+ flexGrow: 1,
738
+ borderRadius: bare ? cssVar("--border-radius-m") : null,
739
+ textDecoration: "none",
740
+ ":hover": {
741
+ backgroundColor: cssVar("--hovered-background")
742
+ },
743
+ ":active:hover": {
744
+ backgroundColor: cssVar("--pressed-background")
745
+ },
746
+ "[aria-disabled=true]": {
747
+ backgroundColor: cssVar("--primary-background")
748
+ },
749
+ "[aria-disabled=true]:active:hover": {
750
+ backgroundColor: cssVar("--primary-background")
751
+ }
752
+ },
753
+ selected && {
754
+ backgroundColor: bare ? cssVar("--light-highlight") : cssVar("--selected-background"),
755
+ boxShadow: bare ? "" : "inset 1px 1px 2px -1px #0000004a",
756
+ ":hover": {
757
+ backgroundColor: cssVar("--hovered-background")
758
+ },
759
+ ":active:hover": {
760
+ backgroundColor: cssVar("--pressed-background")
761
+ }
762
+ }
763
+ ];
764
+ };
765
+ var BaseButton = React34.forwardRef(
766
+ ({
767
+ onClick,
768
+ children,
769
+ jss,
770
+ color,
771
+ bare = false,
772
+ border = false,
773
+ disabled,
774
+ animateInteraction = true,
775
+ padding,
776
+ type = "button",
777
+ ...otherProps
778
+ }, ref) => {
779
+ return /* @__PURE__ */ jsx(
780
+ "button",
781
+ {
782
+ type,
783
+ ...otherProps,
784
+ "aria-disabled": disabled ? true : void 0,
785
+ ref,
786
+ onClick: (event) => {
787
+ if (disabled) {
788
+ return;
789
+ }
790
+ onClick?.(event);
791
+ },
792
+ className: toClassnames([
793
+ ...getInteractableJSS({
794
+ color,
795
+ bare,
796
+ border,
797
+ disabled,
798
+ animateInteraction,
799
+ padding
800
+ }),
801
+ jss
802
+ ]),
803
+ children
804
+ }
805
+ );
806
+ }
807
+ );
808
+ var fontSize = {
809
+ xsmall: cssVar("--font-xsmall"),
810
+ small: cssVar("--font-small"),
811
+ medium: cssVar("--font-medium"),
812
+ large: cssVar("--font-large"),
813
+ xlarge: cssVar("--font-xlarge"),
814
+ xxlarge: cssVar("--font-xxlarge"),
815
+ xxxlarge: cssVar("--font-xxxlarge")
816
+ };
817
+ function Text({
818
+ children,
819
+ color = "primary",
820
+ size = "medium",
821
+ align = "none",
822
+ bold = false,
823
+ ellipsis = "default",
824
+ grow,
825
+ type: Type = "span",
826
+ jss,
827
+ id,
828
+ htmlFor
829
+ }) {
830
+ if (ellipsis === "default") {
831
+ ellipsis = Type === "span" || Type === "label";
832
+ }
833
+ const className = toClassnames([
834
+ getTextColor(color),
835
+ { fontSize: fontSize[size], padding: 0, margin: 0 },
836
+ bold && { fontWeight: "bold" },
837
+ align === "center" && { textAlign: "center" },
838
+ ellipsis && {
839
+ overflow: "hidden",
840
+ textOverflow: "ellipsis",
841
+ whiteSpace: "nowrap"
842
+ },
843
+ grow && { flexGrow: 1 },
844
+ jss
845
+ ]);
846
+ return /* @__PURE__ */ jsx(Type, { id, className, htmlFor, children });
847
+ }
848
+ function Label({ size = "medium", type = "label", ...rest }) {
849
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
850
+ }
851
+ function Span({ size = "medium", type = "span", ...rest }) {
852
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
853
+ }
854
+ function P({ size = "medium", type = "p", ...rest }) {
855
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
856
+ }
857
+ function H1({ size = "xxlarge", type = "h1", ...rest }) {
858
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
859
+ }
860
+ function H2({ size = "xlarge", type = "h2", ...rest }) {
861
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
862
+ }
863
+ function H3({ size = "large", type = "h3", ...rest }) {
864
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
865
+ }
866
+ function Li({ size = "medium", type = "li", ...rest }) {
867
+ return /* @__PURE__ */ jsx(Text, { size, type, ...rest });
868
+ }
869
+ var BaseInput = React34.forwardRef(
870
+ ({
871
+ jss,
872
+ label,
873
+ labelPosition = "end",
874
+ labelSize,
875
+ labelColor,
876
+ labelBold,
877
+ id: propId,
878
+ ...otherProps
879
+ }, ref) => {
880
+ const hookid = useId();
881
+ const id = propId ?? hookid;
882
+ const labelElement = /* @__PURE__ */ jsx(
883
+ Label,
884
+ {
885
+ size: labelSize,
886
+ bold: labelBold,
887
+ color: labelColor,
888
+ jss: {
889
+ display: "flex",
890
+ alignItems: "center",
891
+ justifyContent: "center"
892
+ },
893
+ htmlFor: id,
894
+ children: label
895
+ }
896
+ );
897
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
898
+ label && labelPosition === "start" && labelElement,
899
+ /* @__PURE__ */ jsx(
900
+ "input",
901
+ {
902
+ id,
903
+ ref,
904
+ className: toClassnames(jss),
905
+ ...otherProps
906
+ }
907
+ ),
908
+ label && labelPosition === "end" && labelElement
909
+ ] });
910
+ }
911
+ );
912
+ var BaseLinkComponentOverrideContext = React34.createContext((props) => /* @__PURE__ */ jsx("a", { ...props }));
913
+ var BaseLink = React34.forwardRef(
914
+ ({
915
+ onClick,
916
+ children,
917
+ jss,
918
+ color,
919
+ bare = false,
920
+ disabled,
921
+ animateInteraction = true,
922
+ padding,
923
+ href,
924
+ border,
925
+ role = "link",
926
+ ...otherProps
927
+ }, ref) => {
928
+ const Link2 = useContext(BaseLinkComponentOverrideContext);
929
+ return /* @__PURE__ */ jsx(
930
+ Link2,
931
+ {
932
+ ...otherProps,
933
+ "aria-disabled": disabled ? true : void 0,
934
+ href,
935
+ role,
936
+ ref,
937
+ onClick: (event) => {
938
+ if (disabled) {
939
+ return;
940
+ }
941
+ onClick && onClick(event);
942
+ },
943
+ className: toClassnames([
944
+ ...getInteractableJSS({
945
+ color,
946
+ border,
947
+ bare,
948
+ disabled,
949
+ animateInteraction,
950
+ padding
951
+ }),
952
+ disabled && { pointerEvents: "none" },
953
+ jss
954
+ ]),
955
+ children
956
+ }
957
+ );
958
+ }
959
+ );
960
+ var FlexLayout = React34.forwardRef(
961
+ ({
962
+ jss,
963
+ gap = "none",
964
+ justify = "none",
965
+ align = "none",
966
+ padding = "none",
967
+ direction = "column",
968
+ ...otherProps
969
+ }, ref) => {
970
+ return /* @__PURE__ */ jsx(
971
+ BaseView,
972
+ {
973
+ ref,
974
+ jss: [
975
+ {
976
+ display: "flex",
977
+ flexDirection: direction,
978
+ gap: getSpacing(gap),
979
+ justifyContent: justify,
980
+ alignItems: align
981
+ },
982
+ getPadding(padding),
983
+ jss
984
+ ],
985
+ ...otherProps
986
+ }
987
+ );
988
+ }
989
+ );
990
+ var Column = React34.forwardRef(
991
+ (props, ref) => {
992
+ return /* @__PURE__ */ jsx(FlexLayout, { ref, direction: "column", ...props });
993
+ }
994
+ );
995
+ var BaseList = React34.forwardRef(
996
+ ({ jss, ...otherProps }, ref) => {
997
+ return /* @__PURE__ */ jsx(
998
+ Column,
999
+ {
1000
+ ...otherProps,
1001
+ tag: "ul",
1002
+ jss: [
1003
+ {
1004
+ listStyle: "none",
1005
+ margin: 0,
1006
+ padding: 0
1007
+ },
1008
+ jss
1009
+ ],
1010
+ ref
1011
+ }
1012
+ );
1013
+ }
1014
+ );
1015
+ var BaseListAddOn = React34.forwardRef(
1016
+ (props, ref) => {
1017
+ return /* @__PURE__ */ jsx(BaseView, { ...props, ref });
1018
+ }
1019
+ );
1020
+ var styles3 = {
1021
+ root: {
1022
+ width: "100%",
1023
+ borderBottom: "1px solid var(--divider)"
1024
+ }
1025
+ };
1026
+ function ListDivider() {
1027
+ return /* @__PURE__ */ jsx(BaseView, { jss: styles3.root });
1028
+ }
1029
+ var Row = React34.forwardRef(
1030
+ (props, ref) => {
1031
+ return /* @__PURE__ */ jsx(FlexLayout, { ref, direction: "row", ...props });
1032
+ }
1033
+ );
1034
+ function TextPairing({
1035
+ headline,
1036
+ body,
1037
+ headlineColor = "primary",
1038
+ headlineSize = "medium",
1039
+ headlineAddOn,
1040
+ bodyColor = "secondary",
1041
+ bodySize = "medium",
1042
+ addOn,
1043
+ addOnPosition = "start",
1044
+ gap = "small",
1045
+ align = "stretch",
1046
+ grow,
1047
+ shrink,
1048
+ headlineBold,
1049
+ padding,
1050
+ jss
1051
+ }) {
1052
+ const textElement = /* @__PURE__ */ jsxs(
1053
+ Column,
1054
+ {
1055
+ grow,
1056
+ shrink,
1057
+ padding: addOn ? void 0 : padding,
1058
+ align,
1059
+ jss: [
1060
+ {
1061
+ overflow: "hidden"
1062
+ },
1063
+ jss
1064
+ ],
1065
+ children: [
1066
+ /* @__PURE__ */ jsxs(
1067
+ Row,
1068
+ {
1069
+ align: "center",
1070
+ jss: {
1071
+ textAlign: "start"
1072
+ },
1073
+ children: [
1074
+ /* @__PURE__ */ jsx(Text, { bold: headlineBold, color: headlineColor, size: headlineSize, children: headline }),
1075
+ headlineAddOn && /* @__PURE__ */ jsx(BaseView, { children: headlineAddOn })
1076
+ ]
1077
+ }
1078
+ ),
1079
+ body && /* @__PURE__ */ jsx(
1080
+ Row,
1081
+ {
1082
+ align: "center",
1083
+ jss: {
1084
+ marginTop: cssVar("--spacing-xs"),
1085
+ textAlign: "start"
1086
+ },
1087
+ children: /* @__PURE__ */ jsx(Text, { ellipsis: true, color: bodyColor, size: bodySize, children: body })
1088
+ }
1089
+ )
1090
+ ]
1091
+ }
1092
+ );
1093
+ if (addOn) {
1094
+ return /* @__PURE__ */ jsxs(
1095
+ Row,
1096
+ {
1097
+ grow,
1098
+ shrink,
1099
+ gap,
1100
+ align: "center",
1101
+ padding,
1102
+ jss: {
1103
+ overflow: "hidden"
1104
+ },
1105
+ children: [
1106
+ addOnPosition === "start" && addOn,
1107
+ textElement,
1108
+ addOnPosition === "end" && addOn
1109
+ ]
1110
+ }
1111
+ );
1112
+ }
1113
+ return textElement;
1114
+ }
1115
+
1116
+ // src/aria.ts
1117
+ function queryFocusables(root) {
1118
+ const focusables = Array.from(
1119
+ root.querySelectorAll(
1120
+ "button,input,textarea,a,[tabindex='0'],[tabindex='-1']"
1121
+ )
1122
+ );
1123
+ return focusables.filter((element) => !element["disabled"]);
1124
+ }
1125
+ var normalizeElements = (focusables, index) => {
1126
+ for (const element2 of focusables) {
1127
+ element2.tabIndex = -1;
1128
+ }
1129
+ const element = focusables[index] ?? focusables[focusables.length - 1];
1130
+ element.tabIndex = 0;
1131
+ };
1132
+ var focusElement = (focusables, index) => {
1133
+ normalizeElements(focusables, index);
1134
+ const element = focusables[index] ?? focusables[focusables.length - 1];
1135
+ element.focus();
1136
+ };
1137
+ function useRefEffect(callback) {
1138
+ const unsubscribeRef = useRef(null);
1139
+ return useCallback(
1140
+ (root) => {
1141
+ if (root === null) {
1142
+ const unsubscribe = unsubscribeRef.current;
1143
+ if (unsubscribe) {
1144
+ unsubscribe();
1145
+ }
1146
+ unsubscribeRef.current = null;
1147
+ } else {
1148
+ unsubscribeRef.current = callback(root);
1149
+ }
1150
+ },
1151
+ [callback]
1152
+ );
1153
+ }
1154
+
1155
+ // src/useNavigation.tsx
1156
+ function useNavigation({
1157
+ autofocus = false,
1158
+ rowLength = 1,
1159
+ enabled = true
1160
+ } = {}) {
1161
+ return useRefEffect(
1162
+ useCallback(
1163
+ (root) => {
1164
+ if (!enabled) {
1165
+ return;
1166
+ }
1167
+ let index = 0;
1168
+ const elements = queryFocusables(root);
1169
+ if (elements.length === 0) {
1170
+ return;
1171
+ }
1172
+ if (elements.length !== 0 && autofocus) {
1173
+ focusElement(elements, index);
1174
+ } else {
1175
+ normalizeElements(elements, index);
1176
+ }
1177
+ const onKeyDown = (e) => {
1178
+ const elements2 = queryFocusables(root);
1179
+ if (elements2.length === 0) {
1180
+ return;
1181
+ }
1182
+ let newIndex = -1;
1183
+ if (e.code === "ArrowUp") {
1184
+ if (index - rowLength < 0) {
1185
+ newIndex = elements2.length - elements2.length % rowLength + index;
1186
+ } else {
1187
+ newIndex = index - rowLength;
1188
+ }
1189
+ } else if (e.code === "ArrowLeft") {
1190
+ if (index <= 0) {
1191
+ newIndex = elements2.length - 1;
1192
+ } else {
1193
+ newIndex = index - 1;
1194
+ }
1195
+ } else if (e.code === "ArrowRight") {
1196
+ if (index >= elements2.length - 1) {
1197
+ newIndex = 0;
1198
+ } else {
1199
+ newIndex = index + 1;
1200
+ }
1201
+ } else if (e.code === "ArrowDown") {
1202
+ if (index + rowLength > elements2.length - 1) {
1203
+ newIndex = (index + rowLength) % rowLength;
1204
+ } else {
1205
+ newIndex = index + rowLength;
1206
+ }
1207
+ }
1208
+ if (newIndex !== -1 && index !== newIndex) {
1209
+ index = newIndex;
1210
+ focusElement(elements2, index);
1211
+ e.preventDefault();
1212
+ e.stopPropagation();
1213
+ }
1214
+ };
1215
+ root.addEventListener("keydown", onKeyDown);
1216
+ const observer = new MutationObserver((mutationList) => {
1217
+ if (mutationList.filter((m) => m.type === "childList").length > 0) {
1218
+ const elements2 = queryFocusables(root);
1219
+ if (elements2.length > 0) {
1220
+ normalizeElements(elements2, index);
1221
+ }
1222
+ }
1223
+ });
1224
+ observer.observe(root, { childList: true });
1225
+ return () => {
1226
+ root.removeEventListener("keydown", onKeyDown);
1227
+ observer.disconnect();
1228
+ };
1229
+ },
1230
+ [autofocus, enabled, rowLength]
1231
+ )
1232
+ );
1233
+ }
1234
+ var ListContext = React34.createContext({ bare: false, carded: true });
1235
+ function List({
1236
+ ariaLabel,
1237
+ jss,
1238
+ autofocus = false,
1239
+ navigation = true,
1240
+ bare,
1241
+ carded = true,
1242
+ ...otherProps
1243
+ }) {
1244
+ const rootRef = useNavigation({ autofocus, enabled: navigation });
1245
+ const contextValue = useMemo(() => ({ bare, carded }), [bare, carded]);
1246
+ return /* @__PURE__ */ jsx(ListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
1247
+ BaseList,
1248
+ {
1249
+ role: "grid",
1250
+ "aria-label": ariaLabel,
1251
+ ref: rootRef,
1252
+ jss: [
1253
+ { overflow: "hidden" },
1254
+ !bare && {
1255
+ backgroundColor: cssVar("--overlay-background")
1256
+ },
1257
+ !bare && !carded && {
1258
+ borderBottom: `1px solid ${cssVar("--divider")}`,
1259
+ borderTop: `1px solid ${cssVar("--divider")}`
1260
+ },
1261
+ !bare && carded && {
1262
+ border: `1px solid ${cssVar("--divider")}`,
1263
+ borderRadius: cssVar("--border-radius-l")
1264
+ },
1265
+ jss
1266
+ ],
1267
+ ...otherProps
1268
+ }
1269
+ ) });
1270
+ }
1271
+ var useListContext = () => useContext(ListContext);
1272
+ var BaseListItem = React34.forwardRef(
1273
+ ({
1274
+ children,
1275
+ jss,
1276
+ withDivider = true,
1277
+ headline,
1278
+ headlineSize = "medium",
1279
+ headlineColor = "primary",
1280
+ headlineAddOn,
1281
+ body,
1282
+ bodySize = "small",
1283
+ bodyColor = "secondary",
1284
+ addOn,
1285
+ addOnPosition,
1286
+ outerAddOn,
1287
+ disabled = false,
1288
+ padding = "medium",
1289
+ gap = "medium",
1290
+ selected,
1291
+ headlineBold,
1292
+ ...otherProps
1293
+ }, ref) => {
1294
+ const { bare, carded } = useListContext();
1295
+ const content = /* @__PURE__ */ jsx(
1296
+ TextPairing,
1297
+ {
1298
+ headlineBold,
1299
+ padding,
1300
+ gap,
1301
+ addOn,
1302
+ addOnPosition,
1303
+ headline,
1304
+ headlineSize,
1305
+ headlineColor: disabled ? "subtle" : bare && selected ? "highlight" : headlineColor,
1306
+ headlineAddOn,
1307
+ body,
1308
+ bodySize,
1309
+ bodyColor: disabled ? "subtle" : bodyColor,
1310
+ grow: true,
1311
+ shrink: false
1312
+ }
1313
+ );
1314
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1315
+ /* @__PURE__ */ jsxs(
1316
+ Row,
1317
+ {
1318
+ ...otherProps,
1319
+ ref,
1320
+ relative: true,
1321
+ tag: "li",
1322
+ role: "row",
1323
+ jss: [
1324
+ !bare && carded && {
1325
+ [":first-child *"]: {
1326
+ borderTopLeftRadius: cssVar("--border-radius-l"),
1327
+ borderTopRightRadius: cssVar("--border-radius-l")
1328
+ },
1329
+ [":last-child *"]: {
1330
+ borderBottomLeftRadius: cssVar("--border-radius-l"),
1331
+ borderBottomRightRadius: cssVar("--border-radius-l")
1332
+ }
1333
+ },
1334
+ jss
1335
+ ],
1336
+ children: [
1337
+ /* @__PURE__ */ jsx(
1338
+ Row,
1339
+ {
1340
+ grow: true,
1341
+ role: "gridcell",
1342
+ jss: {
1343
+ overflow: "hidden"
1344
+ },
1345
+ children: children({ content })
1346
+ }
1347
+ ),
1348
+ outerAddOn && /* @__PURE__ */ jsx(BaseView, { role: "gridcell", children: outerAddOn })
1349
+ ]
1350
+ }
1351
+ ),
1352
+ withDivider && /* @__PURE__ */ jsx(ListDivider, {})
1353
+ ] });
1354
+ }
1355
+ );
1356
+ function Box({
1357
+ padding = "medium",
1358
+ align = "center",
1359
+ justify = "center",
1360
+ ...otherProps
1361
+ }) {
1362
+ return /* @__PURE__ */ jsx(
1363
+ FlexLayout,
1364
+ {
1365
+ padding,
1366
+ align,
1367
+ justify,
1368
+ ...otherProps
1369
+ }
1370
+ );
1371
+ }
1372
+ var styles4 = {
1373
+ root: {
1374
+ display: "flex",
1375
+ justifyContent: "center",
1376
+ alignItems: "center",
1377
+ " svg": {
1378
+ height: "inherit",
1379
+ width: "inherit"
1380
+ }
1381
+ },
1382
+ xsmall: {
1383
+ height: 8,
1384
+ width: 8
1385
+ },
1386
+ small: {
1387
+ height: 12,
1388
+ width: 12
1389
+ },
1390
+ medium: {
1391
+ height: 18,
1392
+ width: 18
1393
+ },
1394
+ large: {
1395
+ height: 24,
1396
+ width: 24
1397
+ },
1398
+ xlarge: {
1399
+ height: 32,
1400
+ width: 32
1401
+ },
1402
+ xxlarge: {
1403
+ height: 48,
1404
+ width: 48
1405
+ },
1406
+ xxxlarge: {
1407
+ height: 64,
1408
+ width: 64
1409
+ }
1410
+ };
1411
+ function IconProvider({ children }) {
1412
+ return children;
1413
+ }
1414
+ function Icon({
1415
+ icon,
1416
+ size,
1417
+ color,
1418
+ ariaLabel
1419
+ }) {
1420
+ return /* @__PURE__ */ jsx(
1421
+ BaseView,
1422
+ {
1423
+ "aria-label": ariaLabel,
1424
+ jss: [
1425
+ styles4.root,
1426
+ size === "xsmall" && styles4.xsmall,
1427
+ size === "small" && styles4.small,
1428
+ size === "medium" && styles4.medium,
1429
+ size === "large" && styles4.large,
1430
+ size === "xlarge" && styles4.xlarge,
1431
+ size === "xxlarge" && styles4.xxlarge,
1432
+ size === "xxxlarge" && styles4.xxxlarge,
1433
+ getTextColor(color)
1434
+ ],
1435
+ children: /* @__PURE__ */ jsx(Icon$1, { icon, width: "100%", height: "100%" })
1436
+ }
1437
+ );
1438
+ }
1439
+ var Button = React34.forwardRef(
1440
+ ({
1441
+ children,
1442
+ color,
1443
+ bare,
1444
+ disabled,
1445
+ icon,
1446
+ iconSize = "medium",
1447
+ iconPosition = "left",
1448
+ align = "center",
1449
+ gap = "small",
1450
+ justify = "center",
1451
+ jss,
1452
+ size = "medium",
1453
+ bold,
1454
+ padding = "medium",
1455
+ ...otherProps
1456
+ }, ref) => {
1457
+ return /* @__PURE__ */ jsx(
1458
+ BaseButton,
1459
+ {
1460
+ ...otherProps,
1461
+ bare,
1462
+ ref,
1463
+ color,
1464
+ disabled,
1465
+ padding,
1466
+ jss: [
1467
+ {
1468
+ borderRadius: cssVar("--border-radius-m"),
1469
+ justifyContent: "center",
1470
+ userSelect: "none"
1471
+ },
1472
+ jss
1473
+ ],
1474
+ children: /* @__PURE__ */ jsxs(Row, { grow: true, align, gap, justify, children: [
1475
+ icon && iconPosition === "left" && /* @__PURE__ */ jsx(
1476
+ Icon,
1477
+ {
1478
+ icon,
1479
+ size: iconSize,
1480
+ color: getGlyphColor(color, disabled, bare)
1481
+ }
1482
+ ),
1483
+ /* @__PURE__ */ jsx(
1484
+ Text,
1485
+ {
1486
+ bold,
1487
+ size,
1488
+ color: getGlyphColor(color, disabled, bare),
1489
+ children
1490
+ }
1491
+ ),
1492
+ icon && iconPosition === "right" && /* @__PURE__ */ jsx(
1493
+ Icon,
1494
+ {
1495
+ icon,
1496
+ size: iconSize,
1497
+ color: getGlyphColor(color, disabled, bare)
1498
+ }
1499
+ )
1500
+ ] })
1501
+ }
1502
+ );
1503
+ }
1504
+ );
1505
+ var dateFormatter = Intl.DateTimeFormat("en-GB", {
1506
+ weekday: "short"
1507
+ });
1508
+ var MON = dateFormatter.format(new Date(2e3, 1, 7));
1509
+ var TUE = dateFormatter.format(new Date(2e3, 1, 8));
1510
+ var WED = dateFormatter.format(new Date(2e3, 1, 9));
1511
+ var THU = dateFormatter.format(new Date(2e3, 1, 10));
1512
+ var FRI = dateFormatter.format(new Date(2e3, 1, 11));
1513
+ var SAT = dateFormatter.format(new Date(2e3, 1, 12));
1514
+ var SUN = dateFormatter.format(new Date(2e3, 1, 13));
1515
+ var Calendar = React34.forwardRef(
1516
+ ({
1517
+ date,
1518
+ cell,
1519
+ header,
1520
+ jss
1521
+ }, ref) => {
1522
+ const year = date.getFullYear();
1523
+ const month = date.getMonth();
1524
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
1525
+ const firstDayOfTheMonth = new Date(year, month, 1).getDay();
1526
+ const offset = firstDayOfTheMonth === 0 ? 6 : firstDayOfTheMonth - 1;
1527
+ const headers = useMemo(() => {
1528
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1529
+ header({ weekday: MON }),
1530
+ header({ weekday: TUE }),
1531
+ header({ weekday: WED }),
1532
+ header({ weekday: THU }),
1533
+ header({ weekday: FRI }),
1534
+ header({ weekday: SAT }),
1535
+ header({ weekday: SUN })
1536
+ ] });
1537
+ }, []);
1538
+ return /* @__PURE__ */ jsxs(
1539
+ BaseView,
1540
+ {
1541
+ ref,
1542
+ jss: [
1543
+ {
1544
+ display: "grid",
1545
+ gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr 1fr",
1546
+ gridTemplateRows: "1fr"
1547
+ },
1548
+ jss
1549
+ ],
1550
+ children: [
1551
+ headers,
1552
+ Array.from(Array(offset).keys()).map((index) => {
1553
+ const dayDate = new Date(
1554
+ date.getFullYear(),
1555
+ date.getMonth(),
1556
+ index + 1 - offset
1557
+ );
1558
+ return cloneElement(
1559
+ cell({
1560
+ date: dayDate,
1561
+ today: false,
1562
+ top: true,
1563
+ left: index % 7 === 0,
1564
+ outOfMonth: true,
1565
+ right: false,
1566
+ bottom: false
1567
+ }),
1568
+ { key: dayDate.toISOString() }
1569
+ );
1570
+ }),
1571
+ Array.from(Array(daysInMonth).keys()).map((index) => {
1572
+ const dayDate = new Date(
1573
+ date.getFullYear(),
1574
+ date.getMonth(),
1575
+ index + 1,
1576
+ 12
1577
+ // If we do not add this the ISO string would be from the day before at midnight
1578
+ );
1579
+ return cloneElement(
1580
+ cell({
1581
+ date: dayDate,
1582
+ top: index + offset < 7,
1583
+ left: (index + offset) % 7 === 0,
1584
+ right: (index + offset) % 7 === 7 - 1 || index === daysInMonth - 1,
1585
+ bottom: index > daysInMonth - 7 - 1,
1586
+ outOfMonth: false,
1587
+ today: dayDate.getDate() == (/* @__PURE__ */ new Date()).getDate() && dayDate.getMonth() == (/* @__PURE__ */ new Date()).getMonth() && dayDate.getFullYear() == (/* @__PURE__ */ new Date()).getFullYear()
1588
+ }),
1589
+ { key: dayDate.toISOString() }
1590
+ );
1591
+ })
1592
+ ]
1593
+ }
1594
+ );
1595
+ }
1596
+ );
1597
+ function Card({
1598
+ children,
1599
+ jss,
1600
+ padding = "large",
1601
+ gap = "large",
1602
+ ...otherProps
1603
+ }) {
1604
+ return /* @__PURE__ */ jsx(
1605
+ FlexLayout,
1606
+ {
1607
+ ...otherProps,
1608
+ padding,
1609
+ gap,
1610
+ jss: [
1611
+ {
1612
+ backgroundColor: cssVar("--overlay-background"),
1613
+ borderRadius: cssVar("--border-radius-l"),
1614
+ boxShadow: cssVar("--shadow-sm")
1615
+ },
1616
+ jss
1617
+ ],
1618
+ children
1619
+ }
1620
+ );
1621
+ }
1622
+ var styles5 = {
1623
+ border: {
1624
+ position: "absolute",
1625
+ top: "var(--spacing-xs)",
1626
+ bottom: "var(--spacing-xs)",
1627
+ left: "var(--spacing-xs)",
1628
+ right: "var(--spacing-xs)",
1629
+ border: "1px solid var(--divider)",
1630
+ borderRadius: "50%"
1631
+ },
1632
+ borderChecked: {
1633
+ border: "none",
1634
+ backgroundColor: "var(--highlight)"
1635
+ },
1636
+ icon: {
1637
+ position: "absolute",
1638
+ display: "flex",
1639
+ justifyContent: "center",
1640
+ alignItems: "center",
1641
+ top: "var(--spacing-xs)",
1642
+ bottom: "var(--spacing-xs)",
1643
+ left: "var(--spacing-xs)",
1644
+ right: "var(--spacing-xs)"
1645
+ }
1646
+ };
1647
+ var sizes3 = {
1648
+ xsmall: 20,
1649
+ small: 24,
1650
+ medium: 32,
1651
+ large: 40,
1652
+ xlarge: 48,
1653
+ xxlarge: 56,
1654
+ xxxlarge: 64
1655
+ };
1656
+ function StaticCheckbox({
1657
+ checked,
1658
+ size,
1659
+ icon = "fa-check"
1660
+ }) {
1661
+ return /* @__PURE__ */ jsxs(
1662
+ BaseView,
1663
+ {
1664
+ jss: {
1665
+ position: "relative",
1666
+ backgroundColor: cssVar("--primary-background"),
1667
+ overflow: "hidden",
1668
+ padding: cssVar("--spacing-xs"),
1669
+ borderRadius: sizes3[size] / 2,
1670
+ height: sizes3[size],
1671
+ width: sizes3[size]
1672
+ },
1673
+ children: [
1674
+ /* @__PURE__ */ jsx(BaseView, { jss: [styles5.border, checked && styles5.borderChecked] }),
1675
+ checked && /* @__PURE__ */ jsx(BaseView, { jss: styles5.icon, children: /* @__PURE__ */ jsx(Icon, { size, color: "light", icon }) })
1676
+ ]
1677
+ }
1678
+ );
1679
+ }
1680
+ function Checkbox({
1681
+ checked,
1682
+ onClick,
1683
+ size,
1684
+ ...inputProps
1685
+ }) {
1686
+ return /* @__PURE__ */ jsxs(
1687
+ "label",
1688
+ {
1689
+ className: toClassnames({
1690
+ position: "relative",
1691
+ display: "flex",
1692
+ justifyContent: "center",
1693
+ alignItems: "center",
1694
+ height: sizes3[size],
1695
+ width: sizes3[size],
1696
+ ":has(:focus-visible)": {
1697
+ outline: "2px solid var(--outline)",
1698
+ borderRadius: "50%"
1699
+ },
1700
+ ":has(:active)": {
1701
+ transform: "scale(0.92)"
1702
+ }
1703
+ }),
1704
+ children: [
1705
+ /* @__PURE__ */ jsx(StaticCheckbox, { checked, size }),
1706
+ /* @__PURE__ */ jsx(
1707
+ BaseInput,
1708
+ {
1709
+ ...inputProps,
1710
+ type: "checkbox",
1711
+ role: "checkbox",
1712
+ "aria-checked": `${checked}`,
1713
+ tabIndex: 0,
1714
+ checked,
1715
+ onChange: onClick,
1716
+ jss: {
1717
+ position: "absolute",
1718
+ opacity: 0,
1719
+ cursor: "pointer",
1720
+ top: 0,
1721
+ bottom: 0,
1722
+ left: 0,
1723
+ right: 0,
1724
+ width: "100%",
1725
+ height: "100%"
1726
+ }
1727
+ }
1728
+ )
1729
+ ]
1730
+ }
1731
+ );
1732
+ }
1733
+ function Circle({
1734
+ jss,
1735
+ padding = "medium",
1736
+ ...otherProps
1737
+ }) {
1738
+ return /* @__PURE__ */ jsx(
1739
+ Box,
1740
+ {
1741
+ padding,
1742
+ jss: [
1743
+ {
1744
+ borderRadius: "50%",
1745
+ overflow: "hidden"
1746
+ },
1747
+ jss
1748
+ ],
1749
+ ...otherProps
1750
+ }
1751
+ );
1752
+ }
1753
+ var sizes4 = {
1754
+ xsmall: 20,
1755
+ small: 24,
1756
+ medium: 32,
1757
+ large: 40,
1758
+ xlarge: 48,
1759
+ xxlarge: 56,
1760
+ xxxlarge: 64
1761
+ };
1762
+ var IconButton = React34.forwardRef(
1763
+ ({
1764
+ icon,
1765
+ size,
1766
+ color,
1767
+ bare,
1768
+ disabled,
1769
+ jss,
1770
+ label,
1771
+ labelSize = "medium",
1772
+ ...buttonProps
1773
+ }, ref) => {
1774
+ return /* @__PURE__ */ jsxs(
1775
+ BaseButton,
1776
+ {
1777
+ ...buttonProps,
1778
+ "aria-label": buttonProps["aria-label"] ?? label,
1779
+ bare,
1780
+ jss: [
1781
+ {
1782
+ display: "flex",
1783
+ justifyContent: "center",
1784
+ alignItems: "center",
1785
+ height: sizes4[size],
1786
+ width: sizes4[size],
1787
+ borderRadius: sizes4[size] / 2
1788
+ },
1789
+ !disabled && {
1790
+ ":active": {
1791
+ transform: "scale(0.92)"
1792
+ }
1793
+ },
1794
+ jss
1795
+ ],
1796
+ color,
1797
+ ref,
1798
+ disabled,
1799
+ children: [
1800
+ /* @__PURE__ */ jsx(
1801
+ Icon,
1802
+ {
1803
+ size,
1804
+ icon,
1805
+ color: getGlyphColor(color, disabled, bare)
1806
+ }
1807
+ ),
1808
+ label && /* @__PURE__ */ jsx(Span, { size: labelSize, color: getGlyphColor(color, disabled, bare), children: label })
1809
+ ]
1810
+ }
1811
+ );
1812
+ }
1813
+ );
1814
+ var DarkModeContext = React34.createContext({
1815
+ enabled: false,
1816
+ toggle: () => {
1817
+ }
1818
+ });
1819
+ if (!isServer()) {
1820
+ const darkMode = document.cookie.split(";").map((c) => c.trim()).filter((c) => c.startsWith("dark-mode=")).map((s) => s.split("=")[1]).map((s) => s).pop();
1821
+ if (darkMode === "true") {
1822
+ document.body.classList.add("dark-mode");
1823
+ }
1824
+ }
1825
+ function DarkModeProvider({
1826
+ children,
1827
+ enabled,
1828
+ toggle
1829
+ }) {
1830
+ useEffect(() => {
1831
+ const statusBarMeta = document.head.querySelector(
1832
+ 'meta[name="apple-mobile-web-app-status-bar-style"]'
1833
+ );
1834
+ const themeColorMeta = document.head.querySelector(
1835
+ 'meta[name="theme-color"]'
1836
+ );
1837
+ if (enabled) {
1838
+ document.body.classList.add("dark-mode");
1839
+ if (statusBarMeta != null) {
1840
+ statusBarMeta.content = "black-translucent";
1841
+ }
1842
+ if (themeColorMeta != null) {
1843
+ themeColorMeta.content = "rgb(42, 43, 46)";
1844
+ }
1845
+ } else {
1846
+ document.body.classList.remove("dark-mode");
1847
+ if (statusBarMeta != null) {
1848
+ statusBarMeta.content = "default";
1849
+ }
1850
+ if (themeColorMeta != null) {
1851
+ themeColorMeta.content = "rgb(239, 239, 244)";
1852
+ }
1853
+ }
1854
+ }, [enabled]);
1855
+ return /* @__PURE__ */ jsx(DarkModeContext.Provider, { value: { enabled, toggle }, children });
1856
+ }
1857
+ function DarkModeToggle() {
1858
+ const darkMode = useContext(DarkModeContext);
1859
+ const [show, setShow] = useState(false);
1860
+ useEffect(() => {
1861
+ setShow(true);
1862
+ }, []);
1863
+ if (!show) {
1864
+ return /* @__PURE__ */ jsx(BaseView, { jss: { width: 32, height: 32 } });
1865
+ }
1866
+ return /* @__PURE__ */ jsx(
1867
+ IconButton,
1868
+ {
1869
+ "aria-label": "Toggle dark mode",
1870
+ icon: darkMode.enabled ? "fa-sun-o" : "fa-moon-o",
1871
+ size: "medium",
1872
+ onClick: darkMode.toggle,
1873
+ color: "primary",
1874
+ bare: true
1875
+ }
1876
+ );
1877
+ }
1878
+
1879
+ // src/dateInputValue.ts
1880
+ var pad = (value) => value.toString().padStart(2, "0");
1881
+ function formatDateInputValue(date) {
1882
+ return `${date.getFullYear().toString().padStart(4, "0")}-${pad(
1883
+ date.getMonth() + 1
1884
+ )}-${pad(date.getDate())}`;
1885
+ }
1886
+ function parseDateInputValue(value) {
1887
+ const [year, month, day] = value.split("-").map(Number);
1888
+ return new Date(year, month - 1, day);
1889
+ }
1890
+ function formatDatetimeInputValue(date) {
1891
+ return `${formatDateInputValue(date)}T${pad(date.getHours())}:${pad(
1892
+ date.getMinutes()
1893
+ )}`;
1894
+ }
1895
+ function parseDatetimeInputValue(value) {
1896
+ const [date, time] = value.split("T");
1897
+ const [year, month, day] = date.split("-").map(Number);
1898
+ const [hour, minute] = time.split(":").map(Number);
1899
+ return new Date(year, month - 1, day, hour, minute);
1900
+ }
1901
+ function formatTimeInputValue(date) {
1902
+ return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
1903
+ }
1904
+ var DateInput = React34.forwardRef(
1905
+ ({ date, onDateChange, jss, icon, addOn, ...inputProps }, ref) => {
1906
+ return /* @__PURE__ */ jsxs(
1907
+ Row,
1908
+ {
1909
+ jss: {
1910
+ backgroundColor: "inherit"
1911
+ },
1912
+ children: [
1913
+ icon && /* @__PURE__ */ jsx(Box, { padding: "medium", children: /* @__PURE__ */ jsx(Icon, { size: "medium", color: "secondary", icon }) }),
1914
+ /* @__PURE__ */ jsx(
1915
+ BaseInput,
1916
+ {
1917
+ ...inputProps,
1918
+ type: "date",
1919
+ ref,
1920
+ value: formatDateInputValue(date),
1921
+ onChange: (e) => {
1922
+ if (e.target.value) {
1923
+ onDateChange(parseDateInputValue(e.target.value));
1924
+ }
1925
+ },
1926
+ jss: [
1927
+ {
1928
+ flexGrow: 1,
1929
+ backgroundColor: "inherit",
1930
+ color: "var(--primary-text)",
1931
+ outline: "none",
1932
+ border: "none",
1933
+ fontSize: 20,
1934
+ lineHeight: 24 / 20,
1935
+ "::placeholder": {
1936
+ color: "var(--subtle-text);"
1937
+ },
1938
+ ":disabled": {
1939
+ color: "var(--subtle-text);"
1940
+ }
1941
+ },
1942
+ jss
1943
+ ]
1944
+ }
1945
+ ),
1946
+ addOn
1947
+ ]
1948
+ }
1949
+ );
1950
+ }
1951
+ );
1952
+ var styles6 = {
1953
+ dateInput: {
1954
+ border: "1px solid var(--divider)",
1955
+ backgroundColor: "var(--primary-background)",
1956
+ padding: "var(--spacing-m)",
1957
+ color: "var(--primary-text)",
1958
+ fontSize: 20,
1959
+ lineHeight: 24 / 20
1960
+ }
1961
+ };
1962
+ function DatePicker({
1963
+ id,
1964
+ label,
1965
+ color = "primary",
1966
+ date,
1967
+ onDateChange
1968
+ }) {
1969
+ const [{ min, max }] = useState(() => {
1970
+ const year = date.getFullYear();
1971
+ const month = date.getMonth();
1972
+ const day = date.getDate();
1973
+ return {
1974
+ min: formatDateInputValue(new Date(year - 1, month, day)),
1975
+ max: formatDateInputValue(new Date(year + 1, month, day))
1976
+ };
1977
+ });
1978
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1979
+ /* @__PURE__ */ jsx("label", { htmlFor: id, children: /* @__PURE__ */ jsx(Text, { size: "small", color, children: label }) }),
1980
+ /* @__PURE__ */ jsx(
1981
+ "input",
1982
+ {
1983
+ min,
1984
+ max,
1985
+ className: toClassnames(styles6.dateInput),
1986
+ type: "date",
1987
+ id,
1988
+ value: formatDateInputValue(date),
1989
+ onChange: (event) => {
1990
+ if (event.target.value) {
1991
+ onDateChange(parseDateInputValue(event.target.value));
1992
+ }
1993
+ }
1994
+ }
1995
+ )
1996
+ ] });
1997
+ }
1998
+ var styles7 = {
1999
+ root: {
2000
+ backgroundColor: "var(--primary-background)"
2001
+ },
2002
+ input: {
2003
+ padding: "var(--spacing-m)",
2004
+ flexGrow: 1,
2005
+ backgroundColor: "var(--primary-background)",
2006
+ color: "var(--primary-text)",
2007
+ outline: "none",
2008
+ border: "none",
2009
+ fontSize: 20,
2010
+ lineHeight: 24 / 20,
2011
+ "::placeholder": {
2012
+ color: "var(--subtle-text);"
2013
+ },
2014
+ ":disabled": {
2015
+ color: "var(--subtle-text);"
2016
+ }
2017
+ }
2018
+ };
2019
+ var DatetimeInput = React34.forwardRef(
2020
+ ({ date, onDateChange, jss, icon, addOn, ...inputProps }, ref) => {
2021
+ return /* @__PURE__ */ jsxs(Row, { jss: styles7.root, children: [
2022
+ icon && /* @__PURE__ */ jsx(Box, { padding: "medium", children: /* @__PURE__ */ jsx(Icon, { size: "medium", color: "secondary", icon }) }),
2023
+ /* @__PURE__ */ jsx(
2024
+ BaseInput,
2025
+ {
2026
+ ...inputProps,
2027
+ type: "datetime-local",
2028
+ ref,
2029
+ value: formatDatetimeInputValue(date),
2030
+ onChange: (e) => {
2031
+ if (e.target.value) {
2032
+ onDateChange(parseDatetimeInputValue(e.target.value));
2033
+ }
2034
+ },
2035
+ jss: [styles7.input, jss]
2036
+ }
2037
+ ),
2038
+ addOn
2039
+ ] });
2040
+ }
2041
+ );
2042
+ var styles8 = {
2043
+ dialog: {
2044
+ border: "1px solid var(--divider)",
2045
+ borderRadius: "var(--border-radius-l)",
2046
+ padding: 0,
2047
+ boxShadow: "var(--shadow-lg)",
2048
+ animation: "dialogFadeIn 0.2s ease-out",
2049
+ "::backdrop": {
2050
+ backgroundColor: "rgba(0, 0, 0, 0.4)",
2051
+ animation: "backdropFadeIn 0.2s ease-out"
2052
+ }
2053
+ },
2054
+ root: {
2055
+ display: "grid",
2056
+ width: "calc(100vw - 48px)",
2057
+ gridTemplateAreas: `
2058
+ "header"
2059
+ "content"
2060
+ `,
2061
+ "@media (min-width: 750px)": {
2062
+ maxWidth: 750
2063
+ },
2064
+ backgroundColor: "var(--secondary-background)"
2065
+ },
2066
+ header: {
2067
+ gridArea: "header"
2068
+ },
2069
+ content: {
2070
+ gridArea: "content"
2071
+ }
2072
+ };
2073
+ var Dialog = ({
2074
+ label,
2075
+ children,
2076
+ close
2077
+ }) => {
2078
+ return /* @__PURE__ */ jsxs(BaseView, { jss: styles8.root, children: [
2079
+ /* @__PURE__ */ jsxs(Column, { jss: styles8.header, children: [
2080
+ /* @__PURE__ */ jsxs(Row, { padding: "medium", justify: "space-between", align: "center", children: [
2081
+ /* @__PURE__ */ jsx(Text, { size: "medium", color: "secondary", children: label }),
2082
+ /* @__PURE__ */ jsx(
2083
+ IconButton,
2084
+ {
2085
+ autoFocus: true,
2086
+ bare: true,
2087
+ icon: "fa-close",
2088
+ size: "medium",
2089
+ onClick: close,
2090
+ color: "primary"
2091
+ }
2092
+ )
2093
+ ] }),
2094
+ /* @__PURE__ */ jsx(ListDivider, {})
2095
+ ] }),
2096
+ /* @__PURE__ */ jsx(BaseView, { jss: styles8.content, children })
2097
+ ] });
2098
+ };
2099
+ var DialogContext = React34.createContext({
2100
+ setDialog: () => {
2101
+ }
2102
+ });
2103
+ function DialogProvider({ children }) {
2104
+ const [dialog, setDialog] = useState(null);
2105
+ const value = useMemo(() => ({ setDialog }), []);
2106
+ return /* @__PURE__ */ jsxs(DialogContext.Provider, { value, children: [
2107
+ dialog,
2108
+ children
2109
+ ] });
2110
+ }
2111
+ function useDialog(DialogComponent, options) {
2112
+ const { setDialog } = useContext(DialogContext);
2113
+ const dialogRef = useRef(null);
2114
+ const activeElementRef = useRef(null);
2115
+ const closeRef = useRef(null);
2116
+ closeRef.current = () => {
2117
+ dialogRef.current && dialogRef.current.close();
2118
+ activeElementRef.current && activeElementRef.current.focus();
2119
+ dialogRef.current = null;
2120
+ activeElementRef.current = null;
2121
+ setDialog(null);
2122
+ };
2123
+ const open = (input) => {
2124
+ activeElementRef.current = document.activeElement;
2125
+ setDialog(
2126
+ /* @__PURE__ */ jsx(
2127
+ "dialog",
2128
+ {
2129
+ ref: (ref) => {
2130
+ dialogRef.current = ref;
2131
+ ref && ref.showModal();
2132
+ },
2133
+ className: toClassnames(styles8.dialog),
2134
+ onClose: () => {
2135
+ closeRef.current();
2136
+ },
2137
+ onClick: (e) => {
2138
+ if (dialogRef.current == null) {
2139
+ return;
2140
+ }
2141
+ const dialogDimensions = dialogRef.current.getBoundingClientRect();
2142
+ if (options.closeOnOutsideClick === false) {
2143
+ return;
2144
+ }
2145
+ if (e.clientX < dialogDimensions.left || e.clientX > dialogDimensions.right || e.clientY > dialogDimensions.bottom || e.clientY < dialogDimensions.top) {
2146
+ dialogRef.current.close();
2147
+ }
2148
+ },
2149
+ children: /* @__PURE__ */ jsx(DialogComponent, { ...input, close: () => closeRef.current() })
2150
+ }
2151
+ )
2152
+ );
2153
+ };
2154
+ return {
2155
+ open,
2156
+ close: () => closeRef.current()
2157
+ };
2158
+ }
2159
+ var styles9 = {
2160
+ root: {
2161
+ position: "relative",
2162
+ display: "flex",
2163
+ justifyContent: "center",
2164
+ alignItems: "stretch",
2165
+ flexGrow: 1
2166
+ },
2167
+ button: {
2168
+ flexGrow: 1
2169
+ },
2170
+ dropdown: {
2171
+ position: "absolute",
2172
+ top: "100%",
2173
+ left: 0,
2174
+ right: 0,
2175
+ borderRadius: "var(--border-radius-m)",
2176
+ boxShadow: "var(--shadow-sm)",
2177
+ zIndex: 1
2178
+ }
2179
+ };
2180
+ function Dropdown({
2181
+ id: propId,
2182
+ label,
2183
+ options,
2184
+ selection,
2185
+ setSelection,
2186
+ jss,
2187
+ jssButton,
2188
+ optionLabel,
2189
+ padding,
2190
+ size,
2191
+ gap = "medium"
2192
+ }) {
2193
+ const hookId = useId();
2194
+ const id = propId ?? hookId;
2195
+ const triggerRef = useRef(null);
2196
+ const [expanded, setExpanded] = useState(false);
2197
+ const dropdownRef = useNavigation({ autofocus: true });
2198
+ const rootRef = useRefEffect(
2199
+ useCallback((root) => {
2200
+ const onKeyDown = (e) => {
2201
+ if (e.code === "Escape") {
2202
+ setExpanded(false);
2203
+ }
2204
+ };
2205
+ root.addEventListener("keydown", onKeyDown);
2206
+ return () => root.removeEventListener("keydown", onKeyDown);
2207
+ }, [])
2208
+ );
2209
+ useEffect(() => {
2210
+ if (!expanded) {
2211
+ triggerRef.current && triggerRef.current.focus();
2212
+ }
2213
+ }, [expanded]);
2214
+ return /* @__PURE__ */ jsxs(BaseView, { ref: rootRef, jss: [styles9.root, jss], children: [
2215
+ /* @__PURE__ */ jsx(
2216
+ Button,
2217
+ {
2218
+ size,
2219
+ padding,
2220
+ "aria-expanded": expanded ? "true" : "false",
2221
+ "aria-controls": id,
2222
+ "aria-haspopup": "true",
2223
+ "aria-label": label,
2224
+ role: "combobox",
2225
+ justify: "space-between",
2226
+ tabIndex: 0,
2227
+ jss: [styles9.button, jssButton],
2228
+ color: "positive",
2229
+ icon: "fa-chevron-down",
2230
+ iconPosition: "right",
2231
+ onClick: () => {
2232
+ setExpanded((x) => !x);
2233
+ },
2234
+ ref: triggerRef,
2235
+ children: optionLabel(selection)
2236
+ }
2237
+ ),
2238
+ expanded && /* @__PURE__ */ jsx(
2239
+ Column,
2240
+ {
2241
+ gap,
2242
+ jss: [styles9.dropdown, getBackground("secondary-background")],
2243
+ id,
2244
+ role: "listbox",
2245
+ "aria-label": label,
2246
+ tabIndex: -1,
2247
+ ref: dropdownRef,
2248
+ onBlur: (e) => {
2249
+ if (!e.currentTarget.contains(e.relatedTarget)) {
2250
+ setExpanded(false);
2251
+ }
2252
+ },
2253
+ children: Array.from(options).map((option, index) => {
2254
+ const optionId = `${id}-${index}`;
2255
+ const selected = option === selection;
2256
+ return /* @__PURE__ */ jsx(
2257
+ Button,
2258
+ {
2259
+ size,
2260
+ padding,
2261
+ justify: selected ? "space-between" : "flex-start",
2262
+ align: "center",
2263
+ bare: true,
2264
+ iconPosition: "right",
2265
+ icon: selected ? "fa-check" : void 0,
2266
+ role: "option",
2267
+ id: optionId,
2268
+ "aria-selected": selected ? "true" : "false",
2269
+ color: "positive",
2270
+ onClick: () => {
2271
+ setSelection(option);
2272
+ setExpanded(false);
2273
+ },
2274
+ children: optionLabel(option)
2275
+ },
2276
+ optionId
2277
+ );
2278
+ })
2279
+ }
2280
+ )
2281
+ ] });
2282
+ }
2283
+
2284
+ // src/Emitter.ts
2285
+ function createEmitter() {
2286
+ const subscriptions = /* @__PURE__ */ new Set();
2287
+ const subscribe = (callback) => {
2288
+ subscriptions.add(callback);
2289
+ return () => {
2290
+ subscriptions.delete(callback);
2291
+ };
2292
+ };
2293
+ const emit = (value) => {
2294
+ subscriptions.forEach((subscription) => {
2295
+ subscription(value);
2296
+ });
2297
+ };
2298
+ return {
2299
+ subscribe,
2300
+ emit
2301
+ };
2302
+ }
2303
+
2304
+ // src/guid.ts
2305
+ function guid() {
2306
+ return "ID-xxxxxxxx".replace(/[xy]/g, function(c) {
2307
+ const r = Math.random() * 16 | 0, v = c === "x" ? r : r & 3 | 8;
2308
+ return v.toString(16);
2309
+ });
2310
+ }
2311
+ var sizes5 = {
2312
+ xsmall: 20,
2313
+ small: 24,
2314
+ medium: 32,
2315
+ large: 40,
2316
+ xlarge: 48,
2317
+ xxlarge: 56,
2318
+ xxxlarge: 64
2319
+ };
2320
+ var IconLink = React34.forwardRef(
2321
+ ({ icon, size, color, bare, disabled, jss, ...otherProps }, ref) => {
2322
+ return /* @__PURE__ */ jsx(
2323
+ BaseLink,
2324
+ {
2325
+ ...otherProps,
2326
+ bare,
2327
+ jss: [
2328
+ {
2329
+ display: "flex",
2330
+ justifyContent: "center",
2331
+ alignItems: "center",
2332
+ height: sizes5[size],
2333
+ width: sizes5[size],
2334
+ borderRadius: sizes5[size] / 2,
2335
+ textDecoration: "none"
2336
+ },
2337
+ !disabled && {
2338
+ ":active": {
2339
+ transform: "scale(0.92)"
2340
+ }
2341
+ },
2342
+ jss
2343
+ ],
2344
+ color,
2345
+ ref,
2346
+ disabled,
2347
+ children: /* @__PURE__ */ jsx(
2348
+ Icon,
2349
+ {
2350
+ size,
2351
+ icon,
2352
+ color: getGlyphColor(color, disabled, bare)
2353
+ }
2354
+ )
2355
+ }
2356
+ );
2357
+ }
2358
+ );
2359
+ var Link = React34.forwardRef(
2360
+ ({
2361
+ children,
2362
+ color,
2363
+ bare,
2364
+ disabled,
2365
+ icon,
2366
+ underline,
2367
+ iconSize = "medium",
2368
+ iconPosition = "left",
2369
+ align = "center",
2370
+ gap = "small",
2371
+ justify = "center",
2372
+ jss,
2373
+ size = "medium",
2374
+ padding = "medium",
2375
+ inline = true,
2376
+ bold,
2377
+ ...otherProps
2378
+ }, ref) => {
2379
+ return /* @__PURE__ */ jsx(
2380
+ BaseLink,
2381
+ {
2382
+ ...otherProps,
2383
+ bare,
2384
+ ref,
2385
+ color,
2386
+ disabled,
2387
+ padding,
2388
+ jss: [
2389
+ {
2390
+ borderRadius: cssVar("--border-radius-m"),
2391
+ justifyContent: "center",
2392
+ userSelect: "none",
2393
+ display: inline ? "inline-flex" : "flex",
2394
+ textDecoration: "none"
2395
+ },
2396
+ underline && {
2397
+ textDecorationLine: "underline",
2398
+ textDecorationThickness: "2px",
2399
+ textUnderlineOffset: "2px",
2400
+ textDecorationColor: getCSSColor(color, disabled, bare)
2401
+ },
2402
+ jss
2403
+ ],
2404
+ children: /* @__PURE__ */ jsxs(
2405
+ Row,
2406
+ {
2407
+ jss: {
2408
+ display: inline ? "inline-flex" : "flex"
2409
+ },
2410
+ grow: true,
2411
+ align,
2412
+ gap,
2413
+ justify,
2414
+ children: [
2415
+ icon && iconPosition === "left" && /* @__PURE__ */ jsx(
2416
+ Icon,
2417
+ {
2418
+ icon,
2419
+ size: iconSize,
2420
+ color: getGlyphColor(color, disabled, bare)
2421
+ }
2422
+ ),
2423
+ /* @__PURE__ */ jsx(
2424
+ Text,
2425
+ {
2426
+ bold,
2427
+ size,
2428
+ color: getGlyphColor(color, disabled, bare),
2429
+ children
2430
+ }
2431
+ ),
2432
+ icon && iconPosition === "right" && /* @__PURE__ */ jsx(
2433
+ Icon,
2434
+ {
2435
+ icon,
2436
+ size: iconSize,
2437
+ color: getGlyphColor(color, disabled, bare)
2438
+ }
2439
+ )
2440
+ ]
2441
+ }
2442
+ )
2443
+ }
2444
+ );
2445
+ }
2446
+ );
2447
+ var ListButtonItem = React34.forwardRef(
2448
+ ({
2449
+ onClick,
2450
+ color = "primary",
2451
+ disabled = false,
2452
+ padding = "medium",
2453
+ jss,
2454
+ gap,
2455
+ selected,
2456
+ ...otherProps
2457
+ }, ref) => {
2458
+ const { bare } = useListContext();
2459
+ return /* @__PURE__ */ jsx(
2460
+ BaseListItem,
2461
+ {
2462
+ withDivider: !bare,
2463
+ disabled,
2464
+ padding: "none",
2465
+ gap,
2466
+ headlineColor: getGlyphColor(color, disabled, true),
2467
+ bodyColor: getGlyphColor(color, disabled, true),
2468
+ selected,
2469
+ "aria-selected": selected,
2470
+ ...otherProps,
2471
+ jss,
2472
+ children: ({ content }) => /* @__PURE__ */ jsx(
2473
+ BaseButton,
2474
+ {
2475
+ padding,
2476
+ disabled,
2477
+ animateInteraction: false,
2478
+ bare: true,
2479
+ color: bare ? "primary" : color,
2480
+ ref,
2481
+ jss: getInteractableListItemJSS({ bare, selected }),
2482
+ onClick,
2483
+ children: content
2484
+ }
2485
+ )
2486
+ }
2487
+ );
2488
+ }
2489
+ );
2490
+ function ListHeaderItem({
2491
+ highlight,
2492
+ headline,
2493
+ body,
2494
+ withDivider,
2495
+ addOn,
2496
+ addOnPosition
2497
+ }) {
2498
+ const { bare } = useListContext();
2499
+ return /* @__PURE__ */ jsx(
2500
+ BaseListItem,
2501
+ {
2502
+ headline,
2503
+ headlineColor: highlight ? bare ? "highlight" : "light" : "primary",
2504
+ headlineBold: true,
2505
+ body,
2506
+ addOn,
2507
+ addOnPosition,
2508
+ withDivider: bare ? false : withDivider,
2509
+ jss: bare ? null : {
2510
+ backgroundColor: highlight ? cssVar("--highlight") : cssVar("--secondary-background")
2511
+ },
2512
+ children: ({ content }) => content
2513
+ }
2514
+ );
2515
+ }
2516
+ var ListItem = React34.forwardRef(
2517
+ (props, ref) => {
2518
+ const { bare } = useListContext();
2519
+ return /* @__PURE__ */ jsx(BaseListItem, { withDivider: !bare, ...props, jss: props.jss, ref, children: ({ content }) => content });
2520
+ }
2521
+ );
2522
+ var ListLinkItem = React34.forwardRef(
2523
+ ({
2524
+ onClick,
2525
+ href,
2526
+ disabled = false,
2527
+ padding = "medium",
2528
+ jss,
2529
+ gap,
2530
+ selected,
2531
+ color = "primary",
2532
+ target,
2533
+ ...otherProps
2534
+ }, ref) => {
2535
+ const { bare } = useListContext();
2536
+ return /* @__PURE__ */ jsx(
2537
+ BaseListItem,
2538
+ {
2539
+ withDivider: !bare,
2540
+ disabled,
2541
+ "aria-selected": selected,
2542
+ padding: "none",
2543
+ gap,
2544
+ headlineColor: getGlyphColor(color, disabled, true),
2545
+ bodyColor: getGlyphColor(color, disabled, true),
2546
+ selected,
2547
+ ...otherProps,
2548
+ jss,
2549
+ children: ({ content }) => /* @__PURE__ */ jsx(
2550
+ BaseLink,
2551
+ {
2552
+ target,
2553
+ padding,
2554
+ "aria-current": selected ? "page" : void 0,
2555
+ disabled,
2556
+ animateInteraction: false,
2557
+ bare: true,
2558
+ color,
2559
+ href,
2560
+ ref,
2561
+ jss: getInteractableListItemJSS({ bare, selected }),
2562
+ onClick,
2563
+ children: content
2564
+ }
2565
+ )
2566
+ }
2567
+ );
2568
+ }
2569
+ );
2570
+ var styles10 = {
2571
+ root: {
2572
+ height: "var(--spacing-xl)",
2573
+ backgroundColor: "var(--secondary-background)",
2574
+ width: "100%"
2575
+ }
2576
+ };
2577
+ function ListSpacer() {
2578
+ return /* @__PURE__ */ jsx(BaseView, { jss: styles10.root });
2579
+ }
2580
+ function MenuIcon({ open, color }) {
2581
+ return /* @__PURE__ */ jsxs(Column, { gap: "small", children: [
2582
+ /* @__PURE__ */ jsx(
2583
+ Bar,
2584
+ {
2585
+ color,
2586
+ jss: {
2587
+ transform: open ? "rotateZ(135deg)" : "",
2588
+ transformOrigin: "center",
2589
+ top: open ? 8 : 0
2590
+ }
2591
+ }
2592
+ ),
2593
+ /* @__PURE__ */ jsx(
2594
+ Bar,
2595
+ {
2596
+ color,
2597
+ jss: {
2598
+ opacity: open ? 0 : 1
2599
+ }
2600
+ }
2601
+ ),
2602
+ /* @__PURE__ */ jsx(
2603
+ Bar,
2604
+ {
2605
+ color,
2606
+ jss: {
2607
+ transform: open ? "rotateZ(-135deg)" : "",
2608
+ transformOrigin: "center",
2609
+ top: open ? -8 : 0
2610
+ }
2611
+ }
2612
+ )
2613
+ ] });
2614
+ }
2615
+ function Bar({ jss, color }) {
2616
+ return /* @__PURE__ */ jsx(
2617
+ BaseView,
2618
+ {
2619
+ jss: [
2620
+ {
2621
+ position: "relative",
2622
+ width: 24,
2623
+ height: 4,
2624
+ borderRadius: "1px",
2625
+ transition: "all 200ms ease-out"
2626
+ },
2627
+ getBackground(color),
2628
+ jss
2629
+ ]
2630
+ }
2631
+ );
2632
+ }
2633
+
2634
+ // src/numberToBase.ts
2635
+ var LETTERS_26 = [
2636
+ "a",
2637
+ "b",
2638
+ "c",
2639
+ "d",
2640
+ "e",
2641
+ "f",
2642
+ "g",
2643
+ "h",
2644
+ "i",
2645
+ "j",
2646
+ "k",
2647
+ "l",
2648
+ "m",
2649
+ "n",
2650
+ "o",
2651
+ "p",
2652
+ "q",
2653
+ "r",
2654
+ "s",
2655
+ "t",
2656
+ "u",
2657
+ "v",
2658
+ "w",
2659
+ "x",
2660
+ "y",
2661
+ "z"
2662
+ ];
2663
+ function numberToBase(number, base = LETTERS_26) {
2664
+ if (number <= -1) {
2665
+ return "";
2666
+ }
2667
+ let result = [];
2668
+ number += 1;
2669
+ while (number >= base.length) {
2670
+ const index = number % base.length;
2671
+ number = Math.floor(number / base.length) - 1;
2672
+ result.push(base[index]);
2673
+ }
2674
+ result.push(base[number]);
2675
+ return result.reverse().join("");
2676
+ }
2677
+ function OnVisible({
2678
+ children,
2679
+ onVisible
2680
+ }) {
2681
+ const intersectionObserverRef = useRef(null);
2682
+ const refCallback = useCallback((element) => {
2683
+ if (element == null) {
2684
+ return;
2685
+ }
2686
+ const intersectionObserver = new IntersectionObserver(
2687
+ (entries) => {
2688
+ entries.forEach((entry) => {
2689
+ if (entry.isIntersecting || entry.intersectionRatio > 0) {
2690
+ onVisible();
2691
+ }
2692
+ });
2693
+ },
2694
+ {
2695
+ root: null,
2696
+ rootMargin: "0px"
2697
+ }
2698
+ );
2699
+ intersectionObserverRef.current = intersectionObserver;
2700
+ intersectionObserver.observe(element);
2701
+ return () => {
2702
+ intersectionObserver.unobserve(element);
2703
+ intersectionObserverRef.current = null;
2704
+ };
2705
+ }, []);
2706
+ return children(refCallback);
2707
+ }
2708
+ var styles11 = {
2709
+ popover: {
2710
+ padding: 0,
2711
+ zIndex: 1,
2712
+ backgroundColor: "var(--primary-background)",
2713
+ borderRadius: "var(--border-radius-l)",
2714
+ border: "1px solid var(--divider)",
2715
+ overflow: "hidden",
2716
+ boxShadow: "var(--shadow-lg)",
2717
+ animation: "popoverFadeIn 0.15s ease-out"
2718
+ }
2719
+ };
2720
+ function Popover({ children, close }) {
2721
+ const activeElementRef = useRef(null);
2722
+ const focusTrapRoot = useRefEffect(
2723
+ useCallback(
2724
+ (root) => {
2725
+ activeElementRef.current = document.activeElement;
2726
+ const [element] = queryFocusables(root);
2727
+ element ? element.focus() : root.focus();
2728
+ const keydown = (e) => {
2729
+ if (e.key === "Escape") {
2730
+ close();
2731
+ } else if (e.key === "Tab") {
2732
+ const focusables = queryFocusables(root).filter(
2733
+ (element2) => element2.tabIndex !== -1
2734
+ );
2735
+ if (focusables.length === 0) {
2736
+ e.stopPropagation();
2737
+ e.preventDefault();
2738
+ }
2739
+ const focusedIndex = focusables.findIndex(
2740
+ (x) => x === document.activeElement
2741
+ );
2742
+ if (focusables.length === 0) {
2743
+ e.stopPropagation();
2744
+ e.preventDefault();
2745
+ } else if (focusedIndex === focusables.length - 1) {
2746
+ focusables[0].focus();
2747
+ e.stopPropagation();
2748
+ e.preventDefault();
2749
+ } else ;
2750
+ }
2751
+ };
2752
+ const click = () => {
2753
+ close();
2754
+ };
2755
+ const timeout = window.setTimeout(() => {
2756
+ window.addEventListener("keydown", keydown);
2757
+ window.addEventListener("click", click);
2758
+ }, 0);
2759
+ return () => {
2760
+ window.clearTimeout(timeout);
2761
+ activeElementRef.current && activeElementRef.current.focus();
2762
+ window.removeEventListener("keydown", keydown);
2763
+ window.removeEventListener("click", click);
2764
+ };
2765
+ },
2766
+ [close]
2767
+ )
2768
+ );
2769
+ return /* @__PURE__ */ jsx(BaseView, { ref: focusTrapRoot, children });
2770
+ }
2771
+ function PopoverTrigger({
2772
+ PopoverComponent,
2773
+ jss,
2774
+ jssDialog,
2775
+ grow,
2776
+ shrink,
2777
+ tag,
2778
+ children
2779
+ }) {
2780
+ const [popover, setPopover] = useState(null);
2781
+ const dialogRef = useRef(null);
2782
+ const toggle = (input) => {
2783
+ if (popover == null) {
2784
+ dialogRef && dialogRef.current.show();
2785
+ setPopover(
2786
+ /* @__PURE__ */ jsx(
2787
+ PopoverComponent,
2788
+ {
2789
+ ...input,
2790
+ close: () => {
2791
+ dialogRef && dialogRef.current.close();
2792
+ }
2793
+ }
2794
+ )
2795
+ );
2796
+ } else {
2797
+ dialogRef && dialogRef.current.close();
2798
+ }
2799
+ };
2800
+ return /* @__PURE__ */ jsxs(
2801
+ BaseView,
2802
+ {
2803
+ grow,
2804
+ shrink,
2805
+ tag,
2806
+ relative: true,
2807
+ jss: [jss, { position: "relative", display: "inline-block" }],
2808
+ children: [
2809
+ children({ toggle }),
2810
+ /* @__PURE__ */ jsx(
2811
+ "dialog",
2812
+ {
2813
+ ref: (ref) => {
2814
+ dialogRef.current = ref;
2815
+ },
2816
+ className: toClassnames([styles11.popover, jssDialog]),
2817
+ onClose: () => {
2818
+ setPopover(null);
2819
+ },
2820
+ onClick: (e) => {
2821
+ e.preventDefault();
2822
+ e.stopPropagation();
2823
+ },
2824
+ children: popover
2825
+ }
2826
+ )
2827
+ ]
2828
+ }
2829
+ );
2830
+ }
2831
+ var styles12 = {
2832
+ root: {
2833
+ width: "100%",
2834
+ display: "flex",
2835
+ position: "relative",
2836
+ backgroundColor: "var(--primary-background)",
2837
+ borderRadius: "var(--border-radius-s)",
2838
+ border: "1px solid var(--divider)",
2839
+ overflow: "hidden"
2840
+ },
2841
+ fill: {
2842
+ borderRadius: "var(--border-radius-s)",
2843
+ position: "absolute",
2844
+ transformOrigin: "center left",
2845
+ top: 0,
2846
+ bottom: 0,
2847
+ left: 0,
2848
+ right: 0
2849
+ }
2850
+ };
2851
+ var sizes6 = {
2852
+ xsmall: 4,
2853
+ small: 8,
2854
+ medium: 12,
2855
+ large: 16,
2856
+ xlarge: 20,
2857
+ xxlarge: 28,
2858
+ xxxlarge: 36
2859
+ };
2860
+ function ProgressBar({
2861
+ color,
2862
+ progress,
2863
+ size,
2864
+ jss
2865
+ }) {
2866
+ return /* @__PURE__ */ jsx(
2867
+ BaseView,
2868
+ {
2869
+ jss: [
2870
+ styles12.root,
2871
+ {
2872
+ height: sizes6[size]
2873
+ },
2874
+ jss
2875
+ ],
2876
+ children: /* @__PURE__ */ jsx(
2877
+ BaseView,
2878
+ {
2879
+ jss: [styles12.fill, getBackground(color)],
2880
+ style: {
2881
+ transform: `scaleX(${progress > 1 ? 1 : progress})`
2882
+ }
2883
+ }
2884
+ )
2885
+ }
2886
+ );
2887
+ }
2888
+ function ProgressCircle({
2889
+ progress,
2890
+ stroke = 4,
2891
+ outerRadius
2892
+ }) {
2893
+ const circumference = outerRadius * 2 * Math.PI;
2894
+ const strokeDashoffset = circumference - progress * circumference;
2895
+ return /* @__PURE__ */ jsx(
2896
+ "svg",
2897
+ {
2898
+ className: toClassnames({
2899
+ backgroundColor: cssVar("--secondary-background"),
2900
+ transform: "rotate(-90deg)",
2901
+ borderRadius: "50%"
2902
+ }),
2903
+ width: (outerRadius + stroke) * 2,
2904
+ height: (outerRadius + stroke) * 2,
2905
+ children: /* @__PURE__ */ jsx(
2906
+ "circle",
2907
+ {
2908
+ stroke: "var(--highlight)",
2909
+ fill: "transparent",
2910
+ strokeWidth: stroke,
2911
+ strokeDasharray: `${circumference} ${circumference}`,
2912
+ style: { strokeDashoffset },
2913
+ r: outerRadius,
2914
+ cx: outerRadius + stroke,
2915
+ cy: outerRadius + stroke
2916
+ }
2917
+ )
2918
+ }
2919
+ );
2920
+ }
2921
+ function hasCookie(key) {
2922
+ return document.cookie.split(";").map((c) => c.trim()).filter((c) => c.startsWith(`${key}=`)).length > 0;
2923
+ }
2924
+ function getCookie(key, deserialize = JSON.parse) {
2925
+ return document.cookie.split(";").map((c) => c.trim()).filter((c) => c.startsWith(`${key}=`)).map((s) => s.split("=")[1]).map((s) => deserialize(s)).reverse().pop();
2926
+ }
2927
+ function useCookie(key, {
2928
+ initialValue = null,
2929
+ loadingValue,
2930
+ serialize = JSON.stringify,
2931
+ deserialize = JSON.parse,
2932
+ maxAge = 60 * 60 * 24 * 365
2933
+ }) {
2934
+ const initializationRef = useRef(false);
2935
+ const [cookie, setCookie] = useState(() => {
2936
+ if (!isServer()) {
2937
+ const hasPersistedCookie = hasCookie(key);
2938
+ if (hasPersistedCookie) {
2939
+ return getCookie(key, deserialize);
2940
+ } else {
2941
+ return loadingValue;
2942
+ }
2943
+ }
2944
+ return loadingValue;
2945
+ });
2946
+ useEffect(() => {
2947
+ if (initializationRef.current === true) {
2948
+ return;
2949
+ }
2950
+ const hasPersistedCookie = hasCookie(key);
2951
+ if (hasPersistedCookie) {
2952
+ const persistedCookie = getCookie(key, deserialize);
2953
+ setCookie(persistedCookie);
2954
+ } else {
2955
+ document.cookie = `${key}=${serialize(
2956
+ initialValue
2957
+ )}; max-age=${maxAge};path=/;`;
2958
+ setCookie(initialValue);
2959
+ }
2960
+ initializationRef.current = true;
2961
+ }, []);
2962
+ return [
2963
+ cookie,
2964
+ useCallback((t) => {
2965
+ if (typeof t === "function") {
2966
+ const callback = t;
2967
+ setCookie((oldCookie) => {
2968
+ const newValue = callback(oldCookie);
2969
+ document.cookie = `${key}=${serialize(
2970
+ newValue
2971
+ )}; max-age=${maxAge};path=/;`;
2972
+ return newValue;
2973
+ });
2974
+ } else {
2975
+ setCookie(t);
2976
+ document.cookie = `${key}=${serialize(t)}; max-age=${maxAge};path=/;`;
2977
+ }
2978
+ }, [])
2979
+ ];
2980
+ }
2981
+ function Providers({
2982
+ children,
2983
+ themes
2984
+ }) {
2985
+ const [darkModeEnabled, setDarkModeEnabled] = useCookie("dark-mode", {
2986
+ initialValue: false,
2987
+ loadingValue: false
2988
+ });
2989
+ const toggleDarkMode = React34.useCallback(
2990
+ () => setDarkModeEnabled((x) => !x),
2991
+ []
2992
+ );
2993
+ return /* @__PURE__ */ jsx(JSSProvider, { themes, children: /* @__PURE__ */ jsx(IconProvider, { children: /* @__PURE__ */ jsx(DarkModeProvider, { enabled: darkModeEnabled, toggle: toggleDarkMode, children: /* @__PURE__ */ jsx(DialogProvider, { children }) }) }) });
2994
+ }
2995
+ var RangeInput = React34.forwardRef(
2996
+ ({
2997
+ value,
2998
+ onValueChange,
2999
+ jssRoot,
3000
+ jss,
3001
+ gap = "medium",
3002
+ padding = "none",
3003
+ min = 0,
3004
+ max = 100,
3005
+ step = 1,
3006
+ label,
3007
+ addOn,
3008
+ addOnPosition = "start",
3009
+ ...inputProps
3010
+ }, ref) => {
3011
+ return /* @__PURE__ */ jsxs(
3012
+ Row,
3013
+ {
3014
+ gap,
3015
+ padding,
3016
+ align: "center",
3017
+ jss: [
3018
+ {
3019
+ ":has(:focus-visible)": {
3020
+ borderRadius: cssVar("--border-radius-m"),
3021
+ backgroundColor: cssVar("--light-highlight")
3022
+ }
3023
+ },
3024
+ jssRoot
3025
+ ],
3026
+ children: [
3027
+ addOnPosition === "start" && addOn,
3028
+ /* @__PURE__ */ jsx(
3029
+ BaseInput,
3030
+ {
3031
+ ...inputProps,
3032
+ label,
3033
+ min,
3034
+ max,
3035
+ type: "range",
3036
+ ref,
3037
+ value,
3038
+ onChange: (e) => {
3039
+ onValueChange(parseFloat(e.target.value));
3040
+ },
3041
+ jss: [
3042
+ {
3043
+ backgroundColor: cssVar("--primary-background"),
3044
+ flexGrow: 1,
3045
+ color: cssVar("--primary-text"),
3046
+ margin: 0,
3047
+ paddingTop: cssVar("--spacing-m"),
3048
+ paddingBottom: cssVar("--spacing-m"),
3049
+ ":disabled": {
3050
+ color: cssVar("--subtle-text")
3051
+ }
3052
+ },
3053
+ jss
3054
+ ]
3055
+ }
3056
+ ),
3057
+ addOnPosition === "end" && addOn
3058
+ ]
3059
+ }
3060
+ );
3061
+ }
3062
+ );
3063
+ var StackContext = React34.createContext({
3064
+ subscribe: () => {
3065
+ return () => {
3066
+ };
3067
+ }
3068
+ });
3069
+ function StackContextProvider({ children, isTopOfStack }) {
3070
+ const emitterRef = useRef(createEmitter());
3071
+ useEffect(() => {
3072
+ emitterRef.current.emit(isTopOfStack);
3073
+ }, [isTopOfStack]);
3074
+ const value = useMemo(
3075
+ () => ({ subscribe: emitterRef.current.subscribe }),
3076
+ []
3077
+ );
3078
+ return /* @__PURE__ */ jsx(StackContext.Provider, { value, children });
3079
+ }
3080
+ function useIsTopOfStack() {
3081
+ const [isTopOfStack, setIsTopOfStack] = useState(true);
3082
+ const { subscribe } = useContext(StackContext);
3083
+ useEffect(() => {
3084
+ return subscribe(setIsTopOfStack);
3085
+ }, [subscribe]);
3086
+ return isTopOfStack;
3087
+ }
3088
+ function RootView({
3089
+ children,
3090
+ focusOnlyOnFirstMount = true
3091
+ }) {
3092
+ const isTopOfStack = useIsTopOfStack();
3093
+ const firstMountRef = useRef(true);
3094
+ const refCallback = useCallback(
3095
+ (element) => {
3096
+ if (!element) {
3097
+ return;
3098
+ }
3099
+ if (!isTopOfStack) {
3100
+ return;
3101
+ }
3102
+ if (focusOnlyOnFirstMount && !firstMountRef.current) {
3103
+ return;
3104
+ }
3105
+ const focusables = queryFocusables(element);
3106
+ const firstFocusable = focusables[0];
3107
+ firstMountRef.current = false;
3108
+ firstFocusable && firstFocusable.focus();
3109
+ },
3110
+ [isTopOfStack, focusOnlyOnFirstMount]
3111
+ );
3112
+ return /* @__PURE__ */ jsx(
3113
+ Column,
3114
+ {
3115
+ ref: refCallback,
3116
+ jss: {
3117
+ marginBottom: 0,
3118
+ flexGrow: 1,
3119
+ flexShrink: 1,
3120
+ flexBasis: "0%",
3121
+ overflow: "auto",
3122
+ backgroundColor: cssVar("--secondary-background"),
3123
+ minHeight: "600px"
3124
+ },
3125
+ children
3126
+ }
3127
+ );
3128
+ }
3129
+ var Select = forwardRef(
3130
+ ({ jss, children, onValueChange, value, ...otherProps }, ref) => {
3131
+ return /* @__PURE__ */ jsx(
3132
+ "select",
3133
+ {
3134
+ ref,
3135
+ className: toClassnames([
3136
+ {
3137
+ fontSize: 20,
3138
+ border: `1px solid ${cssVar("--divider")}`,
3139
+ backgroundColor: cssVar("--overlay-background"),
3140
+ borderRadius: cssVar("--border-radius-m")
3141
+ },
3142
+ jss
3143
+ ]),
3144
+ value,
3145
+ onChange: (e) => {
3146
+ onValueChange(e.target.value);
3147
+ },
3148
+ ...otherProps,
3149
+ children
3150
+ }
3151
+ );
3152
+ }
3153
+ );
3154
+ function stateMachineContextFactory(stateMachineConfig) {
3155
+ const StateMachineContext = React34.createContext({
3156
+ subscribe: () => {
3157
+ throw new Error("Not implemented");
3158
+ },
3159
+ send: (_) => {
3160
+ throw new Error("Not implemented");
3161
+ }
3162
+ });
3163
+ function Provider({ children }) {
3164
+ const stateMachineRef = useRef({
3165
+ state: stateMachineConfig.state,
3166
+ context: stateMachineConfig.context
3167
+ });
3168
+ const emitterRef = useRef(
3169
+ createEmitter()
3170
+ );
3171
+ const subscribe = useCallback((callback) => {
3172
+ const unsbuscribe = emitterRef.current.subscribe(callback);
3173
+ callback(stateMachineRef.current);
3174
+ return unsbuscribe;
3175
+ }, []);
3176
+ const send = useCallback(
3177
+ (transition, data) => {
3178
+ const state = stateMachineRef.current.state;
3179
+ const transitions = stateMachineConfig.states[state].on;
3180
+ const reducer = transitions[transition];
3181
+ if (!reducer) {
3182
+ return;
3183
+ }
3184
+ const newState = reducer({
3185
+ ...stateMachineRef.current,
3186
+ data
3187
+ });
3188
+ stateMachineRef.current = newState;
3189
+ emitterRef.current.emit(newState);
3190
+ },
3191
+ []
3192
+ );
3193
+ const value = useMemo(() => ({ subscribe, send }), [subscribe, send]);
3194
+ return /* @__PURE__ */ jsx(StateMachineContext.Provider, { value, children });
3195
+ }
3196
+ function useStateMachine() {
3197
+ return useContext(StateMachineContext);
3198
+ }
3199
+ return { Provider, useStateMachine };
3200
+ }
3201
+ var VERSION = 1;
3202
+ function createStorage({
3203
+ initialState,
3204
+ name = "aidos-storage"
3205
+ }) {
3206
+ const StorageContext = createContext({
3207
+ subscribe: () => {
3208
+ throw new Error("Not implemented");
3209
+ },
3210
+ mutate: () => {
3211
+ throw new Error("Not implemented");
3212
+ },
3213
+ persist: () => {
3214
+ throw new Error("Not implemented");
3215
+ }
3216
+ });
3217
+ const state = { current: initialState };
3218
+ function Storage({ children }) {
3219
+ const emitterRef = useRef(createEmitter());
3220
+ const subscribe = useCallback((callback) => {
3221
+ return emitterRef.current.subscribe(callback);
3222
+ }, []);
3223
+ const mutate = useCallback((mutator) => {
3224
+ state.current = mutator(state.current);
3225
+ emitterRef.current.emit(state.current);
3226
+ }, []);
3227
+ const persist = useCallback(async () => {
3228
+ const s = JSON.stringify(state.current);
3229
+ const bytes = new TextEncoder().encode(s);
3230
+ const blob = new Blob([bytes], {
3231
+ type: "application/json;charset=utf-8"
3232
+ });
3233
+ return saveBlob(blob);
3234
+ }, []);
3235
+ useEffect(() => {
3236
+ getBlob().then((blob) => {
3237
+ if (blob == null) {
3238
+ return;
3239
+ }
3240
+ const fr = new FileReader();
3241
+ fr.onload = (event) => {
3242
+ const text = event.target.result.toString();
3243
+ state.current = JSON.parse(text);
3244
+ emitterRef.current.emit(state.current);
3245
+ };
3246
+ fr.onerror = (error) => {
3247
+ };
3248
+ fr.readAsText(blob);
3249
+ });
3250
+ }, []);
3251
+ return /* @__PURE__ */ jsx(
3252
+ StorageContext.Provider,
3253
+ {
3254
+ value: {
3255
+ subscribe,
3256
+ mutate,
3257
+ persist
3258
+ },
3259
+ children
3260
+ }
3261
+ );
3262
+ }
3263
+ function useStorage(selector) {
3264
+ const [localState, setLocalState] = useState(() => selector(state.current));
3265
+ const { subscribe } = React34.useContext(StorageContext);
3266
+ useEffect(() => {
3267
+ return subscribe((newState) => {
3268
+ const newLocalState = selector(newState);
3269
+ setLocalState((prev) => newLocalState != prev ? newLocalState : prev);
3270
+ });
3271
+ }, []);
3272
+ return localState;
3273
+ }
3274
+ function useMutation() {
3275
+ const { mutate } = React34.useContext(StorageContext);
3276
+ return mutate;
3277
+ }
3278
+ function usePersist() {
3279
+ const { persist } = React34.useContext(StorageContext);
3280
+ return persist;
3281
+ }
3282
+ const dbPromise = new Promise((resolve, reject) => {
3283
+ const request = window.indexedDB.open(name, VERSION);
3284
+ request.onerror = (event) => {
3285
+ reject(event);
3286
+ };
3287
+ request.onupgradeneeded = (event) => {
3288
+ const db = event.target.result;
3289
+ const table = db.createObjectStore("blobs", {
3290
+ keyPath: "key"
3291
+ });
3292
+ table.createIndex("key", "key", { unique: true });
3293
+ };
3294
+ request.onsuccess = (event) => {
3295
+ const db = event.target.result;
3296
+ resolve(db);
3297
+ };
3298
+ });
3299
+ const getBlob = async () => {
3300
+ const db = await dbPromise;
3301
+ return new Promise((resolve, reject) => {
3302
+ const transaction = db.transaction(["blobs"]);
3303
+ const objectStore = transaction.objectStore("blobs");
3304
+ const get = objectStore.get(1);
3305
+ transaction.onerror = (event) => {
3306
+ db.close();
3307
+ reject(event);
3308
+ };
3309
+ get.onsuccess = (event) => {
3310
+ const result = event.target.result;
3311
+ if (result && result.blob) {
3312
+ resolve(result.blob);
3313
+ } else {
3314
+ resolve(null);
3315
+ }
3316
+ db.close();
3317
+ };
3318
+ get.onerror = (event) => {
3319
+ reject(event);
3320
+ };
3321
+ });
3322
+ };
3323
+ const saveBlob = async (blob) => {
3324
+ const db = await dbPromise;
3325
+ return new Promise((resolve, reject) => {
3326
+ const transaction = db.transaction(["blobs"], "readwrite");
3327
+ transaction.oncomplete = () => {
3328
+ db.close();
3329
+ resolve();
3330
+ };
3331
+ transaction.onerror = (event) => {
3332
+ db.close();
3333
+ reject(event);
3334
+ };
3335
+ const objectStore = transaction.objectStore("blobs");
3336
+ objectStore.put({ blob, key: 1 });
3337
+ });
3338
+ };
3339
+ return {
3340
+ Storage,
3341
+ useStorage,
3342
+ useMutation,
3343
+ usePersist
3344
+ };
3345
+ }
3346
+ var useStream = ({
3347
+ render,
3348
+ bufferStart,
3349
+ bufferEnd,
3350
+ index,
3351
+ debounce = 100
3352
+ }) => {
3353
+ const cache = useRef({
3354
+ [index]: render(index)
3355
+ });
3356
+ const [frame, setFrame] = useState(cache.current[index]);
3357
+ const timeout = useRef(null);
3358
+ useEffect(() => {
3359
+ clearTimeout(timeout.current);
3360
+ const subscriptions = [];
3361
+ timeout.current = setTimeout(() => {
3362
+ for (let i = index - bufferStart; i < index + bufferEnd; i++) {
3363
+ subscriptions.push(
3364
+ requestIdleCallback(() => {
3365
+ if (!(i in cache.current)) {
3366
+ cache.current[i] = render(i);
3367
+ if (i === index) {
3368
+ setFrame(cache.current[index]);
3369
+ }
3370
+ }
3371
+ })
3372
+ );
3373
+ }
3374
+ startTransition(() => {
3375
+ setFrame(cache.current[index]);
3376
+ });
3377
+ }, debounce);
3378
+ return () => {
3379
+ subscriptions.forEach((handle) => {
3380
+ cancelIdleCallback(handle);
3381
+ });
3382
+ };
3383
+ }, [index]);
3384
+ return {
3385
+ frame
3386
+ };
3387
+ };
3388
+ function Sublist({
3389
+ children,
3390
+ label,
3391
+ labelBold,
3392
+ initialState = { collapsed: false },
3393
+ jss,
3394
+ secondaryAddOn
3395
+ }) {
3396
+ const [collapsed, setCollapsed] = React34.useState(initialState.collapsed);
3397
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3398
+ /* @__PURE__ */ jsx(
3399
+ ListButtonItem,
3400
+ {
3401
+ headline: label,
3402
+ headlineBold: labelBold,
3403
+ onClick: () => setCollapsed((x) => !x),
3404
+ jss,
3405
+ addOn: /* @__PURE__ */ jsxs(Row, { gap: "medium", align: "center", children: [
3406
+ secondaryAddOn,
3407
+ /* @__PURE__ */ jsx(
3408
+ Box,
3409
+ {
3410
+ padding: "medium",
3411
+ jss: [
3412
+ {
3413
+ transition: "transform 0.15s ease-in"
3414
+ },
3415
+ !collapsed && {
3416
+ transform: "rotateZ(90deg)"
3417
+ }
3418
+ ],
3419
+ children: /* @__PURE__ */ jsx(
3420
+ Icon,
3421
+ {
3422
+ color: "primary",
3423
+ size: "medium",
3424
+ icon: "fa-solid:chevron-right"
3425
+ }
3426
+ )
3427
+ }
3428
+ )
3429
+ ] }),
3430
+ addOnPosition: "end",
3431
+ color: "primary"
3432
+ }
3433
+ ),
3434
+ collapsed ? null : children
3435
+ ] });
3436
+ }
3437
+ function SubmitIconInput({ icon, ...otherProps }) {
3438
+ return /* @__PURE__ */ jsx(
3439
+ BaseInput,
3440
+ {
3441
+ label: /* @__PURE__ */ jsx(
3442
+ Box,
3443
+ {
3444
+ jss: {
3445
+ cursor: "pointer",
3446
+ display: "flex",
3447
+ justifyContent: "center",
3448
+ alignItems: "center",
3449
+ ":hover": {
3450
+ backgroundColor: "var(--secondary-background)",
3451
+ opacity: 0.8
3452
+ },
3453
+ ":active": {
3454
+ transform: "scale(0.92)"
3455
+ },
3456
+ height: 32,
3457
+ width: 32,
3458
+ borderRadius: 16
3459
+ },
3460
+ children: /* @__PURE__ */ jsx(Icon, { icon, size: "medium", color: "primary" })
3461
+ }
3462
+ ),
3463
+ ...otherProps,
3464
+ type: "submit",
3465
+ jss: {
3466
+ visibility: "hidden"
3467
+ },
3468
+ value: ""
3469
+ }
3470
+ );
3471
+ }
3472
+ function Tabs({
3473
+ tabs,
3474
+ gap = "none",
3475
+ padding = "none",
3476
+ tabPadding = "medium",
3477
+ labelSize = "large",
3478
+ jss,
3479
+ jssTab,
3480
+ labelRenderer,
3481
+ ["aria-controls"]: ariaControls,
3482
+ ...otherProps
3483
+ }) {
3484
+ const root = useNavigation();
3485
+ return /* @__PURE__ */ jsx(
3486
+ Row,
3487
+ {
3488
+ role: "tablist",
3489
+ jss,
3490
+ gap,
3491
+ padding,
3492
+ ref: root,
3493
+ ...otherProps,
3494
+ children: tabs.map(
3495
+ ({
3496
+ label,
3497
+ href,
3498
+ onClick,
3499
+ selected,
3500
+ addOn,
3501
+ addOnPosition = "start"
3502
+ }) => {
3503
+ const BaseComponent = href != null ? BaseLink : BaseButton;
3504
+ return /* @__PURE__ */ jsxs(
3505
+ BaseComponent,
3506
+ {
3507
+ "aria-controls": ariaControls,
3508
+ role: "tab",
3509
+ "aria-selected": selected ? "true" : void 0,
3510
+ bare: true,
3511
+ color: selected ? "positive" : "primary",
3512
+ href,
3513
+ onClick,
3514
+ animateInteraction: false,
3515
+ jss: [
3516
+ {
3517
+ textDecoration: "none",
3518
+ borderBottom: selected ? `3px solid ${cssVar("--highlight")}` : `3px solid transparent`,
3519
+ ":active span": {
3520
+ transform: "scale(0.97)"
3521
+ },
3522
+ ":first-child": {
3523
+ borderTopLeftRadius: cssVar("--border-radius-m")
3524
+ },
3525
+ ":last-child": {
3526
+ borderTopRightRadius: cssVar("--border-radius-m")
3527
+ },
3528
+ ":hover": {
3529
+ backgroundColor: cssVar("--hovered-background")
3530
+ },
3531
+ ":active:hover": {
3532
+ backgroundColor: cssVar("--pressed-background")
3533
+ }
3534
+ },
3535
+ getPadding(tabPadding),
3536
+ typeof jssTab === "function" ? jssTab({ selected }) : jssTab
3537
+ ],
3538
+ children: [
3539
+ addOnPosition === "start" && addOn,
3540
+ /* @__PURE__ */ jsx(Text, { size: labelSize, color: selected ? "primary" : "secondary", children: labelRenderer ? labelRenderer(label) : label }),
3541
+ addOnPosition === "end" && addOn
3542
+ ]
3543
+ },
3544
+ label
3545
+ );
3546
+ }
3547
+ )
3548
+ }
3549
+ );
3550
+ }
3551
+ var TextArea = React34.forwardRef(
3552
+ ({
3553
+ jss,
3554
+ onValueChange,
3555
+ value,
3556
+ padding = "medium",
3557
+ ...otherProps
3558
+ }, ref) => {
3559
+ return /* @__PURE__ */ jsx(
3560
+ "textarea",
3561
+ {
3562
+ ...otherProps,
3563
+ ref,
3564
+ className: toClassnames([
3565
+ {
3566
+ flexGrow: 1,
3567
+ color: cssVar("--primary-text"),
3568
+ outline: "none",
3569
+ fontSize: 20,
3570
+ lineHeight: 24 / 20,
3571
+ backgroundColor: cssVar("--overlay-background"),
3572
+ border: `1px solid ${cssVar("--divider")}`,
3573
+ borderRadius: cssVar("--border-radius-m"),
3574
+ "::placeholder": {
3575
+ color: cssVar("--subtle-text")
3576
+ },
3577
+ ":focus-visible": {
3578
+ outline: `2px solid ${cssVar("--highlight")}`,
3579
+ outlineOffset: -2
3580
+ }
3581
+ },
3582
+ getPadding(padding),
3583
+ jss
3584
+ ]),
3585
+ value,
3586
+ onChange: onValueChange ? (e) => onValueChange(e.target.value) : void 0
3587
+ }
3588
+ );
3589
+ }
3590
+ );
3591
+ var fontSize2 = {
3592
+ xsmall: cssVar("--font-xsmall"),
3593
+ small: cssVar("--font-small"),
3594
+ medium: cssVar("--font-medium"),
3595
+ large: cssVar("--font-large"),
3596
+ xlarge: cssVar("--font-xlarge"),
3597
+ xxlarge: cssVar("--font-xxlarge"),
3598
+ xxxlarge: cssVar("--font-xxxlarge")
3599
+ };
3600
+ var TextInput = React34.forwardRef(
3601
+ ({
3602
+ value,
3603
+ onValueChange,
3604
+ jssRoot,
3605
+ jss,
3606
+ addOn,
3607
+ gap = "small",
3608
+ addOnPosition = "start",
3609
+ padding = "medium",
3610
+ bare,
3611
+ size = "medium",
3612
+ ...inputProps
3613
+ }, ref) => {
3614
+ return /* @__PURE__ */ jsxs(
3615
+ Row,
3616
+ {
3617
+ gap,
3618
+ jss: [
3619
+ {
3620
+ borderRadius: cssVar("--border-radius-m"),
3621
+ overflow: "hidden"
3622
+ },
3623
+ bare ? {
3624
+ backgroundColor: "inherit",
3625
+ ":has(:focus-visible)": {
3626
+ backgroundColor: cssVar("--light-highlight")
3627
+ }
3628
+ } : {
3629
+ border: `1px solid ${cssVar("--divider")}`,
3630
+ backgroundColor: cssVar("--overlay-background"),
3631
+ ":has(:focus-visible)": {
3632
+ outline: `2px solid ${cssVar("--highlight")}`,
3633
+ outlineOffset: -2
3634
+ }
3635
+ },
3636
+ jssRoot
3637
+ ],
3638
+ children: [
3639
+ addOnPosition === "start" && addOn && /* @__PURE__ */ jsx(
3640
+ Column,
3641
+ {
3642
+ justify: "center",
3643
+ align: "center",
3644
+ jss: [getPadding(padding), { paddingRight: 0 }],
3645
+ children: addOn
3646
+ }
3647
+ ),
3648
+ /* @__PURE__ */ jsx(
3649
+ BaseInput,
3650
+ {
3651
+ ...inputProps,
3652
+ ref,
3653
+ value,
3654
+ onChange: onValueChange ? (e) => onValueChange(e.target.value) : void 0,
3655
+ jss: [
3656
+ {
3657
+ minWidth: 0,
3658
+ flexGrow: 1,
3659
+ backgroundColor: "inherit",
3660
+ color: cssVar("--primary-text"),
3661
+ outline: "none",
3662
+ border: "none",
3663
+ fontSize: fontSize2[size],
3664
+ lineHeight: 1.2,
3665
+ "::placeholder": {
3666
+ color: cssVar("--subtle-text")
3667
+ },
3668
+ ":disabled": {
3669
+ color: cssVar("--subtle-text")
3670
+ }
3671
+ },
3672
+ getPadding(padding),
3673
+ addOn && addOnPosition === "start" ? { paddingLeft: 0 } : null,
3674
+ addOn && addOnPosition === "end" ? { paddingRight: 0 } : null,
3675
+ jss
3676
+ ]
3677
+ }
3678
+ ),
3679
+ addOnPosition === "end" && addOn && /* @__PURE__ */ jsx(
3680
+ Column,
3681
+ {
3682
+ justify: "center",
3683
+ align: "center",
3684
+ jss: [getPadding(padding), { paddingLeft: 0 }],
3685
+ children: addOn
3686
+ }
3687
+ )
3688
+ ]
3689
+ }
3690
+ );
3691
+ }
3692
+ );
3693
+ function TextInputWithState({
3694
+ valueRef,
3695
+ onValueChange: externalOnChange,
3696
+ ...otherProps
3697
+ }) {
3698
+ const [value, setValue] = useState(valueRef.current);
3699
+ const onValueChange = useCallback(
3700
+ (value2) => {
3701
+ valueRef.current = value2;
3702
+ setValue(value2);
3703
+ externalOnChange && externalOnChange(value2);
3704
+ },
3705
+ [setValue, externalOnChange, valueRef]
3706
+ );
3707
+ return /* @__PURE__ */ jsx(TextInput, { ...otherProps, value, onValueChange });
3708
+ }
3709
+ var timeFormatter = Intl.DateTimeFormat("en-GB", {
3710
+ hour: "2-digit",
3711
+ minute: "2-digit",
3712
+ hourCycle: "h23"
3713
+ });
3714
+ function TimeInputInternal({
3715
+ time: date,
3716
+ onTimeChange: onDateChange,
3717
+ jss,
3718
+ addOn,
3719
+ padding = "small",
3720
+ gap = "none",
3721
+ addOnPosition = "start",
3722
+ bare,
3723
+ ...inputProps
3724
+ }, ref) {
3725
+ return /* @__PURE__ */ jsxs(
3726
+ Row,
3727
+ {
3728
+ padding,
3729
+ gap,
3730
+ align: "center",
3731
+ jss: [
3732
+ {
3733
+ borderRadius: cssVar("--border-radius-m"),
3734
+ overflow: "hidden"
3735
+ },
3736
+ bare ? {
3737
+ backgroundColor: "inherit",
3738
+ ":has(:focus-visible)": {
3739
+ backgroundColor: cssVar("--light-highlight")
3740
+ }
3741
+ } : {
3742
+ border: `1px solid ${cssVar("--divider")}`,
3743
+ backgroundColor: cssVar("--overlay-background"),
3744
+ ":has(:focus-visible)": {
3745
+ outline: `2px solid ${cssVar("--highlight")}`,
3746
+ outlineOffset: -2
3747
+ }
3748
+ }
3749
+ ],
3750
+ children: [
3751
+ addOnPosition === "start" && addOn,
3752
+ /* @__PURE__ */ jsx(
3753
+ BaseInput,
3754
+ {
3755
+ ...inputProps,
3756
+ type: "time",
3757
+ ref,
3758
+ value: formatTimeInputValue(date),
3759
+ onChange: (e) => {
3760
+ const value = e.target.value;
3761
+ const [hour, minute] = value.split(":");
3762
+ onDateChange(
3763
+ new Date(
3764
+ date.getFullYear(),
3765
+ date.getMonth(),
3766
+ date.getDate(),
3767
+ parseInt(hour),
3768
+ parseInt(minute)
3769
+ )
3770
+ );
3771
+ },
3772
+ jss: [
3773
+ {
3774
+ flexGrow: 1,
3775
+ backgroundColor: "inherit",
3776
+ color: "var(--primary-text)",
3777
+ outline: "none",
3778
+ border: "none",
3779
+ fontSize: 20,
3780
+ lineHeight: 24 / 20,
3781
+ "::placeholder": {
3782
+ color: "var(--subtle-text);"
3783
+ },
3784
+ ":disabled": {
3785
+ color: "var(--subtle-text);"
3786
+ },
3787
+ "::-webkit-calendar-picker-indicator": {
3788
+ backgroundColor: "none"
3789
+ }
3790
+ },
3791
+ jss
3792
+ ]
3793
+ }
3794
+ ),
3795
+ addOnPosition === "end" && addOn
3796
+ ]
3797
+ }
3798
+ );
3799
+ }
3800
+ var TimeInput = React34.forwardRef(TimeInputInternal);
3801
+ var styles13 = {
3802
+ tooltip: {
3803
+ top: "-100%",
3804
+ transform: "translateY(50%)",
3805
+ backgroundColor: cssVar("--primary-background"),
3806
+ padding: `${cssVar("--spacing-s")} ${cssVar("--spacing-m")}`,
3807
+ borderRadius: cssVar("--border-radius-m"),
3808
+ border: `1px solid ${cssVar("--divider")}`,
3809
+ boxShadow: cssVar("--shadow-md"),
3810
+ overflow: "hidden",
3811
+ animation: "popoverFadeIn 0.15s ease-out"
3812
+ }
3813
+ };
3814
+ function Tooltip({ content, jss, tag, children }) {
3815
+ const [tooltip, setTooltip] = useState(null);
3816
+ const dialogRef = useRef(null);
3817
+ const focusTrapRoot = useRefEffect(
3818
+ useCallback((root) => {
3819
+ dialogRef.current = root;
3820
+ const keydown = (e) => {
3821
+ if (e.key === "Escape") {
3822
+ dialogRef.current?.close();
3823
+ } else if (e.key === "Tab") {
3824
+ dialogRef.current?.close();
3825
+ }
3826
+ };
3827
+ const click = () => {
3828
+ dialogRef.current?.close();
3829
+ };
3830
+ window.addEventListener("keydown", keydown);
3831
+ window.addEventListener("click", click);
3832
+ const activeElement = document.activeElement;
3833
+ root.show();
3834
+ activeElement.focus();
3835
+ return () => {
3836
+ window.removeEventListener("keydown", keydown);
3837
+ window.removeEventListener("click", click);
3838
+ };
3839
+ }, [])
3840
+ );
3841
+ const toggle = () => {
3842
+ if (tooltip == null) {
3843
+ setTooltip(
3844
+ /* @__PURE__ */ jsx(
3845
+ "dialog",
3846
+ {
3847
+ role: "tooltip",
3848
+ ref: (ref) => {
3849
+ dialogRef.current = ref;
3850
+ focusTrapRoot(ref);
3851
+ },
3852
+ className: toClassnames(styles13.tooltip),
3853
+ onClose: () => {
3854
+ setTooltip(null);
3855
+ },
3856
+ onClick: (e) => {
3857
+ e.preventDefault();
3858
+ e.stopPropagation();
3859
+ },
3860
+ children: /* @__PURE__ */ jsx(Text, { size: "medium", color: "secondary", children: content })
3861
+ }
3862
+ )
3863
+ );
3864
+ } else {
3865
+ setTooltip(null);
3866
+ }
3867
+ };
3868
+ return /* @__PURE__ */ jsxs(
3869
+ BaseView,
3870
+ {
3871
+ tag,
3872
+ relative: true,
3873
+ jss: [{ display: "inline-block" }, jss],
3874
+ onMouseEnter: () => {
3875
+ if (tooltip == null) {
3876
+ toggle();
3877
+ }
3878
+ },
3879
+ onMouseLeave: () => {
3880
+ if (tooltip != null) {
3881
+ toggle();
3882
+ }
3883
+ },
3884
+ children: [
3885
+ children,
3886
+ tooltip
3887
+ ]
3888
+ }
3889
+ );
3890
+ }
3891
+ function useKeyboard(shortcuts) {
3892
+ return useRefEffect(
3893
+ useCallback(
3894
+ (root) => {
3895
+ const onKeyDown = (e) => {
3896
+ for (const {
3897
+ metaKey,
3898
+ key,
3899
+ action,
3900
+ ctrlKey,
3901
+ onlyWhenFocused
3902
+ } of shortcuts) {
3903
+ if (metaKey && e.metaKey !== true) {
3904
+ continue;
3905
+ } else if (ctrlKey && e.ctrlKey !== true) {
3906
+ continue;
3907
+ } else if (onlyWhenFocused && document.activeElement !== root) {
3908
+ continue;
3909
+ }
3910
+ if (e.key.toLowerCase() === key.toLowerCase()) {
3911
+ action(root);
3912
+ }
3913
+ }
3914
+ };
3915
+ window.addEventListener("keydown", onKeyDown);
3916
+ return () => {
3917
+ window.removeEventListener("keydown", onKeyDown);
3918
+ };
3919
+ },
3920
+ [shortcuts]
3921
+ )
3922
+ );
3923
+ }
3924
+ function usePromise(promiseFactory, inputs, initialValue) {
3925
+ const [value, setValue] = useState(initialValue);
3926
+ const [error, setError] = useState(null);
3927
+ useEffect(() => {
3928
+ promiseFactory().then((value2) => setValue(value2)).catch((error2) => setError(error2));
3929
+ }, inputs);
3930
+ return [value, error];
3931
+ }
3932
+
3933
+ export { Badge, BaseButton, BaseInput, BaseLink, BaseLinkComponentOverrideContext, BaseList, BaseListAddOn, BaseListItem, BaseView, Box, Button, Calendar, Card, Checkbox, Circle, Column, DESKTOP_MEDIA, DarkModeContext, DarkModeProvider, DarkModeToggle, DateInput, DatePicker, DatetimeInput, Dialog, DialogProvider, Dropdown, FlexLayout, H1, H2, H3, Icon, IconButton, IconLink, IconProvider, JSSProvider, JSServerStyles, LAPTOP, LAPTOP_MEDIA, Label, Li, Link, List, ListButtonItem, ListDivider, ListHeaderItem, ListItem, ListLinkItem, ListSpacer, MOBILE, MOBILE_MEDIA, MenuIcon, OnVisible, P, Popover, PopoverTrigger, ProgressBar, ProgressCircle, Providers, RangeInput, RootView, Row, Select, Span, StackContextProvider, StaticCheckbox, Sublist, SubmitIconInput, TABLET, TABLET_MEDIA, Tabs, Text, TextArea, TextInput, TextInputWithState, TextPairing, TimeInput, Tooltip, baseStyles, createEmitter, createStorage, cssVar, darkTheme, desktop, getBackground, getBaseStyles, getCookie, getMargin, getPadding, getSize, getSpacing, getTextColor, guid, hasCookie, hash, laptop, lightTheme, mobile, numberToBase, sizes3 as sizes, stateMachineContextFactory, tablet, timeFormatter, toClassnames, useCookie, useDialog, useIsTopOfStack, useKeyboard, useListContext, useNavigation, usePromise, useRefEffect, useStream };
3934
+ //# sourceMappingURL=index.js.map
69
3935
  //# sourceMappingURL=index.js.map