@charcoal-ui/react 3.8.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 (28) hide show
  1. package/dist/components/Checkbox/index.d.ts.map +1 -1
  2. package/dist/components/Modal/index.d.ts.map +1 -1
  3. package/dist/components/Modal/useCustomModalOverlay.d.ts +12 -0
  4. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -0
  5. package/dist/components/Radio/index.d.ts.map +1 -1
  6. package/dist/components/TextArea/index.d.ts.map +1 -1
  7. package/dist/components/TextField/TextField.story.d.ts +1 -0
  8. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  9. package/dist/components/TextField/index.d.ts.map +1 -1
  10. package/dist/index.cjs.js +996 -2224
  11. package/dist/index.cjs.js.map +1 -1
  12. package/dist/index.esm.js +990 -2224
  13. package/dist/index.esm.js.map +1 -1
  14. package/package.json +7 -6
  15. package/src/components/Checkbox/__snapshots__/index.story.storyshot +43 -15
  16. package/src/components/Checkbox/index.tsx +13 -5
  17. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +3 -0
  18. package/src/components/IconButton/__snapshots__/index.story.storyshot +5 -0
  19. package/src/components/IconButton/index.tsx +4 -1
  20. package/src/components/Modal/__snapshots__/index.story.storyshot +12 -0
  21. package/src/components/Modal/index.tsx +15 -20
  22. package/src/components/Modal/useCustomModalOverlay.tsx +42 -0
  23. package/src/components/Radio/__snapshots__/index.story.storyshot +25 -5
  24. package/src/components/Radio/index.tsx +5 -1
  25. package/src/components/TextArea/index.tsx +22 -14
  26. package/src/components/TextField/TextField.story.tsx +20 -0
  27. package/src/components/TextField/__snapshots__/TextField.story.storyshot +277 -0
  28. package/src/components/TextField/index.tsx +22 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -18,6 +18,7 @@
18
18
  "clean": "rimraf dist .tsbuildinfo"
19
19
  },
20
20
  "devDependencies": {
21
+ "@charcoal-ui/esbuild-plugin-styled-components": "^3.9.0",
21
22
  "@react-types/switch": "^3.1.2",
22
23
  "@storybook/addon-actions": "^7.4.1",
23
24
  "@storybook/addon-knobs": "^7.0.2",
@@ -51,10 +52,10 @@
51
52
  "typescript": "^4.9.5"
52
53
  },
53
54
  "dependencies": {
54
- "@charcoal-ui/icons": "^3.8.0",
55
- "@charcoal-ui/styled": "^3.8.0",
56
- "@charcoal-ui/theme": "^3.8.0",
57
- "@charcoal-ui/utils": "^3.8.0",
55
+ "@charcoal-ui/icons": "^3.9.0",
56
+ "@charcoal-ui/styled": "^3.9.0",
57
+ "@charcoal-ui/theme": "^3.9.0",
58
+ "@charcoal-ui/utils": "^3.9.0",
58
59
  "@react-aria/button": "^3.9.1",
59
60
  "@react-aria/checkbox": "^3.13.0",
60
61
  "@react-aria/dialog": "^3.5.10",
@@ -87,5 +88,5 @@
87
88
  "url": "https://github.com/pixiv/charcoal.git",
88
89
  "directory": "packages/react"
89
90
  },
90
- "gitHead": "939ab20e11455ff9cba840c38c7dfd33cd739b59"
91
+ "gitHead": "fe760d136886d2227013d73067544c5a42ff075b"
91
92
  }
@@ -11,13 +11,9 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
11
11
  gap: 4px;
12
12
  }
13
13
 
14
- .c0:disabled,
15
- .c0[aria-disabled]:not([aria-disabled=false]) {
16
- cursor: default;
17
- }
18
-
19
14
  .c0:disabled,
20
15
  .c0[aria-disabled]:not([aria-disabled='false']) {
16
+ cursor: default;
21
17
  opacity: 0.32;
22
18
  }
23
19
 
@@ -39,6 +35,18 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
39
35
  transition: 0.2s box-shadow,0.2s background-color;
40
36
  }
41
37
 
38
+ .c2[type='checkbox']:disabled {
39
+ cursor: default;
40
+ }
41
+
42
+ .c2[type='checkbox']:-moz-read-only {
43
+ cursor: default;
44
+ }
45
+
46
+ .c2[type='checkbox']:read-only {
47
+ cursor: default;
48
+ }
49
+
42
50
  .c2[type='checkbox']:checked {
43
51
  background-color: var(--charcoal-brand);
44
52
  }
