@edvisor/product-language 0.9.0 → 0.10.2

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 (407) hide show
  1. package/.babelrc +12 -0
  2. package/.eslintrc.json +147 -0
  3. package/.release-it.json +17 -0
  4. package/.storybook/main.js +57 -0
  5. package/.storybook/manager.js +7 -0
  6. package/.storybook/preview.js +15 -0
  7. package/.storybook/tsconfig.json +30 -0
  8. package/jest.config.ts +15 -0
  9. package/jest.setup.ts +2 -0
  10. package/package.json +2 -27
  11. package/project.json +98 -0
  12. package/src/README.md +61 -0
  13. package/src/assets/svg/example_icon.svg +3 -0
  14. package/src/assets/svg/example_icon_white.svg +3 -0
  15. package/src/assets/svg/spinner.svg +3 -0
  16. package/src/assets/svg/spinner_white.svg +3 -0
  17. package/src/helpers/index.ts +4 -0
  18. package/src/helpers/playground.ts +26 -0
  19. package/src/helpers/talesOf.tsx +42 -0
  20. package/src/index.ts +2 -0
  21. package/src/lib/components/README.md +49 -0
  22. package/src/lib/components/alert-banner/alert-banner.test.tsx +93 -0
  23. package/src/lib/components/alert-banner/alert-banner.tsx +117 -0
  24. package/src/lib/components/alert-banner/alert-level-flags.ts +101 -0
  25. package/src/lib/components/alert-banner/index.ts +1 -0
  26. package/src/lib/components/alert-banner/storybook/alert-banner.stories.mdx +67 -0
  27. package/src/lib/components/alert-banner/storybook/components.tsx +124 -0
  28. package/src/lib/components/badge/badge-type-flags.ts +72 -0
  29. package/src/lib/components/badge/badge.test.tsx +29 -0
  30. package/src/lib/components/badge/badge.tsx +22 -0
  31. package/src/lib/components/badge/index.ts +1 -0
  32. package/src/lib/components/badge/stories/badge.stories.mdx +44 -0
  33. package/src/lib/components/badge/stories/components.tsx +49 -0
  34. package/{lib/components/card/atoms/card-frame.d.ts → src/lib/components/card/atoms/card-frame.tsx} +16 -7
  35. package/src/lib/components/card/atoms/index.ts +1 -0
  36. package/src/lib/components/card/card.test.tsx +162 -0
  37. package/src/lib/components/card/card.tsx +78 -0
  38. package/src/lib/components/card/components/card-alert-banner-slot.tsx +16 -0
  39. package/src/lib/components/card/components/card-controls-slot.tsx +19 -0
  40. package/src/lib/components/card/components/card-section-slot.tsx +51 -0
  41. package/src/lib/components/card/components/index.ts +3 -0
  42. package/src/lib/components/card/index.ts +3 -0
  43. package/src/lib/components/card/molecules/index.ts +1 -0
  44. package/src/lib/components/card/molecules/left-right-card.test.tsx +89 -0
  45. package/src/lib/components/card/molecules/left-right-card.tsx +63 -0
  46. package/src/lib/components/card/storybook/card.stories.mdx +100 -0
  47. package/src/lib/components/card/storybook/components.tsx +227 -0
  48. package/src/lib/components/checkbox/checkbox.test.tsx +39 -0
  49. package/src/lib/components/checkbox/checkbox.tsx +70 -0
  50. package/src/lib/components/checkbox/helpers.tsx +98 -0
  51. package/src/lib/components/checkbox/index.tsx +1 -0
  52. package/src/lib/components/checkbox/stories/checkbox.stories.mdx +57 -0
  53. package/src/lib/components/checkbox/stories/components.tsx +84 -0
  54. package/src/lib/components/date-picker/components/custom-calendar.tsx +193 -0
  55. package/src/lib/components/date-picker/components/index.ts +1 -0
  56. package/src/lib/components/date-picker/data-picker.test.tsx +220 -0
  57. package/src/lib/components/date-picker/date-picker.tsx +10 -0
  58. package/src/lib/components/date-picker/helpers/date-picker-factory.tsx +210 -0
  59. package/src/lib/components/date-picker/index.ts +1 -0
  60. package/src/lib/components/date-picker/storybook/components.tsx +259 -0
  61. package/src/lib/components/date-picker/storybook/date-picker.stories.mdx +133 -0
  62. package/src/lib/components/divider/divider-type-flags.tsx +37 -0
  63. package/src/lib/components/divider/divider.test.tsx +34 -0
  64. package/src/lib/components/divider/divider.tsx +37 -0
  65. package/src/lib/components/divider/index.tsx +1 -0
  66. package/src/lib/components/divider/stories/components.tsx +13 -0
  67. package/src/lib/components/divider/stories/divider.stories.mdx +44 -0
  68. package/src/lib/components/flag/flag-size-flags.tsx +55 -0
  69. package/src/lib/components/flag/flag.list.tsx +788 -0
  70. package/src/lib/components/flag/flag.test.tsx +65 -0
  71. package/src/lib/components/flag/flag.tsx +97 -0
  72. package/src/lib/components/flag/index.tsx +1 -0
  73. package/src/lib/components/flag/stories/components.tsx +403 -0
  74. package/src/lib/components/flag/stories/flag.stories.mdx +48 -0
  75. package/src/lib/components/flag/stories/playGround-select.tsx +145 -0
  76. package/src/lib/components/icon/icon-list.tsx +135 -0
  77. package/src/lib/components/icon/icon.test.tsx +47 -0
  78. package/src/lib/components/icon/icon.tsx +181 -0
  79. package/src/lib/components/icon/index.tsx +1 -0
  80. package/src/lib/components/icon/stories/components.tsx +282 -0
  81. package/src/lib/components/icon/stories/icon.stories.mdx +65 -0
  82. package/src/lib/components/index.ts +26 -0
  83. package/src/lib/components/input-field/components/index.ts +2 -0
  84. package/src/lib/components/input-field/components/labeled-input.tsx +57 -0
  85. package/src/lib/components/input-field/components/stepper.tsx +64 -0
  86. package/src/lib/components/input-field/index.ts +6 -0
  87. package/src/lib/components/input-field/input-field.test.tsx +107 -0
  88. package/src/lib/components/input-field/input-field.tsx +154 -0
  89. package/src/lib/components/input-field/input-number.tsx +41 -0
  90. package/src/lib/components/input-field/input-text.tsx +30 -0
  91. package/src/lib/components/input-field/storybook/components.tsx +367 -0
  92. package/src/lib/components/input-field/storybook/input-field.stories.mdx +120 -0
  93. package/src/lib/components/layout/flex.tsx +22 -0
  94. package/src/lib/components/layout/grid-layout.tsx +40 -0
  95. package/src/lib/components/layout/index.ts +3 -0
  96. package/src/lib/components/layout/left-right-layout.tsx +67 -0
  97. package/src/lib/components/link/index.ts +1 -0
  98. package/src/lib/components/link/link.test.tsx +29 -0
  99. package/src/lib/components/link/link.tsx +56 -0
  100. package/src/lib/components/link/storybook/link.stories.mdx +52 -0
  101. package/src/lib/components/modal/index.ts +3 -0
  102. package/src/lib/components/modal/modal-base.tsx +129 -0
  103. package/src/lib/components/modal/modal-destructive.tsx +70 -0
  104. package/src/lib/components/modal/modal.test.tsx +138 -0
  105. package/src/lib/components/modal/modal.tsx +114 -0
  106. package/src/lib/components/modal/storybook/components.tsx +105 -0
  107. package/src/lib/components/modal/storybook/modal-destructive.stories.mdx +31 -0
  108. package/src/lib/components/modal/storybook/modal.stories.mdx +50 -0
  109. package/src/lib/components/molecules/avatar/avatar-size-flags.tsx +55 -0
  110. package/src/lib/components/molecules/avatar/avatar.test.tsx +114 -0
  111. package/src/lib/components/molecules/avatar/avatar.tsx +80 -0
  112. package/src/lib/components/molecules/avatar/index.tsx +1 -0
  113. package/src/lib/components/molecules/avatar/stories/avatar.stories.mdx +52 -0
  114. package/src/lib/components/molecules/avatar/stories/components.tsx +36 -0
  115. package/src/lib/components/molecules/button/button-flags.tsx +340 -0
  116. package/src/lib/components/molecules/button/button.test.tsx +77 -0
  117. package/src/lib/components/molecules/button/button.tsx +212 -0
  118. package/src/lib/components/molecules/button/index.tsx +1 -0
  119. package/src/lib/components/molecules/button/stories/button.stories.mdx +105 -0
  120. package/src/lib/components/molecules/button/stories/components.tsx +90 -0
  121. package/src/lib/components/molecules/index.ts +3 -0
  122. package/src/lib/components/molecules/input-checkbox/index.tsx +1 -0
  123. package/src/lib/components/molecules/input-checkbox/input-checkbox.test.tsx +34 -0
  124. package/src/lib/components/molecules/input-checkbox/input-checkbox.tsx +50 -0
  125. package/src/lib/components/molecules/input-checkbox/stories/components.tsx +53 -0
  126. package/src/lib/components/molecules/input-checkbox/stories/input-checkbox.stories.mdx +49 -0
  127. package/src/lib/components/organisms/choice-list/choice-list.test.tsx +36 -0
  128. package/src/lib/components/organisms/choice-list/choice-list.tsx +72 -0
  129. package/src/lib/components/organisms/choice-list/index.tsx +1 -0
  130. package/src/lib/components/organisms/choice-list/stories/choice-list.stories.mdx +57 -0
  131. package/src/lib/components/organisms/choice-list/stories/components.tsx +45 -0
  132. package/src/lib/components/organisms/index.ts +2 -0
  133. package/src/lib/components/organisms/multi-choice-list/index.tsx +1 -0
  134. package/src/lib/components/organisms/multi-choice-list/multi-choice-list.test.tsx +33 -0
  135. package/src/lib/components/organisms/multi-choice-list/multi-choice-list.tsx +53 -0
  136. package/src/lib/components/organisms/multi-choice-list/stories/components.tsx +124 -0
  137. package/src/lib/components/organisms/multi-choice-list/stories/multi-choice-list.stories.mdx +99 -0
  138. package/src/lib/components/progress-bar/index.ts +1 -0
  139. package/src/lib/components/progress-bar/progress-bar-size-flags.tsx +37 -0
  140. package/src/lib/components/progress-bar/progress-bar.test.tsx +66 -0
  141. package/src/lib/components/progress-bar/progress-bar.tsx +42 -0
  142. package/src/lib/components/progress-bar/storybook/components.tsx +62 -0
  143. package/src/lib/components/progress-bar/storybook/progress-bar.stories.mdx +43 -0
  144. package/{lib/components/spinner/index.d.ts → src/lib/components/radio-button/index.tsx} +1 -1
  145. package/src/lib/components/radio-button/radio-button.tsx +135 -0
  146. package/src/lib/components/radio-button/radio.test.tsx +59 -0
  147. package/src/lib/components/radio-button/stories/components.tsx +36 -0
  148. package/src/lib/components/radio-button/stories/radio-button.stories.mdx +44 -0
  149. package/src/lib/components/range-slider/components/bar-chart.tsx +50 -0
  150. package/src/lib/components/range-slider/components/handle.tsx +58 -0
  151. package/src/lib/components/range-slider/components/rail.tsx +44 -0
  152. package/src/lib/components/range-slider/components/slider-component.tsx +98 -0
  153. package/src/lib/components/range-slider/components/slider-inputs.tsx +150 -0
  154. package/src/lib/components/range-slider/components/tick.tsx +51 -0
  155. package/src/lib/components/range-slider/components/track.tsx +67 -0
  156. package/src/lib/components/range-slider/index.tsx +2 -0
  157. package/src/lib/components/range-slider/range-slider.test.tsx +185 -0
  158. package/src/lib/components/range-slider/range-slider.tsx +132 -0
  159. package/src/lib/components/range-slider/slider.test.tsx +89 -0
  160. package/src/lib/components/range-slider/slider.tsx +80 -0
  161. package/src/lib/components/range-slider/stories/components.tsx +179 -0
  162. package/src/lib/components/range-slider/stories/range-slider.stories.mdx +84 -0
  163. package/src/lib/components/range-slider/types.ts +18 -0
  164. package/src/lib/components/select/components/menu-container.tsx +69 -0
  165. package/src/lib/components/select/components/menu-list.tsx +195 -0
  166. package/src/lib/components/select/components/menu-row.tsx +43 -0
  167. package/src/lib/components/select/components/menu.tsx +151 -0
  168. package/src/lib/components/select/components/option.tsx +91 -0
  169. package/src/lib/components/select/components/select-label.tsx +10 -0
  170. package/src/lib/components/select/components/value-component-multi.tsx +40 -0
  171. package/src/lib/components/select/components/value-component-single.tsx +27 -0
  172. package/src/lib/components/select/components/value.tsx +370 -0
  173. package/src/lib/components/select/index.tsx +3 -0
  174. package/src/lib/components/select/select.test.tsx +148 -0
  175. package/src/lib/components/select/select.tsx +337 -0
  176. package/src/lib/components/select/storybook/components.tsx +999 -0
  177. package/src/lib/components/select/storybook/radio-group.tsx +157 -0
  178. package/src/lib/components/select/storybook/select.stories.mdx +172 -0
  179. package/src/lib/components/select/types.ts +149 -0
  180. package/src/lib/components/select/utils.ts +101 -0
  181. package/src/lib/components/spinner/index.tsx +1 -0
  182. package/src/lib/components/spinner/spinner-size-flags.tsx +39 -0
  183. package/src/lib/components/spinner/spinner.test.tsx +31 -0
  184. package/src/lib/components/spinner/spinner.tsx +54 -0
  185. package/src/lib/components/spinner/stories/components.tsx +39 -0
  186. package/src/lib/components/spinner/stories/spinner.stories.mdx +35 -0
  187. package/src/lib/components/tabs/components/index.ts +1 -0
  188. package/src/lib/components/tabs/components/tab.tsx +85 -0
  189. package/src/lib/components/tabs/index.tsx +1 -0
  190. package/src/lib/components/tabs/storybook/components.tsx +317 -0
  191. package/src/lib/components/tabs/storybook/tabs.stories.mdx +105 -0
  192. package/src/lib/components/tabs/tabs.test.tsx +86 -0
  193. package/src/lib/components/tabs/tabs.tsx +115 -0
  194. package/src/lib/components/tag/components/close-button.tsx +85 -0
  195. package/src/lib/components/tag/components/index.ts +2 -0
  196. package/src/lib/components/tag/components/tag-label.tsx +45 -0
  197. package/src/lib/components/tag/index.tsx +1 -0
  198. package/src/lib/components/tag/stories/components.tsx +86 -0
  199. package/src/lib/components/tag/stories/tag.stories.mdx +42 -0
  200. package/src/lib/components/tag/tag.test.tsx +36 -0
  201. package/src/lib/components/tag/tag.tsx +33 -0
  202. package/src/lib/components/thumbnail/index.tsx +1 -0
  203. package/src/lib/components/thumbnail/stories/thumbnail.stories.mdx +44 -0
  204. package/src/lib/components/thumbnail/thumbnail-size-flags.tsx +41 -0
  205. package/src/lib/components/thumbnail/thumbnail.test.tsx +51 -0
  206. package/src/lib/components/thumbnail/thumbnail.tsx +44 -0
  207. package/src/lib/components/tooltip/index.tsx +1 -0
  208. package/src/lib/components/tooltip/stories/components.tsx +224 -0
  209. package/src/lib/components/tooltip/stories/tooltip.stories.mdx +63 -0
  210. package/src/lib/components/tooltip/tooltip.test.tsx +22 -0
  211. package/src/lib/components/tooltip/tooltip.tsx +179 -0
  212. package/src/lib/components/tree-view/components/tree-node.tsx +203 -0
  213. package/src/lib/components/tree-view/helper.tsx +171 -0
  214. package/src/lib/components/tree-view/index.ts +2 -0
  215. package/src/lib/components/tree-view/stories/components.tsx +640 -0
  216. package/src/lib/components/tree-view/stories/tree-view.stories.mdx +127 -0
  217. package/src/lib/components/tree-view/tree-view.test.tsx +146 -0
  218. package/src/lib/components/tree-view/tree-view.tsx +168 -0
  219. package/src/lib/components/tree-view/types.tsx +70 -0
  220. package/src/lib/components/typography/index.ts +1 -0
  221. package/src/lib/components/typography/storybook/components.tsx +288 -0
  222. package/src/lib/components/typography/storybook/typography.stories.mdx +90 -0
  223. package/src/lib/components/typography/typography.test.tsx +97 -0
  224. package/src/lib/components/typography/typography.tsx +99 -0
  225. package/src/lib/foundations/color-system/base-palette/base-palette.stories.tsx +123 -0
  226. package/src/lib/foundations/color-system/base-palette/base-palette.ts +93 -0
  227. package/src/lib/foundations/color-system/base-palette/index.ts +1 -0
  228. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.stories.mdx +85 -0
  229. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.stories.tsx +231 -0
  230. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.ts +160 -0
  231. package/src/lib/foundations/color-system/color-guidelines/index.ts +1 -0
  232. package/src/lib/foundations/color-system/components/color-sample.tsx +99 -0
  233. package/src/lib/foundations/color-system/components/index.ts +1 -0
  234. package/src/lib/foundations/color-system/index.ts +1 -0
  235. package/src/lib/foundations/index.ts +4 -0
  236. package/src/lib/foundations/shadows/components.tsx +59 -0
  237. package/src/lib/foundations/shadows/index.ts +1 -0
  238. package/src/lib/foundations/shadows/shadows.stories.mdx +71 -0
  239. package/src/lib/foundations/shadows/shadows.tsx +47 -0
  240. package/src/lib/foundations/spacing/index.ts +1 -0
  241. package/src/lib/foundations/spacing/spacing-guidelines.ts +37 -0
  242. package/src/lib/foundations/spacing/spacing.stories.mdx +51 -0
  243. package/src/lib/foundations/spacing/spacing.ts +18 -0
  244. package/src/lib/foundations/typography/constants.ts +25 -0
  245. package/src/lib/foundations/typography/fonts.ts +205 -0
  246. package/src/lib/foundations/typography/index.tsx +1 -0
  247. package/src/lib/foundations/typography/text-aspect-flags.ts +61 -0
  248. package/src/lib/foundations/typography/typography.tsx +102 -0
  249. package/src/lib/helpers/generic-types.ts +44 -0
  250. package/src/lib/helpers/index.ts +8 -0
  251. package/src/lib/helpers/isReactElementOfType.test.tsx +108 -0
  252. package/src/lib/helpers/isReactElementOfType.ts +42 -0
  253. package/src/lib/helpers/nothing.tsx +22 -0
  254. package/{lib/helpers/numbers.d.ts → src/lib/helpers/numbers.ts} +67 -50
  255. package/src/lib/helpers/safe-navigation.ts +57 -0
  256. package/src/lib/helpers/slots.tsx +126 -0
  257. package/src/lib/helpers/strings.test.ts +47 -0
  258. package/src/lib/helpers/strings.ts +16 -0
  259. package/src/lib/helpers/useInputElementState.ts +56 -0
  260. package/src/lib/helpers/useKeyDown.ts +17 -0
  261. package/tsconfig.json +35 -0
  262. package/tsconfig.lib.json +28 -0
  263. package/tsconfig.spec.json +21 -0
  264. package/index.d.ts +0 -2
  265. package/index.js +0 -11246
  266. package/lib/components/alert-banner/alert-banner.d.ts +0 -15
  267. package/lib/components/alert-banner/alert-level-flags.d.ts +0 -18
  268. package/lib/components/alert-banner/index.d.ts +0 -1
  269. package/lib/components/badge/badge-type-flags.d.ts +0 -18
  270. package/lib/components/badge/badge.d.ts +0 -5
  271. package/lib/components/badge/index.d.ts +0 -1
  272. package/lib/components/card/atoms/index.d.ts +0 -1
  273. package/lib/components/card/card.d.ts +0 -14
  274. package/lib/components/card/components/card-alert-banner-slot.d.ts +0 -6
  275. package/lib/components/card/components/card-controls-slot.d.ts +0 -5
  276. package/lib/components/card/components/card-section-slot.d.ts +0 -11
  277. package/lib/components/card/components/index.d.ts +0 -3
  278. package/lib/components/card/index.d.ts +0 -3
  279. package/lib/components/card/molecules/index.d.ts +0 -1
  280. package/lib/components/card/molecules/left-right-card.d.ts +0 -16
  281. package/lib/components/checkbox/checkbox.d.ts +0 -11
  282. package/lib/components/checkbox/helpers.d.ts +0 -12
  283. package/lib/components/checkbox/index.d.ts +0 -1
  284. package/lib/components/date-picker/components/custom-calendar.d.ts +0 -6
  285. package/lib/components/date-picker/components/index.d.ts +0 -1
  286. package/lib/components/date-picker/date-picker.d.ts +0 -4
  287. package/lib/components/date-picker/helpers/date-picker-factory.d.ts +0 -34
  288. package/lib/components/date-picker/index.d.ts +0 -1
  289. package/lib/components/divider/divider-type-flags.d.ts +0 -9
  290. package/lib/components/divider/divider.d.ts +0 -7
  291. package/lib/components/divider/index.d.ts +0 -1
  292. package/lib/components/flag/flag-size-flags.d.ts +0 -12
  293. package/lib/components/flag/flag.d.ts +0 -9
  294. package/lib/components/flag/flag.list.d.ts +0 -782
  295. package/lib/components/flag/index.d.ts +0 -1
  296. package/lib/components/icon/icon-list.d.ts +0 -132
  297. package/lib/components/icon/icon.d.ts +0 -131
  298. package/lib/components/icon/index.d.ts +0 -1
  299. package/lib/components/index.d.ts +0 -24
  300. package/lib/components/input-field/components/index.d.ts +0 -2
  301. package/lib/components/input-field/components/labeled-input.d.ts +0 -10
  302. package/lib/components/input-field/components/stepper.d.ts +0 -7
  303. package/lib/components/input-field/index.d.ts +0 -3
  304. package/lib/components/input-field/input-field.d.ts +0 -26
  305. package/lib/components/input-field/input-number.d.ts +0 -18
  306. package/lib/components/input-field/input-text.d.ts +0 -14
  307. package/lib/components/layout/flex.d.ts +0 -16
  308. package/lib/components/layout/grid-layout.d.ts +0 -11
  309. package/lib/components/layout/index.d.ts +0 -3
  310. package/lib/components/layout/left-right-layout.d.ts +0 -34
  311. package/lib/components/link/index.d.ts +0 -1
  312. package/lib/components/link/link.d.ts +0 -14
  313. package/lib/components/modal/index.d.ts +0 -3
  314. package/lib/components/modal/modal-base.d.ts +0 -28
  315. package/lib/components/modal/modal-destructive.d.ts +0 -11
  316. package/lib/components/modal/modal.d.ts +0 -13
  317. package/lib/components/molecules/avatar/avatar-size-flags.d.ts +0 -12
  318. package/lib/components/molecules/avatar/avatar.d.ts +0 -12
  319. package/lib/components/molecules/avatar/index.d.ts +0 -1
  320. package/lib/components/molecules/button/button-flags.d.ts +0 -44
  321. package/lib/components/molecules/button/button.d.ts +0 -12
  322. package/lib/components/molecules/button/index.d.ts +0 -1
  323. package/lib/components/molecules/index.d.ts +0 -3
  324. package/lib/components/molecules/input-checkbox/index.d.ts +0 -1
  325. package/lib/components/molecules/input-checkbox/input-checkbox.d.ts +0 -8
  326. package/lib/components/organisms/choice-list/choice-list.d.ts +0 -9
  327. package/lib/components/organisms/choice-list/index.d.ts +0 -1
  328. package/lib/components/organisms/index.d.ts +0 -2
  329. package/lib/components/organisms/multi-choice-list/index.d.ts +0 -1
  330. package/lib/components/organisms/multi-choice-list/multi-choice-list.d.ts +0 -11
  331. package/lib/components/radio-button/index.d.ts +0 -1
  332. package/lib/components/radio-button/radio-button.d.ts +0 -10
  333. package/lib/components/range-slider/components/bar-chart.d.ts +0 -8
  334. package/lib/components/range-slider/components/handle.d.ts +0 -12
  335. package/lib/components/range-slider/components/rail.d.ts +0 -9
  336. package/lib/components/range-slider/components/slider-component.d.ts +0 -12
  337. package/lib/components/range-slider/components/slider-inputs.d.ts +0 -14
  338. package/lib/components/range-slider/components/tick.d.ts +0 -10
  339. package/lib/components/range-slider/components/track.d.ts +0 -11
  340. package/lib/components/range-slider/index.d.ts +0 -2
  341. package/lib/components/range-slider/range-slider.d.ts +0 -15
  342. package/lib/components/range-slider/slider.d.ts +0 -11
  343. package/lib/components/range-slider/types.d.ts +0 -11
  344. package/lib/components/select/components/menu-container.d.ts +0 -3
  345. package/lib/components/select/components/menu-list.d.ts +0 -3
  346. package/lib/components/select/components/menu-row.d.ts +0 -9
  347. package/lib/components/select/components/menu.d.ts +0 -3
  348. package/lib/components/select/components/option.d.ts +0 -13
  349. package/lib/components/select/components/select-label.d.ts +0 -1
  350. package/lib/components/select/components/value-component-multi.d.ts +0 -4
  351. package/lib/components/select/components/value-component-single.d.ts +0 -4
  352. package/lib/components/select/components/value.d.ts +0 -4
  353. package/lib/components/select/index.d.ts +0 -3
  354. package/lib/components/select/select.d.ts +0 -10
  355. package/lib/components/select/types.d.ts +0 -133
  356. package/lib/components/select/utils.d.ts +0 -15
  357. package/lib/components/spinner/spinner-size-flags.d.ts +0 -10
  358. package/lib/components/spinner/spinner.d.ts +0 -9
  359. package/lib/components/tabs/components/index.d.ts +0 -1
  360. package/lib/components/tabs/components/tab.d.ts +0 -8
  361. package/lib/components/tabs/index.d.ts +0 -1
  362. package/lib/components/tabs/tabs.d.ts +0 -16
  363. package/lib/components/tag/components/close-button.d.ts +0 -8
  364. package/lib/components/tag/components/index.d.ts +0 -2
  365. package/lib/components/tag/components/tag-label.d.ts +0 -8
  366. package/lib/components/tag/index.d.ts +0 -1
  367. package/lib/components/tag/tag.d.ts +0 -10
  368. package/lib/components/thumbnail/index.d.ts +0 -1
  369. package/lib/components/thumbnail/thumbnail-size-flags.d.ts +0 -10
  370. package/lib/components/thumbnail/thumbnail.d.ts +0 -10
  371. package/lib/components/tooltip/index.d.ts +0 -1
  372. package/lib/components/tooltip/tooltip.d.ts +0 -26
  373. package/lib/components/tree-view/components/tree-node.d.ts +0 -3
  374. package/lib/components/tree-view/helper.d.ts +0 -12
  375. package/lib/components/tree-view/index.d.ts +0 -2
  376. package/lib/components/tree-view/tree-view.d.ts +0 -3
  377. package/lib/components/tree-view/types.d.ts +0 -63
  378. package/lib/components/typography/index.d.ts +0 -1
  379. package/lib/components/typography/typography.d.ts +0 -24
  380. package/lib/foundations/color-system/base-palette/base-palette.d.ts +0 -76
  381. package/lib/foundations/color-system/base-palette/index.d.ts +0 -1
  382. package/lib/foundations/color-system/color-guidelines/color-guidelines.d.ts +0 -133
  383. package/lib/foundations/color-system/color-guidelines/index.d.ts +0 -1
  384. package/lib/foundations/color-system/components/color-sample.d.ts +0 -17
  385. package/lib/foundations/color-system/components/index.d.ts +0 -1
  386. package/lib/foundations/color-system/index.d.ts +0 -1
  387. package/lib/foundations/index.d.ts +0 -4
  388. package/lib/foundations/shadows/components.d.ts +0 -8
  389. package/lib/foundations/shadows/index.d.ts +0 -1
  390. package/lib/foundations/shadows/shadows.d.ts +0 -8
  391. package/lib/foundations/spacing/index.d.ts +0 -1
  392. package/lib/foundations/spacing/spacing-guidelines.d.ts +0 -33
  393. package/lib/foundations/spacing/spacing.d.ts +0 -18
  394. package/lib/foundations/typography/constants.d.ts +0 -22
  395. package/lib/foundations/typography/fonts.d.ts +0 -1
  396. package/lib/foundations/typography/index.d.ts +0 -1
  397. package/lib/foundations/typography/text-aspect-flags.d.ts +0 -19
  398. package/lib/foundations/typography/typography.d.ts +0 -24
  399. package/lib/helpers/generic-types.d.ts +0 -21
  400. package/lib/helpers/index.d.ts +0 -8
  401. package/lib/helpers/isReactElementOfType.d.ts +0 -8
  402. package/lib/helpers/nothing.d.ts +0 -10
  403. package/lib/helpers/safe-navigation.d.ts +0 -17
  404. package/lib/helpers/slots.d.ts +0 -17
  405. package/lib/helpers/strings.d.ts +0 -1
  406. package/lib/helpers/useInputElementState.d.ts +0 -30
  407. package/lib/helpers/useKeyDown.d.ts +0 -1
