@charcoal-ui/react 3.7.0 → 3.9.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 (107) hide show
  1. package/dist/components/Button/StyledButton.d.ts +1 -0
  2. package/dist/components/Button/StyledButton.d.ts.map +1 -1
  3. package/dist/components/Button/index.d.ts +1 -0
  4. package/dist/components/Button/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.story.d.ts +16 -32
  6. package/dist/components/Button/index.story.d.ts.map +1 -1
  7. package/dist/components/Checkbox/index.d.ts.map +1 -1
  8. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
  9. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
  10. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
  11. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
  12. package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
  13. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
  14. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  15. package/dist/components/DropdownSelector/index.story.d.ts +9 -12
  16. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  17. package/dist/components/Icon/index.story.d.ts +4 -26
  18. package/dist/components/Icon/index.story.d.ts.map +1 -1
  19. package/dist/components/IconButton/index.d.ts +1 -0
  20. package/dist/components/IconButton/index.d.ts.map +1 -1
  21. package/dist/components/IconButton/index.story.d.ts +6 -25
  22. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  23. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
  24. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
  25. package/dist/components/LoadingSpinner/index.d.ts +2 -2
  26. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  27. package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
  28. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  29. package/dist/components/Modal/index.d.ts.map +1 -1
  30. package/dist/components/Modal/index.story.d.ts +16 -41
  31. package/dist/components/Modal/index.story.d.ts.map +1 -1
  32. package/dist/components/Modal/useCustomModalOverlay.d.ts +12 -0
  33. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -0
  34. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  35. package/dist/components/Radio/index.d.ts +0 -2
  36. package/dist/components/Radio/index.d.ts.map +1 -1
  37. package/dist/components/Radio/index.story.d.ts +12 -23
  38. package/dist/components/Radio/index.story.d.ts.map +1 -1
  39. package/dist/components/SegmentedControl/index.story.d.ts +5 -8
  40. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  41. package/dist/components/Switch/index.d.ts.map +1 -1
  42. package/dist/components/Switch/index.story.d.ts +7 -12
  43. package/dist/components/Switch/index.story.d.ts.map +1 -1
  44. package/dist/components/TagItem/index.d.ts.map +1 -1
  45. package/dist/components/TagItem/index.story.d.ts +14 -24
  46. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  47. package/dist/components/TextArea/TextArea.story.d.ts +7 -25
  48. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
  49. package/dist/components/TextArea/index.d.ts.map +1 -1
  50. package/dist/components/TextField/TextField.story.d.ts +14 -20
  51. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  52. package/dist/components/TextField/index.d.ts.map +1 -1
  53. package/dist/index.cjs.js +1006 -2240
  54. package/dist/index.cjs.js.map +1 -1
  55. package/dist/index.esm.js +1001 -2241
  56. package/dist/index.esm.js.map +1 -1
  57. package/dist/styled.d.ts +4 -4
  58. package/package.json +7 -6
  59. package/src/components/Button/StyledButton.tsx +19 -14
  60. package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
  61. package/src/components/Button/index.story.tsx +141 -138
  62. package/src/components/Button/index.tsx +3 -0
  63. package/src/components/Checkbox/__snapshots__/index.story.storyshot +55 -42
  64. package/src/components/Checkbox/index.tsx +15 -17
  65. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  66. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
  67. package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
  68. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
  69. package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
  70. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
  71. package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
  72. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +148 -47
  73. package/src/components/DropdownSelector/index.story.tsx +207 -204
  74. package/src/components/DropdownSelector/index.tsx +17 -10
  75. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  76. package/src/components/Icon/index.story.tsx +8 -12
  77. package/src/components/IconButton/__snapshots__/index.story.storyshot +135 -13
  78. package/src/components/IconButton/index.story.tsx +30 -23
  79. package/src/components/IconButton/index.tsx +35 -20
  80. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
  81. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
  82. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
  83. package/src/components/LoadingSpinner/index.story.tsx +11 -54
  84. package/src/components/LoadingSpinner/index.tsx +1 -1
  85. package/src/components/Modal/__snapshots__/index.story.storyshot +224 -171
  86. package/src/components/Modal/index.story.tsx +139 -133
  87. package/src/components/Modal/index.tsx +15 -20
  88. package/src/components/Modal/useCustomModalOverlay.tsx +42 -0
  89. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
  90. package/src/components/MultiSelect/index.tsx +3 -0
  91. package/src/components/Radio/__snapshots__/index.story.storyshot +1001 -121
  92. package/src/components/Radio/index.story.tsx +128 -63
  93. package/src/components/Radio/index.tsx +15 -17
  94. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
  95. package/src/components/SegmentedControl/index.story.tsx +24 -29
  96. package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
  97. package/src/components/Switch/index.story.tsx +72 -48
  98. package/src/components/Switch/index.tsx +2 -7
  99. package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
  100. package/src/components/TagItem/index.story.tsx +154 -159
  101. package/src/components/TagItem/index.tsx +2 -6
  102. package/src/components/TextArea/TextArea.story.tsx +29 -32
  103. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +127 -73
  104. package/src/components/TextArea/index.tsx +22 -14
  105. package/src/components/TextField/TextField.story.tsx +85 -64
  106. package/src/components/TextField/__snapshots__/TextField.story.storyshot +479 -167
  107. package/src/components/TextField/index.tsx +22 -21
