aidos-ui 4.0.4 → 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 (376) 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 +3 -1
  13. package/dist/vite-plugin-jss-debug.js +57 -74
  14. package/dist/vite-plugin-jss-debug.js.map +1 -1
  15. package/package.json +58 -27
  16. package/.prettierrc +0 -4
  17. package/CLAUDE.md +0 -72
  18. package/dist/Badge.d.ts +0 -6
  19. package/dist/Badge.js +0 -22
  20. package/dist/Badge.js.map +0 -1
  21. package/dist/BaseButton.d.ts +0 -14
  22. package/dist/BaseButton.js +0 -23
  23. package/dist/BaseButton.js.map +0 -1
  24. package/dist/BaseInput.d.ts +0 -14
  25. package/dist/BaseInput.js +0 -15
  26. package/dist/BaseInput.js.map +0 -1
  27. package/dist/BaseLink.d.ts +0 -18
  28. package/dist/BaseLink.js +0 -29
  29. package/dist/BaseLink.js.map +0 -1
  30. package/dist/BaseList.d.ts +0 -6
  31. package/dist/BaseList.js +0 -14
  32. package/dist/BaseList.js.map +0 -1
  33. package/dist/BaseListAddOn.d.ts +0 -5
  34. package/dist/BaseListAddOn.js +0 -7
  35. package/dist/BaseListAddOn.js.map +0 -1
  36. package/dist/BaseListItem.d.ts +0 -26
  37. package/dist/BaseListItem.js +0 -29
  38. package/dist/BaseListItem.js.map +0 -1
  39. package/dist/BaseView.d.ts +0 -12
  40. package/dist/BaseView.js +0 -26
  41. package/dist/BaseView.js.map +0 -1
  42. package/dist/Box.d.ts +0 -4
  43. package/dist/Box.js +0 -6
  44. package/dist/Box.js.map +0 -1
  45. package/dist/Button.d.ts +0 -20
  46. package/dist/Button.js +0 -19
  47. package/dist/Button.js.map +0 -1
  48. package/dist/Calendar.d.ts +0 -18
  49. package/dist/Calendar.js +0 -57
  50. package/dist/Calendar.js.map +0 -1
  51. package/dist/Card.d.ts +0 -4
  52. package/dist/Card.js +0 -14
  53. package/dist/Card.js.map +0 -1
  54. package/dist/Checkbox.d.ts +0 -11
  55. package/dist/Checkbox.js +0 -32
  56. package/dist/Checkbox.js.map +0 -1
  57. package/dist/Circle.d.ts +0 -5
  58. package/dist/Circle.js +0 -12
  59. package/dist/Circle.js.map +0 -1
  60. package/dist/Column.d.ts +0 -6
  61. package/dist/Column.js +0 -7
  62. package/dist/Column.js.map +0 -1
  63. package/dist/DarkMode.d.ts +0 -13
  64. package/dist/DarkMode.js +0 -62
  65. package/dist/DarkMode.js.map +0 -1
  66. package/dist/DateInput.d.ts +0 -13
  67. package/dist/DateInput.js +0 -29
  68. package/dist/DateInput.js.map +0 -1
  69. package/dist/DatePicker.d.ts +0 -11
  70. package/dist/DatePicker.js +0 -34
  71. package/dist/DatePicker.js.map +0 -1
  72. package/dist/DatetimeInput.d.ts +0 -13
  73. package/dist/DatetimeInput.js +0 -31
  74. package/dist/DatetimeInput.js.map +0 -1
  75. package/dist/DesignBook.d.ts +0 -1
  76. package/dist/DesignBook.js +0 -55
  77. package/dist/DesignBook.js.map +0 -1
  78. package/dist/Dialog.d.ts +0 -17
  79. package/dist/Dialog.js +0 -92
  80. package/dist/Dialog.js.map +0 -1
  81. package/dist/Dropdown.d.ts +0 -14
  82. package/dist/Dropdown.js +0 -65
  83. package/dist/Dropdown.js.map +0 -1
  84. package/dist/Emitter.d.ts +0 -6
  85. package/dist/Emitter.js +0 -19
  86. package/dist/Emitter.js.map +0 -1
  87. package/dist/FlexLayout.d.ts +0 -11
  88. package/dist/FlexLayout.js +0 -18
  89. package/dist/FlexLayout.js.map +0 -1
  90. package/dist/Icon.d.ts +0 -12
  91. package/dist/Icon.js +0 -60
  92. package/dist/Icon.js.map +0 -1
  93. package/dist/IconButton.d.ts +0 -11
  94. package/dist/IconButton.js +0 -34
  95. package/dist/IconButton.js.map +0 -1
  96. package/dist/IconLink.d.ts +0 -9
  97. package/dist/IconLink.js +0 -32
  98. package/dist/IconLink.js.map +0 -1
  99. package/dist/IconType.d.ts +0 -1
  100. package/dist/IconType.js +0 -2
  101. package/dist/IconType.js.map +0 -1
  102. package/dist/Interactable.d.ts +0 -50
  103. package/dist/Interactable.js +0 -169
  104. package/dist/Interactable.js.map +0 -1
  105. package/dist/JSSComment.d.ts +0 -10
  106. package/dist/JSSComment.js +0 -52
  107. package/dist/JSSComment.js.map +0 -1
  108. package/dist/Link.d.ts +0 -22
  109. package/dist/Link.js +0 -29
  110. package/dist/Link.js.map +0 -1
  111. package/dist/List.d.ts +0 -15
  112. package/dist/List.js +0 -29
  113. package/dist/List.js.map +0 -1
  114. package/dist/ListButtonItem.d.ts +0 -14
  115. package/dist/ListButtonItem.js +0 -11
  116. package/dist/ListButtonItem.js.map +0 -1
  117. package/dist/ListDivider.d.ts +0 -1
  118. package/dist/ListDivider.js +0 -12
  119. package/dist/ListDivider.js.map +0 -1
  120. package/dist/ListHeaderItem.d.ts +0 -10
  121. package/dist/ListHeaderItem.js +0 -15
  122. package/dist/ListHeaderItem.js.map +0 -1
  123. package/dist/ListItem.d.ts +0 -9
  124. package/dist/ListItem.js +0 -9
  125. package/dist/ListItem.js.map +0 -1
  126. package/dist/ListLinkItem.d.ts +0 -16
  127. package/dist/ListLinkItem.js +0 -11
  128. package/dist/ListLinkItem.js.map +0 -1
  129. package/dist/ListSpacer.d.ts +0 -1
  130. package/dist/ListSpacer.js +0 -13
  131. package/dist/ListSpacer.js.map +0 -1
  132. package/dist/MenuIcon.d.ts +0 -5
  133. package/dist/MenuIcon.js +0 -31
  134. package/dist/MenuIcon.js.map +0 -1
  135. package/dist/NextJSRouter.d.ts +0 -1
  136. package/dist/NextJSRouter.js +0 -37
  137. package/dist/NextJSRouter.js.map +0 -1
  138. package/dist/NextJSRouterState.d.ts +0 -38
  139. package/dist/NextJSRouterState.js +0 -111
  140. package/dist/NextJSRouterState.js.map +0 -1
  141. package/dist/OnVisible.d.ts +0 -5
  142. package/dist/OnVisible.js +0 -28
  143. package/dist/OnVisible.js.map +0 -1
  144. package/dist/Popover.d.ts +0 -22
  145. package/dist/Popover.js +0 -90
  146. package/dist/Popover.js.map +0 -1
  147. package/dist/ProgressBar.d.ts +0 -7
  148. package/dist/ProgressBar.js +0 -42
  149. package/dist/ProgressBar.js.map +0 -1
  150. package/dist/ProgressCircle.d.ts +0 -5
  151. package/dist/ProgressCircle.js +0 -12
  152. package/dist/ProgressCircle.js.map +0 -1
  153. package/dist/Providers.d.ts +0 -9
  154. package/dist/Providers.js +0 -16
  155. package/dist/Providers.js.map +0 -1
  156. package/dist/RangeInput.d.ts +0 -14
  157. package/dist/RangeInput.js +0 -32
  158. package/dist/RangeInput.js.map +0 -1
  159. package/dist/ResultOrError.d.ts +0 -13
  160. package/dist/ResultOrError.js +0 -7
  161. package/dist/ResultOrError.js.map +0 -1
  162. package/dist/RootView.d.ts +0 -5
  163. package/dist/RootView.js +0 -35
  164. package/dist/RootView.js.map +0 -1
  165. package/dist/Row.d.ts +0 -6
  166. package/dist/Row.js +0 -7
  167. package/dist/Row.js.map +0 -1
  168. package/dist/Select.d.ts +0 -9
  169. package/dist/Select.js +0 -17
  170. package/dist/Select.js.map +0 -1
  171. package/dist/StackContext.d.ts +0 -8
  172. package/dist/StackContext.js +0 -25
  173. package/dist/StackContext.js.map +0 -1
  174. package/dist/StaticCheckbox.d.ts +0 -16
  175. package/dist/StaticCheckbox.js +0 -48
  176. package/dist/StaticCheckbox.js.map +0 -1
  177. package/dist/Storage.d.ts +0 -13
  178. package/dist/Storage.js +0 -146
  179. package/dist/Storage.js.map +0 -1
  180. package/dist/Stream.d.ts +0 -9
  181. package/dist/Stream.js +0 -36
  182. package/dist/Stream.js.map +0 -1
  183. package/dist/Sublist.d.ts +0 -12
  184. package/dist/Sublist.js +0 -18
  185. package/dist/Sublist.js.map +0 -1
  186. package/dist/SubmitIconInput.d.ts +0 -8
  187. package/dist/SubmitIconInput.js +0 -25
  188. package/dist/SubmitIconInput.js.map +0 -1
  189. package/dist/Tabs.d.ts +0 -23
  190. package/dist/Tabs.js +0 -39
  191. package/dist/Tabs.js.map +0 -1
  192. package/dist/Text.d.ts +0 -25
  193. package/dist/Text.js +0 -52
  194. package/dist/Text.js.map +0 -1
  195. package/dist/TextArea.d.ts +0 -11
  196. package/dist/TextArea.js +0 -27
  197. package/dist/TextArea.js.map +0 -1
  198. package/dist/TextInput.d.ts +0 -15
  199. package/dist/TextInput.js +0 -61
  200. package/dist/TextInput.js.map +0 -1
  201. package/dist/TextInputWithState.d.ts +0 -8
  202. package/dist/TextInputWithState.js +0 -14
  203. package/dist/TextInputWithState.js.map +0 -1
  204. package/dist/TextPairing.d.ts +0 -21
  205. package/dist/TextPairing.js +0 -26
  206. package/dist/TextPairing.js.map +0 -1
  207. package/dist/TimeInput.d.ts +0 -15
  208. package/dist/TimeInput.js +0 -58
  209. package/dist/TimeInput.js.map +0 -1
  210. package/dist/Tooltip.d.ts +0 -11
  211. package/dist/Tooltip.js +0 -73
  212. package/dist/Tooltip.js.map +0 -1
  213. package/dist/aria.d.ts +0 -8
  214. package/dist/aria.js +0 -42
  215. package/dist/aria.js.map +0 -1
  216. package/dist/guid.d.ts +0 -1
  217. package/dist/guid.js +0 -7
  218. package/dist/guid.js.map +0 -1
  219. package/dist/hash.d.ts +0 -1
  220. package/dist/hash.js +0 -20
  221. package/dist/hash.js.map +0 -1
  222. package/dist/isServer.d.ts +0 -1
  223. package/dist/isServer.js +0 -4
  224. package/dist/isServer.js.map +0 -1
  225. package/dist/jss.d.ts +0 -122
  226. package/dist/jss.js +0 -515
  227. package/dist/jss.js.map +0 -1
  228. package/dist/numberToBase.d.ts +0 -1
  229. package/dist/numberToBase.js +0 -44
  230. package/dist/numberToBase.js.map +0 -1
  231. package/dist/stateMachineContextFactory.d.ts +0 -36
  232. package/dist/stateMachineContextFactory.js +0 -48
  233. package/dist/stateMachineContextFactory.js.map +0 -1
  234. package/dist/useCookie.d.ts +0 -9
  235. package/dist/useCookie.js +0 -67
  236. package/dist/useCookie.js.map +0 -1
  237. package/dist/useKeyboard.d.ts +0 -8
  238. package/dist/useKeyboard.js +0 -26
  239. package/dist/useKeyboard.js.map +0 -1
  240. package/dist/useNavigation.d.ts +0 -5
  241. package/dist/useNavigation.js +0 -79
  242. package/dist/useNavigation.js.map +0 -1
  243. package/dist/usePromise.d.ts +0 -1
  244. package/dist/usePromise.js +0 -12
  245. package/dist/usePromise.js.map +0 -1
  246. package/dist/useRefEffect.d.ts +0 -1
  247. package/dist/useRefEffect.js +0 -15
  248. package/dist/useRefEffect.js.map +0 -1
  249. package/jss-debug-loader.mjs +0 -44
  250. package/next-env.d.ts +0 -6
  251. package/next.config.js +0 -33
  252. package/scripts/embeddings.js +0 -93
  253. package/scripts/openai_embeddings.js +0 -100
  254. package/scripts/publish.js +0 -28
  255. package/scripts/test_embeddings.js +0 -47
  256. package/src/Badge.tsx +0 -36
  257. package/src/BaseButton.tsx +0 -62
  258. package/src/BaseInput.tsx +0 -63
  259. package/src/BaseLink.tsx +0 -80
  260. package/src/BaseList.tsx +0 -26
  261. package/src/BaseListAddOn.tsx +0 -10
  262. package/src/BaseListItem.tsx +0 -119
  263. package/src/BaseView.tsx +0 -57
  264. package/src/Box.tsx +0 -20
  265. package/src/Button.tsx +0 -90
  266. package/src/Calendar.tsx +0 -123
  267. package/src/Card.tsx +0 -30
  268. package/src/Checkbox.tsx +0 -63
  269. package/src/Circle.tsx +0 -24
  270. package/src/Column.tsx +0 -12
  271. package/src/DarkMode.tsx +0 -100
  272. package/src/DateInput.tsx +0 -63
  273. package/src/DatePicker.tsx +0 -67
  274. package/src/DatetimeInput.tsx +0 -64
  275. package/src/DesignBook.tsx +0 -677
  276. package/src/Dialog.tsx +0 -150
  277. package/src/Dropdown.tsx +0 -146
  278. package/src/Emitter.ts +0 -26
  279. package/src/FlexLayout.tsx +0 -53
  280. package/src/Icon.tsx +0 -80
  281. package/src/IconButton.tsx +0 -81
  282. package/src/IconLink.tsx +0 -59
  283. package/src/IconType.ts +0 -787
  284. package/src/Interactable.tsx +0 -210
  285. package/src/JSSComment.tsx +0 -56
  286. package/src/Link.tsx +0 -110
  287. package/src/List.tsx +0 -58
  288. package/src/ListButtonItem.tsx +0 -69
  289. package/src/ListDivider.tsx +0 -13
  290. package/src/ListHeaderItem.tsx +0 -45
  291. package/src/ListItem.tsx +0 -24
  292. package/src/ListLinkItem.tsx +0 -76
  293. package/src/ListSpacer.tsx +0 -14
  294. package/src/MenuIcon.tsx +0 -50
  295. package/src/NextJSRouter.tsx +0 -60
  296. package/src/NextJSRouterState.tsx +0 -154
  297. package/src/OnVisible.tsx +0 -42
  298. package/src/Popover.tsx +0 -145
  299. package/src/ProgressBar.tsx +0 -63
  300. package/src/ProgressCircle.tsx +0 -38
  301. package/src/Providers.tsx +0 -33
  302. package/src/RangeInput.tsx +0 -82
  303. package/src/ResultOrError.ts +0 -15
  304. package/src/RootView.tsx +0 -55
  305. package/src/Row.tsx +0 -12
  306. package/src/Select.tsx +0 -39
  307. package/src/StackContext.tsx +0 -52
  308. package/src/StaticCheckbox.tsx +0 -72
  309. package/src/Storage.tsx +0 -198
  310. package/src/Stream.tsx +0 -50
  311. package/src/Sublist.tsx +0 -61
  312. package/src/SubmitIconInput.tsx +0 -45
  313. package/src/Tabs.tsx +0 -110
  314. package/src/Text.tsx +0 -111
  315. package/src/TextArea.tsx +0 -58
  316. package/src/TextInput.tsx +0 -123
  317. package/src/TextInputWithState.tsx +0 -32
  318. package/src/TextPairing.tsx +0 -115
  319. package/src/TimeInput.tsx +0 -109
  320. package/src/Tooltip.tsx +0 -109
  321. package/src/aria.ts +0 -72
  322. package/src/docs/mdx.tsx +0 -137
  323. package/src/docs/pages.ts +0 -115
  324. package/src/docs/searchIndex.ts +0 -1
  325. package/src/examples/ExampleDialog.tsx +0 -28
  326. package/src/guid.ts +0 -7
  327. package/src/hash.ts +0 -21
  328. package/src/index.ts +0 -68
  329. package/src/isServer.ts +0 -3
  330. package/src/jss.tsx +0 -712
  331. package/src/jsx-dev-runtime.ts +0 -74
  332. package/src/jsx-runtime.ts +0 -2
  333. package/src/numberToBase.ts +0 -52
  334. package/src/pages/Badge.mdx +0 -152
  335. package/src/pages/Button.mdx +0 -163
  336. package/src/pages/Calendar.mdx +0 -254
  337. package/src/pages/Card.mdx +0 -147
  338. package/src/pages/Checkbox.mdx +0 -131
  339. package/src/pages/Dialog.mdx +0 -197
  340. package/src/pages/FlexLayout.mdx +0 -211
  341. package/src/pages/Hashing.mdx +0 -211
  342. package/src/pages/Icon.mdx +0 -171
  343. package/src/pages/IconButton.mdx +0 -155
  344. package/src/pages/Link.mdx +0 -160
  345. package/src/pages/List.mdx +0 -262
  346. package/src/pages/ListHeader.mdx +0 -220
  347. package/src/pages/Popover.mdx +0 -223
  348. package/src/pages/ProgressBar.mdx +0 -200
  349. package/src/pages/ProgressCircle.mdx +0 -218
  350. package/src/pages/RangeInput.mdx +0 -237
  351. package/src/pages/Tabs.mdx +0 -281
  352. package/src/pages/Text.mdx +0 -154
  353. package/src/pages/TextInput.mdx +0 -235
  354. package/src/pages/TextPairing.mdx +0 -204
  355. package/src/pages/TimeInput.mdx +0 -178
  356. package/src/pages/Tooltip.mdx +0 -115
  357. package/src/pages/_app.tsx +0 -466
  358. package/src/pages/_document.tsx +0 -30
  359. package/src/pages/css-in-js.mdx +0 -240
  360. package/src/pages/index.mdx +0 -58
  361. package/src/pages/navigation.mdx +0 -158
  362. package/src/pages/prism.css +0 -3
  363. package/src/pages/useCookie.mdx +0 -176
  364. package/src/pages/useKeyboard.mdx +0 -257
  365. package/src/pages/useNavigation.mdx +0 -258
  366. package/src/pages/usePromise.mdx +0 -280
  367. package/src/pages/useRefEffect.mdx +0 -251
  368. package/src/stateMachineContextFactory.tsx +0 -111
  369. package/src/useCookie.tsx +0 -95
  370. package/src/useKeyboard.tsx +0 -43
  371. package/src/useNavigation.tsx +0 -89
  372. package/src/usePromise.tsx +0 -18
  373. package/src/useRefEffect.tsx +0 -18
  374. package/src/vite-plugin-jss-debug.ts +0 -77
  375. package/tsconfig.build.json +0 -23
  376. package/tsconfig.json +0 -38
