@granto-umbrella/umbrella-components 3.0.34 → 3.0.36

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 (156) hide show
  1. package/README.md +165 -27
  2. package/dist/umbrella-components.css +1 -1
  3. package/dist/umbrella-components.es.js +28129 -29249
  4. package/dist/umbrella-components.umd.js +1234 -2181
  5. package/package.json +135 -106
  6. package/src/assets.d.ts +19 -19
  7. package/src/components/atoms/Badge/Badge.styles.ts +88 -86
  8. package/src/components/atoms/Badge/Badge.tsx +42 -44
  9. package/src/components/atoms/Badge/Badge.types.ts +15 -15
  10. package/src/components/atoms/Breadcrumb/Breadcrumb.styles.ts +43 -43
  11. package/src/components/atoms/Breadcrumb/Breadcrumb.tsx +46 -48
  12. package/src/components/atoms/Breadcrumb/Breadcrumb.types.ts +12 -12
  13. package/src/components/atoms/Button/Button.styles.ts +279 -280
  14. package/src/components/atoms/Button/Button.tsx +76 -76
  15. package/src/components/atoms/Button/Button.types.ts +28 -28
  16. package/src/components/atoms/Button/index.ts +1 -1
  17. package/src/components/atoms/Checkbox/Checkbox.styles.ts +72 -72
  18. package/src/components/atoms/Checkbox/Checkbox.tsx +36 -36
  19. package/src/components/atoms/Checkbox/Checkbox.types.ts +14 -14
  20. package/src/components/atoms/Checkbox/CheckboxGroup.tsx +30 -30
  21. package/src/components/atoms/Checkbox/CheckboxSelectAll.tsx +32 -32
  22. package/src/components/atoms/CodeInput/CodeInput.styles.tsx +38 -39
  23. package/src/components/atoms/CodeInput/CodeInput.tsx +13 -19
  24. package/src/components/atoms/CodeInput/CodeInput.types.ts +3 -3
  25. package/src/components/atoms/CodeInput/index.tsx +1 -1
  26. package/src/components/atoms/DropDownMenu/DropdownMenu.tsx +48 -48
  27. package/src/components/atoms/DropDownMenu/DropdownMenu.types.ts +15 -15
  28. package/src/components/atoms/DropDownMenu/index.tsx +5 -2
  29. package/src/components/atoms/ErrorMessage/ErrorMessage.styles.tsx +28 -28
  30. package/src/components/atoms/ErrorMessage/ErrorMessage.tsx +12 -12
  31. package/src/components/atoms/ErrorMessage/ErrorMessage.types.ts +6 -6
  32. package/src/components/atoms/ErrorMessage/index.tsx +1 -1
  33. package/src/components/atoms/Footer/Footer.styles.tsx +22 -22
  34. package/src/components/atoms/Footer/Footer.tsx +9 -9
  35. package/src/components/atoms/Footer/Footer.types.tsx +5 -5
  36. package/src/components/atoms/Footer/index.tsx +1 -1
  37. package/src/components/atoms/GenericContainer/GenericContainer.styles.tsx +21 -21
  38. package/src/components/atoms/GenericContainer/GenericContainer.tsx +9 -9
  39. package/src/components/atoms/GenericContainer/GenericContainer.types.ts +5 -5
  40. package/src/components/atoms/GenericContainer/index.tsx +1 -1
  41. package/src/components/atoms/Icon/Icon.styles.ts +11 -11
  42. package/src/components/atoms/Icon/Icon.tsx +22 -22
  43. package/src/components/atoms/Icon/Icon.types.ts +6 -6
  44. package/src/components/atoms/Icon/index.ts +1 -1
  45. package/src/components/atoms/Input/Input.styles.ts +106 -101
  46. package/src/components/atoms/Input/index.ts +1 -1
  47. package/src/components/atoms/Label/Label.tsx +16 -16
  48. package/src/components/atoms/Loading/Loading.styles.tsx +25 -25
  49. package/src/components/atoms/Loading/Loading.tsx +8 -8
  50. package/src/components/atoms/LogoContainer/LogoContainer.Types.tsx +5 -5
  51. package/src/components/atoms/LogoContainer/LogoContainer.styles.tsx +11 -11
  52. package/src/components/atoms/LogoContainer/LogoContainer.tsx +11 -11
  53. package/src/components/atoms/LogoContainer/index.tsx +1 -1
  54. package/src/components/atoms/ModalAviso/ModalAviso.styles.tsx +56 -56
  55. package/src/components/atoms/ModalAviso/ModalAviso.tsx +43 -37
  56. package/src/components/atoms/ModalAviso/ModalAviso.types.ts +5 -5
  57. package/src/components/atoms/ModalAviso/index.tsx +1 -1
  58. package/src/components/atoms/MultiSelect/MultiSelect.styles.tsx +100 -92
  59. package/src/components/atoms/MultiSelect/MultiSelect.tsx +346 -346
  60. package/src/components/atoms/MultiSelect/MultiSelect.types.ts +38 -38
  61. package/src/components/atoms/Pill/Pill.styles.ts +46 -46
  62. package/src/components/atoms/Pill/Pill.tsx +35 -36
  63. package/src/components/atoms/Pill/Pill.types.ts +14 -18
  64. package/src/components/atoms/RadioButton/RadioButton.styles.ts +44 -43
  65. package/src/components/atoms/RadioButton/RadioButton.tsx +31 -31
  66. package/src/components/atoms/ResendLink/ResendLink.styles.tsx +19 -20
  67. package/src/components/atoms/ResendLink/ResendLink.tsx +21 -21
  68. package/src/components/atoms/ResendLink/ResendLink.types.ts +8 -9
  69. package/src/components/atoms/ResendLink/index.tsx +1 -2
  70. package/src/components/atoms/Select/Select.styles.ts +153 -149
  71. package/src/components/atoms/Select/Select.tsx +52 -43
  72. package/src/components/atoms/Select/index.tsx +1 -1
  73. package/src/components/atoms/Subtitle/Subtitle.tsx +7 -7
  74. package/src/components/atoms/Subtitle/Subtitle.types.ts +5 -5
  75. package/src/components/atoms/Subtitle/index.tsx +1 -1
  76. package/src/components/atoms/Switch/Switch.tsx +25 -25
  77. package/src/components/atoms/TabBar/TabBar.styles.tsx +64 -57
  78. package/src/components/atoms/TabBar/index.tsx +2 -2
  79. package/src/components/atoms/Text/Text.styles.tsx +35 -35
  80. package/src/components/atoms/Text/Text.tsx +32 -31
  81. package/src/components/atoms/Text/Text.types.ts +8 -8
  82. package/src/components/atoms/Text/index.ts +1 -1
  83. package/src/components/atoms/Textarea/Textarea.styles.ts +52 -52
  84. package/src/components/atoms/Textarea/Textarea.tsx +31 -31
  85. package/src/components/atoms/Title/Title.tsx +7 -7
  86. package/src/components/atoms/Title/Title.types.ts +5 -5
  87. package/src/components/atoms/Title/index.tsx +1 -1
  88. package/src/components/molecules/BannerAjuda/BannerAjuda.styles.tsx +9 -9
  89. package/src/components/molecules/BannerAjuda/BannerAjuda.tsx +18 -19
  90. package/src/components/molecules/BannerAjuda/index.tsx +1 -1
  91. package/src/components/molecules/ButtonGroup/ButtonGroup.styles.ts +10 -10
  92. package/src/components/molecules/ButtonGroup/ButtonGroup.types.ts +22 -22
  93. package/src/components/molecules/Calendar/Calendar.styles.ts +143 -143
  94. package/src/components/molecules/Calendar/Calendar.tsx +31 -31
  95. package/src/components/molecules/CodeInputContainer/CodeInputContainer.styles.tsx +7 -7
  96. package/src/components/molecules/CodeInputContainer/CodeInputContainer.types.ts +13 -13
  97. package/src/components/molecules/CodeInputContainer/index.tsx +1 -3
  98. package/src/components/molecules/ExcludeModal/ExcludeModal.styles.tsx +123 -118
  99. package/src/components/molecules/ExcludeModal/ExcludeModal.tsx +48 -48
  100. package/src/components/molecules/ExcludeModal/ExcludeModal.types.ts +10 -10
  101. package/src/components/molecules/ExcludeModal/index.tsx +1 -1
  102. package/src/components/molecules/FieldSelector/FieldSelector.styles.ts +59 -0
  103. package/src/components/molecules/FieldSelector/FieldSelector.tsx +167 -0
  104. package/src/components/molecules/HighlightsCard/HighlightsCard.styles.tsx +67 -68
  105. package/src/components/molecules/HighlightsCard/HighlightsCard.tsx +35 -26
  106. package/src/components/molecules/HighlightsCard/HighlightsCard.types.ts +10 -10
  107. package/src/components/molecules/HighlightsCard/index.tsx +1 -1
  108. package/src/components/molecules/InsuranceCard/InsuranceCard.styles.tsx +237 -237
  109. package/src/components/molecules/InsuranceCard/index.tsx +1 -1
  110. package/src/components/molecules/PieChartComponent/PieChartComponent.styles.tsx +7 -8
  111. package/src/components/molecules/PieChartComponent/PieChartComponent.tsx +70 -73
  112. package/src/components/molecules/PieChartComponent/PieChartComponent.types.ts +11 -11
  113. package/src/components/molecules/PieChartComponent/index.tsx +1 -1
  114. package/src/components/molecules/Popover/Popover.styles.ts +66 -65
  115. package/src/components/molecules/Popover/Popover.tsx +23 -23
  116. package/src/components/molecules/RadioBoxGroup/RadioBoxGroup.styles.ts +11 -11
  117. package/src/components/molecules/RadioBoxGroup/RadioBoxGroup.tsx +43 -43
  118. package/src/components/molecules/RadioGroupField/RadioGroupField.styles.tsx +65 -64
  119. package/src/components/molecules/RadioGroupField/RadioGroupField.tsx +69 -69
  120. package/src/components/molecules/RadioGroupField/RadioGroupField.types.ts +17 -17
  121. package/src/components/molecules/RadioGroupField/index.tsx +1 -1
  122. package/src/components/molecules/RefuseModal/RefuseModal.styles.tsx +139 -139
  123. package/src/components/molecules/RefuseModal/RefuseModal.tsx +92 -76
  124. package/src/components/molecules/RefuseModal/RefuseModal.types.ts +15 -15
  125. package/src/components/molecules/RefuseModal/index.tsx +2 -2
  126. package/src/components/molecules/ResultsChart/ResultsChart.tsx +23 -19
  127. package/src/components/molecules/ResultsChart/ResultsChart.types.ts +3 -3
  128. package/src/components/molecules/ResultsChart/index.tsx +2 -2
  129. package/src/components/molecules/TabToggle/TabToggle.styles.ts +54 -54
  130. package/src/components/molecules/TabToggle/TabToggle.tsx +35 -35
  131. package/src/components/organisms/AlertDialog/AlertDialog.styles.tsx +61 -61
  132. package/src/components/organisms/AlertDialog/AlertDialog.tsx +70 -70
  133. package/src/components/organisms/Dialog/Dialog.styles.ts +107 -106
  134. package/src/components/organisms/Dialog/Dialog.tsx +69 -69
  135. package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.styles.tsx +113 -113
  136. package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.tsx +75 -71
  137. package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.types.ts +9 -9
  138. package/src/components/organisms/DonutEmissionsChart/index.tsx +5 -2
  139. package/src/components/organisms/Form/Form.styles.ts +35 -35
  140. package/src/components/organisms/Form/Form.tsx +160 -160
  141. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.styles.tsx +115 -114
  142. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.tsx +89 -89
  143. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.types.ts +16 -16
  144. package/src/components/organisms/ListagemUltimasEmissoes/index.tsx +1 -1
  145. package/src/components/organisms/Navbar/Navbar.styles.tsx +243 -243
  146. package/src/global.d.ts +9 -9
  147. package/src/index.ts +2 -0
  148. package/src/lib/utils.ts +6 -6
  149. package/src/styles/tokens/borders.ts +17 -17
  150. package/src/styles/tokens/index.tsx +6 -6
  151. package/src/styles/tokens/radius.ts +22 -22
  152. package/src/styles/tokens/shadows.ts +22 -22
  153. package/src/styles/tokens/sizes.ts +60 -64
  154. package/src/types/radius.types.ts +1 -1
  155. package/src/types/shadows.types.ts +1 -1
  156. package/src/utils/renderHighlightsCard.tsx +21 -0
