@olympusoss/canvas 3.2.1 → 5.0.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/README.md +75 -65
- package/package.json +11 -5
- package/src/atoms/avatar/avatar.md +185 -0
- package/src/atoms/avatar/avatar.styles.ts +48 -0
- package/src/atoms/avatar/avatar.tsx +99 -0
- package/src/atoms/badge/badge.md +237 -0
- package/src/atoms/badge/badge.styles.ts +79 -0
- package/src/atoms/badge/badge.tsx +86 -0
- package/src/atoms/breadcrumb/breadcrumb.md +233 -0
- package/src/atoms/breadcrumb/breadcrumb.styles.ts +40 -0
- package/src/atoms/breadcrumb/breadcrumb.tsx +130 -0
- package/src/atoms/button/button.android.tsx +6 -0
- package/src/atoms/button/button.ios.tsx +6 -0
- package/src/atoms/button/button.md +184 -0
- package/src/atoms/button/button.shared.tsx +79 -0
- package/src/atoms/button/button.styles.ts +152 -0
- package/src/atoms/button/button.tsx +6 -0
- package/src/atoms/button-group/button-group.android.tsx +6 -0
- package/src/atoms/button-group/button-group.ios.tsx +6 -0
- package/src/atoms/button-group/button-group.md +120 -0
- package/src/atoms/button-group/button-group.shared.tsx +398 -0
- package/src/atoms/button-group/button-group.styles.ts +483 -0
- package/src/atoms/button-group/button-group.tsx +6 -0
- package/src/atoms/checkbox/checkbox.android.tsx +6 -0
- package/src/atoms/checkbox/checkbox.ios.tsx +6 -0
- package/src/atoms/checkbox/checkbox.md +150 -0
- package/src/atoms/checkbox/checkbox.shared.tsx +103 -0
- package/src/atoms/checkbox/checkbox.styles.ts +106 -0
- package/src/atoms/checkbox/checkbox.tsx +6 -0
- package/src/atoms/combobox/combobox.android.tsx +6 -0
- package/src/atoms/combobox/combobox.ios.tsx +6 -0
- package/src/atoms/combobox/combobox.md +213 -0
- package/src/atoms/combobox/combobox.shared.tsx +160 -0
- package/src/atoms/combobox/combobox.styles.ts +270 -0
- package/src/atoms/combobox/combobox.tsx +6 -0
- package/src/atoms/divider/divider.md +140 -0
- package/src/atoms/divider/divider.styles.ts +35 -0
- package/src/atoms/divider/divider.tsx +67 -0
- package/src/atoms/dropdown/dropdown.android.tsx +6 -0
- package/src/atoms/dropdown/dropdown.ios.tsx +6 -0
- package/src/atoms/dropdown/dropdown.md +221 -0
- package/src/atoms/dropdown/dropdown.shared.tsx +190 -0
- package/src/atoms/dropdown/dropdown.styles.ts +233 -0
- package/src/atoms/dropdown/dropdown.tsx +6 -0
- package/src/atoms/icon/icon.md +131 -0
- package/src/atoms/icon/icon.styles.ts +30 -0
- package/src/atoms/icon/icon.tsx +328 -0
- package/src/atoms/index.ts +24 -0
- package/src/atoms/input/input.android.tsx +6 -0
- package/src/atoms/input/input.ios.tsx +6 -0
- package/src/atoms/input/input.md +118 -0
- package/src/atoms/input/input.shared.tsx +203 -0
- package/src/atoms/input/input.styles.ts +286 -0
- package/src/atoms/input/input.tsx +6 -0
- package/src/atoms/kbd/kbd.md +91 -0
- package/src/atoms/kbd/kbd.styles.ts +33 -0
- package/src/atoms/kbd/kbd.tsx +27 -0
- package/src/atoms/listbox/listbox.md +177 -0
- package/src/atoms/listbox/listbox.styles.ts +60 -0
- package/src/atoms/listbox/listbox.tsx +113 -0
- package/src/atoms/pagination/pagination.android.tsx +6 -0
- package/src/atoms/pagination/pagination.ios.tsx +6 -0
- package/src/atoms/pagination/pagination.md +133 -0
- package/src/atoms/pagination/pagination.shared.tsx +289 -0
- package/src/atoms/pagination/pagination.styles.ts +245 -0
- package/src/atoms/pagination/pagination.tsx +6 -0
- package/src/atoms/popover/popover.android.tsx +8 -0
- package/src/atoms/popover/popover.ios.tsx +6 -0
- package/src/atoms/popover/popover.md +87 -0
- package/src/atoms/popover/popover.shared.tsx +124 -0
- package/src/atoms/popover/popover.styles.ts +144 -0
- package/src/atoms/popover/popover.tsx +6 -0
- package/src/atoms/radio/radio.android.tsx +6 -0
- package/src/atoms/radio/radio.ios.tsx +6 -0
- package/src/atoms/radio/radio.md +173 -0
- package/src/atoms/radio/radio.shared.tsx +98 -0
- package/src/atoms/radio/radio.styles.ts +109 -0
- package/src/atoms/radio/radio.tsx +6 -0
- package/src/atoms/select/select.android.tsx +6 -0
- package/src/atoms/select/select.ios.tsx +6 -0
- package/src/atoms/select/select.md +156 -0
- package/src/atoms/select/select.shared.tsx +143 -0
- package/src/atoms/select/select.styles.ts +310 -0
- package/src/atoms/select/select.tsx +6 -0
- package/src/atoms/skeleton/skeleton.md +135 -0
- package/src/atoms/skeleton/skeleton.styles.ts +117 -0
- package/src/atoms/skeleton/skeleton.tsx +145 -0
- package/src/atoms/spinner/spinner.android.tsx +7 -0
- package/src/atoms/spinner/spinner.ios.tsx +7 -0
- package/src/atoms/spinner/spinner.md +94 -0
- package/src/atoms/spinner/spinner.shared.tsx +92 -0
- package/src/atoms/spinner/spinner.styles.tsx +115 -0
- package/src/atoms/spinner/spinner.tsx +7 -0
- package/src/atoms/switch/switch.android.tsx +6 -0
- package/src/atoms/switch/switch.ios.tsx +6 -0
- package/src/atoms/switch/switch.md +91 -0
- package/src/atoms/switch/switch.shared.tsx +97 -0
- package/src/atoms/switch/switch.styles.ts +79 -0
- package/src/atoms/switch/switch.tsx +6 -0
- package/src/atoms/textarea/textarea.android.tsx +6 -0
- package/src/atoms/textarea/textarea.ios.tsx +6 -0
- package/src/atoms/textarea/textarea.md +140 -0
- package/src/atoms/textarea/textarea.shared.tsx +74 -0
- package/src/atoms/textarea/textarea.styles.ts +116 -0
- package/src/atoms/textarea/textarea.tsx +6 -0
- package/src/atoms/tooltip/tooltip.android.tsx +6 -0
- package/src/atoms/tooltip/tooltip.ios.tsx +7 -0
- package/src/atoms/tooltip/tooltip.md +122 -0
- package/src/atoms/tooltip/tooltip.shared.tsx +113 -0
- package/src/atoms/tooltip/tooltip.styles.ts +113 -0
- package/src/atoms/tooltip/tooltip.tsx +6 -0
- package/src/atoms/typography/typography.md +330 -0
- package/src/atoms/typography/typography.styles.ts +95 -0
- package/src/atoms/typography/typography.tsx +76 -0
- package/src/index.ts +12 -2
- package/src/molecules/action-panels/action-panels.md +133 -0
- package/src/molecules/action-panels/action-panels.styles.ts +39 -0
- package/src/molecules/action-panels/action-panels.tsx +113 -0
- package/src/molecules/alert/alert.md +119 -0
- package/src/molecules/alert/alert.styles.ts +88 -0
- package/src/molecules/alert/alert.tsx +74 -0
- package/src/molecules/alert-dialog/alert-dialog.android.tsx +6 -0
- package/src/molecules/alert-dialog/alert-dialog.ios.tsx +6 -0
- package/src/molecules/alert-dialog/alert-dialog.md +177 -0
- package/src/molecules/alert-dialog/alert-dialog.shared.tsx +187 -0
- package/src/molecules/alert-dialog/alert-dialog.styles.ts +248 -0
- package/src/molecules/alert-dialog/alert-dialog.tsx +6 -0
- package/src/molecules/card/card.md +190 -0
- package/src/molecules/card/card.styles.ts +67 -0
- package/src/molecules/card/card.tsx +176 -0
- package/src/molecules/code-block/code-block.md +159 -0
- package/src/molecules/code-block/code-block.styles.ts +167 -0
- package/src/molecules/code-block/code-block.tsx +176 -0
- package/src/molecules/description-lists/description-lists.md +129 -0
- package/src/molecules/description-lists/description-lists.styles.ts +102 -0
- package/src/molecules/description-lists/description-lists.tsx +133 -0
- package/src/molecules/empty-state/empty-state.md +218 -0
- package/src/molecules/empty-state/empty-state.styles.ts +63 -0
- package/src/molecules/empty-state/empty-state.tsx +77 -0
- package/src/molecules/feeds/feeds.md +102 -0
- package/src/molecules/feeds/feeds.styles.ts +120 -0
- package/src/molecules/feeds/feeds.tsx +167 -0
- package/src/molecules/field/field.md +117 -0
- package/src/molecules/field/field.styles.ts +85 -0
- package/src/molecules/field/field.tsx +175 -0
- package/src/molecules/fieldset/fieldset.md +141 -0
- package/src/molecules/fieldset/fieldset.styles.ts +79 -0
- package/src/molecules/fieldset/fieldset.tsx +182 -0
- package/src/molecules/form/form.md +137 -0
- package/src/molecules/form/form.styles.ts +39 -0
- package/src/molecules/form/form.tsx +246 -0
- package/src/molecules/grid-lists/grid-lists.md +114 -0
- package/src/molecules/grid-lists/grid-lists.styles.ts +79 -0
- package/src/molecules/grid-lists/grid-lists.tsx +157 -0
- package/src/molecules/index.ts +16 -0
- package/src/molecules/media-objects/media-objects.md +87 -0
- package/src/molecules/media-objects/media-objects.styles.ts +94 -0
- package/src/molecules/media-objects/media-objects.tsx +128 -0
- package/src/molecules/stacked-lists/stacked-lists.md +116 -0
- package/src/molecules/stacked-lists/stacked-lists.styles.ts +111 -0
- package/src/molecules/stacked-lists/stacked-lists.tsx +195 -0
- package/src/molecules/stats/stats.md +166 -0
- package/src/molecules/stats/stats.styles.ts +91 -0
- package/src/molecules/stats/stats.tsx +88 -0
- package/src/organisms/calendar/calendar.android.tsx +6 -0
- package/src/organisms/calendar/calendar.ios.tsx +6 -0
- package/src/organisms/calendar/calendar.md +114 -0
- package/src/organisms/calendar/calendar.shared.tsx +146 -0
- package/src/organisms/calendar/calendar.styles.ts +315 -0
- package/src/organisms/calendar/calendar.tsx +6 -0
- package/src/organisms/charts/charts.md +326 -0
- package/src/organisms/charts/charts.styles.ts +135 -0
- package/src/organisms/charts/charts.tsx +124 -0
- package/src/organisms/command/command.md +117 -0
- package/src/organisms/command/command.styles.ts +179 -0
- package/src/organisms/command/command.tsx +164 -0
- package/src/organisms/data-table/data-table.md +182 -0
- package/src/organisms/data-table/data-table.styles.ts +103 -0
- package/src/organisms/data-table/data-table.tsx +105 -0
- package/src/organisms/dialog/dialog.android.tsx +6 -0
- package/src/organisms/dialog/dialog.ios.tsx +6 -0
- package/src/organisms/dialog/dialog.md +271 -0
- package/src/organisms/dialog/dialog.shared.tsx +230 -0
- package/src/organisms/dialog/dialog.styles.ts +272 -0
- package/src/organisms/dialog/dialog.tsx +6 -0
- package/src/organisms/filter-panel/filter-panel.md +116 -0
- package/src/organisms/filter-panel/filter-panel.styles.ts +83 -0
- package/src/organisms/filter-panel/filter-panel.tsx +91 -0
- package/src/organisms/index.ts +13 -0
- package/src/organisms/navbars/navbars.android.tsx +6 -0
- package/src/organisms/navbars/navbars.ios.tsx +6 -0
- package/src/organisms/navbars/navbars.md +144 -0
- package/src/organisms/navbars/navbars.shared.tsx +137 -0
- package/src/organisms/navbars/navbars.styles.ts +251 -0
- package/src/organisms/navbars/navbars.tsx +6 -0
- package/src/organisms/overlays/overlays.android.tsx +6 -0
- package/src/organisms/overlays/overlays.ios.tsx +6 -0
- package/src/organisms/overlays/overlays.md +123 -0
- package/src/organisms/overlays/overlays.shared.tsx +175 -0
- package/src/organisms/overlays/overlays.styles.ts +309 -0
- package/src/organisms/overlays/overlays.tsx +6 -0
- package/src/organisms/row-menu/row-menu.android.tsx +6 -0
- package/src/organisms/row-menu/row-menu.ios.tsx +6 -0
- package/src/organisms/row-menu/row-menu.md +102 -0
- package/src/organisms/row-menu/row-menu.shared.tsx +105 -0
- package/src/organisms/row-menu/row-menu.styles.ts +262 -0
- package/src/organisms/row-menu/row-menu.tsx +6 -0
- package/src/organisms/sidebar/sidebar.android.tsx +6 -0
- package/src/organisms/sidebar/sidebar.ios.tsx +6 -0
- package/src/organisms/sidebar/sidebar.md +188 -0
- package/src/organisms/sidebar/sidebar.shared.tsx +167 -0
- package/src/organisms/sidebar/sidebar.styles.ts +262 -0
- package/src/organisms/sidebar/sidebar.tsx +6 -0
- package/src/organisms/stepper/stepper.android.tsx +6 -0
- package/src/organisms/stepper/stepper.ios.tsx +6 -0
- package/src/organisms/stepper/stepper.md +150 -0
- package/src/organisms/stepper/stepper.shared.tsx +158 -0
- package/src/organisms/stepper/stepper.styles.ts +280 -0
- package/src/organisms/stepper/stepper.tsx +6 -0
- package/src/organisms/tabs/tabs.android.tsx +6 -0
- package/src/organisms/tabs/tabs.ios.tsx +6 -0
- package/src/organisms/tabs/tabs.md +127 -0
- package/src/organisms/tabs/tabs.shared.tsx +281 -0
- package/src/organisms/tabs/tabs.styles.ts +398 -0
- package/src/organisms/tabs/tabs.tsx +6 -0
- package/src/style/color.ts +17 -0
- package/src/style/index.ts +14 -0
- package/src/style/primitives.ts +26 -0
- package/src/style/responsive.ts +45 -0
- package/src/style/shadow.ts +21 -0
- package/src/style/theme.tsx +56 -0
- package/src/style/tokens.ts +487 -0
- package/styles/canvas.css +127 -74
- package/tsconfig.json +4 -2
- package/src/cn.ts +0 -3
- package/styles/atoms/avatar.css +0 -22
- package/styles/atoms/badge.css +0 -83
- package/styles/atoms/breadcrumb.css +0 -35
- package/styles/atoms/button-group.css +0 -23
- package/styles/atoms/button.css +0 -107
- package/styles/atoms/checkbox.css +0 -55
- package/styles/atoms/combobox.css +0 -76
- package/styles/atoms/dropdown.css +0 -54
- package/styles/atoms/icon.css +0 -8
- package/styles/atoms/input-group.css +0 -45
- package/styles/atoms/input.css +0 -56
- package/styles/atoms/kbd.css +0 -15
- package/styles/atoms/pagination.css +0 -48
- package/styles/atoms/popover.css +0 -14
- package/styles/atoms/radio.css +0 -28
- package/styles/atoms/select.css +0 -57
- package/styles/atoms/separator.css +0 -32
- package/styles/atoms/skeleton.css +0 -32
- package/styles/atoms/spinner.css +0 -26
- package/styles/atoms/switch.css +0 -45
- package/styles/atoms/textarea.css +0 -31
- package/styles/atoms/tooltip.css +0 -53
- package/styles/atoms/typography.css +0 -105
- package/styles/base.css +0 -17
- package/styles/molecules/alert.css +0 -66
- package/styles/molecules/card.css +0 -58
- package/styles/molecules/code-block.css +0 -18
- package/styles/molecules/empty-state.css +0 -17
- package/styles/molecules/field.css +0 -27
- package/styles/molecules/form.css +0 -27
- package/styles/molecules/page-header.css +0 -52
- package/styles/molecules/section-card.css +0 -49
- package/styles/molecules/stat-card.css +0 -71
- package/styles/molecules/toast.css +0 -95
- package/styles/organisms/app-shell.css +0 -46
- package/styles/organisms/calendar.css +0 -73
- package/styles/organisms/command.css +0 -95
- package/styles/organisms/data-table.css +0 -142
- package/styles/organisms/dialog.css +0 -72
- package/styles/organisms/filter-panel.css +0 -58
- package/styles/organisms/row-menu.css +0 -69
- package/styles/organisms/sheet.css +0 -70
- package/styles/organisms/sidebar.css +0 -146
- package/styles/organisms/stepper.css +0 -63
- package/styles/organisms/tabs.css +0 -40
- package/styles/organisms/topbar.css +0 -24
- package/styles/patterns/backdrops.css +0 -35
- package/styles/patterns/density.css +0 -66
- package/styles/patterns/focus.css +0 -22
- package/styles/patterns/glass.css +0 -85
- package/styles/patterns/high-contrast.css +0 -70
- package/styles/patterns/reduced-motion.css +0 -12
- package/styles/patterns/scrollbar.css +0 -10
- package/styles/reset.css +0 -89
- package/styles/tokens/colors.css +0 -108
- package/styles/tokens/motion.css +0 -33
- package/styles/tokens/radius.css +0 -10
- package/styles/tokens/shadows.css +0 -35
- package/styles/tokens/spacing.css +0 -19
- package/styles/tokens/typography.css +0 -6
- package/styles/tokens/z-index.css +0 -12
- package/styles/utilities/display.css +0 -66
- package/styles/utilities/flexbox.css +0 -240
- package/styles/utilities/gap.css +0 -288
- package/styles/utilities/grid.css +0 -138
- package/styles/utilities/position.css +0 -78
- package/styles/utilities/sizing.css +0 -138
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Color helpers for building style objects from tokens.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Apply an alpha to a hex color, returning an `rgba(...)` string. Replaces the
|
|
5
|
+
* engine's `bg-primary/10`-style alpha suffix: `alpha(tokens.primary, 0.1)`.
|
|
6
|
+
* `a` is a 0..1 fraction. Non-hex inputs (already-translucent token values,
|
|
7
|
+
* "transparent") are returned unchanged so callers can pass any token safely.
|
|
8
|
+
*/
|
|
9
|
+
export function alpha(color: string, a: number): string {
|
|
10
|
+
if (color === "transparent" || color[0] !== "#") return color;
|
|
11
|
+
const h = color.replace("#", "");
|
|
12
|
+
const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
|
|
13
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
14
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
15
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
16
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The Canvas style foundation: design tokens, the theme runtime (ThemeProvider +
|
|
2
|
+
// useTheme), desktop-first responsive selection, and the small style helpers
|
|
3
|
+
// (shadow, alpha) components build their RN style objects from. Components import
|
|
4
|
+
// their primitives and helpers from here:
|
|
5
|
+
//
|
|
6
|
+
// import { View, Text, Pressable, useTheme, useResponsive, shadow, alpha,
|
|
7
|
+
// type ColorTokens } from "../../style/index.js";
|
|
8
|
+
|
|
9
|
+
export * from "./tokens.js";
|
|
10
|
+
export * from "./theme.js";
|
|
11
|
+
export * from "./responsive.js";
|
|
12
|
+
export * from "./shadow.js";
|
|
13
|
+
export * from "./color.js";
|
|
14
|
+
export * from "./primitives.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Raw React Native primitives, re-exported so components import their building
|
|
2
|
+
// blocks from one place alongside the theme/style helpers. These are RN's own
|
|
3
|
+
// View/Text/Pressable/etc. with NO className layer: components style them with
|
|
4
|
+
// plain RN style objects built from tokens. Pressable's `style` accepts the
|
|
5
|
+
// `({ pressed }) => ...` callback form for press feedback, so no wrapper is
|
|
6
|
+
// needed for the old `active:` variant.
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
View,
|
|
10
|
+
Text,
|
|
11
|
+
Pressable,
|
|
12
|
+
Image,
|
|
13
|
+
TextInput,
|
|
14
|
+
ScrollView,
|
|
15
|
+
type ViewProps,
|
|
16
|
+
type TextProps,
|
|
17
|
+
type PressableProps,
|
|
18
|
+
type PressableStateCallbackType,
|
|
19
|
+
type ImageProps,
|
|
20
|
+
type TextInputProps,
|
|
21
|
+
type ScrollViewProps,
|
|
22
|
+
type StyleProp,
|
|
23
|
+
type ViewStyle,
|
|
24
|
+
type TextStyle,
|
|
25
|
+
type ImageStyle,
|
|
26
|
+
} from "react-native";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Desktop-first responsive selection. This replaces the engine's breakpoint
|
|
2
|
+
// className variants (`sm:`/`md:`/...) with a value picker that follows the exact
|
|
3
|
+
// same semantics: the `base` value is the desktop case, and a breakpoint entry
|
|
4
|
+
// applies at that width AND BELOW, with the smallest matching breakpoint winning.
|
|
5
|
+
//
|
|
6
|
+
// A component declares the values it wants per breakpoint and reads the active
|
|
7
|
+
// one for the current viewport:
|
|
8
|
+
//
|
|
9
|
+
// const direction = useResponsive({ base: "row", sm: "column" });
|
|
10
|
+
// // <View style={{ flexDirection: direction }} />
|
|
11
|
+
//
|
|
12
|
+
// Only the breakpoints present in the map are considered, mirroring how a
|
|
13
|
+
// className like `flex-row sm:flex-col` only flips at the `sm` threshold.
|
|
14
|
+
|
|
15
|
+
import { useWindowDimensions } from "react-native";
|
|
16
|
+
import { breakpoints } from "./tokens.js";
|
|
17
|
+
|
|
18
|
+
/** The breakpoint keys, in ascending pixel order. */
|
|
19
|
+
export type BreakpointKey = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
20
|
+
|
|
21
|
+
/** A value that varies by breakpoint. `base` is the desktop default (required). */
|
|
22
|
+
export type Responsive<T> = { base: T } & Partial<Record<BreakpointKey, T>>;
|
|
23
|
+
|
|
24
|
+
// Ascending by px, so the first match when scanning is the smallest breakpoint
|
|
25
|
+
// that still covers the width, which is the one that wins (desktop-first).
|
|
26
|
+
const ASCENDING: BreakpointKey[] = ["sm", "md", "lg", "xl", "2xl"];
|
|
27
|
+
|
|
28
|
+
/** Pure picker: resolve a Responsive map to its active value at the given width. */
|
|
29
|
+
export function responsive<T>(width: number, map: Responsive<T>): T {
|
|
30
|
+
for (const bp of ASCENDING) {
|
|
31
|
+
const value = map[bp];
|
|
32
|
+
if (value !== undefined && width <= breakpoints[bp]) {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return map.base;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Hook form: resolve a Responsive map against the current viewport width. */
|
|
40
|
+
export function useResponsive<T>(map: Responsive<T>): T {
|
|
41
|
+
const { width } = useWindowDimensions();
|
|
42
|
+
return responsive(width, map);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { useWindowDimensions };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ViewStyle } from "react-native";
|
|
2
|
+
|
|
3
|
+
// Elevation presets, matching the engine's old `shadow-*` scale one-for-one, as
|
|
4
|
+
// ready-to-spread RN ViewStyle objects (iOS shadow* props + Android elevation).
|
|
5
|
+
// Spread the result into a style: `{ ...shadow("md") }`.
|
|
6
|
+
|
|
7
|
+
export type ShadowLevel = "none" | "sm" | "DEFAULT" | "md" | "lg" | "xl";
|
|
8
|
+
|
|
9
|
+
const SHADOWS: Record<ShadowLevel, ViewStyle> = {
|
|
10
|
+
none: { shadowOpacity: 0, elevation: 0 },
|
|
11
|
+
sm: { shadowColor: "#000000", shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.05, shadowRadius: 2, elevation: 1 },
|
|
12
|
+
DEFAULT: { shadowColor: "#000000", shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.1, shadowRadius: 3, elevation: 2 },
|
|
13
|
+
md: { shadowColor: "#000000", shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.1, shadowRadius: 6, elevation: 4 },
|
|
14
|
+
lg: { shadowColor: "#000000", shadowOffset: { width: 0, height: 10 }, shadowOpacity: 0.1, shadowRadius: 15, elevation: 8 },
|
|
15
|
+
xl: { shadowColor: "#000000", shadowOffset: { width: 0, height: 20 }, shadowOpacity: 0.1, shadowRadius: 25, elevation: 12 },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** The elevation preset for a level (defaults to the standard `shadow`). */
|
|
19
|
+
export function shadow(level: ShadowLevel = "DEFAULT"): ViewStyle {
|
|
20
|
+
return SHADOWS[level];
|
|
21
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// The theme runtime: a ThemeProvider that supplies the active color scheme and
|
|
2
|
+
// token map, and a useTheme hook components read to paint with scheme-aware
|
|
3
|
+
// colors. This is the one piece of shared state the raw-RN components depend on;
|
|
4
|
+
// everything else they style with plain RN objects built from these tokens.
|
|
5
|
+
|
|
6
|
+
import { type ReactNode, createContext, useContext, useMemo } from "react";
|
|
7
|
+
import { useColorScheme } from "react-native";
|
|
8
|
+
import { colorsByScheme, glassByScheme, type ColorScheme, type ColorTokens } from "./tokens.js";
|
|
9
|
+
|
|
10
|
+
// Surface treatment. "glass" makes surface fills translucent across every
|
|
11
|
+
// component (see glassByScheme). It is a theming dimension, like the color
|
|
12
|
+
// scheme, not a per-component prop.
|
|
13
|
+
export type Surface = "default" | "glass";
|
|
14
|
+
|
|
15
|
+
export interface ThemeValue {
|
|
16
|
+
scheme: ColorScheme;
|
|
17
|
+
surface: Surface;
|
|
18
|
+
tokens: ColorTokens;
|
|
19
|
+
dark: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ThemeContext = createContext<ThemeValue | null>(null);
|
|
23
|
+
const FALLBACK: ThemeValue = { scheme: "light", surface: "default", tokens: colorsByScheme.light, dark: false };
|
|
24
|
+
|
|
25
|
+
export interface ThemeProviderProps {
|
|
26
|
+
/** Force a color scheme. Omit to follow the OS appearance. */
|
|
27
|
+
scheme?: ColorScheme;
|
|
28
|
+
/**
|
|
29
|
+
* Surface treatment. "glass" makes every surface fill (card, popover)
|
|
30
|
+
* translucent, so all surface components read as glass; "default" is solid.
|
|
31
|
+
* This is the theming-level glass switch, no per-component glass prop.
|
|
32
|
+
*/
|
|
33
|
+
surface?: Surface;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function ThemeProvider({ scheme, surface = "default", children }: ThemeProviderProps) {
|
|
38
|
+
const system = useColorScheme();
|
|
39
|
+
const active: ColorScheme = scheme ?? (system === "dark" ? "dark" : "light");
|
|
40
|
+
const value = useMemo<ThemeValue>(
|
|
41
|
+
() => ({
|
|
42
|
+
scheme: active,
|
|
43
|
+
surface,
|
|
44
|
+
tokens: surface === "glass"
|
|
45
|
+
? { ...colorsByScheme[active], ...glassByScheme[active] }
|
|
46
|
+
: colorsByScheme[active],
|
|
47
|
+
dark: active === "dark",
|
|
48
|
+
}),
|
|
49
|
+
[active, surface],
|
|
50
|
+
);
|
|
51
|
+
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function useTheme(): ThemeValue {
|
|
55
|
+
return useContext(ThemeContext) ?? FALLBACK;
|
|
56
|
+
}
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
// Canvas design tokens, as plain JS values. RN-usable: no CSS variables, no
|
|
2
|
+
// document access. Light and dark color sets plus numeric scales for spacing,
|
|
3
|
+
// radius, type, and breakpoints. Components read these (via useTheme for the
|
|
4
|
+
// scheme-aware color set) and build their RN style objects from them.
|
|
5
|
+
|
|
6
|
+
export type ColorScheme = "light" | "dark";
|
|
7
|
+
|
|
8
|
+
/** Semantic color tokens. The named surface/intent colors components paint with. */
|
|
9
|
+
export interface ColorTokens {
|
|
10
|
+
background: string;
|
|
11
|
+
foreground: string;
|
|
12
|
+
card: string;
|
|
13
|
+
"card-foreground": string;
|
|
14
|
+
popover: string;
|
|
15
|
+
"popover-foreground": string;
|
|
16
|
+
primary: string;
|
|
17
|
+
"primary-foreground": string;
|
|
18
|
+
secondary: string;
|
|
19
|
+
"secondary-foreground": string;
|
|
20
|
+
muted: string;
|
|
21
|
+
"muted-foreground": string;
|
|
22
|
+
accent: string;
|
|
23
|
+
"accent-foreground": string;
|
|
24
|
+
destructive: string;
|
|
25
|
+
"destructive-foreground": string;
|
|
26
|
+
border: string;
|
|
27
|
+
input: string;
|
|
28
|
+
ring: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const lightColors: ColorTokens = {
|
|
32
|
+
background: "#ffffff",
|
|
33
|
+
foreground: "#09090b",
|
|
34
|
+
card: "#ffffff",
|
|
35
|
+
"card-foreground": "#09090b",
|
|
36
|
+
popover: "#ffffff",
|
|
37
|
+
"popover-foreground": "#09090b",
|
|
38
|
+
primary: "#4f46e5",
|
|
39
|
+
"primary-foreground": "#ffffff",
|
|
40
|
+
secondary: "#f4f4f5",
|
|
41
|
+
"secondary-foreground": "#18181b",
|
|
42
|
+
muted: "#f4f4f5",
|
|
43
|
+
"muted-foreground": "#71717a",
|
|
44
|
+
accent: "#f4f4f5",
|
|
45
|
+
"accent-foreground": "#18181b",
|
|
46
|
+
destructive: "#dc2626",
|
|
47
|
+
"destructive-foreground": "#ffffff",
|
|
48
|
+
border: "#e4e4e7",
|
|
49
|
+
input: "#e4e4e7",
|
|
50
|
+
ring: "#4f46e5",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const darkColors: ColorTokens = {
|
|
54
|
+
background: "#09090b",
|
|
55
|
+
foreground: "#fafafa",
|
|
56
|
+
card: "#18181b",
|
|
57
|
+
"card-foreground": "#fafafa",
|
|
58
|
+
popover: "#18181b",
|
|
59
|
+
"popover-foreground": "#fafafa",
|
|
60
|
+
primary: "#6366f1",
|
|
61
|
+
"primary-foreground": "#ffffff",
|
|
62
|
+
secondary: "#27272a",
|
|
63
|
+
"secondary-foreground": "#fafafa",
|
|
64
|
+
muted: "#27272a",
|
|
65
|
+
"muted-foreground": "#a1a1aa",
|
|
66
|
+
accent: "#27272a",
|
|
67
|
+
"accent-foreground": "#fafafa",
|
|
68
|
+
destructive: "#ef4444",
|
|
69
|
+
"destructive-foreground": "#fafafa",
|
|
70
|
+
border: "#27272a",
|
|
71
|
+
input: "#27272a",
|
|
72
|
+
ring: "#6366f1",
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const colorsByScheme: Record<ColorScheme, ColorTokens> = {
|
|
76
|
+
light: lightColors,
|
|
77
|
+
dark: darkColors,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Glass-surface token overrides per scheme. When the ThemeProvider's surface is
|
|
82
|
+
* "glass", these are merged over the scheme's tokens so every surface fill
|
|
83
|
+
* (card, popover) becomes translucent, and so every component that paints one
|
|
84
|
+
* reads as glass without a per-component prop. Only the fills change; the
|
|
85
|
+
* foreground and border tokens are untouched. Values are rgba so they compose
|
|
86
|
+
* over whatever sits behind the surface, on native and on react-native-web.
|
|
87
|
+
*/
|
|
88
|
+
export const glassByScheme: Record<ColorScheme, Partial<ColorTokens>> = {
|
|
89
|
+
light: {
|
|
90
|
+
card: "rgba(255, 255, 255, 0.6)",
|
|
91
|
+
popover: "rgba(255, 255, 255, 0.72)",
|
|
92
|
+
},
|
|
93
|
+
dark: {
|
|
94
|
+
card: "rgba(24, 24, 27, 0.55)",
|
|
95
|
+
popover: "rgba(30, 30, 34, 0.66)",
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** Fixed, scheme-independent base colors. */
|
|
100
|
+
export const baseColors: Record<string, string> = {
|
|
101
|
+
white: "#ffffff",
|
|
102
|
+
black: "#000000",
|
|
103
|
+
transparent: "transparent",
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The standard Tailwind v3 color-hue palette, scheme-independent. Color-coded
|
|
108
|
+
* components that need hues beyond the semantic tokens read from here. Keyed
|
|
109
|
+
* "<hue>-<step>" (e.g. "red-500"), values are the canonical Tailwind v3 hexes,
|
|
110
|
+
* lowercase.
|
|
111
|
+
*/
|
|
112
|
+
export const palette: Record<string, string> = {
|
|
113
|
+
// slate
|
|
114
|
+
"slate-50": "#f8fafc",
|
|
115
|
+
"slate-100": "#f1f5f9",
|
|
116
|
+
"slate-200": "#e2e8f0",
|
|
117
|
+
"slate-300": "#cbd5e1",
|
|
118
|
+
"slate-400": "#94a3b8",
|
|
119
|
+
"slate-500": "#64748b",
|
|
120
|
+
"slate-600": "#475569",
|
|
121
|
+
"slate-700": "#334155",
|
|
122
|
+
"slate-800": "#1e293b",
|
|
123
|
+
"slate-900": "#0f172a",
|
|
124
|
+
"slate-950": "#020617",
|
|
125
|
+
// gray
|
|
126
|
+
"gray-50": "#f9fafb",
|
|
127
|
+
"gray-100": "#f3f4f6",
|
|
128
|
+
"gray-200": "#e5e7eb",
|
|
129
|
+
"gray-300": "#d1d5db",
|
|
130
|
+
"gray-400": "#9ca3af",
|
|
131
|
+
"gray-500": "#6b7280",
|
|
132
|
+
"gray-600": "#4b5563",
|
|
133
|
+
"gray-700": "#374151",
|
|
134
|
+
"gray-800": "#1f2937",
|
|
135
|
+
"gray-900": "#111827",
|
|
136
|
+
"gray-950": "#030712",
|
|
137
|
+
// zinc
|
|
138
|
+
"zinc-50": "#fafafa",
|
|
139
|
+
"zinc-100": "#f4f4f5",
|
|
140
|
+
"zinc-200": "#e4e4e7",
|
|
141
|
+
"zinc-300": "#d4d4d8",
|
|
142
|
+
"zinc-400": "#a1a1aa",
|
|
143
|
+
"zinc-500": "#71717a",
|
|
144
|
+
"zinc-600": "#52525b",
|
|
145
|
+
"zinc-700": "#3f3f46",
|
|
146
|
+
"zinc-800": "#27272a",
|
|
147
|
+
"zinc-900": "#18181b",
|
|
148
|
+
"zinc-950": "#09090b",
|
|
149
|
+
// neutral
|
|
150
|
+
"neutral-50": "#fafafa",
|
|
151
|
+
"neutral-100": "#f5f5f5",
|
|
152
|
+
"neutral-200": "#e5e5e5",
|
|
153
|
+
"neutral-300": "#d4d4d4",
|
|
154
|
+
"neutral-400": "#a3a3a3",
|
|
155
|
+
"neutral-500": "#737373",
|
|
156
|
+
"neutral-600": "#525252",
|
|
157
|
+
"neutral-700": "#404040",
|
|
158
|
+
"neutral-800": "#262626",
|
|
159
|
+
"neutral-900": "#171717",
|
|
160
|
+
"neutral-950": "#0a0a0a",
|
|
161
|
+
// stone
|
|
162
|
+
"stone-50": "#fafaf9",
|
|
163
|
+
"stone-100": "#f5f5f4",
|
|
164
|
+
"stone-200": "#e7e5e4",
|
|
165
|
+
"stone-300": "#d6d3d1",
|
|
166
|
+
"stone-400": "#a8a29e",
|
|
167
|
+
"stone-500": "#78716c",
|
|
168
|
+
"stone-600": "#57534e",
|
|
169
|
+
"stone-700": "#44403c",
|
|
170
|
+
"stone-800": "#292524",
|
|
171
|
+
"stone-900": "#1c1917",
|
|
172
|
+
"stone-950": "#0c0a09",
|
|
173
|
+
// red
|
|
174
|
+
"red-50": "#fef2f2",
|
|
175
|
+
"red-100": "#fee2e2",
|
|
176
|
+
"red-200": "#fecaca",
|
|
177
|
+
"red-300": "#fca5a5",
|
|
178
|
+
"red-400": "#f87171",
|
|
179
|
+
"red-500": "#ef4444",
|
|
180
|
+
"red-600": "#dc2626",
|
|
181
|
+
"red-700": "#b91c1c",
|
|
182
|
+
"red-800": "#991b1b",
|
|
183
|
+
"red-900": "#7f1d1d",
|
|
184
|
+
"red-950": "#450a0a",
|
|
185
|
+
// orange
|
|
186
|
+
"orange-50": "#fff7ed",
|
|
187
|
+
"orange-100": "#ffedd5",
|
|
188
|
+
"orange-200": "#fed7aa",
|
|
189
|
+
"orange-300": "#fdba74",
|
|
190
|
+
"orange-400": "#fb923c",
|
|
191
|
+
"orange-500": "#f97316",
|
|
192
|
+
"orange-600": "#ea580c",
|
|
193
|
+
"orange-700": "#c2410c",
|
|
194
|
+
"orange-800": "#9a3412",
|
|
195
|
+
"orange-900": "#7c2d12",
|
|
196
|
+
"orange-950": "#431407",
|
|
197
|
+
// amber
|
|
198
|
+
"amber-50": "#fffbeb",
|
|
199
|
+
"amber-100": "#fef3c7",
|
|
200
|
+
"amber-200": "#fde68a",
|
|
201
|
+
"amber-300": "#fcd34d",
|
|
202
|
+
"amber-400": "#fbbf24",
|
|
203
|
+
"amber-500": "#f59e0b",
|
|
204
|
+
"amber-600": "#d97706",
|
|
205
|
+
"amber-700": "#b45309",
|
|
206
|
+
"amber-800": "#92400e",
|
|
207
|
+
"amber-900": "#78350f",
|
|
208
|
+
"amber-950": "#451a03",
|
|
209
|
+
// yellow
|
|
210
|
+
"yellow-50": "#fefce8",
|
|
211
|
+
"yellow-100": "#fef9c3",
|
|
212
|
+
"yellow-200": "#fef08a",
|
|
213
|
+
"yellow-300": "#fde047",
|
|
214
|
+
"yellow-400": "#facc15",
|
|
215
|
+
"yellow-500": "#eab308",
|
|
216
|
+
"yellow-600": "#ca8a04",
|
|
217
|
+
"yellow-700": "#a16207",
|
|
218
|
+
"yellow-800": "#854d0e",
|
|
219
|
+
"yellow-900": "#713f12",
|
|
220
|
+
"yellow-950": "#422006",
|
|
221
|
+
// lime
|
|
222
|
+
"lime-50": "#f7fee7",
|
|
223
|
+
"lime-100": "#ecfccb",
|
|
224
|
+
"lime-200": "#d9f99d",
|
|
225
|
+
"lime-300": "#bef264",
|
|
226
|
+
"lime-400": "#a3e635",
|
|
227
|
+
"lime-500": "#84cc16",
|
|
228
|
+
"lime-600": "#65a30d",
|
|
229
|
+
"lime-700": "#4d7c0f",
|
|
230
|
+
"lime-800": "#3f6212",
|
|
231
|
+
"lime-900": "#365314",
|
|
232
|
+
"lime-950": "#1a2e05",
|
|
233
|
+
// green
|
|
234
|
+
"green-50": "#f0fdf4",
|
|
235
|
+
"green-100": "#dcfce7",
|
|
236
|
+
"green-200": "#bbf7d0",
|
|
237
|
+
"green-300": "#86efac",
|
|
238
|
+
"green-400": "#4ade80",
|
|
239
|
+
"green-500": "#22c55e",
|
|
240
|
+
"green-600": "#16a34a",
|
|
241
|
+
"green-700": "#15803d",
|
|
242
|
+
"green-800": "#166534",
|
|
243
|
+
"green-900": "#14532d",
|
|
244
|
+
"green-950": "#052e16",
|
|
245
|
+
// emerald
|
|
246
|
+
"emerald-50": "#ecfdf5",
|
|
247
|
+
"emerald-100": "#d1fae5",
|
|
248
|
+
"emerald-200": "#a7f3d0",
|
|
249
|
+
"emerald-300": "#6ee7b7",
|
|
250
|
+
"emerald-400": "#34d399",
|
|
251
|
+
"emerald-500": "#10b981",
|
|
252
|
+
"emerald-600": "#059669",
|
|
253
|
+
"emerald-700": "#047857",
|
|
254
|
+
"emerald-800": "#065f46",
|
|
255
|
+
"emerald-900": "#064e3b",
|
|
256
|
+
"emerald-950": "#022c22",
|
|
257
|
+
// teal
|
|
258
|
+
"teal-50": "#f0fdfa",
|
|
259
|
+
"teal-100": "#ccfbf1",
|
|
260
|
+
"teal-200": "#99f6e4",
|
|
261
|
+
"teal-300": "#5eead4",
|
|
262
|
+
"teal-400": "#2dd4bf",
|
|
263
|
+
"teal-500": "#14b8a6",
|
|
264
|
+
"teal-600": "#0d9488",
|
|
265
|
+
"teal-700": "#0f766e",
|
|
266
|
+
"teal-800": "#115e59",
|
|
267
|
+
"teal-900": "#134e4a",
|
|
268
|
+
"teal-950": "#042f2e",
|
|
269
|
+
// cyan
|
|
270
|
+
"cyan-50": "#ecfeff",
|
|
271
|
+
"cyan-100": "#cffafe",
|
|
272
|
+
"cyan-200": "#a5f3fc",
|
|
273
|
+
"cyan-300": "#67e8f9",
|
|
274
|
+
"cyan-400": "#22d3ee",
|
|
275
|
+
"cyan-500": "#06b6d4",
|
|
276
|
+
"cyan-600": "#0891b2",
|
|
277
|
+
"cyan-700": "#0e7490",
|
|
278
|
+
"cyan-800": "#155e75",
|
|
279
|
+
"cyan-900": "#164e63",
|
|
280
|
+
"cyan-950": "#083344",
|
|
281
|
+
// sky
|
|
282
|
+
"sky-50": "#f0f9ff",
|
|
283
|
+
"sky-100": "#e0f2fe",
|
|
284
|
+
"sky-200": "#bae6fd",
|
|
285
|
+
"sky-300": "#7dd3fc",
|
|
286
|
+
"sky-400": "#38bdf8",
|
|
287
|
+
"sky-500": "#0ea5e9",
|
|
288
|
+
"sky-600": "#0284c7",
|
|
289
|
+
"sky-700": "#0369a1",
|
|
290
|
+
"sky-800": "#075985",
|
|
291
|
+
"sky-900": "#0c4a6e",
|
|
292
|
+
"sky-950": "#082f49",
|
|
293
|
+
// blue
|
|
294
|
+
"blue-50": "#eff6ff",
|
|
295
|
+
"blue-100": "#dbeafe",
|
|
296
|
+
"blue-200": "#bfdbfe",
|
|
297
|
+
"blue-300": "#93c5fd",
|
|
298
|
+
"blue-400": "#60a5fa",
|
|
299
|
+
"blue-500": "#3b82f6",
|
|
300
|
+
"blue-600": "#2563eb",
|
|
301
|
+
"blue-700": "#1d4ed8",
|
|
302
|
+
"blue-800": "#1e40af",
|
|
303
|
+
"blue-900": "#1e3a8a",
|
|
304
|
+
"blue-950": "#172554",
|
|
305
|
+
// indigo
|
|
306
|
+
"indigo-50": "#eef2ff",
|
|
307
|
+
"indigo-100": "#e0e7ff",
|
|
308
|
+
"indigo-200": "#c7d2fe",
|
|
309
|
+
"indigo-300": "#a5b4fc",
|
|
310
|
+
"indigo-400": "#818cf8",
|
|
311
|
+
"indigo-500": "#6366f1",
|
|
312
|
+
"indigo-600": "#4f46e5",
|
|
313
|
+
"indigo-700": "#4338ca",
|
|
314
|
+
"indigo-800": "#3730a3",
|
|
315
|
+
"indigo-900": "#312e81",
|
|
316
|
+
"indigo-950": "#1e1b4b",
|
|
317
|
+
// violet
|
|
318
|
+
"violet-50": "#f5f3ff",
|
|
319
|
+
"violet-100": "#ede9fe",
|
|
320
|
+
"violet-200": "#ddd6fe",
|
|
321
|
+
"violet-300": "#c4b5fd",
|
|
322
|
+
"violet-400": "#a78bfa",
|
|
323
|
+
"violet-500": "#8b5cf6",
|
|
324
|
+
"violet-600": "#7c3aed",
|
|
325
|
+
"violet-700": "#6d28d9",
|
|
326
|
+
"violet-800": "#5b21b6",
|
|
327
|
+
"violet-900": "#4c1d95",
|
|
328
|
+
"violet-950": "#2e1065",
|
|
329
|
+
// purple
|
|
330
|
+
"purple-50": "#faf5ff",
|
|
331
|
+
"purple-100": "#f3e8ff",
|
|
332
|
+
"purple-200": "#e9d5ff",
|
|
333
|
+
"purple-300": "#d8b4fe",
|
|
334
|
+
"purple-400": "#c084fc",
|
|
335
|
+
"purple-500": "#a855f7",
|
|
336
|
+
"purple-600": "#9333ea",
|
|
337
|
+
"purple-700": "#7e22ce",
|
|
338
|
+
"purple-800": "#6b21a8",
|
|
339
|
+
"purple-900": "#581c87",
|
|
340
|
+
"purple-950": "#3b0764",
|
|
341
|
+
// fuchsia
|
|
342
|
+
"fuchsia-50": "#fdf4ff",
|
|
343
|
+
"fuchsia-100": "#fae8ff",
|
|
344
|
+
"fuchsia-200": "#f5d0fe",
|
|
345
|
+
"fuchsia-300": "#f0abfc",
|
|
346
|
+
"fuchsia-400": "#e879f9",
|
|
347
|
+
"fuchsia-500": "#d946ef",
|
|
348
|
+
"fuchsia-600": "#c026d3",
|
|
349
|
+
"fuchsia-700": "#a21caf",
|
|
350
|
+
"fuchsia-800": "#86198f",
|
|
351
|
+
"fuchsia-900": "#701a75",
|
|
352
|
+
"fuchsia-950": "#4a044e",
|
|
353
|
+
// pink
|
|
354
|
+
"pink-50": "#fdf2f8",
|
|
355
|
+
"pink-100": "#fce7f3",
|
|
356
|
+
"pink-200": "#fbcfe8",
|
|
357
|
+
"pink-300": "#f9a8d4",
|
|
358
|
+
"pink-400": "#f472b6",
|
|
359
|
+
"pink-500": "#ec4899",
|
|
360
|
+
"pink-600": "#db2777",
|
|
361
|
+
"pink-700": "#be185d",
|
|
362
|
+
"pink-800": "#9d174d",
|
|
363
|
+
"pink-900": "#831843",
|
|
364
|
+
"pink-950": "#500724",
|
|
365
|
+
// rose
|
|
366
|
+
"rose-50": "#fff1f2",
|
|
367
|
+
"rose-100": "#ffe4e6",
|
|
368
|
+
"rose-200": "#fecdd3",
|
|
369
|
+
"rose-300": "#fda4af",
|
|
370
|
+
"rose-400": "#fb7185",
|
|
371
|
+
"rose-500": "#f43f5e",
|
|
372
|
+
"rose-600": "#e11d48",
|
|
373
|
+
"rose-700": "#be123c",
|
|
374
|
+
"rose-800": "#9f1239",
|
|
375
|
+
"rose-900": "#881337",
|
|
376
|
+
"rose-950": "#4c0519",
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
/** Spacing scale in px (Tailwind rem * 16). Keys are the Tailwind step names. */
|
|
380
|
+
export const spacing: Record<string, number> = {
|
|
381
|
+
"0": 0,
|
|
382
|
+
px: 1,
|
|
383
|
+
"0.5": 2,
|
|
384
|
+
"1": 4,
|
|
385
|
+
"1.5": 6,
|
|
386
|
+
"2": 8,
|
|
387
|
+
"2.5": 10,
|
|
388
|
+
"3": 12,
|
|
389
|
+
"3.5": 14,
|
|
390
|
+
"4": 16,
|
|
391
|
+
"5": 20,
|
|
392
|
+
"6": 24,
|
|
393
|
+
"7": 28,
|
|
394
|
+
"8": 32,
|
|
395
|
+
"9": 36,
|
|
396
|
+
"10": 40,
|
|
397
|
+
"11": 44,
|
|
398
|
+
"12": 48,
|
|
399
|
+
"14": 56,
|
|
400
|
+
"16": 64,
|
|
401
|
+
"20": 80,
|
|
402
|
+
"24": 96,
|
|
403
|
+
"28": 112,
|
|
404
|
+
"32": 128,
|
|
405
|
+
"36": 144,
|
|
406
|
+
"40": 160,
|
|
407
|
+
"48": 192,
|
|
408
|
+
"56": 224,
|
|
409
|
+
"64": 256,
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
/** Border radius scale in px. */
|
|
413
|
+
export const radius: Record<string, number> = {
|
|
414
|
+
none: 0,
|
|
415
|
+
sm: 2,
|
|
416
|
+
DEFAULT: 4,
|
|
417
|
+
md: 6,
|
|
418
|
+
lg: 8,
|
|
419
|
+
xl: 12,
|
|
420
|
+
"2xl": 16,
|
|
421
|
+
"3xl": 24,
|
|
422
|
+
full: 9999,
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
/** Font size and matching line height, in px. */
|
|
426
|
+
export const fontSize: Record<string, { fontSize: number; lineHeight: number }> = {
|
|
427
|
+
xs: { fontSize: 12, lineHeight: 16 },
|
|
428
|
+
sm: { fontSize: 14, lineHeight: 20 },
|
|
429
|
+
base: { fontSize: 16, lineHeight: 24 },
|
|
430
|
+
lg: { fontSize: 18, lineHeight: 28 },
|
|
431
|
+
xl: { fontSize: 20, lineHeight: 28 },
|
|
432
|
+
"2xl": { fontSize: 24, lineHeight: 32 },
|
|
433
|
+
"3xl": { fontSize: 30, lineHeight: 36 },
|
|
434
|
+
"4xl": { fontSize: 36, lineHeight: 40 },
|
|
435
|
+
"5xl": { fontSize: 48, lineHeight: 48 },
|
|
436
|
+
"6xl": { fontSize: 60, lineHeight: 60 },
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
/** Font weights (RN expects string values). */
|
|
440
|
+
export const fontWeight: Record<string, string> = {
|
|
441
|
+
thin: "100",
|
|
442
|
+
extralight: "200",
|
|
443
|
+
light: "300",
|
|
444
|
+
normal: "400",
|
|
445
|
+
medium: "500",
|
|
446
|
+
semibold: "600",
|
|
447
|
+
bold: "700",
|
|
448
|
+
extrabold: "800",
|
|
449
|
+
black: "900",
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
/** Letter spacing (tracking) in px. */
|
|
453
|
+
export const letterSpacing: Record<string, number> = {
|
|
454
|
+
tighter: -0.8,
|
|
455
|
+
tight: -0.4,
|
|
456
|
+
normal: 0,
|
|
457
|
+
wide: 0.4,
|
|
458
|
+
wider: 0.8,
|
|
459
|
+
widest: 1.6,
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/** Line height (leading) in px. Relative leadings are approximated as absolute. */
|
|
463
|
+
export const lineHeight: Record<string, number> = {
|
|
464
|
+
none: 16,
|
|
465
|
+
tight: 18,
|
|
466
|
+
snug: 20,
|
|
467
|
+
normal: 24,
|
|
468
|
+
relaxed: 28,
|
|
469
|
+
loose: 32,
|
|
470
|
+
"3": 12,
|
|
471
|
+
"4": 16,
|
|
472
|
+
"5": 20,
|
|
473
|
+
"6": 24,
|
|
474
|
+
"7": 28,
|
|
475
|
+
"8": 32,
|
|
476
|
+
"9": 36,
|
|
477
|
+
"10": 40,
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/** Desktop-first breakpoints in px: a variant applies at this width and below. */
|
|
481
|
+
export const breakpoints: Record<string, number> = {
|
|
482
|
+
sm: 640,
|
|
483
|
+
md: 768,
|
|
484
|
+
lg: 1024,
|
|
485
|
+
xl: 1280,
|
|
486
|
+
"2xl": 1536,
|
|
487
|
+
};
|