@edvisor/product-language 0.2.0 → 0.3.0

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 (94) hide show
  1. package/.eslintrc.json +14 -6
  2. package/package.json +2 -3
  3. package/project.json +18 -7
  4. package/src/README.md +61 -0
  5. package/src/helpers/index.ts +2 -1
  6. package/src/helpers/playground.ts +16 -0
  7. package/src/lib/components/badge/badge.tsx +8 -17
  8. package/src/lib/components/badge/stories/badge.stories.mdx +44 -0
  9. package/src/lib/components/badge/stories/components.tsx +49 -0
  10. package/src/lib/components/card/card.test.tsx +4 -5
  11. package/src/lib/components/card/card.tsx +2 -2
  12. package/src/lib/components/card/components/card-section-slot.tsx +2 -2
  13. package/src/lib/components/card/storybook/card.stories.mdx +1 -1
  14. package/src/lib/components/card/storybook/components.tsx +6 -23
  15. package/src/lib/components/checkbox/checkbox.tsx +34 -95
  16. package/src/lib/components/checkbox/helpers.tsx +100 -0
  17. package/src/lib/components/checkbox/stories/checkbox.stories.mdx +27 -24
  18. package/src/lib/components/checkbox/stories/components.tsx +63 -15
  19. package/src/lib/components/divider/stories/divider.stories.mdx +7 -13
  20. package/src/lib/components/flag/flag-size-flags.tsx +55 -0
  21. package/src/lib/components/flag/flag.list.tsx +788 -0
  22. package/src/lib/components/flag/flag.test.tsx +65 -0
  23. package/src/lib/components/flag/flag.tsx +97 -0
  24. package/src/lib/components/flag/index.tsx +1 -0
  25. package/src/lib/components/flag/stories/components.tsx +403 -0
  26. package/src/lib/components/flag/stories/flag.stories.mdx +48 -0
  27. package/src/lib/components/flag/stories/playGround-select.tsx +145 -0
  28. package/src/lib/components/icon/icon-list.tsx +135 -0
  29. package/src/lib/components/icon/icon.test.tsx +48 -0
  30. package/src/lib/components/icon/icon.tsx +181 -0
  31. package/src/lib/components/icon/index.tsx +1 -0
  32. package/src/lib/components/icon/stories/components.tsx +282 -0
  33. package/src/lib/components/icon/stories/icon.stories.mdx +65 -0
  34. package/src/lib/components/index.ts +5 -0
  35. package/src/lib/components/input-field/components/labeled-input.tsx +7 -14
  36. package/src/lib/components/input-field/components/stepper.tsx +4 -3
  37. package/src/lib/components/input-field/input-field.test.tsx +5 -6
  38. package/src/lib/components/input-field/input-field.tsx +8 -8
  39. package/src/lib/components/input-field/storybook/components.tsx +9 -16
  40. package/src/lib/components/link/storybook/link.stories.mdx +1 -0
  41. package/src/lib/components/molecules/avatar/avatar-size-flags.tsx +3 -3
  42. package/src/lib/components/molecules/avatar/avatar.tsx +2 -2
  43. package/src/lib/components/molecules/avatar/stories/avatar.stories.mdx +18 -21
  44. package/src/lib/components/molecules/button/button-flags.tsx +120 -15
  45. package/src/lib/components/molecules/button/button.test.tsx +9 -9
  46. package/src/lib/components/molecules/button/button.tsx +61 -78
  47. package/src/lib/components/molecules/button/stories/button.stories.mdx +43 -42
  48. package/src/lib/components/molecules/button/stories/components.tsx +6 -8
  49. package/src/lib/components/molecules/input-checkbox/input-checkbox.tsx +23 -24
  50. package/src/lib/components/molecules/input-checkbox/stories/components.tsx +32 -15
  51. package/src/lib/components/molecules/input-checkbox/stories/input-checkbox.stories.mdx +6 -8
  52. package/src/lib/components/organisms/multi-choice-list/multi-choice-list.tsx +7 -8
  53. package/src/lib/components/organisms/multi-choice-list/stories/components.tsx +3 -5
  54. package/src/lib/components/organisms/multi-choice-list/stories/multi-choice-list.stories.mdx +4 -4
  55. package/src/lib/components/spinner/spinner.test.tsx +2 -2
  56. package/src/lib/components/spinner/spinner.tsx +15 -28
  57. package/src/lib/components/spinner/stories/components.tsx +33 -2
  58. package/src/lib/components/spinner/stories/spinner.stories.mdx +3 -10
  59. package/src/lib/components/tabs/components/index.ts +1 -0
  60. package/src/lib/components/tabs/components/tab.tsx +62 -0
  61. package/src/lib/components/tabs/index.tsx +1 -0
  62. package/src/lib/components/tabs/storybook/components.tsx +282 -0
  63. package/src/lib/components/tabs/storybook/tabs.stories.mdx +97 -0
  64. package/src/lib/components/tabs/tabs.test.tsx +86 -0
  65. package/src/lib/components/tabs/tabs.tsx +101 -0
  66. package/src/lib/components/tag/components/close-button.tsx +85 -0
  67. package/src/lib/components/tag/components/index.ts +2 -0
  68. package/src/lib/components/tag/components/tag-label.tsx +44 -0
  69. package/src/lib/components/tag/index.tsx +1 -0
  70. package/src/lib/components/tag/stories/components.tsx +86 -0
  71. package/src/lib/components/tag/stories/tag.stories.mdx +42 -0
  72. package/src/lib/components/tag/tag.test.tsx +36 -0
  73. package/src/lib/components/tag/tag.tsx +33 -0
  74. package/src/lib/components/thumbnail/thumbnail.tsx +7 -2
  75. package/src/lib/components/typography/storybook/components.tsx +47 -15
  76. package/src/lib/components/typography/storybook/typography.stories.mdx +6 -4
  77. package/src/lib/components/typography/typography.test.tsx +34 -30
  78. package/src/lib/components/typography/typography.tsx +61 -19
  79. package/src/lib/foundations/color-system/base-palette/base-palette.ts +0 -1
  80. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.ts +5 -4
  81. package/src/lib/foundations/color-system/components/color-sample.tsx +3 -3
  82. package/src/lib/foundations/typography/fonts.ts +205 -0
  83. package/src/lib/foundations/typography/text-aspect-flags.ts +11 -4
  84. package/src/lib/foundations/typography/typography.tsx +38 -33
  85. package/src/lib/helpers/numbers.ts +14 -0
  86. package/src/lib/helpers/safe-navigation.ts +10 -0
  87. package/src/lib/helpers/slots.test.tsx +98 -0
  88. package/src/lib/helpers/slots.tsx +93 -12
  89. package/.storybook/preview-head.html +0 -1
  90. package/src/lib/components/badge/badge.stories.tsx +0 -16
  91. package/src/lib/components/checkbox/components/components.tsx +0 -59
  92. package/src/lib/components/checkbox/stories/index.tsx +0 -1
  93. package/src/lib/components/molecules/input-checkbox/stories/index.tsx +0 -1
  94. package/src/lib/components/organisms/multi-choice-list/stories/index.tsx +0 -1
