@zendeskgarden/react-forms 9.15.8 → 9.16.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.
- package/dist/esm/elements/Checkbox.js +1 -0
- package/dist/esm/elements/ClearableInput.js +111 -0
- package/dist/esm/elements/FileUpload.js +1 -0
- package/dist/esm/elements/Input.js +4 -2
- package/dist/esm/elements/MediaInput.js +1 -0
- package/dist/esm/elements/Radio.js +1 -0
- package/dist/esm/elements/Range.js +1 -0
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/Textarea.js +1 -0
- package/dist/esm/elements/Toggle.js +1 -0
- package/dist/esm/elements/common/Field.js +6 -2
- package/dist/esm/elements/common/Fieldset.js +1 -0
- package/dist/esm/elements/common/Hint.js +1 -0
- package/dist/esm/elements/common/Label.js +9 -1
- package/dist/esm/elements/common/Legend.js +1 -0
- package/dist/esm/elements/common/Message.js +1 -0
- package/dist/esm/elements/common/MessageIcon.js +1 -0
- package/dist/esm/elements/faux-input/FauxInput.js +1 -0
- package/dist/esm/elements/faux-input/components/EndIcon.js +1 -0
- package/dist/esm/elements/faux-input/components/StartIcon.js +1 -0
- package/dist/esm/elements/file-list/FileList.js +1 -0
- package/dist/esm/elements/file-list/components/Close.js +1 -0
- package/dist/esm/elements/file-list/components/Delete.js +1 -0
- package/dist/esm/elements/file-list/components/File.js +1 -0
- package/dist/esm/elements/file-list/components/Item.js +1 -0
- package/dist/esm/elements/input-group/InputGroup.js +26 -49
- package/dist/esm/elements/tiles/components/Description.js +1 -0
- package/dist/esm/elements/tiles/components/Icon.js +1 -0
- package/dist/esm/elements/tiles/components/Label.js +1 -0
- package/dist/esm/elements/tiles/components/Tile.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +6 -6
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +6 -6
- package/dist/esm/styled/checkbox/StyledCheckHint.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckInput.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +1 -1
- package/dist/esm/styled/checkbox/StyledDashSvg.js +1 -1
- package/dist/esm/styled/common/StyledField.js +1 -1
- package/dist/esm/styled/common/StyledFieldset.js +1 -1
- package/dist/esm/styled/common/StyledHint.js +1 -1
- package/dist/esm/styled/common/StyledLabel.js +1 -1
- package/dist/esm/styled/common/StyledLegend.js +1 -1
- package/dist/esm/styled/common/StyledMessage.js +1 -1
- package/dist/esm/styled/common/StyledMessageIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFile.js +1 -1
- package/dist/esm/styled/file-list/StyledFileClose.js +1 -1
- package/dist/esm/styled/file-list/StyledFileDelete.js +1 -1
- package/dist/esm/styled/file-list/StyledFileIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFileList.js +1 -1
- package/dist/esm/styled/file-list/StyledFileListItem.js +1 -1
- package/dist/esm/styled/file-upload/StyledFileUpload.js +1 -1
- package/dist/esm/styled/input-group/StyledClearableInput.js +16 -0
- package/dist/esm/styled/input-group/StyledInputGroup.js +97 -5
- package/dist/esm/styled/radio/StyledRadioHint.js +1 -1
- package/dist/esm/styled/radio/StyledRadioInput.js +1 -1
- package/dist/esm/styled/radio/StyledRadioLabel.js +1 -1
- package/dist/esm/styled/radio/StyledRadioMessage.js +1 -1
- package/dist/esm/styled/radio/StyledRadioSvg.js +1 -1
- package/dist/esm/styled/range/StyledRangeInput.js +1 -1
- package/dist/esm/styled/select/StyledSelect.js +1 -1
- package/dist/esm/styled/select/StyledSelectWrapper.js +1 -1
- package/dist/esm/styled/text/StyledTextFauxInput.js +1 -1
- package/dist/esm/styled/text/StyledTextInput.js +2 -2
- package/dist/esm/styled/text/StyledTextMediaFigure.js +1 -1
- package/dist/esm/styled/text/StyledTextMediaInput.js +1 -1
- package/dist/esm/styled/text/StyledTextarea.js +1 -1
- package/dist/esm/styled/tiles/StyledTile.js +1 -1
- package/dist/esm/styled/tiles/StyledTileDescription.js +1 -1
- package/dist/esm/styled/tiles/StyledTileIcon.js +1 -1
- package/dist/esm/styled/tiles/StyledTileLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleHint.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleInput.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleMessage.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleSvg.js +1 -1
- package/dist/esm/utils/useInputGroupContext.js +53 -2
- package/dist/index.cjs.js +362 -91
- package/dist/typings/elements/ClearableInput.d.ts +12 -0
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/styled/index.d.ts +1 -0
- package/dist/typings/styled/input-group/StyledClearableInput.d.ts +12 -0
- package/dist/typings/styled/input-group/StyledInputGroup.d.ts +4 -0
- package/dist/typings/types/index.d.ts +22 -3
- package/dist/typings/utils/useFieldContext.d.ts +2 -0
- package/dist/typings/utils/useInputGroupContext.d.ts +22 -0
- package/package.json +4 -3
|
@@ -21,6 +21,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
21
21
|
import '../styled/text/StyledTextMediaInput.js';
|
|
22
22
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
23
23
|
import '../styled/input-group/StyledInputGroup.js';
|
|
24
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
24
25
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
25
26
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
26
27
|
import { StyledCheckInput } from '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { useRef, useState } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { mergeRefs } from 'react-merge-refs';
|
|
10
|
+
import { useId, composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
11
|
+
import { useText } from '@zendeskgarden/react-theming';
|
|
12
|
+
import { IconButton } from '@zendeskgarden/react-buttons';
|
|
13
|
+
import SvgXStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js';
|
|
14
|
+
import { VALIDATION } from '../types/index.js';
|
|
15
|
+
import useFieldContext from '../utils/useFieldContext.js';
|
|
16
|
+
import { Input } from './Input.js';
|
|
17
|
+
import { StyledClearableInput } from '../styled/input-group/StyledClearableInput.js';
|
|
18
|
+
|
|
19
|
+
const ClearableInput = React__default.forwardRef(({
|
|
20
|
+
clearButtonLabel,
|
|
21
|
+
wrapperProps,
|
|
22
|
+
wrapperRef,
|
|
23
|
+
buttonProps: _buttonProps = {},
|
|
24
|
+
isCompact,
|
|
25
|
+
focusInset,
|
|
26
|
+
isBare,
|
|
27
|
+
value,
|
|
28
|
+
defaultValue,
|
|
29
|
+
onChange,
|
|
30
|
+
disabled,
|
|
31
|
+
readOnly,
|
|
32
|
+
...props
|
|
33
|
+
}, ref) => {
|
|
34
|
+
const fieldContext = useFieldContext();
|
|
35
|
+
const inputRef = useRef(null);
|
|
36
|
+
const generatedId = useId(props.id);
|
|
37
|
+
const inputId = props.id ?? fieldContext?.getInputProps().id ?? generatedId;
|
|
38
|
+
const ariaLabel = useText(ClearableInput, {
|
|
39
|
+
clearButtonLabel
|
|
40
|
+
}, 'clearButtonLabel', 'Clear');
|
|
41
|
+
const isControlled = value !== undefined;
|
|
42
|
+
const [uncontrolledHasValue, setUncontrolledHasValue] = useState(() => !!defaultValue);
|
|
43
|
+
const hasValue = isControlled ? !!value : uncontrolledHasValue;
|
|
44
|
+
const {
|
|
45
|
+
onClick,
|
|
46
|
+
onMouseDown,
|
|
47
|
+
...buttonProps
|
|
48
|
+
} = _buttonProps;
|
|
49
|
+
const onClearButtonMouseDown = event => {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
};
|
|
52
|
+
const onClearButtonClick = () => {
|
|
53
|
+
const input = inputRef.current;
|
|
54
|
+
if (input) {
|
|
55
|
+
Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set?.call(input, '');
|
|
56
|
+
input.dispatchEvent(new Event('input', {
|
|
57
|
+
bubbles: true
|
|
58
|
+
}));
|
|
59
|
+
input.focus();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const onInputChange = event => {
|
|
63
|
+
if (!isControlled) {
|
|
64
|
+
setUncontrolledHasValue(!!event.target.value);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return React__default.createElement(StyledClearableInput, Object.assign({
|
|
68
|
+
focusInset: focusInset
|
|
69
|
+
}, wrapperProps, {
|
|
70
|
+
isUnified: true,
|
|
71
|
+
isCompact: isCompact,
|
|
72
|
+
$isBare: isBare,
|
|
73
|
+
onClick: composeEventHandlers(wrapperProps?.onClick, () => {
|
|
74
|
+
inputRef.current?.focus();
|
|
75
|
+
}),
|
|
76
|
+
ref: wrapperRef
|
|
77
|
+
}), React__default.createElement(Input, Object.assign({
|
|
78
|
+
ref: mergeRefs([inputRef, ref])
|
|
79
|
+
}, props, {
|
|
80
|
+
disabled: disabled,
|
|
81
|
+
readOnly: readOnly,
|
|
82
|
+
value: value,
|
|
83
|
+
defaultValue: defaultValue,
|
|
84
|
+
onChange: composeEventHandlers(onChange, onInputChange),
|
|
85
|
+
id: inputId,
|
|
86
|
+
"data-garden-id": "forms.clearable_input"
|
|
87
|
+
})), hasValue && !disabled && !readOnly ? React__default.createElement(IconButton, Object.assign({
|
|
88
|
+
"aria-label": ariaLabel,
|
|
89
|
+
"aria-controls": inputId,
|
|
90
|
+
isBasic: true
|
|
91
|
+
}, buttonProps, {
|
|
92
|
+
focusInset: !isCompact,
|
|
93
|
+
onMouseDown: composeEventHandlers(onMouseDown, onClearButtonMouseDown),
|
|
94
|
+
onClick: composeEventHandlers(onClick, onClearButtonClick)
|
|
95
|
+
}), React__default.createElement(SvgXStroke, {
|
|
96
|
+
"aria-hidden": "true"
|
|
97
|
+
})) : null);
|
|
98
|
+
});
|
|
99
|
+
ClearableInput.displayName = 'ClearableInput';
|
|
100
|
+
ClearableInput.propTypes = {
|
|
101
|
+
isCompact: PropTypes.bool,
|
|
102
|
+
isBare: PropTypes.bool,
|
|
103
|
+
focusInset: PropTypes.bool,
|
|
104
|
+
validation: PropTypes.oneOf(VALIDATION),
|
|
105
|
+
clearButtonLabel: PropTypes.string,
|
|
106
|
+
wrapperProps: PropTypes.object,
|
|
107
|
+
wrapperRef: PropTypes.any,
|
|
108
|
+
buttonProps: PropTypes.object
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export { ClearableInput };
|
|
@@ -19,6 +19,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
19
19
|
import '../styled/text/StyledTextMediaInput.js';
|
|
20
20
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
21
21
|
import '../styled/input-group/StyledInputGroup.js';
|
|
22
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
22
23
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
23
24
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
24
25
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import { composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
10
10
|
import { VALIDATION } from '../types/index.js';
|
|
11
11
|
import useFieldContext from '../utils/useFieldContext.js';
|
|
12
|
-
import { useInputGroupContext } from '../utils/useInputGroupContext.js';
|
|
12
|
+
import { useInputGroupContext, usePublishInputGroupValidation } from '../utils/useInputGroupContext.js';
|
|
13
13
|
import '../styled/common/StyledField.js';
|
|
14
14
|
import '../styled/common/StyledFieldset.js';
|
|
15
15
|
import '../styled/common/StyledLegend.js';
|
|
@@ -23,6 +23,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
23
23
|
import '../styled/text/StyledTextMediaInput.js';
|
|
24
24
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
25
25
|
import '../styled/input-group/StyledInputGroup.js';
|
|
26
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
27
28
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
28
29
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -65,6 +66,7 @@ const Input = React__default.forwardRef(({
|
|
|
65
66
|
}, ref) => {
|
|
66
67
|
const fieldContext = useFieldContext();
|
|
67
68
|
const inputGroupContext = useInputGroupContext();
|
|
69
|
+
usePublishInputGroupValidation(validation);
|
|
68
70
|
let combinedProps = other;
|
|
69
71
|
if (fieldContext) {
|
|
70
72
|
combinedProps = fieldContext.getInputProps(combinedProps);
|
|
@@ -76,7 +78,7 @@ const Input = React__default.forwardRef(({
|
|
|
76
78
|
ref: ref,
|
|
77
79
|
onSelect: onSelectHandler
|
|
78
80
|
}, combinedProps, {
|
|
79
|
-
$isBare: isBare,
|
|
81
|
+
$isBare: isBare === undefined && inputGroupContext?.isUnified ? true : isBare,
|
|
80
82
|
$isCompact: inputGroupContext ? inputGroupContext.isCompact : isCompact,
|
|
81
83
|
$focusInset: inputGroupContext && focusInset === undefined ? true : focusInset,
|
|
82
84
|
$validation: validation
|
|
@@ -22,6 +22,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
22
22
|
import { StyledTextMediaInput } from '../styled/text/StyledTextMediaInput.js';
|
|
23
23
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
24
24
|
import '../styled/input-group/StyledInputGroup.js';
|
|
25
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
25
26
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
27
28
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -21,6 +21,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
21
21
|
import '../styled/text/StyledTextMediaInput.js';
|
|
22
22
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
23
23
|
import '../styled/input-group/StyledInputGroup.js';
|
|
24
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
24
25
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
25
26
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -21,6 +21,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
21
21
|
import '../styled/text/StyledTextMediaInput.js';
|
|
22
22
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
23
23
|
import '../styled/input-group/StyledInputGroup.js';
|
|
24
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
24
25
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
25
26
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -21,6 +21,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
21
21
|
import '../styled/text/StyledTextMediaInput.js';
|
|
22
22
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
23
23
|
import '../styled/input-group/StyledInputGroup.js';
|
|
24
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
24
25
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
25
26
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -23,6 +23,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
23
23
|
import '../styled/text/StyledTextMediaInput.js';
|
|
24
24
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
25
25
|
import '../styled/input-group/StyledInputGroup.js';
|
|
26
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
27
28
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
28
29
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -21,6 +21,7 @@ import '../styled/text/StyledTextFauxInput.js';
|
|
|
21
21
|
import '../styled/text/StyledTextMediaInput.js';
|
|
22
22
|
import '../styled/text/StyledTextMediaFigure.js';
|
|
23
23
|
import '../styled/input-group/StyledInputGroup.js';
|
|
24
|
+
import '../styled/input-group/StyledClearableInput.js';
|
|
24
25
|
import '../styled/checkbox/StyledCheckLabel.js';
|
|
25
26
|
import '../styled/checkbox/StyledCheckHint.js';
|
|
26
27
|
import '../styled/checkbox/StyledCheckInput.js';
|
|
@@ -20,6 +20,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
20
20
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
21
21
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
22
22
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
23
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
23
24
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
24
25
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
25
26
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -58,6 +59,7 @@ import { Label } from './Label.js';
|
|
|
58
59
|
const FieldComponent = React__default.forwardRef((props, ref) => {
|
|
59
60
|
const [hasHint, setHasHint] = useState(false);
|
|
60
61
|
const [hasMessage, setHasMessage] = useState(false);
|
|
62
|
+
const [hasLabel, setHasLabel] = useState(false);
|
|
61
63
|
const [isLabelActive, setIsLabelActive] = useState(false);
|
|
62
64
|
const [isLabelHovered, setIsLabelHovered] = useState(false);
|
|
63
65
|
const {
|
|
@@ -80,8 +82,10 @@ const FieldComponent = React__default.forwardRef((props, ref) => {
|
|
|
80
82
|
hasHint,
|
|
81
83
|
setHasHint,
|
|
82
84
|
hasMessage,
|
|
83
|
-
setHasMessage
|
|
84
|
-
|
|
85
|
+
setHasMessage,
|
|
86
|
+
hasLabel,
|
|
87
|
+
setHasLabel
|
|
88
|
+
}), [propGetters, getInputProps, getMessageProps, isLabelActive, isLabelHovered, hasHint, hasMessage, hasLabel]);
|
|
85
89
|
return React__default.createElement(FieldContext.Provider, {
|
|
86
90
|
value: fieldProps
|
|
87
91
|
}, React__default.createElement(StyledField, Object.assign({}, props, {
|
|
@@ -20,6 +20,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
20
20
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
21
21
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
22
22
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
23
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
23
24
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
24
25
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
25
26
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -20,6 +20,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
20
20
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
21
21
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
22
22
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
23
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
23
24
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
24
25
|
import { StyledCheckHint } from '../../styled/checkbox/StyledCheckHint.js';
|
|
25
26
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import React__default from 'react';
|
|
7
|
+
import React__default, { useEffect } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
10
10
|
import useFieldContext from '../../utils/useFieldContext.js';
|
|
@@ -23,6 +23,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
23
23
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
24
24
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
25
25
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
26
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
26
27
|
import { StyledCheckLabel } from '../../styled/checkbox/StyledCheckLabel.js';
|
|
27
28
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
28
29
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -63,6 +64,13 @@ const Label$1 = React__default.forwardRef(({
|
|
|
63
64
|
const fieldContext = useFieldContext();
|
|
64
65
|
const fieldsetContext = useFieldsetContext();
|
|
65
66
|
const type = useInputContext();
|
|
67
|
+
const {
|
|
68
|
+
setHasLabel
|
|
69
|
+
} = fieldContext || {};
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
setHasLabel?.(true);
|
|
72
|
+
return () => setHasLabel?.(false);
|
|
73
|
+
}, [setHasLabel]);
|
|
66
74
|
const $isRegular = fieldsetContext && isRegular === undefined ? true : isRegular;
|
|
67
75
|
let combinedProps = other;
|
|
68
76
|
if (fieldContext) {
|
|
@@ -18,6 +18,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
18
18
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
19
19
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
20
20
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
21
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
21
22
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
22
23
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
23
24
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -23,6 +23,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
23
23
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
24
24
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
25
25
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
26
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
26
27
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
27
28
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
28
29
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -22,6 +22,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
22
22
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
23
23
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
24
24
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
25
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
25
26
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
26
27
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
27
28
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -21,6 +21,7 @@ import { StyledTextFauxInput } from '../../styled/text/StyledTextFauxInput.js';
|
|
|
21
21
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
22
22
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
23
23
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
24
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
24
25
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
25
26
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
26
27
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -18,6 +18,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
18
18
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
19
19
|
import { StyledTextMediaFigure } from '../../../styled/text/StyledTextMediaFigure.js';
|
|
20
20
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
21
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
21
22
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
22
23
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -18,6 +18,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
18
18
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
19
19
|
import { StyledTextMediaFigure } from '../../../styled/text/StyledTextMediaFigure.js';
|
|
20
20
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
21
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
21
22
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
22
23
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -19,6 +19,7 @@ import '../../styled/text/StyledTextFauxInput.js';
|
|
|
19
19
|
import '../../styled/text/StyledTextMediaInput.js';
|
|
20
20
|
import '../../styled/text/StyledTextMediaFigure.js';
|
|
21
21
|
import '../../styled/input-group/StyledInputGroup.js';
|
|
22
|
+
import '../../styled/input-group/StyledClearableInput.js';
|
|
22
23
|
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
23
24
|
import '../../styled/checkbox/StyledCheckHint.js';
|
|
24
25
|
import '../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -22,6 +22,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
22
22
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
23
23
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
24
24
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
25
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
25
26
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
26
27
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
27
28
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -22,6 +22,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
22
22
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
23
23
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
24
24
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
25
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
25
26
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
26
27
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
27
28
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -22,6 +22,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
22
22
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
23
23
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
24
24
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
25
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
25
26
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
26
27
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
27
28
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -18,6 +18,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
18
18
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
19
19
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
20
20
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
21
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
21
22
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
22
23
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -6,69 +6,46 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React__default, { useMemo } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
import
|
|
10
|
-
import '../../
|
|
11
|
-
import '../../styled/common/StyledFieldset.js';
|
|
12
|
-
import '../../styled/common/StyledLegend.js';
|
|
13
|
-
import '../../styled/common/StyledHint.js';
|
|
14
|
-
import '../../styled/common/StyledLabel.js';
|
|
15
|
-
import '../../styled/common/StyledMessage.js';
|
|
16
|
-
import '../../styled/common/StyledMessageIcon.js';
|
|
17
|
-
import '../../styled/text/StyledTextInput.js';
|
|
18
|
-
import '../../styled/text/StyledTextarea.js';
|
|
19
|
-
import '../../styled/text/StyledTextFauxInput.js';
|
|
20
|
-
import '../../styled/text/StyledTextMediaInput.js';
|
|
21
|
-
import '../../styled/text/StyledTextMediaFigure.js';
|
|
9
|
+
import useFieldContext from '../../utils/useFieldContext.js';
|
|
10
|
+
import { useInputGroupValidationState, InputGroupContext } from '../../utils/useInputGroupContext.js';
|
|
22
11
|
import { StyledInputGroup } from '../../styled/input-group/StyledInputGroup.js';
|
|
23
|
-
import '../../styled/checkbox/StyledCheckLabel.js';
|
|
24
|
-
import '../../styled/checkbox/StyledCheckHint.js';
|
|
25
|
-
import '../../styled/checkbox/StyledCheckInput.js';
|
|
26
|
-
import '../../styled/checkbox/StyledCheckMessage.js';
|
|
27
|
-
import '../../styled/checkbox/StyledCheckSvg.js';
|
|
28
|
-
import '../../styled/checkbox/StyledDashSvg.js';
|
|
29
|
-
import '../../styled/file-upload/StyledFileUpload.js';
|
|
30
|
-
import '../../styled/file-list/StyledFile.js';
|
|
31
|
-
import '../../styled/file-list/StyledFileClose.js';
|
|
32
|
-
import '../../styled/file-list/StyledFileDelete.js';
|
|
33
|
-
import '../../styled/file-list/StyledFileIcon.js';
|
|
34
|
-
import '../../styled/file-list/StyledFileList.js';
|
|
35
|
-
import '../../styled/file-list/StyledFileListItem.js';
|
|
36
|
-
import '../../styled/radio/StyledRadioLabel.js';
|
|
37
|
-
import '../../styled/radio/StyledRadioHint.js';
|
|
38
|
-
import '../../styled/radio/StyledRadioInput.js';
|
|
39
|
-
import '../../styled/radio/StyledRadioMessage.js';
|
|
40
|
-
import '../../styled/radio/StyledRadioSvg.js';
|
|
41
|
-
import '../../styled/toggle/StyledToggleLabel.js';
|
|
42
|
-
import '../../styled/toggle/StyledToggleHint.js';
|
|
43
|
-
import '../../styled/toggle/StyledToggleInput.js';
|
|
44
|
-
import '../../styled/toggle/StyledToggleMessage.js';
|
|
45
|
-
import '../../styled/toggle/StyledToggleSvg.js';
|
|
46
|
-
import '../../styled/select/StyledSelect.js';
|
|
47
|
-
import '../../styled/select/StyledSelectWrapper.js';
|
|
48
|
-
import '../../styled/range/StyledRangeInput.js';
|
|
49
|
-
import '../../styled/tiles/StyledTile.js';
|
|
50
|
-
import '../../styled/tiles/StyledTileDescription.js';
|
|
51
|
-
import '../../styled/tiles/StyledTileIcon.js';
|
|
52
|
-
import '../../styled/tiles/StyledTileInput.js';
|
|
53
|
-
import '../../styled/tiles/StyledTileLabel.js';
|
|
54
12
|
|
|
55
13
|
const InputGroup = React__default.forwardRef(({
|
|
56
14
|
isCompact,
|
|
15
|
+
isUnified,
|
|
16
|
+
focusInset,
|
|
17
|
+
children,
|
|
57
18
|
...other
|
|
58
19
|
}, ref) => {
|
|
20
|
+
const fieldContext = useFieldContext();
|
|
21
|
+
const {
|
|
22
|
+
validation,
|
|
23
|
+
registerValidation
|
|
24
|
+
} = useInputGroupValidationState();
|
|
59
25
|
const contextValue = useMemo(() => ({
|
|
60
|
-
isCompact
|
|
61
|
-
|
|
26
|
+
isCompact,
|
|
27
|
+
isUnified,
|
|
28
|
+
registerValidation
|
|
29
|
+
}), [isCompact, isUnified, registerValidation]);
|
|
30
|
+
const labelId = fieldContext?.hasLabel && !other['aria-label'] ? fieldContext.getLabelProps({}).id : undefined;
|
|
62
31
|
return React__default.createElement(InputGroupContext.Provider, {
|
|
63
32
|
value: contextValue
|
|
64
33
|
}, React__default.createElement(StyledInputGroup, Object.assign({
|
|
34
|
+
role: "group",
|
|
35
|
+
"aria-labelledby": labelId,
|
|
65
36
|
ref: ref,
|
|
66
|
-
$isCompact: isCompact
|
|
67
|
-
|
|
37
|
+
$isCompact: isCompact,
|
|
38
|
+
$isUnified: isUnified,
|
|
39
|
+
$focusInset: focusInset
|
|
40
|
+
}, other, {
|
|
41
|
+
$validation: validation
|
|
42
|
+
}), children));
|
|
68
43
|
});
|
|
69
44
|
InputGroup.displayName = 'InputGroup';
|
|
70
45
|
InputGroup.propTypes = {
|
|
71
|
-
isCompact: PropTypes.bool
|
|
46
|
+
isCompact: PropTypes.bool,
|
|
47
|
+
isUnified: PropTypes.bool,
|
|
48
|
+
focusInset: PropTypes.bool
|
|
72
49
|
};
|
|
73
50
|
|
|
74
51
|
export { InputGroup };
|
|
@@ -18,6 +18,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
18
18
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
19
19
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
20
20
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
21
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
21
22
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
22
23
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -19,6 +19,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
19
19
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
20
20
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
21
21
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
22
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
22
23
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
24
25
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -19,6 +19,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
19
19
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
20
20
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
21
21
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
22
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
22
23
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
24
25
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
|
@@ -20,6 +20,7 @@ import '../../../styled/text/StyledTextFauxInput.js';
|
|
|
20
20
|
import '../../../styled/text/StyledTextMediaInput.js';
|
|
21
21
|
import '../../../styled/text/StyledTextMediaFigure.js';
|
|
22
22
|
import '../../../styled/input-group/StyledInputGroup.js';
|
|
23
|
+
import '../../../styled/input-group/StyledClearableInput.js';
|
|
23
24
|
import '../../../styled/checkbox/StyledCheckLabel.js';
|
|
24
25
|
import '../../../styled/checkbox/StyledCheckHint.js';
|
|
25
26
|
import '../../../styled/checkbox/StyledCheckInput.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { Toggle } from './elements/Toggle.js';
|
|
|
18
18
|
export { Select } from './elements/Select.js';
|
|
19
19
|
export { Tiles } from './elements/tiles/Tiles.js';
|
|
20
20
|
export { InputGroup } from './elements/input-group/InputGroup.js';
|
|
21
|
+
export { ClearableInput } from './elements/ClearableInput.js';
|
|
21
22
|
export { FileUpload } from './elements/FileUpload.js';
|
|
22
23
|
export { FileList } from './elements/file-list/FileList.js';
|
|
23
24
|
export { File } from './elements/file-list/components/File.js';
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
|
-
var _path$
|
|
10
|
-
function _extends$
|
|
11
|
-
var SvgXStroke
|
|
12
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
9
|
+
var _path$i;
|
|
10
|
+
function _extends$j() { return _extends$j = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$j.apply(null, arguments); }
|
|
11
|
+
var SvgXStroke = function SvgXStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends$j({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
width: 12,
|
|
15
15
|
height: 12,
|
|
16
16
|
focusable: "false",
|
|
17
17
|
viewBox: "0 0 12 12",
|
|
18
18
|
"aria-hidden": "true"
|
|
19
|
-
}, props), _path$
|
|
19
|
+
}, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
|
|
20
20
|
stroke: "currentColor",
|
|
21
21
|
strokeLinecap: "round",
|
|
22
22
|
d: "M3 9l6-6m0 6L3 3"
|
|
23
23
|
})));
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export { SvgXStroke
|
|
26
|
+
export { SvgXStroke as default };
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
|
-
var _path$
|
|
10
|
-
function _extends$
|
|
11
|
-
var SvgXStroke = function SvgXStroke(props) {
|
|
12
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
9
|
+
var _path$j;
|
|
10
|
+
function _extends$k() { return _extends$k = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$k.apply(null, arguments); }
|
|
11
|
+
var SvgXStroke$1 = function SvgXStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends$k({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
width: 16,
|
|
15
15
|
height: 16,
|
|
16
16
|
focusable: "false",
|
|
17
17
|
viewBox: "0 0 16 16",
|
|
18
18
|
"aria-hidden": "true"
|
|
19
|
-
}, props), _path$
|
|
19
|
+
}, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
|
|
20
20
|
stroke: "currentColor",
|
|
21
21
|
strokeLinecap: "round",
|
|
22
22
|
d: "M3 13L13 3m0 10L3 3"
|
|
23
23
|
})));
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export { SvgXStroke as default };
|
|
26
|
+
export { SvgXStroke$1 as default };
|
|
@@ -11,7 +11,7 @@ import { StyledRadioHint } from '../radio/StyledRadioHint.js';
|
|
|
11
11
|
const COMPONENT_ID$q = 'forms.checkbox_hint';
|
|
12
12
|
const StyledCheckHint = styled(StyledRadioHint).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID$q,
|
|
14
|
-
'data-garden-version': '9.
|
|
14
|
+
'data-garden-version': '9.16.0'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledCheckHint",
|
|
17
17
|
componentId: "sc-1kl8e8c-0"
|
|
@@ -64,7 +64,7 @@ const colorStyles$8 = ({
|
|
|
64
64
|
};
|
|
65
65
|
const StyledCheckInput = styled(StyledRadioInput).attrs({
|
|
66
66
|
'data-garden-id': COMPONENT_ID$o,
|
|
67
|
-
'data-garden-version': '9.
|
|
67
|
+
'data-garden-version': '9.16.0',
|
|
68
68
|
type: 'checkbox'
|
|
69
69
|
}).withConfig({
|
|
70
70
|
displayName: "StyledCheckInput",
|