@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.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/components/AppBar/AppBar.d.ts +6 -0
- package/dist/components/AppBar/AppBar.js +55 -0
- package/dist/components/AppBar/AppBar.types.d.ts +11 -0
- package/dist/components/AppBar/AppBar.types.js +0 -0
- package/dist/components/AppBar/index.d.ts +3 -0
- package/dist/components/AppBar/index.js +4 -0
- package/dist/components/Avatar/Avatar.d.ts +7 -0
- package/dist/components/Avatar/Avatar.js +30 -0
- package/dist/components/Avatar/Avatar.types.d.ts +12 -0
- package/dist/components/Avatar/Avatar.types.js +0 -0
- package/dist/components/Avatar/index.d.ts +4 -0
- package/dist/components/Avatar/index.js +4 -0
- package/dist/components/Badge/Badge.d.ts +7 -0
- package/dist/components/Badge/Badge.js +75 -0
- package/dist/components/Badge/Badge.types.d.ts +12 -0
- package/dist/components/Badge/Badge.types.js +0 -0
- package/dist/components/Badge/index.d.ts +4 -0
- package/dist/components/Badge/index.js +4 -0
- package/dist/components/Banner/Banner.d.ts +7 -0
- package/dist/components/Banner/Banner.js +68 -0
- package/dist/components/Banner/Banner.types.d.ts +13 -0
- package/dist/components/Banner/Banner.types.js +0 -0
- package/dist/components/Banner/index.d.ts +4 -0
- package/dist/components/Banner/index.js +4 -0
- package/dist/components/BottomNav/BottomNav.d.ts +7 -0
- package/dist/components/BottomNav/BottomNav.js +9 -0
- package/dist/components/BottomNav/BottomNav.types.d.ts +10 -0
- package/dist/components/BottomNav/BottomNav.types.js +0 -0
- package/dist/components/BottomNav/index.d.ts +3 -0
- package/dist/components/BottomNav/index.js +4 -0
- package/dist/components/Button/Button.d.ts +7 -0
- package/dist/components/Button/Button.js +42 -0
- package/dist/components/Button/Button.types.d.ts +17 -0
- package/dist/components/Button/Button.types.js +0 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.js +4 -0
- package/dist/components/Card/Card.d.ts +6 -0
- package/dist/components/Card/Card.js +26 -0
- package/dist/components/Card/Card.types.d.ts +10 -0
- package/dist/components/Card/Card.types.js +0 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Card/index.js +4 -0
- package/dist/components/Checkbox/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox/Checkbox.js +34 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +17 -0
- package/dist/components/Checkbox/Checkbox.types.js +0 -0
- package/dist/components/Checkbox/index.d.ts +4 -0
- package/dist/components/Checkbox/index.js +4 -0
- package/dist/components/Dialog/Dialog.d.ts +6 -0
- package/dist/components/Dialog/Dialog.js +51 -0
- package/dist/components/Dialog/Dialog.types.d.ts +12 -0
- package/dist/components/Dialog/Dialog.types.js +0 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.js +4 -0
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/Divider.js +19 -0
- package/dist/components/Divider/Divider.types.d.ts +7 -0
- package/dist/components/Divider/Divider.types.js +0 -0
- package/dist/components/Divider/index.d.ts +3 -0
- package/dist/components/Divider/index.js +4 -0
- package/dist/components/Drawer/Drawer.d.ts +8 -0
- package/dist/components/Drawer/Drawer.js +9 -0
- package/dist/components/Drawer/Drawer.types.d.ts +13 -0
- package/dist/components/Drawer/Drawer.types.js +0 -0
- package/dist/components/Drawer/index.d.ts +4 -0
- package/dist/components/Drawer/index.js +4 -0
- package/dist/components/Fab/Fab.d.ts +7 -0
- package/dist/components/Fab/Fab.js +33 -0
- package/dist/components/Fab/Fab.types.d.ts +11 -0
- package/dist/components/Fab/Fab.types.js +0 -0
- package/dist/components/Fab/index.d.ts +4 -0
- package/dist/components/Fab/index.js +4 -0
- package/dist/components/GlassAppBar/GlassAppBar.d.ts +6 -0
- package/dist/components/GlassAppBar/GlassAppBar.js +57 -0
- package/dist/components/GlassAppBar/GlassAppBar.types.d.ts +12 -0
- package/dist/components/GlassAppBar/GlassAppBar.types.js +0 -0
- package/dist/components/GlassAppBar/index.d.ts +3 -0
- package/dist/components/GlassAppBar/index.js +4 -0
- package/dist/components/Icon/Icon.d.ts +8 -0
- package/dist/components/Icon/Icon.js +46 -0
- package/dist/components/Icon/Icon.types.d.ts +14 -0
- package/dist/components/Icon/Icon.types.js +0 -0
- package/dist/components/Icon/index.d.ts +5 -0
- package/dist/components/Icon/index.js +4 -0
- package/dist/components/Input/Input.d.ts +6 -0
- package/dist/components/Input/Input.js +43 -0
- package/dist/components/Input/Input.types.d.ts +13 -0
- package/dist/components/Input/Input.types.js +0 -0
- package/dist/components/Input/index.d.ts +3 -0
- package/dist/components/Input/index.js +4 -0
- package/dist/components/Select/Select.d.ts +6 -0
- package/dist/components/Select/Select.js +50 -0
- package/dist/components/Select/Select.types.d.ts +15 -0
- package/dist/components/Select/Select.types.js +0 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/index.js +4 -0
- package/dist/components/Spinner/Spinner.d.ts +7 -0
- package/dist/components/Spinner/Spinner.js +35 -0
- package/dist/components/Spinner/Spinner.types.d.ts +9 -0
- package/dist/components/Spinner/Spinner.types.js +0 -0
- package/dist/components/Spinner/index.d.ts +4 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Surface/Surface.d.ts +6 -0
- package/dist/components/Surface/Surface.js +29 -0
- package/dist/components/Surface/Surface.types.d.ts +11 -0
- package/dist/components/Surface/Surface.types.js +0 -0
- package/dist/components/Surface/index.d.ts +3 -0
- package/dist/components/Surface/index.js +4 -0
- package/dist/components/Switch/Switch.d.ts +7 -0
- package/dist/components/Switch/Switch.js +34 -0
- package/dist/components/Switch/Switch.types.d.ts +17 -0
- package/dist/components/Switch/Switch.types.js +0 -0
- package/dist/components/Switch/index.d.ts +4 -0
- package/dist/components/Switch/index.js +4 -0
- package/dist/components/Text/Text.d.ts +7 -0
- package/dist/components/Text/Text.js +34 -0
- package/dist/components/Text/Text.types.d.ts +13 -0
- package/dist/components/Text/Text.types.js +0 -0
- package/dist/components/Text/index.d.ts +4 -0
- package/dist/components/Text/index.js +4 -0
- package/dist/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/components/Tooltip/Tooltip.js +8 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +11 -0
- package/dist/components/Tooltip/Tooltip.types.js +0 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.js +4 -0
- package/dist/components/common.d.ts +11 -0
- package/dist/components/common.js +0 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +54 -0
- package/dist/notifications/NotificationContext.d.ts +33 -0
- package/dist/notifications/NotificationContext.js +34 -0
- package/dist/notifications/NotificationHost.d.ts +5 -0
- package/dist/notifications/NotificationHost.js +22 -0
- package/dist/notifications/useNotify.d.ts +13 -0
- package/dist/notifications/useNotify.js +19 -0
- package/dist/provider/SublimeProvider.d.ts +12 -0
- package/dist/provider/SublimeProvider.js +23 -0
- package/dist/provider/TokenContext.d.ts +14 -0
- package/dist/provider/TokenContext.js +5 -0
- package/dist/provider/resolveTokens.d.ts +7 -0
- package/dist/provider/resolveTokens.js +13 -0
- package/dist/provider/useTokens.d.ts +7 -0
- package/dist/provider/useTokens.js +12 -0
- package/dist/tokens/generateThemes.d.ts +10 -0
- package/dist/tokens/generateThemes.js +44 -0
- package/dist/tokens/tokens.d.ts +74 -0
- package/dist/tokens/tokens.js +78 -0
- package/package.json +53 -0
- package/src/components/AppBar/AppBar.native.tsx +28 -0
- package/src/components/AppBar/AppBar.tsx +51 -0
- package/src/components/AppBar/AppBar.types.ts +9 -0
- package/src/components/AppBar/index.ts +2 -0
- package/src/components/Avatar/Avatar.native.tsx +38 -0
- package/src/components/Avatar/Avatar.tsx +38 -0
- package/src/components/Avatar/Avatar.types.ts +10 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Badge/Badge.native.tsx +97 -0
- package/src/components/Badge/Badge.tsx +89 -0
- package/src/components/Badge/Badge.types.ts +11 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Banner/Banner.native.tsx +89 -0
- package/src/components/Banner/Banner.tsx +78 -0
- package/src/components/Banner/Banner.types.ts +11 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/BottomNav/BottomNav.native.tsx +87 -0
- package/src/components/BottomNav/BottomNav.tsx +9 -0
- package/src/components/BottomNav/BottomNav.types.ts +8 -0
- package/src/components/BottomNav/index.ts +2 -0
- package/src/components/Button/Button.native.tsx +27 -0
- package/src/components/Button/Button.tsx +37 -0
- package/src/components/Button/Button.types.ts +17 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Card/Card.native.tsx +24 -0
- package/src/components/Card/Card.tsx +30 -0
- package/src/components/Card/Card.types.ts +8 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.native.tsx +58 -0
- package/src/components/Checkbox/Checkbox.tsx +35 -0
- package/src/components/Checkbox/Checkbox.types.ts +15 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Dialog/Dialog.native.tsx +28 -0
- package/src/components/Dialog/Dialog.tsx +49 -0
- package/src/components/Dialog/Dialog.types.ts +10 -0
- package/src/components/Dialog/index.ts +2 -0
- package/src/components/Divider/Divider.native.tsx +30 -0
- package/src/components/Divider/Divider.tsx +16 -0
- package/src/components/Divider/Divider.types.ts +5 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Drawer/Drawer.native.tsx +113 -0
- package/src/components/Drawer/Drawer.tsx +9 -0
- package/src/components/Drawer/Drawer.types.ts +11 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Fab/Fab.native.tsx +41 -0
- package/src/components/Fab/Fab.tsx +36 -0
- package/src/components/Fab/Fab.types.ts +9 -0
- package/src/components/Fab/index.ts +2 -0
- package/src/components/GlassAppBar/GlassAppBar.native.tsx +29 -0
- package/src/components/GlassAppBar/GlassAppBar.tsx +53 -0
- package/src/components/GlassAppBar/GlassAppBar.types.ts +10 -0
- package/src/components/GlassAppBar/index.ts +2 -0
- package/src/components/Icon/Icon.native.tsx +39 -0
- package/src/components/Icon/Icon.tsx +57 -0
- package/src/components/Icon/Icon.types.ts +13 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Input/Input.native.tsx +34 -0
- package/src/components/Input/Input.tsx +33 -0
- package/src/components/Input/Input.types.ts +11 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Select/Select.native.tsx +63 -0
- package/src/components/Select/Select.tsx +48 -0
- package/src/components/Select/Select.types.ts +14 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Spinner/Spinner.native.tsx +38 -0
- package/src/components/Spinner/Spinner.tsx +37 -0
- package/src/components/Spinner/Spinner.types.ts +7 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Surface/Surface.native.tsx +32 -0
- package/src/components/Surface/Surface.tsx +31 -0
- package/src/components/Surface/Surface.types.ts +10 -0
- package/src/components/Surface/index.ts +2 -0
- package/src/components/Switch/Switch.native.tsx +58 -0
- package/src/components/Switch/Switch.tsx +35 -0
- package/src/components/Switch/Switch.types.ts +15 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Text/Text.native.tsx +31 -0
- package/src/components/Text/Text.tsx +34 -0
- package/src/components/Text/Text.types.ts +12 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.native.tsx +6 -0
- package/src/components/Tooltip/Tooltip.tsx +10 -0
- package/src/components/Tooltip/Tooltip.types.ts +9 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/common.ts +10 -0
- package/src/index.ts +33 -0
- package/src/notifications/NotificationContext.tsx +57 -0
- package/src/notifications/NotificationHost.native.tsx +20 -0
- package/src/notifications/NotificationHost.tsx +27 -0
- package/src/notifications/useNotify.ts +18 -0
- package/src/provider/SublimeProvider.native.tsx +29 -0
- package/src/provider/SublimeProvider.tsx +30 -0
- package/src/provider/TokenContext.ts +13 -0
- package/src/provider/resolveTokens.ts +16 -0
- package/src/provider/useTokens.ts +10 -0
- package/src/test-utils/renderWeb.tsx +8 -0
- package/src/tokens/generateThemes.ts +49 -0
- package/src/tokens/tokens.ts +71 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox as MuiCheckbox, FormControlLabel } from "@mui/material";
|
|
3
|
+
const muiColor = (t) => t === "danger" ? "error" : t === "neutral" ? "default" : t;
|
|
4
|
+
function Checkbox({
|
|
5
|
+
checked,
|
|
6
|
+
onChange,
|
|
7
|
+
label,
|
|
8
|
+
disabled,
|
|
9
|
+
tone = "primary",
|
|
10
|
+
testID
|
|
11
|
+
}) {
|
|
12
|
+
const control = /* @__PURE__ */ jsx(
|
|
13
|
+
MuiCheckbox,
|
|
14
|
+
{
|
|
15
|
+
checked,
|
|
16
|
+
onChange: (e) => onChange(e.target.checked),
|
|
17
|
+
disabled,
|
|
18
|
+
color: muiColor(tone),
|
|
19
|
+
"data-testid": testID
|
|
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
|
+
Checkbox
|
|
34
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Tone } from '../common.js';
|
|
2
|
+
|
|
3
|
+
interface CheckboxProps {
|
|
4
|
+
/** Whether the checkbox is checked. */
|
|
5
|
+
checked: boolean;
|
|
6
|
+
/** Called with the new checked value when toggled. */
|
|
7
|
+
onChange: (checked: boolean) => void;
|
|
8
|
+
/** Optional label rendered beside the checkbox. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Disables interaction. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Color tone applied to the checked state. */
|
|
13
|
+
tone?: Tone;
|
|
14
|
+
testID?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { CheckboxProps };
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Dialog as MuiDialog,
|
|
4
|
+
DialogTitle,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogActions,
|
|
7
|
+
IconButton
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
10
|
+
function Dialog({ open, onClose, title, children, actions, testID }) {
|
|
11
|
+
const tokens = useTokens();
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
MuiDialog,
|
|
14
|
+
{
|
|
15
|
+
open,
|
|
16
|
+
onClose,
|
|
17
|
+
"data-testid": testID,
|
|
18
|
+
PaperProps: {
|
|
19
|
+
sx: {
|
|
20
|
+
backgroundColor: tokens.color.glassBg,
|
|
21
|
+
border: `1px solid ${tokens.color.glassBorder}`,
|
|
22
|
+
borderRadius: `${tokens.radii.lg}px`,
|
|
23
|
+
backgroundImage: "none"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
title ? /* @__PURE__ */ jsxs(
|
|
28
|
+
DialogTitle,
|
|
29
|
+
{
|
|
30
|
+
sx: {
|
|
31
|
+
display: "flex",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
justifyContent: "space-between",
|
|
34
|
+
fontWeight: tokens.typography.weights.semibold,
|
|
35
|
+
color: tokens.color.foreground
|
|
36
|
+
},
|
|
37
|
+
children: [
|
|
38
|
+
title,
|
|
39
|
+
/* @__PURE__ */ jsx(IconButton, { "aria-label": "close", onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ jsx("span", { className: "material-icons", "aria-hidden": true, children: "close" }) })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
) : null,
|
|
43
|
+
/* @__PURE__ */ jsx(DialogContent, { sx: { color: tokens.color.foreground }, children }),
|
|
44
|
+
actions ? /* @__PURE__ */ jsx(DialogActions, { children: actions }) : null
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
Dialog
|
|
51
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Divider as MuiDivider } from "@mui/material";
|
|
3
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
4
|
+
function Divider({ vertical, inset, testID }) {
|
|
5
|
+
const tokens = useTokens();
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
MuiDivider,
|
|
8
|
+
{
|
|
9
|
+
orientation: vertical ? "vertical" : "horizontal",
|
|
10
|
+
flexItem: vertical === true,
|
|
11
|
+
...inset ? { variant: "inset" } : {},
|
|
12
|
+
"data-testid": testID,
|
|
13
|
+
sx: { borderColor: tokens.color.divider }
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
Divider
|
|
19
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NavItem } from '../common.js';
|
|
3
|
+
|
|
4
|
+
interface DrawerProps {
|
|
5
|
+
items: NavItem[];
|
|
6
|
+
activeKey: string;
|
|
7
|
+
onSelect: (key: string) => void;
|
|
8
|
+
header?: ReactNode;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
testID?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type { DrawerProps };
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fab as MuiFab } from "@mui/material";
|
|
3
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
4
|
+
const muiColor = (t) => t === "danger" ? "error" : t === "neutral" ? "inherit" : t;
|
|
5
|
+
function Fab({ icon, onPress, tone = "primary", label, testID }) {
|
|
6
|
+
const tokens = useTokens();
|
|
7
|
+
const extended = label !== void 0;
|
|
8
|
+
return /* @__PURE__ */ jsxs(
|
|
9
|
+
MuiFab,
|
|
10
|
+
{
|
|
11
|
+
color: muiColor(tone),
|
|
12
|
+
variant: extended ? "extended" : "circular",
|
|
13
|
+
onClick: onPress,
|
|
14
|
+
"data-testid": testID,
|
|
15
|
+
sx: {
|
|
16
|
+
backgroundColor: tokens.color.surface,
|
|
17
|
+
color: tokens.color.foreground,
|
|
18
|
+
border: `1px solid ${tokens.color.surfaceBorder}`,
|
|
19
|
+
backdropFilter: "blur(12px)",
|
|
20
|
+
textTransform: "none",
|
|
21
|
+
fontWeight: tokens.typography.weights.semibold,
|
|
22
|
+
"&:hover": { backgroundColor: tokens.color.surfaceHover }
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx("span", { className: "material-icons", "aria-hidden": true, ...extended ? { style: { marginRight: tokens.spacing.sm } } : {}, children: icon }),
|
|
26
|
+
label
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
Fab
|
|
33
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AppBar as MuiAppBar, Toolbar, Typography, IconButton, Box } from "@mui/material";
|
|
3
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
4
|
+
function GlassAppBar({ title, subtitle, onBack, actions, transparent, testID }) {
|
|
5
|
+
const tokens = useTokens();
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
MuiAppBar,
|
|
8
|
+
{
|
|
9
|
+
position: "static",
|
|
10
|
+
elevation: 0,
|
|
11
|
+
"data-testid": testID,
|
|
12
|
+
sx: {
|
|
13
|
+
backgroundColor: transparent ? "transparent" : tokens.color.glassBg,
|
|
14
|
+
backdropFilter: "blur(12px)",
|
|
15
|
+
color: tokens.color.foreground,
|
|
16
|
+
borderBottom: `1px solid ${tokens.color.glassBorder}`,
|
|
17
|
+
boxShadow: "none"
|
|
18
|
+
},
|
|
19
|
+
children: /* @__PURE__ */ jsxs(Toolbar, { sx: { gap: `${tokens.spacing.sm}px` }, children: [
|
|
20
|
+
onBack ? /* @__PURE__ */ jsx(
|
|
21
|
+
IconButton,
|
|
22
|
+
{
|
|
23
|
+
edge: "start",
|
|
24
|
+
"aria-label": "back",
|
|
25
|
+
onClick: onBack,
|
|
26
|
+
sx: { color: tokens.color.foreground },
|
|
27
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2190" })
|
|
28
|
+
}
|
|
29
|
+
) : null,
|
|
30
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
Typography,
|
|
33
|
+
{
|
|
34
|
+
variant: "h6",
|
|
35
|
+
noWrap: true,
|
|
36
|
+
sx: { fontWeight: tokens.typography.weights.semibold },
|
|
37
|
+
children: title
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
subtitle ? /* @__PURE__ */ jsx(
|
|
41
|
+
Typography,
|
|
42
|
+
{
|
|
43
|
+
variant: "caption",
|
|
44
|
+
noWrap: true,
|
|
45
|
+
sx: { display: "block", color: tokens.color.mutedFg },
|
|
46
|
+
children: subtitle
|
|
47
|
+
}
|
|
48
|
+
) : null
|
|
49
|
+
] }),
|
|
50
|
+
actions ?? null
|
|
51
|
+
] })
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
GlassAppBar
|
|
57
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
3
|
+
const resolveSize = (t, size) => {
|
|
4
|
+
if (typeof size === "number") return size;
|
|
5
|
+
const key = size ?? "md";
|
|
6
|
+
return t.typography.sizes[key];
|
|
7
|
+
};
|
|
8
|
+
const resolveColor = (c, color) => {
|
|
9
|
+
if (color === void 0) return void 0;
|
|
10
|
+
if (color in c) return c[color];
|
|
11
|
+
return color;
|
|
12
|
+
};
|
|
13
|
+
function Icon({ name, node, size, color, testID }) {
|
|
14
|
+
const tokens = useTokens();
|
|
15
|
+
const px = resolveSize(tokens, size);
|
|
16
|
+
const resolved = resolveColor(tokens.color, color);
|
|
17
|
+
if (node !== void 0) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
"span",
|
|
20
|
+
{
|
|
21
|
+
"data-testid": testID,
|
|
22
|
+
style: {
|
|
23
|
+
display: "inline-flex",
|
|
24
|
+
fontSize: `${px}px`,
|
|
25
|
+
...resolved ? { color: resolved } : {}
|
|
26
|
+
},
|
|
27
|
+
children: node
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: "material-icons",
|
|
35
|
+
"data-testid": testID,
|
|
36
|
+
style: {
|
|
37
|
+
fontSize: `${px}px`,
|
|
38
|
+
...resolved ? { color: resolved } : {}
|
|
39
|
+
},
|
|
40
|
+
children: name
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
Icon
|
|
46
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Size } from '../common.js';
|
|
3
|
+
import { ColorTokens } from '../../tokens/tokens.js';
|
|
4
|
+
|
|
5
|
+
type IconColor = keyof ColorTokens | (string & {});
|
|
6
|
+
interface IconProps {
|
|
7
|
+
name: string;
|
|
8
|
+
node?: ReactNode;
|
|
9
|
+
size?: number | Size;
|
|
10
|
+
color?: IconColor;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { IconColor, IconProps };
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextField } from "@mui/material";
|
|
3
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
4
|
+
function Input({
|
|
5
|
+
value,
|
|
6
|
+
onChangeText,
|
|
7
|
+
label,
|
|
8
|
+
placeholder,
|
|
9
|
+
error,
|
|
10
|
+
disabled,
|
|
11
|
+
secureTextEntry,
|
|
12
|
+
multiline,
|
|
13
|
+
testID
|
|
14
|
+
}) {
|
|
15
|
+
const tokens = useTokens();
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
TextField,
|
|
18
|
+
{
|
|
19
|
+
value,
|
|
20
|
+
onChange: (e) => onChangeText(e.target.value),
|
|
21
|
+
...label !== void 0 ? { label } : {},
|
|
22
|
+
...placeholder !== void 0 ? { placeholder } : {},
|
|
23
|
+
...error !== void 0 ? { helperText: error } : {},
|
|
24
|
+
...testID !== void 0 ? { "data-testid": testID } : {},
|
|
25
|
+
error: !!error,
|
|
26
|
+
disabled: !!disabled,
|
|
27
|
+
type: secureTextEntry ? "password" : "text",
|
|
28
|
+
multiline: !!multiline,
|
|
29
|
+
fullWidth: true,
|
|
30
|
+
variant: "outlined",
|
|
31
|
+
size: "small",
|
|
32
|
+
sx: {
|
|
33
|
+
"& .MuiOutlinedInput-root": {
|
|
34
|
+
borderRadius: `${tokens.radii.md}px`,
|
|
35
|
+
"& fieldset": { borderColor: tokens.color.surfaceBorder }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
Input
|
|
43
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface InputProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChangeText: (text: string) => void;
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
secureTextEntry?: boolean;
|
|
9
|
+
multiline?: boolean;
|
|
10
|
+
testID?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type { InputProps };
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormControl, InputLabel, MenuItem, Select as MuiSelect } from "@mui/material";
|
|
3
|
+
import { useTokens } from "../../provider/useTokens.js";
|
|
4
|
+
function Select({
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
options,
|
|
8
|
+
label,
|
|
9
|
+
placeholder,
|
|
10
|
+
disabled,
|
|
11
|
+
testID
|
|
12
|
+
}) {
|
|
13
|
+
const tokens = useTokens();
|
|
14
|
+
const labelId = label !== void 0 ? `${label}-select-label` : void 0;
|
|
15
|
+
return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, size: "small", disabled: !!disabled, children: [
|
|
16
|
+
label !== void 0 ? /* @__PURE__ */ jsx(InputLabel, { id: labelId, children: label }) : null,
|
|
17
|
+
/* @__PURE__ */ jsxs(
|
|
18
|
+
MuiSelect,
|
|
19
|
+
{
|
|
20
|
+
...labelId !== void 0 ? { labelId } : {},
|
|
21
|
+
...label !== void 0 ? { label } : {},
|
|
22
|
+
...placeholder !== void 0 ? { displayEmpty: true } : {},
|
|
23
|
+
...testID !== void 0 ? { "data-testid": testID } : {},
|
|
24
|
+
value,
|
|
25
|
+
onChange: (e) => onChange(e.target.value),
|
|
26
|
+
MenuProps: {
|
|
27
|
+
PaperProps: {
|
|
28
|
+
sx: {
|
|
29
|
+
backgroundColor: tokens.color.glassBg,
|
|
30
|
+
border: `1px solid ${tokens.color.glassBorder}`,
|
|
31
|
+
backdropFilter: "blur(12px)",
|
|
32
|
+
borderRadius: `${tokens.radii.md}px`
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
sx: {
|
|
37
|
+
borderRadius: `${tokens.radii.md}px`,
|
|
38
|
+
"& fieldset": { borderColor: tokens.color.surfaceBorder }
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
placeholder !== void 0 ? /* @__PURE__ */ jsx(MenuItem, { value: "", disabled: true, children: placeholder }) : null,
|
|
42
|
+
options.map((opt) => /* @__PURE__ */ jsx(MenuItem, { value: opt.value, children: opt.label }, opt.value))
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
Select
|
|
50
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface SelectOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface SelectProps {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
options: SelectOption[];
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
testID?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { SelectOption, SelectProps };
|