@ohos-ports/dxos-react-ui-theme 0.8.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +25 -0
  3. package/README.yml +1 -0
  4. package/dist/lib/browser/index.mjs +3199 -0
  5. package/dist/lib/browser/index.mjs.map +7 -0
  6. package/dist/lib/browser/meta.json +1 -0
  7. package/dist/plugin/node/chunk-3IKFINB6.cjs +1500 -0
  8. package/dist/plugin/node/chunk-3IKFINB6.cjs.map +7 -0
  9. package/dist/plugin/node/chunk-QA5KMUXP.cjs +70 -0
  10. package/dist/plugin/node/chunk-QA5KMUXP.cjs.map +7 -0
  11. package/dist/plugin/node/config/tailwind.cjs +29 -0
  12. package/dist/plugin/node/config/tailwind.cjs.map +7 -0
  13. package/dist/plugin/node/meta.json +1 -0
  14. package/dist/plugin/node/plugins/esbuild-plugin.cjs +90 -0
  15. package/dist/plugin/node/plugins/esbuild-plugin.cjs.map +7 -0
  16. package/dist/plugin/node/plugins/plugin.cjs +123 -0
  17. package/dist/plugin/node/plugins/plugin.cjs.map +7 -0
  18. package/dist/plugin/node/theme.css +1223 -0
  19. package/dist/plugin/node/theme.css.map +7 -0
  20. package/dist/plugin/node-esm/chunk-LNTZCFPD.mjs +1493 -0
  21. package/dist/plugin/node-esm/chunk-LNTZCFPD.mjs.map +7 -0
  22. package/dist/plugin/node-esm/chunk-TFKSVC5U.mjs +50 -0
  23. package/dist/plugin/node-esm/chunk-TFKSVC5U.mjs.map +7 -0
  24. package/dist/plugin/node-esm/config/tailwind.mjs +8 -0
  25. package/dist/plugin/node-esm/config/tailwind.mjs.map +7 -0
  26. package/dist/plugin/node-esm/meta.json +1 -0
  27. package/dist/plugin/node-esm/plugins/esbuild-plugin.mjs +63 -0
  28. package/dist/plugin/node-esm/plugins/esbuild-plugin.mjs.map +7 -0
  29. package/dist/plugin/node-esm/plugins/plugin.mjs +97 -0
  30. package/dist/plugin/node-esm/plugins/plugin.mjs.map +7 -0
  31. package/dist/plugin/node-esm/theme.css +1223 -0
  32. package/dist/plugin/node-esm/theme.css.map +7 -0
  33. package/dist/types/src/config/index.d.ts +3 -0
  34. package/dist/types/src/config/index.d.ts.map +1 -0
  35. package/dist/types/src/config/tailwind.d.ts +9 -0
  36. package/dist/types/src/config/tailwind.d.ts.map +1 -0
  37. package/dist/types/src/config/tokens/Tokens.stories.d.ts +7 -0
  38. package/dist/types/src/config/tokens/Tokens.stories.d.ts.map +1 -0
  39. package/dist/types/src/config/tokens/alias-colors.d.ts +14 -0
  40. package/dist/types/src/config/tokens/alias-colors.d.ts.map +1 -0
  41. package/dist/types/src/config/tokens/index.d.ts +438 -0
  42. package/dist/types/src/config/tokens/index.d.ts.map +1 -0
  43. package/dist/types/src/config/tokens/lengths.d.ts +116 -0
  44. package/dist/types/src/config/tokens/lengths.d.ts.map +1 -0
  45. package/dist/types/src/config/tokens/physical-colors.d.ts +23 -0
  46. package/dist/types/src/config/tokens/physical-colors.d.ts.map +1 -0
  47. package/dist/types/src/config/tokens/semantic-colors.d.ts +179 -0
  48. package/dist/types/src/config/tokens/semantic-colors.d.ts.map +1 -0
  49. package/dist/types/src/config/tokens/sememes-calls.d.ts +3 -0
  50. package/dist/types/src/config/tokens/sememes-calls.d.ts.map +1 -0
  51. package/dist/types/src/config/tokens/sememes-codemirror.d.ts +43 -0
  52. package/dist/types/src/config/tokens/sememes-codemirror.d.ts.map +1 -0
  53. package/dist/types/src/config/tokens/sememes-hue.d.ts +4 -0
  54. package/dist/types/src/config/tokens/sememes-hue.d.ts.map +1 -0
  55. package/dist/types/src/config/tokens/sememes-sheet.d.ts +52 -0
  56. package/dist/types/src/config/tokens/sememes-sheet.d.ts.map +1 -0
  57. package/dist/types/src/config/tokens/sememes-system.d.ts +91 -0
  58. package/dist/types/src/config/tokens/sememes-system.d.ts.map +1 -0
  59. package/dist/types/src/config/tokens/types.d.ts +5 -0
  60. package/dist/types/src/config/tokens/types.d.ts.map +1 -0
  61. package/dist/types/src/index.d.ts +8 -0
  62. package/dist/types/src/index.d.ts.map +1 -0
  63. package/dist/types/src/plugins/esbuild-plugin.d.ts +9 -0
  64. package/dist/types/src/plugins/esbuild-plugin.d.ts.map +1 -0
  65. package/dist/types/src/plugins/plugin.d.ts +17 -0
  66. package/dist/types/src/plugins/plugin.d.ts.map +1 -0
  67. package/dist/types/src/plugins/resolveContent.d.ts +2 -0
  68. package/dist/types/src/plugins/resolveContent.d.ts.map +1 -0
  69. package/dist/types/src/styles/components/anchored-overflow.d.ts +6 -0
  70. package/dist/types/src/styles/components/anchored-overflow.d.ts.map +1 -0
  71. package/dist/types/src/styles/components/avatar.d.ts +21 -0
  72. package/dist/types/src/styles/components/avatar.d.ts.map +1 -0
  73. package/dist/types/src/styles/components/breadcrumb.d.ts +9 -0
  74. package/dist/types/src/styles/components/breadcrumb.d.ts.map +1 -0
  75. package/dist/types/src/styles/components/button.d.ts +19 -0
  76. package/dist/types/src/styles/components/button.d.ts.map +1 -0
  77. package/dist/types/src/styles/components/dialog.d.ts +12 -0
  78. package/dist/types/src/styles/components/dialog.d.ts.map +1 -0
  79. package/dist/types/src/styles/components/icon-button.d.ts +5 -0
  80. package/dist/types/src/styles/components/icon-button.d.ts.map +1 -0
  81. package/dist/types/src/styles/components/icon.d.ts +7 -0
  82. package/dist/types/src/styles/components/icon.d.ts.map +1 -0
  83. package/dist/types/src/styles/components/index.d.ts +24 -0
  84. package/dist/types/src/styles/components/index.d.ts.map +1 -0
  85. package/dist/types/src/styles/components/input.d.ts +111 -0
  86. package/dist/types/src/styles/components/input.d.ts.map +1 -0
  87. package/dist/types/src/styles/components/link.d.ts +7 -0
  88. package/dist/types/src/styles/components/link.d.ts.map +1 -0
  89. package/dist/types/src/styles/components/list.d.ts +14 -0
  90. package/dist/types/src/styles/components/list.d.ts.map +1 -0
  91. package/dist/types/src/styles/components/main.d.ts +28 -0
  92. package/dist/types/src/styles/components/main.d.ts.map +1 -0
  93. package/dist/types/src/styles/components/menu.d.ts +13 -0
  94. package/dist/types/src/styles/components/menu.d.ts.map +1 -0
  95. package/dist/types/src/styles/components/message.d.ts +11 -0
  96. package/dist/types/src/styles/components/message.d.ts.map +1 -0
  97. package/dist/types/src/styles/components/popover.d.ts +11 -0
  98. package/dist/types/src/styles/components/popover.d.ts.map +1 -0
  99. package/dist/types/src/styles/components/scroll-area.d.ts +9 -0
  100. package/dist/types/src/styles/components/scroll-area.d.ts.map +1 -0
  101. package/dist/types/src/styles/components/select.d.ts +14 -0
  102. package/dist/types/src/styles/components/select.d.ts.map +1 -0
  103. package/dist/types/src/styles/components/separator.d.ts +8 -0
  104. package/dist/types/src/styles/components/separator.d.ts.map +1 -0
  105. package/dist/types/src/styles/components/status.d.ts +9 -0
  106. package/dist/types/src/styles/components/status.d.ts.map +1 -0
  107. package/dist/types/src/styles/components/tag.d.ts +7 -0
  108. package/dist/types/src/styles/components/tag.d.ts.map +1 -0
  109. package/dist/types/src/styles/components/toast.d.ts +12 -0
  110. package/dist/types/src/styles/components/toast.d.ts.map +1 -0
  111. package/dist/types/src/styles/components/toolbar.d.ts +8 -0
  112. package/dist/types/src/styles/components/toolbar.d.ts.map +1 -0
  113. package/dist/types/src/styles/components/tooltip.d.ts +8 -0
  114. package/dist/types/src/styles/components/tooltip.d.ts.map +1 -0
  115. package/dist/types/src/styles/components/treegrid.d.ts +10 -0
  116. package/dist/types/src/styles/components/treegrid.d.ts.map +1 -0
  117. package/dist/types/src/styles/fragments/density.d.ts +13 -0
  118. package/dist/types/src/styles/fragments/density.d.ts.map +1 -0
  119. package/dist/types/src/styles/fragments/dimension.d.ts +5 -0
  120. package/dist/types/src/styles/fragments/dimension.d.ts.map +1 -0
  121. package/dist/types/src/styles/fragments/disabled.d.ts +3 -0
  122. package/dist/types/src/styles/fragments/disabled.d.ts.map +1 -0
  123. package/dist/types/src/styles/fragments/elevation.d.ts +15 -0
  124. package/dist/types/src/styles/fragments/elevation.d.ts.map +1 -0
  125. package/dist/types/src/styles/fragments/focus.d.ts +6 -0
  126. package/dist/types/src/styles/fragments/focus.d.ts.map +1 -0
  127. package/dist/types/src/styles/fragments/group.d.ts +5 -0
  128. package/dist/types/src/styles/fragments/group.d.ts.map +1 -0
  129. package/dist/types/src/styles/fragments/hover.d.ts +16 -0
  130. package/dist/types/src/styles/fragments/hover.d.ts.map +1 -0
  131. package/dist/types/src/styles/fragments/index.d.ts +17 -0
  132. package/dist/types/src/styles/fragments/index.d.ts.map +1 -0
  133. package/dist/types/src/styles/fragments/layout.d.ts +3 -0
  134. package/dist/types/src/styles/fragments/layout.d.ts.map +1 -0
  135. package/dist/types/src/styles/fragments/motion.d.ts +2 -0
  136. package/dist/types/src/styles/fragments/motion.d.ts.map +1 -0
  137. package/dist/types/src/styles/fragments/ornament.d.ts +5 -0
  138. package/dist/types/src/styles/fragments/ornament.d.ts.map +1 -0
  139. package/dist/types/src/styles/fragments/selected.d.ts +13 -0
  140. package/dist/types/src/styles/fragments/selected.d.ts.map +1 -0
  141. package/dist/types/src/styles/fragments/shimmer.d.ts +3 -0
  142. package/dist/types/src/styles/fragments/shimmer.d.ts.map +1 -0
  143. package/dist/types/src/styles/fragments/size.d.ts +9 -0
  144. package/dist/types/src/styles/fragments/size.d.ts.map +1 -0
  145. package/dist/types/src/styles/fragments/surface.d.ts +9 -0
  146. package/dist/types/src/styles/fragments/surface.d.ts.map +1 -0
  147. package/dist/types/src/styles/fragments/text.d.ts +7 -0
  148. package/dist/types/src/styles/fragments/text.d.ts.map +1 -0
  149. package/dist/types/src/styles/fragments/valence.d.ts +13 -0
  150. package/dist/types/src/styles/fragments/valence.d.ts.map +1 -0
  151. package/dist/types/src/styles/index.d.ts +4 -0
  152. package/dist/types/src/styles/index.d.ts.map +1 -0
  153. package/dist/types/src/styles/theme.d.ts +5 -0
  154. package/dist/types/src/styles/theme.d.ts.map +1 -0
  155. package/dist/types/src/tailwind.d.ts +1 -0
  156. package/dist/types/src/tailwind.d.ts.map +1 -0
  157. package/dist/types/src/types.d.ts +3 -0
  158. package/dist/types/src/types.d.ts.map +1 -0
  159. package/dist/types/src/util/hash.d.ts +8 -0
  160. package/dist/types/src/util/hash.d.ts.map +1 -0
  161. package/dist/types/src/util/index.d.ts +3 -0
  162. package/dist/types/src/util/index.d.ts.map +1 -0
  163. package/dist/types/src/util/mx.d.ts +2 -0
  164. package/dist/types/src/util/mx.d.ts.map +1 -0
  165. package/dist/types/src/util/withLogical.d.ts +164 -0
  166. package/dist/types/src/util/withLogical.d.ts.map +1 -0
  167. package/dist/types/tsconfig.tsbuildinfo +1 -0
  168. package/package.json +58 -0
  169. package/plugin.d.ts +7 -0
  170. package/plugin.js +10 -0
  171. package/src/config/index.ts +6 -0
  172. package/src/config/tailwind.ts +236 -0
  173. package/src/config/tokens/Tokens.stories.tsx +94 -0
  174. package/src/config/tokens/alias-colors.ts +38 -0
  175. package/src/config/tokens/index.ts +90 -0
  176. package/src/config/tokens/lengths.ts +87 -0
  177. package/src/config/tokens/physical-colors.ts +125 -0
  178. package/src/config/tokens/semantic-colors.ts +27 -0
  179. package/src/config/tokens/sememes-calls.ts +17 -0
  180. package/src/config/tokens/sememes-codemirror.ts +50 -0
  181. package/src/config/tokens/sememes-hue.ts +54 -0
  182. package/src/config/tokens/sememes-sheet.ts +60 -0
  183. package/src/config/tokens/sememes-system.ts +255 -0
  184. package/src/config/tokens/types.ts +9 -0
  185. package/src/index.ts +15 -0
  186. package/src/plugins/esbuild-plugin.ts +60 -0
  187. package/src/plugins/plugin.ts +127 -0
  188. package/src/plugins/resolveContent.ts +55 -0
  189. package/src/styles/components/README.md +6 -0
  190. package/src/styles/components/anchored-overflow.ts +20 -0
  191. package/src/styles/components/avatar.ts +96 -0
  192. package/src/styles/components/breadcrumb.ts +29 -0
  193. package/src/styles/components/button.ts +48 -0
  194. package/src/styles/components/dialog.ts +36 -0
  195. package/src/styles/components/icon-button.ts +17 -0
  196. package/src/styles/components/icon.ts +19 -0
  197. package/src/styles/components/index.ts +27 -0
  198. package/src/styles/components/input.ts +176 -0
  199. package/src/styles/components/link.ts +26 -0
  200. package/src/styles/components/list.ts +46 -0
  201. package/src/styles/components/main.ts +36 -0
  202. package/src/styles/components/menu.ts +60 -0
  203. package/src/styles/components/message.ts +36 -0
  204. package/src/styles/components/popover.ts +40 -0
  205. package/src/styles/components/scroll-area.ts +42 -0
  206. package/src/styles/components/select.ts +64 -0
  207. package/src/styles/components/separator.ts +24 -0
  208. package/src/styles/components/status.ts +32 -0
  209. package/src/styles/components/tag.ts +23 -0
  210. package/src/styles/components/toast.ts +55 -0
  211. package/src/styles/components/toolbar.ts +20 -0
  212. package/src/styles/components/tooltip.ts +29 -0
  213. package/src/styles/components/treegrid.ts +37 -0
  214. package/src/styles/fragments/density.ts +17 -0
  215. package/src/styles/fragments/dimension.ts +8 -0
  216. package/src/styles/fragments/disabled.ts +6 -0
  217. package/src/styles/fragments/elevation.ts +29 -0
  218. package/src/styles/fragments/focus.ts +16 -0
  219. package/src/styles/fragments/group.ts +12 -0
  220. package/src/styles/fragments/hover.ts +24 -0
  221. package/src/styles/fragments/index.ts +20 -0
  222. package/src/styles/fragments/layout.ts +7 -0
  223. package/src/styles/fragments/motion.ts +6 -0
  224. package/src/styles/fragments/ornament.ts +10 -0
  225. package/src/styles/fragments/selected.ts +45 -0
  226. package/src/styles/fragments/shimmer.ts +9 -0
  227. package/src/styles/fragments/size.ts +117 -0
  228. package/src/styles/fragments/surface.ts +29 -0
  229. package/src/styles/fragments/text.ts +13 -0
  230. package/src/styles/fragments/valence.ts +48 -0
  231. package/src/styles/index.ts +7 -0
  232. package/src/styles/layers/anchored-overflow.css +9 -0
  233. package/src/styles/layers/attention.css +8 -0
  234. package/src/styles/layers/base.css +25 -0
  235. package/src/styles/layers/button.css +76 -0
  236. package/src/styles/layers/can-scroll.css +26 -0
  237. package/src/styles/layers/checkbox.css +50 -0
  238. package/src/styles/layers/dialog.css +42 -0
  239. package/src/styles/layers/drag-preview.css +18 -0
  240. package/src/styles/layers/focus-ring.css +129 -0
  241. package/src/styles/layers/hues.css +110 -0
  242. package/src/styles/layers/index.css +21 -0
  243. package/src/styles/layers/main.css +162 -0
  244. package/src/styles/layers/native.css +14 -0
  245. package/src/styles/layers/positioning.css +23 -0
  246. package/src/styles/layers/size.css +299 -0
  247. package/src/styles/layers/surfaces.css +31 -0
  248. package/src/styles/layers/tag.css +123 -0
  249. package/src/styles/layers/tldraw.css +91 -0
  250. package/src/styles/layers/tokens.css +44 -0
  251. package/src/styles/layers/typography.css +152 -0
  252. package/src/styles/theme.ts +69 -0
  253. package/src/tailwind.ts +5 -0
  254. package/src/theme.css +5 -0
  255. package/src/types.ts +7 -0
  256. package/src/typings.d.ts +8 -0
  257. package/src/util/hash.ts +39 -0
  258. package/src/util/index.ts +6 -0
  259. package/src/util/mx.ts +34 -0
  260. package/src/util/withLogical.ts +114 -0
