@nulogy/components 10.0.0 → 10.0.2
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/main.js +45 -34
- package/dist/main.module.js +45 -34
- package/dist/src/AsyncSelect/AsyncSelect.d.ts +3 -0
- package/dist/src/Form/Form.d.ts +4 -8
- package/dist/src/Form/Form.story.d.ts +1 -0
- package/dist/src/Select/Select.d.ts +26 -38
- package/dist/src/Select/Select.spec-utils.d.ts +5 -2
- package/dist/src/Select/Select.story.d.ts +1 -1
- package/dist/src/Select/SelectOption.d.ts +6 -1
- package/dist/src/Select/customReactSelectStyles.d.ts +12 -949
- package/dist/src/theme.d.ts +1 -1
- package/dist/src/theme.type.d.ts +22 -22
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -17253,7 +17253,7 @@
|
|
|
17253
17253
|
children = _a.children,
|
|
17254
17254
|
props = __rest(_a, ["title", "children"]);
|
|
17255
17255
|
|
|
17256
|
-
return /*#__PURE__*/
|
|
17256
|
+
return /*#__PURE__*/React__namespace.createElement("form", Object.assign({}, props), title && /*#__PURE__*/React__namespace.createElement(Heading2, null, title), children);
|
|
17257
17257
|
}).withConfig({
|
|
17258
17258
|
displayName: "Form",
|
|
17259
17259
|
componentId: "sc-1qb2xtx-0"
|
|
@@ -17588,11 +17588,11 @@
|
|
|
17588
17588
|
}
|
|
17589
17589
|
});
|
|
17590
17590
|
},
|
|
17591
|
-
dropdownIndicator: function dropdownIndicator(provided
|
|
17591
|
+
dropdownIndicator: function dropdownIndicator(provided) {
|
|
17592
17592
|
return Object.assign(Object.assign(Object.assign({}, provided), !hasDefaultOptions && {
|
|
17593
17593
|
display: "none"
|
|
17594
17594
|
}), {
|
|
17595
|
-
color:
|
|
17595
|
+
color: theme.colors.grey
|
|
17596
17596
|
});
|
|
17597
17597
|
},
|
|
17598
17598
|
indicatorsContainer: function indicatorsContainer(provided) {
|
|
@@ -17609,9 +17609,6 @@
|
|
|
17609
17609
|
transform: "translateY(-50%)"
|
|
17610
17610
|
});
|
|
17611
17611
|
},
|
|
17612
|
-
input: function input() {
|
|
17613
|
-
return {};
|
|
17614
|
-
},
|
|
17615
17612
|
valueContainer: function valueContainer(provided, state) {
|
|
17616
17613
|
return Object.assign(Object.assign(Object.assign({}, provided), {
|
|
17617
17614
|
display: "flex",
|
|
@@ -17637,14 +17634,13 @@
|
|
|
17637
17634
|
marginBottom: 0,
|
|
17638
17635
|
position: "absolute",
|
|
17639
17636
|
overflowX: "auto",
|
|
17640
|
-
zIndex:
|
|
17637
|
+
zIndex: 100,
|
|
17641
17638
|
width: "100%",
|
|
17642
17639
|
background: theme.colors.white,
|
|
17643
17640
|
borderWidth: "1px",
|
|
17644
17641
|
borderColor: getBorderColor({
|
|
17645
17642
|
errored: error,
|
|
17646
17643
|
isOpen: true,
|
|
17647
|
-
disabled: state.isDisabled,
|
|
17648
17644
|
isFocused: false,
|
|
17649
17645
|
theme: theme
|
|
17650
17646
|
}),
|
|
@@ -18669,7 +18665,7 @@
|
|
|
18669
18665
|
};
|
|
18670
18666
|
}, function (_ref2) {
|
|
18671
18667
|
var theme = _ref2.theme,
|
|
18672
|
-
|
|
18668
|
+
size = _ref2.size;
|
|
18673
18669
|
return stylesForSize({
|
|
18674
18670
|
large: {
|
|
18675
18671
|
div: {
|
|
@@ -18681,14 +18677,16 @@
|
|
|
18681
18677
|
padding: subPx(theme.space.x1)
|
|
18682
18678
|
}
|
|
18683
18679
|
}
|
|
18684
|
-
},
|
|
18680
|
+
}, size);
|
|
18685
18681
|
});
|
|
18686
|
-
|
|
18687
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledOption,
|
|
18688
|
-
|
|
18682
|
+
function SelectOption(props) {
|
|
18683
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledOption, {
|
|
18684
|
+
isSelected: props.isSelected,
|
|
18685
|
+
isFocused: props.isFocused,
|
|
18686
|
+
size: props.size,
|
|
18689
18687
|
"data-testid": "select-option"
|
|
18690
|
-
}
|
|
18691
|
-
}
|
|
18688
|
+
}, /*#__PURE__*/React__default["default"].createElement(WindowedSelect.components.Option, Object.assign({}, props)));
|
|
18689
|
+
}
|
|
18692
18690
|
|
|
18693
18691
|
var getSubset = function getSubset(o, propObj) {
|
|
18694
18692
|
var fields = Object.keys(propObj);
|
|
@@ -18795,7 +18793,8 @@
|
|
|
18795
18793
|
defaultOptions = _a.defaultOptions,
|
|
18796
18794
|
loadOptions = _a.loadOptions,
|
|
18797
18795
|
isClearable = _a.isClearable,
|
|
18798
|
-
|
|
18796
|
+
size = _a.size,
|
|
18797
|
+
props = __rest(_a, ["autocomplete", "labelText", "required", "requirementText", "helpText", "noOptionsMessage", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "maxHeight", "menuPosition", "multiselect", "name", "onChange", "placeholder", "value", "defaultValue", "className", "classNamePrefix", "onBlur", "menuIsOpen", "onMenuOpen", "onMenuClose", "onInputChange", "components", "aria-label", "cacheOptions", "defaultOptions", "loadOptions", "isClearable", "size"]);
|
|
18799
18798
|
|
|
18800
18799
|
var _useTranslation = useTranslation(),
|
|
18801
18800
|
t = _useTranslation.t;
|
|
@@ -18803,6 +18802,7 @@
|
|
|
18803
18802
|
var theme = styled.useTheme();
|
|
18804
18803
|
var spaceProps = getSubset(props, propTypes.space);
|
|
18805
18804
|
var error = !!(errorMessage || errorList);
|
|
18805
|
+
var componentSize = useComponentSize(size);
|
|
18806
18806
|
return /*#__PURE__*/React__default["default"].createElement(Field, Object.assign({}, spaceProps), /*#__PURE__*/React__default["default"].createElement(MaybeFieldLabel, {
|
|
18807
18807
|
labelText: labelText,
|
|
18808
18808
|
requirementText: requirementText,
|
|
@@ -18840,7 +18840,11 @@
|
|
|
18840
18840
|
onInputChange: onInputChange,
|
|
18841
18841
|
theme: theme,
|
|
18842
18842
|
components: Object.assign({
|
|
18843
|
-
Option:
|
|
18843
|
+
Option: function Option(props) {
|
|
18844
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectOption, Object.assign({
|
|
18845
|
+
size: componentSize
|
|
18846
|
+
}, props));
|
|
18847
|
+
},
|
|
18844
18848
|
Control: SelectControl$1,
|
|
18845
18849
|
MultiValue: SelectMultiValue$1,
|
|
18846
18850
|
ClearIndicator: SelectClearIndicator$1,
|
|
@@ -49099,7 +49103,7 @@
|
|
|
49099
49103
|
initialIsOpen = _a.initialIsOpen,
|
|
49100
49104
|
maxHeight = _a.maxHeight,
|
|
49101
49105
|
multiselect = _a.multiselect,
|
|
49102
|
-
|
|
49106
|
+
_onChange = _a.onChange,
|
|
49103
49107
|
placeholder = _a.placeholder,
|
|
49104
49108
|
value = _a.value,
|
|
49105
49109
|
defaultValue = _a.defaultValue,
|
|
@@ -49121,9 +49125,6 @@
|
|
|
49121
49125
|
checkOptionsAreValid(options);
|
|
49122
49126
|
optionsRef.current = options;
|
|
49123
49127
|
}, [options]);
|
|
49124
|
-
var handleChange = React__default["default"].useCallback(function (option) {
|
|
49125
|
-
onChange && onChange(extractValue(option, multiselect));
|
|
49126
|
-
}, [multiselect, onChange]);
|
|
49127
49128
|
React__default["default"].useEffect(function () {
|
|
49128
49129
|
if (ref) {
|
|
49129
49130
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -49136,7 +49137,6 @@
|
|
|
49136
49137
|
requirementText: requirementText,
|
|
49137
49138
|
helpText: helpText
|
|
49138
49139
|
}, /*#__PURE__*/React__default["default"].createElement(WindowedSelect__default["default"], Object.assign({
|
|
49139
|
-
size: componentSize,
|
|
49140
49140
|
ref: reactSelectRef,
|
|
49141
49141
|
placeholder: placeholder || t("select"),
|
|
49142
49142
|
windowThreshold: windowThreshold,
|
|
@@ -49153,13 +49153,21 @@
|
|
|
49153
49153
|
"aria-invalid": error,
|
|
49154
49154
|
defaultMenuIsOpen: initialIsOpen,
|
|
49155
49155
|
inputId: id,
|
|
49156
|
-
onChange:
|
|
49156
|
+
onChange: function onChange(option) {
|
|
49157
|
+
if (!_onChange) return;
|
|
49158
|
+
var value = extractValue(option, multiselect);
|
|
49159
|
+
|
|
49160
|
+
_onChange(value);
|
|
49161
|
+
},
|
|
49157
49162
|
defaultValue: getReactSelectValue(options, defaultValue),
|
|
49158
49163
|
value: getReactSelectValue(options, value),
|
|
49159
49164
|
isMulti: multiselect,
|
|
49160
|
-
theme: themeContext,
|
|
49161
49165
|
components: Object.assign({
|
|
49162
|
-
Option:
|
|
49166
|
+
Option: function Option(props) {
|
|
49167
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectOption, Object.assign({
|
|
49168
|
+
size: componentSize
|
|
49169
|
+
}, props));
|
|
49170
|
+
},
|
|
49163
49171
|
Control: SelectControl,
|
|
49164
49172
|
MultiValue: SelectMultiValue,
|
|
49165
49173
|
ClearIndicator: SelectClearIndicator,
|
|
@@ -49169,8 +49177,7 @@
|
|
|
49169
49177
|
Input: SelectInput
|
|
49170
49178
|
}, components),
|
|
49171
49179
|
"aria-label": ariaLabel,
|
|
49172
|
-
options: options
|
|
49173
|
-
labelText: labelText
|
|
49180
|
+
options: options
|
|
49174
49181
|
}, props)), /*#__PURE__*/React__default["default"].createElement(InlineValidation, {
|
|
49175
49182
|
mt: "x1",
|
|
49176
49183
|
errorMessage: errorMessage,
|
|
@@ -49217,19 +49224,23 @@
|
|
|
49217
49224
|
return getOption(options, input);
|
|
49218
49225
|
};
|
|
49219
49226
|
|
|
49220
|
-
|
|
49221
|
-
if (
|
|
49222
|
-
|
|
49223
|
-
return o
|
|
49224
|
-
|
|
49227
|
+
function extractValue(options, isMulti) {
|
|
49228
|
+
if (Array.isArray(options)) {
|
|
49229
|
+
if (isMulti) {
|
|
49230
|
+
return options && options.length ? options.map(function (o) {
|
|
49231
|
+
return o.value;
|
|
49232
|
+
}) : [];
|
|
49233
|
+
} else {
|
|
49234
|
+
throw new Error("UNEXPECTED ERROR: don't forget to enable isMulti");
|
|
49235
|
+
}
|
|
49225
49236
|
}
|
|
49226
49237
|
|
|
49227
|
-
if (options
|
|
49238
|
+
if (options === null) {
|
|
49228
49239
|
return options;
|
|
49229
49240
|
} else {
|
|
49230
49241
|
return options.value;
|
|
49231
49242
|
}
|
|
49232
|
-
}
|
|
49243
|
+
}
|
|
49233
49244
|
|
|
49234
49245
|
ReactSelect.defaultProps = Object.assign(Object.assign({}, SelectDefaultProps), {
|
|
49235
49246
|
windowThreshold: 300,
|
package/dist/main.module.js
CHANGED
|
@@ -17236,7 +17236,7 @@ var Form = styled(function (_a) {
|
|
|
17236
17236
|
children = _a.children,
|
|
17237
17237
|
props = __rest(_a, ["title", "children"]);
|
|
17238
17238
|
|
|
17239
|
-
return /*#__PURE__*/
|
|
17239
|
+
return /*#__PURE__*/React.createElement("form", Object.assign({}, props), title && /*#__PURE__*/React.createElement(Heading2, null, title), children);
|
|
17240
17240
|
}).withConfig({
|
|
17241
17241
|
displayName: "Form",
|
|
17242
17242
|
componentId: "sc-1qb2xtx-0"
|
|
@@ -17571,11 +17571,11 @@ var customStyles = function customStyles(_ref6) {
|
|
|
17571
17571
|
}
|
|
17572
17572
|
});
|
|
17573
17573
|
},
|
|
17574
|
-
dropdownIndicator: function dropdownIndicator(provided
|
|
17574
|
+
dropdownIndicator: function dropdownIndicator(provided) {
|
|
17575
17575
|
return Object.assign(Object.assign(Object.assign({}, provided), !hasDefaultOptions && {
|
|
17576
17576
|
display: "none"
|
|
17577
17577
|
}), {
|
|
17578
|
-
color:
|
|
17578
|
+
color: theme.colors.grey
|
|
17579
17579
|
});
|
|
17580
17580
|
},
|
|
17581
17581
|
indicatorsContainer: function indicatorsContainer(provided) {
|
|
@@ -17592,9 +17592,6 @@ var customStyles = function customStyles(_ref6) {
|
|
|
17592
17592
|
transform: "translateY(-50%)"
|
|
17593
17593
|
});
|
|
17594
17594
|
},
|
|
17595
|
-
input: function input() {
|
|
17596
|
-
return {};
|
|
17597
|
-
},
|
|
17598
17595
|
valueContainer: function valueContainer(provided, state) {
|
|
17599
17596
|
return Object.assign(Object.assign(Object.assign({}, provided), {
|
|
17600
17597
|
display: "flex",
|
|
@@ -17620,14 +17617,13 @@ var customStyles = function customStyles(_ref6) {
|
|
|
17620
17617
|
marginBottom: 0,
|
|
17621
17618
|
position: "absolute",
|
|
17622
17619
|
overflowX: "auto",
|
|
17623
|
-
zIndex:
|
|
17620
|
+
zIndex: 100,
|
|
17624
17621
|
width: "100%",
|
|
17625
17622
|
background: theme.colors.white,
|
|
17626
17623
|
borderWidth: "1px",
|
|
17627
17624
|
borderColor: getBorderColor({
|
|
17628
17625
|
errored: error,
|
|
17629
17626
|
isOpen: true,
|
|
17630
|
-
disabled: state.isDisabled,
|
|
17631
17627
|
isFocused: false,
|
|
17632
17628
|
theme: theme
|
|
17633
17629
|
}),
|
|
@@ -18652,7 +18648,7 @@ var StyledOption = styled.div.withConfig({
|
|
|
18652
18648
|
};
|
|
18653
18649
|
}, function (_ref2) {
|
|
18654
18650
|
var theme = _ref2.theme,
|
|
18655
|
-
|
|
18651
|
+
size = _ref2.size;
|
|
18656
18652
|
return stylesForSize({
|
|
18657
18653
|
large: {
|
|
18658
18654
|
div: {
|
|
@@ -18664,14 +18660,16 @@ var StyledOption = styled.div.withConfig({
|
|
|
18664
18660
|
padding: subPx(theme.space.x1)
|
|
18665
18661
|
}
|
|
18666
18662
|
}
|
|
18667
|
-
},
|
|
18663
|
+
}, size);
|
|
18668
18664
|
});
|
|
18669
|
-
|
|
18670
|
-
return /*#__PURE__*/React__default.createElement(StyledOption,
|
|
18671
|
-
|
|
18665
|
+
function SelectOption(props) {
|
|
18666
|
+
return /*#__PURE__*/React__default.createElement(StyledOption, {
|
|
18667
|
+
isSelected: props.isSelected,
|
|
18668
|
+
isFocused: props.isFocused,
|
|
18669
|
+
size: props.size,
|
|
18672
18670
|
"data-testid": "select-option"
|
|
18673
|
-
}
|
|
18674
|
-
}
|
|
18671
|
+
}, /*#__PURE__*/React__default.createElement(components$1.Option, Object.assign({}, props)));
|
|
18672
|
+
}
|
|
18675
18673
|
|
|
18676
18674
|
var getSubset = function getSubset(o, propObj) {
|
|
18677
18675
|
var fields = Object.keys(propObj);
|
|
@@ -18778,7 +18776,8 @@ var AsyncSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
18778
18776
|
defaultOptions = _a.defaultOptions,
|
|
18779
18777
|
loadOptions = _a.loadOptions,
|
|
18780
18778
|
isClearable = _a.isClearable,
|
|
18781
|
-
|
|
18779
|
+
size = _a.size,
|
|
18780
|
+
props = __rest(_a, ["autocomplete", "labelText", "required", "requirementText", "helpText", "noOptionsMessage", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "maxHeight", "menuPosition", "multiselect", "name", "onChange", "placeholder", "value", "defaultValue", "className", "classNamePrefix", "onBlur", "menuIsOpen", "onMenuOpen", "onMenuClose", "onInputChange", "components", "aria-label", "cacheOptions", "defaultOptions", "loadOptions", "isClearable", "size"]);
|
|
18782
18781
|
|
|
18783
18782
|
var _useTranslation = useTranslation(),
|
|
18784
18783
|
t = _useTranslation.t;
|
|
@@ -18786,6 +18785,7 @@ var AsyncSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
18786
18785
|
var theme = useTheme();
|
|
18787
18786
|
var spaceProps = getSubset(props, propTypes.space);
|
|
18788
18787
|
var error = !!(errorMessage || errorList);
|
|
18788
|
+
var componentSize = useComponentSize(size);
|
|
18789
18789
|
return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, spaceProps), /*#__PURE__*/React__default.createElement(MaybeFieldLabel, {
|
|
18790
18790
|
labelText: labelText,
|
|
18791
18791
|
requirementText: requirementText,
|
|
@@ -18823,7 +18823,11 @@ var AsyncSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
18823
18823
|
onInputChange: onInputChange,
|
|
18824
18824
|
theme: theme,
|
|
18825
18825
|
components: Object.assign({
|
|
18826
|
-
Option:
|
|
18826
|
+
Option: function Option(props) {
|
|
18827
|
+
return /*#__PURE__*/React__default.createElement(SelectOption, Object.assign({
|
|
18828
|
+
size: componentSize
|
|
18829
|
+
}, props));
|
|
18830
|
+
},
|
|
18827
18831
|
Control: SelectControl$1,
|
|
18828
18832
|
MultiValue: SelectMultiValue$1,
|
|
18829
18833
|
ClearIndicator: SelectClearIndicator$1,
|
|
@@ -49082,7 +49086,7 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
49082
49086
|
initialIsOpen = _a.initialIsOpen,
|
|
49083
49087
|
maxHeight = _a.maxHeight,
|
|
49084
49088
|
multiselect = _a.multiselect,
|
|
49085
|
-
|
|
49089
|
+
_onChange = _a.onChange,
|
|
49086
49090
|
placeholder = _a.placeholder,
|
|
49087
49091
|
value = _a.value,
|
|
49088
49092
|
defaultValue = _a.defaultValue,
|
|
@@ -49104,9 +49108,6 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
49104
49108
|
checkOptionsAreValid(options);
|
|
49105
49109
|
optionsRef.current = options;
|
|
49106
49110
|
}, [options]);
|
|
49107
|
-
var handleChange = React__default.useCallback(function (option) {
|
|
49108
|
-
onChange && onChange(extractValue(option, multiselect));
|
|
49109
|
-
}, [multiselect, onChange]);
|
|
49110
49111
|
React__default.useEffect(function () {
|
|
49111
49112
|
if (ref) {
|
|
49112
49113
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -49119,7 +49120,6 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
49119
49120
|
requirementText: requirementText,
|
|
49120
49121
|
helpText: helpText
|
|
49121
49122
|
}, /*#__PURE__*/React__default.createElement(WindowedSelect, Object.assign({
|
|
49122
|
-
size: componentSize,
|
|
49123
49123
|
ref: reactSelectRef,
|
|
49124
49124
|
placeholder: placeholder || t("select"),
|
|
49125
49125
|
windowThreshold: windowThreshold,
|
|
@@ -49136,13 +49136,21 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
49136
49136
|
"aria-invalid": error,
|
|
49137
49137
|
defaultMenuIsOpen: initialIsOpen,
|
|
49138
49138
|
inputId: id,
|
|
49139
|
-
onChange:
|
|
49139
|
+
onChange: function onChange(option) {
|
|
49140
|
+
if (!_onChange) return;
|
|
49141
|
+
var value = extractValue(option, multiselect);
|
|
49142
|
+
|
|
49143
|
+
_onChange(value);
|
|
49144
|
+
},
|
|
49140
49145
|
defaultValue: getReactSelectValue(options, defaultValue),
|
|
49141
49146
|
value: getReactSelectValue(options, value),
|
|
49142
49147
|
isMulti: multiselect,
|
|
49143
|
-
theme: themeContext,
|
|
49144
49148
|
components: Object.assign({
|
|
49145
|
-
Option:
|
|
49149
|
+
Option: function Option(props) {
|
|
49150
|
+
return /*#__PURE__*/React__default.createElement(SelectOption, Object.assign({
|
|
49151
|
+
size: componentSize
|
|
49152
|
+
}, props));
|
|
49153
|
+
},
|
|
49146
49154
|
Control: SelectControl,
|
|
49147
49155
|
MultiValue: SelectMultiValue,
|
|
49148
49156
|
ClearIndicator: SelectClearIndicator,
|
|
@@ -49152,8 +49160,7 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
49152
49160
|
Input: SelectInput
|
|
49153
49161
|
}, components),
|
|
49154
49162
|
"aria-label": ariaLabel,
|
|
49155
|
-
options: options
|
|
49156
|
-
labelText: labelText
|
|
49163
|
+
options: options
|
|
49157
49164
|
}, props)), /*#__PURE__*/React__default.createElement(InlineValidation, {
|
|
49158
49165
|
mt: "x1",
|
|
49159
49166
|
errorMessage: errorMessage,
|
|
@@ -49200,19 +49207,23 @@ var getReactSelectValue = function getReactSelectValue(options, input) {
|
|
|
49200
49207
|
return getOption(options, input);
|
|
49201
49208
|
};
|
|
49202
49209
|
|
|
49203
|
-
|
|
49204
|
-
if (
|
|
49205
|
-
|
|
49206
|
-
return o
|
|
49207
|
-
|
|
49210
|
+
function extractValue(options, isMulti) {
|
|
49211
|
+
if (Array.isArray(options)) {
|
|
49212
|
+
if (isMulti) {
|
|
49213
|
+
return options && options.length ? options.map(function (o) {
|
|
49214
|
+
return o.value;
|
|
49215
|
+
}) : [];
|
|
49216
|
+
} else {
|
|
49217
|
+
throw new Error("UNEXPECTED ERROR: don't forget to enable isMulti");
|
|
49218
|
+
}
|
|
49208
49219
|
}
|
|
49209
49220
|
|
|
49210
|
-
if (options
|
|
49221
|
+
if (options === null) {
|
|
49211
49222
|
return options;
|
|
49212
49223
|
} else {
|
|
49213
49224
|
return options.value;
|
|
49214
49225
|
}
|
|
49215
|
-
}
|
|
49226
|
+
}
|
|
49216
49227
|
|
|
49217
49228
|
ReactSelect.defaultProps = Object.assign(Object.assign({}, SelectDefaultProps), {
|
|
49218
49229
|
windowThreshold: 300,
|
|
@@ -2,9 +2,11 @@ import React, { ReactNode } from "react";
|
|
|
2
2
|
import Select from "react-select/base";
|
|
3
3
|
import { AsyncProps } from "react-select/async";
|
|
4
4
|
import { GroupBase } from "react-select";
|
|
5
|
+
import { ComponentSize } from "../NDSProvider/ComponentSizeContext";
|
|
5
6
|
type AsyncCustomProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = {
|
|
6
7
|
autocomplete?: AsyncProps<Option, IsMulti, Group>["isSearchable"];
|
|
7
8
|
labelText?: string;
|
|
9
|
+
size?: ComponentSize;
|
|
8
10
|
requirementText?: string;
|
|
9
11
|
helpText?: ReactNode;
|
|
10
12
|
disabled?: AsyncProps<Option, IsMulti, Group>["isDisabled"];
|
|
@@ -15,5 +17,6 @@ type AsyncCustomProps<Option, IsMulti extends boolean, Group extends GroupBase<O
|
|
|
15
17
|
maxHeight?: string;
|
|
16
18
|
defaultValue?: AsyncProps<Option, IsMulti, Group>["defaultInputValue"];
|
|
17
19
|
};
|
|
20
|
+
export type AsyncSelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = Omit<AsyncProps<Option, IsMulti, Group>, "isSearchable" | "isDisabled" | "isMulti" | "defaultMenuIsOpen" | "defaultInputValue"> & AsyncCustomProps<Option, IsMulti, Group>;
|
|
18
21
|
declare const AsyncSelect: React.ForwardRefExoticComponent<Omit<AsyncProps<unknown, boolean, GroupBase<unknown>>, "isDisabled" | "isMulti" | "isSearchable" | "defaultMenuIsOpen" | "defaultInputValue"> & AsyncCustomProps<unknown, boolean, GroupBase<unknown>> & React.RefAttributes<Select<unknown, boolean, GroupBase<unknown>>>>;
|
|
19
22
|
export default AsyncSelect;
|
package/dist/src/Form/Form.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SpaceProps } from "styled-system";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
style?: React.CSSProperties;
|
|
7
|
-
id?: string;
|
|
8
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpaceProps } from "styled-system";
|
|
3
|
+
interface FormProps extends SpaceProps, React.HTMLProps<HTMLFormElement> {
|
|
4
|
+
}
|
|
9
5
|
declare const Form: import("styled-components").StyledComponent<({ title, children, ...props }: FormProps) => React.JSX.Element, import("styled-components").DefaultTheme, {}, never>;
|
|
10
6
|
export default Form;
|
|
@@ -1,44 +1,32 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { GroupBase } from "react-windowed-select";
|
|
3
|
+
import type { MenuPlacement, MenuPosition, Props as SelectProps } from "react-select";
|
|
2
4
|
import { ComponentSize } from "../NDSProvider/ComponentSizeContext";
|
|
3
|
-
|
|
4
|
-
options?: any[];
|
|
5
|
+
interface WindowedSelectProps extends SelectProps {
|
|
5
6
|
windowThreshold?: number;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
}
|
|
8
|
+
interface NDSOptionType {
|
|
9
|
+
label: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
}
|
|
12
|
+
interface CustomProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
13
|
+
autocomplete?: SelectProps<Option, IsMulti, Group>["isSearchable"];
|
|
12
14
|
labelText?: string;
|
|
13
|
-
helpText?: any;
|
|
14
|
-
noOptionsMessage?: Function;
|
|
15
15
|
requirementText?: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
helpText?: ReactNode;
|
|
17
|
+
disabled?: SelectProps<Option, IsMulti, Group>["isDisabled"];
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
errorList?: string[];
|
|
20
|
+
initialIsOpen?: SelectProps<Option, IsMulti, Group>["defaultMenuIsOpen"];
|
|
21
|
+
multiselect?: SelectProps<Option, IsMulti, Group>["isMulti"];
|
|
20
22
|
maxHeight?: string;
|
|
21
|
-
multiselect?: boolean;
|
|
22
|
-
name?: string;
|
|
23
|
-
onBlur?: (...args: any[]) => any;
|
|
24
|
-
onChange?: (...args: any[]) => any;
|
|
25
|
-
placeholder?: string;
|
|
26
|
-
required?: boolean;
|
|
27
|
-
value?: any;
|
|
28
|
-
defaultValue?: any;
|
|
29
|
-
className?: string;
|
|
30
|
-
classNamePrefix?: string;
|
|
31
|
-
menuIsOpen?: boolean;
|
|
32
|
-
onMenuOpen?: (...args: any[]) => any;
|
|
33
|
-
onMenuClose?: (...args: any[]) => any;
|
|
34
|
-
onInputChange?: (...args: any[]) => any;
|
|
35
|
-
components?: any;
|
|
36
|
-
closeMenuOnSelect?: boolean;
|
|
37
|
-
"aria-label"?: string;
|
|
38
23
|
size?: ComponentSize;
|
|
39
|
-
|
|
24
|
+
error?: boolean;
|
|
25
|
+
options: NDSOptionType[];
|
|
26
|
+
onChange?: (newValue: unknown) => void;
|
|
40
27
|
[key: string]: any;
|
|
41
|
-
}
|
|
28
|
+
}
|
|
29
|
+
export type NDSSelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = Omit<WindowedSelectProps, "isSearchable" | "isDisabled" | "isMulti" | "defaultMenuIsOpen" | "defaultInputValue" | "options" | "onChange"> & CustomProps<Option, IsMulti, Group>;
|
|
42
30
|
export declare const SelectDefaultProps: {
|
|
43
31
|
autocomplete: boolean;
|
|
44
32
|
disabled: any;
|
|
@@ -53,8 +41,8 @@ export declare const SelectDefaultProps: {
|
|
|
53
41
|
id: any;
|
|
54
42
|
initialIsOpen: any;
|
|
55
43
|
maxHeight: string;
|
|
56
|
-
menuPosition:
|
|
57
|
-
menuPlacement:
|
|
44
|
+
menuPosition: MenuPosition;
|
|
45
|
+
menuPlacement: MenuPlacement;
|
|
58
46
|
multiselect: boolean;
|
|
59
47
|
name: any;
|
|
60
48
|
onBlur: any;
|
|
@@ -71,6 +59,6 @@ export declare const SelectDefaultProps: {
|
|
|
71
59
|
components: any;
|
|
72
60
|
closeMenuOnSelect: boolean;
|
|
73
61
|
};
|
|
74
|
-
declare const ReactSelect: React.ForwardRefExoticComponent<Omit<
|
|
75
|
-
export declare const getOption: (options:
|
|
62
|
+
declare const ReactSelect: React.ForwardRefExoticComponent<Omit<Omit<WindowedSelectProps, "isDisabled" | "isMulti" | "isSearchable" | "onChange" | "options" | "defaultMenuIsOpen" | "defaultInputValue"> & CustomProps<unknown, boolean, GroupBase<unknown>>, "ref"> & React.RefAttributes<unknown>>;
|
|
63
|
+
export declare const getOption: (options: NDSOptionType[], value: unknown) => unknown;
|
|
76
64
|
export default ReactSelect;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Matcher, SelectorMatcherOptions } from "@testing-library/react";
|
|
2
|
+
type QueryByText = (id: Matcher, options?: SelectorMatcherOptions) => HTMLElement;
|
|
3
|
+
export declare const openDropdown: (element: HTMLElement, i: number) => void;
|
|
4
|
+
export declare const selectOption: (optionText: string, container: HTMLElement, queryByText: QueryByText, i?: number) => void;
|
|
5
|
+
export {};
|
|
@@ -109,5 +109,5 @@ export declare const UsingRefToControlFocus: {
|
|
|
109
109
|
name: string;
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
|
-
export declare const WithCustomProps: () => React.JSX.Element;
|
|
113
112
|
export declare const WithTopMenuPlacement: () => React.JSX.Element;
|
|
113
|
+
export declare const WithCustomProps: () => React.JSX.Element;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { OptionProps } from "react-windowed-select";
|
|
3
|
+
import { GroupBase } from "react-select";
|
|
4
|
+
import { ComponentSize } from "../NDSProvider/ComponentSizeContext";
|
|
5
|
+
export declare function SelectOption<Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: OptionProps<Option, IsMulti, Group> & {
|
|
6
|
+
size: ComponentSize;
|
|
7
|
+
}): React.JSX.Element;
|