@tanishqkancharla/maui 0.0.1

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 (209) hide show
  1. package/README.md +6 -0
  2. package/dist/MauiProvider.d.ts +10 -0
  3. package/dist/MauiProvider.js +45 -0
  4. package/dist/UIDatabase/Focus.d.ts +52 -0
  5. package/dist/UIDatabase/Focus.js +173 -0
  6. package/dist/UIDatabase/UIDatabase.d.ts +11 -0
  7. package/dist/UIDatabase/UIDatabase.js +24 -0
  8. package/dist/components/Avatar.d.ts +8 -0
  9. package/dist/components/Avatar.js +77 -0
  10. package/dist/components/Badge.d.ts +4 -0
  11. package/dist/components/Badge.js +27 -0
  12. package/dist/components/Button.d.ts +13 -0
  13. package/dist/components/Button.js +112 -0
  14. package/dist/components/Checkbox.d.ts +7 -0
  15. package/dist/components/Checkbox.js +54 -0
  16. package/dist/components/CollectionPopover.d.ts +4 -0
  17. package/dist/components/CollectionPopover.js +17 -0
  18. package/dist/components/Dialog.d.ts +7 -0
  19. package/dist/components/Dialog.js +36 -0
  20. package/dist/components/FuzzyString.d.ts +5 -0
  21. package/dist/components/FuzzyString.js +13 -0
  22. package/dist/components/Icons.d.ts +28 -0
  23. package/dist/components/Icons.js +52 -0
  24. package/dist/components/Input.d.ts +7 -0
  25. package/dist/components/Input.js +193 -0
  26. package/dist/components/ListBox.d.ts +9 -0
  27. package/dist/components/ListBox.js +58 -0
  28. package/dist/components/Menu.d.ts +13 -0
  29. package/dist/components/Menu.js +28 -0
  30. package/dist/components/Overlay.d.ts +5 -0
  31. package/dist/components/Overlay.js +30 -0
  32. package/dist/components/Panel.d.ts +4 -0
  33. package/dist/components/Panel.js +15 -0
  34. package/dist/components/Prose.d.ts +24 -0
  35. package/dist/components/Prose.js +43 -0
  36. package/dist/components/Radio.d.ts +12 -0
  37. package/dist/components/Radio.js +64 -0
  38. package/dist/components/Select.d.ts +13 -0
  39. package/dist/components/Select.js +85 -0
  40. package/dist/components/Slider.d.ts +6 -0
  41. package/dist/components/Slider.js +84 -0
  42. package/dist/components/Switch.d.ts +7 -0
  43. package/dist/components/Switch.js +55 -0
  44. package/dist/components/Table.d.ts +20 -0
  45. package/dist/components/Table.js +42 -0
  46. package/dist/components/Tooltip.d.ts +14 -0
  47. package/dist/components/Tooltip.js +165 -0
  48. package/dist/components/Typography.d.ts +36 -0
  49. package/dist/components/Typography.js +116 -0
  50. package/dist/components/Utils.d.ts +35 -0
  51. package/dist/components/Utils.js +43 -0
  52. package/dist/components/navigationItem.d.ts +1 -0
  53. package/dist/components/navigationItem.js +19 -0
  54. package/dist/hooks/useFocus.d.ts +18 -0
  55. package/dist/hooks/useFocus.js +47 -0
  56. package/dist/hooks/useRefCurrent.d.ts +1 -0
  57. package/dist/hooks/useRefCurrent.js +8 -0
  58. package/dist/hooks/useTupleDatabase.d.ts +7 -0
  59. package/dist/hooks/useTupleDatabase.js +10 -0
  60. package/dist/maui.d.ts +42 -0
  61. package/dist/maui.js +46 -0
  62. package/dist/patterns/Loader.d.ts +9 -0
  63. package/dist/patterns/Loader.js +100 -0
  64. package/dist/patterns/Sidebar.d.ts +19 -0
  65. package/dist/patterns/Sidebar.js +96 -0
  66. package/dist/patterns/Tree.d.ts +32 -0
  67. package/dist/patterns/Tree.js +173 -0
  68. package/dist/theme/ThemeContext.d.ts +14 -0
  69. package/dist/theme/ThemeContext.js +51 -0
  70. package/dist/theme/dataTheme.d.ts +2 -0
  71. package/dist/theme/dataTheme.js +2 -0
  72. package/dist/theme/themeFoucScript.d.ts +5 -0
  73. package/dist/theme/themeFoucScript.js +28 -0
  74. package/dist/tokens/avatar.d.ts +32 -0
  75. package/dist/tokens/avatar.js +34 -0
  76. package/dist/tokens/background.d.ts +15 -0
  77. package/dist/tokens/background.js +34 -0
  78. package/dist/tokens/borders.d.ts +7 -0
  79. package/dist/tokens/borders.js +21 -0
  80. package/dist/tokens/colors.d.ts +202 -0
  81. package/dist/tokens/colors.js +65 -0
  82. package/dist/tokens/focusRing.d.ts +5 -0
  83. package/dist/tokens/focusRing.js +23 -0
  84. package/dist/tokens/layout.d.ts +32 -0
  85. package/dist/tokens/layout.js +79 -0
  86. package/dist/tokens/motion.d.ts +3 -0
  87. package/dist/tokens/motion.js +11 -0
  88. package/dist/tokens/prose.d.ts +30 -0
  89. package/dist/tokens/prose.js +117 -0
  90. package/dist/tokens/radius.d.ts +10 -0
  91. package/dist/tokens/radius.js +11 -0
  92. package/dist/tokens/shadow.d.ts +10 -0
  93. package/dist/tokens/shadow.js +24 -0
  94. package/dist/tokens/sizing.d.ts +5 -0
  95. package/dist/tokens/sizing.js +6 -0
  96. package/dist/tokens/spacing.d.ts +39 -0
  97. package/dist/tokens/spacing.js +39 -0
  98. package/dist/tokens/text.d.ts +865 -0
  99. package/dist/tokens/text.js +59 -0
  100. package/dist/tokens/visuallyHidden.d.ts +1 -0
  101. package/dist/tokens/visuallyHidden.js +12 -0
  102. package/dist/utils/fuzzyMatch.d.ts +9 -0
  103. package/dist/utils/fuzzyMatch.js +101 -0
  104. package/dist/utils/memoize.d.ts +8 -0
  105. package/dist/utils/memoize.js +20 -0
  106. package/package.json +67 -0
  107. package/src/MauiProvider.tsx +83 -0
  108. package/src/UIDatabase/Focus.ts +263 -0
  109. package/src/UIDatabase/UIDatabase.tsx +49 -0
  110. package/src/apps/EmailClient/EmailClient.tsx +129 -0
  111. package/src/apps/EmailClient/data.tsx +254 -0
  112. package/src/components/Avatar.tsx +99 -0
  113. package/src/components/Badge.tsx +38 -0
  114. package/src/components/Button.tsx +175 -0
  115. package/src/components/Checkbox.tsx +99 -0
  116. package/src/components/CodeBlock.tsx +78 -0
  117. package/src/components/CollectionPopover.tsx +41 -0
  118. package/src/components/Dialog.tsx +60 -0
  119. package/src/components/FuzzyString.tsx +23 -0
  120. package/src/components/Icons.tsx +320 -0
  121. package/src/components/Input.tsx +274 -0
  122. package/src/components/ListBox.tsx +81 -0
  123. package/src/components/Menu.tsx +68 -0
  124. package/src/components/Overlay.tsx +45 -0
  125. package/src/components/Panel.tsx +32 -0
  126. package/src/components/Prose.tsx +59 -0
  127. package/src/components/Radio.tsx +121 -0
  128. package/src/components/Select.tsx +166 -0
  129. package/src/components/Slider.tsx +126 -0
  130. package/src/components/Switch.tsx +94 -0
  131. package/src/components/Table.tsx +61 -0
  132. package/src/components/Tooltip.tsx +269 -0
  133. package/src/components/Typography.tsx +161 -0
  134. package/src/components/Utils.tsx +100 -0
  135. package/src/components/navigationItem.ts +25 -0
  136. package/src/hooks/useCommand.ts +98 -0
  137. package/src/hooks/useFocus.tsx +87 -0
  138. package/src/hooks/useRefCurrent.ts +11 -0
  139. package/src/hooks/useTupleDatabase.ts +22 -0
  140. package/src/index.html +52 -0
  141. package/src/index.tsx +64 -0
  142. package/src/maui.ts +104 -0
  143. package/src/pages/AvatarPage.tsx +52 -0
  144. package/src/pages/BackgroundColorTokenPage.tsx +142 -0
  145. package/src/pages/BadgePage.tsx +41 -0
  146. package/src/pages/BordersTokenPage.tsx +205 -0
  147. package/src/pages/ButtonsPage.tsx +160 -0
  148. package/src/pages/CodeBlockPage.tsx +120 -0
  149. package/src/pages/ColorTokenPage.tsx +126 -0
  150. package/src/pages/CornerRadiusTokenPage.tsx +164 -0
  151. package/src/pages/EmailClientPage.tsx +25 -0
  152. package/src/pages/FlexTokenPage.tsx +167 -0
  153. package/src/pages/FocusRingTokenPage.tsx +77 -0
  154. package/src/pages/FormControlsPage.tsx +112 -0
  155. package/src/pages/FuzzyStringPage.tsx +155 -0
  156. package/src/pages/IconsPage.tsx +62 -0
  157. package/src/pages/InboxPage.tsx +29 -0
  158. package/src/pages/LayoutTokenPage.tsx +150 -0
  159. package/src/pages/LayoutUtilitiesPage.tsx +34 -0
  160. package/src/pages/ListBoxPage.tsx +44 -0
  161. package/src/pages/LoaderPage.tsx +74 -0
  162. package/src/pages/Maui.tsx +298 -0
  163. package/src/pages/MenuPage.tsx +49 -0
  164. package/src/pages/MessageListPage.tsx +30 -0
  165. package/src/pages/MotionTokenPage.tsx +107 -0
  166. package/src/pages/ProsePage.tsx +107 -0
  167. package/src/pages/SelectPage.tsx +28 -0
  168. package/src/pages/ShadowTokenPage.tsx +128 -0
  169. package/src/pages/SidebarPage.tsx +178 -0
  170. package/src/pages/SizingTokenPage.tsx +150 -0
  171. package/src/pages/SpacingTokenPage.tsx +169 -0
  172. package/src/pages/TextTokenPage.tsx +182 -0
  173. package/src/pages/TooltipPage.tsx +127 -0
  174. package/src/pages/TreePage.tsx +156 -0
  175. package/src/patterns/Inbox.tsx +487 -0
  176. package/src/patterns/Loader.tsx +161 -0
  177. package/src/patterns/MessageList.tsx +194 -0
  178. package/src/patterns/Sidebar.tsx +184 -0
  179. package/src/patterns/Tree.tsx +354 -0
  180. package/src/theme/ThemeContext.tsx +88 -0
  181. package/src/theme/dataTheme.ts +2 -0
  182. package/src/theme/themeFoucScript.ts +29 -0
  183. package/src/tokens/avatar.ts +35 -0
  184. package/src/tokens/background.ts +39 -0
  185. package/src/tokens/borders.ts +33 -0
  186. package/src/tokens/colors.ts +79 -0
  187. package/src/tokens/focusRing.ts +29 -0
  188. package/src/tokens/layout.ts +130 -0
  189. package/src/tokens/motion.ts +15 -0
  190. package/src/tokens/prose.ts +164 -0
  191. package/src/tokens/radius.ts +12 -0
  192. package/src/tokens/shadow.ts +28 -0
  193. package/src/tokens/sizing.ts +7 -0
  194. package/src/tokens/spacing.ts +58 -0
  195. package/src/tokens/text.ts +79 -0
  196. package/src/tokens/visuallyHidden.ts +13 -0
  197. package/src/types/index.d.ts +8 -0
  198. package/src/utils/assertUtils.ts +4 -0
  199. package/src/utils/cls.ts +5 -0
  200. package/src/utils/debug.ts +20 -0
  201. package/src/utils/fuzzyMatch.ts +123 -0
  202. package/src/utils/isEqualToDepth.ts +22 -0
  203. package/src/utils/mauiShikiTheme.ts +195 -0
  204. package/src/utils/memoize.ts +25 -0
  205. package/src/utils/randomId.ts +3 -0
  206. package/src/utils/shiki.ts +63 -0
  207. package/src/utils/useMemoShallowEqual.ts +13 -0
  208. package/src/utils/useRerender.ts +11 -0
  209. package/src/utils/useShortcut.tsx +111 -0
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ type DialogProps = {
3
+ children?: React.ReactNode;
4
+ onClickOutside?: () => void;
5
+ };
6
+ export declare function Dialog(props: DialogProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { animated, useSpring } from "@react-spring/web";
3
+ import { style, useStyles } from "purse-styles";
4
+ import { FocusScope } from "../hooks/useFocus";
5
+ import { border } from "../tokens/borders";
6
+ import { colors } from "../tokens/colors";
7
+ import { Overlay } from "./Overlay";
8
+ const dialogStyle = style(border([], "border"), {
9
+ flex: 1,
10
+ borderRadius: "4px",
11
+ backgroundColor: colors.gray[2],
12
+ margin: "15vh 20vw",
13
+ padding: "32px",
14
+ });
15
+ const springConfigs = {
16
+ big: {
17
+ tension: 700,
18
+ friction: 50,
19
+ // clamp: true,
20
+ },
21
+ };
22
+ export function Dialog(props) {
23
+ const className = useStyles(dialogStyle);
24
+ const dialogSprings = useSpring({
25
+ config: springConfigs.big,
26
+ from: {
27
+ transform: "scale(0.95)",
28
+ opacity: 0,
29
+ },
30
+ to: { transform: "scale(1)", opacity: 1 },
31
+ });
32
+ return (_jsx(Overlay, { onClickOutside: props.onClickOutside, children: _jsx(FocusScope, { containBehavior: "lock", autoFocus: true, children: _jsx(animated.div, { style: {
33
+ ...dialogSprings,
34
+ }, className: className, children: props.children }) }) }));
35
+ }
36
+ function AnimatedComponent(props) { }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { FuzzyMatch } from "../utils/fuzzyMatch";
3
+ export declare function FuzzyString(props: {
4
+ match: FuzzyMatch;
5
+ }): React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { colors } from "../tokens/colors";
3
+ export function FuzzyString(props) {
4
+ const { match } = props;
5
+ return (_jsx(_Fragment, { children: match.map((item, i) => {
6
+ if ("match" in item) {
7
+ return (_jsx("span", { style: { color: colors.accent[11] }, children: item.match }, i));
8
+ }
9
+ else {
10
+ return _jsx("span", { children: item.skip }, i);
11
+ }
12
+ }) }));
13
+ }
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ declare function Search(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
3
+ declare function CircleX(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
4
+ declare function Plus(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
5
+ declare function Minus(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
6
+ declare function DotsHorizontal(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
7
+ declare function ArrowDown(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
8
+ declare function Star(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
9
+ declare function Archive(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
10
+ declare function Trash(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
11
+ declare function Envelope(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
12
+ declare function Clock(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
13
+ declare function Pin(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
14
+ export declare const Icons: {
15
+ Search: typeof Search;
16
+ CircleX: typeof CircleX;
17
+ Plus: typeof Plus;
18
+ Minus: typeof Minus;
19
+ DotsHorizontal: typeof DotsHorizontal;
20
+ ArrowDown: typeof ArrowDown;
21
+ Star: typeof Star;
22
+ Archive: typeof Archive;
23
+ Trash: typeof Trash;
24
+ Envelope: typeof Envelope;
25
+ Clock: typeof Clock;
26
+ Pin: typeof Pin;
27
+ };
28
+ export {};
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { colors } from "../tokens/colors";
3
+ function Search(props) {
4
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M19.25 19.25L15.5 15.5M4.75 11C4.75 7.54822 7.54822 4.75 11 4.75C14.4518 4.75 17.25 7.54822 17.25 11C17.25 14.4518 14.4518 17.25 11 17.25C7.54822 17.25 4.75 14.4518 4.75 11Z" }) }));
5
+ }
6
+ function CircleX(props) {
7
+ return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor" }), _jsx("path", { stroke: colors.gray[3], strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 9L15 15M15 9L9 15" })] }));
8
+ }
9
+ function Plus(props) {
10
+ return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12 5.75V18.25" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M18.25 12H5.75" })] }));
11
+ }
12
+ function Minus(props) {
13
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M18.25 12.25H5.75" }) }));
14
+ }
15
+ function DotsHorizontal(props) {
16
+ return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { fill: "currentColor", d: "M13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12Z" }), _jsx("path", { fill: "currentColor", d: "M9 12C9 12.5523 8.55228 13 8 13C7.44772 13 7 12.5523 7 12C7 11.4477 7.44772 11 8 11C8.55228 11 9 11.4477 9 12Z" }), _jsx("path", { fill: "currentColor", d: "M17 12C17 12.5523 16.5523 13 16 13C15.4477 13 15 12.5523 15 12C15 11.4477 15.4477 11 16 11C16.5523 11 17 11.4477 17 12Z" })] }));
17
+ }
18
+ function ArrowDown(props) {
19
+ return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.25 13.75L12 19.25L6.75 13.75" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12 18.25V4.75" })] }));
20
+ }
21
+ function Star(props) {
22
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M12 4.75L14.16 9.13L19 9.83L15.5 13.24L16.33 18.06L12 15.78L7.67 18.06L8.5 13.24L5 9.83L9.84 9.13L12 4.75Z" }) }));
23
+ }
24
+ function Archive(props) {
25
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M5.25 8.75H18.75M7.25 8.75V18.25H16.75V8.75M6.25 5.75H17.75V8.75H6.25V5.75ZM9.75 12.25H14.25" }) }));
26
+ }
27
+ function Trash(props) {
28
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M8.75 8.75V18.25M12 8.75V18.25M15.25 8.75V18.25M5.75 6.75H18.25M9.25 6.75L10.25 4.75H13.75L14.75 6.75M7.25 6.75L7.85 19.25H16.15L16.75 6.75" }) }));
29
+ }
30
+ function Envelope(props) {
31
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M5.75 7.25H18.25V16.75H5.75V7.25ZM6.25 7.75L12 12.5L17.75 7.75" }) }));
32
+ }
33
+ function Clock(props) {
34
+ return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M19.25 12C19.25 16.0041 16.0041 19.25 12 19.25C7.99594 19.25 4.75 16.0041 4.75 12C4.75 7.99594 7.99594 4.75 12 4.75C16.0041 4.75 19.25 7.99594 19.25 12ZM12 8.25V12.25L14.75 14" }) }));
35
+ }
36
+ function Pin(props) {
37
+ return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M14.83 4.34L19.66 9.17C20.44 9.95 20.44 11.22 19.66 12L17.83 13.83L10.17 6.17L12 4.34C12.78 3.56 14.05 3.56 14.83 4.34Z" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M13.5 10.5L6 18M9.5 14.5L4.75 19.25" })] }));
38
+ }
39
+ export const Icons = {
40
+ Search,
41
+ CircleX,
42
+ Plus,
43
+ Minus,
44
+ DotsHorizontal,
45
+ ArrowDown,
46
+ Star,
47
+ Archive,
48
+ Trash,
49
+ Envelope,
50
+ Clock,
51
+ Pin,
52
+ };
@@ -0,0 +1,7 @@
1
+ import { AriaNumberFieldProps, AriaSearchFieldProps, AriaTextFieldOptions } from "react-aria";
2
+ type InputProps = AriaTextFieldOptions<"input">;
3
+ export declare function TextField(props: InputProps): import("react").JSX.Element;
4
+ export declare function SearchField(props: AriaSearchFieldProps): import("react").JSX.Element;
5
+ export declare function NumberField(props: AriaNumberFieldProps): import("react").JSX.Element;
6
+ export declare function QuietTextField(props: InputProps): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,193 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { useButton, useLocale, useNumberField, useSearchField, useTextField, } from "react-aria";
4
+ import { useNumberFieldState, useSearchFieldState } from "react-stately";
5
+ import { style, useStyles } from "purse-styles";
6
+ import { backgroundColor } from "../tokens/background";
7
+ import { colors } from "../tokens/colors";
8
+ import { focusRing } from "../tokens/focusRing";
9
+ import { motion } from "../tokens/motion";
10
+ import { radius } from "../tokens/radius";
11
+ import { shadow, shadowVars } from "../tokens/shadow";
12
+ import { spacing } from "../tokens/spacing";
13
+ import { text } from "../tokens/text";
14
+ import { Icons } from "./Icons";
15
+ const inputText = text("sm", 400, "highContrast");
16
+ const numberFieldDivider = `color-mix(in oklch, ${colors.gray[12]} 5%, ${backgroundColor.element})`;
17
+ const inputClass = style(inputText, focusRing("&:focus-visible", shadowVars.subtle), motion.standard("background", "border-color"), radius.sm, spacing.padding({ x: 4, y: 2 }), shadow.subtle, {
18
+ width: "100%",
19
+ minWidth: 0,
20
+ color: colors.gray[12],
21
+ border: "none",
22
+ background: backgroundColor.element,
23
+ "&:hover:not(:disabled)": {
24
+ background: backgroundColor.elementHover,
25
+ },
26
+ "&:disabled": {
27
+ color: colors.gray[8],
28
+ background: colors.gray[2],
29
+ },
30
+ "&[aria-invalid='true']:not(:focus-visible)": {
31
+ boxShadow: `0 0 0 1px light-dark(#ce2c31, #e5484d), ${shadowVars.subtle}`,
32
+ },
33
+ "&::placeholder": {
34
+ fontStyle: "italic",
35
+ color: colors.gray[8],
36
+ },
37
+ });
38
+ export function TextField(props) {
39
+ const ref = useRef(null);
40
+ const { inputProps } = useTextField({ ...props }, ref);
41
+ const className = useStyles(inputClass);
42
+ return _jsx("input", { className: className, ref: ref, ...inputProps });
43
+ }
44
+ const searchFieldClass = style(focusRing("& button:focus-visible"), {
45
+ position: "relative",
46
+ width: "100%",
47
+ "& input": {
48
+ paddingRight: "30px",
49
+ appearance: "none",
50
+ },
51
+ "& input::-webkit-search-cancel-button": {
52
+ appearance: "none",
53
+ },
54
+ "& button": {
55
+ position: "absolute",
56
+ top: "50%",
57
+ right: "6px",
58
+ display: "flex",
59
+ alignItems: "center",
60
+ justifyContent: "center",
61
+ width: "16px",
62
+ height: "16px",
63
+ transform: "translateY(-50%)",
64
+ zIndex: 2,
65
+ border: "none",
66
+ borderRadius: "50%",
67
+ background: "transparent",
68
+ color: colors.gray[9],
69
+ padding: 0,
70
+ },
71
+ "& button svg": {
72
+ width: "16px",
73
+ height: "16px",
74
+ },
75
+ "& button:hover": {
76
+ color: colors.gray[12],
77
+ },
78
+ });
79
+ export function SearchField(props) {
80
+ const ref = useRef(null);
81
+ const state = useSearchFieldState(props);
82
+ const { inputProps } = useSearchField(props, state, ref);
83
+ const inputClassName = useStyles(inputClass);
84
+ const searchClassName = useStyles(searchFieldClass);
85
+ return (_jsxs("div", { className: searchClassName, children: [_jsx("input", { className: inputClassName, ref: ref, ...inputProps }), state.value !== "" && (_jsx("button", { "aria-label": "Clear search", type: "button", onMouseDown: (event) => event.preventDefault(), onClick: () => state.setValue(""), children: _jsx(Icons.CircleX, {}) }))] }));
86
+ }
87
+ const numberFieldClass = style(focusRing("&:has(:focus-visible)", shadowVars.subtle), motion.standard("background", "border-color"), radius.sm, shadow.subtle, {
88
+ display: "flex",
89
+ alignItems: "center",
90
+ width: "100%",
91
+ height: "28px",
92
+ overflow: "hidden",
93
+ color: colors.gray[12],
94
+ background: backgroundColor.element,
95
+ "&:has(input:disabled)": {
96
+ color: colors.gray[8],
97
+ background: colors.gray[2],
98
+ },
99
+ "&:has(input[aria-invalid='true']):not(:has(:focus-visible))": {
100
+ boxShadow: `0 0 0 1px light-dark(#ce2c31, #e5484d), ${shadowVars.subtle}`,
101
+ },
102
+ "& .number-stepper": {
103
+ display: "flex",
104
+ alignSelf: "stretch",
105
+ },
106
+ "& button": {
107
+ display: "flex",
108
+ placeItems: "center",
109
+ justifyContent: "center",
110
+ width: "24px",
111
+ border: "none",
112
+ borderLeft: `1px solid ${numberFieldDivider}`,
113
+ background: "transparent",
114
+ color: colors.gray[11],
115
+ padding: 0,
116
+ },
117
+ "& button:first-child": {
118
+ borderRadius: 0,
119
+ },
120
+ "& button:last-child": {
121
+ borderTopRightRadius: "4px",
122
+ borderBottomRightRadius: "4px",
123
+ },
124
+ "& button svg": {
125
+ width: "14px",
126
+ height: "14px",
127
+ },
128
+ "& button:hover:not(:disabled)": {
129
+ background: backgroundColor.elementHover,
130
+ },
131
+ "& button:active:not(:disabled)": {
132
+ background: backgroundColor.elementHover,
133
+ },
134
+ "& button:disabled": {
135
+ color: colors.gray[8],
136
+ },
137
+ });
138
+ const numberInputClass = style(inputText, spacing.padding({ x: 4, y: 2 }), {
139
+ flex: "1 1 auto",
140
+ width: "100%",
141
+ minWidth: 0,
142
+ color: "inherit",
143
+ border: "none",
144
+ outline: "none",
145
+ background: "transparent",
146
+ "&:hover:not(:disabled)": {
147
+ background: backgroundColor.elementHover,
148
+ },
149
+ "&::placeholder": {
150
+ fontStyle: "italic",
151
+ color: colors.gray[8],
152
+ },
153
+ });
154
+ export function NumberField(props) {
155
+ const ref = useRef(null);
156
+ const incrementRef = useRef(null);
157
+ const decrementRef = useRef(null);
158
+ const { locale } = useLocale();
159
+ const state = useNumberFieldState({ ...props, locale });
160
+ const { inputProps, groupProps, incrementButtonProps, decrementButtonProps } = useNumberField(props, state, ref);
161
+ const { buttonProps: incrementProps } = useButton(incrementButtonProps, incrementRef);
162
+ const { buttonProps: decrementProps } = useButton(decrementButtonProps, decrementRef);
163
+ const inputClassName = useStyles(numberInputClass);
164
+ const numberClassName = useStyles(numberFieldClass);
165
+ return (_jsxs("div", { className: numberClassName, ...groupProps, children: [_jsx("input", { className: inputClassName, ref: ref, ...inputProps }), _jsxs("div", { className: "number-stepper", children: [_jsx("button", { ...decrementProps, ref: decrementRef, type: "button", children: _jsx(Icons.Minus, {}) }), _jsx("button", { ...incrementProps, ref: incrementRef, type: "button", children: _jsx(Icons.Plus, {}) })] })] }));
166
+ }
167
+ const quietInputClass = style(inputText, focusRing(), motion.standard("background", "border-color"), radius.sm, spacing.padding({ x: 4, y: 2 }), {
168
+ width: "100%",
169
+ minWidth: 0,
170
+ color: colors.gray[12],
171
+ background: "transparent",
172
+ border: "none",
173
+ "&:hover:not(:disabled)": {
174
+ background: backgroundColor.elementHover,
175
+ },
176
+ "&:disabled": {
177
+ color: colors.gray[8],
178
+ background: colors.gray[2],
179
+ },
180
+ "&[aria-invalid='true']:not(:focus-visible)": {
181
+ boxShadow: "0 0 0 1px light-dark(#ce2c31, #e5484d)",
182
+ },
183
+ "&::placeholder": {
184
+ fontStyle: "italic",
185
+ color: colors.gray[8],
186
+ },
187
+ });
188
+ export function QuietTextField(props) {
189
+ const ref = useRef(null);
190
+ const { inputProps } = useTextField({ ...props }, ref);
191
+ const className = useStyles(quietInputClass);
192
+ return _jsx("input", { className: className, ...inputProps });
193
+ }
@@ -0,0 +1,9 @@
1
+ import { type ListBoxItemProps as AriaListBoxItemProps, type ListBoxProps as AriaListBoxProps } from "react-aria-components";
2
+ export declare const listBoxStyle: import("purse-styles").StyleElement;
3
+ export declare const listBoxItemStyle: import("purse-styles").StyleElement;
4
+ export interface ListBoxProps<T> extends Omit<AriaListBoxProps<T>, "className"> {
5
+ }
6
+ export declare function ListBox<T>(props: ListBoxProps<T>): import("react").JSX.Element;
7
+ export interface ListBoxItemProps<T = object> extends Omit<AriaListBoxItemProps<T>, "className"> {
8
+ }
9
+ export declare function ListBoxItem<T extends object = object>(props: ListBoxItemProps<T>): import("react").JSX.Element;
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ListBox as AriaListBox, ListBoxItem as AriaListBoxItem, } from "react-aria-components";
3
+ import { style, useStyles } from "purse-styles";
4
+ import { background, backgroundColor } from "../tokens/background";
5
+ import { colors } from "../tokens/colors";
6
+ import { spacing } from "../tokens/spacing";
7
+ import { text } from "../tokens/text";
8
+ export const listBoxStyle = style(background.element, {
9
+ margin: 0,
10
+ padding: 0,
11
+ listStyleType: "none",
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ gap: "1px",
15
+ maxHeight: "inherit",
16
+ overflowY: "auto",
17
+ outline: "none",
18
+ });
19
+ export const listBoxItemStyle = style(spacing.padding({ x: 4, y: 2 }), text("sm", 400, "highContrast"), {
20
+ position: "relative",
21
+ margin: 0,
22
+ outline: "none",
23
+ cursor: "default",
24
+ userSelect: "none",
25
+ "&:hover": {
26
+ background: backgroundColor.elementHover,
27
+ },
28
+ "&[data-hovered]": {
29
+ background: backgroundColor.elementHover,
30
+ },
31
+ "&[data-focused]": {
32
+ background: backgroundColor.elementHover,
33
+ },
34
+ "&[data-selected]": {
35
+ color: colors.accent[9],
36
+ fontWeight: 500,
37
+ },
38
+ "&[data-selected]::after": {
39
+ content: '"✓"',
40
+ position: "absolute",
41
+ right: "8px",
42
+ color: colors.accent[9],
43
+ fontWeight: 500,
44
+ },
45
+ "&[data-disabled]": {
46
+ color: colors.gray[8],
47
+ },
48
+ });
49
+ export function ListBox(props) {
50
+ const className = useStyles(listBoxStyle);
51
+ return _jsx(AriaListBox, { ...props, className: className });
52
+ }
53
+ export function ListBoxItem(props) {
54
+ const className = useStyles(listBoxItemStyle);
55
+ const textValue = props.textValue ??
56
+ (typeof props.children === "string" ? props.children : undefined);
57
+ return _jsx(AriaListBoxItem, { ...props, textValue: textValue, className: className });
58
+ }
@@ -0,0 +1,13 @@
1
+ import { type ReactElement } from "react";
2
+ import { type MenuItemProps as AriaMenuItemProps, type MenuProps as AriaMenuProps, type MenuTriggerProps as AriaMenuTriggerProps, type PopoverProps } from "react-aria-components";
3
+ export interface MenuTriggerProps extends AriaMenuTriggerProps {
4
+ children: [ReactElement, ReactElement];
5
+ placement?: PopoverProps["placement"];
6
+ }
7
+ export declare function MenuTrigger({ children, placement, ...props }: MenuTriggerProps): import("react").JSX.Element;
8
+ export interface MenuProps<T> extends Omit<AriaMenuProps<T>, "className"> {
9
+ }
10
+ export declare function Menu<T>(props: MenuProps<T>): import("react").JSX.Element;
11
+ export interface MenuItemProps<T = object> extends Omit<AriaMenuItemProps<T>, "className"> {
12
+ }
13
+ export declare function MenuItem<T extends object = object>(props: MenuItemProps<T>): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children } from "react";
3
+ import { Menu as AriaMenu, MenuItem as AriaMenuItem, MenuTrigger as AriaMenuTrigger, } from "react-aria-components";
4
+ import { style, useStyles } from "purse-styles";
5
+ import { CollectionPopover } from "./CollectionPopover";
6
+ import { listBoxItemStyle, listBoxStyle } from "./ListBox";
7
+ const menuStyle = style(listBoxStyle, {
8
+ minWidth: "140px",
9
+ });
10
+ const menuItemStyle = style(listBoxItemStyle, {
11
+ "&[data-has-submenu]": {
12
+ paddingRight: "28px",
13
+ },
14
+ });
15
+ export function MenuTrigger({ children, placement = "bottom start", ...props }) {
16
+ const [trigger, menu] = Children.toArray(children);
17
+ return (_jsxs(AriaMenuTrigger, { ...props, children: [trigger, _jsx(CollectionPopover, { placement: placement, children: menu })] }));
18
+ }
19
+ export function Menu(props) {
20
+ const className = useStyles(menuStyle);
21
+ return _jsx(AriaMenu, { ...props, className: className });
22
+ }
23
+ export function MenuItem(props) {
24
+ const className = useStyles(menuItemStyle);
25
+ const textValue = props.textValue ??
26
+ (typeof props.children === "string" ? props.children : undefined);
27
+ return _jsx(AriaMenuItem, { ...props, textValue: textValue, className: className });
28
+ }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare function Overlay(props: {
3
+ children: React.ReactNode;
4
+ onClickOutside?: () => void;
5
+ }): React.ReactPortal;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useMemo } from "react";
3
+ import ReactDOM from "react-dom";
4
+ export function Overlay(props) {
5
+ const { onClickOutside } = props;
6
+ const overlayContainer = useMemo(() => document.createElement("div"), []);
7
+ useEffect(() => {
8
+ // Use append here so nested overlays show up in the right order
9
+ document.body.appendChild(overlayContainer);
10
+ return () => {
11
+ document.body.removeChild(overlayContainer);
12
+ };
13
+ }, [overlayContainer]);
14
+ return ReactDOM.createPortal(_jsx("div", { style: {
15
+ position: "fixed",
16
+ top: "0",
17
+ bottom: "0",
18
+ right: "0",
19
+ left: "0",
20
+ width: "100vw",
21
+ height: "100vh",
22
+ // Make sure this is above other children
23
+ zIndex: `${document.body.childElementCount}`,
24
+ }, onMouseDown: (event) => {
25
+ if (onClickOutside && event.currentTarget === event.target) {
26
+ onClickOutside();
27
+ }
28
+ event.stopPropagation();
29
+ }, children: props.children }), overlayContainer);
30
+ }
@@ -0,0 +1,4 @@
1
+ import type React from "react";
2
+ type PanelProps = React.ComponentPropsWithoutRef<"div">;
3
+ export declare function Panel({ className, children, ...props }: PanelProps): React.JSX.Element;
4
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { style, useStyles } from "purse-styles";
3
+ import { border } from "../tokens/borders";
4
+ import { colors } from "../tokens/colors";
5
+ import { radius } from "../tokens/radius";
6
+ import { spacing } from "../tokens/spacing";
7
+ const panelClass = style(spacing.padding({ all: 16 }), border([], "outline"), radius.lg, {
8
+ backgroundColor: colors.gray[1],
9
+ backgroundImage: `radial-gradient(${colors.grayAlpha[3]} 1px, transparent 1px)`,
10
+ backgroundSize: "12px 12px",
11
+ });
12
+ export function Panel({ className, children, ...props }) {
13
+ const panelClassName = useStyles(panelClass);
14
+ return (_jsx("div", { ...props, className: [panelClassName, className].filter(Boolean).join(" "), children: children }));
15
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { type ProseSize } from "../tokens/prose";
3
+ /**
4
+ * Returns the current prose size, or `null` when rendered outside a `Prose`
5
+ * container. Typography components use this to decide between prose and
6
+ * application type treatments.
7
+ */
8
+ export declare function useProseSize(): ProseSize | null;
9
+ /**
10
+ * Vertical rhythm for long-form/docs content (headings, paragraphs, and the
11
+ * demo panels between them). Typography components carry no margin of their
12
+ * own, so this is the one place spacing between them is defined - as a
13
+ * property of this container, not of the elements passing through it.
14
+ *
15
+ * `size` selects the prose type scale that descendant typography components
16
+ * inherit via context.
17
+ */
18
+ export declare function Prose(props: {
19
+ children: React.ReactNode;
20
+ size?: ProseSize;
21
+ className?: string;
22
+ style?: React.CSSProperties;
23
+ }): React.JSX.Element;
24
+ export declare const proseMaxWidth = "72ch";
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { style, useStyles } from "purse-styles";
3
+ import React from "react";
4
+ import { proseRhythm } from "../tokens/prose";
5
+ /**
6
+ * Set inside a `Prose` container so typography components can opt into the
7
+ * prose type scale at the container's size. `null` means "not in prose" -
8
+ * components fall back to their application (`text`) treatment.
9
+ */
10
+ const ProseContext = React.createContext(null);
11
+ /**
12
+ * Returns the current prose size, or `null` when rendered outside a `Prose`
13
+ * container. Typography components use this to decide between prose and
14
+ * application type treatments.
15
+ */
16
+ export function useProseSize() {
17
+ return React.useContext(ProseContext);
18
+ }
19
+ /**
20
+ * Vertical rhythm for long-form/docs content (headings, paragraphs, and the
21
+ * demo panels between them). Typography components carry no margin of their
22
+ * own, so this is the one place spacing between them is defined - as a
23
+ * property of this container, not of the elements passing through it.
24
+ *
25
+ * `size` selects the prose type scale that descendant typography components
26
+ * inherit via context.
27
+ */
28
+ export function Prose(props) {
29
+ const size = props.size ?? "md";
30
+ const proseClassName = useStyles(proseContainerClass, proseRhythm(size));
31
+ const className = props.className
32
+ ? `${proseClassName} ${props.className}`
33
+ : proseClassName;
34
+ return (_jsx(ProseContext.Provider, { value: size, children: _jsx("section", { className: className, style: props.style, children: props.children }) }));
35
+ }
36
+ // Reading measure for long-form content. Set once here on the container
37
+ // rather than on every typography component, so the constraint is a property
38
+ // of the prose column and doesn't follow those components into app UI. The
39
+ // per-size vertical rhythm lives in `proseRhythm` and is composed in above.
40
+ export const proseMaxWidth = "72ch";
41
+ const proseContainerClass = style({
42
+ maxWidth: proseMaxWidth,
43
+ });
@@ -0,0 +1,12 @@
1
+ import { AriaRadioGroupProps } from "react-aria";
2
+ type RadioOptionGroupProps = AriaRadioGroupProps & {
3
+ label: string;
4
+ children: React.ReactNode;
5
+ };
6
+ export declare function RadioOptionGroup(props: RadioOptionGroupProps): import("react").JSX.Element;
7
+ type RadioOptionProps = {
8
+ value: string;
9
+ children: React.ReactNode;
10
+ };
11
+ export declare function RadioOption(props: RadioOptionProps): import("react").JSX.Element;
12
+ export {};