@@ -0,0 +1,45 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type ComponentFragment } from '@dxos/react-ui-types';
6
+
7
+ import { ghostHover } from './hover';
8
+
9
+ // TODO(burdon): Use semantic tokens (e.g., accentSurfaceHover, bg-gridSelectionOverlay).
10
+
11
+ export const ghostSelectedCurrent = [
12
+ ghostHover,
13
+ 'aria-[current]:bg-inputSurface hover:aria-[current]:bg-hoverSurface',
14
+ 'aria-selected:bg-primary-100 dark:aria-selected:bg-primary-850 hover:aria-selected:bg-primary-150 hover:dark:aria-selected:bg-primary-800',
15
+ 'aria-[current]:aria-selected:bg-primary-200 dark:aria-[current]:aria-selected:bg-primary-750 hover:aria-[current]:aria-selected:bg-primary-200 hover:dark:aria-[current]:aria-selected:bg-primary-750',
16
+ ];
17
+
18
+ export const ghostHighlighted =
19
+ 'data-[highlighted]:bg-primary-100 dark:data-[highlighted]:bg-primary-600 hover:data-[highlighted]:bg-primary-150 hover:dark:data-[highlighted]:bg-primary-500';
20
+
21
+ export const ghostSelectedTrackingInterFromNormal = 'tracking-[0.0092em]';
22
+
23
+ export const ghostSelected =
24
+ 'aria-selected:bg-baseSurface aria-selected:text-accentText hover:aria-selected:text-accentTextHover aria-selected:font-semibold aria-selected:tracking-normal transition-[color,font-variation-settings,letter-spacing]';
25
+
26
+ export const ghostSelectedContainerMd =
27
+ '@md:aria-selected:bg-baseSurface @md:aria-selected:text-accentText @md:hover:aria-selected:text-accentTextHover @md:aria-selected:font-semibold @md:aria-selected:tracking-normal @md:transition-[color,font-variation-settings,letter-spacing]';
28
+
29
+ export type SelectedStyleProps = {
30
+ current?: boolean;
31
+ selected?: boolean;
32
+ };
33
+
34
+ export const staticGhostSelectedCurrent: ComponentFragment<SelectedStyleProps> = ({ current, selected }) => [
35
+ current && selected
36
+ ? 'bg-primary-200 dark:bg-primary-750 hover:bg-primary-200 hover:dark:bg-primary-750'
37
+ : current
38
+ ? 'bg-inputSurface hover:bg-hoverSurface'
39
+ : selected
40
+ ? 'bg-primary-100 dark:bg-primary-850 hover:bg-primary-150 hover:dark:bg-primary-800'
41
+ : ghostHover,
42
+ ];
43
+
44
+ export const staticGhostSelected: ComponentFragment<Pick<SelectedStyleProps, 'selected'>> = ({ selected }) =>
45
+ selected ? ['bg-primary-200 dark:bg-primary-750'] : [];
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export const shimmer =
6
+ 'relative before:absolute before:inset-0 before:-translate-x-full before:animate-shimmer before:bg-gradient-to-r before:from-transparent before:via-neutral-100/10 before:to-transparent isolate overflow-hidden';
7
+
8
+ export const strongShimmer =
9
+ 'relative before:absolute before:inset-0 before:-translate-x-full before:animate-shimmer before:bg-gradient-to-r before:from-transparent before:via-primary-100/80 before:to-transparent isolate overflow-hidden';
@@ -0,0 +1,117 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { type Size } from '@dxos/react-ui-types';
6
+
7
+ import { mx } from '../../util';
8
+
9
+ export const sizeWidthMap = new Map<Size, string>([
10
+ [0, 'is-0'],
11
+ ['px', 'is-px'],
12
+ [0.5, 'is-0.5'],
13
+ [1, 'is-1'],
14
+ [1.5, 'is-1.5'],
15
+ [2, 'is-2'],
16
+ [2.5, 'is-2.5'],
17
+ [3, 'is-3'],
18
+ [3.5, 'is-3.5'],
19
+ [4, 'is-4'],
20
+ [5, 'is-5'],
21
+ [6, 'is-6'],
22
+ [7, 'is-7'],
23
+ [8, 'is-8'],
24
+ [9, 'is-9'],
25
+ [10, 'is-10'],
26
+ [11, 'is-11'],
27
+ [12, 'is-12'],
28
+ [14, 'is-14'],
29
+ [16, 'is-16'],
30
+ [20, 'is-20'],
31
+ [24, 'is-24'],
32
+ [28, 'is-28'],
33
+ [32, 'is-32'],
34
+ [36, 'is-36'],
35
+ [40, 'is-40'],
36
+ [44, 'is-44'],
37
+ [48, 'is-48'],
38
+ [52, 'is-52'],
39
+ [56, 'is-56'],
40
+ [60, 'is-60'],
41
+ [64, 'is-64'],
42
+ [72, 'is-72'],
43
+ [80, 'is-80'],
44
+ [96, 'is-96'],
45
+ ]);
46
+
47
+ export const sizeHeightMap = new Map<Size, string>([
48
+ [0, 'bs-0'],
49
+ ['px', 'bs-px'],
50
+ [0.5, 'bs-0.5'],
51
+ [1, 'bs-1'],
52
+ [1.5, 'bs-1.5'],
53
+ [2, 'bs-2'],
54
+ [2.5, 'bs-2.5'],
55
+ [3, 'bs-3'],
56
+ [3.5, 'bs-3.5'],
57
+ [4, 'bs-4'],
58
+ [5, 'bs-5'],
59
+ [6, 'bs-6'],
60
+ [7, 'bs-7'],
61
+ [8, 'bs-8'],
62
+ [9, 'bs-9'],
63
+ [10, 'bs-10'],
64
+ [11, 'bs-11'],
65
+ [12, 'bs-12'],
66
+ [14, 'bs-14'],
67
+ [16, 'bs-16'],
68
+ [20, 'bs-20'],
69
+ [24, 'bs-24'],
70
+ [28, 'bs-28'],
71
+ [32, 'bs-32'],
72
+ [36, 'bs-36'],
73
+ [40, 'bs-40'],
74
+ [44, 'bs-44'],
75
+ [48, 'bs-48'],
76
+ [52, 'bs-52'],
77
+ [56, 'bs-56'],
78
+ [60, 'bs-60'],
79
+ [64, 'bs-64'],
80
+ [72, 'bs-72'],
81
+ [80, 'bs-80'],
82
+ [96, 'bs-96'],
83
+ ]);
84
+
85
+ const sizes = new Set(sizeWidthMap.keys());
86
+
87
+ export const getSizeHeight = sizeHeightMap.get.bind(sizeHeightMap);
88
+ export const getSizeWidth = sizeWidthMap.get.bind(sizeWidthMap);
89
+ export const getSize = (size: Size) => mx(getSizeHeight(size), getSizeWidth(size));
90
+
91
+ export const computeSize = (value: number, defaultSize: Size) => {
92
+ if (sizes.has(value as Size)) {
93
+ return value as Size;
94
+ } else if (value <= 0) {
95
+ return 0;
96
+ } else if (value === 1) {
97
+ return 'px';
98
+ } else {
99
+ const wholeSeries = Math.floor(value);
100
+ const halfSeries = Math.floor(value * 2) / 2;
101
+ const doubleSeries = Math.floor(value / 2) * 2;
102
+ const quadrupleSeries = Math.floor(value / 4) * 4;
103
+ if (sizes.has(halfSeries as Size)) {
104
+ return halfSeries as Size;
105
+ } else if (sizes.has(wholeSeries as Size)) {
106
+ return wholeSeries as Size;
107
+ } else if (sizes.has(doubleSeries as Size)) {
108
+ return doubleSeries as Size;
109
+ } else if (sizes.has(quadrupleSeries as Size)) {
110
+ return quadrupleSeries as Size;
111
+ } else {
112
+ return defaultSize;
113
+ }
114
+ }
115
+ };
116
+
117
+ export const sizeValue = (size: Size): number => (size === 'px' ? 1 : size);
@@ -0,0 +1,29 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ // NOTE: Please don’t make changes to these fragments without testing *all* the places where they’re used.
6
+
7
+ // If your scope of concern is narrower than exactly *the entire design system*, please define and apply your own
8
+ // fragment, either to the specific component or in an override to `ThemeProvider`’s `tx` value.
9
+
10
+ // Main background.
11
+ // NOTE: This should align with theme's root --surface-bg.
12
+ export const baseSurface = 'base-surface';
13
+
14
+ // Sidebars.
15
+ export const sidebarSurface = 'sidebar-surface backdrop-blur-md dark:backdrop-blur-lg';
16
+ export const sidebarBorder = 'border-separator';
17
+
18
+ // Generic grouping style.
19
+ export const activeSurface = 'base-surface';
20
+ export const groupBorder = 'border-separator';
21
+
22
+ // Tooltips, popovers, menus, dialogs, etc.
23
+ export const modalSurface = 'modal-surface backdrop-blur-md';
24
+
25
+ // Elements that actively have the user’s “attention”; prefer to select with CSS-native selectors like focus-within,
26
+ // but may be applied by app state. ⚠️ Do not apply statically.
27
+ export const attentionSurface = 'attention-surface';
28
+
29
+ export const accentSurface = 'bg-accentSurface text-accentSurfaceText';
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export const placeholderText = 'placeholder-neutral-300 dark:placeholder-neutral-500';
6
+ export const staticPlaceholderText = 'text-neutral-300 dark:text-neutral-500';
7
+
8
+ export const descriptionText = 'text-sm font-normal text-description';
9
+ export const descriptionTextPrimary = 'text-sm font-normal text-baseText';
10
+
11
+ export const descriptionMessage = [descriptionText, 'border border-dashed border-separator rounded p-4'];
12
+
13
+ export const chromeText = 'text-sm font-normal';
@@ -0,0 +1,48 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { type MessageValence } from '@dxos/react-ui-types';
6
+
7
+ export const successText = 'text-xs font-medium text-successText';
8
+ export const infoText = 'text-xs font-medium text-infoText';
9
+ export const warningText = 'text-xs font-medium text-warningText';
10
+ export const errorText = 'text-xs font-medium text-errorText';
11
+
12
+ export const valenceColorText = (valence?: MessageValence) => {
13
+ switch (valence) {
14
+ case 'success':
15
+ return successText;
16
+ case 'info':
17
+ return infoText;
18
+ case 'warning':
19
+ return warningText;
20
+ case 'error':
21
+ return errorText;
22
+ default:
23
+ return undefined;
24
+ }
25
+ };
26
+
27
+ // TODO(burdon): Border colors.
28
+
29
+ export const neutralMessageColors = 'border border-dashed border-separator text-subdued';
30
+ export const successMessageColors = 'text-successSurfaceText bg-successSurface';
31
+ export const infoMessageColors = 'text-infoSurfaceText bg-infoSurface';
32
+ export const warningMessageColors = 'text-warningSurfaceText bg-warningSurface';
33
+ export const errorMessageColors = 'text-errorSurfaceText bg-errorSurface';
34
+
35
+ export const messageValence = (valence?: MessageValence) => {
36
+ switch (valence) {
37
+ case 'success':
38
+ return successMessageColors;
39
+ case 'info':
40
+ return infoMessageColors;
41
+ case 'warning':
42
+ return warningMessageColors;
43
+ case 'error':
44
+ return errorMessageColors;
45
+ default:
46
+ return neutralMessageColors;
47
+ }
48
+ };
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './fragments';
6
+ export * from './components';
7
+ export * from './theme';
@@ -0,0 +1,9 @@
1
+ @layer utilities {
2
+ .overflow-anchored * {
3
+ overflow-anchor: none;
4
+ }
5
+
6
+ .overflow-anchor {
7
+ overflow-anchor: auto;
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ @layer utilities {
2
+ /* If an element should apply attention-related color tokens, it should use this class. */
3
+ .attention-surface {
4
+ --surface-separator: transparent;
5
+ background-color: var(--dx-baseSurface);
6
+ border-color: var(--dx-separator);
7
+ }
8
+ }
@@ -0,0 +1,25 @@
1
+ @layer dx-base {
2
+ :root {
3
+ touch-action: pan-x pan-y;
4
+ font-synthesis: none;
5
+ font-variation-settings: 'wght' 400,
6
+ 'slnt' 0;
7
+ scroll-padding-block-start: theme(spacing.14);
8
+ scroll-padding-block-end: theme(spacing.2);
9
+ @apply font-body;
10
+ }
11
+
12
+ button {
13
+ -webkit-tap-highlight-color: transparent;
14
+ }
15
+ }
16
+
17
+ @layer dx-tokens {
18
+ html, html.dark, html .dark {
19
+ background-color: var(--dx-baseSurface);
20
+ --surface-bg: var(--dx-baseSurface);
21
+ color: var(--dx-baseText);
22
+ --surface-text: var(--dx-baseText);
23
+ --description-text: var(--dx-description);
24
+ }
25
+ }
@@ -0,0 +1,76 @@
1
+ /* TODO(thure): Focus is handled by .dx-focus-ring, but should ideally be applied as part of this component. */
2
+ @layer dx-components {
3
+ /**
4
+ * NOTE: These are component classes (not utility classes) on a different layer, which themselves apply utility classes using `@apply`.
5
+ */
6
+
7
+ /* Base styles */
8
+ .dx-button {
9
+ @apply font-medium shrink-0 inline-flex select-none items-center justify-center overflow-hidden transition-colors duration-100 ease-linear bg-inputSurface min-bs-[2.5rem] pli-3;
10
+ &[aria-pressed='true'],
11
+ &[aria-checked='true'] {
12
+ @apply text-accentText bg-attention;
13
+ }
14
+ /* Disabled styles */
15
+ &[disabled]:not([disabled='false']) {
16
+ @apply opacity-40 cursor-not-allowed shadow-none;
17
+ }
18
+ /* Variants consistent between enabled & disabled */
19
+ &[data-variant='ghost'] {
20
+ @apply bg-transparent;
21
+ &:hover {
22
+ @apply bg-hoverSurface text-inherit;
23
+ }
24
+ &[data-state='open'] {
25
+ @apply bg-inputSurface;
26
+ }
27
+ &[aria-pressed='true'],
28
+ &[aria-checked='true'] {
29
+ @apply bg-baseSurface text-accentText;
30
+ }
31
+ }
32
+ &[data-variant='outline'] {
33
+ @apply border border-baseSurface bg-transparent;
34
+ &:hover {
35
+ @apply bg-hoverSurface;
36
+ }
37
+ }
38
+ /* Enabled styles */
39
+ &:not([disabled]),
40
+ &[disabled='false'] {
41
+ /* Hover */
42
+ &:hover {
43
+ @apply bg-hoverSurface;
44
+ }
45
+ /* Variants */
46
+ &[data-variant='primary'] {
47
+ @apply text-accentSurfaceText bg-accentSurface;
48
+ &:hover,
49
+ &[aria-pressed='true'],
50
+ &[aria-checked='true'] &[data-state='open'] {
51
+ @apply bg-accentSurfaceHover;
52
+ }
53
+ }
54
+ &[data-variant='destructive'] {
55
+ @apply text-accentSurfaceText bg-roseFill;
56
+ &:hover,
57
+ &[aria-pressed='true'],
58
+ &[aria-checked='true'] &[data-state='open'] {
59
+ @apply bg-roseFill;
60
+ }
61
+ }
62
+ }
63
+ }
64
+ /* Props */
65
+ .dx-button:not([data-props~='grouped']) {
66
+ @apply rounded-sm;
67
+ }
68
+ .dx-button:not([data-props~='wrap']) {
69
+ @apply truncate;
70
+ }
71
+ @media (pointer: fine) {
72
+ .dx-button[data-density='fine'] {
73
+ @apply min-bs-[2rem] pli-2.5;
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,26 @@
1
+ @layer dx-components {
2
+ :root {
3
+ --can-scroll-inline: initial;
4
+ }
5
+
6
+ @keyframes detect-scroll-inline {
7
+ from,
8
+ to {
9
+ --can-scroll-inline: ;
10
+ }
11
+ }
12
+
13
+ .justify-center-if-no-scroll {
14
+ justify-content: start;
15
+ }
16
+
17
+ @supports (animation-timeline: scroll(inline self)) {
18
+ .justify-center-if-no-scroll {
19
+ animation: detect-scroll-inline linear;
20
+ animation-timeline: scroll(inline self);
21
+ --justify-if-no-scroll: center;
22
+ --justify-if-can-scroll: var(--can-scroll-inline) start;
23
+ justify-content: var(--justify-if-can-scroll, var(--justify-if-no-scroll));
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,50 @@
1
+ /* TODO(thure): Focus is handled by .dx-focus-ring, but should ideally be applied as part of this component.*/
2
+ @layer dx-components {
3
+ .dx-checkbox--switch,
4
+ .dx-checkbox {
5
+ @apply border border-unAccent;
6
+ &[aria-checked='true'],
7
+ &[aria-checked='mixed'],
8
+ &:checked {
9
+ @apply bg-accentSurface accent-accentSurface border-accentSurface;
10
+ }
11
+
12
+ &:not([disabled]),
13
+ &[disabled='false'] {
14
+ &:hover {
15
+ @apply bg-unAccentHover accent-unAccentHover;
16
+ &[aria-checked='true'],
17
+ &[aria-checked='mixed'],
18
+ &:checked {
19
+ @apply bg-accentSurfaceHover accent-accentSurfaceHover border-accentSurfaceHover;
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ .dx-checkbox {
26
+ @apply is-4 bs-4 overflow-hidden shadow-inner transition-colors bg-unAccent accent-unAccent text-accentSurfaceText shrink-0 inline-grid place-items-center rounded-sm;
27
+ }
28
+
29
+ /* TODO(ZaymonFC): Focus is handled by .dx-focus-ring, but should ideally be applied as part of this component.*/
30
+ /* NOTE: This isn't compatible with the Radix switch. */
31
+ .dx-checkbox--switch {
32
+ @apply inline-block appearance-none relative shrink-0 bs-5 is-8;
33
+ @apply shadow-inner transition-colors bg-unAccent;
34
+ @apply cursor-pointer rounded-full;
35
+
36
+ &::before {
37
+ @apply is-3 bs-3 mli-[0.1875rem] mlb-[0.1875rem] absolute block bg-white rounded-full border-separator transition-transform duration-100 will-change-transform;
38
+ content: '';
39
+ }
40
+
41
+ &[aria-checked='true'],
42
+ &[aria-checked='mixed'],
43
+ &:checked {
44
+ background-image: none;
45
+ &::before {
46
+ @apply translate-x-[100%];
47
+ }
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,42 @@
1
+ @layer dx-components {
2
+ .dx-dialog__overlay {
3
+ @apply fixed z-50 inset-inline-0 block-start-0 bs-dvh bg-scrimSurface overflow-auto grid place-items-center pbs-[env(safe-area-inset-top)];
4
+ @media (min-width: theme('screens.sm')) {
5
+ @apply p-[calc(env(safe-area-inset-top)+.6rem)];
6
+ }
7
+ @media (min-width: theme('screens.md')) {
8
+ @apply p-[calc(env(safe-area-inset-top)+1.2rem)];
9
+ }
10
+ @media (min-width: theme('screens.lg')) {
11
+ @apply p-[calc(env(safe-area-inset-top)+2.4rem)];
12
+ }
13
+ &[data-block-align="start"]{
14
+ align-items: start;
15
+ justify-items: center;
16
+ }
17
+ &[data-block-align="center"]{
18
+ place-items: center;
19
+ }
20
+ &[data-block-align="end"]{
21
+ align-items: end;
22
+ justify-items: center;
23
+ }
24
+ }
25
+ .dx-dialog__content {
26
+ /* TODO(thure): `flex` should not be default. */
27
+ @apply flex flex-col is-dvw max-is-full p-4 animate-slideUpAndFade shadow-md backdrop-blur;
28
+ will-change: opacity, transform;
29
+ @media (min-width: theme('screens.sm')) {
30
+ @apply is-[95vw] border rounded-md border-separator;
31
+ }
32
+ @media (min-width: theme('screens.md')) {
33
+ @apply max-is-[24rem];
34
+ }
35
+ }
36
+ .dx-dialog__title {
37
+ @apply rounded shrink-0 text-xl font-medium;
38
+ }
39
+ .dx-dialog__description {
40
+ @apply mlb-2;
41
+ }
42
+ }
@@ -0,0 +1,18 @@
1
+ @layer dx-base {
2
+ body[data-drag-preview] {
3
+ i[data-tabster-dummy] {
4
+ display: none;
5
+ }
6
+ }
7
+ }
8
+
9
+ @layer utilities {
10
+ body[data-drag-preview] {
11
+ .drag-preview-p-0 {
12
+ padding-inline-start: 0;
13
+ padding-inline-end: 0;
14
+ padding-block-start: 0;
15
+ padding-block-end: 0;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,129 @@
1
+ @layer utilities {
2
+ .dx-focus-ring, .dx-focus-ring-inset {
3
+ &:not([disabled]),
4
+ &[disabled='false'] {
5
+ &:focus {
6
+ @apply outline-none;
7
+ }
8
+
9
+ &:focus-visible {
10
+ @apply ring-focusLine ring-offset-focusOffset z-[1] ring-neutralFocusIndicator;
11
+
12
+ &[data-variant="primary"] {
13
+ @apply ring-accentFocusIndicator;
14
+ }
15
+
16
+ &:hover {
17
+ @apply outline-none;
18
+
19
+ .dark & {
20
+ @apply outline-none;
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+ .dx-focus-ring-group, .dx-focus-ring-group-x, .dx-focus-ring-group-y {
28
+ &:not([disabled]),
29
+ &[disabled='false'] {
30
+ &:focus {
31
+ @apply outline-none;
32
+ }
33
+ }
34
+ }
35
+
36
+ .dx-focus-ring-group:focus-visible .dx-focus-ring-group-indicator,
37
+ .dx-focus-ring-group-x:focus-visible .dx-focus-ring-group-x-indicator,
38
+ .dx-focus-ring-group-y:focus-visible .dx-focus-ring-group-y-indicator {
39
+ @apply ring-focusLine ring-offset-focusOffset ring-neutralFocusIndicator;
40
+
41
+ &[data-variant="primary"] {
42
+ @apply ring-accentFocusIndicator;
43
+ }
44
+
45
+ &:hover {
46
+ @apply outline-none;
47
+
48
+ .dark & {
49
+ @apply outline-none;
50
+ }
51
+ }
52
+ }
53
+
54
+ .dx-focus-ring-inset {
55
+ &:not([disabled]),
56
+ &[disabled='false'] {
57
+ &:focus-visible {
58
+ @apply ring-inset;
59
+ }
60
+ }
61
+ }
62
+
63
+ .dx-focus-ring-inset-over-all, .dx-focus-ring-main[data-handles-focus="true"] {
64
+ &:not([disabled]),
65
+ &[disabled='false'] {
66
+ &::after {
67
+ content: "";
68
+ @apply z-20 pointer-events-none;
69
+ }
70
+
71
+ &:focus {
72
+ @apply outline-none;
73
+ }
74
+
75
+ &:focus-visible {
76
+ &::after {
77
+ @apply ring-focusLine ring-offset-focusOffset ring-inset z-[1] ring-neutralFocusIndicator;
78
+ }
79
+
80
+ &[data-variant="primary"]::after {
81
+ @apply ring-accentFocusIndicator;
82
+ }
83
+
84
+ &:hover {
85
+ @apply outline-none;
86
+
87
+ .dark & {
88
+ @apply outline-none;
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ .dx-focus-ring-inset-over-all {
96
+ &:not([disabled]),
97
+ &[disabled='false'] {
98
+ &::after {
99
+ @apply inset-0 absolute;
100
+ }
101
+ }
102
+ }
103
+
104
+ .dx-focus-ring-main[data-handles-focus="true"] {
105
+ &:not([disabled]),
106
+ &[disabled='false'] {
107
+ &::after {
108
+ position: fixed;
109
+ inset: 0;
110
+ }
111
+
112
+ @media screen(lg) {
113
+ &[data-sidebar-inline-start-state="expanded"]::after {
114
+ inset-inline-start: var(--nav-sidebar-size);
115
+ }
116
+ &[data-sidebar-inline-start-state="collapsed"]::after {
117
+ inset-inline-start: var(--l0-size);
118
+ }
119
+
120
+ &[data-sidebar-inline-end-state="expanded"]::after {
121
+ inset-inline-end: var(--complementary-sidebar-size);
122
+ }
123
+ &[data-sidebar-inline-end-state="collapsed"]::after {
124
+ inset-inline-end: var(--r0-size);
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }