@charcoal-ui/react 3.8.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +1 -0
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts +12 -0
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -0
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts +1 -0
- package/dist/components/TextField/TextField.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/index.cjs.js +1001 -2226
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +995 -2226
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -6
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +43 -15
- package/src/components/Checkbox/index.tsx +13 -5
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +3 -0
- package/src/components/IconButton/__snapshots__/index.story.storyshot +5 -0
- package/src/components/IconButton/index.tsx +4 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +926 -0
- package/src/components/Modal/index.story.tsx +23 -0
- package/src/components/Modal/index.tsx +15 -20
- package/src/components/Modal/useCustomModalOverlay.tsx +47 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +25 -5
- package/src/components/Radio/index.tsx +5 -1
- package/src/components/TextArea/index.tsx +22 -14
- package/src/components/TextField/TextField.story.tsx +20 -0
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +277 -0
- package/src/components/TextField/index.tsx +22 -14
|
@@ -7,6 +7,7 @@ import FieldLabel, { FieldLabelProps } from '../FieldLabel'
|
|
|
7
7
|
import { countCodePointsInString, mergeRefs } from '../../_lib'
|
|
8
8
|
import { ReactAreaUseTextFieldCompat } from '../../_lib/compat'
|
|
9
9
|
import { useFocusWithClick } from './useFocusWithClick'
|
|
10
|
+
import { mergeProps } from '@react-aria/utils'
|
|
10
11
|
|
|
11
12
|
type DOMProps = Omit<
|
|
12
13
|
React.InputHTMLAttributes<HTMLInputElement>,
|
|
@@ -60,6 +61,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
60
61
|
maxLength,
|
|
61
62
|
prefix = null,
|
|
62
63
|
suffix = null,
|
|
64
|
+
...restProps
|
|
63
65
|
} = props
|
|
64
66
|
|
|
65
67
|
const { visuallyHiddenProps } = useVisuallyHidden()
|
|
@@ -87,25 +89,31 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
87
89
|
setCount(countCodePointsInString(props.value ?? ''))
|
|
88
90
|
}, [props.value])
|
|
89
91
|
|
|
90
|
-
const {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
const {
|
|
93
|
+
inputProps: ariaInputProps,
|
|
94
|
+
labelProps,
|
|
95
|
+
descriptionProps,
|
|
96
|
+
errorMessageProps,
|
|
97
|
+
} = useTextField(
|
|
98
|
+
{
|
|
99
|
+
inputElementType: 'input',
|
|
100
|
+
isDisabled: disabled,
|
|
101
|
+
isRequired: required,
|
|
102
|
+
validationState: invalid ? 'invalid' : 'valid',
|
|
103
|
+
description: !invalid && assistiveText,
|
|
104
|
+
errorMessage: invalid && assistiveText,
|
|
105
|
+
onChange: handleChange,
|
|
106
|
+
...props,
|
|
107
|
+
},
|
|
108
|
+
ariaRef
|
|
109
|
+
)
|
|
104
110
|
|
|
105
111
|
const containerRef = useRef(null)
|
|
106
112
|
|
|
107
113
|
useFocusWithClick(containerRef, ariaRef)
|
|
108
114
|
|
|
115
|
+
const inputProps = mergeProps(restProps, ariaInputProps)
|
|
116
|
+
|
|
109
117
|
return (
|
|
110
118
|
<TextFieldRoot className={className} isDisabled={disabled}>
|
|
111
119
|
<TextFieldLabel
|