@clickhouse/click-ui 0.0.2 → 0.0.4

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 (237) hide show
  1. package/dist/click-ui.es.js +15975 -0
  2. package/dist/click-ui.umd.js +442 -0
  3. package/package.json +13 -4
  4. package/.eslintrc.cjs +0 -33
  5. package/.github/workflows/deployment.yml +0 -34
  6. package/.prettierrc +0 -14
  7. package/.storybook/main.ts +0 -19
  8. package/.storybook/manager.ts +0 -11
  9. package/.storybook/preview-head.html +0 -2
  10. package/.storybook/preview.tsx +0 -76
  11. package/.storybook/theme.ts +0 -16
  12. package/build-tokens.js +0 -131
  13. package/index.html +0 -17
  14. package/jest.config.ts +0 -11
  15. package/src/App.css +0 -1
  16. package/src/App.module.css +0 -235
  17. package/src/App.tsx +0 -217
  18. package/src/assets/RightArrow/RightArrow.tsx +0 -17
  19. package/src/assets/S3Logo/S3Logo.tsx +0 -31
  20. package/src/assets/react.svg +0 -1
  21. package/src/components/Accordion/Accordion.stories.tsx +0 -28
  22. package/src/components/Accordion/Accordion.test.tsx +0 -46
  23. package/src/components/Accordion/Accordion.tsx +0 -119
  24. package/src/components/Alert/Alert.stories.tsx +0 -14
  25. package/src/components/Alert/Alert.test.tsx +0 -27
  26. package/src/components/Alert/Alert.tsx +0 -130
  27. package/src/components/Avatar/Avatar.stories.tsx +0 -13
  28. package/src/components/Avatar/Avatar.tsx +0 -64
  29. package/src/components/Badge/Badge.stories.ts +0 -30
  30. package/src/components/Badge/Badge.test.tsx +0 -16
  31. package/src/components/Badge/Badge.tsx +0 -78
  32. package/src/components/BigStat/BigStat.stories.ts +0 -20
  33. package/src/components/BigStat/BigStat.tsx +0 -49
  34. package/src/components/Button/Button.stories.ts +0 -26
  35. package/src/components/Button/Button.test.tsx +0 -32
  36. package/src/components/Button/Button.tsx +0 -115
  37. package/src/components/ButtonGroup/ButtonGroup.stories.ts +0 -14
  38. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -78
  39. package/src/components/Card/Card.stories.ts +0 -19
  40. package/src/components/Card/Card.tsx +0 -107
  41. package/src/components/Checkbox/Checkbox.stories.tsx +0 -35
  42. package/src/components/Checkbox/Checkbox.test.tsx +0 -41
  43. package/src/components/Checkbox/Checkbox.tsx +0 -89
  44. package/src/components/ContextMenu/ContextMenu.stories.tsx +0 -73
  45. package/src/components/ContextMenu/ContextMenu.test.tsx +0 -152
  46. package/src/components/ContextMenu/ContextMenu.tsx +0 -155
  47. package/src/components/Dropdown/Dropdown.stories.tsx +0 -64
  48. package/src/components/Dropdown/Dropdown.test.tsx +0 -141
  49. package/src/components/Dropdown/Dropdown.tsx +0 -149
  50. package/src/components/FormField/Label.stories.tsx +0 -39
  51. package/src/components/FormField/Label.tsx +0 -47
  52. package/src/components/FormField/Select.stories.tsx +0 -48
  53. package/src/components/FormField/Select.test.tsx +0 -216
  54. package/src/components/FormField/Select.tsx +0 -574
  55. package/src/components/FormField/SelectContext.tsx +0 -101
  56. package/src/components/FormField/commonElement.tsx +0 -42
  57. package/src/components/GenericMenu.tsx +0 -114
  58. package/src/components/HoverCard/HoverCard.stories.tsx +0 -64
  59. package/src/components/HoverCard/HoverCard.test.tsx +0 -85
  60. package/src/components/HoverCard/HoverCard.tsx +0 -65
  61. package/src/components/Icon/Icon.stories.ts +0 -15
  62. package/src/components/Icon/Icon.tsx +0 -238
  63. package/src/components/Icon/types.ts +0 -95
  64. package/src/components/IconButton/IconButton.stories.ts +0 -34
  65. package/src/components/IconButton/IconButton.test.tsx +0 -32
  66. package/src/components/IconButton/IconButton.tsx +0 -83
  67. package/src/components/Panel/Panel.stories.tsx +0 -25
  68. package/src/components/Panel/Panel.tsx +0 -33
  69. package/src/components/Popover/Popover.stories.tsx +0 -67
  70. package/src/components/Popover/Popover.test.tsx +0 -46
  71. package/src/components/Popover/Popover.tsx +0 -115
  72. package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -43
  73. package/src/components/RadioGroup/RadioGroup.test.tsx +0 -59
  74. package/src/components/RadioGroup/RadioGroup.tsx +0 -149
  75. package/src/components/Separator/Separator.stories.tsx +0 -24
  76. package/src/components/Separator/Separator.tsx +0 -29
  77. package/src/components/SidebarNavigationItem/SidebarNavigationItem.stories.tsx +0 -28
  78. package/src/components/SidebarNavigationItem/SidebarNavigationItem.tsx +0 -112
  79. package/src/components/Spacer/Spacer.stories.tsx +0 -20
  80. package/src/components/Spacer/Spacer.tsx +0 -15
  81. package/src/components/Switch/Switch.stories.ts +0 -14
  82. package/src/components/Switch/Switch.tsx +0 -107
  83. package/src/components/Table/Table.stories.tsx +0 -29
  84. package/src/components/Table/Table.tsx +0 -109
  85. package/src/components/Tabs/Tabs.stories.tsx +0 -36
  86. package/src/components/Tabs/Tabs.test.tsx +0 -86
  87. package/src/components/Tabs/Tabs.tsx +0 -82
  88. package/src/components/Tooltip/Tooltip.stories.tsx +0 -68
  89. package/src/components/Tooltip/Tooltip.test.tsx +0 -44
  90. package/src/components/Tooltip/Tooltip.tsx +0 -67
  91. package/src/components/Typography/Text/Text.stories.tsx +0 -22
  92. package/src/components/Typography/Text/Text.test.tsx +0 -16
  93. package/src/components/Typography/Text/Text.tsx +0 -30
  94. package/src/components/Typography/Title/Title.stories.tsx +0 -31
  95. package/src/components/Typography/Title/Title.test.tsx +0 -16
  96. package/src/components/Typography/Title/Title.tsx +0 -36
  97. package/src/components/icons/Activity.tsx +0 -30
  98. package/src/components/icons/ArrowDown.tsx +0 -22
  99. package/src/components/icons/ArrowRight.tsx +0 -22
  100. package/src/components/icons/ArrowTriangle.tsx +0 -36
  101. package/src/components/icons/ArrowUp.tsx +0 -22
  102. package/src/components/icons/Backups.tsx +0 -29
  103. package/src/components/icons/Blog.tsx +0 -38
  104. package/src/components/icons/Book.tsx +0 -30
  105. package/src/components/icons/Brackets.tsx +0 -22
  106. package/src/components/icons/Briefcase.tsx +0 -30
  107. package/src/components/icons/Building.tsx +0 -30
  108. package/src/components/icons/BurgerMenu.tsx +0 -22
  109. package/src/components/icons/Cards.tsx +0 -30
  110. package/src/components/icons/CellTower.tsx +0 -21
  111. package/src/components/icons/ChatIcon.tsx +0 -22
  112. package/src/components/icons/CheckIcon.tsx +0 -21
  113. package/src/components/icons/CheckInCircle.tsx +0 -39
  114. package/src/components/icons/ChevronDown.tsx +0 -20
  115. package/src/components/icons/ChevronLeft.tsx +0 -22
  116. package/src/components/icons/ChevronRight.tsx +0 -20
  117. package/src/components/icons/ChevronUp.tsx +0 -22
  118. package/src/components/icons/Clock.tsx +0 -37
  119. package/src/components/icons/Cloud.tsx +0 -23
  120. package/src/components/icons/Code.tsx +0 -22
  121. package/src/components/icons/CodeInSquare.tsx +0 -30
  122. package/src/components/icons/Connect.tsx +0 -22
  123. package/src/components/icons/ConnectAlt.tsx +0 -30
  124. package/src/components/icons/Console.tsx +0 -30
  125. package/src/components/icons/Copy.tsx +0 -33
  126. package/src/components/icons/CrossIcon.tsx +0 -29
  127. package/src/components/icons/Data.tsx +0 -36
  128. package/src/components/icons/DatabaseIcon.tsx +0 -31
  129. package/src/components/icons/Disk.tsx +0 -30
  130. package/src/components/icons/Display.tsx +0 -30
  131. package/src/components/icons/Document.tsx +0 -30
  132. package/src/components/icons/DotsHorizontal.tsx +0 -36
  133. package/src/components/icons/DotsVertical.tsx +0 -33
  134. package/src/components/icons/Email.tsx +0 -33
  135. package/src/components/icons/Empty.tsx +0 -14
  136. package/src/components/icons/FilterIcon.tsx +0 -37
  137. package/src/components/icons/Fire.tsx +0 -23
  138. package/src/components/icons/Flags/EuropeanUnion.tsx +0 -174
  139. package/src/components/icons/Flags/Germany.tsx +0 -25
  140. package/src/components/icons/Flags/India.tsx +0 -48
  141. package/src/components/icons/Flags/Ireland.tsx +0 -32
  142. package/src/components/icons/Flags/Netherlands.tsx +0 -29
  143. package/src/components/icons/Flags/Singapore.tsx +0 -43
  144. package/src/components/icons/Flags/UnitedKingdom.tsx +0 -32
  145. package/src/components/icons/Flags/UnitedStates.tsx +0 -26
  146. package/src/components/icons/Flags/index.tsx +0 -46
  147. package/src/components/icons/Folder.tsx +0 -20
  148. package/src/components/icons/Gift.tsx +0 -21
  149. package/src/components/icons/HistoryIcon.tsx +0 -28
  150. package/src/components/icons/Home.tsx +0 -29
  151. package/src/components/icons/Http.tsx +0 -22
  152. package/src/components/icons/Icons.mdx +0 -39
  153. package/src/components/icons/InfoInCircleIcon.tsx +0 -37
  154. package/src/components/icons/InformationIcon.tsx +0 -34
  155. package/src/components/icons/InsertRowIcon.tsx +0 -34
  156. package/src/components/icons/Integrations.tsx +0 -29
  157. package/src/components/icons/LightBulb.tsx +0 -40
  158. package/src/components/icons/Lightening.tsx +0 -30
  159. package/src/components/icons/Loading.tsx +0 -57
  160. package/src/components/icons/Metrics.tsx +0 -38
  161. package/src/components/icons/MetricsAlt.tsx +0 -30
  162. package/src/components/icons/Payment.tsx +0 -23
  163. package/src/components/icons/Payments/Amex.tsx +0 -44
  164. package/src/components/icons/Payments/MasterCard.tsx +0 -48
  165. package/src/components/icons/Payments/Paypal.tsx +0 -41
  166. package/src/components/icons/Payments/Visa.tsx +0 -36
  167. package/src/components/icons/Payments/index.tsx +0 -30
  168. package/src/components/icons/Pencil.tsx +0 -30
  169. package/src/components/icons/PieChart.tsx +0 -30
  170. package/src/components/icons/Play.tsx +0 -30
  171. package/src/components/icons/Plus.tsx +0 -22
  172. package/src/components/icons/Popout.tsx +0 -22
  173. package/src/components/icons/PopoverArrow.tsx +0 -22
  174. package/src/components/icons/Question.tsx +0 -30
  175. package/src/components/icons/Refresh.tsx +0 -29
  176. package/src/components/icons/Search.tsx +0 -22
  177. package/src/components/icons/Secure.tsx +0 -30
  178. package/src/components/icons/Services.tsx +0 -23
  179. package/src/components/icons/Settings.tsx +0 -22
  180. package/src/components/icons/Share.tsx +0 -29
  181. package/src/components/icons/SlideIn.tsx +0 -28
  182. package/src/components/icons/SlideOut.tsx +0 -28
  183. package/src/components/icons/SortAltIcon.tsx +0 -22
  184. package/src/components/icons/SortIcon.tsx +0 -24
  185. package/src/components/icons/Sparkle.tsx +0 -23
  186. package/src/components/icons/Speaker.tsx +0 -30
  187. package/src/components/icons/Speed.tsx +0 -29
  188. package/src/components/icons/Star.tsx +0 -23
  189. package/src/components/icons/Support.tsx +0 -37
  190. package/src/components/icons/Table.tsx +0 -30
  191. package/src/components/icons/Taxi.tsx +0 -120
  192. package/src/components/icons/Trash.tsx +0 -22
  193. package/src/components/icons/Upload.tsx +0 -29
  194. package/src/components/icons/Url.tsx +0 -22
  195. package/src/components/icons/UserIcon.tsx +0 -17
  196. package/src/components/icons/UsersIcon.tsx +0 -43
  197. package/src/components/icons/WarningIcon.tsx +0 -30
  198. package/src/components/index.ts +0 -35
  199. package/src/components/types.ts +0 -1
  200. package/src/index.css +0 -9
  201. package/src/index.ts +0 -2
  202. package/src/main.tsx +0 -11
  203. package/src/stories/assets/code-brackets.svg +0 -1
  204. package/src/stories/assets/colors.svg +0 -1
  205. package/src/stories/assets/comments.svg +0 -1
  206. package/src/stories/assets/direction.svg +0 -1
  207. package/src/stories/assets/flow.svg +0 -1
  208. package/src/stories/assets/plugin.svg +0 -1
  209. package/src/stories/assets/repo.svg +0 -1
  210. package/src/stories/assets/stackalt.svg +0 -1
  211. package/src/styles/Home.module.css +0 -235
  212. package/src/styles/globals.css +0 -111
  213. package/src/styles/types.ts +0 -2089
  214. package/src/styles/variables.classic.css +0 -16
  215. package/src/styles/variables.classic.json +0 -202
  216. package/src/styles/variables.css +0 -763
  217. package/src/styles/variables.dark.css +0 -135
  218. package/src/styles/variables.dark.json +0 -894
  219. package/src/styles/variables.json +0 -2087
  220. package/src/styles/variables.light.css +0 -203
  221. package/src/styles/variables.light.json +0 -949
  222. package/src/theme/index.ts +0 -22
  223. package/src/theme/theme.tsx +0 -28
  224. package/src/vite-env.d.ts +0 -1
  225. package/tokens/themes/$metadata.json +0 -9
  226. package/tokens/themes/$themes.json +0 -3657
  227. package/tokens/themes/classic.json +0 -550
  228. package/tokens/themes/component.json +0 -2252
  229. package/tokens/themes/dark.json +0 -2563
  230. package/tokens/themes/light.json +0 -2645
  231. package/tokens/themes/primitives.json +0 -947
  232. package/tsconfig.json +0 -27
  233. package/tsconfig.node.json +0 -10
  234. package/vite.config.ts +0 -40
  235. /package/{public → dist}/favicon.ico +0 -0
  236. /package/{public → dist}/logo.svg +0 -0
  237. /package/{public → dist}/vite.svg +0 -0
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -1,28 +0,0 @@
1
- import { Accordion } from "./Accordion";
2
-
3
- export default {
4
- component: Accordion,
5
- title: "Display/Accordion",
6
- tags: ["accordion", "autodocs"],
7
- };
8
-
9
- const children = (
10
- <div style={{ padding: "8px", border: "1px solid #f1f1f1" }}>
11
- <h2>Content</h2>
12
- <p>
13
- Lorem Ipsum is simply dummy text of the printing and typesetting industry.
14
- Lorem Ipsum has been the industry's standard Lorem Ipsum is simply dummy
15
- text of the printing and typesetting industry. Lorem Ipsum has been the
16
- industry's standard Lorem Ipsum is simply dummy text of the printing and
17
- typesetting industry. Lorem Ipsum has been the industry's standard
18
- </p>
19
- </div>
20
- );
21
- export const Playground = {
22
- args: {
23
- title: "Accordion title",
24
- theme: "light",
25
- size: "medium",
26
- children,
27
- },
28
- };
@@ -1,46 +0,0 @@
1
- import { render, fireEvent } from "@testing-library/react";
2
- import { Accordion } from "./Accordion";
3
- import { ThemeProvider } from "styled-components";
4
- import { themes } from "../../theme";
5
-
6
- interface RenderAccordionProps {
7
- title: string;
8
- content?: string;
9
- }
10
-
11
- describe("Accordion", () => {
12
- const renderAccordion = ({ title, content }: RenderAccordionProps) =>
13
- render(
14
- <ThemeProvider theme={themes.dark}>
15
- <Accordion title={title}>
16
- <div>{content}</div>
17
- </Accordion>
18
- </ThemeProvider>
19
- );
20
- it("given no arguments, should render the accordion", () => {
21
- const title = "Test accordion";
22
- const rendered = renderAccordion({ title });
23
-
24
- const accordion = rendered.getByText(title);
25
- expect(accordion).toBeTruthy;
26
- });
27
-
28
- it("given a title, should render the accordion's title", () => {
29
- const title = "Test title";
30
- const rendered = renderAccordion({ title });
31
-
32
- const accordion = rendered.getByText(title);
33
- expect(accordion.textContent).toEqual(title);
34
- });
35
-
36
- it("given some content, should render the content when clicked", () => {
37
- const content = "Accordion content";
38
- const title = "Test title";
39
- const rendered = renderAccordion({ title, content });
40
-
41
- const accordion = rendered.getByText(title);
42
- fireEvent.click(accordion);
43
- const accordionContent = rendered.getByText(content);
44
- expect(accordionContent.textContent).toEqual(content);
45
- });
46
- });
@@ -1,119 +0,0 @@
1
- import * as RadixAccordion from "@radix-ui/react-accordion";
2
- import styled from "styled-components";
3
- import { IconName } from "@/components/Icon/types";
4
- import { Icon } from "@/components";
5
-
6
- type Size = "small" | "medium" | "large";
7
- export interface AccordionProps extends SizeProp {
8
- title: string;
9
- icon?: IconName;
10
- iconSize?: Size;
11
- children: React.ReactNode;
12
- }
13
-
14
- interface TriggerProps extends RadixAccordion.AccordionTriggerProps, SizeProp {}
15
- interface SizeProp {
16
- size?: Size;
17
- }
18
-
19
- const Accordion = ({
20
- title,
21
- size = "medium",
22
- icon,
23
- iconSize,
24
- children,
25
- ...delegated
26
- }: AccordionProps) => (
27
- <AccordionRoot type="single" collapsible {...delegated}>
28
- <AccordionItem value="item">
29
- <AccordionTrigger size={size}>
30
- <AccordionIconsWrapper>
31
- <AccordionIconWrapper>
32
- <Icon name="chevron-right" size={iconSize || size} />
33
- </AccordionIconWrapper>
34
- {icon ? <Icon name={icon} size={iconSize || size} /> : null}
35
- </AccordionIconsWrapper>
36
- <p>{title}</p>
37
- </AccordionTrigger>
38
- <AccordionContent>{children}</AccordionContent>
39
- </AccordionItem>
40
- </AccordionRoot>
41
- );
42
-
43
- const AccordionRoot = styled(RadixAccordion.Root)``;
44
-
45
- const AccordionItem = styled(RadixAccordion.Item)``;
46
-
47
- const AccordionTrigger = styled(RadixAccordion.Trigger)<TriggerProps>`
48
- border: none;
49
- padding: 0;
50
- background-color: transparent;
51
- display: flex;
52
- align-items: center;
53
- gap: ${props =>
54
- props.theme.click.accordion[props.size || "medium"].space.gap};
55
-
56
- color: ${props => props.theme.click.accordion.color.label.default};
57
- font: ${props =>
58
- props.theme.click.accordion[props.size || "medium"].typography.label
59
- .default};
60
-
61
- &:active {
62
- color: ${props => props.theme.click.accordion.color.label.active};
63
- font: ${props =>
64
- props.theme.click.accordion[props.size || "medium"].typography.label
65
- .active};
66
- }
67
-
68
- &:hover {
69
- color: ${props => props.theme.click.accordion.color.label.hover};
70
- cursor: pointer;
71
- }
72
- `;
73
-
74
- const AccordionIconWrapper = styled.div`
75
- display: flex;
76
- align-items: center;
77
- justify-content: center;
78
- transition: transform 200ms cubic-bezier(0.87, 0, 0.13, 1);
79
-
80
- ${AccordionTrigger}[data-state='open'] & {
81
- transform: rotate(90deg);
82
- }
83
- `;
84
- const AccordionIconsWrapper = styled.div`
85
- display: flex;
86
- align-items: center;
87
- justify-content: center;
88
- `;
89
-
90
- const AccordionContent = styled(RadixAccordion.Content)``;
91
-
92
- const SidebarAccordion = styled(Accordion)`
93
- ${AccordionTrigger} {
94
- gap: ${props =>
95
- props.theme.click.sidebar.navigation.item.default.space.gap};
96
- }
97
- p {
98
- margin: 0;
99
- }
100
-
101
- ${AccordionIconWrapper} {
102
- visibility: hidden;
103
- }
104
-
105
- &:hover ${AccordionIconWrapper} {
106
- visibility: revert;
107
- }
108
- &:active ${AccordionIconWrapper} {
109
- visibility: revert;
110
- }
111
-
112
- ${AccordionTrigger}[data-state='open'] ${AccordionIconWrapper} {
113
- visibility: revert;
114
- }
115
- `;
116
- // This allows the Accordion to be referenced inside other
117
- // components css
118
- const AccordionToExport = styled(Accordion)``;
119
- export { AccordionToExport as Accordion, SidebarAccordion };
@@ -1,14 +0,0 @@
1
- import { Alert } from "@/components/Alert/Alert";
2
-
3
- export default {
4
- component: Alert,
5
- title: "Display/Alert",
6
- tags: ["alert", "autodocs"],
7
- };
8
-
9
- export const Playground = {
10
- args: {
11
- state: "success",
12
- text: "An alert example",
13
- },
14
- };
@@ -1,27 +0,0 @@
1
- import { ThemeProvider } from "@/theme";
2
- import { Alert, AlertProps } from "./Alert";
3
- import { render, waitFor } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
-
6
- describe("Alert", () => {
7
- const renderAlert = (props: AlertProps) =>
8
- render(
9
- <ThemeProvider theme="light">
10
- <Alert {...props} />
11
- </ThemeProvider>
12
- );
13
-
14
- it("given a dismissible alert, should not be visible after dismissing it", async () => {
15
- const text = "Test alert component";
16
- const { queryAllByText, getByTestId } = renderAlert({
17
- text,
18
- dismissible: true,
19
- });
20
-
21
- expect(queryAllByText(text).length).toEqual(1);
22
-
23
- const dismissButton = getByTestId("click-alert-dismiss-button");
24
- userEvent.click(dismissButton);
25
- await waitFor(() => expect(queryAllByText(text).length).toEqual(0));
26
- });
27
- });
@@ -1,130 +0,0 @@
1
- import { Icon } from "@/components";
2
- import { IconName } from "@/components/Icon/types";
3
- import { useState } from "react";
4
- import styled from "styled-components";
5
-
6
- type AlertSize = "small" | "medium";
7
- type AlertState = "neutral" | "success" | "warning" | "danger" | "info";
8
- export type AlertProps = {
9
- state?: AlertState;
10
- title?: string;
11
- text: string;
12
- size?: AlertSize;
13
- showIcon?: boolean;
14
- dismissible?: boolean;
15
- };
16
-
17
- const stateIconMap: Record<AlertState, IconName> = {
18
- neutral: "information",
19
- success: "check",
20
- warning: "warning",
21
- danger: "warning",
22
- info: "information",
23
- };
24
- const Alert = ({
25
- text,
26
- title = "",
27
- size = "small",
28
- state = "neutral",
29
- showIcon = true,
30
- dismissible,
31
- ...delegated
32
- }: AlertProps) => {
33
- const [isVisible, setIsVisible] = useState(true);
34
-
35
- return isVisible ? (
36
- <Wrapper size={size} state={state} data-testid="click-alert" {...delegated}>
37
- {showIcon && (
38
- <IconWrapper state={state} size={size}>
39
- <StyledIcon size={size} name={stateIconMap[state]} />
40
- </IconWrapper>
41
- )}
42
- <TextWrapper state={state} size={size}>
43
- {title && <Title size={size}>{title}</Title>}
44
- <Text size={size}>{text}</Text>
45
- </TextWrapper>
46
- {dismissible && (
47
- <DismissWrapper
48
- data-testid="click-alert-dismiss-button"
49
- state={state}
50
- onClick={() => setIsVisible(false)}
51
- >
52
- <Icon name="cross" />
53
- </DismissWrapper>
54
- )}
55
- </Wrapper>
56
- ) : null;
57
- };
58
-
59
- const Wrapper = styled.div<{
60
- state: AlertState;
61
- size: AlertSize;
62
- }>`
63
- display: flex;
64
- border-radius: ${props => props.theme.click.alert.radii.end};
65
- background-color: ${({ state = "neutral", theme }) =>
66
- theme.click.alert.color.background[state]};
67
- color: ${({ state = "neutral", theme }) =>
68
- theme.click.alert.color.text[state]};
69
- `;
70
-
71
- const IconWrapper = styled.div<{ state: AlertState; size: AlertSize }>`
72
- display: flex;
73
- align-items: center;
74
- background-color: ${({ state = "neutral", theme }) =>
75
- theme.click.alert.color.iconBackground[state]};
76
- color: ${({ state = "neutral", theme }) =>
77
- theme.click.alert.color.iconForeground[state]};
78
- border-top-left-radius: ${props => props.theme.click.alert.radii.end};
79
- border-bottom-left-radius: ${props => props.theme.click.alert.radii.end};
80
- padding: ${props =>
81
- `${props.theme.click.alert[props.size].space.y} ${
82
- props.theme.click.alert[props.size].space.x
83
- }`};
84
- `;
85
-
86
- const StyledIcon = styled(Icon)<{ size: AlertSize }>`
87
- height: ${props => props.theme.click.alert[props.size].icon.height};
88
- width: ${props => props.theme.click.alert[props.size].icon.width};
89
- `;
90
- const TextWrapper = styled.div<{ state: AlertState; size: AlertSize }>`
91
- display: flex;
92
- flex-flow: column;
93
- gap: ${props => props.theme.click.alert[props.size].space.gap};
94
- padding: ${props =>
95
- `${props.theme.click.alert[props.size].space.y} ${
96
- props.theme.click.alert[props.size].space.x
97
- }`};
98
- `;
99
- const Title = styled.h6<{ size: AlertSize }>`
100
- margin: 0;
101
- font: ${props =>
102
- props.theme.click.alert[props.size].typography.title.default};
103
- `;
104
- const Text = styled.p<{ size: AlertSize }>`
105
- margin: 0;
106
- font: ${props => props.theme.click.alert[props.size].typography.text.default};
107
- `;
108
-
109
- const DismissWrapper = styled.button<{ state: AlertState }>`
110
- display: flex;
111
- align-items: center;
112
- margin-left: auto;
113
- border: none;
114
- background-color: transparent;
115
- color: inherit;
116
- `;
117
-
118
- const DangerAlert = (props: AlertProps) => <Alert {...props} state="danger" />;
119
-
120
- const InfoAlert = (props: AlertProps) => <Alert {...props} state="info" />;
121
-
122
- const SuccessAlert = (props: AlertProps) => (
123
- <Alert {...props} state="success" />
124
- );
125
-
126
- const WarningAlert = (props: AlertProps) => (
127
- <Alert {...props} state="warning" />
128
- );
129
-
130
- export { Alert, DangerAlert, InfoAlert, SuccessAlert, WarningAlert };
@@ -1,13 +0,0 @@
1
- import { Avatar } from "./Avatar";
2
-
3
- export default {
4
- component: Avatar,
5
- title: "Display/Avatar",
6
- tags: ["avatar","autodocs"],
7
- };
8
-
9
- export const Playground = {
10
- args: {
11
- text: "CM",
12
- },
13
- };
@@ -1,64 +0,0 @@
1
- import { Fallback, Root } from "@radix-ui/react-avatar";
2
- import styled from "styled-components";
3
-
4
- type TextSize = "md" | "sm";
5
-
6
- export type AvatarProps = {
7
- text: string;
8
- textSize?: TextSize;
9
- };
10
-
11
- const Avatar = ({ text = "", textSize = "sm", ...delegated }: AvatarProps) => (
12
- <StyledRoot {...delegated}>
13
- <StyledFallback textSize={textSize}>{text}</StyledFallback>
14
- </StyledRoot>
15
- );
16
-
17
- const StyledRoot = styled(Root)`
18
- width: ${props => props.theme.click.avatar.size.width};
19
- height: ${props => props.theme.click.avatar.size.height};
20
- display: inline-flex;
21
- align-items: center;
22
- justify-content: center;
23
- vertical-align: middle;
24
- overflow: hidden;
25
- user-select: none;
26
-
27
- background-color: ${props =>
28
- props.theme.click.avatar.color.background.default};
29
- color: ${props => props.theme.click.avatar.color.text.default};
30
- border-radius: ${props => props.theme.click.avatar.radii.all};
31
-
32
- &:active {
33
- background-color: ${props =>
34
- props.theme.click.avatar.color.background.active};
35
- color: ${props => props.theme.click.avatar.color.text.active};
36
- }
37
-
38
- &:hover {
39
- background-color: ${props =>
40
- props.theme.click.avatar.color.background.hover};
41
- color: ${props => props.theme.click.avatar.color.text.hover};
42
- }
43
- `;
44
-
45
- const StyledFallback = styled(Fallback)<{ textSize: TextSize }>`
46
- width: ${props => props.theme.click.avatar.size.label.width};
47
- display: inline-flex;
48
- align-items: center;
49
- justify-content: center;
50
- font: ${props =>
51
- props.theme.click.avatar.typography.label[props.textSize || "sm"].default};
52
-
53
- &:active {
54
- font: ${props =>
55
- props.theme.click.avatar.typography.label[props.textSize || "sm"].active};
56
- }
57
-
58
- &:hover {
59
- font: ${props =>
60
- props.theme.click.avatar.typography.label[props.textSize || "sm"].hover};
61
- }
62
- `;
63
-
64
- export { Avatar };
@@ -1,30 +0,0 @@
1
- import { Badge } from "./Badge";
2
-
3
- export default {
4
- component: Badge,
5
- title: "Display/Badge",
6
- tags: ["badge","autodocs"],
7
- argTypes: {
8
- size: {
9
- options: ["sm", "md"],
10
- control: { type: "radio" },
11
- },
12
- state: {
13
- options: ["default","success","neutral", "info", "warning", "danger", "disabled"],
14
- control: { type: "radio" },
15
- },
16
- dismissible: {
17
- options: [true, false],
18
- control: { type: "boolean" },
19
- }
20
- }
21
- };
22
-
23
- export const Playground = {
24
- args: {
25
- text: "experiment",
26
- state: "success",
27
- size: "md",
28
- dismissible: false,
29
- },
30
- };
@@ -1,16 +0,0 @@
1
- import { render } from "@testing-library/react";
2
- import { Badge } from "./Badge";
3
- import { ThemeProvider } from "@/theme";
4
-
5
- describe("Badge", () => {
6
- test("given a text, should render it", () => {
7
- const text = "text to render";
8
- const rendered = render(
9
- <ThemeProvider theme="light">
10
- <Badge text={text} />
11
- </ThemeProvider>
12
- );
13
-
14
- expect(rendered.getByText(text).textContent).toEqual(text);
15
- });
16
- });
@@ -1,78 +0,0 @@
1
- import styled from "styled-components";
2
- import { Icon } from "../Icon/Icon";
3
- export type BadgeState =
4
- | "default"
5
- | "success"
6
- | "neutral"
7
- | "danger"
8
- | "disabled"
9
- | "warning"
10
- | "info";
11
-
12
- export type BadgeSize = "sm" | "md";
13
-
14
- export interface BadgeProps {
15
- text: string;
16
- state?: BadgeState;
17
- size?: BadgeSize;
18
- }
19
-
20
- export interface DismissibleBadge extends BadgeProps {
21
- dismissible: true;
22
- onClose: () => void;
23
- }
24
-
25
- export interface NonDismissibleBadge extends BadgeProps {
26
- dismissible?: never;
27
- onClose?: never;
28
- }
29
-
30
- const Wrapper = styled.div<Pick<BadgeProps, "state" | "size">>`
31
- background-color: ${({ state = "default", theme }) =>
32
- theme.click.badge.color.background[state]};
33
- color: ${({ state = "default", theme }) => theme.click.badge.color.text[state]};
34
- font: ${({ size = "md", theme }) => theme.click.badge.typography.label[size].default};
35
- border-radius: ${({ theme }) => theme.click.badge.radii.all};
36
- border: ${({ state = "default", theme }) =>
37
- `${theme.click.badge.stroke} solid ${theme.click.badge.color.stroke[state]}`};
38
- padding: ${({ size = "md", theme }) => theme.click.badge.space[size].y}
39
- ${({ size = "md", theme }) => theme.click.badge.space[size].x};
40
- display: inline-block;
41
- `;
42
-
43
- const Content = styled.div<Pick<BadgeProps, "state" | "size">>`
44
- display: inline-flex;
45
- align-items: center;
46
- gap: ${({ size = "md", theme }) => theme.click.badge.space[size].gap};
47
- `;
48
-
49
- const CrossContainer = styled.svg<Pick<BadgeProps, "state" | "size">>`
50
- color: ${({ state = "default", theme }) => theme.click.badge.color.text[state]};
51
- height: ${({ size = "md", theme }) => theme.click.badge.icon[size].size.height};
52
- width: ${({ size = "md", theme }) => theme.click.badge.icon[size].size.width};
53
- `;
54
-
55
- export const Badge = ({
56
- text,
57
- state = "default",
58
- size = "md",
59
- dismissible,
60
- onClose,
61
- }: NonDismissibleBadge | DismissibleBadge) => (
62
- <Wrapper
63
- state={state}
64
- size={size}
65
- >
66
- <Content>
67
- {text}
68
- {dismissible && (
69
- <CrossContainer
70
- name="cross"
71
- state={state}
72
- as={Icon}
73
- onClick={onClose}
74
- />
75
- )}
76
- </Content>
77
- </Wrapper>
78
- );
@@ -1,20 +0,0 @@
1
- import { BigStat } from "./BigStat";
2
-
3
- export default {
4
- component: BigStat,
5
- title: "Display/Big Stat",
6
- tags: ["big-stat", "autodocs"],
7
- size: {
8
- options: ["lg", "sm"],
9
- control: { type: "radio" },
10
- },
11
- };
12
-
13
- export const Playground = {
14
- args: {
15
- label: "Percentage complete",
16
- title: "100%",
17
- state: "default",
18
- size: "lg"
19
- },
20
- };
@@ -1,49 +0,0 @@
1
- import styled from "styled-components";
2
-
3
- export type bigStatState = "default";
4
- export type bigStatSize = "sm" | "lg";
5
-
6
- export interface BigStatProps {
7
- label: React.ReactNode;
8
- title: React.ReactNode;
9
- state?: bigStatState;
10
- size?: bigStatSize;
11
- }
12
-
13
- //* Use this component to highlight important pieces of information. */
14
- export const BigStat = ({
15
- label = "Label",
16
- title = "Title",
17
- size,
18
- state,
19
- }: BigStatProps) => (
20
- <Wrapper state={state} size={size}>
21
- <Label state={state} size={size}>{label}</Label>
22
- <Title state={state} size={size}>{title}</Title>
23
- </Wrapper>
24
- );
25
-
26
- const Wrapper = styled.div<Pick<BigStatProps, "state" | "size">>`
27
- background-color: ${({ state = "default", theme }) =>
28
- theme.click.bigStat.color.background[state]};
29
- border-radius: ${props => props.theme.click.bigStat.radii.all};
30
- border: ${({ state = "default", theme }) =>
31
- `${theme.click.bigStat.stroke} solid ${theme.click.bigStat.color.stroke[state]}`};
32
- gap: ${props => props.theme.click.bigStat.space.gap};
33
- padding: ${props => props.theme.click.bigStat.space.all};
34
- display: flex;
35
- flex-direction: ${({ size }) => size === "sm" ? "column-reverse" : "column"}
36
- `;
37
-
38
- const Label = styled.div<Pick<BigStatProps, "state" | "size">>`
39
- color: ${({ state = "default", theme }) => theme.click.bigStat.color.label[state]};
40
- font: ${({ state = "default", size = "lg", theme }) =>
41
- theme.click.bigStat.typography[size].label[state]};
42
- `;
43
-
44
- const Title = styled.div<Pick<BigStatProps, "state" | "size">>`
45
- color: ${({ state = "default", theme }) =>
46
- theme.click.bigStat.color.title[state]};
47
- font: ${({ state = "default", size="lg", theme }) =>
48
- theme.click.bigStat.typography[size].title[state]};
49
- `;
@@ -1,26 +0,0 @@
1
- import { Button } from "./Button";
2
-
3
- export default {
4
- title: "Buttons/Button",
5
- component: Button,
6
- tags: ["button", "autodocs"],
7
- argTypes: {
8
- type: {
9
- options: ["primary", "secondary", "danger"],
10
- control: { type: "radio" },
11
- },
12
- align: {
13
- options: ["center", "left"],
14
- control: { type: "radio" },
15
- },
16
- },
17
- };
18
-
19
- export const Playground = {
20
- args: {
21
- type: "primary",
22
- disabled: false,
23
- label: "Button",
24
- align: "center",
25
- },
26
- };