@@ -1,4 +1,3 @@
1
- import { Story } from '../../_lib/compat'
2
1
  import Modal, { ModalDismissButton, ModalProps } from '.'
3
2
  import { OverlayProvider } from '@react-aria/overlays'
4
3
  import { useOverlayTriggerState } from 'react-stately'
@@ -14,6 +13,7 @@ import { theme } from '../../styled'
14
13
  import TextField from '../TextField'
15
14
  import DropdownSelector from '../DropdownSelector'
16
15
  import DropdownMenuItem from '../DropdownSelector/DropdownMenuItem'
16
+ import { Meta, StoryObj } from '@storybook/react'
17
17
 
18
18
  export default {
19
19
  title: 'Modal',
@@ -27,6 +27,7 @@ export default {
27
27
  control: {
28
28
  type: 'inline-radio',
29
29
  },
30
+ defaultValue: 'M',
30
31
  },
31
32
  bottomSheet: {
32
33
  options: ['full', 'true', 'false'],
@@ -34,26 +35,26 @@ export default {
34
35
  control: {
35
36
  type: 'inline-radio',
36
37
  },
38
+ defaultValue: false,
37
39
  },
38
40
  },
39
- }
40
-
41
- const DefaultStory = (args: ModalProps) => {
42
- const state = useOverlayTriggerState({})
43
- return (
44
- // Application must be wrapped in an OverlayProvider so that it can be
45
- // hidden from screen readers when a modal opens.
46
- <OverlayProvider>
47
- <Button onClick={() => state.open()}>Open Modal</Button>
48
- <M
49
- {...args}
50
- isDismissable
51
- isOpen={state.isOpen}
52
- onClose={() => state.close()}
53
- />
54
- </OverlayProvider>
55
- )
56
- }
41
+ render: function Render(args) {
42
+ const state = useOverlayTriggerState({})
43
+ return (
44
+ // Application must be wrapped in an OverlayProvider so that it can be
45
+ // hidden from screen readers when a modal opens.
46
+ <OverlayProvider>
47
+ <Button onClick={() => state.open()}>Open Modal</Button>
48
+ <M
49
+ {...args}
50
+ isDismissable
51
+ isOpen={state.isOpen}
52
+ onClose={() => state.close()}
53
+ />
54
+ </OverlayProvider>
55
+ )
56
+ },
57
+ } as Meta<typeof Modal>
57
58
 
