@charcoal-ui/react 3.6.0 → 3.8.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 (127) hide show
  1. package/dist/_lib/compat.d.ts +1 -0
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/StyledButton.d.ts +13 -0
  4. package/dist/components/Button/StyledButton.d.ts.map +1 -0
  5. package/dist/components/Button/index.d.ts +3 -2
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/index.story.d.ts +16 -32
  8. package/dist/components/Button/index.story.d.ts.map +1 -1
  9. package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
  10. package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
  11. package/dist/components/Button/lib/variantToFont.d.ts +3 -0
  12. package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
  13. package/dist/components/Checkbox/index.d.ts.map +1 -1
  14. package/dist/components/Checkbox/index.story.d.ts +6 -16
  15. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  16. package/dist/components/Clickable/index.story.d.ts +4 -6
  17. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  18. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
  19. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
  20. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
  21. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
  22. package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
  23. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
  24. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  25. package/dist/components/DropdownSelector/index.story.d.ts +9 -11
  26. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  27. package/dist/components/Icon/index.story.d.ts +4 -26
  28. package/dist/components/Icon/index.story.d.ts.map +1 -1
  29. package/dist/components/IconButton/index.d.ts +1 -0
  30. package/dist/components/IconButton/index.d.ts.map +1 -1
  31. package/dist/components/IconButton/index.story.d.ts +6 -25
  32. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  33. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
  34. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
  35. package/dist/components/LoadingSpinner/index.d.ts +2 -2
  36. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  37. package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
  38. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  39. package/dist/components/Modal/index.story.d.ts +16 -41
  40. package/dist/components/Modal/index.story.d.ts.map +1 -1
  41. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  42. package/dist/components/Radio/index.d.ts +0 -2
  43. package/dist/components/Radio/index.d.ts.map +1 -1
  44. package/dist/components/Radio/index.story.d.ts +12 -23
  45. package/dist/components/Radio/index.story.d.ts.map +1 -1
  46. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  47. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  48. package/dist/components/SegmentedControl/index.story.d.ts +5 -8
  49. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  50. package/dist/components/Switch/index.d.ts.map +1 -1
  51. package/dist/components/Switch/index.story.d.ts +7 -12
  52. package/dist/components/Switch/index.story.d.ts.map +1 -1
  53. package/dist/components/TagItem/index.d.ts.map +1 -1
  54. package/dist/components/TagItem/index.story.d.ts +14 -24
  55. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  56. package/dist/components/TextArea/TextArea.story.d.ts +7 -25
  57. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
  58. package/dist/components/TextField/TextField.story.d.ts +13 -20
  59. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  60. package/dist/components/TextField/index.d.ts.map +1 -1
  61. package/dist/index.cjs.js +418 -206
  62. package/dist/index.cjs.js.map +1 -1
  63. package/dist/index.esm.js +387 -175
  64. package/dist/index.esm.js.map +1 -1
  65. package/dist/styled.d.ts +4 -4
  66. package/package.json +17 -20
  67. package/src/_lib/compat.ts +8 -0
  68. package/src/components/Button/StyledButton.tsx +71 -0
  69. package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
  70. package/src/components/Button/index.story.tsx +141 -138
  71. package/src/components/Button/index.tsx +15 -104
  72. package/src/components/Button/lib/variantToBackground.tsx +19 -0
  73. package/src/components/Button/lib/variantToFont.tsx +19 -0
  74. package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
  75. package/src/components/Checkbox/index.story.tsx +82 -88
  76. package/src/components/Checkbox/index.tsx +2 -12
  77. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  78. package/src/components/Clickable/index.story.tsx +12 -9
  79. package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
  80. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
  81. package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
  82. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
  83. package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
  84. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
  85. package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
  86. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +313 -151
  87. package/src/components/DropdownSelector/index.story.tsx +207 -171
  88. package/src/components/DropdownSelector/index.tsx +22 -22
  89. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  90. package/src/components/Icon/index.story.tsx +8 -12
  91. package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
  92. package/src/components/IconButton/index.story.tsx +30 -23
  93. package/src/components/IconButton/index.tsx +32 -20
  94. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
  95. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
  96. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
  97. package/src/components/LoadingSpinner/index.story.tsx +11 -54
  98. package/src/components/LoadingSpinner/index.tsx +1 -1
  99. package/src/components/Modal/__snapshots__/index.story.storyshot +231 -194
  100. package/src/components/Modal/index.story.tsx +139 -133
  101. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
  102. package/src/components/MultiSelect/index.tsx +3 -0
  103. package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
  104. package/src/components/Radio/index.story.tsx +128 -63
  105. package/src/components/Radio/index.tsx +10 -16
  106. package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
  107. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +11 -11
  108. package/src/components/SegmentedControl/index.story.tsx +24 -29
  109. package/src/components/SegmentedControl/index.tsx +1 -1
  110. package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
  111. package/src/components/Switch/index.story.tsx +72 -48
  112. package/src/components/Switch/index.tsx +2 -7
  113. package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
  114. package/src/components/TagItem/index.story.tsx +154 -159
  115. package/src/components/TagItem/index.tsx +2 -6
  116. package/src/components/TextArea/TextArea.story.tsx +29 -32
  117. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +139 -83
  118. package/src/components/TextField/TextField.story.tsx +67 -66
  119. package/src/components/TextField/__snapshots__/TextField.story.storyshot +198 -162
  120. package/src/components/TextField/index.tsx +0 -7
  121. package/dist/components/Checkbox/performance.test.d.ts +0 -4
  122. package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
  123. package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
  124. package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
  125. package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
  126. package/src/components/Checkbox/performance.test.tsx +0 -30
  127. package/src/components/Checkbox/snapshot.test.tsx +0 -66
