@visio-io/design-system 1.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 +151 -0
- package/dist/index.cjs.js +64 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +2838 -0
- package/dist/index.es.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/components/Button/Button.d.ts +2 -0
- package/dist/types/components/Button/Button.stories.d.ts +16 -0
- package/dist/types/components/Button/handlers.d.ts +3 -0
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/Button/types.d.ts +19 -0
- package/dist/types/components/Button/utils.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/styles/tokens/colors.d.ts +52 -0
- package/dist/types/styles/tokens/index.d.ts +4 -0
- package/dist/types/styles/tokens/radii.d.ts +7 -0
- package/dist/types/styles/tokens/spacing.d.ts +9 -0
- package/dist/types/styles/tokens/typography.d.ts +22 -0
- package/dist/types/theme/theme.d.ts +33 -0
- package/package.json +63 -0
- package/src/styles/tokens/colors.scss +53 -0
- package/src/styles/tokens/colors.ts +53 -0
- package/src/styles/tokens/index.ts +4 -0
- package/src/styles/tokens/radii.ts +7 -0
- package/src/styles/tokens/spacing.ts +9 -0
- package/src/styles/tokens/typography.ts +22 -0
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.button{transition:all .2s ease-in-out}.button:disabled{cursor:not-allowed}.borderRadiusNone{border-radius:0}.borderRadiusSmall{border-radius:4px}.borderRadiusMedium{border-radius:8px}.borderRadiusLarge{border-radius:16px}.borderRadiusRound{border-radius:50px}._button_1x96v_1{transition:all .2s ease-in-out}._button_1x96v_1:disabled{cursor:not-allowed}._borderRadiusNone_1x96v_8{border-radius:0}._borderRadiusSmall_1x96v_12{border-radius:4px}._borderRadiusMedium_1x96v_16{border-radius:8px}._borderRadiusLarge_1x96v_20{border-radius:16px}._borderRadiusRound_1x96v_24{border-radius:50px}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import '../../styles/index.scss';
|
|
4
|
+
declare const meta: Meta<typeof Button>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof Button>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const Variants: Story;
|
|
9
|
+
export declare const Sizes: Story;
|
|
10
|
+
export declare const Colors: Story;
|
|
11
|
+
export declare const States: Story;
|
|
12
|
+
export declare const WithIcons: Story;
|
|
13
|
+
export declare const BorderRadius: Story;
|
|
14
|
+
export declare const FullWidth: Story;
|
|
15
|
+
export declare const Combinations: Story;
|
|
16
|
+
export declare const Interactive: Story;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { ButtonProps } from './types';
|
|
3
|
+
export declare const createClickHandler: (isDisabled: boolean, onClick?: ButtonProps["onClick"], onAction?: ButtonProps["onAction"]) => ((event: MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ButtonProps as MuiButtonProps } from '@mui/material';
|
|
2
|
+
import { ReactNode, MouseEvent } from 'react';
|
|
3
|
+
export type ButtonVariant = 'contained' | 'outlined' | 'text';
|
|
4
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
5
|
+
export type ButtonColor = 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success' | 'inherit';
|
|
6
|
+
export type ButtonBorderRadius = 'none' | 'small' | 'medium' | 'large' | 'round' | number;
|
|
7
|
+
export interface ButtonProps extends Omit<MuiButtonProps, 'variant' | 'size' | 'color' | 'type' | 'startIcon' | 'endIcon' | 'onClick'> {
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
loadingText?: string;
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
size?: ButtonSize;
|
|
12
|
+
color?: ButtonColor;
|
|
13
|
+
type?: 'button' | 'submit' | 'reset';
|
|
14
|
+
borderRadius?: ButtonBorderRadius;
|
|
15
|
+
startIcon?: ReactNode;
|
|
16
|
+
endIcon?: ReactNode;
|
|
17
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
18
|
+
onAction?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ButtonBorderRadius } from './types';
|
|
2
|
+
export declare const getBorderRadiusClass: (borderRadius: ButtonBorderRadius | undefined, defaultBorderRadius?: ButtonBorderRadius) => string;
|
|
3
|
+
export declare const getBorderRadiusValue: (borderRadius: ButtonBorderRadius | undefined) => string | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const lightColors: {
|
|
2
|
+
readonly primary: "#006399";
|
|
3
|
+
readonly onPrimary: "#ffffff";
|
|
4
|
+
readonly primaryContainer: "#cfe5ff";
|
|
5
|
+
readonly onPrimaryContainer: "#001d33";
|
|
6
|
+
readonly secondary: "#526070";
|
|
7
|
+
readonly onSecondary: "#ffffff";
|
|
8
|
+
readonly secondaryContainer: "#d5e4f7";
|
|
9
|
+
readonly onSecondaryContainer: "#0f1d2a";
|
|
10
|
+
readonly tertiary: "#68587a";
|
|
11
|
+
readonly onTertiary: "#ffffff";
|
|
12
|
+
readonly tertiaryContainer: "#eedcff";
|
|
13
|
+
readonly onTertiaryContainer: "#231533";
|
|
14
|
+
readonly error: "#ba1a1a";
|
|
15
|
+
readonly onError: "#ffffff";
|
|
16
|
+
readonly errorContainer: "#ffdad6";
|
|
17
|
+
readonly onErrorContainer: "#410002";
|
|
18
|
+
readonly surface: "#fdfcff";
|
|
19
|
+
readonly onSurface: "#1a1c1e";
|
|
20
|
+
readonly surfaceVariant: "#dee3eb";
|
|
21
|
+
readonly onSurfaceVariant: "#42474e";
|
|
22
|
+
readonly outline: "#72787e";
|
|
23
|
+
readonly inverseSurface: "#2f3033";
|
|
24
|
+
readonly inverseOnSurface: "#f1f0f4";
|
|
25
|
+
readonly inversePrimary: "#98cbff";
|
|
26
|
+
};
|
|
27
|
+
export declare const darkColors: {
|
|
28
|
+
readonly primary: "#98cbff";
|
|
29
|
+
readonly onPrimary: "#003354";
|
|
30
|
+
readonly primaryContainer: "#004a78";
|
|
31
|
+
readonly onPrimaryContainer: "#cfe5ff";
|
|
32
|
+
readonly secondary: "#b9c8da";
|
|
33
|
+
readonly onSecondary: "#233241";
|
|
34
|
+
readonly secondaryContainer: "#3a4a58";
|
|
35
|
+
readonly onSecondaryContainer: "#d5e4f7";
|
|
36
|
+
readonly tertiary: "#d3bee5";
|
|
37
|
+
readonly onTertiary: "#382a4a";
|
|
38
|
+
readonly tertiaryContainer: "#4f4062";
|
|
39
|
+
readonly onTertiaryContainer: "#eedcff";
|
|
40
|
+
readonly error: "#ffb4ab";
|
|
41
|
+
readonly onError: "#690005";
|
|
42
|
+
readonly errorContainer: "#93000a";
|
|
43
|
+
readonly onErrorContainer: "#ffdad6";
|
|
44
|
+
readonly surface: "#1a1c1e";
|
|
45
|
+
readonly onSurface: "#e2e2e6";
|
|
46
|
+
readonly surfaceVariant: "#42474e";
|
|
47
|
+
readonly onSurfaceVariant: "#c2c7cf";
|
|
48
|
+
readonly outline: "#8c9198";
|
|
49
|
+
readonly inverseSurface: "#e2e2e6";
|
|
50
|
+
readonly inverseOnSurface: "#2f3033";
|
|
51
|
+
readonly inversePrimary: "#006399";
|
|
52
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const typographyTokens: {
|
|
2
|
+
readonly fontFamily: "\"Inter\", \"Helvetica\", \"Arial\", sans-serif";
|
|
3
|
+
readonly fontSize: {
|
|
4
|
+
readonly xs: 12;
|
|
5
|
+
readonly sm: 14;
|
|
6
|
+
readonly md: 16;
|
|
7
|
+
readonly lg: 18;
|
|
8
|
+
readonly xl: 20;
|
|
9
|
+
readonly xxl: 24;
|
|
10
|
+
};
|
|
11
|
+
readonly fontWeight: {
|
|
12
|
+
readonly regular: 400;
|
|
13
|
+
readonly medium: 500;
|
|
14
|
+
readonly semibold: 600;
|
|
15
|
+
readonly bold: 700;
|
|
16
|
+
};
|
|
17
|
+
readonly lineHeight: {
|
|
18
|
+
readonly tight: 1.2;
|
|
19
|
+
readonly normal: 1.5;
|
|
20
|
+
readonly relaxed: 1.7;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Theme } from "@mui/material/styles";
|
|
2
|
+
declare module "@mui/material/styles" {
|
|
3
|
+
interface Theme {
|
|
4
|
+
visio: {
|
|
5
|
+
surfaceVariant: string;
|
|
6
|
+
onSurfaceVariant: string;
|
|
7
|
+
inverseSurface: string;
|
|
8
|
+
inverseOnSurface: string;
|
|
9
|
+
inversePrimary: string;
|
|
10
|
+
outline: string;
|
|
11
|
+
tertiary: {
|
|
12
|
+
main: string;
|
|
13
|
+
contrastText: string;
|
|
14
|
+
container: string;
|
|
15
|
+
onContainer: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface ThemeOptions {
|
|
20
|
+
visio?: Theme["visio"];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare const lightTheme: Theme;
|
|
24
|
+
export declare const darkTheme: Theme;
|
|
25
|
+
export declare const spacingScale: {
|
|
26
|
+
readonly xxs: 2;
|
|
27
|
+
readonly xs: 4;
|
|
28
|
+
readonly sm: 8;
|
|
29
|
+
readonly md: 12;
|
|
30
|
+
readonly lg: 16;
|
|
31
|
+
readonly xl: 24;
|
|
32
|
+
readonly xxl: 32;
|
|
33
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@visio-io/design-system",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Visio Design System",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.es.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"style": "dist/style.css",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"import": "./dist/index.es.js",
|
|
13
|
+
"require": "./dist/index.cjs.js",
|
|
14
|
+
"default": "./dist/index.es.js"
|
|
15
|
+
},
|
|
16
|
+
"./style.css": "./dist/style.css",
|
|
17
|
+
"./tokens": "./src/styles/tokens/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"src/styles/tokens"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"**/*.scss",
|
|
25
|
+
"**/*.css"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"registry": "https://registry.npmjs.org/",
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/visio-io/visio-design-system.git"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@emotion/react": "^11.0.0",
|
|
37
|
+
"@emotion/styled": "^11.0.0",
|
|
38
|
+
"@mui/material": "^5.0.0",
|
|
39
|
+
"react": "^19.0.0",
|
|
40
|
+
"react-dom": "^19.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@changesets/cli": "^2.27.1",
|
|
44
|
+
"@storybook/addon-a11y": "^8.4.0",
|
|
45
|
+
"@storybook/addon-essentials": "^8.4.0",
|
|
46
|
+
"@storybook/react": "^8.4.0",
|
|
47
|
+
"@storybook/react-vite": "^8.4.0",
|
|
48
|
+
"storybook": "^8.4.0",
|
|
49
|
+
"@types/react": "^19.0.0",
|
|
50
|
+
"@types/react-dom": "^19.0.0",
|
|
51
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
52
|
+
"sass": "^1.77.0",
|
|
53
|
+
"typescript": "^5.6.0",
|
|
54
|
+
"vite": "^5.4.0"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"dev": "storybook dev -p 6006",
|
|
58
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
59
|
+
"type-check": "tsc --noEmit",
|
|
60
|
+
"version": "changeset version",
|
|
61
|
+
"release": "pnpm build && changeset publish"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
$visio-light-colors: (
|
|
2
|
+
primary: #006399,
|
|
3
|
+
on-primary: #ffffff,
|
|
4
|
+
primary-container: #cfe5ff,
|
|
5
|
+
on-primary-container: #001d33,
|
|
6
|
+
secondary: #526070,
|
|
7
|
+
on-secondary: #ffffff,
|
|
8
|
+
secondary-container: #d5e4f7,
|
|
9
|
+
on-secondary-container: #0f1d2a,
|
|
10
|
+
tertiary: #68587a,
|
|
11
|
+
on-tertiary: #ffffff,
|
|
12
|
+
tertiary-container: #eedcff,
|
|
13
|
+
on-tertiary-container: #231533,
|
|
14
|
+
error: #ba1a1a,
|
|
15
|
+
on-error: #ffffff,
|
|
16
|
+
error-container: #ffdad6,
|
|
17
|
+
on-error-container: #410002,
|
|
18
|
+
surface: #fdfcff,
|
|
19
|
+
on-surface: #1a1c1e,
|
|
20
|
+
surface-variant: #dee3eb,
|
|
21
|
+
on-surface-variant: #42474e,
|
|
22
|
+
outline: #72787e,
|
|
23
|
+
inverse-surface: #2f3033,
|
|
24
|
+
inverse-on-surface: #f1f0f4,
|
|
25
|
+
inverse-primary: #98cbff,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
$visio-dark-colors: (
|
|
29
|
+
primary: #98cbff,
|
|
30
|
+
on-primary: #003354,
|
|
31
|
+
primary-container: #004a78,
|
|
32
|
+
on-primary-container: #cfe5ff,
|
|
33
|
+
secondary: #b9c8da,
|
|
34
|
+
on-secondary: #233241,
|
|
35
|
+
secondary-container: #3a4a58,
|
|
36
|
+
on-secondary-container: #d5e4f7,
|
|
37
|
+
tertiary: #d3bee5,
|
|
38
|
+
on-tertiary: #382a4a,
|
|
39
|
+
tertiary-container: #4f4062,
|
|
40
|
+
on-tertiary-container: #eedcff,
|
|
41
|
+
error: #ffb4ab,
|
|
42
|
+
on-error: #690005,
|
|
43
|
+
error-container: #93000a,
|
|
44
|
+
on-error-container: #ffdad6,
|
|
45
|
+
surface: #1a1c1e,
|
|
46
|
+
on-surface: #e2e2e6,
|
|
47
|
+
surface-variant: #42474e,
|
|
48
|
+
on-surface-variant: #c2c7cf,
|
|
49
|
+
outline: #8c9198,
|
|
50
|
+
inverse-surface: #e2e2e6,
|
|
51
|
+
inverse-on-surface: #2f3033,
|
|
52
|
+
inverse-primary: #006399,
|
|
53
|
+
);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const lightColors = {
|
|
2
|
+
primary: "#006399",
|
|
3
|
+
onPrimary: "#ffffff",
|
|
4
|
+
primaryContainer: "#cfe5ff",
|
|
5
|
+
onPrimaryContainer: "#001d33",
|
|
6
|
+
secondary: "#526070",
|
|
7
|
+
onSecondary: "#ffffff",
|
|
8
|
+
secondaryContainer: "#d5e4f7",
|
|
9
|
+
onSecondaryContainer: "#0f1d2a",
|
|
10
|
+
tertiary: "#68587a",
|
|
11
|
+
onTertiary: "#ffffff",
|
|
12
|
+
tertiaryContainer: "#eedcff",
|
|
13
|
+
onTertiaryContainer: "#231533",
|
|
14
|
+
error: "#ba1a1a",
|
|
15
|
+
onError: "#ffffff",
|
|
16
|
+
errorContainer: "#ffdad6",
|
|
17
|
+
onErrorContainer: "#410002",
|
|
18
|
+
surface: "#fdfcff",
|
|
19
|
+
onSurface: "#1a1c1e",
|
|
20
|
+
surfaceVariant: "#dee3eb",
|
|
21
|
+
onSurfaceVariant: "#42474e",
|
|
22
|
+
outline: "#72787e",
|
|
23
|
+
inverseSurface: "#2f3033",
|
|
24
|
+
inverseOnSurface: "#f1f0f4",
|
|
25
|
+
inversePrimary: "#98cbff",
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
export const darkColors = {
|
|
29
|
+
primary: "#98cbff",
|
|
30
|
+
onPrimary: "#003354",
|
|
31
|
+
primaryContainer: "#004a78",
|
|
32
|
+
onPrimaryContainer: "#cfe5ff",
|
|
33
|
+
secondary: "#b9c8da",
|
|
34
|
+
onSecondary: "#233241",
|
|
35
|
+
secondaryContainer: "#3a4a58",
|
|
36
|
+
onSecondaryContainer: "#d5e4f7",
|
|
37
|
+
tertiary: "#d3bee5",
|
|
38
|
+
onTertiary: "#382a4a",
|
|
39
|
+
tertiaryContainer: "#4f4062",
|
|
40
|
+
onTertiaryContainer: "#eedcff",
|
|
41
|
+
error: "#ffb4ab",
|
|
42
|
+
onError: "#690005",
|
|
43
|
+
errorContainer: "#93000a",
|
|
44
|
+
onErrorContainer: "#ffdad6",
|
|
45
|
+
surface: "#1a1c1e",
|
|
46
|
+
onSurface: "#e2e2e6",
|
|
47
|
+
surfaceVariant: "#42474e",
|
|
48
|
+
onSurfaceVariant: "#c2c7cf",
|
|
49
|
+
outline: "#8c9198",
|
|
50
|
+
inverseSurface: "#e2e2e6",
|
|
51
|
+
inverseOnSurface: "#2f3033",
|
|
52
|
+
inversePrimary: "#006399",
|
|
53
|
+
} as const;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const typographyTokens = {
|
|
2
|
+
fontFamily: '"Inter", "Helvetica", "Arial", sans-serif',
|
|
3
|
+
fontSize: {
|
|
4
|
+
xs: 12,
|
|
5
|
+
sm: 14,
|
|
6
|
+
md: 16,
|
|
7
|
+
lg: 18,
|
|
8
|
+
xl: 20,
|
|
9
|
+
xxl: 24,
|
|
10
|
+
},
|
|
11
|
+
fontWeight: {
|
|
12
|
+
regular: 400,
|
|
13
|
+
medium: 500,
|
|
14
|
+
semibold: 600,
|
|
15
|
+
bold: 700,
|
|
16
|
+
},
|
|
17
|
+
lineHeight: {
|
|
18
|
+
tight: 1.2,
|
|
19
|
+
normal: 1.5,
|
|
20
|
+
relaxed: 1.7,
|
|
21
|
+
},
|
|
22
|
+
} as const;
|