@@ -6,7 +6,7 @@ import { getSlot, Slot, is, forwardRef, If } from '@helpers'
6
6
  import { Flex, SpaceBetween } from '../layout'
7
7
 
8
8
  import { LabeledInput } from './components'
9
- import { Label1, Label2 } from 'components/typography'
9
+ import { Label } from 'components/typography'
10
10
 
11
11
  const FancyBorder = styled(SpaceBetween)<{ invalid?: boolean }>`
12
12
  background: ${({ invalid }) => is(invalid) ? Surface.Critical.Subdued : Surface.Default.Default };
@@ -49,11 +49,11 @@ export const HTMLInput = styled.input`
49
49
  }
50
50
  `
51
51
 
52
- const PrefixFrame = styled(Label1)`
52
+ const PrefixFrame = styled(Label)`
53
53
  margin-right: ${Margin.xs};
54
54
  `
55
55
 
56
- const SuffixFrame = styled(Label1)`
56
+ const SuffixFrame = styled(Label)`
57
57
  margin-right: ${Margin.xs};
58
58
  `
59
59
 
@@ -82,7 +82,7 @@ const InputFrame = styled.label`
82
82
 
83
83
  const ControlsFrame = Flex
84
84
 
85
- const Label = styled(Label2)`
85
+ const InputLabel = styled(Label)`
86
86
  margin-bottom: ${Margin.xxs};
