@edvisor/product-language 0.2.0 → 0.3.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 (248) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +7914 -0
  3. package/lib/components/alert-banner/alert-banner.d.ts +11 -0
  4. package/lib/components/alert-banner/alert-level-flags.d.ts +13 -0
  5. package/lib/components/alert-banner/index.d.ts +1 -0
  6. package/lib/components/badge/badge-type-flags.d.ts +18 -0
  7. package/lib/components/badge/badge.d.ts +5 -0
  8. package/lib/components/badge/index.d.ts +1 -0
  9. package/{src/lib/components/card/atoms/card-frame.tsx → lib/components/card/atoms/card-frame.d.ts} +7 -17
  10. package/lib/components/card/atoms/index.d.ts +1 -0
  11. package/lib/components/card/card.d.ts +14 -0
  12. package/lib/components/card/components/card-alert-banner-slot.d.ts +5 -0
  13. package/lib/components/card/components/card-controls-slot.d.ts +4 -0
  14. package/lib/components/card/components/card-section-slot.d.ts +11 -0
  15. package/lib/components/card/components/index.d.ts +3 -0
  16. package/lib/components/card/index.d.ts +2 -0
  17. package/lib/components/card/molecules/index.d.ts +1 -0
  18. package/lib/components/card/molecules/left-right-card.d.ts +16 -0
  19. package/lib/components/checkbox/checkbox.d.ts +10 -0
  20. package/lib/components/checkbox/helpers.d.ts +12 -0
  21. package/lib/components/checkbox/index.d.ts +1 -0
  22. package/lib/components/divider/divider-type-flags.d.ts +9 -0
  23. package/lib/components/divider/divider.d.ts +7 -0
  24. package/lib/components/divider/index.d.ts +1 -0
  25. package/lib/components/flag/flag-size-flags.d.ts +12 -0
  26. package/lib/components/flag/flag.d.ts +9 -0
  27. package/lib/components/flag/flag.list.d.ts +781 -0
  28. package/lib/components/flag/index.d.ts +1 -0
  29. package/lib/components/icon/icon-list.d.ts +131 -0
  30. package/lib/components/icon/icon.d.ts +131 -0
  31. package/lib/components/icon/index.d.ts +1 -0
  32. package/lib/components/index.d.ts +17 -0
  33. package/lib/components/input-field/components/index.d.ts +2 -0
  34. package/lib/components/input-field/components/labeled-input.d.ts +10 -0
  35. package/lib/components/input-field/components/stepper.d.ts +7 -0
  36. package/lib/components/input-field/index.d.ts +3 -0
  37. package/lib/components/input-field/input-field.d.ts +25 -0
  38. package/lib/components/input-field/input-number.d.ts +18 -0
  39. package/lib/components/input-field/input-text.d.ts +14 -0
  40. package/lib/components/layout/flex.d.ts +16 -0
  41. package/lib/components/layout/grid-layout.d.ts +11 -0
  42. package/lib/components/layout/index.d.ts +3 -0
  43. package/lib/components/layout/left-right-layout.d.ts +34 -0
  44. package/lib/components/link/index.d.ts +1 -0
  45. package/lib/components/link/link.d.ts +14 -0
  46. package/lib/components/molecules/avatar/avatar-size-flags.d.ts +12 -0
  47. package/lib/components/molecules/avatar/avatar.d.ts +12 -0
  48. package/lib/components/molecules/avatar/index.d.ts +1 -0
  49. package/lib/components/molecules/button/button-flags.d.ts +44 -0
  50. package/lib/components/molecules/button/button.d.ts +12 -0
  51. package/lib/components/molecules/button/index.d.ts +1 -0
  52. package/lib/components/molecules/index.d.ts +3 -0
  53. package/lib/components/molecules/input-checkbox/index.d.ts +1 -0
  54. package/lib/components/molecules/input-checkbox/input-checkbox.d.ts +8 -0
  55. package/lib/components/organisms/index.d.ts +1 -0
  56. package/lib/components/organisms/multi-choice-list/index.d.ts +1 -0
  57. package/lib/components/organisms/multi-choice-list/multi-choice-list.d.ts +10 -0
  58. package/lib/components/spinner/index.d.ts +1 -0
  59. package/lib/components/spinner/spinner-size-flags.d.ts +10 -0
  60. package/lib/components/spinner/spinner.d.ts +9 -0
  61. package/lib/components/tabs/components/index.d.ts +1 -0
  62. package/lib/components/tabs/components/tab.d.ts +7 -0
  63. package/lib/components/tabs/index.d.ts +1 -0
  64. package/lib/components/tabs/tabs.d.ts +15 -0
  65. package/lib/components/tag/components/close-button.d.ts +8 -0
  66. package/lib/components/tag/components/index.d.ts +2 -0
  67. package/lib/components/tag/components/tag-label.d.ts +8 -0
  68. package/lib/components/tag/index.d.ts +1 -0
  69. package/lib/components/tag/tag.d.ts +10 -0
  70. package/lib/components/thumbnail/index.d.ts +1 -0
  71. package/lib/components/thumbnail/thumbnail-size-flags.d.ts +10 -0
  72. package/lib/components/thumbnail/thumbnail.d.ts +10 -0
  73. package/lib/components/typography/index.d.ts +1 -0
  74. package/lib/components/typography/typography.d.ts +24 -0
  75. package/lib/foundations/color-system/base-palette/base-palette.d.ts +76 -0
  76. package/lib/foundations/color-system/base-palette/index.d.ts +1 -0
  77. package/lib/foundations/color-system/color-guidelines/color-guidelines.d.ts +132 -0
  78. package/lib/foundations/color-system/color-guidelines/index.d.ts +1 -0
  79. package/lib/foundations/color-system/components/color-sample.d.ts +17 -0
  80. package/lib/foundations/color-system/components/index.d.ts +1 -0
  81. package/lib/foundations/color-system/index.d.ts +1 -0
  82. package/lib/foundations/index.d.ts +4 -0
  83. package/lib/foundations/shadows/components.d.ts +8 -0
  84. package/lib/foundations/shadows/index.d.ts +1 -0
  85. package/lib/foundations/shadows/shadows.d.ts +8 -0
  86. package/lib/foundations/spacing/index.d.ts +1 -0
  87. package/lib/foundations/spacing/spacing-guidelines.d.ts +22 -0
  88. package/lib/foundations/spacing/spacing.d.ts +18 -0
  89. package/lib/foundations/typography/constants.d.ts +22 -0
  90. package/lib/foundations/typography/fonts.d.ts +1 -0
  91. package/lib/foundations/typography/index.d.ts +1 -0
  92. package/lib/foundations/typography/text-aspect-flags.d.ts +19 -0
  93. package/lib/foundations/typography/typography.d.ts +24 -0
  94. package/lib/helpers/generic-types.d.ts +21 -0
  95. package/lib/helpers/index.d.ts +6 -0
  96. package/lib/helpers/nothing.d.ts +8 -0
  97. package/{src/lib/helpers/numbers.ts → lib/helpers/numbers.d.ts} +50 -53
  98. package/lib/helpers/safe-navigation.d.ts +15 -0
  99. package/lib/helpers/slots.d.ts +23 -0
  100. package/lib/helpers/strings.d.ts +1 -0
  101. package/package.json +12 -5
  102. package/.babelrc +0 -12
  103. package/.eslintrc.json +0 -139
  104. package/.storybook/main.js +0 -57
  105. package/.storybook/manager.js +0 -7
  106. package/.storybook/preview-head.html +0 -1
  107. package/.storybook/preview.js +0 -15
  108. package/.storybook/tsconfig.json +0 -30
  109. package/jest.config.ts +0 -15
  110. package/jest.setup.ts +0 -2
  111. package/project.json +0 -85
  112. package/release-it.json +0 -18
  113. package/src/assets/svg/example_icon.svg +0 -3
  114. package/src/assets/svg/example_icon_white.svg +0 -3
  115. package/src/assets/svg/spinner.svg +0 -3
  116. package/src/assets/svg/spinner_white.svg +0 -3
  117. package/src/helpers/index.ts +0 -3
  118. package/src/helpers/talesOf.tsx +0 -42
  119. package/src/index.ts +0 -2
  120. package/src/lib/components/README.md +0 -49
  121. package/src/lib/components/alert-banner/alert-banner.tsx +0 -34
  122. package/src/lib/components/alert-banner/alert-level-flags.ts +0 -77
  123. package/src/lib/components/alert-banner/index.ts +0 -1
  124. package/src/lib/components/badge/badge-type-flags.ts +0 -72
  125. package/src/lib/components/badge/badge.stories.tsx +0 -16
  126. package/src/lib/components/badge/badge.test.tsx +0 -29
  127. package/src/lib/components/badge/badge.tsx +0 -31
  128. package/src/lib/components/badge/index.ts +0 -1
  129. package/src/lib/components/card/atoms/index.ts +0 -1
  130. package/src/lib/components/card/card.test.tsx +0 -163
  131. package/src/lib/components/card/card.tsx +0 -78
  132. package/src/lib/components/card/components/card-alert-banner-slot.tsx +0 -16
  133. package/src/lib/components/card/components/card-controls-slot.tsx +0 -19
  134. package/src/lib/components/card/components/card-section-slot.tsx +0 -51
  135. package/src/lib/components/card/components/index.ts +0 -3
  136. package/src/lib/components/card/index.ts +0 -2
  137. package/src/lib/components/card/molecules/index.ts +0 -1
  138. package/src/lib/components/card/molecules/left-right-card.test.tsx +0 -89
  139. package/src/lib/components/card/molecules/left-right-card.tsx +0 -63
  140. package/src/lib/components/card/storybook/card.stories.mdx +0 -100
  141. package/src/lib/components/card/storybook/components.tsx +0 -240
  142. package/src/lib/components/checkbox/checkbox.test.tsx +0 -39
  143. package/src/lib/components/checkbox/checkbox.tsx +0 -124
  144. package/src/lib/components/checkbox/components/components.tsx +0 -59
  145. package/src/lib/components/checkbox/index.tsx +0 -1
  146. package/src/lib/components/checkbox/stories/checkbox.stories.mdx +0 -54
  147. package/src/lib/components/checkbox/stories/components.tsx +0 -36
  148. package/src/lib/components/checkbox/stories/index.tsx +0 -1
  149. package/src/lib/components/divider/divider-type-flags.tsx +0 -37
  150. package/src/lib/components/divider/divider.test.tsx +0 -34
  151. package/src/lib/components/divider/divider.tsx +0 -37
  152. package/src/lib/components/divider/index.tsx +0 -1
  153. package/src/lib/components/divider/stories/components.tsx +0 -13
  154. package/src/lib/components/divider/stories/divider.stories.mdx +0 -50
  155. package/src/lib/components/index.ts +0 -14
  156. package/src/lib/components/input-field/components/index.ts +0 -2
  157. package/src/lib/components/input-field/components/labeled-input.tsx +0 -61
  158. package/src/lib/components/input-field/components/stepper.tsx +0 -59
  159. package/src/lib/components/input-field/index.ts +0 -6
  160. package/src/lib/components/input-field/input-field.test.tsx +0 -108
  161. package/src/lib/components/input-field/input-field.tsx +0 -126
  162. package/src/lib/components/input-field/input-number.tsx +0 -41
  163. package/src/lib/components/input-field/input-text.tsx +0 -30
  164. package/src/lib/components/input-field/storybook/components.tsx +0 -334
  165. package/src/lib/components/input-field/storybook/input-field.stories.mdx +0 -113
  166. package/src/lib/components/layout/flex.tsx +0 -22
  167. package/src/lib/components/layout/grid-layout.tsx +0 -40
  168. package/src/lib/components/layout/index.ts +0 -3
  169. package/src/lib/components/layout/left-right-layout.tsx +0 -67
  170. package/src/lib/components/link/index.ts +0 -1
  171. package/src/lib/components/link/link.test.tsx +0 -29
  172. package/src/lib/components/link/link.tsx +0 -56
  173. package/src/lib/components/link/storybook/link.stories.mdx +0 -51
  174. package/src/lib/components/molecules/avatar/avatar-size-flags.tsx +0 -55
  175. package/src/lib/components/molecules/avatar/avatar.test.tsx +0 -114
  176. package/src/lib/components/molecules/avatar/avatar.tsx +0 -80
  177. package/src/lib/components/molecules/avatar/index.tsx +0 -1
  178. package/src/lib/components/molecules/avatar/stories/avatar.stories.mdx +0 -55
  179. package/src/lib/components/molecules/avatar/stories/components.tsx +0 -36
  180. package/src/lib/components/molecules/button/button-flags.tsx +0 -235
  181. package/src/lib/components/molecules/button/button.test.tsx +0 -77
  182. package/src/lib/components/molecules/button/button.tsx +0 -231
  183. package/src/lib/components/molecules/button/index.tsx +0 -1
  184. package/src/lib/components/molecules/button/stories/button.stories.mdx +0 -104
  185. package/src/lib/components/molecules/button/stories/components.tsx +0 -86
  186. package/src/lib/components/molecules/index.ts +0 -3
  187. package/src/lib/components/molecules/input-checkbox/index.tsx +0 -1
  188. package/src/lib/components/molecules/input-checkbox/input-checkbox.test.tsx +0 -34
  189. package/src/lib/components/molecules/input-checkbox/input-checkbox.tsx +0 -50
  190. package/src/lib/components/molecules/input-checkbox/stories/components.tsx +0 -36
  191. package/src/lib/components/molecules/input-checkbox/stories/index.tsx +0 -1
  192. package/src/lib/components/molecules/input-checkbox/stories/input-checkbox.stories.mdx +0 -51
  193. package/src/lib/components/organisms/index.ts +0 -1
  194. package/src/lib/components/organisms/multi-choice-list/index.tsx +0 -1
  195. package/src/lib/components/organisms/multi-choice-list/multi-choice-list.test.tsx +0 -33
  196. package/src/lib/components/organisms/multi-choice-list/multi-choice-list.tsx +0 -53
  197. package/src/lib/components/organisms/multi-choice-list/stories/components.tsx +0 -126
  198. package/src/lib/components/organisms/multi-choice-list/stories/index.tsx +0 -1
  199. package/src/lib/components/organisms/multi-choice-list/stories/multi-choice-list.stories.mdx +0 -99
  200. package/src/lib/components/spinner/index.tsx +0 -1
  201. package/src/lib/components/spinner/spinner-size-flags.tsx +0 -39
  202. package/src/lib/components/spinner/spinner.test.tsx +0 -31
  203. package/src/lib/components/spinner/spinner.tsx +0 -67
  204. package/src/lib/components/spinner/stories/components.tsx +0 -8
  205. package/src/lib/components/spinner/stories/spinner.stories.mdx +0 -42
  206. package/src/lib/components/thumbnail/index.tsx +0 -1
  207. package/src/lib/components/thumbnail/stories/thumbnail.stories.mdx +0 -34
  208. package/src/lib/components/thumbnail/thumbnail-size-flags.tsx +0 -41
  209. package/src/lib/components/thumbnail/thumbnail.test.tsx +0 -51
  210. package/src/lib/components/thumbnail/thumbnail.tsx +0 -40
  211. package/src/lib/components/typography/index.ts +0 -1
  212. package/src/lib/components/typography/storybook/components.tsx +0 -256
  213. package/src/lib/components/typography/storybook/typography.stories.mdx +0 -88
  214. package/src/lib/components/typography/typography.test.tsx +0 -93
  215. package/src/lib/components/typography/typography.tsx +0 -57
  216. package/src/lib/foundations/color-system/base-palette/base-palette.stories.tsx +0 -123
  217. package/src/lib/foundations/color-system/base-palette/base-palette.ts +0 -94
  218. package/src/lib/foundations/color-system/base-palette/index.ts +0 -1
  219. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.stories.mdx +0 -85
  220. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.stories.tsx +0 -231
  221. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.ts +0 -159
  222. package/src/lib/foundations/color-system/color-guidelines/index.ts +0 -1
  223. package/src/lib/foundations/color-system/components/color-sample.tsx +0 -99
  224. package/src/lib/foundations/color-system/components/index.ts +0 -1
  225. package/src/lib/foundations/color-system/index.ts +0 -1
  226. package/src/lib/foundations/index.ts +0 -4
  227. package/src/lib/foundations/shadows/components.tsx +0 -59
  228. package/src/lib/foundations/shadows/index.ts +0 -1
  229. package/src/lib/foundations/shadows/shadows.stories.mdx +0 -71
  230. package/src/lib/foundations/shadows/shadows.tsx +0 -47
  231. package/src/lib/foundations/spacing/index.ts +0 -1
  232. package/src/lib/foundations/spacing/spacing-guidelines.ts +0 -24
  233. package/src/lib/foundations/spacing/spacing.stories.mdx +0 -51
  234. package/src/lib/foundations/spacing/spacing.ts +0 -18
  235. package/src/lib/foundations/typography/constants.ts +0 -25
  236. package/src/lib/foundations/typography/index.tsx +0 -1
  237. package/src/lib/foundations/typography/text-aspect-flags.ts +0 -54
  238. package/src/lib/foundations/typography/typography.tsx +0 -97
  239. package/src/lib/helpers/generic-types.ts +0 -44
  240. package/src/lib/helpers/index.ts +0 -6
  241. package/src/lib/helpers/nothing.tsx +0 -18
  242. package/src/lib/helpers/safe-navigation.ts +0 -34
  243. package/src/lib/helpers/slots.tsx +0 -76
  244. package/src/lib/helpers/strings.test.ts +0 -47
  245. package/src/lib/helpers/strings.ts +0 -16
  246. package/tsconfig.json +0 -35
  247. package/tsconfig.lib.json +0 -28
  248. package/tsconfig.spec.json +0 -21