@@ -140,6 +148,7 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
140
148
  onTouchEnd={[Function]}
141
149
  onTouchMove={[Function]}
142
150
  onTouchStart={[Function]}
151
+ readOnly={false}
143
152
  type="checkbox"
144
153
  />
145
154
  <div
@@ -173,13 +182,9 @@ exports[`Storybook Tests Checkbox Labelled 1`] = `
173
182
  gap: 4px;
174
183
  }
175
184
 
176
- .c0:disabled,
177
- .c0[aria-disabled]:not([aria-disabled=false]) {
178
- cursor: default;
179
- }
180
-
181
185
  .c0:disabled,
182
186
  .c0[aria-disabled]:not([aria-disabled='false']) {
187
+ cursor: default;
183
188
  opacity: 0.32;
184
189
  }
185
190
 
@@ -201,6 +206,18 @@ exports[`Storybook Tests Checkbox Labelled 1`] = `
201
206
  transition: 0.2s box-shadow,0.2s background-color;
202
207
  }
203
208
 
209
+ .c2[type='checkbox']:disabled {
210
+ cursor: default;
211
+ }
212
+
213
+ .c2[type='checkbox']:-moz-read-only {
214
+ cursor: default;
215
+ }
216
+
217
+ .c2[type='checkbox']:read-only {
218
+ cursor: default;
219
+ }
220
+
204
221
  .c2[type='checkbox']:checked {
205
222
  background-color: var(--charcoal-brand);
206
223
  }
@@ -309,6 +326,7 @@ exports[`Storybook Tests Checkbox Labelled 1`] = `
309
326
  onTouchEnd={[Function]}
310
327
  onTouchMove={[Function]}
311
328
  onTouchStart={[Function]}
329
+ readOnly={false}
312
330
  type="checkbox"
313
331
  />
314
332
  <div
@@ -357,6 +375,7 @@ exports[`Storybook Tests Checkbox Labelled 1`] = `
357
375
  onTouchEnd={[Function]}
358
376
  onTouchMove={[Function]}
359
377
  onTouchStart={[Function]}
378
+ readOnly={false}
360
379
  type="checkbox"
361
380
  />
362
381
  <div
@@ -401,13 +420,9 @@ exports[`Storybook Tests Checkbox Unlabelled 1`] = `
401
420
  gap: 4px;
402
421
  }
403
422
 
404
- .c0:disabled,
405
- .c0[aria-disabled]:not([aria-disabled=false]) {
406
- cursor: default;
407
- }
408
-
409
423
  .c0:disabled,
410
424
  .c0[aria-disabled]:not([aria-disabled='false']) {
425
+ cursor: default;
411
426
  opacity: 0.32;
412
427
  }
413
428
 
@@ -429,6 +444,18 @@ exports[`Storybook Tests Checkbox Unlabelled 1`] = `
429
444
  transition: 0.2s box-shadow,0.2s background-color;
430
445
  }
431
446
 
447
+ .c2[type='checkbox']:disabled {
448
+ cursor: default;
449
+ }
450
+
451
+ .c2[type='checkbox']:-moz-read-only {
452
+ cursor: default;
453
+ }
454
+
455
+ .c2[type='checkbox']:read-only {
456
+ cursor: default;
457
+ }
458
+
432
459
  .c2[type='checkbox']:checked {
433
460
  background-color: var(--charcoal-brand);
434
461
  }
