@liguelead/design-system 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.
Files changed (37) hide show
  1. package/components/Button/Button.appearance.ts +62 -0
  2. package/components/Button/Button.sizes.ts +41 -0
  3. package/components/Button/Button.styles.ts +50 -0
  4. package/components/Button/Button.tsx +70 -0
  5. package/components/Button/Button.types.ts +22 -0
  6. package/components/Button/index.ts +1 -0
  7. package/components/IconButton/IconButton.sizes.ts +41 -0
  8. package/components/IconButton/IconButton.tsx +67 -0
  9. package/components/IconButton/index.ts +1 -0
  10. package/components/PageWrapper/PageWrapper.tsx +31 -0
  11. package/components/PageWrapper/index.ts +1 -0
  12. package/components/Text/Text.styles.ts +43 -0
  13. package/components/Text/Text.tsx +65 -0
  14. package/components/Text/index.ts +1 -0
  15. package/components/TextField/TextField.sizes.ts +58 -0
  16. package/components/TextField/TextField.states.tsx +76 -0
  17. package/components/TextField/TextField.styles.ts +98 -0
  18. package/components/TextField/TextField.tsx +87 -0
  19. package/components/TextField/TextField.types.ts +21 -0
  20. package/components/TextField/index.ts +2 -0
  21. package/components/ThemeProvider/ThemeProvider.tsx +30 -0
  22. package/components/ThemeProvider/index.ts +1 -0
  23. package/components/ThemeProvider/style.ts +200 -0
  24. package/components/Wizard/StepContent.tsx +28 -0
  25. package/components/Wizard/StepMenuItem.tsx +33 -0
  26. package/components/Wizard/Wizard.context.tsx +76 -0
  27. package/components/Wizard/Wizard.styles.ts +126 -0
  28. package/components/Wizard/Wizard.tsx +55 -0
  29. package/components/Wizard/index.ts +1 -0
  30. package/components/index.ts +7 -0
  31. package/package.json +32 -0
  32. package/utils/colorDarken.ts +10 -0
  33. package/utils/colorLighten.ts +10 -0
  34. package/utils/darkenOrLighen.ts +19 -0
  35. package/utils/getTextColor.ts +12 -0
  36. package/utils/index.ts +5 -0
  37. package/utils/parseColor.ts +7 -0
@@ -0,0 +1,55 @@
1
+ import React, { ReactElement } from 'react'
2
+
3
+ import StepContent from './StepContent'
4
+ import StepMenuItem from './StepMenuItem'
5
+ import { WizardContextProvider } from './Wizard.context'
6
+ import { WizardWrapper, WizardMenu, WizardContent, WizardMenuList } from './Wizard.styles'
7
+
8
+ type StepProps = {
9
+ label?: string
10
+ stepNumber?: number
11
+ }
12
+
13
+ type WizardStep = ReactElement<StepProps>
14
+
15
+ interface WizardProps {
16
+ children: WizardStep[]
17
+ menuNavigation?: boolean
18
+ }
19
+
20
+ function Wizard({ menuNavigation = true, children }: Readonly<WizardProps>) {
21
+ if (!children) {
22
+ return <div>Necessário criar os Wizards Steps</div>
23
+ }
24
+
25
+ const totalSteps = children.length
26
+
27
+ return (
28
+ <WizardContextProvider totalSteps={totalSteps}>
29
+ <WizardWrapper>
30
+ <WizardMenu>
31
+ <WizardMenuList>
32
+ {children.map((item, index) => (
33
+ <StepMenuItem
34
+ menuNavigation={menuNavigation}
35
+ key={index}
36
+ stepNumber={index + 1}
37
+ label={item.props.label}
38
+ />
39
+ ))}
40
+ </WizardMenuList>
41
+ </WizardMenu>
42
+ <WizardContent>
43
+ {React.Children.map(children, (child, index) => {
44
+ return React.cloneElement(child, {
45
+ stepNumber: index + 1
46
+ })
47
+ })}
48
+ </WizardContent>
49
+ </WizardWrapper>
50
+ </WizardContextProvider>
51
+ )
52
+ }
53
+
54
+ Wizard.Step = StepContent
55
+ export default Wizard
@@ -0,0 +1 @@
1
+ export { default } from './Wizard'
@@ -0,0 +1,7 @@
1
+ export { default as Button } from './Button'
2
+ export { default as IconButton } from './IconButton'
3
+ export { default as PageWrapper } from './PageWrapper'
4
+ export { default as Text } from './Text'
5
+ export { default as TextField } from './TextField'
6
+ export { default as ThemeProvider } from './ThemeProvider'
7
+ export { default as Wizard } from './Wizard'
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@liguelead/design-system",
3
+ "version": "0.0.1",
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
+ },
13
+ "scripts": {
14
+ "lint": "eslint ."
15
+ },
16
+ "files": [
17
+ "components/",
18
+ "utils/"
19
+ ],
20
+ "devDependencies": {
21
+ "@eslint/js": "^9.13.0",
22
+ "@types/react": "^18.3.12",
23
+ "eslint": "^9.13.0",
24
+ "eslint-plugin-react-hooks": "^5.0.0",
25
+ "eslint-plugin-react-refresh": "^0.4.14",
26
+ "globals": "^15.11.0",
27
+ "react": "^18.3.1",
28
+ "styled-components": "6.1.13",
29
+ "typescript": "5.6.2",
30
+ "typescript-eslint": "^8.11.0"
31
+ }
32
+ }
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
package/utils/index.ts ADDED
@@ -0,0 +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'
@@ -0,0 +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