87
87
  `
88
88
 
@@ -100,19 +100,19 @@ export const InputField = forwardRef<
100
100
  <FancyBorder invalid={props.invalid} className={className}>
101
101
  <InputFrame>
102
102
  <If is={label}>
103
- <Label subdued>
103
+ <InputLabel subtle subdued>
104
104
  {label}
105
105
  {required}
106
- </Label>
106
+ </InputLabel>
107
107
  </If>
108
108
  <InputLayout>
109
109
  {icon}
110
110
  <If is={prefix}>
111
- <PrefixFrame subdued>{prefix}</PrefixFrame>
111
+ <PrefixFrame subtle subdued>{prefix}</PrefixFrame>
112
112
  </If>
113
113
  <HTMLInput ref={ref} {...inputProps} />
114
114
  <If is={suffix}>
115
- <SuffixFrame subdued>{suffix}</SuffixFrame>
115
+ <SuffixFrame subtle subdued>{suffix}</SuffixFrame>
116
116
  </If>
117
117
  </InputLayout>
118
118
  </InputFrame>
@@ -1,22 +1,15 @@
1
1
  import styled from 'styled-components'
2
2
  import { useForm } from 'react-hook-form'
3
3
 
4
- import { Icons, Margin } from '@foundations'
5
4
  import { SpaceBetween } from 'components/layout'
6
5
  import { InputField } from '../input-field'
7
6
 
7
+ import { IconMinor } from 'components/icon'
8
+
8
9
  import { Playground } from 'storybook-addon-jarle-monaco'
9
10
  import { InputNumber } from '../input-number'
10
11
  import { InputText } from '../input-text'
11
12
 
12
- /** @TODO placeholder Icon until the icons are done */
13
- export const Icon = styled.div`
14
- height: 16px;
15
- width: 16px;
16
- border: 2px solid ${Icons.Default};
17
- border-radius: 50%;
18
- margin-right: ${Margin.xs};
19
- `
20
13
 
21
14
  export const PlainHTMLFormExample = () => (
22
15
  <Playground
@@ -159,7 +152,7 @@ export const IconExample = () => (
159
152
  prefix="🍺"
160
153
  >
161
154
  <InputField.Icon>
162
- <Icon title="Icons render before the input" />
155
+ <IconMinor.FolderOpen title="Icons render before the input" />
163
156
  </InputField.Icon>
164
157
  </InputField>
165
158
  `}
@@ -167,7 +160,7 @@ export const IconExample = () => (
167
160
  renderAsComponent: true,
168
161
  scope: {
169
162
  InputField,
170
- Icon,
163
+ IconMinor,
171
164
  },
172
165
  }}
173
166
  />
@@ -201,7 +194,7 @@ const onDislike = () => setLikes(Math.max(likes - 1, 0));
201
194
  renderAsComponent: true,
202
195
  scope: {
203
196
  InputField,
204
- Icon,
197
+ IconMinor,
205
198
  styled,
206
199
  SpaceBetween,
207
200
  },
@@ -247,7 +240,7 @@ const handleChange = (change: string) => {
247
240
  renderAsComponent: true,
248
241
  scope: {
249
242
  InputText,
250
- Icon,
243
+ IconMinor,
251
244
  },
252
245
  }}
253
246
  />
@@ -315,10 +308,10 @@ export const AllDressedExample = () => (
315
308
  placeholder="Enter an amount..."
316
309
  >
317
310
  <InputField.Icon>
318
- <Icon title="Icons render before the input" />
311
+ <IconMinor.CircleDollar title="Icons render before the input" />
319
312
  </InputField.Icon>
320
313
  <InputField.Controls>
321
- <Icon title="Controls render after the input" />
314
+ <IconMinor.CircleDollar title="Controls render after the input" />
322
315
  </InputField.Controls>
323
316
  </InputField>
324
317
  </InputField.Label>
@@ -327,7 +320,7 @@ export const AllDressedExample = () => (
327
320
  renderAsComponent: true,
328
321
  scope: {
329
322
  InputField,
330
- Icon,
323
+ IconMinor,
331
324
  },
332
325
  }}
