@hyphen/hyphen-components 7.1.0 → 7.2.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/components/SelectInputNative/SelectInputNative.d.ts +6 -4
- package/dist/hyphen-components.cjs.development.js +5 -3
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +5 -3
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Formik/Formik.stories.tsx +1 -0
- package/src/components/SelectInputNative/SelectInputNative.stories.tsx +1 -0
- package/src/components/SelectInputNative/SelectInputNative.test.tsx +15 -1
- package/src/components/SelectInputNative/SelectInputNative.tsx +17 -4
|
@@ -3,14 +3,16 @@ import { ResponsiveProp } from '../../types';
|
|
|
3
3
|
import { BoxProps } from '../Box/Box';
|
|
4
4
|
import { FormControlProps } from '../FormControl/FormControl';
|
|
5
5
|
export type SelectInputNativeSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
export interface SelectInputNativeOption {
|
|
7
|
+
value: string | number;
|
|
8
|
+
label: string | number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
6
11
|
export interface SelectInputNativeProps extends BoxProps, FormControlProps {
|
|
7
12
|
/**
|
|
8
13
|
* List of options for the select input.
|
|
9
14
|
*/
|
|
10
|
-
options:
|
|
11
|
-
value: string | number;
|
|
12
|
-
label: string | number;
|
|
13
|
-
}[];
|
|
15
|
+
options: SelectInputNativeOption[];
|
|
14
16
|
/**
|
|
15
17
|
* onChange callback from select element.
|
|
16
18
|
*/
|
|
@@ -2677,9 +2677,10 @@ var SelectInputNative = function SelectInputNative(_ref) {
|
|
|
2677
2677
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
2678
2678
|
var placeholderOption = {
|
|
2679
2679
|
value: '',
|
|
2680
|
-
label: placeholder
|
|
2680
|
+
label: placeholder,
|
|
2681
|
+
disabled: true
|
|
2681
2682
|
};
|
|
2682
|
-
var optionsWithPlaceholder = [
|
|
2683
|
+
var optionsWithPlaceholder = [placeholderOption].concat(options);
|
|
2683
2684
|
var responsiveClasses = generateResponsiveClasses('size', size);
|
|
2684
2685
|
var selectWrapperClasses = classNames.apply(void 0, ['hyphen-components__variables__form-control', styles$g['select-input-native-wrapper']].concat(responsiveClasses.map(function (className) {
|
|
2685
2686
|
return styles$g[className];
|
|
@@ -2709,11 +2710,12 @@ var SelectInputNative = function SelectInputNative(_ref) {
|
|
|
2709
2710
|
id: id,
|
|
2710
2711
|
required: isRequired
|
|
2711
2712
|
}, optionsWithPlaceholder.map(function (option) {
|
|
2713
|
+
var _option$disabled;
|
|
2712
2714
|
return React.createElement(Box, {
|
|
2713
2715
|
as: "option",
|
|
2714
2716
|
key: option.value,
|
|
2715
2717
|
value: option.value,
|
|
2716
|
-
disabled: option.
|
|
2718
|
+
disabled: (_option$disabled = option.disabled) != null ? _option$disabled : false,
|
|
2717
2719
|
hidden: option.value === '',
|
|
2718
2720
|
color: option.value === '' ? 'disabled' : 'base'
|
|
2719
2721
|
}, option.label);
|