@@ -0,0 +1,93 @@
1
+ /* eslint-disable no-restricted-syntax */
2
+ import { Hex } from '@helpers'
3
+
4
+ export type ColorPalette = {
5
+ [key in string]: Hex
6
+ }
7
+
8
+ export const WHITE = '#FFFFFF' as const
9
+ export const BLACK = '#000000' as const
10
+
11
+ export const GRAY = {
12
+ 50: '#F9FAFB',
13
+ 100: '#F3F4F6',
14
+ 200: '#E5E7EB',
15
+ 300: '#D1D5DB',
16
+ 400: '#9CA3AF',
17
+ 500: '#6B7280',
18
+ 600: '#46505D',
19
+ 700: '#374151',
20
+ 800: '#1F2937',
21
+ 900: '#111827',
22
+ } as const
23
+
24
+ export const BLUE = {
25
+ 50: '#F0F6FF',
26
+ 100: '#DBEAFE',
27
+ 200: '#BFDBFE',
28
+ 300: '#93C5FD',
29
+ 400: '#60A5FA',
30
+ 500: '#3B82F6',
31
+ 600: '#2563EB',
32
+ 700: '#1D4ED8',
33
+ 800: '#1E40AF',
34
+ 900: '#1E3A8A',
35
+ } as const
36
+
37
+ export const GREEN = {
38
+ 50: '#F1FEF8',
39
+ 100: '#D1FAE5',
40
+ 200: '#A7F3D0',
41
+ 300: '#6EE7B7',
42
+ 400: '#34D399',
43
+ 500: '#10B981',
44
+ 600: '#059669',
45
+ 700: '#047857',
46
+ 800: '#065F46',
47
+ 900: '#064E3B',
48
+ } as const
49
+
50
+ export const ORANGE = {
51
+ 50: '#FFFAF5',
52
+ 100: '#FFEDD5',
53
+ 200: '#FED7AA',
54
+ 300: '#FDBA74',
55
+ 400: '#FB923C',
56
+ 500: '#F97316',
57
+ 600: '#EA580C',
58
+ 700: '#C2410C',
59
+ 800: '#9A3412',
60
+ 900: '#7C2D12',
61
+ } as const
62
+
63
+ export const RED = {
64
+ 50: '#FEF6F6',
65
+ 100: '#FEE2E2',
66
+ 200: '#FECACA',
67
+ 300: '#FCA5A5', // @TODO we should update the current structure with the figma updates
68
+ 400: '#F87171',
69
+ 500: '#EF4444',
70
+ 600: '#DC2626',
71
+ 700: '#B91C1C',
72
+ 800: '#991B1B',
73
+ 900: '#7F1D1D',
74
+ } as const
75
+
76
+ export const SHADES = {
77
+ White: WHITE,
78
+ Black: BLACK,
79
+ } as const
80
+
81
+ export const BRAND = {
82
+ Brand: '#0792D4',
83
+ } as const
84
+
85
+ type ValuesOf<T> = T[keyof T]
86
+
87
+ export type COLOR = ValuesOf<typeof BRAND>
88
+ | ValuesOf<typeof BLUE>
89
+ | ValuesOf<typeof SHADES>
90
+ | ValuesOf<typeof RED>
91
+ | ValuesOf<typeof ORANGE>
92
+ | ValuesOf<typeof GREEN>
93
+ | ValuesOf<typeof GRAY>
@@ -0,0 +1 @@
1
+ export * from './base-palette'
@@ -0,0 +1,85 @@
1
+ import { Canvas, Meta, Story } from '@storybook/addon-docs';
2
+ import { Card, AlertBanner } from '@components'
3
+ import { Background, Surface, Borders } from './color-guidelines'
4
+ import {
5
+ BackgroundStory,
6
+ SurfaceStory,
7
+ BordersStory,
8
+ } from './color-guidelines.stories.tsx'
9
+
10
+ <Meta title="Foundations/ColorSystem"/>
11
+
12
+ # Color Guidelines
13
+
14
+ The Color Guidelines give names and functions to the colors defined in out base palette.
15
+
16
+ All colors used in our app are namespaced according to their context in which they should be used (eg the background color is namespaces by "Background") and named after their role within the namespace (eg `Background.Default`, the default background color).
17
+
18
+ ```ts
19
+ import { Background, Critical } from '@foundations'
20
+
21
+ // the default background color
22
+ const color = Background.Default
23
+
24
+ // the color of a critical surface
25
+ const color = Surface.Critical
26
+ ```
27
+
28
+ ## Examples
29
+
30
+ What follow are guidelines for the usage of each color.
31
+
32
+ <BackgroundStory />
33
+
34
+ The background color is used to define negative space in our app. Note the grey background surrounding the Card below.
35
+
36
+ <Canvas>
37
+ <div style={{ padding: '24px', background: Background.Default }}>
38
+ <Card heading='Heading'>
39
+ Body
40
+ </Card>
41
+ </div>
42
+ </Canvas>
43
+
44
+ ---
45
+
46
+ <SurfaceStory />
47
+
48
+ Surfaces make up the positive space in our app. We call them surfaces because you can put things on them, typically text and other UI elements. The Card you saw in the example above used `Surface.Default`. The Card below also uses `Surface.Default` for its background, but the alert-banner inside the card is using `Surface.Info`.
49
+
50
+ <Canvas>
51
+ <div style={{ padding: '24px', background: Background.Default }}>
52
+ <Card heading='Heading'>
53
+ <Card.AlertBanner>Some helpful info</Card.AlertBanner>
54
+ Body
55
+ </Card>
56
+ </div>
57
+ </Canvas>
58
+
59
+ Colorful surfaces such as `Surface.Critical` are used to draw the eye to important information:
60
+
61
+ <Canvas>
62
+ <AlertBanner>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</AlertBanner>
63
+ <AlertBanner info>There will be a raffle later today</AlertBanner>
64
+ <AlertBanner success>You won! You won the raffle!</AlertBanner>
65
+ <AlertBanner warning>Please put down your weapon.</AlertBanner>
66
+ <AlertBanner critical>Please put down your weapon. You have twenty seconds to comply.</AlertBanner>
67
+ </Canvas>
68
+
69
+ ---
70
+
71
+ <BordersStory />
72
+
73
+ Borders surround an element, be it a Card or a Button. The color of a border is typically chosen to complement the surface color, and is named the same as the surface it complements.
74
+
75
+ <Canvas>
76
+ <div style={{ padding: '24px', background: Background.Default }}>
77
+ <div style={{ background: Surface.Critical.Subdued, border: `1px solid ${Borders.Critical.Subdued}`, borderRadius: '6px', padding: '24px' }}>
78
+ Oh Oh
79
+ </div>
80
+ </div>
81
+ </Canvas>
82
+
83
+ # Roadmap
84
+ - Add new subdoad colors
85
+ - Add boarder styles colors
@@ -0,0 +1,231 @@
1
+ import styled from 'styled-components'
2
+ import { Flex, Heading2 } from '@components'
3
+ import { FC, Hex, isDefined, Nothing, isEmpty, isNil } from '@helpers'
4
+ import { StoryComponent, talesOf } from '@stories'
5
+ import { Margin } from 'foundations/spacing/spacing-guidelines'
6
+
7
+ import { BLACK, BLUE, BRAND, ColorPalette, GRAY, GREEN, ORANGE, RED, SHADES, WHITE } from '../base-palette'
8
+ import { ColorSquare } from '../components'
9
+ import { Background, Surface, Borders, Focused, Text, Icons, Interactive, Actions } from './color-guidelines'
10
+
11
+ export const BackgroundStory: FC = () => {
12
+ return (
13
+ <SemanticCategory
14
+ name={'Background'}
15
+ subCategories={[
16
+ { name: '', palette: Background },
17
+ ]}
18
+ />
19
+ )
20
+ }
21
+
22
+ export const SurfaceStory: FC = () => {
23
+ return (
24
+ <SemanticCategory
25
+ name={'Surface'}
26
+ subCategories={[
27
+ { name: '', palette: Surface.Default },
28
+ { name: 'Selected', palette: Surface.Selected },
29
+ { name: 'Critical', palette: Surface.Critical },
30
+ { name: 'Warning', palette: Surface.Warning },
31
+ { name: 'Success', palette: Surface.Success },
32
+ { name: 'Highlight', palette: Surface.Highlight },
33
+ { name: 'Neutral', palette: Surface.Neutral },
34
+ ]}
35
+ />
36
+ )
37
+ }
38
+
39
+ export const BordersStory: FC = () => {
40
+ return (
41
+ <SemanticCategory
42
+ name={'Borders'}
43
+ subCategories={[
44
+ { name: '', border: Surface.Default.Default, palette: Borders.Default },
45
+ { name: 'Critical', border: Surface.Critical.Subdued, palette: Borders.Critical },
46
+ { name: 'Warning', border: Surface.Warning.Subdued, palette: Borders.Warning },
47
+ { name: 'Success', border: Surface.Success.Subdued, palette: Borders.Success },
48
+ { name: 'Highlight', border: Surface.Highlight.Subdued, palette: Borders.Highlight },
49
+ ]}
50
+ />
51
+ )
52
+ }
53
+
54
+ const FocusedStory: FC = () => {
55
+ return (
56
+ <SemanticCategory
57
+ name={'Focused'}
58
+ subCategories={[
59
+ { name: '', palette: Focused, border: Background.Default },
60
+ ]}
61
+ />
62
+ )
63
+ }
64
+
65
+ const TextStory: FC = () => {
66
+ const { Default, Subdued, Light, Critical, Success, OnPrimary, OnCritical } =
67
+ Text
68
+
69
+ return (
70
+ <SemanticCategory
71
+ name={'Text'}
72
+ subCategories={[
73
+ { name: '', palette: { Default, Subdued, Light } },
74
+ { name: '', palette: { Critical, Success } },
75
+ { name: '', palette: { OnPrimary, OnCritical } },
76
+ ]}
77
+ />
78
+ )
79
+ }
80
+
81
+ const IconsStory: FC = () => {
82
+ const { Default, Subdued, Hover, Pressed, Disabled, Critical, Success, Warning, Highlight, OnPrimary, OnCritical } =
83
+ Icons
84
+
85
+ return (
86
+ <SemanticCategory
87
+ name={'Icons'}
88
+ subCategories={[
89
+ { name: '', palette: { Default, Subdued, Hover, Pressed, Disabled } },
90
+ { name: '', palette: { Critical, Warning, Success, Highlight } },
91
+ { name: '', palette: { OnPrimary, OnCritical } },
92
+ ]}
93
+ />
94
+ )
95
+ }
96
+
97
+ const InteractionsStory: FC = () => {
98
+ return (
99
+ <SemanticCategory
100
+ name={'Interactions'}
101
+ subCategories={[
102
+ { name: '', palette: Interactive.Default },
103
+ { name: 'Subtle', palette: Interactive.Subtle },
104
+ ]}
105
+ />
106
+ )
107
+ }
108
+
109
+ const ActionsStory: FC = () => {
110
+ return (
111
+ <SemanticCategory
112
+ name={'Actions'}
113
+ subCategories={[
114
+ { name: 'Primary', palette: Actions.Primary },
115
+ { name: 'Secondary', palette: Actions.Secondary },
116
+ { name: 'Critical', palette: Actions.Critical },
117
+ { name: 'Secondary Critical', palette: Actions.SecondaryCritical },
118
+ ]}
119
+ />
120
+ )
121
+ }
122
+
123
+ const Story: StoryComponent = () => {
124
+ return (
125
+ <>
126
+ <BackgroundStory />
127
+ <SurfaceStory />
128
+ <BordersStory />
129
+ <FocusedStory />
130
+ <TextStory />
131
+ <IconsStory />
132
+ <InteractionsStory />
133
+ <ActionsStory />
134
+ </>
135
+ )
136
+ }
137
+
138
+ const SemanticCategoryHeading = styled(Heading2)`
139
+ margin-bottom: ${Margin.xl};
140
+ `
141
+
142
+ const COLOR_SYSTEM = { GRAY, BLUE, GREEN, ORANGE, RED, SHADES, BRAND } as const
143
+
144
+ function getColorId (color: Hex) {
145
+ if (color === WHITE) {
146
+ return 'white'
147
+ }
148
+
149
+ if (color === BLACK) {
150
+ return 'black'
151
+ }
152
+
153
+ const colorHex = color.slice(0, 7)
154
+ const fadeHex = color.slice(7, 9)
155
+
156
+ const colorId = Object.keys(COLOR_SYSTEM).reduce((acc, COLOR_NAME) => {
157
+ const COLOR = COLOR_SYSTEM[COLOR_NAME as keyof typeof COLOR_SYSTEM]
158
+ const id = Object.keys(COLOR).find((_id) => COLOR[_id as keyof typeof COLOR] === colorHex)
159
+
160
+ if (isDefined(id)) {
161
+ return `${COLOR_NAME.toLowerCase()}-${id}`
162
+ }
163
+
164
+ return acc
165
+ }, undefined as string | undefined)
166
+
167
+ if (isNil(colorId)) {
168
+ return color
169
+ }
170
+
171
+ if (isEmpty(fadeHex)) {
172
+ return colorId
173
+ }
174
+
175
+ return `${colorId} - ${toPercentage(fadeHex)}`
176
+ }
177
+
178
+ // convert a hex string like 1E to a percentage
179
+ // by dividing out of 255
180
+ function toPercentage (hex: string) {
181
+ const dec = parseInt(hex, 16)
182
+
183
+ return dec === 0 ? '' : `${Math.round((dec / 255) * 100)}%`
184
+ }
185
+
186
+ interface ISemanticCategoryProps {
187
+ name: string
188
+ subCategories: {
189
+ name: string,
190
+ palette: ColorPalette,
191
+ border?: Hex,
192
+ }[]
193
+ }
194
+
195
+ /** a semantic group is a kind of categorization based on meaning */
196
+ const SemanticCategory: FC<ISemanticCategoryProps> = (props) => {
197
+ return (
198
+ <>
199
+ <SemanticCategoryHeading>{props.name}</SemanticCategoryHeading>
200
+ <Flex>
201
+ {props.subCategories.map((subCategory, index) => {
202
+
203
+ return (
204
+ <div key={index}>
205
+ {Object.keys(subCategory.palette).map((name) => {
206
+ if (name === 'border') {
207
+ return <Nothing />
208
+ }
209
+
210
+ const hex = subCategory.palette[name]
211
+ const colorId = getColorId(hex)
212
+
213
+ return (
214
+ <ColorSquare
215
+ key={`${subCategory.name} ${name}`}
216
+ colorId={colorId}
217
+ name={`${subCategory.name} ${name}`}
218
+ hex={hex}
219
+ border={subCategory.border}
220
+ />
221
+ )
222
+ })}
223
+ </div>
224
+ )
225
+ })}
226
+ </Flex>
227
+ </>
228
+ )
229
+ }
230
+
231
+ talesOf(__filename, module, Story)
@@ -0,0 +1,160 @@
1
+ import { clamp, concatHex, Hex, toHex } from '@helpers'
2
+ import { GRAY, RED, ORANGE, GREEN, BLUE, WHITE } from '../base-palette'
3
+
4
+ function addOpacity(hex: Hex, opacity: number): Hex {
5
+ const opacityHex = toHex(clamp(0, Math.floor(0xFF * opacity), 0xFF), 2)
6
+ return concatHex(hex, opacityHex)
7
+ }
8
+
9
+ export const Background = {
10
+ Default: GRAY[100],
11
+ Overlay: addOpacity(GRAY[800], 0.6),
12
+ } as const
13
+
14
+ export const Surface = {
15
+ Default: {
16
+ Default: WHITE,
17
+ Subdued: GRAY[50],
18
+ Hover: GRAY[100],
19
+ Pressed: GRAY[200],
20
+ Depressed: GRAY[200],
21
+ Inverse: GRAY[800],
22
+ },
23
+
24
+ Selected: {
25
+ Default: BLUE[50],
26
+ Hover: BLUE[100],
27
+ Pressed: BLUE[200],
28
+ },
29
+
30
+ Critical: {
31
+ Default: RED[200],
32
+ Subdued: RED[50],
33
+ Hover: RED[50],
34
+ Pressed: RED[100],
35
+ },
36
+
37
+ Warning: {
38
+ Default: ORANGE[200],
39
+ Subdued: ORANGE[50],
40
+ },
41
+
42
+ Success: {
43
+ Default: GREEN[200],
44
+ Subdued: GREEN[50],
45
+ Depressed: GREEN[500],
46
+
47
+ },
48
+
49
+ Highlight: {
50
+ Default: BLUE[200],
51
+ Subdued: BLUE[50],
52
+ },
53
+
54
+ Neutral: {
55
+ Default: GRAY[200],
56
+ Subdued: GRAY[100],
57
+ Hover: GRAY[300],
58
+ Pressed: GRAY[400],
59
+ },
60
+ }
61
+
62
+ export const Borders = {
63
+ Default: {
64
+ Default: GRAY[300],
65
+ Subdued: GRAY[200],
66
+ Light: WHITE,
67
+ Dark: GRAY[400],
68
+ },
69
+ Critical: {
70
+ Default: RED[600],
71
+ Subdued: RED[300],
72
+ },
73
+ Warning: {
74
+ Subdued: ORANGE[300],
75
+ },
76
+ Success: {
77
+ Subdued: GREEN[300],
78
+ },
79
+ Highlight: {
80
+ Default: BLUE[600],
81
+ Subdued: BLUE[300],
82
+ },
83
+ }
84
+
85
+ export const Focused = {
86
+ Default: BLUE[400],
87
+ }
88
+
89
+ export const Text = {
90
+ Default: GRAY[800],
91
+ Subdued: GRAY[500],
92
+ Light: GRAY[400],
93
+ Critical: RED[600],
94
+ Success: GREEN[600],
95
+ OnPrimary: WHITE,
96
+ OnCritical: WHITE,
97
+ }
98
+
99
+ export const Icons = {
100
+ Default: GRAY[500],
101
+ Subdued: GRAY[400],
102
+ Hover: GRAY[800],
103
+ Pressed: GRAY[600],
104
+ Disabled: GRAY[300],
105
+ Critical: RED[600],
106
+ Warning: ORANGE[500],
107
+ Success: GREEN[600],
108
+ Highlight: BLUE[600],
109
+ OnPrimary: WHITE,
110
+ OnCritical: WHITE,
111
+ }
112
+
113
+ export const Interactive = {
114
+ Default: {
115
+ Default: BLUE[600],
116
+ Hover: BLUE[800],
117
+ Pressed: BLUE[800],
118
+ Disabled: GRAY[400],
119
+ },
120
+ Subtle: {
121
+ Default: GRAY[800],
122
+ Hover: GRAY[800],
123
+ Pressed: GRAY[800],
124
+ Disabled: GRAY[400],
125
+ }
126
+ }
127
+
128
+ /** in order for disabled to appear light gray on any background
129
+ * we have to give a darker gray some opacity */
130
+ const DisabledGray = addOpacity(GRAY[800], 0.06)
131
+ const PressedGray = addOpacity(GRAY[800], 0.12)
132
+
133
+ export const Actions = {
134
+ Primary: {
135
+ Default: BLUE[600],
136
+ Hover: BLUE[700],
137
+ Pressed: BLUE[800],
138
+ Depressed: BLUE[900],
139
+ Disabled: DisabledGray,
140
+ },
141
+ Secondary: {
142
+ Default: WHITE,
143
+ Hover: DisabledGray,
144
+ Pressed: PressedGray,
145
+ Depressed: GRAY[500],
146
+ Disabled: DisabledGray,
147
+ },
148
+ Critical: {
149
+ Default: RED[600],
150
+ Hover: RED[700],
151
+ Pressed: RED[800],
152
+ Disabled: DisabledGray,
153
+ },
154
+ SecondaryCritical: {
155
+ Default: WHITE,
156
+ Hover: RED[700],
157
+ Pressed: RED[800],
158
+ Disabled: DisabledGray,
159
+ },
160
+ }
@@ -0,0 +1 @@
1
+ export * from './color-guidelines'
@@ -0,0 +1,99 @@
1
+ import styled from 'styled-components'
2
+
3
+ import { FC, Hex, isDefined } from '@helpers'
4
+ import { Flex, SpaceBetween } from '@components'
5
+
6
+ import { GRAY, WHITE } from '../base-palette'
7
+ import { Caption, Label } from 'components/typography'
8
+ import { Margin } from '../../spacing'
9
+
10
+ function isPale (color: string) {
11
+ return color === WHITE || color === GRAY[50] || color === GRAY[100]
12
+ }
13
+
14
+ /** a ColorSample is a rectangular area with a uniform color */
15
+ const ColorSample = styled.div<{ color: string; border?: Hex }>`
16
+ ${({ border, color }) =>
17
+ isDefined(border) ? '' : `background-color: ${color};` }
18
+ ${({ border, color }) =>
19
+ isDefined(border) ? `border: 1px solid ${color};` : ''}
20
+ ${({ border, color }) =>
21
+ !isDefined(border) && isPale(color) ? `border: 1px solid ${GRAY[200]};` : ''}
22
+
23
+ height: 40px;
24
+ border-radius: 4px;
25
+ `
26
+
27
+ const RectangularColorSample = styled(ColorSample)`
28
+ max-width: 122px;
29
+ margin-bottom: ${Margin.xxs};
30
+ `
31
+
32
+ const SquareColorSample = styled(ColorSample)`
33
+ width: 40px;
34
+ flex-shrink: 0;
35
+ margin-right: ${Margin.s};
36
+ border-radius: 6px;
37
+
38
+ ${({ border, color }) =>
39
+ isDefined(border) ? `background-color: ${border};` : `background-color: ${color};` }
40
+ ${({ border, color }) =>
41
+ isDefined(border) ? `border: 1px solid ${color};` : `border: 2px solid ${WHITE};`}
42
+ `
43
+
44
+ interface IColorRectangleProps {
45
+ name: string
46
+ hex: Hex
47
+ border?: Hex
48
+ }
49
+
50
+ export const ColorRectangle: FC<IColorRectangleProps> = (props) => {
51
+ return (
52
+ <div>
53
+ <RectangularColorSample color={props.hex} border={props.border} />
54
+ <SpaceBetween>
55
+ <Caption>{props.name}</Caption>
56
+ <Caption subdued>{props.hex}</Caption>
57
+ </SpaceBetween>
58
+ </div>
59
+ )
60
+ }
61
+
62
+ const ColorFrame = styled(Flex)`
63
+ margin-bottom: ${Margin.l};
64
+ margin-right: ${Margin.xxl};
65
+ `
66
+
67
+ const Details = styled(Flex)`
68
+ justify-content: center;
69
+ `
70
+
71
+ const ColorName = styled(Label)`
72
+ white-space: nowrap;
73
+ margin-bottom: ${Margin.xxxs};
74
+ `
75
+
76
+ const ColorId = styled(Caption)`
77
+ white-space: nowrap;
78
+ `
79
+
80
+ interface IColorSquareProps {
81
+ name: string,
82
+ colorId: string
83
+ hex: Hex,
84
+ /** if true the color will only show in the border
85
+ * rather than as a fill color */
86
+ border?: Hex,
87
+ }
88
+
89
+ export const ColorSquare: FC<IColorSquareProps> = (props) => {
90
+ return (
91
+ <ColorFrame>
92
+ <SquareColorSample color={props.hex} border={props.border} />
93
+ <Details column>
94
+ <ColorName strong>{props.name}</ColorName>
95
+ <ColorId subdued>{props.colorId}</ColorId>
96
+ </Details>
97
+ </ColorFrame>
98
+ )
99
+ }
@@ -0,0 +1 @@
1
+ export * from './color-sample'
@@ -0,0 +1 @@
1
+ export * from './color-guidelines'
@@ -0,0 +1,4 @@
1
+ export * from './color-system'
2
+ export * from './typography'
3
+ export * from './spacing'
4
+ export * from './shadows'