package/src/Text.tsx DELETED
@@ -1,111 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import {
3
- JSS,
4
- Size,
5
- TextColor,
6
- cssVar,
7
- getTextColor,
8
- toClassnames,
9
- } from "./jss";
10
-
11
- const fontSize = {
12
- xsmall: cssVar("--font-xsmall"),
13
- small: cssVar("--font-small"),
14
- medium: cssVar("--font-medium"),
15
- large: cssVar("--font-large"),
16
- xlarge: cssVar("--font-xlarge"),
17
- xxlarge: cssVar("--font-xxlarge"),
18
- xxxlarge: cssVar("--font-xxxlarge"),
19
- };
20
-
21
- export type Display = "inline" | "block";
22
-
23
- export interface TextProps {
24
- children: ReactNode;
25
- color?: TextColor;
26
- size?: Size;
27
- bold?: boolean;
28
- ellipsis?: boolean | "default";
29
- align?: "center" | "none";
30
- type?: TextType;
31
- grow?: boolean;
32
- jss?: JSS;
33
- id?: string;
34
- htmlFor?: string;
35
- }
36
-
37
- export type TextType =
38
- | "label"
39
- | "span"
40
- | "p"
41
- | "h1"
42
- | "h2"
43
- | "h3"
44
- | "h4"
45
- | "li";
46
-
47
- export function Text({
48
- children,
49
- color = "primary",
50
- size = "medium",
51
- align = "none",
52
- bold = false,
53
- ellipsis = "default",
54
- grow,
55
- type: Type = "span",
56
- jss,
57
- id,
58
- htmlFor,
59
- }: TextProps) {
60
- if (ellipsis === "default") {
61
- ellipsis = Type === "span" || Type === "label";
62
- }
63
-
64
- const className = toClassnames([
65
- getTextColor(color),
66
- { fontSize: fontSize[size], padding: 0, margin: 0 },
67
- bold && { fontWeight: "bold" },
68
- align === "center" && { textAlign: "center" },
69
- ellipsis && {
70
- overflow: "hidden",
71
- textOverflow: "ellipsis",
72
- whiteSpace: "nowrap",
73
- },
74
- grow && { flexGrow: 1 },
75
- jss,
76
- ]);
77
-
78
- return (
79
- <Type id={id} className={className} htmlFor={htmlFor}>
80
- {children}
81
- </Type>
82
- );
83
- }
84
-
85
- export function Label({ size = "medium", type = "label", ...rest }: TextProps) {
86
- return <Text size={size} type={type} {...rest} />;
87
- }
88
-
89
- export function Span({ size = "medium", type = "span", ...rest }: TextProps) {
90
- return <Text size={size} type={type} {...rest} />;
91
- }
92
-
93
- export function P({ size = "medium", type = "p", ...rest }: TextProps) {
94
- return <Text size={size} type={type} {...rest} />;
95
- }
96
-
97
- export function H1({ size = "xxlarge", type = "h1", ...rest }: TextProps) {
98
- return <Text size={size} type={type} {...rest} />;
99
- }
100
-
101
- export function H2({ size = "xlarge", type = "h2", ...rest }: TextProps) {
102
- return <Text size={size} type={type} {...rest} />;
103
- }
104
-
105
- export function H3({ size = "large", type = "h3", ...rest }: TextProps) {
106
- return <Text size={size} type={type} {...rest} />;
107
- }
108
-
109
- export function Li({ size = "medium", type = "li", ...rest }: TextProps) {
110
- return <Text size={size} type={type} {...rest} />;
111
- }
package/src/TextArea.tsx DELETED
@@ -1,58 +0,0 @@
1
- import React from "react";
2
- import { JSS, Padding, cssVar, getPadding, toClassnames } from "./jss";
3
-
4
- export interface TextAreaProps
5
- extends React.InputHTMLAttributes<HTMLTextAreaElement> {
6
- jss?: JSS;
7
- onValueChange?: (value: string) => void;
8
- value?: string;
9
- className?: undefined;
10
- size?: undefined;
11
- padding?: Padding;
12
- }
13
-
14
- export const TextArea = React.forwardRef(
15
- (
16
- {
17
- jss,
18
- onValueChange,
19
- value,
20
- onChange,
21
- padding = "medium",
22
- ...otherProps
23
- }: TextAreaProps,
24
- ref?: React.Ref<HTMLTextAreaElement>
25
- ) => {
26
- return (
27
- <textarea
28
- {...otherProps}
29
- ref={ref}
30
- className={toClassnames([
31
- {
32
- flexGrow: 1,
33
- color: cssVar("--primary-text"),
34
- outline: "none",
35
- fontSize: 20,
36
- lineHeight: 24 / 20,
37
- backgroundColor: cssVar("--overlay-background"),
38
- border: `1px solid ${cssVar("--divider")}`,
39
- borderRadius: cssVar("--border-radius-m"),
40
- "::placeholder": {
41
- color: cssVar("--subtle-text"),
42
- },
43
- ":focus-visible": {
44
- outline: `2px solid ${cssVar("--highlight")}`,
45
- outlineOffset: -2,
46
- },
47
- },
48
- getPadding(padding),
49
- jss,
50
- ])}
51
- value={value}
52
- onChange={
53
- onValueChange ? (e) => onValueChange(e.target.value) : undefined
54
- }
55
- />
56
- );
57
- }
58
- );
package/src/TextInput.tsx DELETED
@@ -1,123 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { BaseInput, BaseInputProps } from "./BaseInput";
3
- import { Column } from "./Column";
4
- import { Row } from "./Row";
5
- import { Gap, JSS, Padding, Size, cssVar, getPadding } from "./jss";
6
-
7
- const fontSize = {
8
- xsmall: cssVar("--font-xsmall"),
9
- small: cssVar("--font-small"),
10
- medium: cssVar("--font-medium"),
11
- large: cssVar("--font-large"),
12
- xlarge: cssVar("--font-xlarge"),
13
- xxlarge: cssVar("--font-xxlarge"),
14
- xxxlarge: cssVar("--font-xxxlarge"),
15
- };
16
-
17
- export interface TextInputProps extends Omit<BaseInputProps, "size"> {
18
- onValueChange?: (value: string) => void;
19
- jssRoot?: JSS;
20
- addOn?: ReactNode;
21
- addOnPosition?: "start" | "end";
22
- gap?: Gap;
23
- onChange?: undefined;
24
- padding?: Padding;
25
- bare?: boolean;
26
- size?: Size;
27
- }
28
-
29
- export const TextInput = React.forwardRef(
30
- (
31
- {
32
- value,
33
- onValueChange,
34
- jssRoot,
35
- jss,
36
- addOn,
37
- gap = "small",
38
- addOnPosition = "start",
39
- padding = "medium",
40
- bare,
41
- size = "medium",
42
- ...inputProps
43
- }: TextInputProps,
44
- ref?: React.Ref<HTMLInputElement>
45
- ) => {
46
- return (
47
- <Row
48
- gap={gap}
49
- jss={[
50
- {
51
- borderRadius: cssVar("--border-radius-m"),
52
- overflow: "hidden",
53
- },
54
- bare
55
- ? {
56
- backgroundColor: "inherit",
57
- ":has(:focus-visible)": {
58
- backgroundColor: cssVar("--light-highlight"),
59
- },
60
- }
61
- : {
62
- border: `1px solid ${cssVar("--divider")}`,
63
- backgroundColor: cssVar("--overlay-background"),
64
- ":has(:focus-visible)": {
65
- outline: `2px solid ${cssVar("--highlight")}`,
66
- outlineOffset: -2,
67
- },
68
- },
69
- jssRoot,
70
- ]}
71
- >
72
- {addOnPosition === "start" && addOn && (
73
- <Column
74
- justify="center"
75
- align="center"
76
- jss={[getPadding(padding), { paddingRight: 0 }]}
77
- >
78
- {addOn}
79
- </Column>
80
- )}
81
- <BaseInput
82
- {...inputProps}
83
- ref={ref}
84
- value={value}
85
- onChange={
86
- onValueChange ? (e) => onValueChange(e.target.value) : undefined
87
- }
88
- jss={[
89
- {
90
- minWidth: 0,
91
- flexGrow: 1,
92
- backgroundColor: "inherit",
93
- color: cssVar("--primary-text"),
94
- outline: "none",
95
- border: "none",
96
- fontSize: fontSize[size],
97
- lineHeight: 1.2,
98
- "::placeholder": {
99
- color: cssVar("--subtle-text"),
100
- },
101
- ":disabled": {
102
- color: cssVar("--subtle-text"),
103
- },
104
- },
105
- getPadding(padding),
106
- addOn && addOnPosition === "start" ? { paddingLeft: 0 } : null,
107
- addOn && addOnPosition === "end" ? { paddingRight: 0 } : null,
108
- jss,
109
- ]}
110
- />
111
- {addOnPosition === "end" && addOn && (
112
- <Column
113
- justify="center"
114
- align="center"
115
- jss={[getPadding(padding), { paddingLeft: 0 }]}
116
- >
117
- {addOn}
118
- </Column>
119
- )}
120
- </Row>
121
- );
122
- }
123
- );
@@ -1,32 +0,0 @@
1
- import React, { useCallback } from "react";
2
-
3
- import { TextInput } from "./TextInput";
4
- import { BaseInputProps } from "./BaseInput";
5
- import { useState } from "react";
6
-
7
- export interface TextInputWithStateProps extends BaseInputProps {
8
- onValueChange?: (value: string) => void;
9
- valueRef: React.MutableRefObject<string>;
10
- onChange?: undefined;
11
- }
12
-
13
- export function TextInputWithState({
14
- valueRef,
15
- onValueChange: externalOnChange,
16
- ...otherProps
17
- }: TextInputWithStateProps) {
18
- const [value, setValue] = useState(valueRef.current);
19
-
20
- const onValueChange = useCallback(
21
- (value) => {
22
- valueRef.current = value;
23
- setValue(value);
24
- externalOnChange && externalOnChange(value);
25
- },
26
- [setValue, externalOnChange, valueRef]
27
- );
28
-
29
- return (
30
- <TextInput {...otherProps} value={value} onValueChange={onValueChange} />
31
- );
32
- }
@@ -1,115 +0,0 @@
1
- import React, { ReactNode } from "react";
2
-
3
- import { Text, TextType } from "./Text";
4
- import { Row } from "./Row";
5
- import { BaseView } from "./BaseView";
6
- import { Column } from "./Column";
7
- import {
8
- TextColor,
9
- Size,
10
- Position,
11
- Gap,
12
- Padding,
13
- Align,
14
- cssVar,
15
- JSS,
16
- } from "./jss";
17
-
18
- export interface TextPairingProps {
19
- headline: ReactNode;
20
- body?: ReactNode;
21
- headlineColor?: TextColor;
22
- headlineSize?: Size;
23
- headlineAddOn?: ReactNode;
24
- bodyColor?: TextColor;
25
- bodySize?: Size;
26
- addOn?: ReactNode;
27
- addOnPosition?: Position;
28
- gap?: Gap;
29
- padding?: Padding;
30
- align?: Align;
31
- grow?: boolean;
32
- shrink?: boolean;
33
- headlineBold?: boolean;
34
- jss?: JSS;
35
- }
36
-
37
- export function TextPairing({
38
- headline,
39
- body,
40
- headlineColor = "primary",
41
- headlineSize = "medium",
42
- headlineAddOn,
43
- bodyColor = "secondary",
44
- bodySize = "medium",
45
- addOn,
46
- addOnPosition = "start",
47
- gap = "small",
48
- align = "stretch",
49
- grow,
50
- shrink,
51
- headlineBold,
52
- padding,
53
- jss,
54
- }: TextPairingProps) {
55
- const textElement = (
56
- <Column
57
- grow={grow}
58
- shrink={shrink}
59
- padding={addOn ? undefined : padding}
60
- align={align}
61
- jss={[
62
- {
63
- overflow: "hidden",
64
- },
65
- jss,
66
- ]}
67
- >
68
- <Row
69
- align="center"
70
- jss={{
71
- textAlign: "start",
72
- }}
73
- >
74
- <Text bold={headlineBold} color={headlineColor} size={headlineSize}>
75
- {headline}
76
- </Text>
77
- {headlineAddOn && <BaseView>{headlineAddOn}</BaseView>}
78
- </Row>
79
- {body && (
80
- <Row
81
- align="center"
82
- jss={{
83
- marginTop: cssVar("--spacing-xs"),
84
- textAlign: "start",
85
- }}
86
- >
87
- <Text ellipsis={true} color={bodyColor} size={bodySize}>
88
- {body}
89
- </Text>
90
- </Row>
91
- )}
92
- </Column>
93
- );
94
-
95
- if (addOn) {
96
- return (
97
- <Row
98
- grow={grow}
99
- shrink={shrink}
100
- gap={gap}
101
- align="center"
102
- padding={padding}
103
- jss={{
104
- overflow: "hidden",
105
- }}
106
- >
107
- {addOnPosition === "start" && addOn}
108
- {textElement}
109
- {addOnPosition === "end" && addOn}
110
- </Row>
111
- );
112
- }
113
-
114
- return textElement;
115
- }
package/src/TimeInput.tsx DELETED
@@ -1,109 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { BaseInput, BaseInputProps } from "./BaseInput";
3
- import { Row } from "./Row";
4
- import { Gap, Padding, cssVar } from "./jss";
5
-
6
- export interface TimeInputProps extends BaseInputProps {
7
- onTimeChange: (date: Date) => void;
8
- time: Date;
9
- gap?: Gap;
10
- padding?: Padding;
11
- addOn?: ReactNode;
12
- addOnPosition?: "start" | "end";
13
- onChange?: undefined;
14
- bare?: boolean;
15
- }
16
-
17
- export const timeFormatter = Intl.DateTimeFormat("en-UK", {
18
- hour: "2-digit",
19
- minute: "2-digit",
20
- });
21
-
22
- function TimeInputInternal(
23
- {
24
- time: date,
25
- onTimeChange: onDateChange,
26
- jss,
27
- addOn,
28
- padding = "small",
29
- gap = "none",
30
- addOnPosition = "start",
31
- bare,
32
- ...inputProps
33
- }: TimeInputProps,
34
- ref?: React.Ref<HTMLInputElement>
35
- ) {
36
- return (
37
- <Row
38
- padding={padding}
39
- gap={gap}
40
- align="center"
41
- jss={[
42
- {
43
- borderRadius: cssVar("--border-radius-m"),
44
- overflow: "hidden",
45
- },
46
- bare
47
- ? {
48
- backgroundColor: "inherit",
49
- ":has(:focus-visible)": {
50
- backgroundColor: cssVar("--light-highlight"),
51
- },
52
- }
53
- : {
54
- border: `1px solid ${cssVar("--divider")}`,
55
- backgroundColor: cssVar("--overlay-background"),
56
- ":has(:focus-visible)": {
57
- outline: `2px solid ${cssVar("--highlight")}`,
58
- outlineOffset: -2,
59
- },
60
- },
61
- ]}
62
- >
63
- {addOnPosition === "start" && addOn}
64
- <BaseInput
65
- {...inputProps}
66
- type="time"
67
- ref={ref}
68
- value={timeFormatter.format(date)}
69
- onChange={(e) => {
70
- const value = e.target.value;
71
- const [hour, minute] = value.split(":");
72
- onDateChange(
73
- new Date(
74
- date.getFullYear(),
75
- date.getMonth(),
76
- date.getDate(),
77
- parseInt(hour),
78
- parseInt(minute)
79
- )
80
- );
81
- }}
82
- jss={[
83
- {
84
- flexGrow: 1,
85
- backgroundColor: "inherit",
86
- color: "var(--primary-text)",
87
- outline: "none",
88
- border: "none",
89
- fontSize: 20,
90
- lineHeight: 24 / 20,
91
- "::placeholder": {
92
- color: "var(--subtle-text);",
93
- },
94
- ":disabled": {
95
- color: "var(--subtle-text);",
96
- },
97
- "::-webkit-calendar-picker-indicator": {
98
- backgroundColor: "none",
99
- },
100
- },
101
- jss,
102
- ]}
103
- />
104
- {addOnPosition === "end" && addOn}
105
- </Row>
106
- );
107
- }
108
-
109
- export const TimeInput = React.forwardRef(TimeInputInternal);
package/src/Tooltip.tsx DELETED
@@ -1,109 +0,0 @@
1
- import React, { useRef, useState } from "react";
2
-
3
- import { BaseView } from "./BaseView";
4
- import { useRefEffect } from "./useRefEffect";
5
- import { Text } from "./Text";
6
- import { JSS, cssVar, toClassnames } from "./jss";
7
-
8
- const styles: { [key: string]: JSS } = {
9
- tooltip: {
10
- top: "-100%",
11
- transform: "translateY(50%)",
12
- backgroundColor: cssVar("--primary-background"),
13
- padding: `${cssVar("--spacing-s")} ${cssVar("--spacing-m")}`,
14
- borderRadius: cssVar("--border-radius-m"),
15
- border: `1px solid ${cssVar("--divider")}`,
16
- boxShadow: cssVar("--shadow-md"),
17
- overflow: "hidden",
18
- animation: "popoverFadeIn 0.15s ease-out",
19
- },
20
- };
21
-
22
- interface TooltipProps {
23
- content: string;
24
- jss?: JSS;
25
- className?: undefined;
26
- tag?: keyof HTMLElementTagNameMap;
27
- children: React.JSX.Element;
28
- }
29
-
30
- export function Tooltip({ content, jss, tag, children }: TooltipProps) {
31
- const [tooltip, setTooltip] = useState<React.JSX.Element>(null);
32
- const dialogRef = useRef(null);
33
- const focusTrapRoot = useRefEffect((root: HTMLDialogElement) => {
34
- dialogRef.current = root;
35
-
36
- const keydown = (e) => {
37
- if (e.key === "Escape") {
38
- dialogRef.current?.close();
39
- } else if (e.key === "Tab") {
40
- dialogRef.current?.close();
41
- }
42
- };
43
-
44
- const click = () => {
45
- dialogRef.current?.close();
46
- };
47
-
48
- window.addEventListener("keydown", keydown);
49
- window.addEventListener("click", click);
50
-
51
- const activeElement = document.activeElement;
52
- root.show();
53
- // @ts-ignore
54
- activeElement.focus();
55
-
56
- return () => {
57
- window.removeEventListener("keydown", keydown);
58
- window.removeEventListener("click", click);
59
- };
60
- });
61
-
62
- const toggle = () => {
63
- if (tooltip == null) {
64
- setTooltip(
65
- <dialog
66
- ref={(ref: null | HTMLDialogElement) => {
67
- dialogRef.current = ref;
68
- focusTrapRoot(ref);
69
- }}
70
- className={toClassnames(styles.tooltip)}
71
- onClose={() => {
72
- setTooltip(null);
73
- }}
74
- onClick={(e) => {
75
- e.preventDefault();
76
- e.stopPropagation();
77
- }}
78
- >
79
- <Text size="medium" color="secondary">
80
- {content}
81
- </Text>
82
- </dialog>
83
- );
84
- } else {
85
- setTooltip(null);
86
- }
87
- };
88
-
89
- return (
90
- <BaseView
91
- tag={tag}
92
- relative={true}
93
- jss={[{ display: "inline-block" }, jss]}
94
- onMouseEnter={() => {
95
- if (tooltip == null) {
96
- toggle();
97
- }
98
- }}
99
- onMouseLeave={() => {
100
- if (tooltip != null) {
101
- toggle();
102
- }
103
- }}
104
- >
105
- {children}
106
- {tooltip}
107
- </BaseView>
108
- );
109
- }