@liguelead/design-system 0.0.8 → 0.0.10
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/components/Button/Button.appearance.ts +62 -62
- package/components/Button/Button.sizes.ts +41 -41
- package/components/Button/Button.styles.ts +50 -50
- package/components/Button/Button.tsx +76 -76
- package/components/Button/Button.types.ts +23 -23
- package/components/Button/index.ts +1 -1
- package/components/Checkbox/Checkbox.styles.ts +66 -66
- package/components/Checkbox/Checkbox.tsx +40 -40
- package/components/Checkbox/Checkbox.types.ts +11 -11
- package/components/Checkbox/index.tsx +2 -2
- package/components/DatePicker/DatePicker.styles.ts +66 -66
- package/components/DatePicker/DatePicker.tsx +135 -135
- package/components/DatePicker/DatePicker.types.ts +29 -29
- package/components/DatePicker/index.ts +1 -1
- package/components/IconButton/IconButton.sizes.ts +41 -41
- package/components/IconButton/IconButton.tsx +70 -70
- package/components/IconButton/index.ts +1 -1
- package/components/PageWrapper/PageWrapper.tsx +31 -31
- package/components/PageWrapper/index.ts +1 -1
- package/components/SegmentedButton/SegmentedButton.styles.ts +29 -29
- package/components/SegmentedButton/SegmentedButton.tsx +49 -49
- package/components/SegmentedButton/SegmentedButton.types.ts +20 -20
- package/components/SegmentedButton/index.ts +1 -1
- package/components/Select/Select.sizes.ts +56 -56
- package/components/Select/Select.states.tsx +69 -69
- package/components/Select/Select.styles.ts +148 -148
- package/components/Select/Select.tsx +145 -144
- package/components/Select/Select.types.ts +36 -36
- package/components/Select/index.ts +1 -1
- package/components/Text/Text.styles.ts +43 -43
- package/components/Text/Text.tsx +27 -27
- package/components/Text/Text.types.ts +42 -42
- package/components/Text/index.ts +1 -1
- package/components/TextField/TextField.sizes.ts +58 -58
- package/components/TextField/TextField.states.tsx +53 -76
- package/components/TextField/TextField.styles.ts +81 -98
- package/components/TextField/TextField.tsx +105 -108
- package/components/TextField/TextField.types.ts +22 -21
- package/components/TextField/index.ts +2 -2
- package/components/TextField/utils/getState.ts +7 -0
- package/components/ThemeProvider/ThemeProvider.tsx +21 -21
- package/components/ThemeProvider/index.ts +1 -1
- package/components/ThemeProvider/style.ts +969 -969
- package/components/Wizard/StepContent.tsx +28 -28
- package/components/Wizard/StepMenuItem.tsx +33 -33
- package/components/Wizard/Wizard.context.tsx +76 -76
- package/components/Wizard/Wizard.styles.ts +126 -126
- package/components/Wizard/Wizard.tsx +55 -55
- package/components/Wizard/index.ts +1 -1
- package/components/index.ts +11 -11
- package/package.json +41 -39
- package/scripts/createTypes.js +70 -70
- package/utils/colorDarken.ts +10 -10
- package/utils/colorLighten.ts +10 -10
- package/utils/darkenOrLighen.ts +19 -19
- package/utils/getTextColor.ts +12 -12
- package/utils/index.ts +5 -5
- package/utils/parseColor.ts +7 -7
package/package.json
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@liguelead/design-system",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "components/index.ts",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@liguelead/foundation": "^0.0.11",
|
|
11
|
-
"@phosphor-icons/react": "^2.1.7",
|
|
12
|
-
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
13
|
-
"@radix-ui/react-select": "^2.1.6"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"eslint": "^9.13.0",
|
|
30
|
-
"
|
|
31
|
-
"eslint
|
|
32
|
-
"
|
|
33
|
-
"react": "^
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@liguelead/design-system",
|
|
3
|
+
"version": "0.0.10",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "components/index.ts",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@liguelead/foundation": "^0.0.11",
|
|
11
|
+
"@phosphor-icons/react": "^2.1.7",
|
|
12
|
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
13
|
+
"@radix-ui/react-select": "^2.1.6",
|
|
14
|
+
"lodash": "^4.17.21",
|
|
15
|
+
"react-datepicker": "^7.6.0"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"lint": "eslint ."
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"ll-create-types": "./scripts/createTypes.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"components/",
|
|
25
|
+
"utils/",
|
|
26
|
+
"scripts/"
|
|
27
|
+
],
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@eslint/js": "^9.13.0",
|
|
30
|
+
"@types/react": "^18.3.12",
|
|
31
|
+
"eslint": "^9.13.0",
|
|
32
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
33
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
34
|
+
"globals": "^15.11.0",
|
|
35
|
+
"react": "^18.3.1",
|
|
36
|
+
"styled-components": "6.1.13",
|
|
37
|
+
"typescript": "5.6.2",
|
|
38
|
+
"typescript-eslint": "^8.11.0",
|
|
39
|
+
"vite-tsconfig-paths": "^5.1.3"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/scripts/createTypes.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
|
|
6
|
-
// Diretório e arquivos que queremos criar
|
|
7
|
-
const dir = path.resolve(process.cwd(), './')
|
|
8
|
-
const srcDir = path.resolve(process.cwd(), 'src')
|
|
9
|
-
const typesDir = path.join(srcDir, 'types')
|
|
10
|
-
const indexFile = path.join(typesDir, 'index.ts')
|
|
11
|
-
const typesFile = path.join(typesDir, 'types.ts')
|
|
12
|
-
const tsconfigApp = path.join(dir, 'tsconfig.json')
|
|
13
|
-
const viteConfig = path.join(dir, 'vite.config.ts')
|
|
14
|
-
|
|
15
|
-
// Função para criar pasta e arquivos
|
|
16
|
-
const createOrUpdateTypes = () => {
|
|
17
|
-
const viteConfigContent = `
|
|
18
|
-
// vite.config.ts
|
|
19
|
-
import { defineConfig } from 'vite';
|
|
20
|
-
import react from '@vitejs/plugin-react';
|
|
21
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
22
|
-
|
|
23
|
-
export default defineConfig({
|
|
24
|
-
plugins: [react(), tsconfigPaths()],
|
|
25
|
-
});
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
const tsconfigAppContent = `{
|
|
29
|
-
"compilerOptions": {
|
|
30
|
-
// Configurações de compilação base
|
|
31
|
-
"baseUrl": "./src"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`
|
|
35
|
-
fs.writeFileSync(tsconfigApp, tsconfigAppContent, 'utf8')
|
|
36
|
-
console.log(`Arquivo sobrescrito: ${tsconfigApp}`)
|
|
37
|
-
|
|
38
|
-
fs.writeFileSync(viteConfig, viteConfigContent, 'utf8')
|
|
39
|
-
console.log(`Arquivo sobrescrito: ${viteConfig}`)
|
|
40
|
-
|
|
41
|
-
if (!fs.existsSync(srcDir)) {
|
|
42
|
-
console.error(
|
|
43
|
-
'A pasta "src" não foi encontrada. Certifique-se de que ela existe.'
|
|
44
|
-
)
|
|
45
|
-
process.exit(1)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!fs.existsSync(typesDir)) {
|
|
49
|
-
fs.mkdirSync(typesDir, { recursive: true })
|
|
50
|
-
console.log(`Pasta criada: ${typesDir}`)
|
|
51
|
-
} else {
|
|
52
|
-
console.log(`A pasta já existe: ${typesDir}`)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!fs.existsSync(indexFile)) {
|
|
56
|
-
const indexFileContent = `export type {colorType} from './types'`
|
|
57
|
-
fs.writeFileSync(indexFile, indexFileContent, 'utf8')
|
|
58
|
-
console.log(`Arquivo criado: ${indexFile}`)
|
|
59
|
-
} else {
|
|
60
|
-
console.log(`O arquivo já existe e não será modificado: ${indexFile}`)
|
|
61
|
-
}
|
|
62
|
-
const typesFileContent = `import {DefaultTheme} from 'styled-components'
|
|
63
|
-
export type colorType = keyof DefaultTheme['colors']`
|
|
64
|
-
|
|
65
|
-
fs.writeFileSync(typesFile, typesFileContent, 'utf8')
|
|
66
|
-
console.log(`Arquivo sobrescrito: ${typesFile}`)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Executa a função
|
|
70
|
-
createOrUpdateTypes()
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
|
|
6
|
+
// Diretório e arquivos que queremos criar
|
|
7
|
+
const dir = path.resolve(process.cwd(), './')
|
|
8
|
+
const srcDir = path.resolve(process.cwd(), 'src')
|
|
9
|
+
const typesDir = path.join(srcDir, 'types')
|
|
10
|
+
const indexFile = path.join(typesDir, 'index.ts')
|
|
11
|
+
const typesFile = path.join(typesDir, 'types.ts')
|
|
12
|
+
const tsconfigApp = path.join(dir, 'tsconfig.json')
|
|
13
|
+
const viteConfig = path.join(dir, 'vite.config.ts')
|
|
14
|
+
|
|
15
|
+
// Função para criar pasta e arquivos
|
|
16
|
+
const createOrUpdateTypes = () => {
|
|
17
|
+
const viteConfigContent = `
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import { defineConfig } from 'vite';
|
|
20
|
+
import react from '@vitejs/plugin-react';
|
|
21
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
plugins: [react(), tsconfigPaths()],
|
|
25
|
+
});
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
const tsconfigAppContent = `{
|
|
29
|
+
"compilerOptions": {
|
|
30
|
+
// Configurações de compilação base
|
|
31
|
+
"baseUrl": "./src"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
fs.writeFileSync(tsconfigApp, tsconfigAppContent, 'utf8')
|
|
36
|
+
console.log(`Arquivo sobrescrito: ${tsconfigApp}`)
|
|
37
|
+
|
|
38
|
+
fs.writeFileSync(viteConfig, viteConfigContent, 'utf8')
|
|
39
|
+
console.log(`Arquivo sobrescrito: ${viteConfig}`)
|
|
40
|
+
|
|
41
|
+
if (!fs.existsSync(srcDir)) {
|
|
42
|
+
console.error(
|
|
43
|
+
'A pasta "src" não foi encontrada. Certifique-se de que ela existe.'
|
|
44
|
+
)
|
|
45
|
+
process.exit(1)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!fs.existsSync(typesDir)) {
|
|
49
|
+
fs.mkdirSync(typesDir, { recursive: true })
|
|
50
|
+
console.log(`Pasta criada: ${typesDir}`)
|
|
51
|
+
} else {
|
|
52
|
+
console.log(`A pasta já existe: ${typesDir}`)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!fs.existsSync(indexFile)) {
|
|
56
|
+
const indexFileContent = `export type {colorType} from './types'`
|
|
57
|
+
fs.writeFileSync(indexFile, indexFileContent, 'utf8')
|
|
58
|
+
console.log(`Arquivo criado: ${indexFile}`)
|
|
59
|
+
} else {
|
|
60
|
+
console.log(`O arquivo já existe e não será modificado: ${indexFile}`)
|
|
61
|
+
}
|
|
62
|
+
const typesFileContent = `import {DefaultTheme} from 'styled-components'
|
|
63
|
+
export type colorType = keyof DefaultTheme['colors']`
|
|
64
|
+
|
|
65
|
+
fs.writeFileSync(typesFile, typesFileContent, 'utf8')
|
|
66
|
+
console.log(`Arquivo sobrescrito: ${typesFile}`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Executa a função
|
|
70
|
+
createOrUpdateTypes()
|
package/utils/colorDarken.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const darken = (amount: number, color: string): string => {
|
|
2
|
-
const value = Math.max(0, Math.min(1, amount))
|
|
3
|
-
const colorValue = parseInt(color.slice(1), 16)
|
|
4
|
-
const r = Math.max(0, Math.min(255, (colorValue >> 16) - Math.round(255 * value)))
|
|
5
|
-
const g = Math.max(0, Math.min(255, ((colorValue >> 8) & 0x00ff) - Math.round(255 * value)))
|
|
6
|
-
const b = Math.max(0, Math.min(255, (colorValue & 0x0000ff) - Math.round(255 * value)))
|
|
7
|
-
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default darken
|
|
1
|
+
const darken = (amount: number, color: string): string => {
|
|
2
|
+
const value = Math.max(0, Math.min(1, amount))
|
|
3
|
+
const colorValue = parseInt(color.slice(1), 16)
|
|
4
|
+
const r = Math.max(0, Math.min(255, (colorValue >> 16) - Math.round(255 * value)))
|
|
5
|
+
const g = Math.max(0, Math.min(255, ((colorValue >> 8) & 0x00ff) - Math.round(255 * value)))
|
|
6
|
+
const b = Math.max(0, Math.min(255, (colorValue & 0x0000ff) - Math.round(255 * value)))
|
|
7
|
+
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default darken
|
package/utils/colorLighten.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const lighten = (amount: number, color: string): string => {
|
|
2
|
-
const value = Math.max(0, Math.min(1, amount))
|
|
3
|
-
const colorValue = parseInt(color.slice(1), 16)
|
|
4
|
-
const r = Math.min(255, (colorValue >> 16) + Math.round(255 * value))
|
|
5
|
-
const g = Math.min(255, ((colorValue >> 8) & 0x00ff) + Math.round(255 * value))
|
|
6
|
-
const b = Math.min(255, (colorValue & 0x0000ff) + Math.round(255 * value))
|
|
7
|
-
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default lighten
|
|
1
|
+
const lighten = (amount: number, color: string): string => {
|
|
2
|
+
const value = Math.max(0, Math.min(1, amount))
|
|
3
|
+
const colorValue = parseInt(color.slice(1), 16)
|
|
4
|
+
const r = Math.min(255, (colorValue >> 16) + Math.round(255 * value))
|
|
5
|
+
const g = Math.min(255, ((colorValue >> 8) & 0x00ff) + Math.round(255 * value))
|
|
6
|
+
const b = Math.min(255, (colorValue & 0x0000ff) + Math.round(255 * value))
|
|
7
|
+
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default lighten
|
package/utils/darkenOrLighen.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import darken from './colorDarken'
|
|
2
|
-
import lighten from './colorLighten'
|
|
3
|
-
|
|
4
|
-
const darkenOrLighten = (amount: number, bgColor: string): string => {
|
|
5
|
-
const hex = bgColor.replace('#', '')
|
|
6
|
-
const r = parseInt(hex.substring(0, 2), 16)
|
|
7
|
-
const g = parseInt(hex.substring(2, 4), 16)
|
|
8
|
-
const b = parseInt(hex.substring(4, 6), 16)
|
|
9
|
-
|
|
10
|
-
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b
|
|
11
|
-
|
|
12
|
-
if (luminance < 95) {
|
|
13
|
-
return lighten(amount, bgColor)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return darken(amount, bgColor)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default darkenOrLighten
|
|
1
|
+
import darken from './colorDarken'
|
|
2
|
+
import lighten from './colorLighten'
|
|
3
|
+
|
|
4
|
+
const darkenOrLighten = (amount: number, bgColor: string): string => {
|
|
5
|
+
const hex = bgColor.replace('#', '')
|
|
6
|
+
const r = parseInt(hex.substring(0, 2), 16)
|
|
7
|
+
const g = parseInt(hex.substring(2, 4), 16)
|
|
8
|
+
const b = parseInt(hex.substring(4, 6), 16)
|
|
9
|
+
|
|
10
|
+
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b
|
|
11
|
+
|
|
12
|
+
if (luminance < 95) {
|
|
13
|
+
return lighten(amount, bgColor)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return darken(amount, bgColor)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default darkenOrLighten
|
package/utils/getTextColor.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const getTextColor = (bgColor: string): 'neutral50' | 'neutral1000' => {
|
|
2
|
-
const hex = bgColor.replace('#', '')
|
|
3
|
-
const r = parseInt(hex.substring(0, 2), 16)
|
|
4
|
-
const g = parseInt(hex.substring(2, 4), 16)
|
|
5
|
-
const b = parseInt(hex.substring(4, 6), 16)
|
|
6
|
-
|
|
7
|
-
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b
|
|
8
|
-
|
|
9
|
-
return luminance < 128 ? 'neutral50' : 'neutral1000'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default getTextColor
|
|
1
|
+
const getTextColor = (bgColor: string): 'neutral50' | 'neutral1000' => {
|
|
2
|
+
const hex = bgColor.replace('#', '')
|
|
3
|
+
const r = parseInt(hex.substring(0, 2), 16)
|
|
4
|
+
const g = parseInt(hex.substring(2, 4), 16)
|
|
5
|
+
const b = parseInt(hex.substring(4, 6), 16)
|
|
6
|
+
|
|
7
|
+
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b
|
|
8
|
+
|
|
9
|
+
return luminance < 128 ? 'neutral50' : 'neutral1000'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default getTextColor
|
package/utils/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {default as parseColor} from './parseColor'
|
|
2
|
-
export {default as getTextColor} from './getTextColor'
|
|
3
|
-
export {default as darken} from './colorDarken'
|
|
4
|
-
export {default as lighten} from './colorLighten'
|
|
5
|
-
export {default as darkenOrLighten} from './darkenOrLighen'
|
|
1
|
+
export {default as parseColor} from './parseColor'
|
|
2
|
+
export {default as getTextColor} from './getTextColor'
|
|
3
|
+
export {default as darken} from './colorDarken'
|
|
4
|
+
export {default as lighten} from './colorLighten'
|
|
5
|
+
export {default as darkenOrLighten} from './darkenOrLighen'
|
package/utils/parseColor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { colors, ColorsInterface } from '@liguelead/foundation'
|
|
2
|
-
|
|
3
|
-
const parseColor = (themeColor: keyof ColorsInterface) => {
|
|
4
|
-
return colors[themeColor]
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default parseColor
|
|
1
|
+
import { colors, ColorsInterface } from '@liguelead/foundation'
|
|
2
|
+
|
|
3
|
+
const parseColor = (themeColor: keyof ColorsInterface) => {
|
|
4
|
+
return colors[themeColor]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default parseColor
|