Skip to content

Commit 4bf6676

Browse files
authored
Searchwithin validationState behavior (#2168)
1 parent 8d39881 commit 4bf6676

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

packages/@react-spectrum/searchwithin/src/SearchWithin.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ function SearchWithin(props: SpectrumSearchWithinProps, ref: FocusableRef<HTMLEl
5757

5858
useLayoutEffect(onResize, [scale, onResize]);
5959

60-
let defaultSlotValues = {isDisabled, isRequired, label: null, isQuiet: false, 'aria-labelledby': labelProps.id || ariaLabel};
60+
let defaultSlotValues = {
61+
isDisabled,
62+
isRequired,
63+
label: null,
64+
isQuiet: false,
65+
'aria-labelledby': labelProps.id || ariaLabel,
66+
validationState: null
67+
};
6168
let searchFieldClassName = classNames(styles, 'spectrum-SearchWithin-searchfield');
6269
let pickerClassName = classNames(styles, 'spectrum-SearchWithin-picker');
6370
let slots = {

packages/@react-spectrum/searchwithin/stories/SearchWithin.stories.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,16 @@ export const pickerDefaultValue = () => render({}, {}, {defaultSelectedKey: 'tag
9494
pickerDefaultValue.storyName = 'Default value for Picker';
9595

9696
export const isRequiredNecessityIndicatorLabel = () => render({isRequired: true, necessityIndicator: 'label'});
97-
isRequiredNecessityIndicatorLabel.storyName = 'isRequired: true, necessityIndicator \'label\' ';
97+
isRequiredNecessityIndicatorLabel.storyName = 'isRequired: true, necessityIndicator "label"';
9898

9999
export const isRequiredFalse_necessityIndicator = () => render({isRequired: false, necessityIndicator: 'label'});
100-
isRequiredFalse_necessityIndicator.storyName = 'isRequired: false, necessityIndicator \'label\' ';
100+
isRequiredFalse_necessityIndicator.storyName = 'isRequired: false, necessityIndicator "label"';
101+
102+
export const InputValidationSateInvalid = () => render({}, {validationState: 'invalid'});
103+
InputValidationSateInvalid.storyName = 'input validationState: invalid';
104+
105+
export const PickerValidationSateInvalid = () => render({}, {}, {validationState: 'invalid'});
106+
PickerValidationSateInvalid.storyName = 'picker validationState: invalid';
101107

102108
export const PickerDisabled = () => render({}, {}, {isDisabled: true});
103109

0 commit comments

Comments
 (0)