@frontify/fondue-components 0.1.0-beta.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/.eslintignore +4 -0
- package/.eslintrc.cjs +33 -0
- package/.prettierignore +1 -0
- package/.prettierrc +17 -0
- package/.storybook/DocumentationTemplate.mdx +25 -0
- package/.storybook/main.ts +29 -0
- package/.storybook/preview.ts +53 -0
- package/CHANGELOG.md +7 -0
- package/package.json +91 -0
- package/playwright/index.html +12 -0
- package/playwright/index.ts +3 -0
- package/playwright.config.ts +29 -0
- package/postcss.config.cjs +8 -0
- package/scripts/createNewComponent.ts +42 -0
- package/scripts/templates/__tests__/component.ct.tsx +25 -0
- package/scripts/templates/__tests__/component.spec.tsx +24 -0
- package/scripts/templates/component.stories.ts +35 -0
- package/scripts/templates/component.ts +25 -0
- package/scripts/templates/index.ts +15 -0
- package/scripts/templates/styles/componentStyles.tsx +16 -0
- package/scripts/transforms.ts +13 -0
- package/scripts/types.ts +7 -0
- package/src/components/Button/Button.stories.tsx +57 -0
- package/src/components/Button/Button.tsx +111 -0
- package/src/components/Button/styles/buttonStyles.ts +175 -0
- package/src/components/Button/styles/iconStyles.ts +152 -0
- package/src/components/Button/styles/textStyles.ts +149 -0
- package/src/components/Button/tests/Button.ct.tsx +61 -0
- package/src/components/Button/tests/Button.spec.tsx +34 -0
- package/src/components/Divider/Divider.stories.ts +47 -0
- package/src/components/Divider/Divider.tsx +69 -0
- package/src/components/Divider/__tests__/Divider.spec.tsx +88 -0
- package/src/components/LoadingBar/LoadingBar.stories.tsx +32 -0
- package/src/components/LoadingBar/LoadingBar.tsx +68 -0
- package/src/components/LoadingBar/styles/loadingBarStyles.ts +38 -0
- package/src/components/LoadingBar/tests/LoadingBar.ct.tsx +39 -0
- package/src/components/Tag/Tag.ct.tsx +16 -0
- package/src/components/Tag/Tag.stories.ts +29 -0
- package/src/components/Tag/Tag.tsx +18 -0
- package/src/components/Tag/__tests__/tag.spec.tsx +13 -0
- package/src/index.ts +8 -0
- package/src/setupTests.ts +19 -0
- package/src/styles.css +35 -0
- package/src/utilities/focusStyle.ts +12 -0
- package/src/utilities/styleUtilities.ts +19 -0
- package/src/utilities/tests/styleUtilities.spec.ts +114 -0
- package/tailwind.config.ts +148 -0
- package/tsconfig.json +26 -0
- package/tsconfig.node.json +21 -0
- package/vite.config.ts +67 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
// @ts-expect-error Untyped
|
|
4
|
+
import frontifyTailwindConfig from '@frontify/fondue-tokens/tailwind';
|
|
5
|
+
import tailwindForms from '@tailwindcss/forms';
|
|
6
|
+
import { type Config } from 'tailwindcss';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
presets: [frontifyTailwindConfig as Config],
|
|
10
|
+
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}', './.storybook/DocumentationTemplate.mdx'],
|
|
11
|
+
plugins: [
|
|
12
|
+
tailwindForms({
|
|
13
|
+
strategy: 'class',
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
theme: {
|
|
17
|
+
extend: {
|
|
18
|
+
outline: {
|
|
19
|
+
violet: '1px solid #825fff',
|
|
20
|
+
},
|
|
21
|
+
boxShadow: {
|
|
22
|
+
large: '0 25px 80px 0 rgba(45, 50, 50, 0.4)',
|
|
23
|
+
mid: '0 3px 10px 0 rgba(8, 8, 8, 0.15)',
|
|
24
|
+
'mid-top': '0 -10px 10px -5px rgba(45, 50, 50, 0.1)',
|
|
25
|
+
'mid-bottom': '0 10px 10px -5px rgba(45, 50, 50, 0.1)',
|
|
26
|
+
'inner-mighty': 'inset 0 0 0 var(--line-width) var(--line-color-mighty)',
|
|
27
|
+
none: 'none',
|
|
28
|
+
},
|
|
29
|
+
ringColor: {
|
|
30
|
+
blue: '#5e9ed6',
|
|
31
|
+
},
|
|
32
|
+
colors: {
|
|
33
|
+
transparent: 'transparent',
|
|
34
|
+
current: 'currentColor',
|
|
35
|
+
white: '#ffffff',
|
|
36
|
+
black: {
|
|
37
|
+
DEFAULT: '#2d3232',
|
|
38
|
+
|
|
39
|
+
// Solids
|
|
40
|
+
superdark: '#1a1d1d',
|
|
41
|
+
100: '#2d3232',
|
|
42
|
+
95: '#424747',
|
|
43
|
+
90: '#575b5b',
|
|
44
|
+
85: '#5f6363',
|
|
45
|
+
80: '#6c7070',
|
|
46
|
+
70: '#818484',
|
|
47
|
+
60: '#969898',
|
|
48
|
+
50: '#abadad',
|
|
49
|
+
40: '#b3b5b5',
|
|
50
|
+
30: '#c0c2c2',
|
|
51
|
+
20: '#d5d6d6',
|
|
52
|
+
10: '#eaebeb',
|
|
53
|
+
5: '#f7f7f7',
|
|
54
|
+
0: '#fafafa',
|
|
55
|
+
warm: '#e6dcdc',
|
|
56
|
+
},
|
|
57
|
+
violet: {
|
|
58
|
+
// Solids
|
|
59
|
+
90: '#443185',
|
|
60
|
+
70: '#6449c4',
|
|
61
|
+
60: '#825fff',
|
|
62
|
+
50: '#9088ff',
|
|
63
|
+
40: '#c8d1ed',
|
|
64
|
+
20: '#e3e8f6',
|
|
65
|
+
},
|
|
66
|
+
green: {
|
|
67
|
+
90: '#006452',
|
|
68
|
+
75: '#00866E',
|
|
69
|
+
70: '#00a084',
|
|
70
|
+
60: '#00c8a5',
|
|
71
|
+
50: '#80dbb7',
|
|
72
|
+
40: '#bee1d4',
|
|
73
|
+
20: '#def0e9',
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
yellow: {
|
|
77
|
+
90: '#cc9000',
|
|
78
|
+
70: '#e6a200',
|
|
79
|
+
60: '#ffb400',
|
|
80
|
+
50: '#eec779',
|
|
81
|
+
40: '#e1d4be',
|
|
82
|
+
20: '#f0e9de',
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
red: {
|
|
86
|
+
90: '#992136',
|
|
87
|
+
70: '#cc2c48',
|
|
88
|
+
65: '#E52144',
|
|
89
|
+
60: '#ff375a',
|
|
90
|
+
50: '#ff8066',
|
|
91
|
+
40: '#e1c4be',
|
|
92
|
+
20: '#f0e1de',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
fontFamily: {
|
|
96
|
+
sans: [
|
|
97
|
+
'"Space Grotesk Frontify"',
|
|
98
|
+
'Arial',
|
|
99
|
+
'-apple-system',
|
|
100
|
+
'BlinkMacSystemFont',
|
|
101
|
+
'Segoe UI',
|
|
102
|
+
'Roboto',
|
|
103
|
+
'Helvetica',
|
|
104
|
+
'sans-serif',
|
|
105
|
+
'"Apple Color Emoji"',
|
|
106
|
+
'"Segoe UI Emoji"',
|
|
107
|
+
'"Segoe UI Symbol"',
|
|
108
|
+
],
|
|
109
|
+
mono: ['Menlo', 'Courier', 'monospace'],
|
|
110
|
+
},
|
|
111
|
+
fontSize: {
|
|
112
|
+
xxs: ['0.75rem', { letterSpacing: '0.02rem', lineHeight: '1rem' }],
|
|
113
|
+
xs: ['0.813rem', '1rem'],
|
|
114
|
+
s: ['0.875rem', '1rem'],
|
|
115
|
+
m: ['1rem', '1.25rem'],
|
|
116
|
+
l: ['1.125rem', '1.5rem'],
|
|
117
|
+
xl: ['1.5rem', '2rem'],
|
|
118
|
+
xxl: ['2rem', '2.5rem'],
|
|
119
|
+
xxxl: ['3rem', '3.5rem'],
|
|
120
|
+
},
|
|
121
|
+
transitionProperty: {
|
|
122
|
+
height: 'height',
|
|
123
|
+
width: 'width',
|
|
124
|
+
},
|
|
125
|
+
screens: {
|
|
126
|
+
xs: '480px',
|
|
127
|
+
sm: '600px',
|
|
128
|
+
md: '768px',
|
|
129
|
+
lg: '1024px',
|
|
130
|
+
xl: '1280px',
|
|
131
|
+
'2xl': '1536px',
|
|
132
|
+
},
|
|
133
|
+
animation: {
|
|
134
|
+
'loading-bar-infinite': 'loading-bar-infinite 1s infinite linear',
|
|
135
|
+
},
|
|
136
|
+
keyframes: {
|
|
137
|
+
'loading-bar-infinite': {
|
|
138
|
+
'0%': { transform: ' translateX(0) scaleX(0)' },
|
|
139
|
+
'40%': { transform: 'translateX(0) scaleX(0.4)' },
|
|
140
|
+
'100%': { transform: 'translateX(100%) scaleX(0.5)' },
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
transformOrigin: {
|
|
144
|
+
'left-right': '0% 50%',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
} satisfies Config;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2021",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2021", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUncheckedIndexedAccess": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"baseUrl": ".",
|
|
20
|
+
"paths": {
|
|
21
|
+
"#/*": ["./src/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": [".storybook", "src"],
|
|
25
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"baseUrl": ".",
|
|
9
|
+
"lib": ["ESNext"]
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
".eslintrc.cjs",
|
|
13
|
+
"tailwind.config.ts",
|
|
14
|
+
"vite.config.ts",
|
|
15
|
+
"postcss.config.cjs",
|
|
16
|
+
"package.json",
|
|
17
|
+
"playwright.config.ts",
|
|
18
|
+
"playwright",
|
|
19
|
+
"scripts"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import dts from 'vite-plugin-dts';
|
|
5
|
+
import tsConfigPaths from 'vite-tsconfig-paths';
|
|
6
|
+
import { configDefaults, defineConfig } from 'vitest/config';
|
|
7
|
+
|
|
8
|
+
import { dependencies as dependenciesMap, peerDependencies as peerDependenciesMap } from './package.json';
|
|
9
|
+
|
|
10
|
+
const peerDependencies = Object.keys(peerDependenciesMap);
|
|
11
|
+
const dependencies = Object.keys(dependenciesMap);
|
|
12
|
+
|
|
13
|
+
export const globals = {
|
|
14
|
+
react: 'React',
|
|
15
|
+
'react-dom': 'ReactDOM',
|
|
16
|
+
'react-dom/client': 'ReactDOMClient',
|
|
17
|
+
'react/jsx-runtime': 'react/jsx-runtime',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
plugins: [
|
|
22
|
+
react(),
|
|
23
|
+
tsConfigPaths(),
|
|
24
|
+
dts({ insertTypesEntry: true, rollupTypes: true, exclude: ['**/*.stories.tsx'] }),
|
|
25
|
+
],
|
|
26
|
+
build: {
|
|
27
|
+
lib: {
|
|
28
|
+
entry: './src/index.ts',
|
|
29
|
+
name: 'FondueComponents',
|
|
30
|
+
formats: ['es'],
|
|
31
|
+
},
|
|
32
|
+
sourcemap: true,
|
|
33
|
+
minify: true,
|
|
34
|
+
rollupOptions: {
|
|
35
|
+
external: [...dependencies, ...peerDependencies],
|
|
36
|
+
output: [
|
|
37
|
+
{
|
|
38
|
+
name: 'FondueComponents',
|
|
39
|
+
format: 'es',
|
|
40
|
+
preserveModules: true,
|
|
41
|
+
preserveModulesRoot: 'src',
|
|
42
|
+
globals,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
test: {
|
|
48
|
+
environment: 'happy-dom',
|
|
49
|
+
setupFiles: ['./src/setupTests.ts'],
|
|
50
|
+
css: true,
|
|
51
|
+
exclude: [...configDefaults.exclude, 'scripts/templates/**/*.**'],
|
|
52
|
+
coverage: {
|
|
53
|
+
exclude: [
|
|
54
|
+
...configDefaults.exclude,
|
|
55
|
+
'.storybook',
|
|
56
|
+
'playwright',
|
|
57
|
+
'scripts/templates',
|
|
58
|
+
'.eslintrc.cjs',
|
|
59
|
+
'**.config.{ts,cjs}',
|
|
60
|
+
'**/**/*.{ct,spec,test,stories}.{ts,tsx}',
|
|
61
|
+
],
|
|
62
|
+
enabled: true,
|
|
63
|
+
provider: 'v8',
|
|
64
|
+
reporter: ['text', 'lcov', 'html'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|