@@ -1,8 +1,7 @@
1
- import { action } from '@storybook/addon-actions'
2
1
  import { useRef } from 'react'
3
- import { Story } from '../../_lib/compat'
4
2
  import { ClickableElement } from '../Clickable'
5
3
  import Button, { ButtonProps } from '.'
4
+ import { Meta, StoryObj } from '@storybook/react'
6
5
 
7
6
  export default {
8
7
  title: 'Button',
@@ -21,167 +20,171 @@ export default {
21
20
  },
22
21
  },
23
22
  },
24
- }
25
-
26
- const DefaultStory = (args: ButtonProps) => (
27
- <Button {...args} onClick={action('click')}>
28
- Button
29
- </Button>
30
- )
23
+ render: (args) => <Button {...args}>Button</Button>,
24
+ } as Meta<typeof Button>
31
25
 
32
- export const Default: Story<ButtonProps> = DefaultStory.bind({})
26
+ export const Default: StoryObj<typeof Button> = {}
33
27
 
34
- export const Primary: Story<ButtonProps> = DefaultStory.bind({})
35
- Primary.args = {
36
- variant: 'Primary',
28
+ export const Primary: StoryObj<typeof Button> = {
29
+ args: {
30
+ variant: 'Primary',
31
+ },
37
32
  }
38
33
 
39
- export const Navigation: Story<ButtonProps> = DefaultStory.bind({})
40
- Navigation.args = {
41
- variant: 'Navigation',
34
+ export const Navigation: StoryObj<typeof Button> = {
35
+ args: {
36
+ variant: 'Navigation',
37
+ },
42
38
  }
43
39
 
44
- export const Overlay: Story<ButtonProps> = DefaultStory.bind({})
45
- Overlay.args = {
46
- variant: 'Overlay',
40
+ export const Overlay: StoryObj<typeof Button> = {
41
+ args: {
42
+ variant: 'Overlay',
43
+ },
47
44
  }
48
45
 
49
- export const Danger: Story<ButtonProps> = DefaultStory.bind({})
50
- Danger.args = {
51
- variant: 'Danger',
46
+ export const Danger: StoryObj<typeof Button> = {
47
+ args: {
48
+ variant: 'Danger',
49
+ },
52
50
  }
53
51
 
54
- export const Small: Story<ButtonProps> = DefaultStory.bind({})
55
- Small.args = {
56
- size: 'S',
52
+ export const Small: StoryObj<typeof Button> = {
53
+ args: {
54
+ size: 'S',
55
+ },
57
56
  }
58
57
 
59
- export const Fixed: Story<ButtonProps> = DefaultStory.bind({})
60
- Fixed.args = {
61
- fullWidth: true,
58
+ export const Fixed: StoryObj<typeof Button> = {
59
+ args: {
60
+ fullWidth: true,
61
+ },
62
62
  }
63
63
 
64
- export const Disabled: Story<ButtonProps> = DefaultStory.bind({})
65
- Disabled.args = {
66
- disabled: true,
64
+ export const Disabled: StoryObj<typeof Button> = {
65
+ args: {
66
+ disabled: true,
67
+ },
67
68
  }
68
69
 
69
- export const Link: Story<ButtonProps> = DefaultStory.bind({})
70
- Link.args = {
71
- to: '#',
70
+ export const Active: StoryObj<typeof Button> = {
71
+ args: {
72
+ isActive: true,
73
+ },
72
74
  }
73
75
 
74
- const NihongoStory = (args: ButtonProps) => (
75
- <Button {...args} onClick={action('click')}>
76
- 日本語だよ
77
- </Button>
78
- )
79
-
80
- export const Nihongo: Story<ButtonProps> = NihongoStory.bind({})
81
-
82
- const FocusStory = (args: ButtonProps) => <FocusStoryInternal {...args} />
83
- const FocusStoryInternal = (args: ButtonProps) => {
84
- const ref = useRef<ClickableElement>(null)
85
- const focus = () => ref.current?.focus()
86
- return (
87
- <Button {...args} onMouseOver={focus} ref={ref}>
88
- Mouse over to focus
89
- </Button>
90
- )
76
+ export const Link: StoryObj<typeof Button> = {
77
+ args: {
78
+ to: '#',
79
+ },
91
80
  }
92
81
 
93
- export const Focus: Story<ButtonProps> = FocusStory.bind({})
94
-
95
- const LayoutExampleStory = (args: ButtonProps) => (
96
- <div
97
- css={`
98
- display: grid;
99
- gap: 24px;
100
- `}
101
- >
102
- <div
103
- css={`
104
- display: grid;
105
- grid: auto / auto-flow min-content;
106
- gap: 8px;
107
- `}
108
- >
109
- <Button {...args}>Grid</Button>
110
- <Button {...args} variant="Navigation">
111
- Layout
112
- </Button>
113
- <Button {...args} variant="Danger">
114
- Sample
115
- </Button>
116
- </div>
117
- <div
118
- css={`
119
- display: grid;
120
- grid: auto-flow auto / 392px;
121
- gap: 8px;
122
- `}
123
- >
124
- <Button {...args} variant="Primary" fullWidth>
125
- Submit
126
- </Button>
127
- <Button {...args} variant="Default" fullWidth>
128
- Cancel
129
- </Button>
130
- </div>
131
- <div
132
- css={`
133
- display: flex;
82
+ export const Nihongo: StoryObj<typeof Button> = {
83
+ render: (args) => <Button {...args}>日本語だよ</Button>,
84
+ }
134
85
 
135
- & > * + * {
136
- margin-left: 8px;
137
- }
138
- `}
139
- >
140
- <Button {...args}>Flex</Button>
141
- <Button {...args} variant="Navigation">
142
- Layout
143
- </Button>
144
- <Button {...args} variant="Danger">
145
- Sample
86
+ export const Focus: StoryObj<typeof Button> = {
87
+ render: function Render(args) {
88
+ const ref = useRef<ClickableElement>(null)
89
+ const focus = () => ref.current?.focus()
90
+ return (
91
+ <Button {...args} onMouseOver={focus} ref={ref}>
92
+ Mouse over to focus
146
93
  </Button>
147
- </div>
148
- <div
149
- css={`
150
- display: flex;
151
- flex-direction: column;
152
- width: 392px;
94
+ )
95
+ },
96
+ }
153
97
 
154
- & > * + * {
155
- margin-top: 8px;
156
- }
157
- `}
158
- >
159
- <Button {...args} variant="Primary" fullWidth>
160
- Submit
161
- </Button>
162
- <Button {...args} variant="Default" fullWidth>
163
- Cancel
164
- </Button>
165
- </div>
98
+ export const LayoutExample: StoryObj<typeof Button> = {
99
+ render: (args: ButtonProps) => (
166
100
  <div
167
101
  css={`
168
- display: flex;
169
- flex-direction: column;
170
- width: 392px;
171
-
172
- & > * + * {
173
- margin-top: 8px;
174
- }
102
+ display: grid;
103
+ gap: 24px;
175
104
  `}
176
105
  >
177
- <Button {...args} variant="Primary" fullWidth>
178
- すべて見る
179
- </Button>
180
- <Button {...args} variant="Default">
181
- 作品を投稿
182
- </Button>
106
+ <div
107
+ css={`
108
+ display: grid;
109
+ grid: auto / auto-flow min-content;
110
+ gap: 8px;
111
+ `}
112
+ >
113
+ <Button {...args}>Grid</Button>
114
+ <Button {...args} variant="Navigation">
115
+ Layout
116
+ </Button>
117
+ <Button {...args} variant="Danger">
118
+ Sample
119
+ </Button>
120
+ </div>
121
+ <div
122
+ css={`
123
+ display: grid;
124
+ grid: auto-flow auto / 392px;
125
+ gap: 8px;
126
+ `}
127
+ >
128
+ <Button {...args} variant="Primary" fullWidth>
129
+ Submit
130
+ </Button>
131
+ <Button {...args} variant="Default" fullWidth>
132
+ Cancel
133
+ </Button>
134
+ </div>
135
+ <div
136
+ css={`
137
+ display: flex;
138
+
139
+ & > * + * {
140
+ margin-left: 8px;
141
+ }
142
+ `}
143
+ >
144
+ <Button {...args}>Flex</Button>
145
+ <Button {...args} variant="Navigation">
146
+ Layout
147
+ </Button>
148
+ <Button {...args} variant="Danger">
149
+ Sample
150
+ </Button>
151
+ </div>
152
+ <div
153
+ css={`
154
+ display: flex;
155
+ flex-direction: column;
156
+ width: 392px;
157
+
158
+ & > * + * {
159
+ margin-top: 8px;
160
+ }
161
+ `}
162
+ >
163
+ <Button {...args} variant="Primary" fullWidth>
164
+ Submit
165
+ </Button>
166
+ <Button {...args} variant="Default" fullWidth>
167
+ Cancel
168
+ </Button>
169
+ </div>
170
+ <div
171
+ css={`
172
+ display: flex;
173
+ flex-direction: column;
174
+ width: 392px;
175
+
176
+ & > * + * {
177
+ margin-top: 8px;
178
+ }
179
+ `}
180
+ >
181
+ <Button {...args} variant="Primary" fullWidth>
182
+ すべて見る
183
+ </Button>
184
+ <Button {...args} variant="Default">
185
+ 作品を投稿
186
+ </Button>
187
+ </div>
183
188
  </div>
184
- </div>
185
- )
186
-
187
- export const LayoutExample = LayoutExampleStory.bind({})
189
+ ),
190
+ }
@@ -1,21 +1,23 @@
1
1
  import { forwardRef } from 'react'
2
- import styled, { css } from 'styled-components'
3
- import { unreachable } from '../../_lib'
4
- import Clickable, { ClickableElement, ClickableProps } from '../Clickable'
2
+ import { ClickableElement, ClickableProps } from '../Clickable'
3
+ import { variantToFont } from './lib/variantToFont'
4
+ import { variantToBackground } from './lib/variantToBackground'
5
+ import { StyledButton } from './StyledButton'
5
6
 
6
- type Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'
7
- type Size = 'S' | 'M'
7
+ export type Variant =
8
+ | 'Primary'
9
+ | 'Default'
10
+ | 'Overlay'
11
+ | 'Danger'
12
+ | 'Navigation'
8
13
 
9
- interface StyledProps {
10
- $variant: Variant
11
- $fullWidth: boolean
12
- $size: Size
13
- }
14
+ export type Size = 'S' | 'M'
14
15
 
15
16
  export type ButtonProps = Partial<{
16
17
  variant: Variant
17
18
  size: Size
18
19
  fullWidth: boolean
20
+ isActive: boolean
19
21
  }> &
20
22
  ClickableProps
21
23
 
@@ -26,6 +28,7 @@ const Button = forwardRef<ClickableElement, ButtonProps>(function Button(
26
28
  size = 'M',
27
29
  fullWidth: fixed = false,
28
30
  disabled = false,
31
+ isActive = false,
29
32
  ...rest
30
33
  },
31
34
  ref
@@ -38,104 +41,12 @@ const Button = forwardRef<ClickableElement, ButtonProps>(function Button(
38
41
  $color={variantToFont(variant)}
39
42
  $size={size}
40
43
  $fullWidth={fixed}
44
+ $isActive={isActive}
41
45
  ref={ref}
42
46
  >
43
47
  {children}
44
48
  </StyledButton>
45
49
  )
46
50
  })
47
- export default Button
48
-
49
- const horizontalPaddingSmall = css`
50
- padding-right: 16px;
51
- padding-left: 16px;
52
- `
53
- const horizontalPaddingMedium = css`
54
- padding-right: 24px;
55
- padding-left: 24px;
56
- `
57
-
58
- type StyledButtonProps = Omit<StyledProps, '$variant'> & {
59
- $background: ReturnType<typeof variantToBackground>
60
- $color: ReturnType<typeof variantToFont>
61
- }
62
- const StyledButton = styled(Clickable)<StyledButtonProps>`
63
- width: ${(p) => (p.$fullWidth ? 'stretch' : 'min-content')};
64
- display: inline-grid;
65
- align-items: center;
66
- justify-content: center;
67
- cursor: pointer;
68
- user-select: none;
69
- white-space: nowrap;
70
- border-radius: 999999px;
71
- font-size: 14px;
72
- line-height: 22px;
73
- font-weight: bold;
74
-
75
- ${(p) => (p.$size === 'M' ? horizontalPaddingMedium : horizontalPaddingSmall)}
76
-
77
- color: var(--charcoal-${(p) => p.$color});
78
- background-color: var(--charcoal-${(p) => p.$background});
79
- transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
80
-
81
- &:not(:disabled):not([aria-disabled]),
82
- &[aria-disabled='false'] {
83
- &:active,
84
- &:focus,
85
- &:focus-visible {
86
- outline: none;
87
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
88
- }
89
51
 
90
- &:hover {
91
- color: var(--charcoal-${(p) => p.$color}-hover);
92
- background-color: var(--charcoal-${(p) => p.$background}-hover);
93
- }
94
- &:active {
95
- color: var(--charcoal-${(p) => p.$color}-press);
96
- background-color: var(--charcoal-${(p) => p.$background}-press);
97
- }
98
- }
99
-
100
- &:disabled,
101
- &[aria-disabled]:not([aria-disabled='false']) {
102
- opacity: 0.32;
103
- }
104
-
105
- /* よく考えたらheight=32って定義が存在しないな... */
106
- height: ${(p) => (p.$size === 'M' ? 40 : 32)}px;
107
- `
108
-
109
- function variantToBackground(variant: Variant) {
110
- switch (variant) {
111
- case 'Overlay':
112
- return 'surface4'
113
- case 'Default':
114
- return 'surface3'
115
- case 'Primary':
116
- return 'brand'
117
- case 'Navigation':
118
- return 'surface6'
119
- case 'Danger':
120
- return 'assertive'
121
- default:
122
- return unreachable(variant)
123
- }
124
- }
125
-
126
- function variantToFont(variant: Variant) {
127
- switch (variant) {
128
- case 'Overlay':
129
- return 'text5'
130
- case 'Default':
131
- return 'text2'
132
- case 'Primary':
133
- return 'text5'
134
- case 'Navigation':
135
- return 'text5'
136
- case 'Danger':
137
- return 'text5'
138
- default:
139
- return unreachable(variant)
140
- }
141
- }
52
+ export default Button
@@ -0,0 +1,19 @@
1
+ import { unreachable } from '../../../_lib'
2
+ import type { Variant } from '..'
3
+
4
+ export function variantToBackground(variant: Variant) {
5
+ switch (variant) {
6
+ case 'Overlay':
7
+ return 'surface4'
8
+ case 'Default':
9
+ return 'surface3'
10
+ case 'Primary':
11
+ return 'brand'
12
+ case 'Navigation':
13
+ return 'surface6'
14
+ case 'Danger':
15
+ return 'assertive'
16
+ default:
17
+ return unreachable(variant)
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ import { unreachable } from '../../../_lib'
2
+ import type { Variant } from '..'
3
+
4
+ export function variantToFont(variant: Variant) {
5
+ switch (variant) {
6
+ case 'Overlay':
7
+ return 'text5'
8
+ case 'Default':
9
+ return 'text2'
10
+ case 'Primary':
11
+ return 'text5'
12
+ case 'Navigation':
13
+ return 'text5'
14
+ case 'Danger':
15
+ return 'text5'
16
+ default:
17
+ return unreachable(variant)
18
+ }
19
+ }
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storyshots Checkbox Invalid 1`] = `
3
+ exports[`Storybook Tests Checkbox Invalid 1`] = `
4
4
  .c0 {
5
5
  position: relative;
6
6
  display: -webkit-box;
@@ -54,23 +54,18 @@ exports[`Storyshots Checkbox Invalid 1`] = `
54
54
  }
55
55
 
56
56
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus,
57
- .c2[type='checkbox'][aria-disabled='false']:focus,
58
- .c2[type='checkbox']:not(:disabled):not([aria-disabled]):active,
59
- .c2[type='checkbox'][aria-disabled='false']:active {
57
+ .c2[type='checkbox'][aria-disabled='false']:focus {
60
58
  outline: none;
61
59
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
62
60
  }
63
61
 
64
62
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
65
- .c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible),
66
- .c2[type='checkbox']:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
67
- .c2[type='checkbox'][aria-disabled='false']:active:not(:focus-visible) {
68
- outline: none;
63
+ .c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible) {
64
+ box-shadow: none;
69
65
  }
70
66
 
71
67
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus-visible,
72
68
  .c2[type='checkbox'][aria-disabled='false']:focus-visible {
73
- outline: none;
74
69
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
75
70
  }
76
71
 
@@ -167,7 +162,7 @@ exports[`Storyshots Checkbox Invalid 1`] = `
167
162
  </div>
168
163
  `;
169
164
 
170
- exports[`Storyshots Checkbox Labelled 1`] = `
165
+ exports[`Storybook Tests Checkbox Labelled 1`] = `
171
166
  .c0 {
172
167
  position: relative;
173
168
  display: -webkit-box;
@@ -221,23 +216,18 @@ exports[`Storyshots Checkbox Labelled 1`] = `
221
216
  }
222
217
 
223
218
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus,
224
- .c2[type='checkbox'][aria-disabled='false']:focus,
225
- .c2[type='checkbox']:not(:disabled):not([aria-disabled]):active,
226
- .c2[type='checkbox'][aria-disabled='false']:active {
219
+ .c2[type='checkbox'][aria-disabled='false']:focus {
227
220
  outline: none;
228
221
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
229
222
  }
230
223
 
231
224
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
232
- .c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible),
233
- .c2[type='checkbox']:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
234
- .c2[type='checkbox'][aria-disabled='false']:active:not(:focus-visible) {
235
- outline: none;
225
+ .c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible) {
226
+ box-shadow: none;
236
227
  }
237
228
 
238
229
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus-visible,
239
230
  .c2[type='checkbox'][aria-disabled='false']:focus-visible {
240
- outline: none;
241
231
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
242
232
  }
243
233
 
@@ -400,7 +390,7 @@ exports[`Storyshots Checkbox Labelled 1`] = `
400
390
  </div>
401
391
  `;
402
392
 
403
- exports[`Storyshots Checkbox Unlabelled 1`] = `
393
+ exports[`Storybook Tests Checkbox Unlabelled 1`] = `
404
394
  .c0 {
405
395
  position: relative;
406
396
  display: -webkit-box;
@@ -454,23 +444,18 @@ exports[`Storyshots Checkbox Unlabelled 1`] = `
454
444
  }
455
445
 
456
446
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus,
457
- .c2[type='checkbox'][aria-disabled='false']:focus,
458
- .c2[type='checkbox']:not(:disabled):not([aria-disabled]):active,
459
- .c2[type='checkbox'][aria-disabled='false']:active {
447
+ .c2[type='checkbox'][aria-disabled='false']:focus {
460
448
  outline: none;
461
449
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
462
450
  }
463
451
 
464
452
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
465
- .c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible),
466
- .c2[type='checkbox']:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
467
- .c2[type='checkbox'][aria-disabled='false']:active:not(:focus-visible) {
468
- outline: none;
453
+ .c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible) {
454
+ box-shadow: none;
469
455
  }
470
456
 
471
457
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus-visible,
472
458
  .c2[type='checkbox'][aria-disabled='false']:focus-visible {
473
- outline: none;
474
459
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
475
460
  }
476
461