@bitrise/bitkit 9.4.0 → 9.4.1-alpha.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 (203) hide show
  1. package/.eslintrc.js +9 -2
  2. package/.storybook/main.js +35 -0
  3. package/.storybook/preview.js +20 -0
  4. package/.stylelintignore +1 -0
  5. package/.stylelintrc +2 -3
  6. package/CHANGELOG.md +2 -0
  7. package/jest.setup.js +1 -1
  8. package/lib/cjs/Dropdown/DropdownMenu.css +1 -1
  9. package/lib/cjs/chakra/BitkitProvider.d.ts +5 -0
  10. package/lib/cjs/chakra/BitkitProvider.d.ts.map +1 -0
  11. package/lib/cjs/chakra/BitkitProvider.js +14 -0
  12. package/lib/cjs/chakra/BitkitProvider.js.map +1 -0
  13. package/lib/cjs/chakra/components/Button/Button.d.ts +22 -0
  14. package/lib/cjs/chakra/components/Button/Button.d.ts.map +1 -0
  15. package/lib/cjs/chakra/components/Button/Button.js +61 -0
  16. package/lib/cjs/chakra/components/Button/Button.js.map +1 -0
  17. package/lib/cjs/chakra/components/Button/Button.stories.d.ts +6 -0
  18. package/lib/cjs/chakra/components/Button/Button.stories.d.ts.map +1 -0
  19. package/lib/cjs/chakra/components/Button/Button.stories.js +37 -0
  20. package/lib/cjs/chakra/components/Button/Button.stories.js.map +1 -0
  21. package/lib/cjs/chakra/components/Button/Button.theme.d.ts +117 -0
  22. package/lib/cjs/chakra/components/Button/Button.theme.d.ts.map +1 -0
  23. package/lib/cjs/chakra/components/Button/Button.theme.js +119 -0
  24. package/lib/cjs/chakra/components/Button/Button.theme.js.map +1 -0
  25. package/lib/cjs/chakra/components/IconButton/IconButton.d.ts +14 -0
  26. package/lib/cjs/chakra/components/IconButton/IconButton.d.ts.map +1 -0
  27. package/lib/cjs/chakra/components/IconButton/IconButton.js +41 -0
  28. package/lib/cjs/chakra/components/IconButton/IconButton.js.map +1 -0
  29. package/lib/cjs/chakra/components/IconButton/IconButton.stories.d.ts +6 -0
  30. package/lib/cjs/chakra/components/IconButton/IconButton.stories.d.ts.map +1 -0
  31. package/lib/cjs/chakra/components/IconButton/IconButton.stories.js +48 -0
  32. package/lib/cjs/chakra/components/IconButton/IconButton.stories.js.map +1 -0
  33. package/lib/cjs/chakra/components/Link/Link.d.ts +16 -0
  34. package/lib/cjs/chakra/components/Link/Link.d.ts.map +1 -0
  35. package/lib/cjs/chakra/components/Link/Link.js +44 -0
  36. package/lib/cjs/chakra/components/Link/Link.js.map +1 -0
  37. package/lib/cjs/chakra/components/Link/Link.stories.d.ts +12 -0
  38. package/lib/cjs/chakra/components/Link/Link.stories.d.ts.map +1 -0
  39. package/lib/cjs/chakra/components/Link/Link.stories.js +42 -0
  40. package/lib/cjs/chakra/components/Link/Link.stories.js.map +1 -0
  41. package/lib/cjs/chakra/components/Menu/Menu.d.ts +6 -0
  42. package/lib/cjs/chakra/components/Menu/Menu.d.ts.map +1 -0
  43. package/lib/cjs/chakra/components/Menu/Menu.js +21 -0
  44. package/lib/cjs/chakra/components/Menu/Menu.js.map +1 -0
  45. package/lib/cjs/chakra/components/Menu/Menu.stories.d.ts +9 -0
  46. package/lib/cjs/chakra/components/Menu/Menu.stories.d.ts.map +1 -0
  47. package/lib/cjs/chakra/components/Menu/Menu.stories.js +48 -0
  48. package/lib/cjs/chakra/components/Menu/Menu.stories.js.map +1 -0
  49. package/lib/cjs/chakra/components/Menu/Menu.theme.d.ts +4 -0
  50. package/lib/cjs/chakra/components/Menu/Menu.theme.d.ts.map +1 -0
  51. package/lib/cjs/chakra/components/Menu/Menu.theme.js +23 -0
  52. package/lib/cjs/chakra/components/Menu/Menu.theme.js.map +1 -0
  53. package/lib/cjs/chakra/components/Menu/MenuItem.d.ts +10 -0
  54. package/lib/cjs/chakra/components/Menu/MenuItem.d.ts.map +1 -0
  55. package/lib/cjs/chakra/components/Menu/MenuItem.js +39 -0
  56. package/lib/cjs/chakra/components/Menu/MenuItem.js.map +1 -0
  57. package/lib/cjs/chakra/components/StatusTag/StatusTag.d.ts +16 -0
  58. package/lib/cjs/chakra/components/StatusTag/StatusTag.d.ts.map +1 -0
  59. package/lib/cjs/chakra/components/StatusTag/StatusTag.js +36 -0
  60. package/lib/cjs/chakra/components/StatusTag/StatusTag.js.map +1 -0
  61. package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.d.ts +13 -0
  62. package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.d.ts.map +1 -0
  63. package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.js +44 -0
  64. package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.js.map +1 -0
  65. package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.d.ts +45 -0
  66. package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.d.ts.map +1 -0
  67. package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.js +47 -0
  68. package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.js.map +1 -0
  69. package/lib/cjs/chakra/components/Text/Text.d.ts +32 -0
  70. package/lib/cjs/chakra/components/Text/Text.d.ts.map +1 -0
  71. package/lib/cjs/chakra/components/Text/Text.js +38 -0
  72. package/lib/cjs/chakra/components/Text/Text.js.map +1 -0
  73. package/lib/cjs/chakra/components/Text/Text.stories.d.ts +12 -0
  74. package/lib/cjs/chakra/components/Text/Text.stories.d.ts.map +1 -0
  75. package/lib/cjs/chakra/components/Text/Text.stories.js +42 -0
  76. package/lib/cjs/chakra/components/Text/Text.stories.js.map +1 -0
  77. package/lib/cjs/chakra/shared.d.ts +2 -0
  78. package/lib/cjs/chakra/shared.d.ts.map +1 -0
  79. package/lib/cjs/chakra/shared.js +15 -0
  80. package/lib/cjs/chakra/shared.js.map +1 -0
  81. package/lib/cjs/chakra/theme/theme.d.ts +3 -0
  82. package/lib/cjs/chakra/theme/theme.d.ts.map +1 -0
  83. package/lib/cjs/chakra/theme/theme.js +54 -0
  84. package/lib/cjs/chakra/theme/theme.js.map +1 -0
  85. package/lib/cjs/chakra/theme/typographyConfig.d.ts +4 -0
  86. package/lib/cjs/chakra/theme/typographyConfig.d.ts.map +1 -0
  87. package/lib/cjs/chakra/theme/typographyConfig.js +38 -0
  88. package/lib/cjs/chakra/theme/typographyConfig.js.map +1 -0
  89. package/lib/cjs/index.d.ts +9 -0
  90. package/lib/cjs/index.d.ts.map +1 -1
  91. package/lib/cjs/index.js +20 -1
  92. package/lib/cjs/index.js.map +1 -1
  93. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  94. package/lib/esn/Dropdown/DropdownMenu.css +1 -1
  95. package/lib/esn/chakra/BitkitProvider.d.ts +5 -0
  96. package/lib/esn/chakra/BitkitProvider.d.ts.map +1 -0
  97. package/lib/esn/chakra/BitkitProvider.js +8 -0
  98. package/lib/esn/chakra/BitkitProvider.js.map +1 -0
  99. package/lib/esn/chakra/components/Button/Button.d.ts +22 -0
  100. package/lib/esn/chakra/components/Button/Button.d.ts.map +1 -0
  101. package/lib/esn/chakra/components/Button/Button.js +34 -0
  102. package/lib/esn/chakra/components/Button/Button.js.map +1 -0
  103. package/lib/esn/chakra/components/Button/Button.stories.d.ts +6 -0
  104. package/lib/esn/chakra/components/Button/Button.stories.d.ts.map +1 -0
  105. package/lib/esn/chakra/components/Button/Button.stories.js +29 -0
  106. package/lib/esn/chakra/components/Button/Button.stories.js.map +1 -0
  107. package/lib/esn/chakra/components/Button/Button.theme.d.ts +117 -0
  108. package/lib/esn/chakra/components/Button/Button.theme.d.ts.map +1 -0
  109. package/lib/esn/chakra/components/Button/Button.theme.js +117 -0
  110. package/lib/esn/chakra/components/Button/Button.theme.js.map +1 -0
  111. package/lib/esn/chakra/components/IconButton/IconButton.d.ts +14 -0
  112. package/lib/esn/chakra/components/IconButton/IconButton.d.ts.map +1 -0
  113. package/lib/esn/chakra/components/IconButton/IconButton.js +18 -0
  114. package/lib/esn/chakra/components/IconButton/IconButton.js.map +1 -0
  115. package/lib/esn/chakra/components/IconButton/IconButton.stories.d.ts +6 -0
  116. package/lib/esn/chakra/components/IconButton/IconButton.stories.d.ts.map +1 -0
  117. package/lib/esn/chakra/components/IconButton/IconButton.stories.js +21 -0
  118. package/lib/esn/chakra/components/IconButton/IconButton.stories.js.map +1 -0
  119. package/lib/esn/chakra/components/Link/Link.d.ts +16 -0
  120. package/lib/esn/chakra/components/Link/Link.d.ts.map +1 -0
  121. package/lib/esn/chakra/components/Link/Link.js +17 -0
  122. package/lib/esn/chakra/components/Link/Link.js.map +1 -0
  123. package/lib/esn/chakra/components/Link/Link.stories.d.ts +12 -0
  124. package/lib/esn/chakra/components/Link/Link.stories.d.ts.map +1 -0
  125. package/lib/esn/chakra/components/Link/Link.stories.js +16 -0
  126. package/lib/esn/chakra/components/Link/Link.stories.js.map +1 -0
  127. package/lib/esn/chakra/components/Menu/Menu.d.ts +6 -0
  128. package/lib/esn/chakra/components/Menu/Menu.d.ts.map +1 -0
  129. package/lib/esn/chakra/components/Menu/Menu.js +5 -0
  130. package/lib/esn/chakra/components/Menu/Menu.js.map +1 -0
  131. package/lib/esn/chakra/components/Menu/Menu.stories.d.ts +9 -0
  132. package/lib/esn/chakra/components/Menu/Menu.stories.d.ts.map +1 -0
  133. package/lib/esn/chakra/components/Menu/Menu.stories.js +39 -0
  134. package/lib/esn/chakra/components/Menu/Menu.stories.js.map +1 -0
  135. package/lib/esn/chakra/components/Menu/Menu.theme.d.ts +4 -0
  136. package/lib/esn/chakra/components/Menu/Menu.theme.d.ts.map +1 -0
  137. package/lib/esn/chakra/components/Menu/Menu.theme.js +21 -0
  138. package/lib/esn/chakra/components/Menu/Menu.theme.js.map +1 -0
  139. package/lib/esn/chakra/components/Menu/MenuItem.d.ts +10 -0
  140. package/lib/esn/chakra/components/Menu/MenuItem.d.ts.map +1 -0
  141. package/lib/esn/chakra/components/Menu/MenuItem.js +12 -0
  142. package/lib/esn/chakra/components/Menu/MenuItem.js.map +1 -0
  143. package/lib/esn/chakra/components/StatusTag/StatusTag.d.ts +16 -0
  144. package/lib/esn/chakra/components/StatusTag/StatusTag.d.ts.map +1 -0
  145. package/lib/esn/chakra/components/StatusTag/StatusTag.js +30 -0
  146. package/lib/esn/chakra/components/StatusTag/StatusTag.js.map +1 -0
  147. package/lib/esn/chakra/components/StatusTag/StatusTag.stories.d.ts +13 -0
  148. package/lib/esn/chakra/components/StatusTag/StatusTag.stories.d.ts.map +1 -0
  149. package/lib/esn/chakra/components/StatusTag/StatusTag.stories.js +16 -0
  150. package/lib/esn/chakra/components/StatusTag/StatusTag.stories.js.map +1 -0
  151. package/lib/esn/chakra/components/StatusTag/StatusTag.theme.d.ts +45 -0
  152. package/lib/esn/chakra/components/StatusTag/StatusTag.theme.d.ts.map +1 -0
  153. package/lib/esn/chakra/components/StatusTag/StatusTag.theme.js +45 -0
  154. package/lib/esn/chakra/components/StatusTag/StatusTag.theme.js.map +1 -0
  155. package/lib/esn/chakra/components/Text/Text.d.ts +32 -0
  156. package/lib/esn/chakra/components/Text/Text.d.ts.map +1 -0
  157. package/lib/esn/chakra/components/Text/Text.js +22 -0
  158. package/lib/esn/chakra/components/Text/Text.js.map +1 -0
  159. package/lib/esn/chakra/components/Text/Text.stories.d.ts +12 -0
  160. package/lib/esn/chakra/components/Text/Text.stories.d.ts.map +1 -0
  161. package/lib/esn/chakra/components/Text/Text.stories.js +19 -0
  162. package/lib/esn/chakra/components/Text/Text.stories.js.map +1 -0
  163. package/lib/esn/chakra/shared.d.ts +2 -0
  164. package/lib/esn/chakra/shared.d.ts.map +1 -0
  165. package/lib/esn/chakra/shared.js +11 -0
  166. package/lib/esn/chakra/shared.js.map +1 -0
  167. package/lib/esn/chakra/theme/theme.d.ts +3 -0
  168. package/lib/esn/chakra/theme/theme.d.ts.map +1 -0
  169. package/lib/esn/chakra/theme/theme.js +49 -0
  170. package/lib/esn/chakra/theme/theme.js.map +1 -0
  171. package/lib/esn/chakra/theme/typographyConfig.d.ts +4 -0
  172. package/lib/esn/chakra/theme/typographyConfig.d.ts.map +1 -0
  173. package/lib/esn/chakra/theme/typographyConfig.js +36 -0
  174. package/lib/esn/chakra/theme/typographyConfig.js.map +1 -0
  175. package/lib/esn/index.d.ts +9 -0
  176. package/lib/esn/index.d.ts.map +1 -1
  177. package/lib/esn/index.js +9 -0
  178. package/lib/esn/index.js.map +1 -1
  179. package/lib/esn/tsconfig.tsbuildinfo +1 -1
  180. package/package.json +44 -21
  181. package/src/Dropdown/DropdownMenu.css +1 -1
  182. package/src/chakra/BitkitProvider.tsx +9 -0
  183. package/src/chakra/components/Button/Button.stories.tsx +32 -0
  184. package/src/chakra/components/Button/Button.theme.ts +117 -0
  185. package/src/chakra/components/Button/Button.tsx +52 -0
  186. package/src/chakra/components/IconButton/IconButton.stories.tsx +24 -0
  187. package/src/chakra/components/IconButton/IconButton.tsx +29 -0
  188. package/src/chakra/components/Link/Link.stories.tsx +19 -0
  189. package/src/chakra/components/Link/Link.tsx +30 -0
  190. package/src/chakra/components/Menu/Menu.stories.tsx +57 -0
  191. package/src/chakra/components/Menu/Menu.theme.ts +23 -0
  192. package/src/chakra/components/Menu/Menu.tsx +8 -0
  193. package/src/chakra/components/Menu/MenuItem.tsx +19 -0
  194. package/src/chakra/components/StatusTag/StatusTag.stories.tsx +19 -0
  195. package/src/chakra/components/StatusTag/StatusTag.theme.ts +45 -0
  196. package/src/chakra/components/StatusTag/StatusTag.tsx +55 -0
  197. package/src/chakra/components/Text/Text.stories.tsx +22 -0
  198. package/src/chakra/components/Text/Text.tsx +73 -0
  199. package/src/chakra/shared.ts +11 -0
  200. package/src/chakra/theme/theme.ts +50 -0
  201. package/src/chakra/theme/typographyConfig.ts +38 -0
  202. package/src/index.ts +10 -0
  203. package/tsconfig.json +5 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "9.4.0",