@@ -525,6 +552,7 @@ exports[`Storybook Tests Checkbox Unlabelled 1`] = `
525
552
  onTouchEnd={[Function]}
526
553
  onTouchMove={[Function]}
527
554
  onTouchStart={[Function]}
555
+ readOnly={false}
528
556
  type="checkbox"
529
557
  />
530
558
  <div
@@ -4,7 +4,6 @@ import styled, { css } from 'styled-components'
4
4
  import { useCheckbox } from '@react-aria/checkbox'
5
5
  import { useObjectRef } from '@react-aria/utils'
6
6
  import { useToggleState } from 'react-stately'
7
- import { disabledSelector } from '@charcoal-ui/utils'
8
7
 
9
8
  import type { AriaCheckboxProps } from '@react-types/checkbox'
10
9
  import Icon from '../Icon'
@@ -59,7 +58,11 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
59
58
  return (
60
59
  <InputRoot aria-disabled={isDisabled} className={props.className}>
61
60
  <CheckboxRoot>
62
- <CheckboxInput type="checkbox" {...inputProps} />
61
+ <CheckboxInput
62
+ type="checkbox"
63
+ {...inputProps}
64
+ readOnly={props.readonly}
65
+ />
63
66
  <CheckboxInputOverlay aria-hidden={true} checked={inputProps.checked}>
64
67
  <Icon name="24/Check" unsafeNonGuidelineScale={2 / 3} />
65
68
  </CheckboxInputOverlay>
@@ -82,13 +85,11 @@ const InputRoot = styled.label`
82
85
  display: flex;
83
86
 
84
87
  cursor: pointer;
85
- ${disabledSelector} {
86
- cursor: default;
87
- }
88
88
 
89
89
  gap: 4px;
90
90
  &:disabled,
91
91
  &[aria-disabled]:not([aria-disabled='false']) {
92
+ cursor: default;
92
93
  opacity: 0.32;
93
94
  }
94
95
  `
@@ -108,6 +109,13 @@ const CheckboxInput = styled.input`
108
109
  border-radius: 4px;
109
110
  transition: 0.2s box-shadow, 0.2s background-color;
110
111
 