@@ -1,93 +0,0 @@
1
- import { render, screen } from '@testing-library/react'
2
- import {
3
- Display,
4
- Heading1,
5
- Heading2,
6
- Heading3,
7
- Heading4,
8
- BodyLarge,
9
- Body,
10
- Caption,
11
- Label1,
12
- Label2,
13
- } from './typography'
14
-
15
- describe('Typography', () => {
16
- it('should render Display successfully', () => {
17
- const { baseElement } = render(<Display>My Text Here</Display>)
18
- expect(baseElement).toBeTruthy()
19
- expect(screen.getByText('My Text Here')).toBeTruthy()
20
- })
21
-
22
- it('should render Heading1 successfully', () => {
23
- const { baseElement } = render(<Heading1>My Text Here</Heading1>)
24
- expect(baseElement).toBeTruthy()
25
- expect(screen.getByText('My Text Here')).toBeTruthy()
26
- })
27
-
28
- it('should render Heading2 successfully', () => {
29
- const { baseElement } = render(<Heading2>My Text Here</Heading2>)
30
- expect(baseElement).toBeTruthy()
31
- expect(screen.getByText('My Text Here')).toBeTruthy()
32
- })
33
-
34
- it('should render Heading3 successfully', () => {
35
- const { baseElement } = render(<Heading3>My Text Here</Heading3>)
36
- expect(baseElement).toBeTruthy()
37
- expect(screen.getByText('My Text Here')).toBeTruthy()
38
- })
39
-
40
- it('should render Heading4 successfully', () => {
41
- const { baseElement } = render(<Heading4>My Text Here</Heading4>)
42
- expect(baseElement).toBeTruthy()
43
- expect(screen.getByText('My Text Here')).toBeTruthy()
44
- })
45
-
46
- it('should render BodyLarge successfully', () => {
47
- const { baseElement } = render(<BodyLarge>My Text Here</BodyLarge>)
48
- expect(baseElement).toBeTruthy()
49
- expect(screen.getByText('My Text Here')).toBeTruthy()
50
- })
51
-
52
- it('should render Body successfully', () => {
53
- const { baseElement } = render(<Body>My Text Here</Body>)
54
- expect(baseElement).toBeTruthy()
55
- expect(screen.getByText('My Text Here')).toBeTruthy()
56
- })
57
-
58
- it('should render Subdued successfully', () => {
59
- const { baseElement } = render(<Body subdued>My Text Here</Body>)
60
- expect(baseElement).toBeTruthy()
61
- expect(screen.getByText('My Text Here')).toBeTruthy()
62
- })
63
-
64
- it('should render Light successfully', () => {
65
- const { baseElement } = render(<Body light>My Text Here</Body>)
66
- expect(baseElement).toBeTruthy()
67
- expect(screen.getByText('My Text Here')).toBeTruthy()
68
- })
69
-
70
- it('should render White successfully', () => {
71
- const { baseElement } = render(<Body onPrimary>My Text Here</Body>)
72
- expect(baseElement).toBeTruthy()
73
- expect(screen.getByText('My Text Here')).toBeTruthy()
74
- })
75
-
76
- it('should render Caption successfully', () => {
77
- const { baseElement } = render(<Caption>My Text Here</Caption>)
78
- expect(baseElement).toBeTruthy()
79
- expect(screen.getByText('My Text Here')).toBeTruthy()
80
- })
81
-
82
- it('should render Label1 successfully', () => {
83
- const { baseElement } = render(<Label1>My Text Here</Label1>)
84
- expect(baseElement).toBeTruthy()
85
- expect(screen.getByText('My Text Here')).toBeTruthy()
86
- })
87
-
88
- it('should render Label2 successfully', () => {
89
- const { baseElement } = render(<Label2>My Text Here</Label2>)
90
- expect(baseElement).toBeTruthy()
91
- expect(screen.getByText('My Text Here')).toBeTruthy()
92
- })
93
- })
@@ -1,57 +0,0 @@
1
- import { Typography, ITextProps, Margin } from '@foundations'
2
- import { PropsWithChildren } from '@helpers'
3
- import styled from 'styled-components'
4
-
5
- type Semibold = { semibold?: boolean }
6
- type Regular = { regular?: boolean }
7
- type Medium = { medium?: boolean }
8
-
9
- type ITextComponentProps = ITextProps & PropsWithChildren
10
-
11
- export const Display = styled.div<ITextComponentProps & Regular>`
12
- ${Typography.Display};
13
- `
14
-
15
- export const Heading1 = styled.h1<ITextComponentProps & Semibold>`
16
- ${Typography.Heading1};
17
- margin: ${Margin.none};
18
- margin-bottom: ${Margin.l};
19
- `
20
-
21
- export const Heading2 = styled.h2<ITextComponentProps & Semibold>`
22
- ${Typography.Heading2};
23
- margin: ${Margin.none};
24
- margin-bottom: ${Margin.m};
25
- `
26
-
27
- export const Heading3 = styled.h3<ITextComponentProps & Semibold>`
28
- ${Typography.Heading3};
29
- margin: ${Margin.none};
30
- margin-bottom: ${Margin.l};
31
- `
32
-
33
- export const Heading4 = styled.h4<ITextComponentProps & Semibold>`
34
- ${Typography.Heading4};
35
- margin: ${Margin.none};
36
- margin-bottom: ${Margin.m};
37
- `
38
-
39
- export const BodyLarge = styled.div<ITextComponentProps & Regular & Semibold>`
40
- ${Typography.BodyLarge};
41
- `
42
-
43
- export const Body = styled.div<ITextComponentProps & Regular & Medium>`
44
- ${Typography.Body};
45
- `
46
-
47
- export const Caption = styled.div<ITextComponentProps & Regular>`
48
- ${Typography.Caption};
49
- `
50
-
51
- export const Label1 = styled.div<ITextComponentProps & Regular & Medium>`
52
- ${Typography.Label1};
53
- `
54
-
55
- export const Label2 = styled.div<ITextComponentProps & Regular>`
56
- ${Typography.Label2};
57
- `
@@ -1,123 +0,0 @@
1
- import { Card, gridLayoutGenerator, leftRightLayoutGenerator } from '@components'
2
- import { FC } from '@helpers'
3
- import { BLUE, BRAND, ColorPalette, GRAY, GREEN, ORANGE, RED, SHADES } from './base-palette'
4
- import { ColorRectangle } from '../components'
5
- import { StoryComponent, talesOf } from '@stories'
6
-
7
- const Story: StoryComponent = () => {
8
- return (
9
- <Card
10
- heading={'Color System: Base Palette'}
11
- >
12
- <Card.Section>
13
- <Hue
14
- colorName={'Gray'}
15
- colorPalette={GRAY}
16
- description={
17
- 'These colors are used as supporting colors in backgrounds, text colors, seperators, modals, etc.'
18
- }
19
- />
20
- </Card.Section>
21
- <Card.Section>
22
- <Hue
23
- colorName={'Blue'}
24
- colorPalette={BLUE}
25
- description={
26
- 'These colors are used as across all the interactive elements such as CTAs, links, active states, etc.'
27
- }
28
- />
29
- </Card.Section>
30
- <Card.Section>
31
- <Hue
32
- colorName={'Green'}
33
- colorPalette={GREEN}
34
- description={
35
- 'These colors are used to depict the emotion of positivity. Generally used across success and complete states.'
36
- }
37
- />
38
- </Card.Section>
39
- <Card.Section>
40
- <Hue
41
- colorName={'Orange'}
42
- colorPalette={ORANGE}
43
- description={
44
- 'These colors are used to depict the emotion of caution. Generally used across warning states.'
45
- }
46
- />
47
- </Card.Section>
48
- <Card.Section>
49
- <Hue
50
- colorName={'Red'}
51
- colorPalette={RED}
52
- description={
53
- 'These colors decpict the emotion of negativity. Generally used across critical or destructive states.'
54
- }
55
- />
56
- </Card.Section>
57
- <Card.Section>
58
- <Hue
59
- colorName={'Shades'}
60
- colorPalette={SHADES}
61
- description={
62
- 'White is generally used to color text on surfaces such as primary buttons. Various opacities of black are used for shadows.'
63
- }
64
- />
65
- </Card.Section>
66
- <Card.Section>
67
- <Hue
68
- colorName={'Brand'}
69
- colorPalette={BRAND}
70
- description={
71
- 'Edvisor brand color.'
72
- }
73
- />
74
- </Card.Section>
75
- </Card>
76
- )
77
- }
78
-
79
- const { Layout } = leftRightLayoutGenerator()
80
-
81
- interface IHueProps {
82
- colorName: string
83
- colorPalette: ColorPalette
84
- description: string
85
- }
86
-
87
- /** a "hue" is a color like "green" or "red" without saturation or value */
88
- const Hue: FC<IHueProps> = (props) => {
89
- return (
90
- <Layout>
91
- <Layout.Left>
92
- <Layout.HeadingText>{props.colorName}</Layout.HeadingText>
93
- <Layout.HelpText>{props.description}</Layout.HelpText>
94
- </Layout.Left>
95
- <Layout.Right>
96
- <Palette colors={props.colorPalette} />
97
- </Layout.Right>
98
- </Layout>
99
- )
100
- }
101
-
102
- const { Grid } = gridLayoutGenerator({
103
- columns: 5,
104
- rows: 2,
105
- columnGutter: 16,
106
- rowGutter: 24,
107
- })
108
-
109
- interface IPaletteProps {
110
- colors: ColorPalette
111
- }
112
-
113
- const Palette: FC<IPaletteProps> = (props) => {
114
- return (
115
- <Grid>
116
- {Object.entries(props.colors).map(([name, hex]) =>
117
- <ColorRectangle key={hex} name={name} hex={hex}/>
118
- )}
119
- </Grid>
120
- )
121
- }
122
-
123
- talesOf(__filename, module, Story)
@@ -1,94 +0,0 @@
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
- 3300: '#FEF6F6',
69
- 400: '#F87171',
70
- 500: '#EF4444',
71
- 600: '#DC2626',
72
- 700: '#B91C1C',
73
- 800: '#991B1B',
74
- 900: '#7F1D1D',
75
- } as const
76
-
77
- export const SHADES = {
78
- White: WHITE,
79
- Black: BLACK,
80
- } as const
81
-
82
- export const BRAND = {
83
- Brand: '#0792D4',
84
- } as const
85
-
86
- type ValuesOf<T> = T[keyof T]
87
-
88
- export type COLOR = ValuesOf<typeof BRAND>
89
- | ValuesOf<typeof BLUE>
90
- | ValuesOf<typeof SHADES>
91
- | ValuesOf<typeof RED>
92
- | ValuesOf<typeof ORANGE>
93
- | ValuesOf<typeof GREEN>
94
- | ValuesOf<typeof GRAY>
@@ -1 +0,0 @@
1
- export * from './base-palette'
@@ -1,85 +0,0 @@
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
@@ -1,231 +0,0 @@
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)