4
+ "version": "9.4.1-alpha.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "lib/cjs/index.js",
7
7
  "esnext": "lib/esn/index.js",
@@ -27,34 +27,50 @@
27
27
  "start:docs": "ts-node ./scripts/build-docs-watch",
28
28
  "start:site": "parcel serve site/index.html --port 4001 -d dist --no-cache",
29
29
  "start:icons": "chokidar src/Icon/svg/** -c \"yarn svgr {path} && yarn lint:fix-icons\"",
30
- "test": "jest ./src"
30
+ "test": "jest ./src",
31
+ "storybook": "start-storybook -p 6006",
32
+ "build-storybook": "build-storybook"
31
33
  },
32
34
  "alias": {
33
- "@bitrise/bitkit": "./src"
35
+ "@bitrise/bitkit": "./src",
36
+ "framer-motion": "./node_modules/framer-motion/dist/cjs"
34
37
  },
35
38
  "dependencies": {
39
+ "@chakra-ui/react": "^1.8.6",
40
+ "@emotion/react": "^11",
41
+ "@emotion/styled": "^11",
36
42
  "@juggle/resize-observer": "^3.3.1",
37
43
  "classnames": "^2.3.1",
38
44
  "clipboard": "^2.0.10",
39
- "luxon": "^1.28.0",
45
+ "framer-motion": "^6",
46
+ "luxon": "^2.3.1",
40
47
  "normalize.css": "^8.0.1",
41
48
  "popper.js": "^1.14.4",
42
- "react": "^16.14.0",
43
- "react-dom": "^16.14.0",
49
+ "react": "^17.0.2",
50
+ "react-dom": "^17.0.2",
44
51
  "react-popper": "^1.3.11",
45
- "react-transition-group": "^2.9.0"
52
+ "react-transition-group": "^4.4.2"
46
53
  },
