@sublime-ui/library 0.1.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 (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/dist/components/AppBar/AppBar.d.ts +6 -0
  4. package/dist/components/AppBar/AppBar.js +55 -0
  5. package/dist/components/AppBar/AppBar.types.d.ts +11 -0
  6. package/dist/components/AppBar/AppBar.types.js +0 -0
  7. package/dist/components/AppBar/index.d.ts +3 -0
  8. package/dist/components/AppBar/index.js +4 -0
  9. package/dist/components/Avatar/Avatar.d.ts +7 -0
  10. package/dist/components/Avatar/Avatar.js +30 -0
  11. package/dist/components/Avatar/Avatar.types.d.ts +12 -0
  12. package/dist/components/Avatar/Avatar.types.js +0 -0
  13. package/dist/components/Avatar/index.d.ts +4 -0
  14. package/dist/components/Avatar/index.js +4 -0
  15. package/dist/components/Badge/Badge.d.ts +7 -0
  16. package/dist/components/Badge/Badge.js +75 -0
  17. package/dist/components/Badge/Badge.types.d.ts +12 -0
  18. package/dist/components/Badge/Badge.types.js +0 -0
  19. package/dist/components/Badge/index.d.ts +4 -0
  20. package/dist/components/Badge/index.js +4 -0
  21. package/dist/components/Banner/Banner.d.ts +7 -0
  22. package/dist/components/Banner/Banner.js +68 -0
  23. package/dist/components/Banner/Banner.types.d.ts +13 -0
  24. package/dist/components/Banner/Banner.types.js +0 -0
  25. package/dist/components/Banner/index.d.ts +4 -0
  26. package/dist/components/Banner/index.js +4 -0
  27. package/dist/components/BottomNav/BottomNav.d.ts +7 -0
  28. package/dist/components/BottomNav/BottomNav.js +9 -0
  29. package/dist/components/BottomNav/BottomNav.types.d.ts +10 -0
  30. package/dist/components/BottomNav/BottomNav.types.js +0 -0
  31. package/dist/components/BottomNav/index.d.ts +3 -0
  32. package/dist/components/BottomNav/index.js +4 -0
  33. package/dist/components/Button/Button.d.ts +7 -0
  34. package/dist/components/Button/Button.js +42 -0
  35. package/dist/components/Button/Button.types.d.ts +17 -0
  36. package/dist/components/Button/Button.types.js +0 -0
  37. package/dist/components/Button/index.d.ts +4 -0
  38. package/dist/components/Button/index.js +4 -0
  39. package/dist/components/Card/Card.d.ts +6 -0
  40. package/dist/components/Card/Card.js +26 -0
  41. package/dist/components/Card/Card.types.d.ts +10 -0
  42. package/dist/components/Card/Card.types.js +0 -0
  43. package/dist/components/Card/index.d.ts +3 -0
  44. package/dist/components/Card/index.js +4 -0
  45. package/dist/components/Checkbox/Checkbox.d.ts +7 -0
  46. package/dist/components/Checkbox/Checkbox.js +34 -0
  47. package/dist/components/Checkbox/Checkbox.types.d.ts +17 -0
  48. package/dist/components/Checkbox/Checkbox.types.js +0 -0
  49. package/dist/components/Checkbox/index.d.ts +4 -0
  50. package/dist/components/Checkbox/index.js +4 -0
  51. package/dist/components/Dialog/Dialog.d.ts +6 -0
  52. package/dist/components/Dialog/Dialog.js +51 -0
  53. package/dist/components/Dialog/Dialog.types.d.ts +12 -0
  54. package/dist/components/Dialog/Dialog.types.js +0 -0
  55. package/dist/components/Dialog/index.d.ts +3 -0
  56. package/dist/components/Dialog/index.js +4 -0
  57. package/dist/components/Divider/Divider.d.ts +6 -0
  58. package/dist/components/Divider/Divider.js +19 -0
  59. package/dist/components/Divider/Divider.types.d.ts +7 -0
  60. package/dist/components/Divider/Divider.types.js +0 -0
  61. package/dist/components/Divider/index.d.ts +3 -0
  62. package/dist/components/Divider/index.js +4 -0
  63. package/dist/components/Drawer/Drawer.d.ts +8 -0
  64. package/dist/components/Drawer/Drawer.js +9 -0
  65. package/dist/components/Drawer/Drawer.types.d.ts +13 -0
  66. package/dist/components/Drawer/Drawer.types.js +0 -0
  67. package/dist/components/Drawer/index.d.ts +4 -0
  68. package/dist/components/Drawer/index.js +4 -0
  69. package/dist/components/Fab/Fab.d.ts +7 -0
  70. package/dist/components/Fab/Fab.js +33 -0
  71. package/dist/components/Fab/Fab.types.d.ts +11 -0
  72. package/dist/components/Fab/Fab.types.js +0 -0
  73. package/dist/components/Fab/index.d.ts +4 -0
  74. package/dist/components/Fab/index.js +4 -0
  75. package/dist/components/GlassAppBar/GlassAppBar.d.ts +6 -0
  76. package/dist/components/GlassAppBar/GlassAppBar.js +57 -0
  77. package/dist/components/GlassAppBar/GlassAppBar.types.d.ts +12 -0
  78. package/dist/components/GlassAppBar/GlassAppBar.types.js +0 -0
  79. package/dist/components/GlassAppBar/index.d.ts +3 -0
  80. package/dist/components/GlassAppBar/index.js +4 -0
  81. package/dist/components/Icon/Icon.d.ts +8 -0
  82. package/dist/components/Icon/Icon.js +46 -0
  83. package/dist/components/Icon/Icon.types.d.ts +14 -0
  84. package/dist/components/Icon/Icon.types.js +0 -0
  85. package/dist/components/Icon/index.d.ts +5 -0
  86. package/dist/components/Icon/index.js +4 -0
  87. package/dist/components/Input/Input.d.ts +6 -0
  88. package/dist/components/Input/Input.js +43 -0
  89. package/dist/components/Input/Input.types.d.ts +13 -0
  90. package/dist/components/Input/Input.types.js +0 -0
  91. package/dist/components/Input/index.d.ts +3 -0
  92. package/dist/components/Input/index.js +4 -0
  93. package/dist/components/Select/Select.d.ts +6 -0
  94. package/dist/components/Select/Select.js +50 -0
  95. package/dist/components/Select/Select.types.d.ts +15 -0
  96. package/dist/components/Select/Select.types.js +0 -0
  97. package/dist/components/Select/index.d.ts +3 -0
  98. package/dist/components/Select/index.js +4 -0
  99. package/dist/components/Spinner/Spinner.d.ts +7 -0
  100. package/dist/components/Spinner/Spinner.js +35 -0
  101. package/dist/components/Spinner/Spinner.types.d.ts +9 -0
  102. package/dist/components/Spinner/Spinner.types.js +0 -0
  103. package/dist/components/Spinner/index.d.ts +4 -0
  104. package/dist/components/Spinner/index.js +4 -0
  105. package/dist/components/Surface/Surface.d.ts +6 -0
  106. package/dist/components/Surface/Surface.js +29 -0
  107. package/dist/components/Surface/Surface.types.d.ts +11 -0
  108. package/dist/components/Surface/Surface.types.js +0 -0
  109. package/dist/components/Surface/index.d.ts +3 -0
  110. package/dist/components/Surface/index.js +4 -0
  111. package/dist/components/Switch/Switch.d.ts +7 -0
  112. package/dist/components/Switch/Switch.js +34 -0
  113. package/dist/components/Switch/Switch.types.d.ts +17 -0
  114. package/dist/components/Switch/Switch.types.js +0 -0
  115. package/dist/components/Switch/index.d.ts +4 -0
  116. package/dist/components/Switch/index.js +4 -0
  117. package/dist/components/Text/Text.d.ts +7 -0
  118. package/dist/components/Text/Text.js +34 -0
  119. package/dist/components/Text/Text.types.d.ts +13 -0
  120. package/dist/components/Text/Text.types.js +0 -0
  121. package/dist/components/Text/index.d.ts +4 -0
  122. package/dist/components/Text/index.js +4 -0
  123. package/dist/components/Tooltip/Tooltip.d.ts +6 -0
  124. package/dist/components/Tooltip/Tooltip.js +8 -0
  125. package/dist/components/Tooltip/Tooltip.types.d.ts +11 -0
  126. package/dist/components/Tooltip/Tooltip.types.js +0 -0
  127. package/dist/components/Tooltip/index.d.ts +3 -0
  128. package/dist/components/Tooltip/index.js +4 -0
  129. package/dist/components/common.d.ts +11 -0
  130. package/dist/components/common.js +0 -0
  131. package/dist/index.d.ts +53 -0
  132. package/dist/index.js +54 -0
  133. package/dist/notifications/NotificationContext.d.ts +33 -0
  134. package/dist/notifications/NotificationContext.js +34 -0
  135. package/dist/notifications/NotificationHost.d.ts +5 -0
  136. package/dist/notifications/NotificationHost.js +22 -0
  137. package/dist/notifications/useNotify.d.ts +13 -0
  138. package/dist/notifications/useNotify.js +19 -0
  139. package/dist/provider/SublimeProvider.d.ts +12 -0
  140. package/dist/provider/SublimeProvider.js +23 -0
  141. package/dist/provider/TokenContext.d.ts +14 -0
  142. package/dist/provider/TokenContext.js +5 -0
  143. package/dist/provider/resolveTokens.d.ts +7 -0
  144. package/dist/provider/resolveTokens.js +13 -0
  145. package/dist/provider/useTokens.d.ts +7 -0
  146. package/dist/provider/useTokens.js +12 -0
  147. package/dist/tokens/generateThemes.d.ts +10 -0
  148. package/dist/tokens/generateThemes.js +44 -0
  149. package/dist/tokens/tokens.d.ts +74 -0
  150. package/dist/tokens/tokens.js +78 -0
  151. package/package.json +53 -0
  152. package/src/components/AppBar/AppBar.native.tsx +28 -0
  153. package/src/components/AppBar/AppBar.tsx +51 -0
  154. package/src/components/AppBar/AppBar.types.ts +9 -0
  155. package/src/components/AppBar/index.ts +2 -0
  156. package/src/components/Avatar/Avatar.native.tsx +38 -0
  157. package/src/components/Avatar/Avatar.tsx +38 -0
  158. package/src/components/Avatar/Avatar.types.ts +10 -0
  159. package/src/components/Avatar/index.ts +2 -0
  160. package/src/components/Badge/Badge.native.tsx +97 -0
  161. package/src/components/Badge/Badge.tsx +89 -0
  162. package/src/components/Badge/Badge.types.ts +11 -0
  163. package/src/components/Badge/index.ts +2 -0
  164. package/src/components/Banner/Banner.native.tsx +89 -0
  165. package/src/components/Banner/Banner.tsx +78 -0
  166. package/src/components/Banner/Banner.types.ts +11 -0
  167. package/src/components/Banner/index.ts +2 -0
  168. package/src/components/BottomNav/BottomNav.native.tsx +87 -0
  169. package/src/components/BottomNav/BottomNav.tsx +9 -0
  170. package/src/components/BottomNav/BottomNav.types.ts +8 -0
  171. package/src/components/BottomNav/index.ts +2 -0
  172. package/src/components/Button/Button.native.tsx +27 -0
  173. package/src/components/Button/Button.tsx +37 -0
  174. package/src/components/Button/Button.types.ts +17 -0
  175. package/src/components/Button/index.ts +2 -0
  176. package/src/components/Card/Card.native.tsx +24 -0
  177. package/src/components/Card/Card.tsx +30 -0
  178. package/src/components/Card/Card.types.ts +8 -0
  179. package/src/components/Card/index.ts +2 -0
  180. package/src/components/Checkbox/Checkbox.native.tsx +58 -0
  181. package/src/components/Checkbox/Checkbox.tsx +35 -0
  182. package/src/components/Checkbox/Checkbox.types.ts +15 -0
  183. package/src/components/Checkbox/index.ts +2 -0
  184. package/src/components/Dialog/Dialog.native.tsx +28 -0
  185. package/src/components/Dialog/Dialog.tsx +49 -0
  186. package/src/components/Dialog/Dialog.types.ts +10 -0
  187. package/src/components/Dialog/index.ts +2 -0
  188. package/src/components/Divider/Divider.native.tsx +30 -0
  189. package/src/components/Divider/Divider.tsx +16 -0
  190. package/src/components/Divider/Divider.types.ts +5 -0
  191. package/src/components/Divider/index.ts +2 -0
  192. package/src/components/Drawer/Drawer.native.tsx +113 -0
  193. package/src/components/Drawer/Drawer.tsx +9 -0
  194. package/src/components/Drawer/Drawer.types.ts +11 -0
  195. package/src/components/Drawer/index.ts +2 -0
  196. package/src/components/Fab/Fab.native.tsx +41 -0
  197. package/src/components/Fab/Fab.tsx +36 -0
  198. package/src/components/Fab/Fab.types.ts +9 -0
  199. package/src/components/Fab/index.ts +2 -0
  200. package/src/components/GlassAppBar/GlassAppBar.native.tsx +29 -0
  201. package/src/components/GlassAppBar/GlassAppBar.tsx +53 -0
  202. package/src/components/GlassAppBar/GlassAppBar.types.ts +10 -0
  203. package/src/components/GlassAppBar/index.ts +2 -0
  204. package/src/components/Icon/Icon.native.tsx +39 -0
  205. package/src/components/Icon/Icon.tsx +57 -0
  206. package/src/components/Icon/Icon.types.ts +13 -0
  207. package/src/components/Icon/index.ts +2 -0
  208. package/src/components/Input/Input.native.tsx +34 -0
  209. package/src/components/Input/Input.tsx +33 -0
  210. package/src/components/Input/Input.types.ts +11 -0
  211. package/src/components/Input/index.ts +2 -0
  212. package/src/components/Select/Select.native.tsx +63 -0
  213. package/src/components/Select/Select.tsx +48 -0
  214. package/src/components/Select/Select.types.ts +14 -0
  215. package/src/components/Select/index.ts +2 -0
  216. package/src/components/Spinner/Spinner.native.tsx +38 -0
  217. package/src/components/Spinner/Spinner.tsx +37 -0
  218. package/src/components/Spinner/Spinner.types.ts +7 -0
  219. package/src/components/Spinner/index.ts +2 -0
  220. package/src/components/Surface/Surface.native.tsx +32 -0
  221. package/src/components/Surface/Surface.tsx +31 -0
  222. package/src/components/Surface/Surface.types.ts +10 -0
  223. package/src/components/Surface/index.ts +2 -0
  224. package/src/components/Switch/Switch.native.tsx +58 -0
  225. package/src/components/Switch/Switch.tsx +35 -0
  226. package/src/components/Switch/Switch.types.ts +15 -0
  227. package/src/components/Switch/index.ts +2 -0
  228. package/src/components/Text/Text.native.tsx +31 -0
  229. package/src/components/Text/Text.tsx +34 -0
  230. package/src/components/Text/Text.types.ts +12 -0
  231. package/src/components/Text/index.ts +2 -0
  232. package/src/components/Tooltip/Tooltip.native.tsx +6 -0
  233. package/src/components/Tooltip/Tooltip.tsx +10 -0
  234. package/src/components/Tooltip/Tooltip.types.ts +9 -0
  235. package/src/components/Tooltip/index.ts +2 -0
  236. package/src/components/common.ts +10 -0
  237. package/src/index.ts +33 -0
  238. package/src/notifications/NotificationContext.tsx +57 -0
  239. package/src/notifications/NotificationHost.native.tsx +20 -0
  240. package/src/notifications/NotificationHost.tsx +27 -0
  241. package/src/notifications/useNotify.ts +18 -0
  242. package/src/provider/SublimeProvider.native.tsx +29 -0
  243. package/src/provider/SublimeProvider.tsx +30 -0
  244. package/src/provider/TokenContext.ts +13 -0
  245. package/src/provider/resolveTokens.ts +16 -0
  246. package/src/provider/useTokens.ts +10 -0
  247. package/src/test-utils/renderWeb.tsx +8 -0
  248. package/src/tokens/generateThemes.ts +49 -0
  249. package/src/tokens/tokens.ts +71 -0
File without changes
@@ -0,0 +1,3 @@
1
+ export { Select } from './Select.js';
2
+ export { SelectOption, SelectProps } from './Select.types.js';
3
+ import 'react';
@@ -0,0 +1,4 @@
1
+ import { Select } from "./Select.js";
2
+ export {
3
+ Select
4
+ };
@@ -0,0 +1,7 @@
1
+ import * as react from 'react';
2
+ import { SpinnerProps } from './Spinner.types.js';
3
+ import '../common.js';
4
+
5
+ declare function Spinner({ size, tone, testID }: SpinnerProps): react.JSX.Element;
6
+
7
+ export { Spinner };
@@ -0,0 +1,35 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { CircularProgress } from "@mui/material";
3
+ import { useTokens } from "../../provider/useTokens.js";
4
+ const sizePx = (size) => size === "sm" ? 16 : size === "lg" ? 40 : 24;
5
+ const toneColor = (c, tone) => {
6
+ switch (tone) {
7
+ case "primary":
8
+ return c.primary;
9
+ case "success":
10
+ return c.success;
11
+ case "danger":
12
+ return c.danger;
13
+ case "warning":
14
+ return c.warning;
15
+ case "info":
16
+ return c.info;
17
+ case "neutral":
18
+ default:
19
+ return c.mutedFg;
20
+ }
21
+ };
22
+ function Spinner({ size = "md", tone = "primary", testID }) {
23
+ const tokens = useTokens();
24
+ return /* @__PURE__ */ jsx(
25
+ CircularProgress,
26
+ {
27
+ size: sizePx(size),
28
+ "data-testid": testID,
29
+ sx: { color: toneColor(tokens.color, tone) }
30
+ }
31
+ );
32
+ }
33
+ export {
34
+ Spinner
35
+ };
@@ -0,0 +1,9 @@
1
+ import { Size, Tone } from '../common.js';
2
+
3
+ interface SpinnerProps {
4
+ size?: Size;
5
+ tone?: Tone;
6
+ testID?: string;
7
+ }
8
+
9
+ export type { SpinnerProps };
File without changes
@@ -0,0 +1,4 @@
1
+ export { Spinner } from './Spinner.js';
2
+ export { SpinnerProps } from './Spinner.types.js';
3
+ import 'react';
4
+ import '../common.js';
@@ -0,0 +1,4 @@
1
+ import { Spinner } from "./Spinner.js";
2
+ export {
3
+ Spinner
4
+ };
@@ -0,0 +1,6 @@
1
+ import * as react from 'react';
2
+ import { SurfaceProps } from './Surface.types.js';
3
+
4
+ declare function Surface({ children, elevation, padded, testID, }: SurfaceProps): react.JSX.Element;
5
+
6
+ export { Surface };
@@ -0,0 +1,29 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mui/material";
3
+ import { useTokens } from "../../provider/useTokens.js";
4
+ const boxShadow = (e, shadows) => e === "none" ? "none" : shadows[e];
5
+ function Surface({
6
+ children,
7
+ elevation = "sm",
8
+ padded = true,
9
+ testID
10
+ }) {
11
+ const tokens = useTokens();
12
+ return /* @__PURE__ */ jsx(
13
+ Box,
14
+ {
15
+ "data-testid": testID,
16
+ sx: {
17
+ backgroundColor: tokens.color.surface,
18
+ border: `1px solid ${tokens.color.surfaceBorder}`,
19
+ borderRadius: `${tokens.radii.lg}px`,
20
+ boxShadow: boxShadow(elevation, tokens.shadows),
21
+ padding: padded ? `${tokens.spacing.lg}px` : 0
22
+ },
23
+ children
24
+ }
25
+ );
26
+ }
27
+ export {
28
+ Surface
29
+ };
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ type SurfaceElevation = 'none' | 'sm' | 'md' | 'lg';
4
+ interface SurfaceProps {
5
+ children: ReactNode;
6
+ elevation?: SurfaceElevation;
7
+ padded?: boolean;
8
+ testID?: string;
9
+ }
10
+
11
+ export type { SurfaceElevation, SurfaceProps };
File without changes
@@ -0,0 +1,3 @@
1
+ export { Surface } from './Surface.js';
2
+ export { SurfaceProps } from './Surface.types.js';
3
+ import 'react';
@@ -0,0 +1,4 @@
1
+ import { Surface } from "./Surface.js";
2
+ export {
3
+ Surface
4
+ };
@@ -0,0 +1,7 @@
1
+ import * as react from 'react';
2
+ import { SwitchProps } from './Switch.types.js';
3
+ import '../common.js';
4
+
5
+ declare function Switch({ value, onValueChange, label, disabled, tone, testID, }: SwitchProps): react.JSX.Element;
6
+
7
+ export { Switch };
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Switch as MuiSwitch, FormControlLabel } from "@mui/material";
3
+ const muiColor = (t) => t === "danger" ? "error" : t === "neutral" ? "default" : t;
4
+ function Switch({
5
+ value,
6
+ onValueChange,
7
+ label,
8
+ disabled,
9
+ tone = "primary",
10
+ testID
11
+ }) {
12
+ const control = /* @__PURE__ */ jsx(
13
+ MuiSwitch,
14
+ {
15
+ checked: value,
16
+ onChange: (e) => onValueChange(e.target.checked),
17
+ color: muiColor(tone),
18
+ "data-testid": testID,
19
+ ...disabled === void 0 ? {} : { disabled }
20
+ }
21
+ );
22
+ if (label === void 0) return control;
23
+ return /* @__PURE__ */ jsx(
24
+ FormControlLabel,
25
+ {
26
+ control,
27
+ label,
28
+ ...disabled === void 0 ? {} : { disabled }
29
+ }
30
+ );
31
+ }
32
+ export {
33
+ Switch
34
+ };
@@ -0,0 +1,17 @@
1
+ import { Tone } from '../common.js';
2
+
3
+ interface SwitchProps {
4
+ /** Whether the switch is on. */
5
+ value: boolean;
6
+ /** Called with the new value when toggled. */
7
+ onValueChange: (value: boolean) => void;
8
+ /** Optional label rendered beside the switch. */
9
+ label?: string;
10
+ /** Disables interaction. */
11
+ disabled?: boolean;
12
+ /** Color tone applied to the on state. */
13
+ tone?: Tone;
14
+ testID?: string;
15
+ }
16
+
17
+ export type { SwitchProps };
File without changes
@@ -0,0 +1,4 @@
1
+ export { Switch } from './Switch.js';
2
+ export { SwitchProps } from './Switch.types.js';
3
+ import 'react';
4
+ import '../common.js';
@@ -0,0 +1,4 @@
1
+ import { Switch } from "./Switch.js";
2
+ export {
3
+ Switch
4
+ };
@@ -0,0 +1,7 @@
1
+ import * as react from 'react';
2
+ import { TextProps } from './Text.types.js';
3
+ import '../common.js';
4
+
5
+ declare function Text({ children, variant, numberOfLines, testID, }: TextProps): react.JSX.Element;
6
+
7
+ export { Text };
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Typography } from "@mui/material";
3
+ import { useTokens } from "../../provider/useTokens.js";
4
+ const muiVariant = (v) => v === "title" ? "h6" : v === "subtitle" ? "subtitle1" : v === "caption" ? "caption" : "body1";
5
+ function Text({
6
+ children,
7
+ variant = "body",
8
+ numberOfLines,
9
+ testID
10
+ }) {
11
+ const tokens = useTokens();
12
+ const muted = variant === "caption" || variant === "subtitle";
13
+ const clamp = numberOfLines !== void 0 ? {
14
+ display: "-webkit-box",
15
+ WebkitLineClamp: numberOfLines,
16
+ WebkitBoxOrient: "vertical",
17
+ overflow: "hidden"
18
+ } : {};
19
+ return /* @__PURE__ */ jsx(
20
+ Typography,
21
+ {
22
+ variant: muiVariant(variant),
23
+ "data-testid": testID,
24
+ sx: {
25
+ color: muted ? tokens.color.mutedFg : tokens.color.foreground,
26
+ ...clamp
27
+ },
28
+ children
29
+ }
30
+ );
31
+ }
32
+ export {
33
+ Text
34
+ };
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { Tone } from '../common.js';
3
+
4
+ type TextVariant = 'title' | 'subtitle' | 'body' | 'caption';
5
+ interface TextProps {
6
+ children: ReactNode;
7
+ variant?: TextVariant;
8
+ tone?: Tone;
9
+ numberOfLines?: number;
10
+ testID?: string;
11
+ }
12
+
13
+ export type { TextProps, TextVariant };
File without changes
@@ -0,0 +1,4 @@
1
+ export { Text } from './Text.js';
2
+ export { TextProps } from './Text.types.js';
3
+ import 'react';
4
+ import '../common.js';
@@ -0,0 +1,4 @@
1
+ import { Text } from "./Text.js";
2
+ export {
3
+ Text
4
+ };
@@ -0,0 +1,6 @@
1
+ import * as react from 'react';
2
+ import { TooltipProps } from './Tooltip.types.js';
3
+
4
+ declare function Tooltip({ label, children, testID }: TooltipProps): react.JSX.Element;
5
+
6
+ export { Tooltip };
@@ -0,0 +1,8 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Tooltip as MuiTooltip } from "@mui/material";
3
+ function Tooltip({ label, children, testID }) {
4
+ return /* @__PURE__ */ jsx(MuiTooltip, { title: label, "data-testid": testID, children });
5
+ }
6
+ export {
7
+ Tooltip
8
+ };
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react';
2
+
3
+ interface TooltipProps {
4
+ /** The tooltip text shown on hover/long-press. */
5
+ label: string;
6
+ /** The single element the tooltip wraps. */
7
+ children: ReactElement;
8
+ testID?: string;
9
+ }
10
+
11
+ export type { TooltipProps };
File without changes
@@ -0,0 +1,3 @@
1
+ export { Tooltip } from './Tooltip.js';
2
+ export { TooltipProps } from './Tooltip.types.js';
3
+ import 'react';
@@ -0,0 +1,4 @@
1
+ import { Tooltip } from "./Tooltip.js";
2
+ export {
3
+ Tooltip
4
+ };
@@ -0,0 +1,11 @@
1
+ type Variant = 'solid' | 'soft' | 'outline' | 'ghost';
2
+ type Tone = 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'neutral';
3
+ type Size = 'sm' | 'md' | 'lg';
4
+ interface NavItem {
5
+ key: string;
6
+ label: string;
7
+ icon: string;
8
+ badge?: string | number;
9
+ }
10
+
11
+ export type { NavItem, Size, Tone, Variant };
File without changes
@@ -0,0 +1,53 @@
1
+ export { SublimeProvider, SublimeProviderProps } from './provider/SublimeProvider.js';
2
+ export { useTokens } from './provider/useTokens.js';
3
+ export { generateThemes } from './tokens/generateThemes.js';
4
+ export { ColorTokens, SublimeTokens, defaultTokens } from './tokens/tokens.js';
5
+ export { useNotify } from './notifications/useNotify.js';
6
+ export { Button } from './components/Button/Button.js';
7
+ export { ButtonProps } from './components/Button/Button.types.js';
8
+ export { Text } from './components/Text/Text.js';
9
+ export { NavItem } from './components/common.js';
10
+ export { Input } from './components/Input/Input.js';
11
+ export { Card } from './components/Card/Card.js';
12
+ export { Badge } from './components/Badge/Badge.js';
13
+ export { Icon } from './components/Icon/Icon.js';
14
+ export { Surface } from './components/Surface/Surface.js';
15
+ export { Divider } from './components/Divider/Divider.js';
16
+ export { Spinner } from './components/Spinner/Spinner.js';
17
+ export { Dialog } from './components/Dialog/Dialog.js';
18
+ export { Banner } from './components/Banner/Banner.js';
19
+ export { Fab } from './components/Fab/Fab.js';
20
+ export { AppBar } from './components/AppBar/AppBar.js';
21
+ export { Select } from './components/Select/Select.js';
22
+ export { Avatar } from './components/Avatar/Avatar.js';
23
+ export { Tooltip } from './components/Tooltip/Tooltip.js';
24
+ export { Checkbox } from './components/Checkbox/Checkbox.js';
25
+ export { Switch } from './components/Switch/Switch.js';
26
+ export { GlassAppBar } from './components/GlassAppBar/GlassAppBar.js';
27
+ export { BottomNav } from './components/BottomNav/BottomNav.js';
28
+ export { Drawer } from './components/Drawer/Drawer.js';
29
+ import 'react';
30
+ import './provider/TokenContext.js';
31
+ import 'react-native-paper';
32
+ import '@mui/material';
33
+ import './notifications/NotificationContext.js';
34
+ import './components/Text/Text.types.js';
35
+ import './components/Input/Input.types.js';
36
+ import './components/Card/Card.types.js';
37
+ import './components/Badge/Badge.types.js';
38
+ import './components/Icon/Icon.types.js';
39
+ import './components/Surface/Surface.types.js';
40
+ import './components/Divider/Divider.types.js';
41
+ import './components/Spinner/Spinner.types.js';
42
+ import './components/Dialog/Dialog.types.js';
43
+ import './components/Banner/Banner.types.js';
44
+ import './components/Fab/Fab.types.js';
45
+ import './components/AppBar/AppBar.types.js';
46
+ import './components/Select/Select.types.js';
47
+ import './components/Avatar/Avatar.types.js';
48
+ import './components/Tooltip/Tooltip.types.js';
49
+ import './components/Checkbox/Checkbox.types.js';
50
+ import './components/Switch/Switch.types.js';
51
+ import './components/GlassAppBar/GlassAppBar.types.js';
52
+ import './components/BottomNav/BottomNav.types.js';
53
+ import './components/Drawer/Drawer.types.js';
package/dist/index.js ADDED
@@ -0,0 +1,54 @@
1
+ import { SublimeProvider } from "./provider/SublimeProvider.js";
2
+ import { useTokens } from "./provider/useTokens.js";
3
+ import { generateThemes } from "./tokens/generateThemes.js";
4
+ import { defaultTokens } from "./tokens/tokens.js";
5
+ import { useNotify } from "./notifications/useNotify.js";
6
+ import { Button } from "./components/Button/index.js";
7
+ import { Text } from "./components/Text/index.js";
8
+ import { Input } from "./components/Input/index.js";
9
+ import { Card } from "./components/Card/index.js";
10
+ import { Badge } from "./components/Badge/index.js";
11
+ import { Icon } from "./components/Icon/index.js";
12
+ import { Surface } from "./components/Surface/index.js";
13
+ import { Divider } from "./components/Divider/index.js";
14
+ import { Spinner } from "./components/Spinner/index.js";
15
+ import { Dialog } from "./components/Dialog/index.js";
16
+ import { Banner } from "./components/Banner/index.js";
17
+ import { Fab } from "./components/Fab/index.js";
18
+ import { AppBar } from "./components/AppBar/index.js";
19
+ import { Select } from "./components/Select/index.js";
20
+ import { Avatar } from "./components/Avatar/index.js";
21
+ import { Tooltip } from "./components/Tooltip/index.js";
22
+ import { Checkbox } from "./components/Checkbox/index.js";
23
+ import { Switch } from "./components/Switch/index.js";
24
+ import { GlassAppBar } from "./components/GlassAppBar/index.js";
25
+ import { BottomNav } from "./components/BottomNav/index.js";
26
+ import { Drawer } from "./components/Drawer/index.js";
27
+ export {
28
+ AppBar,
29
+ Avatar,
30
+ Badge,
31
+ Banner,
32
+ BottomNav,
33
+ Button,
34
+ Card,
35
+ Checkbox,
36
+ Dialog,
37
+ Divider,
38
+ Drawer,
39
+ Fab,
40
+ GlassAppBar,
41
+ Icon,
42
+ Input,
43
+ Select,
44
+ Spinner,
45
+ SublimeProvider,
46
+ Surface,
47
+ Switch,
48
+ Text,
49
+ Tooltip,
50
+ defaultTokens,
51
+ generateThemes,
52
+ useNotify,
53
+ useTokens
54
+ };
@@ -0,0 +1,33 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ type Tone = 'success' | 'error' | 'warning' | 'info' | 'neutral';
5
+ interface Notification {
6
+ id: string;
7
+ message: string;
8
+ tone: Tone;
9
+ duration: number;
10
+ action?: {
11
+ label: string;
12
+ onPress: () => void;
13
+ };
14
+ }
15
+ interface NotifyOptions {
16
+ tone?: Tone;
17
+ duration?: number;
18
+ action?: {
19
+ label: string;
20
+ onPress: () => void;
21
+ };
22
+ }
23
+ interface QueueApi {
24
+ queue: Notification[];
25
+ notify: (message: string, opts?: NotifyOptions) => string;
26
+ dismiss: (id: string) => void;
27
+ }
28
+ declare function NotificationProvider({ children }: {
29
+ children: ReactNode;
30
+ }): react.JSX.Element;
31
+ declare function useNotificationQueue(): QueueApi;
32
+
33
+ export { type Notification, NotificationProvider, type NotifyOptions, type Tone, useNotificationQueue };
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
3
+ const Ctx = createContext(null);
4
+ function NotificationProvider({ children }) {
5
+ const [queue, setQueue] = useState([]);
6
+ const counter = useRef(0);
7
+ const dismiss = useCallback((id) => {
8
+ setQueue((q) => q.filter((n) => n.id !== id));
9
+ }, []);
10
+ const notify = useCallback((message, opts = {}) => {
11
+ counter.current += 1;
12
+ const id = `n${counter.current}`;
13
+ const n = {
14
+ id,
15
+ message,
16
+ tone: opts.tone ?? "neutral",
17
+ duration: opts.duration ?? 4e3,
18
+ ...opts.action ? { action: opts.action } : {}
19
+ };
20
+ setQueue((q) => [...q, n]);
21
+ return id;
22
+ }, []);
23
+ const value = useMemo(() => ({ queue, notify, dismiss }), [queue, notify, dismiss]);
24
+ return /* @__PURE__ */ jsx(Ctx.Provider, { value, children });
25
+ }
26
+ function useNotificationQueue() {
27
+ const api = useContext(Ctx);
28
+ if (api === null) throw new Error("Notifications require a <SublimeProvider>.");
29
+ return api;
30
+ }
31
+ export {
32
+ NotificationProvider,
33
+ useNotificationQueue
34
+ };
@@ -0,0 +1,5 @@
1
+ import * as react from 'react';
2
+
3
+ declare function NotificationHost(): react.JSX.Element;
4
+
5
+ export { NotificationHost };
@@ -0,0 +1,22 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { Snackbar, Alert } from "@mui/material";
3
+ import { useNotificationQueue } from "./NotificationContext.js";
4
+ const severityOf = (tone) => tone === "neutral" ? "info" : tone;
5
+ function NotificationHost() {
6
+ const { queue, dismiss } = useNotificationQueue();
7
+ return /* @__PURE__ */ jsx(Fragment, { children: queue.map((n, i) => /* @__PURE__ */ jsx(
8
+ Snackbar,
9
+ {
10
+ open: true,
11
+ autoHideDuration: n.duration,
12
+ onClose: () => dismiss(n.id),
13
+ anchorOrigin: { vertical: "bottom", horizontal: "center" },
14
+ style: { bottom: 16 + i * 64 },
15
+ children: /* @__PURE__ */ jsx(Alert, { severity: severityOf(n.tone), onClose: () => dismiss(n.id), variant: "filled", children: n.message })
16
+ },
17
+ n.id
18
+ )) });
19
+ }
20
+ export {
21
+ NotificationHost
22
+ };
@@ -0,0 +1,13 @@
1
+ import { NotifyOptions } from './NotificationContext.js';
2
+ import 'react';
3
+
4
+ declare function useNotify(): {
5
+ notify: (message: string, opts?: NotifyOptions) => string;
6
+ dismiss: (id: string) => void;
7
+ success: (message: string, opts?: NotifyOptions) => string;
8
+ error: (message: string, opts?: NotifyOptions) => string;
9
+ warning: (message: string, opts?: NotifyOptions) => string;
10
+ info: (message: string, opts?: NotifyOptions) => string;
11
+ };
12
+
13
+ export { useNotify };
@@ -0,0 +1,19 @@
1
+ import { useMemo } from "react";
2
+ import { useNotificationQueue } from "./NotificationContext.js";
3
+ function useNotify() {
4
+ const { notify, dismiss } = useNotificationQueue();
5
+ return useMemo(() => {
6
+ const toned = (tone) => (message, opts) => notify(message, { ...opts, tone });
7
+ return {
8
+ notify,
9
+ dismiss,
10
+ success: toned("success"),
11
+ error: toned("error"),
12
+ warning: toned("warning"),
13
+ info: toned("info")
14
+ };
15
+ }, [notify, dismiss]);
16
+ }
17
+ export {
18
+ useNotify
19
+ };
@@ -0,0 +1,12 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { SublimeTokens } from '../tokens/tokens.js';
4
+
5
+ interface SublimeProviderProps {
6
+ mode?: 'light' | 'dark';
7
+ tokens?: SublimeTokens;
8
+ children: ReactNode;
9
+ }
10
+ declare function SublimeProvider({ mode, tokens, children }: SublimeProviderProps): react.JSX.Element;
11
+
12
+ export { SublimeProvider, type SublimeProviderProps };
@@ -0,0 +1,23 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { ThemeProvider, CssBaseline } from "@mui/material";
4
+ import { generateThemes } from "../tokens/generateThemes.js";
5
+ import { defaultTokens } from "../tokens/tokens.js";
6
+ import { TokenContext } from "./TokenContext.js";
7
+ import { resolveTokens } from "./resolveTokens.js";
8
+ import { NotificationProvider } from "../notifications/NotificationContext.js";
9
+ import { NotificationHost } from "../notifications/NotificationHost.js";
10
+ function SublimeProvider({ mode = "light", tokens = defaultTokens, children }) {
11
+ const { muiTheme } = useMemo(() => generateThemes(tokens, mode), [tokens, mode]);
12
+ const resolved = useMemo(() => resolveTokens(tokens, mode), [tokens, mode]);
13
+ return /* @__PURE__ */ jsxs(ThemeProvider, { theme: muiTheme, children: [
14
+ /* @__PURE__ */ jsx(CssBaseline, {}),
15
+ /* @__PURE__ */ jsx(TokenContext.Provider, { value: resolved, children: /* @__PURE__ */ jsxs(NotificationProvider, { children: [
16
+ children,
17
+ /* @__PURE__ */ jsx(NotificationHost, {})
18
+ ] }) })
19
+ ] });
20
+ }
21
+ export {
22
+ SublimeProvider
23
+ };
@@ -0,0 +1,14 @@
1
+ import * as react from 'react';
2
+ import { ColorTokens, SublimeTokens } from '../tokens/tokens.js';
3
+
4
+ interface ResolvedTokens {
5
+ color: ColorTokens;
6
+ radii: SublimeTokens['radii'];
7
+ shadows: SublimeTokens['shadows'];
8
+ spacing: SublimeTokens['spacing'];
9
+ typography: SublimeTokens['typography'];
10
+ mode: 'light' | 'dark';
11
+ }
12
+ declare const TokenContext: react.Context<ResolvedTokens | null>;
13
+
14
+ export { type ResolvedTokens, TokenContext };