package/package.json CHANGED
@@ -1,106 +1,135 @@
1
- {
2
- "name": "@granto-umbrella/umbrella-components",
3
- "version": "3.0.34",
4
- "description": "Umbrella Components for React",
5
- "type": "module",
6
- "main": "src/index.js",
7
- "module": "src/index.js",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/grantoseguros/granto-umbrella-components.git"
11
- },
12
- "scripts": {
13
- "dev": "vite",
14
- "build": "tsc -b && vite build",
15
- "lint": "eslint .",
16
- "preview": "vite preview",
17
- "storybook": "storybook dev -p 6006",
18
- "build-storybook": "storybook build",
19
- "predeploy": "npm run build-storybook",
20
- "deploy": "gh-pages -d storybook-static",
21
- "test": "jest",
22
- "test:watch": "jest --watch",
23
- "test:coverage": "jest --coverage",
24
- "version": "npm run build && git add .",
25
- "release:patch": "npm version patch && git push && git push --tags",
26
- "release:minor": "npm version minor && git push && git push --tags",
27
- "release:major": "npm version major && git push && git push --tags",
28
- "bump:patch": "npm version patch",
29
- "bump:minor": "npm version minor",
30
- "bump:major": "npm version major"
31
- },
32
- "dependencies": {
33
- "@phosphor-icons/react": "^2.1.10",
34
- "@radix-ui/react-dialog": "^1.1.15",
35
- "@radix-ui/react-label": "^2.1.3",
36
- "@radix-ui/react-popover": "^1.1.11",
37
- "@radix-ui/react-radio-group": "^1.2.4",
38
- "cpf-cnpj-validator": "^1.0.3",
39
- "date-fns": "^4.1.0",
40
- "lucide-react": "^0.488.0",
41
- "make-mask": "^1.0.3",
42
- "phosphor-react": "^1.4.1",
43
- "radix": "^0.0.0",
44
- "react": "^18.3.1",
45
- "react-datepicker": "^8.3.0",
46
- "react-day-picker": "^9.6.7",
47
- "react-dom": "^18.3.1",
48
- "react-hook-form": "^7.63.0",
49
- "react-router": "^6.30.1",
50
- "react-router-dom": "^6.30.1",
51
- "react-select": "^5.10.0",
52
- "recharts": "^3.2.1",
53
- "tailwind-merge": "^3.2.0"
54
- },
55
- "devDependencies": {
56
- "@chromatic-com/storybook": "4.1.1",
57
- "@eslint/js": "^9.17.0",
58
- "@storybook/addon-actions": "8.4.7",
59
- "@storybook/addon-essentials": "8.4.7",
60
- "@storybook/addon-interactions": "8.4.7",
61
- "@storybook/addon-onboarding": "9.1.15",
62
- "@storybook/react-vite": "9.1.15",
63
- "@testing-library/jest-dom": "^6.6.3",
64
- "@testing-library/react": "^16.1.0",
65
- "@testing-library/user-event": "^14.5.2",
66
- "@types/mocha": "^10.0.10",
67
- "@types/react": "^18.3.17",
68
- "@types/react-dom": "^18.3.5",
69
- "@types/styled-components": "^5.1.34",
70
- "@vitejs/plugin-react": "^4.3.4",
71
- "babel-plugin-styled-components": "^2.1.4",
72
- "eslint": "^9.17.0",
73
- "eslint-plugin-react-hooks": "^5.0.0",
74
- "eslint-plugin-react-refresh": "^0.4.16",
75
- "gh-pages": "^6.3.0",
76
- "globals": "^15.13.0",
77
- "jest": "^29.7.0",
78
- "jest-environment-jsdom": "^29.7.0",
79
- "react-icons": "^5.4.0",
80
- "styled-components": "^6.1.19",
81
- "ts-jest": "^29.2.5",
82
- "typescript": "~5.6.2",
83
- "typescript-eslint": "^8.18.1",
84
- "vite": "^6.0.3"
85
- },
86
- "keywords": [
87
- "cli",
88
- "vite",
89
- "components"
90
- ],
91
- "eslintConfig": {
92
- "extends": [
93
- "plugin:storybook/recommended"
94
- ]
95
- },
96
- "engines": {
97
- "node": "20.17.0",
98
- "yarn": ">=1.22.18"
99
- },
100
- "files": [
101
- "dist",
102
- "src/**/*",
103
- "!src/**/*.test.*",
104
- "!src/**/*.stories.*"
105
- ]
106
- }
1
+ {
2
+ "name": "@granto-umbrella/umbrella-components",
3
+ "version": "3.0.36",
4
+ "description": "Umbrella Components for React",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "module": "src/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/grantoseguros/granto-umbrella-components.git"
11
+ },
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "build": "tsc -b && vite build",
15
+ "commit": "cz",
16
+ "pr": "node scripts/open-pr.cjs",
17
+ "typecheck": "npm run typecheck:app && npm run typecheck:test",
18
+ "typecheck:app": "tsc -p tsconfig.app.json --noEmit",
19
+ "typecheck:test": "tsc -p tsconfig.test.json --noEmit",
20
+ "test": "jest --config=jest.config.mjs",
21
+ "test:ci": "jest --config=jest.config.mjs --coverage",
22
+ "test:related": "jest --config=jest.config.mjs -o",
23
+ "test:coverage": "jest --config jest.config.mjs --coverage --coverageReporters",
24
+ "lint": "eslint .",
25
+ "lint:staged": "eslint --max-warnings=0 --ignore-pattern 'storybook-static/**' --ignore-pattern 'coverage/**' --ignore-pattern 'dist/**'",
26
+ "format": "prettier -c .",
27
+ "format:check": "prettier --check .",
28
+ "format:write": "prettier -w .",
29
+ "prepare": "lefthook install",
30
+ "preview": "vite preview",
31
+ "storybook": "storybook dev -p 6006",
32
+ "build-storybook": "storybook build",
33
+ "predeploy": "npm run build-storybook",
34
+ "deploy": "gh-pages -d storybook-static",
35
+ "version": "npm run build && git add .",
36
+ "release:patch": "npm version patch && git push && git push --tags",
37
+ "release:minor": "npm version minor && git push && git push --tags",
38
+ "release:major": "npm version major && git push && git push --tags",
39
+ "bump:patch": "npm version patch",
40
+ "bump:minor": "npm version minor",
41
+ "bump:major": "npm version major"
42
+ },
43
+ "config": {
44
+ "commitizen": {
45
+ "path": "cz-git"
46
+ }
47
+ },
48
+ "dependencies": {
49
+ "@hello-pangea/dnd": "^18.0.1",
50
+ "@phosphor-icons/react": "^2.1.10",
51
+ "@radix-ui/react-dialog": "^1.1.15",
52
+ "@radix-ui/react-label": "^2.1.3",
53
+ "@radix-ui/react-popover": "^1.1.11",
54
+ "@radix-ui/react-radio-group": "^1.2.4",
55
+ "cpf-cnpj-validator": "^1.0.3",
56
+ "date-fns": "^4.1.0",
57
+ "lucide-react": "^0.488.0",
58
+ "make-mask": "^1.0.3",
59
+ "phosphor-react": "^1.4.1",
60
+ "radix": "^0.0.0",
61
+ "react": "^18.3.1",
62
+ "react-datepicker": "^8.3.0",
63
+ "react-day-picker": "^9.6.7",
64
+ "react-dom": "^18.3.1",
65
+ "react-hook-form": "^7.63.0",
66
+ "react-router": "^6.30.1",
67
+ "react-router-dom": "^6.30.1",
68
+ "react-select": "^5.10.0",
69
+ "recharts": "^3.2.1",
70
+ "tailwind-merge": "^3.2.0"
71
+ },
72
+ "devDependencies": {
73
+ "@chromatic-com/storybook": "3.2.3",
74
+ "@commitlint/cli": "^20.1.0",
75
+ "@commitlint/config-conventional": "^20.0.0",
76
+ "@eslint/js": "^9.17.0",
77
+ "@storybook/addon-actions": "8.4.7",
78
+ "@storybook/addon-essentials": "8.4.7",
79
+ "@storybook/addon-interactions": "8.4.7",
80
+ "@storybook/addon-onboarding": "8.4.7",
81
+ "@storybook/react-vite": "8.4.7",
82
+ "@testing-library/jest-dom": "^6.9.1",
83
+ "@testing-library/react": "^16.3.0",
84
+ "@testing-library/user-event": "^14.6.1",
85
+ "@types/jest": "^30.0.0",
86
+ "@types/mocha": "^10.0.10",
87
+ "@types/node": "^24.9.2",
88
+ "@types/react": "^18.3.17",
89
+ "@types/react-dom": "^18.3.5",
90
+ "@types/styled-components": "^5.1.34",
91
+ "@vitejs/plugin-react": "^4.7.0",
92
+ "babel-plugin-styled-components": "^2.1.4",
93
+ "commitizen": "^4.3.1",
94
+ "commitlint": "^20.1.0",
95
+ "cz-git": "^1.12.0",
96
+ "eslint": "^9.17.0",
97
+ "eslint-plugin-react-hooks": "^5.0.0",
98
+ "eslint-plugin-react-refresh": "^0.4.16",
99
+ "gh-pages": "^6.3.0",
100
+ "globals": "^15.13.0",
101
+ "identity-obj-proxy": "^3.0.0",
102
+ "jest": "^29.7.0",
103
+ "jest-environment-jsdom": "^29.7.0",
104
+ "jest-styled-components": "^7.2.0",
105
+ "lefthook": "^2.0.1",
106
+ "prettier": "^3.6.2",
107
+ "react-icons": "^5.4.0",
108
+ "styled-components": "^6.1.19",
109
+ "ts-jest": "^29.4.5",
110
+ "ts-node": "^10.9.2",
111
+ "typescript": "~5.6.2",
112
+ "typescript-eslint": "^8.18.1",
113
+ "vite": "^6.0.3"
114
+ },
115
+ "keywords": [
116
+ "cli",
117
+ "vite",
118
+ "components"
119
+ ],
120
+ "eslintConfig": {
121
+ "extends": [
122
+ "plugin:storybook/recommended"
123
+ ]
124
+ },
125
+ "engines": {
126
+ "node": "20.17.0",
127
+ "yarn": ">=1.22.18"
128
+ },
129
+ "files": [
130
+ "dist",
131
+ "src/**/*",
132
+ "!src/**/*.test.*",
133
+ "!src/**/*.stories.*"
134
+ ]
135
+ }
package/src/assets.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- declare module "*.png" {
2
- const content: string;
3
- export default content;
4
- }
5
-
6
- declare module "*.jpg" {
7
- const content: string;
8
- export default content;
9
- }
10
-
11
- declare module "*.jpeg" {
12
- const content: string;
13
- export default content;
14
- }
15
-
16
- declare module "*.svg" {
17
- const content: string;
18
- export default content;
19
- }
1
+ declare module '*.png' {
2
+ const content: string;
3
+ export default content;
4
+ }
5
+
6
+ declare module '*.jpg' {
7
+ const content: string;
8
+ export default content;
9
+ }
10
+
11
+ declare module '*.jpeg' {
12
+ const content: string;
13
+ export default content;
14
+ }
15
+
16
+ declare module '*.svg' {
17
+ const content: string;
18
+ export default content;
19
+ }
@@ -1,86 +1,88 @@
1
- import styled, { css } from "styled-components";
2
- import {
3
- semanticColors,
4
- semanticSizes,
5
- semanticRadius,
6
- typographyTokens,
7
- } from "../../../styles/tokens";
8
-
9
- const badgeVariants = {
10
- primary: css`
11
- background: ${semanticColors.branding.surface.enabled};
12
- color: ${semanticColors.base.background};
13
- `,
14
- outline: css`
15
- background: transparent;
16
- border: 1px solid ${semanticColors.branding.border.enabled};
17
- color: ${semanticColors.branding.text.accent.enabled};
18
- `,
19
- danger: css`
20
- background: ${semanticColors.global.surface.danger.disabled};
21
- color: ${semanticColors.global.text.feedback.strong.error};
22
-
23
- `,
24
- success: css`
25
- background: ${semanticColors.success.surface.feedback};
26
- color: ${semanticColors.success.text.feedback};
27
- `,
28
- warning: css`
29
- background: ${semanticColors.warning.surface.feedback};
30
- color: ${semanticColors.warning.text.feedback};
31
- `,
32
- neutral: css`
33
- background: ${semanticColors.neutral[200]};
34
- color: ${semanticColors.neutral[700]};
35
- `,
36
- info: css`
37
- background: ${semanticColors.info.surface.feedback};
38
- color: ${semanticColors.info.text.feedback.strong};
39
- `,
40
- };
41
-
42
- const badgeSizes = {
43
- sm: css`
44
- padding: ${semanticSizes.global.padding.xs} ${semanticSizes.global.padding.sm};
45
- font-size: ${typographyTokens.fontSizes.labelS};
46
- font-weight: ${typographyTokens.fontWeights.medium};
47
- line-height: ${typographyTokens.lineHeights.labelS};
48
- font-family: ${typographyTokens.fontFamily.base};
49
- `,
50
- md: css`
51
- padding: ${semanticSizes.global.padding.sm} ${semanticSizes.global.padding.md};
52
- font-size: ${typographyTokens.fontSizes.labelM};
53
- font-weight: ${typographyTokens.fontWeights.medium};
54
- line-height: ${typographyTokens.lineHeights.labelM};
55
- font-family: ${typographyTokens.fontFamily.base};
56
- `,
57
- lg: css`
58
- padding: ${semanticSizes.global.padding.md} ${semanticSizes.global.padding.lg};
59
- font-size: ${typographyTokens.fontSizes.labelL};
60
- font-weight: ${typographyTokens.fontWeights.medium};
61
- line-height: ${typographyTokens.lineHeights.labelL};
62
- font-family: ${typographyTokens.fontFamily.base};
63
- `,
64
- };
65
-
66
- export const StyledBadge = styled.span<{
67
- $size: keyof typeof badgeSizes;
68
- $variant: keyof typeof badgeVariants;
69
- $radius: keyof typeof semanticRadius.global.radius;
70
- }>`
71
- display: inline-flex;
72
- align-items: center;
73
- justify-content: center;
74
- border-radius: ${({ $radius }) => semanticRadius.global.radius[$radius]};
75
- gap: ${semanticSizes.global.gap.xs};
76
-
77
- ${({ $size }) => badgeSizes[$size]}
78
- ${({ $variant }) => badgeVariants[$variant]}
79
-
80
- .icon-left,
81
- .icon-right {
82
- display: flex;
83
- align-items: center;
84
- line-height: 1;
85
- }
86
- `;;
1
+ import styled, { css } from 'styled-components';
2
+ import {
3
+ semanticColors,
4
+ semanticSizes,
5
+ semanticRadius,
6
+ typographyTokens,
7
+ } from '../../../styles/tokens';
8
+
9
+ const badgeVariants = {
10
+ primary: css`
11
+ background: ${semanticColors.branding.surface.enabled};
12
+ color: ${semanticColors.base.background};
13
+ `,
14
+ outline: css`
15
+ background: transparent;
16
+ border: 1px solid ${semanticColors.branding.border.enabled};
17
+ color: ${semanticColors.branding.text.accent.enabled};
18
+ `,
19
+ danger: css`
20
+ background: ${semanticColors.global.surface.danger.disabled};
21
+ color: ${semanticColors.global.text.feedback.strong.error};
22
+ `,
23
+ success: css`
24
+ background: ${semanticColors.success.surface.feedback};
25
+ color: ${semanticColors.success.text.feedback};
26
+ `,
27
+ warning: css`
28
+ background: ${semanticColors.warning.surface.feedback};
29
+ color: ${semanticColors.warning.text.feedback};
30
+ `,
31
+ neutral: css`
32
+ background: ${semanticColors.neutral[200]};
33
+ color: ${semanticColors.neutral[700]};
34
+ `,
35
+ info: css`
36
+ background: ${semanticColors.info.surface.feedback};
37
+ color: ${semanticColors.info.text.feedback.strong};
38
+ `,
39
+ };
40
+
41
+ const badgeSizes = {
42
+ sm: css`
43
+ padding: ${semanticSizes.global.padding.xs}
44
+ ${semanticSizes.global.padding.sm};
45
+ font-size: ${typographyTokens.fontSizes.labelS};
46
+ font-weight: ${typographyTokens.fontWeights.medium};
47
+ line-height: ${typographyTokens.lineHeights.labelS};
48
+ font-family: ${typographyTokens.fontFamily.base};
49
+ `,
50
+ md: css`
51
+ padding: ${semanticSizes.global.padding.sm}
52
+ ${semanticSizes.global.padding.md};
53
+ font-size: ${typographyTokens.fontSizes.labelM};
54
+ font-weight: ${typographyTokens.fontWeights.medium};
55
+ line-height: ${typographyTokens.lineHeights.labelM};
56
+ font-family: ${typographyTokens.fontFamily.base};
57
+ `,
58
+ lg: css`
59
+ padding: ${semanticSizes.global.padding.md}
60
+ ${semanticSizes.global.padding.lg};
61
+ font-size: ${typographyTokens.fontSizes.labelL};
62
+ font-weight: ${typographyTokens.fontWeights.medium};
63
+ line-height: ${typographyTokens.lineHeights.labelL};
64
+ font-family: ${typographyTokens.fontFamily.base};
65
+ `,
66
+ };
67
+
68
+ export const StyledBadge = styled.span<{
69
+ $size: keyof typeof badgeSizes;
70
+ $variant: keyof typeof badgeVariants;
71
+ $radius: keyof typeof semanticRadius.global.radius;
72
+ }>`
73
+ display: inline-flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ border-radius: ${({ $radius }) => semanticRadius.global.radius[$radius]};
77
+ gap: ${semanticSizes.global.gap.xs};
78
+
79
+ ${({ $size }) => badgeSizes[$size]}
80
+ ${({ $variant }) => badgeVariants[$variant]}
81
+
82
+ .icon-left,
83
+ .icon-right {
84
+ display: flex;
85
+ align-items: center;
86
+ line-height: 1;
87
+ }
88
+ `;
@@ -1,44 +1,42 @@
1
- import React from "react";
2
- import { StyledBadge } from "./Badge.styles";
3
- import { BadgeProps } from "./Badge.types";
4
- import * as Icons from "@phosphor-icons/react";
5
- import { semanticSizes } from "../../../styles/tokens/sizes";
6
-
7
- const getIconSize = (size: BadgeProps["size"]) => {
8
- switch (size) {
9
- case "sm":
10
- return semanticSizes.global.padding.lg;
11
- case "lg":
12
- return semanticSizes.global.padding['2xl'];
13
- default: // Caso 'md'
14
- return semanticSizes.global.padding.xl;
15
- }
16
- };
17
-
18
- const Badge: React.FC<BadgeProps> = ({
19
- children,
20
- size = "md",
21
- variant = "primary",
22
- radius = "full",
23
- leftIcon,
24
- rightIcon,
25
- }) => {
26
- const IconComponentLeft = leftIcon && (Icons[leftIcon as keyof typeof Icons] as React.ElementType);
27
- const IconComponentRight = rightIcon && (Icons[rightIcon as keyof typeof Icons] as React.ElementType);
28
-
29
- const iconSize = getIconSize(size);
30
-
31
- return (
32
- <StyledBadge $size={size} $variant={variant} $radius={radius}>
33
- {IconComponentLeft && (
34
- <IconComponentLeft size={parseInt(iconSize)} />
35
- )}
36
- {children}
37
- {IconComponentRight && (
38
- <IconComponentRight size={parseInt(iconSize)} />
39
- )}
40
- </StyledBadge>
41
- );
42
- };
43
-
44
- export default Badge;
1
+ import React from 'react';
2
+ import { StyledBadge } from './Badge.styles';
3
+ import { BadgeProps } from './Badge.types';
4
+ import * as Icons from '@phosphor-icons/react';
5
+ import { semanticSizes } from '../../../styles/tokens/sizes';
6
+
7
+ const getIconSize = (size: BadgeProps['size']) => {
8
+ switch (size) {
9
+ case 'sm':
10
+ return semanticSizes.global.padding.lg;
11
+ case 'lg':
12
+ return semanticSizes.global.padding['2xl'];
13
+ default: // Caso 'md'
14
+ return semanticSizes.global.padding.xl;
15
+ }
16
+ };
17
+
18
+ const Badge: React.FC<BadgeProps> = ({
19
+ children,
20
+ size = 'md',
21
+ variant = 'primary',
22
+ radius = 'full',
23
+ leftIcon,
24
+ rightIcon,
25
+ }) => {
26
+ const IconComponentLeft =
27
+ leftIcon && (Icons[leftIcon as keyof typeof Icons] as React.ElementType);
28
+ const IconComponentRight =
29
+ rightIcon && (Icons[rightIcon as keyof typeof Icons] as React.ElementType);
30
+
31
+ const iconSize = getIconSize(size);
32
+
33
+ return (
34
+ <StyledBadge $size={size} $variant={variant} $radius={radius}>
35
+ {IconComponentLeft && <IconComponentLeft size={parseInt(iconSize)} />}
36
+ {children}
37
+ {IconComponentRight && <IconComponentRight size={parseInt(iconSize)} />}
38
+ </StyledBadge>
39
+ );
40
+ };
41
+
42
+ export default Badge;
@@ -1,15 +1,15 @@
1
- export interface BadgeProps {
2
- children: React.ReactNode;
3
- size?: "sm" | "md" | "lg";
4
- variant?:
5
- | "primary"
6
- | "outline"
7
- | "danger"
8
- | "success"
9
- | "warning"
10
- | "neutral"
11
- | "info";
12
- radius?: "sm" | "md" | "lg" | "full";
13
- leftIcon?: string;
14
- rightIcon?: string;
15
- }
1
+ export interface BadgeProps {
2
+ children: React.ReactNode;
3
+ size?: 'sm' | 'md' | 'lg';
4
+ variant?:
5
+ | 'primary'
6
+ | 'outline'
7
+ | 'danger'
8
+ | 'success'
9
+ | 'warning'
10
+ | 'neutral'
11
+ | 'info';
12
+ radius?: 'sm' | 'md' | 'lg' | 'full';
13
+ leftIcon?: string;
14
+ rightIcon?: string;
15
+ }