47
54
  "peerDependencies": {
48
- "react": "^16.14.0",
49
- "react-dom": "^16.14.0"
55
+ "react": "^17.0.2",
56
+ "react-dom": "^17.0.2"
50
57
  },
51
58
  "devDependencies": {
59
+ "@babel/core": "^7.17.8",
52
60
  "@bitrise/eslint-plugin": "^2.1.0",
53
61
  "@commitlint/cli": "^8.3.6",
54
62
  "@commitlint/config-conventional": "^8.3.6",
55
63
  "@semantic-release/changelog": "^6.0.1",
56
64
  "@semantic-release/commit-analyzer": "^9.0.2",
57
65
  "@semantic-release/git": "^10.0.1",
66
+ "@storybook/addon-actions": "^6.4.19",
67
+ "@storybook/addon-essentials": "^6.4.19",
68
+ "@storybook/addon-interactions": "^6.4.19",
69
+ "@storybook/addon-links": "^6.4.19",
70
+ "@storybook/builder-webpack5": "^6.4.19",
71
+ "@storybook/manager-webpack5": "^6.4.19",
72
+ "@storybook/react": "^6.4.19",
73
+ "@storybook/testing-library": "^0.0.9",
58
74
  "@svgr/cli": "^6.2.1",
59
75
  "@types/cheerio": "^0.22.31",
60
76
  "@types/clipboard": "^2.0.1",
@@ -62,30 +78,33 @@
62
78
  "@types/jest": "^27.4.1",
63
79
  "@types/lodash.sample": "^4.2.6",
64
80
  "@types/lodash.shuffle": "^4.2.6",
65
- "@types/luxon": "^1.27.1",
81
+ "@types/luxon": "^2.3.1",
66
82
  "@types/prismjs": "^1.26.0",
67
- "@types/react": "^17.0.40",
68
- "@types/react-dom": "^17.0.13",
83
+ "@types/react": "17.0.40",
84
+ "@types/react-dom": "^17.0.14",
69
85
  "@types/react-router": "^5.1.18",
70
86
  "@types/react-router-dom": "^5.3.3",
71
- "@types/react-transition-group": "^2.9.2",
87
+ "@types/react-transition-group": "^4.4.4",
72
88
  "@types/vfile-message": "^2.0.0",
73
89
  "@typescript-eslint/eslint-plugin": "^5.15.0",
74
90
  "@typescript-eslint/parser": "^5.15.0",
75
- "autoprefixer": "^9.8.8",
91
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
92
+ "autoprefixer": "^9",
76
93
  "babel-eslint": "^10.0.1",
94
+ "babel-loader": "^8.2.3",
77
95
  "chokidar-cli": "^3.0.0",
78
96
  "concurrently": "^4.1.2",
97
+ "csstype": "3.0.9",
79
98
  "enzyme": "^3.11.0",
80
- "enzyme-adapter-react-16": "^1.15.6",
81
99
  "enzyme-to-json": "^3.6.2",
82
100
  "eslint": "^8.11.0",
83
101
  "eslint-plugin-import": "^2.25.4",
84
- "eslint-plugin-jest": "^26.1.1",
102
+ "eslint-plugin-jest": "^26.1.2",
85
103
  "eslint-plugin-jsx-a11y": "^6.5.1",
86
104
  "eslint-plugin-prettier": "^4.0.0",
87
105
  "eslint-plugin-react": "^7.29.4",
88
106
  "eslint-plugin-react-hooks": "^4.3.0",
107
+ "eslint-plugin-storybook": "^0.5.7",
89
108
  "eslint-plugin-testing-library": "^5.1.0",
90
109
  "fscreen": "^1.2.0",
91
110
  "husky": "^3.1.0",
@@ -100,16 +119,17 @@
100
119
  "postcss-preset-env": "^6.7.1",
101
120
  "prettier": "^2.6.0",
102
121
  "prismjs": "^1.27.0",
103
- "react-docgen": "5.4.0",
104
122
  "react-router": "^5.2.1",
105
123
  "react-router-dom": "^5.3.0",
106
124
  "semantic-release": "^18.0.1",
107
- "stylelint": "^9.10.1",
108
- "stylelint-order": "^0.8.1",
109
- "superstatic": "^6.0.4",
125
+ "stylelint": "^14.6.0",
126
+ "stylelint-order": "^5.0.0",
127
+ "superstatic": "^7.1.0",
110
128
  "ts-jest": "^27.1.3",
111
129
  "ts-node": "^10.7.0",
112
- "typescript": "^4.6.2"
130
+ "tsconfig-paths-webpack-plugin": "^3.5.2",
131
+ "typescript": "^4.6.2",
132
+ "webpack": "^5.70.0"
113
133
  },