58
59
  const M = (props: ModalProps) => {
59
60
  return (
@@ -114,127 +115,132 @@ const StyledModalText = styled(ModalAlign)`
114
115
  ${theme((o) => [o.font.text2, o.typography(14)])}
115
116
  `
116
117
 
117
- export const Default: Story<ModalProps> = DefaultStory.bind({})
118
+ export const Default: StoryObj<typeof Modal> = {}
118
119
 
119
- const FullBottomSheetStory = (args: ModalProps) => {
120
- const state = useOverlayTriggerState({})
121
- return (
122
- // Application must be wrapped in an OverlayProvider so that it can be
123
- // hidden from screen readers when a modal opens.
124
- <OverlayProvider>
125
- <Button onClick={() => state.open()}>Open Modal</Button>
120
+ export const FullBottomSheet: StoryObj<typeof Modal> = {
121
+ args: {
122
+ bottomSheet: 'full',
123
+ },
124
+ render: function Render(args) {
125
+ const state = useOverlayTriggerState({})
126
+ return (
127
+ // Application must be wrapped in an OverlayProvider so that it can be
128
+ // hidden from screen readers when a modal opens.
129
+ <OverlayProvider>
130
+ <Button onClick={() => state.open()}>Open Modal</Button>
126
131
 
127
- <Modal
128
- {...args}
129
- isDismissable
130
- bottomSheet="full"
131
- isOpen={state.isOpen}
132
- onClose={() => state.close()}
133
- >
134
- <ModalHeader />
135
- <ModalBody>
136
- <ModalVStack>
137
- <StyledModalText>
138
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
139
- placeat tenetur, necessitatibus laudantium cumque exercitationem
140
- provident. Quaerat iure enim, eveniet dolores earum odio quo
141
- possimus fugiat aspernatur, numquam, commodi repellat.
142
- </StyledModalText>
143
- <ModalAlign>
144
- <TextField
145
- showLabel
146
- label="Name"
147
- placeholder="Nagisa"
148
- ></TextField>
149
- </ModalAlign>
150
- <ModalAlign>
151
- <TextField
152
- showLabel
153
- label="Country"
154
- placeholder="Tokyo"
155
- ></TextField>
156
- </ModalAlign>
157
- </ModalVStack>
158
- <ModalButtons>
159
- <Button variant="Primary" onClick={() => state.close()} fullWidth>
160
- Apply
161
- </Button>
162
- <Button onClick={() => state.close()} fullWidth>
163
- Cancel
164
- </Button>
165
- </ModalButtons>
166
- </ModalBody>
167
- </Modal>
168
- </OverlayProvider>
169
- )
132
+ <Modal
133
+ {...args}
134
+ isDismissable
135
+ isOpen={state.isOpen}
136
+ onClose={() => state.close()}
137
+ >
138
+ <ModalHeader />
139
+ <ModalBody>
140
+ <ModalVStack>
141
+ <StyledModalText>
142
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
143
+ placeat tenetur, necessitatibus laudantium cumque exercitationem
144
+ provident. Quaerat iure enim, eveniet dolores earum odio quo
145
+ possimus fugiat aspernatur, numquam, commodi repellat.
146
+ </StyledModalText>
147
+ <ModalAlign>
148
+ <TextField
149
+ showLabel
150
+ label="Name"
151
+ placeholder="Nagisa"
152
+ ></TextField>
153
+ </ModalAlign>
154
+ <ModalAlign>
155
+ <TextField
156
+ showLabel
157
+ label="Country"
158
+ placeholder="Tokyo"
159
+ ></TextField>
160
+ </ModalAlign>
161
+ </ModalVStack>
162
+ <ModalButtons>
163
+ <Button variant="Primary" onClick={() => state.close()} fullWidth>
164
+ Apply
165
+ </Button>
166
+ <Button onClick={() => state.close()} fullWidth>
167
+ Cancel
168
+ </Button>
169
+ </ModalButtons>
170
+ </ModalBody>
171
+ </Modal>
172
+ </OverlayProvider>
173
+ )
174
+ },
170
175
  }
171
176
 
172
- export const FullBottomSheet: Story<ModalProps> = FullBottomSheetStory.bind({})
173
-
174
- const BottomSheetStory = (args: ModalProps) => {
175
- const state = useOverlayTriggerState({})
176
- return (
177
- // Application must be wrapped in an OverlayProvider so that it can be
178
- // hidden from screen readers when a modal opens.
179
- <OverlayProvider>
180
- <Button onClick={() => state.open()}>Open Modal</Button>
177
+ export const BottomSheet: StoryObj<typeof Modal> = {
178
+ render: function Render(args) {
179
+ const state = useOverlayTriggerState({})
180
+ return (
181
+ // Application must be wrapped in an OverlayProvider so that it can be
182
+ // hidden from screen readers when a modal opens.
183
+ <OverlayProvider>
184
+ <Button onClick={() => state.open()}>Open Modal</Button>
181
185
 
182
- <Modal
183
- {...args}
184
- isOpen={state.isOpen}
185
- onClose={() => state.close()}
186
- bottomSheet
187
- isDismissable
188
- >
189
- <ModalHeader />
190
- <ModalBody>
191
- <ModalVStack>
192
- <StyledModalText>
193
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
194
- placeat tenetur, necessitatibus laudantium cumque exercitationem
195
- provident. Quaerat iure enim, eveniet dolores earum odio quo
196
- possimus fugiat aspernatur, numquam, commodi repellat.
197
- </StyledModalText>
198
- </ModalVStack>
199
- <ModalButtons>
200
- <Button variant="Danger" onClick={() => state.close()} fullWidth>
201
- 削除する
202
- </Button>
203
- <ModalDismissButton>キャンセル</ModalDismissButton>
204
- </ModalButtons>
205
- </ModalBody>
206
- </Modal>
207
- </OverlayProvider>
208
- )
186
+ <Modal
187
+ {...args}
188
+ isOpen={state.isOpen}
189
+ onClose={() => state.close()}
190
+ bottomSheet
191
+ isDismissable
192
+ >
193
+ <ModalHeader />
194
+ <ModalBody>
195
+ <ModalVStack>
196
+ <StyledModalText>
197
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
198
+ placeat tenetur, necessitatibus laudantium cumque exercitationem
199
+ provident. Quaerat iure enim, eveniet dolores earum odio quo
200
+ possimus fugiat aspernatur, numquam, commodi repellat.
201
+ </StyledModalText>
202
+ </ModalVStack>
203
+ <ModalButtons>
204
+ <Button variant="Danger" onClick={() => state.close()} fullWidth>
205
+ 削除する
206
+ </Button>
207
+ <ModalDismissButton>キャンセル</ModalDismissButton>
208
+ </ModalButtons>
209
+ </ModalBody>
210
+ </Modal>
211
+ </OverlayProvider>
212
+ )
213
+ },
209
214
  }
210
215
 
211
- export const BottomSheet: Story<ModalProps> = BottomSheetStory.bind({})
216
+ export const NotDismmissableStory: StoryObj<typeof Modal> = {
217
+ render: function Render(args) {
218
+ const state = useOverlayTriggerState({})
219
+ return (
220
+ <OverlayProvider>
221
+ <Button onClick={() => state.open()}>Open Modal</Button>
212
222
 
213
- export const NotDismmissableStory: Story<ModalProps> = (args: ModalProps) => {
214
- const state = useOverlayTriggerState({})
215
- return (
216
- <OverlayProvider>
217
- <Button onClick={() => state.open()}>Open Modal</Button>
218
-
219
- <Modal {...args} isOpen={state.isOpen} onClose={() => state.close()}>
220
- <ModalHeader />
221
- <ModalBody>
222
- <ModalVStack>
223
- <StyledModalText>
224
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
225
- placeat tenetur, necessitatibus laudantium cumque exercitationem
226
- provident. Quaerat iure enim, eveniet dolores earum odio quo
227
- possimus fugiat aspernatur, numquam, commodi repellat.
228
- </StyledModalText>
229
- </ModalVStack>
230
- <ModalButtons>
231
- <Button variant="Primary" onClick={() => state.close()} fullWidth>
232
- OK
233
- </Button>
234
- </ModalButtons>
235
- </ModalBody>
236
- </Modal>
237
- </OverlayProvider>
238
- )
223
+ <Modal {...args} isOpen={state.isOpen} onClose={() => state.close()}>
224
+ <ModalHeader />
225
+ <ModalBody>
226
+ <ModalVStack>
227
+ <StyledModalText>
228
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
229
+ placeat tenetur, necessitatibus laudantium cumque exercitationem
230
+ provident. Quaerat iure enim, eveniet dolores earum odio quo
231
+ possimus fugiat aspernatur, numquam, commodi repellat.
232
+ </StyledModalText>
233
+ </ModalVStack>
234
+ <ModalButtons>
235
+ <Button variant="Primary" onClick={() => state.close()} fullWidth>
236
+ OK
237
+ </Button>
238
+ </ModalButtons>
239
+ </ModalBody>
240
+ </Modal>
241
+ </OverlayProvider>
242
+ )
243
+ },
239
244
  }
245
+
240
246
  export { InternalScrollStory as InternalScroll } from './__stories__/InternalScrollStory'
@@ -1,10 +1,6 @@
1
1
  import { useContext, forwardRef, memo } from 'react'
2
2
  import * as React from 'react'
3
- import {
4
- AriaModalOverlayProps,
5
- Overlay,
6
- useModalOverlay,
7
- } from '@react-aria/overlays'
3
+ import { AriaModalOverlayProps, Overlay } from '@react-aria/overlays'
8
4
  import styled, { css, useTheme } from 'styled-components'
9
5
  import { AriaDialogProps } from '@react-types/dialog'
10
6
  import { maxWidth } from '@charcoal-ui/utils'
@@ -15,6 +11,7 @@ import IconButton from '../IconButton'
15
11
  import { useObjectRef } from '@react-aria/utils'
16
12
  import { Dialog } from './Dialog'
17
13
  import { ModalBackgroundContext } from './ModalBackgroundContext'
14
+ import { useCharcoalModalOverlay } from './useCustomModalOverlay'
18
15
 
19
16
  export type BottomSheet = boolean | 'full'
20
17
  export type Size = 'S' | 'M' | 'L'
@@ -81,27 +78,15 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(function ModalInner(
81
78
 
82
79
  const ref = useObjectRef<HTMLDivElement>(external)
83
80
 
84
- const { modalProps, underlayProps } = useModalOverlay(
81
+ const { modalProps, underlayProps } = useCharcoalModalOverlay(
85
82
  {
86
83
  ...props,
87
84
  isKeyboardDismissDisabled:
88
85
  isDismissable === undefined || isDismissable === false,
89
86
  },
90
-
91
87
  {
92
- close: onClose,
93
- isOpen: isOpen,
94
- // these props are not used actually.
95
- // https://github.com/adobe/react-spectrum/blob/df14e3fb129b94b310f0397a701b83f006b51dfe/packages/%40react-aria/overlays/src/useModalOverlay.ts
96
- open: () => {
97
- // nope
98
- },
99
- setOpen: () => {
100
- // nope
101
- },
102
- toggle: () => {
103
- // nope
104
- },
88
+ onClose,
89
+ isOpen,
105
90
  },
106
91
  ref
107
92
  )
@@ -136,6 +121,15 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(function ModalInner(
136
121
 
137
122
  const bgRef = React.useRef<HTMLElement>(null)
138
123
 
124
+ const handleClick = React.useCallback(
125
+ (e: MouseEvent) => {
126
+ if (e.currentTarget === e.target) {
127
+ onClose()
128
+ }
129
+ },
130
+ [onClose]
131
+ )
132
+
139
133
  return transition(
140
134
  ({ backgroundColor, overflow, transform }, item) =>
141
135
  item && (
@@ -146,6 +140,7 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(function ModalInner(
146
140
  {...underlayProps}
147
141
  style={transitionEnabled ? { backgroundColor, overflow } : {}}
148
142
  $bottomSheet={bottomSheet}
143
+ onClick={handleClick}
149
144
  >
150
145
  <ModalBackgroundContext.Provider value={bgRef.current}>
151
146
  <Dialog
@@ -0,0 +1,42 @@
1
+ import * as React from 'react'
2
+ import {
3
+ AriaModalOverlayProps,
4
+ ModalOverlayAria,
5
+ ariaHideOutside,
6
+ useOverlay,
7
+ useOverlayFocusContain,
8
+ } from '@react-aria/overlays'
9
+
10
+ /**
11
+ * We want to enable scrolling on the modal background,
12
+ * but `useModalOverlay` (specifically, `useOverlay` within it) detects pointer events on the scrollbar.
13
+ * Therefore, to prevent this issue, we need to override `shouldCloseOnInteractOutside` in `useModalOverlay`.
14
+ */
15
+ export function useCharcoalModalOverlay(
16
+ props: AriaModalOverlayProps,
17
+ state: { isOpen: boolean; onClose: () => void },
18
+ ref: React.RefObject<HTMLElement>
19
+ ): ModalOverlayAria {
20
+ const { overlayProps, underlayProps } = useOverlay(
21
+ {
22
+ ...props,
23
+ isOpen: state.isOpen,
24
+ onClose: state.onClose,
25
+ shouldCloseOnInteractOutside: () => false,
26
+ },
27
+ ref
28
+ )
29
+
30
+ useOverlayFocusContain()
31
+
32
+ React.useEffect(() => {
33
+ if (state.isOpen && ref.current) {
34
+ return ariaHideOutside([ref.current])
35
+ }
36
+ }, [state.isOpen, ref])
37
+
38
+ return {
39
+ modalProps: overlayProps,
40
+ underlayProps,
41
+ }
42
+ }
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storyshots MultiSelect Default 1`] = `
3
+ exports[`Storybook Tests MultiSelect Default 1`] = `
4
4
  .c1 {
5
5
  display: grid;
6
6
  grid-template-columns: auto 1fr;
@@ -88,6 +88,19 @@ exports[`Storyshots MultiSelect Default 1`] = `
88
88
  background-color: var(--charcoal-text3-press);
89
89
  }
90
90
 
91
+ .c2[type='checkbox']:focus {
92
+ outline: none;
93
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
94
+ }
95
+
96
+ .c2[type='checkbox']:focus:not(:focus-visible) {
97
+ box-shadow: none;
98
+ }
99
+
100
+ .c2[type='checkbox']:focus-visible {
101
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
102
+ }
103
+
91
104
  .c3 {
92
105
  position: absolute;
93
106
  top: -2px;
@@ -251,7 +264,7 @@ exports[`Storyshots MultiSelect Default 1`] = `
251
264
  </div>
252
265
  `;
253
266
 
254
- exports[`Storyshots MultiSelect Invalid 1`] = `
267
+ exports[`Storybook Tests MultiSelect Invalid 1`] = `
255
268
  .c1 {
256
269
  display: grid;
257
270
  grid-template-columns: auto 1fr;
@@ -339,6 +352,19 @@ exports[`Storyshots MultiSelect Invalid 1`] = `
339
352
  background-color: var(--charcoal-text3-press);
340
353
  }
341
354
 
355
+ .c2[type='checkbox']:focus {
356
+ outline: none;
357
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
358
+ }
359
+
360
+ .c2[type='checkbox']:focus:not(:focus-visible) {
361
+ box-shadow: none;
362
+ }
363
+
364
+ .c2[type='checkbox']:focus-visible {
365
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
366
+ }
367
+
342
368
  .c2[type='checkbox']:not(:disabled):not([aria-disabled]),
343
369
  .c2[type='checkbox'][aria-disabled='false'] {
344
370
  box-shadow: 0 0 0 4px rgba(255,43,0,0.32);
@@ -507,7 +533,7 @@ exports[`Storyshots MultiSelect Invalid 1`] = `
507
533
  </div>
508
534
  `;
509
535
 
510
- exports[`Storyshots MultiSelect Overlay 1`] = `
536
+ exports[`Storybook Tests MultiSelect Overlay 1`] = `
511
537
  .c1 {
512
538
  display: grid;
513
539
  grid-template-columns: auto 1fr;
@@ -596,6 +622,19 @@ exports[`Storyshots MultiSelect Overlay 1`] = `
596
622
  background-color: var(--charcoal-text3-press);
597
623
  }
598
624
 
625
+ .c2[type='checkbox']:focus {
626
+ outline: none;
627
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
628
+ }
629
+
630
+ .c2[type='checkbox']:focus:not(:focus-visible) {
631
+ box-shadow: none;
632
+ }
633
+
634
+ .c2[type='checkbox']:focus-visible {
635
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
636
+ }
637
+
599
638
  .c3 {
600
639
  position: absolute;
601
640
  top: -2px;
@@ -762,7 +801,7 @@ exports[`Storyshots MultiSelect Overlay 1`] = `
762
801
  </div>
763
802
  `;
764
803
 
765
- exports[`Storyshots MultiSelect Playground 1`] = `
804
+ exports[`Storybook Tests MultiSelect Playground 1`] = `
766
805
  .c1 {
767
806
  display: grid;
768
807
  grid-template-columns: auto 1fr;
@@ -850,6 +889,19 @@ exports[`Storyshots MultiSelect Playground 1`] = `
850
889
  background-color: var(--charcoal-text3-press);
851
890
  }
852
891
 
892
+ .c2[type='checkbox']:focus {
893
+ outline: none;
894
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
895
+ }
896
+
897
+ .c2[type='checkbox']:focus:not(:focus-visible) {
898
+ box-shadow: none;
899
+ }
900
+
901
+ .c2[type='checkbox']:focus-visible {
902
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
903
+ }
904
+
853
905
  .c3 {
854
906
  position: absolute;
855
907
  top: -2px;
@@ -5,6 +5,7 @@ import warning from 'warning'
5
5
  import { px } from '@charcoal-ui/utils'
6
6
 
7
7
  import { MultiSelectGroupContext } from './context'
8
+ import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
8
9
 
9
10
  export type MultiSelectProps = React.PropsWithChildren<{
10
11
  value: string
@@ -168,6 +169,8 @@ const MultiSelectInput = styled.input.attrs({ type: 'checkbox' })<{
168
169
  }
169
170
  }
170
171
 
172
+ ${focusVisibleFocusRingCss}
173
+
171
174
  ${({ invalid, overlay }) =>
172
175
  invalid &&
173
176
  !overlay &&