@lunar-js/lunar 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.
- package/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/components/composite/Card/Card.d.ts +64 -0
- package/dist/components/composite/Card/Card.d.ts.map +1 -0
- package/dist/components/composite/Card/Card.js +86 -0
- package/dist/components/composite/Card/Card.js.map +1 -0
- package/dist/components/composite/Card/card.css.js +62 -0
- package/dist/components/composite/Card/card.css.js.map +1 -0
- package/dist/components/composite/Dialog/Dialog.d.ts +45 -0
- package/dist/components/composite/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/composite/Dialog/Dialog.js +117 -0
- package/dist/components/composite/Dialog/Dialog.js.map +1 -0
- package/dist/components/composite/Dialog/DialogProvider.d.ts +11 -0
- package/dist/components/composite/Dialog/DialogProvider.d.ts.map +1 -0
- package/dist/components/composite/Dialog/DialogProvider.js +19 -0
- package/dist/components/composite/Dialog/DialogProvider.js.map +1 -0
- package/dist/components/composite/Dialog/dialog.css.js +104 -0
- package/dist/components/composite/Dialog/dialog.css.js.map +1 -0
- package/dist/components/primitives/Button/Button.d.ts +27 -0
- package/dist/components/primitives/Button/Button.d.ts.map +1 -0
- package/dist/components/primitives/Button/Button.js +25 -0
- package/dist/components/primitives/Button/Button.js.map +1 -0
- package/dist/components/primitives/Button/button.css.d.ts +16 -0
- package/dist/components/primitives/Button/button.css.d.ts.map +1 -0
- package/dist/components/primitives/Button/button.css.js +202 -0
- package/dist/components/primitives/Button/button.css.js.map +1 -0
- package/dist/components/primitives/Button/button.types.d.ts +8 -0
- package/dist/components/primitives/Button/button.types.d.ts.map +1 -0
- package/dist/components/primitives/Input/Input.d.ts +12 -0
- package/dist/components/primitives/Input/Input.d.ts.map +1 -0
- package/dist/components/primitives/Input/Input.js +21 -0
- package/dist/components/primitives/Input/Input.js.map +1 -0
- package/dist/components/primitives/Input/input.css.js +54 -0
- package/dist/components/primitives/Input/input.css.js.map +1 -0
- package/dist/components/primitives/Label/Label.d.ts +13 -0
- package/dist/components/primitives/Label/Label.d.ts.map +1 -0
- package/dist/components/primitives/Label/Label.js +22 -0
- package/dist/components/primitives/Label/Label.js.map +1 -0
- package/dist/components/primitives/Label/label.css.js +35 -0
- package/dist/components/primitives/Label/label.css.js.map +1 -0
- package/dist/components/primitives/Typography/Text.d.ts +40 -0
- package/dist/components/primitives/Typography/Text.d.ts.map +1 -0
- package/dist/components/primitives/Typography/Text.js +28 -0
- package/dist/components/primitives/Typography/Text.js.map +1 -0
- package/dist/components/primitives/Typography/text.css.d.ts +31 -0
- package/dist/components/primitives/Typography/text.css.d.ts.map +1 -0
- package/dist/components/primitives/Typography/text.css.js +1019 -0
- package/dist/components/primitives/Typography/text.css.js.map +1 -0
- package/dist/components/primitives/Typography/text.types.d.ts +10 -0
- package/dist/components/primitives/Typography/text.types.d.ts.map +1 -0
- package/dist/constants/theming.d.ts +10 -0
- package/dist/constants/theming.d.ts.map +1 -0
- package/dist/constants/theming.js +11 -0
- package/dist/constants/theming.js.map +1 -0
- package/dist/hooks/dialog.d.ts +7 -0
- package/dist/hooks/dialog.d.ts.map +1 -0
- package/dist/hooks/dialog.js +14 -0
- package/dist/hooks/dialog.js.map +1 -0
- package/dist/hooks/refs.js +23 -0
- package/dist/hooks/refs.js.map +1 -0
- package/dist/hooks/theme.d.ts +7 -0
- package/dist/hooks/theme.d.ts.map +1 -0
- package/dist/hooks/theme.js +14 -0
- package/dist/hooks/theme.js.map +1 -0
- package/dist/hooks/utils.js +6 -0
- package/dist/hooks/utils.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/styles.css.d.ts +4 -0
- package/dist/styles.css.js +5 -0
- package/dist/themes/ThemeProvider/ThemeProvider.d.ts +19 -0
- package/dist/themes/ThemeProvider/ThemeProvider.d.ts.map +1 -0
- package/dist/themes/ThemeProvider/ThemeProvider.js +25 -0
- package/dist/themes/ThemeProvider/ThemeProvider.js.map +1 -0
- package/dist/themes/regal.css.d.ts +5 -0
- package/dist/themes/regal.css.d.ts.map +1 -0
- package/dist/themes/regal.css.js +720 -0
- package/dist/themes/regal.css.js.map +1 -0
- package/dist/themes/styles/color-scheme.css.d.ts +6 -0
- package/dist/themes/styles/color-scheme.css.d.ts.map +1 -0
- package/dist/themes/styles/color-scheme.css.js +9 -0
- package/dist/themes/styles/color-scheme.css.js.map +1 -0
- package/dist/themes/styles/utilities.d.ts +125 -0
- package/dist/themes/styles/utilities.d.ts.map +1 -0
- package/dist/themes/styles/utilities.js +129 -0
- package/dist/themes/styles/utilities.js.map +1 -0
- package/dist/themes/tokens/primitives/borders.d.ts +22 -0
- package/dist/themes/tokens/primitives/borders.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/borders.js +23 -0
- package/dist/themes/tokens/primitives/borders.js.map +1 -0
- package/dist/themes/tokens/primitives/colors.d.ts +100 -0
- package/dist/themes/tokens/primitives/colors.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/colors.js +101 -0
- package/dist/themes/tokens/primitives/colors.js.map +1 -0
- package/dist/themes/tokens/primitives/shadows.d.ts +14 -0
- package/dist/themes/tokens/primitives/shadows.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/shadows.js +15 -0
- package/dist/themes/tokens/primitives/shadows.js.map +1 -0
- package/dist/themes/tokens/primitives/spacing.d.ts +41 -0
- package/dist/themes/tokens/primitives/spacing.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/spacing.js +42 -0
- package/dist/themes/tokens/primitives/spacing.js.map +1 -0
- package/dist/themes/tokens/primitives/typography.d.ts +105 -0
- package/dist/themes/tokens/primitives/typography.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/typography.js +106 -0
- package/dist/themes/tokens/primitives/typography.js.map +1 -0
- package/dist/themes/tokens/semantic/borders.js +23 -0
- package/dist/themes/tokens/semantic/borders.js.map +1 -0
- package/dist/themes/tokens/semantic/colors.js +145 -0
- package/dist/themes/tokens/semantic/colors.js.map +1 -0
- package/dist/themes/tokens/semantic/shadows.js +15 -0
- package/dist/themes/tokens/semantic/shadows.js.map +1 -0
- package/dist/themes/tokens/semantic/spacing.js +70 -0
- package/dist/themes/tokens/semantic/spacing.js.map +1 -0
- package/dist/themes/tokens/semantic/typography.js +34 -0
- package/dist/themes/tokens/semantic/typography.js.map +1 -0
- package/dist/themes/tokens/tokens.css.d.ts +714 -0
- package/dist/themes/tokens/tokens.css.d.ts.map +1 -0
- package/dist/themes/tokens/tokens.css.js +36 -0
- package/dist/themes/tokens/tokens.css.js.map +1 -0
- package/dist/types/theming.d.ts +7 -0
- package/dist/types/theming.d.ts.map +1 -0
- package/package.json +80 -0
- package/src/components/composite/Card/Card.tsx +62 -0
- package/src/components/composite/Card/card.css.ts +79 -0
- package/src/components/composite/Dialog/Dialog.tsx +150 -0
- package/src/components/composite/Dialog/DialogProvider.tsx +21 -0
- package/src/components/composite/Dialog/dialog.css.ts +137 -0
- package/src/components/primitives/Button/Button.tsx +35 -0
- package/src/components/primitives/Button/button.css.ts +236 -0
- package/src/components/primitives/Button/button.types.ts +23 -0
- package/src/components/primitives/Input/Input.tsx +13 -0
- package/src/components/primitives/Input/input.css.ts +64 -0
- package/src/components/primitives/Label/Label.tsx +15 -0
- package/src/components/primitives/Label/label.css.ts +39 -0
- package/src/components/primitives/Typography/Text.tsx +55 -0
- package/src/components/primitives/Typography/text.css.ts +1091 -0
- package/src/components/primitives/Typography/text.types.ts +55 -0
- package/src/constants/theming.ts +16 -0
- package/src/hooks/dialog.ts +15 -0
- package/src/hooks/refs.ts +34 -0
- package/src/hooks/theme.ts +15 -0
- package/src/hooks/utils.ts +3 -0
- package/src/index.css.ts +26 -0
- package/src/index.ts +111 -0
- package/src/themes/ThemeProvider/ThemeProvider.tsx +39 -0
- package/src/themes/regal.css.ts +741 -0
- package/src/themes/styles/color-scheme.css.ts +11 -0
- package/src/themes/styles/utilities.ts +140 -0
- package/src/themes/tokens/primitives/borders.ts +21 -0
- package/src/themes/tokens/primitives/colors.ts +114 -0
- package/src/themes/tokens/primitives/shadows.ts +12 -0
- package/src/themes/tokens/primitives/spacing.ts +39 -0
- package/src/themes/tokens/primitives/typography.ts +125 -0
- package/src/themes/tokens/semantic/borders.ts +21 -0
- package/src/themes/tokens/semantic/colors.ts +166 -0
- package/src/themes/tokens/semantic/shadows.ts +12 -0
- package/src/themes/tokens/semantic/spacing.ts +75 -0
- package/src/themes/tokens/semantic/typography.ts +35 -0
- package/src/themes/tokens/tokens.css.ts +42 -0
- package/src/types/theming.ts +14 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
TEXT_COLOR__ACCENT,
|
|
3
|
+
TEXT_COLOR__BRAND,
|
|
4
|
+
TEXT_COLOR__DANGER,
|
|
5
|
+
TEXT_COLOR__DISABLED,
|
|
6
|
+
TEXT_COLOR__INFO,
|
|
7
|
+
TEXT_COLOR__INTERACTIVE,
|
|
8
|
+
TEXT_COLOR__INVERSE,
|
|
9
|
+
TEXT_COLOR__MUTED,
|
|
10
|
+
TEXT_COLOR__PRIMARY,
|
|
11
|
+
TEXT_COLOR__SECONDARY,
|
|
12
|
+
TEXT_COLOR__SUCCESS,
|
|
13
|
+
TEXT_COLOR__WARNING,
|
|
14
|
+
TEXT_SIZE__LG,
|
|
15
|
+
TEXT_SIZE__MD,
|
|
16
|
+
TEXT_SIZE__SM,
|
|
17
|
+
TEXT_SIZE__XL,
|
|
18
|
+
TEXT_VARIANT__BODY,
|
|
19
|
+
TEXT_VARIANT__CAPTION,
|
|
20
|
+
TEXT_VARIANT__DISPLAY,
|
|
21
|
+
TEXT_VARIANT__HEADING,
|
|
22
|
+
TEXT_VARIANT__LABEL,
|
|
23
|
+
TEXT_VARIANT__SUBHEADING,
|
|
24
|
+
TEXT_WEIGHT__BOLD,
|
|
25
|
+
TEXT_WEIGHT__LIGHT,
|
|
26
|
+
TEXT_WEIGHT__MEDIUM,
|
|
27
|
+
} from './text.css.js';
|
|
28
|
+
|
|
29
|
+
type TextType =
|
|
30
|
+
| typeof TEXT_VARIANT__DISPLAY
|
|
31
|
+
| typeof TEXT_VARIANT__HEADING
|
|
32
|
+
| typeof TEXT_VARIANT__SUBHEADING
|
|
33
|
+
| typeof TEXT_VARIANT__BODY
|
|
34
|
+
| typeof TEXT_VARIANT__CAPTION
|
|
35
|
+
| typeof TEXT_VARIANT__LABEL;
|
|
36
|
+
|
|
37
|
+
type TextSize = typeof TEXT_SIZE__XL | typeof TEXT_SIZE__LG | typeof TEXT_SIZE__MD | typeof TEXT_SIZE__SM;
|
|
38
|
+
|
|
39
|
+
type TextWeight = typeof TEXT_WEIGHT__LIGHT | typeof TEXT_WEIGHT__MEDIUM | typeof TEXT_WEIGHT__BOLD;
|
|
40
|
+
|
|
41
|
+
type TextColor =
|
|
42
|
+
| typeof TEXT_COLOR__PRIMARY
|
|
43
|
+
| typeof TEXT_COLOR__SECONDARY
|
|
44
|
+
| typeof TEXT_COLOR__MUTED
|
|
45
|
+
| typeof TEXT_COLOR__DISABLED
|
|
46
|
+
| typeof TEXT_COLOR__INVERSE
|
|
47
|
+
| typeof TEXT_COLOR__INTERACTIVE
|
|
48
|
+
| typeof TEXT_COLOR__SUCCESS
|
|
49
|
+
| typeof TEXT_COLOR__WARNING
|
|
50
|
+
| typeof TEXT_COLOR__DANGER
|
|
51
|
+
| typeof TEXT_COLOR__INFO
|
|
52
|
+
| typeof TEXT_COLOR__BRAND
|
|
53
|
+
| typeof TEXT_COLOR__ACCENT;
|
|
54
|
+
|
|
55
|
+
export type { TextType, TextSize, TextWeight, TextColor };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const COLOR_SCHEME__SYSTEM = 'system';
|
|
2
|
+
const COLOR_SCHEME__LIGHT = 'light';
|
|
3
|
+
const COLOR_SCHEME__DARK = 'dark';
|
|
4
|
+
|
|
5
|
+
const BREAKPOINT__SM = '40rem';
|
|
6
|
+
const BREAKPOINT__MD = '48rem';
|
|
7
|
+
const BREAKPOINT__LG = '64rem';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
COLOR_SCHEME__LIGHT,
|
|
11
|
+
COLOR_SCHEME__SYSTEM,
|
|
12
|
+
COLOR_SCHEME__DARK,
|
|
13
|
+
BREAKPOINT__SM,
|
|
14
|
+
BREAKPOINT__MD,
|
|
15
|
+
BREAKPOINT__LG,
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { use } from 'react';
|
|
2
|
+
|
|
3
|
+
import { DialogContext } from '../components/composite/Dialog/DialogProvider.js';
|
|
4
|
+
import { createUnitializedProviderError } from './utils.js';
|
|
5
|
+
|
|
6
|
+
const useDialog = () => {
|
|
7
|
+
const dialogContext = use(DialogContext);
|
|
8
|
+
if (!dialogContext) {
|
|
9
|
+
throw createUnitializedProviderError('DialogProvider');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return dialogContext;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useDialog };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback, type RefCallback, type RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Merges an internal ref with a forwarded ref, handling both callback and object refs.
|
|
5
|
+
* This is useful for components that need their own internal ref while also allowing
|
|
6
|
+
* consumers to pass their own ref.
|
|
7
|
+
*
|
|
8
|
+
* @param internalRef - The component's internal ref object
|
|
9
|
+
* @param forwardedRef - The ref passed by the consumer (can be callback or object ref)
|
|
10
|
+
* @returns A callback ref that updates both internal and forwarded refs
|
|
11
|
+
*/
|
|
12
|
+
const useMergedRef = <T>(
|
|
13
|
+
internalRef: RefObject<T | null>,
|
|
14
|
+
forwardedRef?: RefCallback<T | null> | RefObject<T | null> | null
|
|
15
|
+
): RefCallback<T | null> => {
|
|
16
|
+
return useCallback(
|
|
17
|
+
(node: T | null) => {
|
|
18
|
+
internalRef.current = node;
|
|
19
|
+
|
|
20
|
+
if (forwardedRef) {
|
|
21
|
+
if (typeof forwardedRef === 'function') {
|
|
22
|
+
// Handle callback ref
|
|
23
|
+
forwardedRef(node);
|
|
24
|
+
} else {
|
|
25
|
+
// Handle ref object
|
|
26
|
+
forwardedRef.current = node;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
[internalRef, forwardedRef]
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { useMergedRef };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { use } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ThemeContext } from '../themes/ThemeProvider/ThemeProvider.js';
|
|
4
|
+
import { createUnitializedProviderError } from './utils.js';
|
|
5
|
+
|
|
6
|
+
const useTheme = () => {
|
|
7
|
+
const themeContext = use(ThemeContext);
|
|
8
|
+
if (!themeContext) {
|
|
9
|
+
throw createUnitializedProviderError('ThemeProvider');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return themeContext;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useTheme };
|
package/src/index.css.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Styling Index
|
|
3
|
+
*
|
|
4
|
+
* This index file exports CSS-in-JS objects, theme definitions, and styling
|
|
5
|
+
* utilities for use with Vanilla Extract and other CSS-in-JS systems.
|
|
6
|
+
* Consumed via the "./styles.css" package export.
|
|
7
|
+
*
|
|
8
|
+
* Should export:
|
|
9
|
+
* - Theme objects and configurations (regalTheme, themeContract)
|
|
10
|
+
* - Vanilla Extract style recipes and variants
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Theming Exports
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export { themeContract } from './themes/tokens/tokens.css.js';
|
|
19
|
+
|
|
20
|
+
export { regalTheme } from './themes/regal.css.js';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Styling Exports
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export { darkColorScheme, lightColorScheme } from './themes/styles/color-scheme.css.js';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Package Index
|
|
3
|
+
*
|
|
4
|
+
* This is the primary entry point for the Lunar design system package.
|
|
5
|
+
* Exports all React components, TypeScript types, and JavaScript utilities
|
|
6
|
+
* that consumers need at runtime.
|
|
7
|
+
*
|
|
8
|
+
* Should export:
|
|
9
|
+
* - React components (Button, Text, Card, etc.)
|
|
10
|
+
* - Component prop types
|
|
11
|
+
* - Runtime utilities and helper functions
|
|
12
|
+
* - ThemeProvider and theme-related React functionality
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Component Exports
|
|
18
|
+
*/
|
|
19
|
+
export { default as ThemeProvider } from './themes/ThemeProvider/ThemeProvider.js';
|
|
20
|
+
export { useTheme } from './hooks/theme.js';
|
|
21
|
+
|
|
22
|
+
export { default as Button, type ButtonProps } from './components/primitives/Button/Button.js';
|
|
23
|
+
export {
|
|
24
|
+
BUTTON_VARIANT__PRIMARY,
|
|
25
|
+
BUTTON_VARIANT__SECONDARY,
|
|
26
|
+
BUTTON_VARIANT__OUTLINE,
|
|
27
|
+
BUTTON_VARIANT__DESTRUCTIVE,
|
|
28
|
+
BUTTON_VARIANT__GHOST,
|
|
29
|
+
BUTTON_VARIANT__LINK,
|
|
30
|
+
BUTTON_SIZE__LARGE,
|
|
31
|
+
BUTTON_SIZE__MEDIUM,
|
|
32
|
+
BUTTON_SIZE__SMALL,
|
|
33
|
+
} from './components/primitives/Button/button.css.js';
|
|
34
|
+
export { default as Input } from './components/primitives/Input/Input.js';
|
|
35
|
+
export { default as Label } from './components/primitives/Label/Label.js';
|
|
36
|
+
export { default as Text, type TextProps } from './components/primitives/Typography/Text.js';
|
|
37
|
+
export {
|
|
38
|
+
Card,
|
|
39
|
+
CardHeader,
|
|
40
|
+
CardFooter,
|
|
41
|
+
CardTitle,
|
|
42
|
+
CardAction,
|
|
43
|
+
CardDescription,
|
|
44
|
+
CardContent,
|
|
45
|
+
} from './components/composite/Card/Card.js';
|
|
46
|
+
export {
|
|
47
|
+
TEXT_VARIANT__DISPLAY,
|
|
48
|
+
TEXT_VARIANT__HEADING,
|
|
49
|
+
TEXT_VARIANT__SUBHEADING,
|
|
50
|
+
TEXT_VARIANT__BODY,
|
|
51
|
+
TEXT_VARIANT__CAPTION,
|
|
52
|
+
TEXT_VARIANT__LABEL,
|
|
53
|
+
TEXT_SIZE__XL,
|
|
54
|
+
TEXT_SIZE__LG,
|
|
55
|
+
TEXT_SIZE__MD,
|
|
56
|
+
TEXT_SIZE__SM,
|
|
57
|
+
TEXT_COLOR__PRIMARY,
|
|
58
|
+
TEXT_COLOR__SECONDARY,
|
|
59
|
+
TEXT_COLOR__MUTED,
|
|
60
|
+
TEXT_COLOR__DISABLED,
|
|
61
|
+
TEXT_COLOR__INVERSE,
|
|
62
|
+
TEXT_COLOR__INTERACTIVE,
|
|
63
|
+
TEXT_COLOR__SUCCESS,
|
|
64
|
+
TEXT_COLOR__WARNING,
|
|
65
|
+
TEXT_COLOR__DANGER,
|
|
66
|
+
TEXT_COLOR__INFO,
|
|
67
|
+
TEXT_COLOR__BRAND,
|
|
68
|
+
TEXT_COLOR__ACCENT,
|
|
69
|
+
TEXT_WEIGHT__LIGHT,
|
|
70
|
+
TEXT_WEIGHT__MEDIUM,
|
|
71
|
+
TEXT_WEIGHT__BOLD,
|
|
72
|
+
} from './components/primitives/Typography/text.css.js';
|
|
73
|
+
export {
|
|
74
|
+
Dialog,
|
|
75
|
+
DialogTrigger,
|
|
76
|
+
DialogClose,
|
|
77
|
+
DialogContent,
|
|
78
|
+
DialogHeader,
|
|
79
|
+
DialogFooter,
|
|
80
|
+
} from './components/composite/Dialog/Dialog.js';
|
|
81
|
+
export { useDialog } from './hooks/dialog.js';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Styling Utility Exports
|
|
85
|
+
*/
|
|
86
|
+
export { withCustomOutline, withSafeTransition, withBreakpoint } from './themes/styles/utilities.js';
|
|
87
|
+
|
|
88
|
+
export { BREAKPOINT__SM, BREAKPOINT__MD, BREAKPOINT__LG } from './constants/theming.js';
|
|
89
|
+
export {
|
|
90
|
+
COLORS__PURE,
|
|
91
|
+
COLORS__STONE,
|
|
92
|
+
COLORS__RED,
|
|
93
|
+
COLORS__GREEN,
|
|
94
|
+
COLORS__GOLD,
|
|
95
|
+
COLORS__PEARL,
|
|
96
|
+
COLORS__YELLOW,
|
|
97
|
+
COLORS__BLUE,
|
|
98
|
+
} from './themes/tokens/primitives/colors.js';
|
|
99
|
+
export { SPACING } from './themes/tokens/primitives/spacing.js';
|
|
100
|
+
export { BORDER_RADIUS, BORDER_WIDTH } from './themes/tokens/primitives/borders.js';
|
|
101
|
+
export { BOX_SHADOW } from './themes/tokens/primitives/shadows.js';
|
|
102
|
+
export {
|
|
103
|
+
FONT_FAMILY,
|
|
104
|
+
FONT_SIZE,
|
|
105
|
+
FONT_WEIGHT,
|
|
106
|
+
LETTER_SPACING,
|
|
107
|
+
LINE_HEIGHT__TIGHT,
|
|
108
|
+
LINE_HEIGHT__RELAXED,
|
|
109
|
+
} from './themes/tokens/primitives/typography.js';
|
|
110
|
+
export { COLOR_SCHEME__DARK, COLOR_SCHEME__LIGHT, COLOR_SCHEME__SYSTEM } from './constants/theming.js';
|
|
111
|
+
export type { ColorScheme } from './types/theming.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ReactNode, createContext, useMemo } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
|
|
4
|
+
import { darkColorScheme, lightColorScheme } from '../styles/color-scheme.css.js';
|
|
5
|
+
import type { ColorScheme } from '../../types/theming.js';
|
|
6
|
+
import { COLOR_SCHEME__DARK, COLOR_SCHEME__LIGHT, COLOR_SCHEME__SYSTEM } from '../../constants/theming.js';
|
|
7
|
+
|
|
8
|
+
interface ThemeProviderProps {
|
|
9
|
+
children: (themeClassName: string) => ReactNode;
|
|
10
|
+
themeClassName: string;
|
|
11
|
+
colorScheme?: ColorScheme;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
15
|
+
interface ThemeContextProps {}
|
|
16
|
+
|
|
17
|
+
const ThemeContext = createContext<ThemeContextProps | null>(null);
|
|
18
|
+
|
|
19
|
+
const ThemeProvider = ({ children, themeClassName, colorScheme = COLOR_SCHEME__SYSTEM }: ThemeProviderProps) => {
|
|
20
|
+
const colorSchemeOverrideClassName = useMemo(() => {
|
|
21
|
+
switch (colorScheme) {
|
|
22
|
+
case COLOR_SCHEME__LIGHT: {
|
|
23
|
+
return lightColorScheme;
|
|
24
|
+
}
|
|
25
|
+
case COLOR_SCHEME__DARK: {
|
|
26
|
+
return darkColorScheme;
|
|
27
|
+
}
|
|
28
|
+
default: {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, [colorScheme]);
|
|
33
|
+
|
|
34
|
+
return <ThemeContext value={{}}>{children(clsx(themeClassName, colorSchemeOverrideClassName))}</ThemeContext>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type { ThemeContextProps };
|
|
38
|
+
export default ThemeProvider;
|
|
39
|
+
export { ThemeContext };
|