114
134
  "publishConfig": {
115
135
  "access": "public"
@@ -129,5 +149,8 @@
129
149
  "transform": {
130
150
  "\\.tsx?$": "ts-jest"
131
151
  }
152
+ },
153
+ "resolutions": {
154
+ "@types/react": "17.0.40"
132
155
  }
133
156
  }
@@ -15,7 +15,7 @@
15
15
  .DropdownMenu__group-text::after {
16
16
  content: '';
17
17
  flex: 1;
18
- /* stylelint-disable-next-line unit-blacklist */
18
+ /* stylelint-disable-next-line unit-disallowed-list */
19
19
  height: 1px;
20
20
  background-color: var(--color-gray--3);
21
21
  }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ChakraProvider, ChakraProviderProps } from '@chakra-ui/react';
3
+ import theme from './theme/theme';
4
+
5
+ const BitkitProvider = ({ children }: ChakraProviderProps) => {
6
+ return <ChakraProvider theme={theme}>{children}</ChakraProvider>;
7
+ };
8
+
9
+ export default BitkitProvider;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { sortObjectByKey } from '../../shared';
4
+ import { IconList } from '../../../Icon/tsx';
5
+ import Button from './Button';
6
+
7
+ export default {
8
+ title: 'Components/Button',
9
+ component: Button,
10
+ argTypes: {
11
+ leftIconName: {
12
+ options: IconList,
13
+ },
14
+ rightIconName: {
15
+ options: IconList,
16
+ },
17
+ },
18
+ } as ComponentMeta<typeof Button>;
19
+
20
+ const Template: ComponentStory<typeof Button> = (props) => <Button {...props} />;
21
+
22
+ export const WithProps = Template.bind({});
23
+ WithProps.args = sortObjectByKey({
24
+ ...Button.defaultProps,
25
+ as: 'button',
26
+ className: '',
27
+ isDisabled: false,
28
+ href: '',
29
+ target: '_self',
30
+ type: 'button',
31
+ children: 'Button',
32
+ });
@@ -0,0 +1,117 @@
1
+ const ButtonTheme = {
2
+ baseStyle: {
3
+ border: '1px solid',
4
+ borderRadius: 'base',
5
+ fontWeight: 'normal',
6
+ lineHeight: 3,
7
+ },
8
+ variants: {
9
+ primary: {
10
+ bgGradient: 'linear(to-b, #6C0EB2, #450674)',
11
+ borderColor: '#683D87',
12
+ color: '#F8F8F8',
13
+ fontWeight: 'bold',
14
+ _hover: {
15
+ bgGradient: 'linear(to-b, #50167B, #3D125D)',
16
+ _disabled: {
17
+ bgGradient: 'linear(to-b, #ccc, #ACACAC)',
18
+ borderColor: '#ACACAC',
19
+ },
20
+ },
21
+ _active: {
22
+ bgGradient: 'linear(to-b, #351D48, #351D48)',
23
+ },
24
+ _disabled: {
25
+ bgGradient: 'linear(to-b, #ccc, #ACACAC)',
26
+ borderColor: '#ACACAC',
27
+ },
28
+ },
29
+ secondary: {
30
+ bgGradient: 'linear(to-b, #f8f8f8, #fff)',
31
+ borderColor: '#ddd',
32
+ color: '#351D48',
33
+ _hover: {
34
+ bgGradient: 'linear(to-b, #ECECEC, #ECECEC)',
35
+ },
36
+ _active: {
37
+ bgGradient: 'linear(to-b, #351D48, #351D48)',
38
+ color: '#F8F8F8',
39
+ },
40
+ _disabled: {
41
+ color: '#ACACAC',
42
+ },
43
+ },
44
+ tertiary: {
45
+ background: 'transparent',
46
+ borderColor: 'transparent',
47
+ color: '#760FC3',
48
+ _hover: {
49
+ background: '#F8F0FF',
50
+ },
51
+ _active: {
52
+ background: '#351D48',
53
+ color: '#F8F8F8',
54
+ },
55
+ _disabled: {
56
+ color: '#ACACAC',
57
+ },
58
+ },
59
+ dangerPrimary: {
60
+ bgGradient: 'linear(to-b, #E41447, #FF2158)',
61
+ borderColor: '#D4093C',
62
+ color: '#fff',
63
+ fontWeight: 'bold',
64
+ _hover: {
65
+ bgGradient: 'linear(to-b, #C90032, #C90032)',
66
+ _disabled: {
67
+ bgGradient: 'linear(to-b, #ccc, #acacac)',
68
+ borderColor: '#ACACAC',
69
+ },
70
+ },
71
+ _active: {
72
+ bgGradient: 'linear(to-b, #C02048, #C02048)',
73
+ },
74
+ _disabled: {
75
+ bgGradient: 'linear(to-b, #ccc, #acacac)',
76
+ borderColor: '#ACACAC',
77
+ },
78
+ },
79
+ dangerSecondary: {
80
+ bgGradient: 'linear(to-b, #f8f8f8, #fff)',
81
+ borderColor: '#ddd',
82
+ color: '#FF2158',
83
+ _hover: {
84
+ bgGradient: 'linear(to-b, #FFE8EE, #FFE8EE)',
85
+ borderColor: '#FF8FAB',
86
+ _disabled: {
87
+ bgGradient: 'linear(to-b, #f8f8f8, #fff)',
88
+ borderColor: '#ddd',
89
+ color: '#ACACAC',
90
+ },
91
+ },
92
+ _active: {
93
+ bgGradient: 'linear(to-b, #C02048, #C02048)',
94
+ color: '#fff',
95
+ },
96
+ _disabled: {
97
+ color: '#ACACAC',
98
+ },
99
+ },
100
+ },
101
+ sizes: {
102
+ small: {
103
+ minWidth: '32px',
104
+ height: '32px',
105
+ fontSize: 2,
106
+ paddingX: '12px',
107
+ },
108
+ medium: {
109
+ minWidth: '48px',
110
+ height: '48px',
111
+ fontSize: 3,
112
+ paddingX: '16px',
113
+ },
114
+ },
115
+ };
116
+
117
+ export default ButtonTheme;
@@ -0,0 +1,52 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+ import React from 'react';
3
+ import { Button as ChakraButton, ButtonProps } from '@chakra-ui/react';
4
+ import { Icon, TypeIconName } from '@bitrise/bitkit';
5
+
6
+ export interface Props {
7
+ as?: 'a' | 'button';
8
+ children: string;
9
+ className?: string;
10
+ href?: string;
11
+ isDisabled?: boolean;
12
+ leftIconName?: TypeIconName;
13
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
14
+ ref?: ButtonProps['itemRef'];
15
+ rightIconName?: TypeIconName;
16
+ size?: 'small' | 'medium';
17
+ sx?: ButtonProps['sx'];
18
+ target?: '_blank' | '_parent' | '_self' | '_top';
19
+ type?: ButtonProps['type'];
20
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'dangerPrimary' | 'dangerSecondary';
21
+ }
22
+
23
+ const Button = React.forwardRef<HTMLButtonElement, Props>((props: Props, ref) => {
24
+ const { as, leftIconName, rightIconName, size, ...rest } = props;
25
+ const properties: ButtonProps = { as, size, ...rest };
26
+ if (leftIconName) {
27
+ properties.leftIcon = <Icon name={leftIconName} />;
28
+ }
29
+ if (rightIconName) {
30
+ properties.rightIcon = <Icon name={rightIconName} />;
31
+ }
32
+ if (leftIconName || rightIconName) {
33
+ properties.iconSpacing = size === 'medium' ? '10px' : '6px';
34
+ }
35
+ if (as === 'a') {
36
+ delete properties.type;
37
+ } else {
38
+ /* @ts-ignore */
39
+ delete properties.href;
40
+ /* @ts-ignore */
41
+ delete properties.target;
42
+ }
43
+ return <ChakraButton ref={ref} {...properties} />;
44
+ });
45
+
46
+ Button.defaultProps = {
47
+ as: 'button',
48
+ size: 'medium',
49
+ variant: 'primary',
50
+ };
51
+
52
+ export default Button;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { sortObjectByKey } from '../../shared';
4
+ import { IconList } from '../../../Icon/tsx';
5
+ import IconButton from './IconButton';
6
+
7
+ export default {
8
+ title: 'Components/IconButton',
9
+ component: IconButton,
10
+ argTypes: {
11
+ iconName: {
12
+ options: IconList,
13
+ },
14
+ },
15
+ } as ComponentMeta<typeof IconButton>;
16
+
17
+ const Template: ComponentStory<typeof IconButton> = ({ ...props }) => <IconButton {...props} />;
18
+
19
+ export const WithProps = Template.bind({});
20
+ WithProps.args = sortObjectByKey({
21
+ ...IconButton.defaultProps,
22
+ iconName: 'AddOns',
23
+ label: 'This is the label',
24
+ });
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { IconButton as ChakraIconButton, IconButtonProps } from '@chakra-ui/react';
3
+ import { Icon, TypeIconName } from '@bitrise/bitkit';
4
+
5
+ export interface Props {
6
+ iconName: TypeIconName;
7
+ label: IconButtonProps['aria-label'];
8
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
9
+ size?: 'small' | 'medium';
10
+ sx?: IconButtonProps['sx'];
11
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'dangerPrimary' | 'dangerSecondary';
12
+ }
13
+
14
+ const IconButton = React.forwardRef<HTMLButtonElement, Props>((props: Props, ref) => {
15
+ const { iconName, label, ...rest } = props;
16
+ const properties: IconButtonProps = {
17
+ 'aria-label': label,
18
+ icon: <Icon name={iconName} />,
19
+ ...rest,
20
+ };
21
+ return <ChakraIconButton ref={ref} {...properties} />;
22
+ });
23
+
24
+ IconButton.defaultProps = {
25
+ size: 'medium',
26
+ variant: 'primary',
27
+ } as Props;
28
+
29
+ export default IconButton;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { sortObjectByKey } from '../../shared';
4
+ import Link from './Link';
5
+
6
+ export default {
7
+ title: 'Components/Link',
8
+ component: Link,
9
+ } as ComponentMeta<typeof Link>;
10
+
11
+ const Template: ComponentStory<typeof Link> = ({ ...props }) => <Link {...props} />;
12
+
13
+ export const WithProps = Template.bind({});
14
+ WithProps.args = sortObjectByKey({
15
+ ...Link.defaultProps,
16
+ children: 'The quick brown fox jumps over the lazy dog.',
17
+ href: '#',
18
+ target: '_self',
19
+ });
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Link as ChakraLink, LinkProps } from '@chakra-ui/react';
3
+
4
+ export type TypeLinkColor = 'grape-3' | 'grape-5' | 'gray-1' | 'gray-5' | 'white' | 'inherit';
5
+
6
+ export interface Props {
7
+ children: LinkProps['children'];
8
+ color?: TypeLinkColor;
9
+ href: string;
10
+ isUnderlined?: boolean;
11
+ target?: '_blank' | '_parent' | '_self' | '_top';
12
+ }
13
+
14
+ const Link = (props: Props) => {
15
+ const { isUnderlined, ...rest } = props;
16
+ const properties: LinkProps = { ...rest };
17
+ properties.as = 'a';
18
+ if (isUnderlined) {
19
+ properties.textDecoration = 'underline';
20
+ }
21
+
22
+ return <ChakraLink {...properties} />;
23
+ };
24
+
25
+ Link.defaultProps = {
26
+ color: 'grape-3',
27
+ isUnderlined: true,
28
+ } as Props;
29
+
30
+ export default Link;
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { ButtonGroup, HStack, MenuButton, MenuList } from '@chakra-ui/react';
4
+ import Button from '../Button/Button';
5
+ import IconButton from '../IconButton/IconButton';
6
+ import Menu from './Menu';
7
+ import MenuItem from './MenuItem';
8
+
9
+ export default {
10
+ title: 'Components/Menu',
11
+ component: Menu,
12
+ subcomponents: { MenuButton, MenuList, MenuItem },
13
+ } as ComponentMeta<typeof Menu>;
14
+
15
+ export const WithButton: ComponentStory<typeof Menu> = () => (
16
+ <Menu>
17
+ <MenuButton as={Button}>Actions</MenuButton>
18
+ <MenuList>
19
+ <MenuItem iconName="AddOnsColorTuorqouise">Download</MenuItem>
20
+ <MenuItem iconName="AddOnsColorTuorqouise">Create a Copy</MenuItem>
21
+ <MenuItem iconName="AddOnsColorTuorqouise">Mark as Draft</MenuItem>
22
+ <MenuItem iconName="AddOnsColorTuorqouise">Delete</MenuItem>
23
+ <MenuItem iconName="AddOnsColorTuorqouise">Attend a Workshop</MenuItem>
24
+ </MenuList>
25
+ </Menu>
26
+ );
27
+
28
+ export const WithIconButton: ComponentStory<typeof Menu> = () => (
29
+ <Menu>
30
+ <MenuButton as={IconButton} iconName="AddOnsColorTuorqouise" label="Open menu" />
31
+ <MenuList>
32
+ <MenuItem iconName="AddOnsColorTuorqouise">Download</MenuItem>
33
+ <MenuItem iconName="AddOnsColorTuorqouise">Create a Copy</MenuItem>
34
+ <MenuItem iconName="AddOnsColorTuorqouise">Mark as Draft</MenuItem>
35
+ <MenuItem iconName="AddOnsColorTuorqouise">Delete</MenuItem>
36
+ <MenuItem iconName="AddOnsColorTuorqouise">Attend a Workshop</MenuItem>
37
+ </MenuList>
38
+ </Menu>
39
+ );
40
+
41
+ export const WithButtonGroup: ComponentStory<typeof Menu> = () => (
42
+ <HStack justifyContent="end">
43
+ <ButtonGroup isAttached>
44
+ <Button>Button</Button>
45
+ <Menu>
46
+ <MenuButton as={IconButton} iconName="AddOnsColorTuorqouise" label="Open menu" />
47
+ <MenuList>
48
+ <MenuItem iconName="AddOnsColorTuorqouise">Download</MenuItem>
49
+ <MenuItem iconName="AddOnsColorTuorqouise">Create a Copy</MenuItem>
50
+ <MenuItem iconName="AddOnsColorTuorqouise">Mark as Draft</MenuItem>
51
+ <MenuItem iconName="AddOnsColorTuorqouise">Delete</MenuItem>
52
+ <MenuItem iconName="AddOnsColorTuorqouise">Attend a Workshop</MenuItem>
53
+ </MenuList>
54
+ </Menu>
55
+ </ButtonGroup>
56
+ </HStack>
57
+ );
@@ -0,0 +1,23 @@
1
+ import type { SystemStyleObject } from '@chakra-ui/theme-tools';
2
+
3
+ const MenuTheme: SystemStyleObject = {
4
+ baseStyle: {
5
+ list: {
6
+ backgroundColor: '#fff',
7
+ borderRadius: '8px',
8
+ filter: 'drop-shadow(0 0.125rem 0.3125rem rgba(199, 205, 207, 0.7))',
9
+ paddingY: '16px',
10
+ },
11
+ item: {
12
+ padding: '12px 32px',
13
+ _focus: {
14
+ backgroundColor: '#F8F0FF',
15
+ },
16
+ _hover: {
17
+ backgroundColor: '#F8F0FF',
18
+ },
19
+ },
20
+ },
21
+ };
22
+
23
+ export default MenuTheme;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { Menu as ChakraMenu, MenuProps } from '@chakra-ui/react';
3
+
4
+ export type Props = MenuProps;
5
+
6
+ const Menu = (props: Props) => <ChakraMenu {...props} />;
7
+
8
+ export default Menu;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { MenuItem as ChakraMenuItem, MenuItemProps } from '@chakra-ui/react';
3
+ import { Icon, TypeIconName } from '@bitrise/bitkit';
4
+
5
+ export type Props = {
6
+ children: string;
7
+ iconName: TypeIconName;
8
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
9
+ };
10
+
11
+ const MenuItem = (props: Props) => {
12
+ const { iconName, ...rest } = props;
13
+ const properties: MenuItemProps = { ...rest };
14
+ properties.icon = <Icon name={iconName} />;
15
+ properties.iconSpacing = '16px';
16
+ return <ChakraMenuItem {...properties} />;
17
+ };
18
+
19
+ export default MenuItem;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { sortObjectByKey } from '../../shared';
4
+ import StatusTag, { Props } from './StatusTag';
5
+
6
+ export default {
7
+ title: 'Components/StatusTag',
8
+ component: StatusTag,
9
+ } as ComponentMeta<typeof StatusTag>;
10
+
11
+ const Template: ComponentStory<typeof StatusTag> = ({ ...props }) => <StatusTag {...props} />;
12
+
13
+ export const WithProps = Template.bind({});
14
+ WithProps.args = sortObjectByKey({
15
+ ...StatusTag.defaultProps,
16
+ children: 'Running',
17
+ // iconName: 'BuildstatusLoadingAnimated',
18
+ variant: 'running',
19
+ } as Props);
@@ -0,0 +1,45 @@
1
+ const StatusTagTheme = {
2
+ baseStyle: {
3
+ borderRadius: '4px',
4
+ paddingX: '8px',
5
+ },
6
+ sizes: {
7
+ small: {
8
+ paddingY: '4px',
9
+ },
10
+ normal: {
11
+ paddingY: '8px',
12
+ },
13
+ big: {
14
+ paddingY: '20px',
15
+ },
16
+ },
17
+ variants: {
18
+ aborted: {
19
+ backgroundColor: '#FFF6D1',
20
+ color: '#875B00',
21
+ },
22
+ failed: {
23
+ backgroundColor: '#FFF0F3',
24
+ color: '#A91E2E',
25
+ },
26
+ onHold: {
27
+ backgroundColor: '#F6F4F6',
28
+ color: '#6B6071',
29
+ },
30
+ running: {
31
+ backgroundColor: '#F9F2FD',
32
+ color: '#492F5C',
33
+ },
34
+ starting: {
35
+ backgroundColor: '#ECF8FD',
36
+ color: '#1066AC',
37
+ },
38
+ success: {
39
+ backgroundColor: '#EEF9F1',
40
+ color: '#167231',
41
+ },
42
+ },
43
+ };
44
+
45
+ export default StatusTagTheme;