112
+ &:disabled {
113
+ cursor: default;
114
+ }
115
+ &:read-only {
116
+ cursor: default;
117
+ }
118
+
111
119
  &:checked {
112
120
  background-color: var(--charcoal-brand);
113
121
 
@@ -512,11 +512,13 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `
512
512
 
513
513
  .c12:not(:disabled):not([aria-disabled]):hover,
514
514
  .c12[aria-disabled='false']:hover {
515
+ color: var(--charcoal-text3-hover);
515
516
  background-color: var(--charcoal-transparent-hover);
516
517
  }
517
518
 
518
519
  .c12:not(:disabled):not([aria-disabled]):active,
519
520
  .c12[aria-disabled='false']:active {
521
+ color: var(--charcoal-text3-press);
520
522
  background-color: var(--charcoal-transparent-press);
521
523
  }
522
524
 
@@ -701,6 +703,7 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `
701
703
  </button>
702
704
  <div
703
705
  className="c0"
706
+ onClick={[Function]}
704
707
  onPointerDown={[Function]}
705
708
  style={
706
709
  Object {
@@ -67,11 +67,13 @@ exports[`Storybook Tests IconButton DefaultM 1`] = `
67
67
 
68
68
  .c1:not(:disabled):not([aria-disabled]):hover,
69
69
  .c1[aria-disabled='false']:hover {
70
+ color: var(--charcoal-text3-hover);
70
71
  background-color: var(--charcoal-transparent-hover);
71
72
  }
72
73
 
73
74
  .c1:not(:disabled):not([aria-disabled]):active,
74
75
  .c1[aria-disabled='false']:active {
76
+ color: var(--charcoal-text3-press);
75
77
  background-color: var(--charcoal-transparent-press);
76
78
  }
77
79
 
@@ -177,6 +179,7 @@ exports[`Storybook Tests IconButton IsActive 1`] = `
177
179
 
178
180
  .c1:not(:disabled):not([aria-disabled]),
179
181
  .c1[aria-disabled='false'] {
182
+ color: var(--charcoal-text3-press);
180
183
  background-color: var(--charcoal-transparent-press);
181
184
  }
182
185
 
@@ -282,11 +285,13 @@ exports[`Storybook Tests IconButton OverlayM 1`] = `
282
285
 
283
286
  .c1:not(:disabled):not([aria-disabled]):hover,
284
287
  .c1[aria-disabled='false']:hover {
288
+ color: var(--charcoal-text5-hover);
285
289
  background-color: var(--charcoal-surface4-hover);
286
290
  }
287
291
 
288
292
  .c1:not(:disabled):not([aria-disabled]):active,
289
293
  .c1[aria-disabled='false']:active {
294
+ color: var(--charcoal-text5-press);
290
295
  background-color: var(--charcoal-surface4-press);
291
296
  }
292
297
 
@@ -69,16 +69,19 @@ const StyledIconButton = styled(Clickable).attrs<
69
69
 
70
70
  &:not(:disabled):not([aria-disabled]),
71
71
  &[aria-disabled='false'] {
72
- ${({ $isActive, $background }) =>
72
+ ${({ $isActive, $background, $font }) =>
73
73
  $isActive
74
74
  ? css`
75
+ color: var(--charcoal-${$font}-press);
75
76
  background-color: var(--charcoal-${$background}-press);
76
77
  `
77
78
  : css`
78
79
  &:hover {
80
+ color: var(--charcoal-${$font}-hover);
79
81
  background-color: var(--charcoal-${$background}-hover);
80
82
  }
81
83
  &:active {
84
+ color: var(--charcoal-${$font}-press);
82
85
  background-color: var(--charcoal-${$background}-press);
83
86
  }
84
87
  `}
@@ -197,11 +197,13 @@ exports[`Storybook Tests Modal BottomSheet 1`] = `
197
197
 
198
198
  .c13:not(:disabled):not([aria-disabled]):hover,
199
199
  .c13[aria-disabled='false']:hover {
200
+ color: var(--charcoal-text3-hover);
200
201
  background-color: var(--charcoal-transparent-hover);
201
202
  }
202
203
 
203
204
  .c13:not(:disabled):not([aria-disabled]):active,
204
205
  .c13[aria-disabled='false']:active {
206
+ color: var(--charcoal-text3-press);
205
207
  background-color: var(--charcoal-transparent-press);
206
208
  }
207
209
 
@@ -409,6 +411,7 @@ exports[`Storybook Tests Modal BottomSheet 1`] = `
409
411
  </button>
410
412
  <div
411
413
  className="c2"
414
+ onClick={[Function]}
412
415
  onPointerDown={[Function]}
413
416
  style={
414
417
  Object {
@@ -912,11 +915,13 @@ exports[`Storybook Tests Modal Default 1`] = `
912
915
 
913
916
  .c27:not(:disabled):not([aria-disabled]):hover,
914
917
  .c27[aria-disabled='false']:hover {
918
+ color: var(--charcoal-text3-hover);
915
919
  background-color: var(--charcoal-transparent-hover);
916
920
  }
917
921
 
918
922
  .c27:not(:disabled):not([aria-disabled]):active,
919
923
  .c27[aria-disabled='false']:active {
924
+ color: var(--charcoal-text3-press);
920
925
  background-color: var(--charcoal-transparent-press);
921
926
  }
922
927
 
@@ -1196,6 +1201,7 @@ exports[`Storybook Tests Modal Default 1`] = `
1196
1201
  </button>
1197
1202
  <div
1198
1203
  className="c2"
1204
+ onClick={[Function]}
1199
1205
  onPointerDown={[Function]}
1200
1206
  style={Object {}}
1201
1207
  >
@@ -1295,6 +1301,7 @@ exports[`Storybook Tests Modal Default 1`] = `
1295
1301
  >
1296
1302
  <input
1297
1303
  aria-labelledby="test-id"
1304
+ autoFocus={true}
1298
1305
  className="c18"
1299
1306
  disabled={false}
1300
1307
  id="test-id"
@@ -1725,11 +1732,13 @@ exports[`Storybook Tests Modal FullBottomSheet 1`] = `
1725
1732
 
1726
1733
  .c22:not(:disabled):not([aria-disabled]):hover,
1727
1734
  .c22[aria-disabled='false']:hover {
1735
+ color: var(--charcoal-text3-hover);
1728
1736
  background-color: var(--charcoal-transparent-hover);
1729
1737
  }
1730
1738
 
1731
1739
  .c22:not(:disabled):not([aria-disabled]):active,
1732
1740
  .c22[aria-disabled='false']:active {
1741
+ color: var(--charcoal-text3-press);
1733
1742
  background-color: var(--charcoal-transparent-press);
1734
1743
  }
1735
1744
 
@@ -2018,6 +2027,7 @@ exports[`Storybook Tests Modal FullBottomSheet 1`] = `
2018
2027
  </button>
2019
2028
  <div
2020
2029
  className="c2"
2030
+ onClick={[Function]}
2021
2031
  onPointerDown={[Function]}
2022
2032
  style={
2023
2033
  Object {
@@ -2485,6 +2495,7 @@ exports[`Storybook Tests Modal InternalScroll 1`] = `
2485
2495
  </button>
2486
2496
  <div
2487
2497
  className="c2"
2498
+ onClick={[Function]}
2488
2499
  onPointerDown={[Function]}
2489
2500
  style={Object {}}
2490
2501
  >
@@ -2864,6 +2875,7 @@ exports[`Storybook Tests Modal NotDismmissableStory 1`] = `
2864
2875
  </button>
2865
2876
  <div
2866
2877
  className="c2"
2878
+ onClick={[Function]}
2867
2879
  onPointerDown={[Function]}
2868
2880
  style={Object {}}
2869
2881
  >
@@ -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
+ }
@@ -12,9 +12,9 @@ exports[`Storybook Tests Radio Basic 1`] = `
12
12
  cursor: pointer;
13
13
  }
14
14
 
15
- .c2:disabled,
16
15
  .c2[aria-disabled]:not([aria-disabled='false']) {
17
16
  opacity: 0.32;
17
+ cursor: default;
18
18
  }
19
19
 
20
20
  .c3[type='radio'] {
@@ -34,6 +34,10 @@ exports[`Storybook Tests Radio Basic 1`] = `
34
34
  transition: 0.2s background-color,0.2s box-shadow;
35
35
  }
36
36
 
37
+ .c3[type='radio']:disabled {
38
+ cursor: default;
39
+ }
40
+
37
41
  .c3[type='radio']:not(:disabled):not([aria-disabled]):hover,
38
42
  .c3[type='radio'][aria-disabled='false']:hover {
39
43
  background-color: var(--charcoal-surface1-hover);
@@ -244,9 +248,9 @@ exports[`Storybook Tests Radio Disabled 1`] = `
244
248
  cursor: pointer;
245
249
  }
246
250
 
247
- .c2:disabled,
248
251
  .c2[aria-disabled]:not([aria-disabled='false']) {
249
252
  opacity: 0.32;
253
+ cursor: default;
250
254
  }
251
255
 
252
256
  .c3[type='radio'] {
@@ -266,6 +270,10 @@ exports[`Storybook Tests Radio Disabled 1`] = `
266
270
  transition: 0.2s background-color,0.2s box-shadow;
267
271
  }
268
272
 
273
+ .c3[type='radio']:disabled {
274
+ cursor: default;
275
+ }
276
+
269
277
  .c3[type='radio']:not(:disabled):not([aria-disabled]):hover,
270
278
  .c3[type='radio'][aria-disabled='false']:hover {
271
279
  background-color: var(--charcoal-surface1-hover);
@@ -476,9 +484,9 @@ exports[`Storybook Tests Radio Invalid 1`] = `
476
484
  cursor: pointer;
477
485
  }
478
486
 
479
- .c2:disabled,
480
487
  .c2[aria-disabled]:not([aria-disabled='false']) {
481
488
  opacity: 0.32;
489
+ cursor: default;
482
490
  }
483
491
 
484
492
  .c3[type='radio'] {
@@ -498,6 +506,10 @@ exports[`Storybook Tests Radio Invalid 1`] = `
498
506
  transition: 0.2s background-color,0.2s box-shadow;
499
507
  }
500
508
 
509
+ .c3[type='radio']:disabled {
510
+ cursor: default;
511
+ }
512
+
501
513
  .c3[type='radio']:not(:disabled):not([aria-disabled]):hover,
502
514
  .c3[type='radio'][aria-disabled='false']:hover {
503
515
  background-color: var(--charcoal-surface1-hover);
@@ -709,9 +721,9 @@ exports[`Storybook Tests Radio PartialDisabled 1`] = `
709
721
  cursor: pointer;
710
722
  }
711
723
 
712
- .c2:disabled,
713
724
  .c2[aria-disabled]:not([aria-disabled='false']) {
714
725
  opacity: 0.32;
726
+ cursor: default;
715
727
  }
716
728
 
717
729
  .c3[type='radio'] {
@@ -731,6 +743,10 @@ exports[`Storybook Tests Radio PartialDisabled 1`] = `
731
743
  transition: 0.2s background-color,0.2s box-shadow;
732
744
  }
733
745
 
746
+ .c3[type='radio']:disabled {
747
+ cursor: default;
748
+ }
749
+
734
750
  .c3[type='radio']:not(:disabled):not([aria-disabled]):hover,
735
751
  .c3[type='radio'][aria-disabled='false']:hover {
736
752
  background-color: var(--charcoal-surface1-hover);
@@ -941,9 +957,9 @@ exports[`Storybook Tests Radio Readonly 1`] = `
941
957
  cursor: pointer;
942
958
  }
943
959
 
944
- .c2:disabled,
945
960
  .c2[aria-disabled]:not([aria-disabled='false']) {
946
961
  opacity: 0.32;
962
+ cursor: default;
947
963
  }
948
964
 
949
965
  .c3[type='radio'] {
@@ -963,6 +979,10 @@ exports[`Storybook Tests Radio Readonly 1`] = `
963
979
  transition: 0.2s background-color,0.2s box-shadow;
964
980
  }
965
981
 
982
+ .c3[type='radio']:disabled {
983
+ cursor: default;
984
+ }
985
+
966
986
  .c3[type='radio']:not(:disabled):not([aria-disabled]):hover,
967
987
  .c3[type='radio'][aria-disabled='false']:hover {
968
988
  background-color: var(--charcoal-surface1-hover);
@@ -65,9 +65,9 @@ const RadioRoot = styled.label`
65
65
  align-items: center;
66
66
  cursor: pointer;
67
67
 
68
- &:disabled,
69
68
  &[aria-disabled]:not([aria-disabled='false']) {
70
69
  opacity: 0.32;
70
+ cursor: default;
71
71
  }
72
72
  `
73
73
 
@@ -88,6 +88,10 @@ export const RadioInput = styled.input.attrs({ type: 'radio' })`
88
88
  background-color: var(--charcoal-surface1);
89
89
  transition: 0.2s background-color, 0.2s box-shadow;
90
90
 
91
+ :disabled {
92
+ cursor: default;
93
+ }
94
+
91
95
  &:not(:disabled):not([aria-disabled]),
92
96
  &[aria-disabled='false'] {
93
97
  &:hover {
@@ -7,6 +7,7 @@ import { countCodePointsInString, mergeRefs } from '../../_lib'
7
7
  import { ReactAreaUseTextFieldCompat } from '../../_lib/compat'
8
8
  import { AssistiveText, TextFieldLabel } from '../TextField'
9
9
  import { useFocusWithClick } from '../TextField/useFocusWithClick'
10
+ import { mergeProps } from '@react-aria/utils'
10
11
 
11
12
  type DOMProps = Omit<
12
13
  React.TextareaHTMLAttributes<HTMLTextAreaElement>,
@@ -55,6 +56,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
55
56
  maxLength,
56
57
  autoHeight = false,
57
58
  rows: initialRows = 4,
59
+ ...restProps
58
60
  } = props
59
61
 
60
62
  const { visuallyHiddenProps } = useVisuallyHidden()
@@ -95,20 +97,24 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
95
97
  setCount(countCodePointsInString(props.value ?? ''))
96
98
  }, [props.value])
97
99
 
98
- const { inputProps, labelProps, descriptionProps, errorMessageProps } =
99
- useTextField(
100
- {
101
- inputElementType: 'textarea',
102
- isDisabled: disabled,
103
- isRequired: required,
104
- validationState: invalid ? 'invalid' : 'valid',
105
- description: !invalid && assistiveText,
106
- errorMessage: invalid && assistiveText,
107
- onChange: handleChange,
108
- ...props,
109
- },
110
- ariaRef
111
- )
100
+ const {
101
+ inputProps: ariaInputProps,
102
+ labelProps,
103
+ descriptionProps,
104
+ errorMessageProps,
105
+ } = useTextField(
106
+ {
107
+ inputElementType: 'textarea',
108
+ isDisabled: disabled,
109
+ isRequired: required,
110
+ validationState: invalid ? 'invalid' : 'valid',
111
+ description: !invalid && assistiveText,
112
+ errorMessage: invalid && assistiveText,
113
+ onChange: handleChange,
114
+ ...props,
115
+ },
116
+ ariaRef
117
+ )
112
118
 
113
119
  useEffect(() => {
114
120
  if (autoHeight && textareaRef.current !== null) {
@@ -120,6 +126,8 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
120
126
 
121
127
  useFocusWithClick(containerRef, ariaRef)
122
128
 
129
+ const inputProps = mergeProps(restProps, ariaInputProps)
130
+
123
131
  return (
124
132
  <TextFieldRoot className={className} isDisabled={disabled}>
125
133
  <TextFieldLabel