333
326
  />
@@ -1,5 +1,6 @@
1
1
  import { Canvas, Meta } from '@storybook/addon-docs';
2
2
  import { Link } from '../link'
3
+ import { Button } from '../../molecules/button'
3
4
  import { Body } from '../../typography'
4
5
 
5
6
 
@@ -1,6 +1,6 @@
1
1
  // this file was generated, but it is safe to modify
2
2
  import { bitwiseOr, MappedEnum, RequireOnlyOne, PropsWithChildren } from '@helpers'
3
- import { Label1, BodyLarge, Display } from 'components/typography'
3
+ import { Label, Body, Display } from 'components/typography'
4
4
 
5
5
  const enum AvatarSize {
6
6
  small = 1,
@@ -30,8 +30,8 @@ const AvatarSizeValues = {
30
30
  }
31
31
 
32
32
  const AvatarSizeNodes = {
33
- [AvatarSize.small]: Label1,
34
- [AvatarSize.medium]: BodyLarge,
33
+ [AvatarSize.small]: Label,
34
+ [AvatarSize.medium]: Body,
35
35
  [AvatarSize.large]: Display,
36
36
  }
37
37
 
@@ -3,7 +3,7 @@ import { FC, isDefined, isNil, Nothing } from '@helpers'
3
3
  import { Margin, Surface } from '@foundations'
4
4
  import { SpaceAround } from '../../layout/'
5
5
  import { AvatarSizeProps, getValuesBySize, getNodeToRenderText } from './avatar-size-flags'
6
- import { Label1 } from 'components/typography'
6
+ import { Label } from 'components/typography'
7
7
 
8
8
  const Container = styled(SpaceAround)`
9
9
  align-items: center;
@@ -25,7 +25,7 @@ const Image = styled.img`
25
25
  border-radius: 50%;
26
26
  `
27
27
 
28
- const FullName = styled(Label1)`
28
+ const FullName = styled(Label)`
29
29
  margin-left: ${Margin.xs};
30
30
  `
31
31
  interface IAvatarProps {
@@ -1,4 +1,4 @@
1
- import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
1
+ import { Canvas, Meta } from '@storybook/addon-docs';
2
2
  import { Avatar } from '../index'
3
3
  import { WrapperStories, AvatarsWithText, AvatarsWithImage, WrapperStoriesWithLabel } from './components'
4
4
 
@@ -26,30 +26,27 @@ import { Avatar } from './index'
26
26
 
27
27
  ## Examples
28
28
 
29
+ Default
29
30
  <Canvas>
30
- <Story name="default">
31
- <WrapperStories>
32
- <AvatarsWithText>
33
- <Avatar name="Yan Leite" small />
34
- <Avatar name="Yan Leite" medium />
35
- <Avatar name="Yan Leite" large />
36
- </AvatarsWithText>
37
- <AvatarsWithImage>
38
- <Avatar name="Yan Leite" imageLabel="Edvisor Logo" small imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
39
- <Avatar name="Yan Leite" medium imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
40
- <Avatar name="Yan Leite" large imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
41
- </AvatarsWithImage>
42
- </WrapperStories>
43
- </Story>
31
+ <WrapperStories>
32
+ <AvatarsWithText>
33
+ <Avatar name="Yan Leite" small />
34
+ <Avatar name="Yan Leite" medium />
35
+ <Avatar name="Yan Leite" large />
36
+ </AvatarsWithText>
37
+ <AvatarsWithImage>
38
+ <Avatar name="Yan Leite" imageLabel="Edvisor Logo" small imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
39
+ <Avatar name="Yan Leite" medium imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
40
+ <Avatar name="Yan Leite" large imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
41
+ </AvatarsWithImage>
42
+ </WrapperStories>
44
43
  </Canvas>
45
44
 
46
45
  Also, we can use that rendering the full name
47
46
  <Canvas>
48
- <Story name="with-label">
49
- <WrapperStoriesWithLabel>
50
- <Avatar name="Yan Leite" withLabel />
51
- <Avatar name="Yan Leite" withLabel imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
52
- </WrapperStoriesWithLabel>
53
- </Story>
47
+ <WrapperStoriesWithLabel>
48
+ <Avatar name="Yan Leite" withLabel />
49
+ <Avatar name="Yan Leite" withLabel imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png' />
50
+ </WrapperStoriesWithLabel>
54
51
  </Canvas>
55
52
 
@@ -4,17 +4,19 @@ import {
4
4
  MappedEnum,
5
5
  RequireOnlyOne,
6
6
  PropsWithChildren,
7
+ getRightmostSetBitNumber,
7
8
  } from '@helpers'
8
- import { Actions, Padding, Interactive, Text, Borders } from '@foundations'
9
+ import { Actions, Padding, Interactive, Text, Borders, Icons } from '@foundations'
9
10
 
10
11
  export const enum ButtonType {
11
12
  basic = 1,
12
13
  primary = 2,
13
- primaryDestructive = 4,
14
- destructive = 8,
15
- outline = 16,
16
- plain = 32,
17
- plainSubtle = 64,
14
+ destructive = 4,
15
+ destructivePrimary = 6,
16
+ outline = 8,
17
+ plain = 16,
18
+ subtle = 32,
19
+ plainSubtle = 48,
18
20
  }
19
21
 
20
22
  const enum ButtonSize {
@@ -56,83 +58,147 @@ function toButtonDisabledType(n: number): ButtonDisabledType {
56
58
  }
57
59
  }
58
60
 
61
+ function toButtonTypes(n: number): ButtonType {
62
+ const defaultType = 0
63
+ switch (n) {
64
+ case defaultType:
65
+ case ButtonType.basic:
66
+ return ButtonType.basic
67
+ case ButtonType.primary:
68
+ return ButtonType.primary
69
+ case ButtonType.destructivePrimary:
70
+ return ButtonType.destructivePrimary
71
+ case ButtonType.destructive:
72
+ return ButtonType.destructive
73
+ case ButtonType.outline:
74
+ return ButtonType.outline
75
+ case ButtonType.plain:
76
+ return ButtonType.plain
77
+ case ButtonType.plainSubtle:
78
+ return ButtonType.plainSubtle
79
+ default:
80
+ return getRightmostSetBitNumber(n)
81
+ }
82
+ }
83
+
59
84
  const ButtonBackgroundColorValues = {
60
85
  [ButtonType.basic]: Actions.Secondary.Default,
61
86
  [ButtonType.primary]: Actions.Primary.Default,
62
- [ButtonType.primaryDestructive]: Actions.Critical.Default,
87
+ [ButtonType.destructivePrimary]: Actions.Critical.Default,
63
88
  [ButtonType.destructive]: 'none',
64
89
  [ButtonType.outline]: 'none',
65
90
  [ButtonType.plain]: 'none',
91
+ [ButtonType.subtle]: 'none',
66
92
  [ButtonType.plainSubtle]: 'none',
67
93
  }
68
94
 
69
95
  const ButtonBackgroundColorDisabledValues = {
70
96
  [ButtonType.basic]: Actions.Secondary.Disabled,
71
97
  [ButtonType.primary]: Actions.Primary.Disabled,
72
- [ButtonType.primaryDestructive]: Actions.Critical.Disabled,
98
+ [ButtonType.destructivePrimary]: Actions.Critical.Disabled,
73
99
  [ButtonType.destructive]: Actions.Secondary.Disabled,
74
100
  [ButtonType.outline]: 'none',
75
101
  [ButtonType.plain]: 'none',
102
+ [ButtonType.subtle]: Actions.Secondary.Disabled,
76
103
  [ButtonType.plainSubtle]: 'none',
77
104
  }
78
105
 
79
106
  const ButtonBackgroundColorHoverValues = {
80
107
  [ButtonType.basic]: Actions.Secondary.Hover,
81
108
  [ButtonType.primary]: Actions.Primary.Hover,
82
- [ButtonType.primaryDestructive]: Actions.Critical.Hover,
109
+ [ButtonType.destructivePrimary]: Actions.Critical.Hover,
83
110
  [ButtonType.destructive]: Actions.Critical.Hover,
84
111
  [ButtonType.outline]: Actions.Secondary.Hover,
85
112
  [ButtonType.plain]: '',
113
+ [ButtonType.subtle]: Actions.Secondary.Hover,
86
114
  [ButtonType.plainSubtle]: '',
87
115
  }
88
116
 
117
+ const ButtonTextDecorationHoverValues = {
118
+ [ButtonType.basic]: '',
119
+ [ButtonType.primary]: '',
120
+ [ButtonType.destructivePrimary]: '',
121
+ [ButtonType.destructive]: '',
122
+ [ButtonType.outline]: '',
123
+ [ButtonType.plain]: 'underline',
124
+ [ButtonType.subtle]: '',
125
+ [ButtonType.plainSubtle]: 'underline',
126
+ }
127
+
89
128
  const ButtonBackgroundColorPressedValues = {
90
129
  [ButtonType.basic]: Actions.Secondary.Pressed,
91
130
  [ButtonType.primary]: Actions.Primary.Pressed,
92
- [ButtonType.primaryDestructive]: Actions.Critical.Pressed,
131
+ [ButtonType.destructivePrimary]: Actions.Critical.Pressed,
93
132
  [ButtonType.destructive]: Actions.Critical.Pressed,
94
133
  [ButtonType.outline]: Actions.Secondary.Pressed,
95
134
  [ButtonType.plain]: Actions.Secondary.Hover,
135
+ [ButtonType.subtle]: Actions.Secondary.Pressed,
96
136
  [ButtonType.plainSubtle]: Actions.Secondary.Hover,
97
137
  }
98
138
 
99
139
  const ButtonTextColorValues = {
100
140
  [ButtonType.basic]: Text.Default,
101
141
  [ButtonType.primary]: Text.OnPrimary,
102
- [ButtonType.primaryDestructive]: Text.OnCritical,
142
+ [ButtonType.destructivePrimary]: Text.OnCritical,
103
143
  [ButtonType.destructive]: Text.Default,
104
144
  [ButtonType.outline]: Text.Default,
105
145
  [ButtonType.plain]: Interactive.Default.Default,
146
+ [ButtonType.subtle]: Text.Default,
106
147
  [ButtonType.plainSubtle]: Interactive.Subtle.Default,
107
148
  }
108
149
 
150
+ const IconTextColorValues = {
151
+ [ButtonType.basic]: Icons.Default,
152
+ [ButtonType.primary]: Icons.OnPrimary,
153
+ [ButtonType.destructivePrimary]: Icons.OnCritical,
154
+ [ButtonType.destructive]: Icons.Default,
155
+ [ButtonType.outline]: Icons.Default,
156
+ [ButtonType.plain]: Interactive.Default.Default,
157
+ [ButtonType.subtle]: Icons.Default,
158
+ [ButtonType.plainSubtle]: Icons.Default,
159
+ }
160
+
109
161
  const ButtonTextColorHoverValues = {
110
162
  [ButtonType.basic]: Text.Default,
111
163
  [ButtonType.primary]: Text.OnPrimary,
112
- [ButtonType.primaryDestructive]: Text.OnCritical,
164
+ [ButtonType.destructivePrimary]: Text.OnCritical,
113
165
  [ButtonType.destructive]: Text.OnCritical,
114
166
  [ButtonType.outline]: Text.Default,
115
167
  [ButtonType.plain]: Interactive.Default.Hover,
168
+ [ButtonType.subtle]: Text.Default,
169
+ [ButtonType.plainSubtle]: Interactive.Subtle.Hover,
170
+ }
171
+
172
+ const IconColorHoverValues = {
173
+ [ButtonType.basic]: Icons.Default,
174
+ [ButtonType.primary]: Icons.OnPrimary,
175
+ [ButtonType.destructivePrimary]: Icons.OnCritical,
176
+ [ButtonType.destructive]: Icons.OnCritical,
177
+ [ButtonType.outline]: Icons.Default,
178
+ [ButtonType.plain]: Interactive.Default.Hover,
179
+ [ButtonType.subtle]: Icons.Default,
116
180
  [ButtonType.plainSubtle]: Interactive.Subtle.Hover,
117
181
  }
118
182
 
119
183
  const ButtonBorderValues = {
120
184
  [ButtonType.basic]: `1px solid ${Borders.Default.Default}`,
121
185
  [ButtonType.primary]: 'none',
122
- [ButtonType.primaryDestructive]: 'none',
186
+ [ButtonType.destructivePrimary]: 'none',
123
187
  [ButtonType.destructive]: `1px solid ${Borders.Default.Default}`,
124
188
  [ButtonType.outline]: `1px solid ${Borders.Default.Default}`,
125
189
  [ButtonType.plain]: 'none',
190
+ [ButtonType.subtle]: `1px solid ${Borders.Default.Default}`,
126
191
  [ButtonType.plainSubtle]: 'none',
127
192
  }
128
193
 
129
194
  const ButtonBorderDisabledValues = {
130
195
  [ButtonType.basic]: `1px solid ${Borders.Default.Subdued}`,
131
196
  [ButtonType.primary]: 'none',
132
- [ButtonType.primaryDestructive]: 'none',
197
+ [ButtonType.destructivePrimary]: 'none',
133
198
  [ButtonType.destructive]: `1px solid ${Borders.Default.Subdued}`,
134
199
  [ButtonType.outline]: `1px solid ${Borders.Default.Default}`,
135
200
  [ButtonType.plain]: 'none',
201
+ [ButtonType.subtle]: `1px solid ${Borders.Default.Subdued}`,
136
202
  [ButtonType.plainSubtle]: 'none',
137
203
  }
138
204
 
@@ -155,13 +221,25 @@ const ButtonSizeValues = {
155
221
  const ButtonSizeValuesByType = {
156
222
  [ButtonType.basic]: '',
157
223
  [ButtonType.primary]: '',
158
- [ButtonType.primaryDestructive]: '',
224
+ [ButtonType.destructivePrimary]: '',
159
225
  [ButtonType.destructive]: '',
160
226
  [ButtonType.outline]: '',
161
227
  [ButtonType.plain]: `${Padding.xxxs} ${Padding.xxs}`,
228
+ [ButtonType.subtle]: '',
162
229
  [ButtonType.plainSubtle]: `${Padding.xxxs} ${Padding.xxs}`,
163
230
  }
164
231
 
232
+ const ButtonTypeValues = {
233
+ [ButtonType.basic]: 1,
234
+ [ButtonType.primary]: 2,
235
+ [ButtonType.destructive]: 4,
236
+ [ButtonType.destructivePrimary]: 6,
237
+ [ButtonType.outline]: 8,
238
+ [ButtonType.plain]: 16,
239
+ [ButtonType.subtle]: 32,
240
+ [ButtonType.plainSubtle]: 48,
241
+ }
242
+
165
243
  export type ButtonTypeProps = Partial<RequireOnlyOne<ButtonTypes<boolean>>> &
166
244
  PropsWithChildren
167
245
 
@@ -181,6 +259,10 @@ export function getBackgroundColorHoverByType(type: ButtonType): string {
181
259
  return ButtonBackgroundColorHoverValues[type]
182
260
  }
183
261
 
262
+ export function getTextDecorationHoverByType(type: ButtonType): string {
263
+ return ButtonTextDecorationHoverValues[type]
264
+ }
265
+
184
266
  export function getBackgroundColorDisabledByType(type: ButtonType): string {
185
267
  return ButtonBackgroundColorDisabledValues[type]
186
268
  }
@@ -193,10 +275,18 @@ export function getTextColorByType(type: ButtonType): string {
193
275
  return ButtonTextColorValues[type]
194
276
  }
195
277
 
278
+ export function getIconColorByType(type: ButtonType): string {
279
+ return IconTextColorValues[type]
280
+ }
281
+
196
282
  export function getTextColorOnHoverByType(type: ButtonType): string {
197
283
  return ButtonTextColorHoverValues[type]
198
284
  }
199
285
 
286
+ export function getIconColorOnHoverByType(type: ButtonType): string {
287
+ return IconColorHoverValues[type]
288
+ }
289
+
200
290
  export function getBorderByType(type: ButtonType): string {
201
291
  return ButtonBorderValues[type]
202
292
  }
@@ -233,3 +323,18 @@ export function getIsDisabled(props: ButtonDisabledTypeProps): boolean {
233
323
  ButtonDisabledType.disabled
234
324
  )
235
325
  }
326
+
327
+ export function getButtonType(props: ButtonTypeProps) {
328
+ return ButtonTypeValues[
329
+ toButtonTypes(
330
+ bitwiseOr([
331
+ props.basic,
332
+ props.primary,
333
+ props.destructive,
334
+ props.outline,
335
+ props.plain,
336
+ props.subtle,
337
+ ])
338
+ )
339
+ ]
340
+ }
@@ -1,12 +1,12 @@
1
1
  import { Actions } from '@foundations'
2
2
  import {render, screen } from '@testing-library/react'
3
- import { ButtonBasic, ButtonPrimary, ButtonDestructive, ButtonOutline, ButtonPlain } from './index'
3
+ import { Button } from './index'
4
4
 
5
5
  describe('Button Tests', () => {
6
6
  describe('ButtonBasic Tests', () => {
7
7
  it('should render Button with given Text', async () => {
8
8
  render(
9
- <ButtonBasic>Test Button</ButtonBasic>
9
+ <Button>Test Button</Button>
10
10
  )
11
11
 
12
12
  expect(screen.getByText('Test Button')).toBeInTheDocument()
@@ -18,7 +18,7 @@ describe('Button Tests', () => {
18
18
  describe('ButtonPrimary Tests', () => {
19
19
  it('should render Button with given Text', async () => {
20
20
  render(
21
- <ButtonPrimary>Test Button</ButtonPrimary>
21
+ <Button primary>Test Button</Button>
22
22
  )
23
23
 
24
24
  expect(screen.getByText('Test Button')).toBeInTheDocument()
@@ -30,22 +30,22 @@ describe('Button Tests', () => {
30
30
  describe('ButtonDestructive Tests', () => {
31
31
  it('should render Button with given Text', async () => {
32
32
  render(
33
- <ButtonDestructive>Test Button</ButtonDestructive>
33
+ <Button destructive>Test Button</Button>
34
34
  )
35
35
 
36
36
  expect(screen.getByText('Test Button')).toBeInTheDocument()
37
37
  expect(screen.queryByRole('button')).toBeInTheDocument()
38
- expect(screen.getByTestId('button-test')).toHaveStyle('background: none')
38
+ expect(screen.queryByRole('button')).toHaveStyle('background: none')
39
39
  })
40
40
 
41
41
  it('should render Button with given Text', async () => {
42
42
  render(
43
- <ButtonDestructive primary>Test Button</ButtonDestructive>
43
+ <Button destructive primary>Test Button</Button>
44
44
  )
45
45
 
46
46
  expect(screen.getByText('Test Button')).toBeInTheDocument()
47
47
  expect(screen.queryByRole('button')).toBeInTheDocument()
48
- expect(screen.getByTestId('button-test')).toHaveStyle(`background: ${Actions.Critical.Default}`)
48
+ expect(screen.queryByRole('button')).toHaveStyle(`background: ${Actions.Critical.Default}`)
49
49
  })
50
50
 
51
51
 
@@ -54,7 +54,7 @@ describe('Button Tests', () => {
54
54
  describe('ButtonOutline Tests', () => {
55
55
  it('should render Button with given Text', async () => {
56
56
  render(
57
- <ButtonOutline>Test Button</ButtonOutline>
57
+ <Button outline>Test Button</Button>
58
58
  )
59
59
 
60
60
  expect(screen.getByText('Test Button')).toBeInTheDocument()
@@ -66,7 +66,7 @@ describe('Button Tests', () => {
66
66
  describe('ButtonPlain Tests', () => {
67
67
  it('should render Button with given Text', async () => {
68
68
  render(
69
- <ButtonPlain>Test Button</ButtonPlain>
69
+ <Button plain>Test Button</Button>
70
70
  )
71
71
 
72
72
  expect(screen.getByText('Test Button')).toBeInTheDocument()