syntra-ui 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/README.md +73 -0
- package/dist/components/button/Button.d.ts +19 -0
- package/dist/components/button/button.styles.d.ts +9 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/input/Input.d.ts +18 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/input.styles.d.ts +8 -0
- package/dist/components/spinner/Spinner.d.ts +13 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/defaults/borders.d.ts +2 -0
- package/dist/defaults/colors.d.ts +3 -0
- package/dist/defaults/shadows.d.ts +3 -0
- package/dist/defaults/spacing.d.ts +2 -0
- package/dist/defaults/theme.d.ts +3 -0
- package/dist/defaults/transitions.d.ts +2 -0
- package/dist/defaults/typography.d.ts +2 -0
- package/dist/hooks/useSyntra.d.ts +2 -0
- package/dist/hooks/useSyntraMode.d.ts +2 -0
- package/dist/index.d.ts +15 -0
- package/dist/primitives/Box.d.ts +10 -0
- package/dist/primitives/Divider.d.ts +14 -0
- package/dist/primitives/Flex.d.ts +18 -0
- package/dist/primitives/Grid.d.ts +19 -0
- package/dist/primitives/Heading.d.ts +15 -0
- package/dist/primitives/Stack.d.ts +15 -0
- package/dist/primitives/Text.d.ts +19 -0
- package/dist/primitives/VisuallyHidden.d.ts +9 -0
- package/dist/primitives/index.d.ts +19 -0
- package/dist/primitives/polymorphic.d.ts +13 -0
- package/dist/primitives/style-props.d.ts +75 -0
- package/dist/provider/SyntraContext.d.ts +2 -0
- package/dist/provider/SyntraProvider.d.ts +10 -0
- package/dist/provider/cssVars.d.ts +6 -0
- package/dist/syntra-ui.cjs +135 -0
- package/dist/syntra-ui.mjs +1541 -0
- package/dist/types.d.ts +176 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/colorScale.d.ts +10 -0
- package/dist/utils/createSyntraTheme.d.ts +2 -0
- package/dist/utils/deepMerge.d.ts +1 -0
- package/dist/utils/use-styles.d.ts +1 -0
- package/dist/utils/use-syntra-context.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from '../../primitives/polymorphic';
|
|
3
|
+
import { SyntraStyleProps } from '../../primitives/style-props';
|
|
4
|
+
import { ButtonVariant, ButtonSize, ButtonColorScheme } from './button.styles';
|
|
5
|
+
interface ButtonOwnProps extends SyntraStyleProps {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
colorScheme?: ButtonColorScheme;
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
leftSection?: ReactNode;
|
|
13
|
+
rightSection?: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
declare const Button: PolymorphicComponent<"button", ButtonOwnProps>;
|
|
18
|
+
export { Button };
|
|
19
|
+
export type { ButtonOwnProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'soft' | 'link';
|
|
3
|
+
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
|
+
type ButtonColorScheme = 'primary' | 'neutral' | 'danger' | (string & {});
|
|
5
|
+
declare const BUTTON_CSS = "\n.syntra-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n white-space: nowrap;\n user-select: none;\n vertical-align: middle;\n cursor: pointer;\n font-family: inherit;\n font-weight: var(--_btn-fw);\n font-size: var(--_btn-fz);\n height: var(--_btn-h);\n padding-left: var(--_btn-px);\n padding-right: var(--_btn-px);\n gap: var(--_btn-gap);\n border-radius: var(--_btn-radius);\n background: var(--_btn-bg);\n color: var(--_btn-color);\n border: 1px solid var(--_btn-border, transparent);\n transition: background 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;\n text-decoration: none;\n outline: none;\n}\n.syntra-button:hover:not(:disabled):not([data-loading]) {\n background: var(--_btn-bg-hover);\n border-color: var(--_btn-border-hover, transparent);\n color: var(--_btn-color-hover, var(--_btn-color));\n}\n.syntra-button:active:not(:disabled):not([data-loading]) {\n background: var(--_btn-bg-active);\n}\n.syntra-button:focus-visible {\n outline: 2px solid var(--_btn-ring);\n outline-offset: 2px;\n}\n.syntra-button:disabled,\n.syntra-button[data-loading] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.syntra-button[data-loading] {\n cursor: wait;\n pointer-events: none;\n}\n.syntra-button[data-full-width] {\n width: 100%;\n}\n.syntra-button[data-variant=\"link\"] {\n height: auto;\n padding-left: 0;\n padding-right: 0;\n background: transparent;\n border-color: transparent;\n}\n.syntra-button[data-variant=\"link\"]:hover:not(:disabled) {\n text-decoration: underline;\n background: transparent;\n}\n.syntra-button-label[data-loading] {\n opacity: 0;\n}\n.syntra-button-spinner {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n";
|
|
6
|
+
declare function getButtonSizeStyles(size: ButtonSize): CSSProperties;
|
|
7
|
+
declare function getButtonVariantStyles(variant: ButtonVariant, colorScheme: ButtonColorScheme): CSSProperties;
|
|
8
|
+
export { BUTTON_CSS, getButtonSizeStyles, getButtonVariantStyles };
|
|
9
|
+
export type { ButtonVariant, ButtonSize, ButtonColorScheme };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Button } from './button';
|
|
2
|
+
export type { ButtonOwnProps, ButtonVariant, ButtonSize, ButtonColorScheme } from './button';
|
|
3
|
+
export { Input } from './input';
|
|
4
|
+
export type { InputOwnProps, InputProps, InputVariant, InputSize } from './input';
|
|
5
|
+
export { Spinner } from './spinner';
|
|
6
|
+
export type { SpinnerProps } from './spinner';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { SyntraStyleProps } from '../../primitives/style-props';
|
|
3
|
+
import { InputVariant, InputSize } from './input.styles';
|
|
4
|
+
interface InputOwnProps extends SyntraStyleProps {
|
|
5
|
+
variant?: InputVariant;
|
|
6
|
+
size?: InputSize;
|
|
7
|
+
invalid?: boolean;
|
|
8
|
+
leftSection?: ReactNode;
|
|
9
|
+
rightSection?: ReactNode;
|
|
10
|
+
wrapperClassName?: string;
|
|
11
|
+
wrapperStyle?: CSSProperties;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
type InputProps = InputOwnProps & Omit<InputHTMLAttributes<HTMLInputElement>, keyof InputOwnProps>;
|
|
16
|
+
declare const Input: import('react').ForwardRefExoticComponent<InputOwnProps & Omit<InputHTMLAttributes<HTMLInputElement>, keyof InputOwnProps> & import('react').RefAttributes<HTMLInputElement>>;
|
|
17
|
+
export { Input };
|
|
18
|
+
export type { InputOwnProps, InputProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
type InputVariant = 'outline' | 'filled' | 'unstyled';
|
|
3
|
+
type InputSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
|
+
declare const INPUT_CSS = "\n.syntra-input-wrapper {\n display: inline-flex;\n align-items: center;\n position: relative;\n width: var(--_input-w, auto);\n height: var(--_input-h);\n padding-left: var(--_input-px);\n padding-right: var(--_input-px);\n gap: var(--_input-gap);\n border-radius: var(--_input-radius);\n background: var(--_input-bg);\n border: 1px solid var(--_input-border, transparent);\n font-family: inherit;\n font-size: var(--_input-fz);\n transition: border-color 150ms ease, box-shadow 150ms ease;\n}\n.syntra-input-wrapper:focus-within:not([data-disabled]):not([data-variant=\"unstyled\"]) {\n border-color: var(--_input-focus-border);\n box-shadow: 0 0 0 1px var(--_input-focus-border);\n}\n.syntra-input-wrapper[data-invalid]:not([data-disabled]) {\n border-color: var(--_input-invalid-border);\n}\n.syntra-input-wrapper[data-invalid]:focus-within:not([data-disabled]) {\n border-color: var(--_input-invalid-border);\n box-shadow: 0 0 0 1px var(--_input-invalid-border);\n}\n.syntra-input-wrapper[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.syntra-input {\n flex: 1;\n min-width: 0;\n height: 100%;\n border: none;\n outline: none;\n background: transparent;\n color: inherit;\n font-family: inherit;\n font-size: inherit;\n padding: 0;\n}\n.syntra-input::placeholder {\n color: var(--syntra-color-foreground-muted);\n}\n.syntra-input:disabled {\n cursor: not-allowed;\n}\n.syntra-input-section {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: var(--syntra-color-foreground-muted);\n}\n";
|
|
5
|
+
declare function getInputSizeStyles(size: InputSize): CSSProperties;
|
|
6
|
+
declare function getInputVariantStyles(variant: InputVariant): CSSProperties;
|
|
7
|
+
export { INPUT_CSS, getInputSizeStyles, getInputVariantStyles };
|
|
8
|
+
export type { InputVariant, InputSize };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
interface SpinnerProps {
|
|
3
|
+
size?: number | string;
|
|
4
|
+
color?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
declare function Spinner({ size, color, className, style }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare namespace Spinner {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export { Spinner };
|
|
13
|
+
export type { SpinnerProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { SyntraProvider } from './provider/SyntraProvider';
|
|
2
|
+
export type { SyntraProviderProps } from './provider/SyntraProvider';
|
|
3
|
+
export { useSyntra } from './hooks/useSyntra';
|
|
4
|
+
export { useSyntraMode } from './hooks/useSyntraMode';
|
|
5
|
+
export { Box, Text, Heading, Flex, Stack, Grid, Divider, VisuallyHidden, resolveStyleProps, extractStyleProps, } from './primitives';
|
|
6
|
+
export type { BoxOwnProps, TextOwnProps, HeadingOwnProps, HeadingLevel, FlexOwnProps, StackOwnProps, GridOwnProps, DividerOwnProps, VisuallyHiddenOwnProps, SyntraStyleProps, SpaceProp, RadiusProp, ShadowProp, PolymorphicProps, PolymorphicPropsWithRef, PolymorphicComponent, } from './primitives';
|
|
7
|
+
export { Button, Input, Spinner } from './components';
|
|
8
|
+
export type { ButtonOwnProps, ButtonVariant, ButtonSize, ButtonColorScheme, InputOwnProps, InputProps, InputVariant, InputSize, SpinnerProps, } from './components';
|
|
9
|
+
export { cn } from './utils/cn';
|
|
10
|
+
export { createSyntraTheme } from './utils/createSyntraTheme';
|
|
11
|
+
export { generateColorScale } from './utils/colorScale';
|
|
12
|
+
export { deepMerge } from './utils/deepMerge';
|
|
13
|
+
export { defaultLightTheme, defaultDarkTheme } from './defaults/theme';
|
|
14
|
+
export { lightColors, darkColors } from './defaults/colors';
|
|
15
|
+
export type { SyntraTheme, SyntraThemeInput, SyntraConfigInput, SyntraContextValue, SyntraMode, ResolvedMode, SyntraColors, SyntraColorsInput, ColorScale, GrayScale, SemanticColor, ColorInput, SyntraTypography, SyntraSpacing, SyntraBorderRadius, SyntraShadows, SyntraTransitions, DeepPartial, } from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps } from './style-props';
|
|
4
|
+
interface BoxOwnProps extends SyntraStyleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
declare const Box: PolymorphicComponent<"div", BoxOwnProps>;
|
|
9
|
+
export { Box };
|
|
10
|
+
export type { BoxOwnProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps } from './style-props';
|
|
4
|
+
interface DividerOwnProps extends SyntraStyleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
|
+
color?: string;
|
|
9
|
+
thickness?: string | number;
|
|
10
|
+
decorative?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const Divider: PolymorphicComponent<"div", DividerOwnProps>;
|
|
13
|
+
export { Divider };
|
|
14
|
+
export type { DividerOwnProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps, SpaceProp } from './style-props';
|
|
4
|
+
interface FlexOwnProps extends SyntraStyleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
direction?: CSSProperties['flexDirection'];
|
|
8
|
+
align?: CSSProperties['alignItems'];
|
|
9
|
+
justify?: CSSProperties['justifyContent'];
|
|
10
|
+
wrap?: CSSProperties['flexWrap'];
|
|
11
|
+
gap?: SpaceProp;
|
|
12
|
+
gapX?: SpaceProp;
|
|
13
|
+
gapY?: SpaceProp;
|
|
14
|
+
inline?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const Flex: PolymorphicComponent<"div", FlexOwnProps>;
|
|
17
|
+
export { Flex };
|
|
18
|
+
export type { FlexOwnProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps, SpaceProp } from './style-props';
|
|
4
|
+
interface GridOwnProps extends SyntraStyleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
columns?: number | string;
|
|
8
|
+
rows?: number | string;
|
|
9
|
+
gap?: SpaceProp;
|
|
10
|
+
gapX?: SpaceProp;
|
|
11
|
+
gapY?: SpaceProp;
|
|
12
|
+
areas?: string;
|
|
13
|
+
align?: CSSProperties['alignItems'];
|
|
14
|
+
justify?: CSSProperties['justifyContent'];
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const Grid: PolymorphicComponent<"div", GridOwnProps>;
|
|
18
|
+
export { Grid };
|
|
19
|
+
export type { GridOwnProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps, FontSizeProp, FontWeightProp, LetterSpacingProp } from './style-props';
|
|
4
|
+
type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
5
|
+
interface HeadingOwnProps extends SyntraStyleProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
level?: HeadingLevel;
|
|
9
|
+
size?: FontSizeProp;
|
|
10
|
+
weight?: FontWeightProp;
|
|
11
|
+
tracking?: LetterSpacingProp;
|
|
12
|
+
}
|
|
13
|
+
declare const Heading: PolymorphicComponent<"h2", HeadingOwnProps>;
|
|
14
|
+
export { Heading };
|
|
15
|
+
export type { HeadingOwnProps, HeadingLevel };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps, SpaceProp } from './style-props';
|
|
4
|
+
interface StackOwnProps extends SyntraStyleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
direction?: 'vertical' | 'horizontal';
|
|
8
|
+
gap?: SpaceProp;
|
|
9
|
+
align?: CSSProperties['alignItems'];
|
|
10
|
+
justify?: CSSProperties['justifyContent'];
|
|
11
|
+
wrap?: CSSProperties['flexWrap'];
|
|
12
|
+
}
|
|
13
|
+
declare const Stack: PolymorphicComponent<"div", StackOwnProps>;
|
|
14
|
+
export { Stack };
|
|
15
|
+
export type { StackOwnProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
import { SyntraStyleProps, FontSizeProp, FontWeightProp, LineHeightProp, LetterSpacingProp } from './style-props';
|
|
4
|
+
interface TextOwnProps extends SyntraStyleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
size?: FontSizeProp;
|
|
8
|
+
weight?: FontWeightProp;
|
|
9
|
+
lineHeight?: LineHeightProp;
|
|
10
|
+
tracking?: LetterSpacingProp;
|
|
11
|
+
align?: CSSProperties['textAlign'];
|
|
12
|
+
truncate?: boolean;
|
|
13
|
+
lineClamp?: number;
|
|
14
|
+
mono?: boolean;
|
|
15
|
+
italic?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const Text: PolymorphicComponent<"span", TextOwnProps>;
|
|
18
|
+
export { Text };
|
|
19
|
+
export type { TextOwnProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PolymorphicComponent } from './polymorphic';
|
|
3
|
+
interface VisuallyHiddenOwnProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
declare const VisuallyHidden: PolymorphicComponent<"span", VisuallyHiddenOwnProps>;
|
|
8
|
+
export { VisuallyHidden };
|
|
9
|
+
export type { VisuallyHiddenOwnProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { Box } from './Box';
|
|
2
|
+
export { Text } from './Text';
|
|
3
|
+
export { Heading } from './Heading';
|
|
4
|
+
export { Flex } from './Flex';
|
|
5
|
+
export { Stack } from './Stack';
|
|
6
|
+
export { Grid } from './Grid';
|
|
7
|
+
export { Divider } from './Divider';
|
|
8
|
+
export { VisuallyHidden } from './VisuallyHidden';
|
|
9
|
+
export { resolveStyleProps, extractStyleProps } from './style-props';
|
|
10
|
+
export type { BoxOwnProps } from './Box';
|
|
11
|
+
export type { TextOwnProps } from './Text';
|
|
12
|
+
export type { HeadingOwnProps, HeadingLevel } from './Heading';
|
|
13
|
+
export type { FlexOwnProps } from './Flex';
|
|
14
|
+
export type { StackOwnProps } from './Stack';
|
|
15
|
+
export type { GridOwnProps } from './Grid';
|
|
16
|
+
export type { DividerOwnProps } from './Divider';
|
|
17
|
+
export type { VisuallyHiddenOwnProps } from './VisuallyHidden';
|
|
18
|
+
export type { SyntraStyleProps, SpaceProp, RadiusProp, ShadowProp } from './style-props';
|
|
19
|
+
export type { PolymorphicProps, PolymorphicPropsWithRef, PolymorphicComponent } from './polymorphic';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ElementType, ComponentPropsWithoutRef, ComponentPropsWithRef, ReactElement } from 'react';
|
|
2
|
+
type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
|
|
3
|
+
type PolymorphicProps<C extends ElementType, OwnProps = object> = OwnProps & {
|
|
4
|
+
as?: C;
|
|
5
|
+
} & Omit<ComponentPropsWithoutRef<C>, keyof OwnProps | 'as'>;
|
|
6
|
+
type PolymorphicPropsWithRef<C extends ElementType, OwnProps = object> = PolymorphicProps<C, OwnProps> & {
|
|
7
|
+
ref?: PolymorphicRef<C>;
|
|
8
|
+
};
|
|
9
|
+
type PolymorphicComponent<DefaultElement extends ElementType, OwnProps = object> = {
|
|
10
|
+
<C extends ElementType = DefaultElement>(props: PolymorphicPropsWithRef<C, OwnProps>): ReactElement | null;
|
|
11
|
+
displayName?: string;
|
|
12
|
+
};
|
|
13
|
+
export type { PolymorphicRef, PolymorphicProps, PolymorphicPropsWithRef, PolymorphicComponent, };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
type SpaceToken = 'px' | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24;
|
|
3
|
+
type RadiusToken = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
|
|
4
|
+
type ShadowToken = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
5
|
+
type SpaceProp = SpaceToken | (string & {});
|
|
6
|
+
type RadiusProp = RadiusToken | (string & {});
|
|
7
|
+
type ShadowProp = ShadowToken | (string & {});
|
|
8
|
+
type SizeProp = string | number;
|
|
9
|
+
type FontSizeToken = '2xs' | 'xs' | 'sm' | 'base' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
|
|
10
|
+
type FontWeightToken = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
11
|
+
type LineHeightToken = 'tight' | 'normal' | 'relaxed';
|
|
12
|
+
type LetterSpacingToken = 'tight' | 'normal' | 'wide';
|
|
13
|
+
type FontSizeProp = FontSizeToken | (string & {});
|
|
14
|
+
type FontWeightProp = FontWeightToken | (string & {});
|
|
15
|
+
type LineHeightProp = LineHeightToken | (string & {});
|
|
16
|
+
type LetterSpacingProp = LetterSpacingToken | (string & {});
|
|
17
|
+
interface SyntraStyleProps {
|
|
18
|
+
p?: SpaceProp;
|
|
19
|
+
px?: SpaceProp;
|
|
20
|
+
py?: SpaceProp;
|
|
21
|
+
pt?: SpaceProp;
|
|
22
|
+
pr?: SpaceProp;
|
|
23
|
+
pb?: SpaceProp;
|
|
24
|
+
pl?: SpaceProp;
|
|
25
|
+
m?: SpaceProp;
|
|
26
|
+
mx?: SpaceProp;
|
|
27
|
+
my?: SpaceProp;
|
|
28
|
+
mt?: SpaceProp;
|
|
29
|
+
mr?: SpaceProp;
|
|
30
|
+
mb?: SpaceProp;
|
|
31
|
+
ml?: SpaceProp;
|
|
32
|
+
gap?: SpaceProp;
|
|
33
|
+
gapX?: SpaceProp;
|
|
34
|
+
gapY?: SpaceProp;
|
|
35
|
+
w?: SizeProp;
|
|
36
|
+
h?: SizeProp;
|
|
37
|
+
minW?: SizeProp;
|
|
38
|
+
minH?: SizeProp;
|
|
39
|
+
maxW?: SizeProp;
|
|
40
|
+
maxH?: SizeProp;
|
|
41
|
+
display?: CSSProperties['display'];
|
|
42
|
+
position?: CSSProperties['position'];
|
|
43
|
+
overflow?: CSSProperties['overflow'];
|
|
44
|
+
inset?: SizeProp;
|
|
45
|
+
top?: SizeProp;
|
|
46
|
+
right?: SizeProp;
|
|
47
|
+
bottom?: SizeProp;
|
|
48
|
+
left?: SizeProp;
|
|
49
|
+
bg?: string;
|
|
50
|
+
color?: string;
|
|
51
|
+
opacity?: CSSProperties['opacity'];
|
|
52
|
+
radius?: RadiusProp;
|
|
53
|
+
shadow?: ShadowProp;
|
|
54
|
+
border?: string;
|
|
55
|
+
borderColor?: string;
|
|
56
|
+
borderWidth?: SizeProp;
|
|
57
|
+
flex?: CSSProperties['flex'];
|
|
58
|
+
flexGrow?: CSSProperties['flexGrow'];
|
|
59
|
+
flexShrink?: CSSProperties['flexShrink'];
|
|
60
|
+
flexBasis?: CSSProperties['flexBasis'];
|
|
61
|
+
alignSelf?: CSSProperties['alignSelf'];
|
|
62
|
+
justifySelf?: CSSProperties['justifySelf'];
|
|
63
|
+
}
|
|
64
|
+
declare function resolveFontSize(value: string, prefix: string): string;
|
|
65
|
+
declare function resolveFontWeight(value: string, prefix: string): string;
|
|
66
|
+
declare function resolveLineHeight(value: string, prefix: string): string;
|
|
67
|
+
declare function resolveLetterSpacing(value: string, prefix: string): string;
|
|
68
|
+
declare function resolveStyleProps(props: SyntraStyleProps, prefix?: string): CSSProperties;
|
|
69
|
+
declare function extractStyleProps<T extends Record<string, unknown>>(props: T): {
|
|
70
|
+
styleProps: SyntraStyleProps;
|
|
71
|
+
rest: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
export { resolveStyleProps, extractStyleProps };
|
|
74
|
+
export { resolveFontSize, resolveFontWeight, resolveLineHeight, resolveLetterSpacing };
|
|
75
|
+
export type { SyntraStyleProps, SpaceProp, RadiusProp, ShadowProp, SizeProp, FontSizeProp, FontWeightProp, LineHeightProp, LetterSpacingProp, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SyntraMode, SyntraThemeInput } from '../types';
|
|
3
|
+
export interface SyntraProviderProps {
|
|
4
|
+
theme?: SyntraThemeInput;
|
|
5
|
+
darkTheme?: SyntraThemeInput;
|
|
6
|
+
mode?: SyntraMode;
|
|
7
|
+
cssVarPrefix?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function SyntraProvider({ theme: themeInput, darkTheme: darkThemeInput, mode: initialMode, cssVarPrefix, children, }: SyntraProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SyntraTheme } from '../types';
|
|
2
|
+
type FlattenResult = Record<string, string>;
|
|
3
|
+
export declare function themeToCssVars(theme: SyntraTheme, prefix?: string): FlattenResult;
|
|
4
|
+
export declare function injectCssVars(theme: SyntraTheme, prefix?: string, element?: HTMLElement): void;
|
|
5
|
+
export declare function removeCssVars(prefix?: string, element?: HTMLElement): void;
|
|
6
|
+
export {};
|