aidos-ui 4.0.3 → 4.0.5

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