@nulogy/components 15.1.2 → 15.1.3
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
CHANGED
|
@@ -52673,9 +52673,6 @@
|
|
|
52673
52673
|
var value = _a.value,
|
|
52674
52674
|
_onChange = _a.onChange,
|
|
52675
52675
|
defaultValue = _a.defaultValue,
|
|
52676
|
-
labelText = _a.labelText,
|
|
52677
|
-
requirementText = _a.requirementText,
|
|
52678
|
-
helpText = _a.helpText,
|
|
52679
52676
|
disabled = _a.disabled,
|
|
52680
52677
|
errorMessage = _a.errorMessage,
|
|
52681
52678
|
errorList = _a.errorList,
|
|
@@ -52703,7 +52700,7 @@
|
|
|
52703
52700
|
_a$closeMenuOnSelect = _a.closeMenuOnSelect,
|
|
52704
52701
|
closeMenuOnSelect = _a$closeMenuOnSelect === void 0 ? true : _a$closeMenuOnSelect,
|
|
52705
52702
|
noOptionsMessage = _a.noOptionsMessage,
|
|
52706
|
-
props = __rest(_a, ["value", "onChange", "defaultValue", "
|
|
52703
|
+
props = __rest(_a, ["value", "onChange", "defaultValue", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "multiselect", "placeholder", "components", "options", "styles", "windowThreshold", "autocomplete", "maxHeight", "required", "menuPosition", "menuPlacement", "classNamePrefix", "closeMenuOnSelect", "noOptionsMessage"]);
|
|
52707
52704
|
var _useTranslation = useTranslation(),
|
|
52708
52705
|
t = _useTranslation.t;
|
|
52709
52706
|
var variant = useComponentVariant();
|
|
@@ -52715,6 +52712,16 @@
|
|
|
52715
52712
|
return calcOptionsLength(options);
|
|
52716
52713
|
}, [options]);
|
|
52717
52714
|
var isWindowed = optionsLength >= windowThreshold;
|
|
52715
|
+
var labelText = props.labelText,
|
|
52716
|
+
requirementText = props.requirementText,
|
|
52717
|
+
helpText = props.helpText,
|
|
52718
|
+
hint = props.hint;
|
|
52719
|
+
var fieldLabelProps = {
|
|
52720
|
+
labelText: labelText,
|
|
52721
|
+
requirementText: requirementText,
|
|
52722
|
+
helpText: helpText,
|
|
52723
|
+
hint: hint
|
|
52724
|
+
};
|
|
52718
52725
|
noOptionsMessage || (noOptionsMessage = function noOptionsMessage() {
|
|
52719
52726
|
return t("no options");
|
|
52720
52727
|
});
|
|
@@ -52729,11 +52736,7 @@
|
|
|
52729
52736
|
maxHeight: maxHeight,
|
|
52730
52737
|
windowed: options.length > windowThreshold
|
|
52731
52738
|
});
|
|
52732
|
-
return /*#__PURE__*/React__default["default"].createElement(Field, Object.assign({}, styledProps), /*#__PURE__*/React__default["default"].createElement(MaybeFieldLabel, {
|
|
52733
|
-
labelText: labelText,
|
|
52734
|
-
requirementText: requirementText,
|
|
52735
|
-
helpText: helpText
|
|
52736
|
-
}, /*#__PURE__*/React__default["default"].createElement(StateManagedSelect$1, Object.assign({
|
|
52739
|
+
return /*#__PURE__*/React__default["default"].createElement(Field, Object.assign({}, styledProps), /*#__PURE__*/React__default["default"].createElement(MaybeFieldLabel, Object.assign({}, fieldLabelProps), /*#__PURE__*/React__default["default"].createElement(StateManagedSelect$1, Object.assign({
|
|
52737
52740
|
ref: ref,
|
|
52738
52741
|
isSearchable: autocomplete,
|
|
52739
52742
|
isDisabled: disabled,
|
package/dist/main.module.js
CHANGED
|
@@ -52656,9 +52656,6 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
52656
52656
|
var value = _a.value,
|
|
52657
52657
|
_onChange = _a.onChange,
|
|
52658
52658
|
defaultValue = _a.defaultValue,
|
|
52659
|
-
labelText = _a.labelText,
|
|
52660
|
-
requirementText = _a.requirementText,
|
|
52661
|
-
helpText = _a.helpText,
|
|
52662
52659
|
disabled = _a.disabled,
|
|
52663
52660
|
errorMessage = _a.errorMessage,
|
|
52664
52661
|
errorList = _a.errorList,
|
|
@@ -52686,7 +52683,7 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
52686
52683
|
_a$closeMenuOnSelect = _a.closeMenuOnSelect,
|
|
52687
52684
|
closeMenuOnSelect = _a$closeMenuOnSelect === void 0 ? true : _a$closeMenuOnSelect,
|
|
52688
52685
|
noOptionsMessage = _a.noOptionsMessage,
|
|
52689
|
-
props = __rest(_a, ["value", "onChange", "defaultValue", "
|
|
52686
|
+
props = __rest(_a, ["value", "onChange", "defaultValue", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "multiselect", "placeholder", "components", "options", "styles", "windowThreshold", "autocomplete", "maxHeight", "required", "menuPosition", "menuPlacement", "classNamePrefix", "closeMenuOnSelect", "noOptionsMessage"]);
|
|
52690
52687
|
var _useTranslation = useTranslation(),
|
|
52691
52688
|
t = _useTranslation.t;
|
|
52692
52689
|
var variant = useComponentVariant();
|
|
@@ -52698,6 +52695,16 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
52698
52695
|
return calcOptionsLength(options);
|
|
52699
52696
|
}, [options]);
|
|
52700
52697
|
var isWindowed = optionsLength >= windowThreshold;
|
|
52698
|
+
var labelText = props.labelText,
|
|
52699
|
+
requirementText = props.requirementText,
|
|
52700
|
+
helpText = props.helpText,
|
|
52701
|
+
hint = props.hint;
|
|
52702
|
+
var fieldLabelProps = {
|
|
52703
|
+
labelText: labelText,
|
|
52704
|
+
requirementText: requirementText,
|
|
52705
|
+
helpText: helpText,
|
|
52706
|
+
hint: hint
|
|
52707
|
+
};
|
|
52701
52708
|
noOptionsMessage || (noOptionsMessage = function noOptionsMessage() {
|
|
52702
52709
|
return t("no options");
|
|
52703
52710
|
});
|
|
@@ -52712,11 +52719,7 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
52712
52719
|
maxHeight: maxHeight,
|
|
52713
52720
|
windowed: options.length > windowThreshold
|
|
52714
52721
|
});
|
|
52715
|
-
return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, styledProps), /*#__PURE__*/React__default.createElement(MaybeFieldLabel, {
|
|
52716
|
-
labelText: labelText,
|
|
52717
|
-
requirementText: requirementText,
|
|
52718
|
-
helpText: helpText
|
|
52719
|
-
}, /*#__PURE__*/React__default.createElement(StateManagedSelect$1, Object.assign({
|
|
52722
|
+
return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, styledProps), /*#__PURE__*/React__default.createElement(MaybeFieldLabel, Object.assign({}, fieldLabelProps), /*#__PURE__*/React__default.createElement(StateManagedSelect$1, Object.assign({
|
|
52720
52723
|
ref: ref,
|
|
52721
52724
|
isSearchable: autocomplete,
|
|
52722
52725
|
isDisabled: disabled,
|
|
@@ -4,6 +4,7 @@ import { PropsValue } from "react-select";
|
|
|
4
4
|
import type { GroupBase, Props, StylesConfig } from "react-select";
|
|
5
5
|
import { StyledProps } from "../StyledProps";
|
|
6
6
|
import { CustomOnChangeValue } from "./lib";
|
|
7
|
+
import { FieldLabelProps } from "../FieldLabel/FieldLabel.type";
|
|
7
8
|
export type NDSOptionValue = string | number | boolean | null;
|
|
8
9
|
export interface NDSOption {
|
|
9
10
|
label: ReactNode;
|
|
@@ -11,9 +12,10 @@ export interface NDSOption {
|
|
|
11
12
|
}
|
|
12
13
|
interface CustomProps<Option extends NDSOption, IsMulti extends boolean, Group extends GroupBase<Option>> extends StyledProps {
|
|
13
14
|
autocomplete?: Props<Option, IsMulti, Group>["isSearchable"];
|
|
14
|
-
labelText?:
|
|
15
|
-
requirementText?:
|
|
16
|
-
|
|
15
|
+
labelText?: FieldLabelProps["labelText"];
|
|
16
|
+
requirementText?: FieldLabelProps["requirementText"];
|
|
17
|
+
hint?: FieldLabelProps["hint"];
|
|
18
|
+
helpText?: FieldLabelProps["helpText"];
|
|
17
19
|
disabled?: Props<Option, IsMulti, Group>["isDisabled"];
|
|
18
20
|
errorMessage?: string;
|
|
19
21
|
errorList?: string[];
|
|
@@ -26,7 +26,7 @@ import { SelectOption } from "./SelectOption";
|
|
|
26
26
|
import MenuList from "./MenuList";
|
|
27
27
|
import { calcOptionsLength, checkOptionsAreValid, extractValue, getReactSelectValue } from "./lib";
|
|
28
28
|
const NDSSelect = forwardRef((_a, ref) => {
|
|
29
|
-
var { value, onChange, defaultValue,
|
|
29
|
+
var { value, onChange, defaultValue, disabled, errorMessage, errorList, id, initialIsOpen, multiselect, placeholder, components, options, styles, windowThreshold = 300, autocomplete = true, maxHeight = "248px", required = false, menuPosition = "absolute", menuPlacement = "bottom", classNamePrefix = "ndsSelect", closeMenuOnSelect = true, noOptionsMessage } = _a, props = __rest(_a, ["value", "onChange", "defaultValue", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "multiselect", "placeholder", "components", "options", "styles", "windowThreshold", "autocomplete", "maxHeight", "required", "menuPosition", "menuPlacement", "classNamePrefix", "closeMenuOnSelect", "noOptionsMessage"]);
|
|
30
30
|
const { t } = useTranslation();
|
|
31
31
|
const variant = useComponentVariant();
|
|
32
32
|
const theme = useTheme();
|
|
@@ -35,6 +35,8 @@ const NDSSelect = forwardRef((_a, ref) => {
|
|
|
35
35
|
const optionsRef = React.useRef(options);
|
|
36
36
|
const optionsLength = React.useMemo(() => calcOptionsLength(options), [options]);
|
|
37
37
|
const isWindowed = optionsLength >= windowThreshold;
|
|
38
|
+
const { labelText, requirementText, helpText, hint } = props;
|
|
39
|
+
const fieldLabelProps = { labelText, requirementText, helpText, hint };
|
|
38
40
|
noOptionsMessage || (noOptionsMessage = () => t("no options"));
|
|
39
41
|
React.useEffect(() => {
|
|
40
42
|
checkOptionsAreValid(options);
|
|
@@ -48,7 +50,7 @@ const NDSSelect = forwardRef((_a, ref) => {
|
|
|
48
50
|
windowed: options.length > windowThreshold,
|
|
49
51
|
});
|
|
50
52
|
return (React.createElement(Field, Object.assign({}, styledProps),
|
|
51
|
-
React.createElement(MaybeFieldLabel, {
|
|
53
|
+
React.createElement(MaybeFieldLabel, Object.assign({}, fieldLabelProps),
|
|
52
54
|
React.createElement(ReactSelect, Object.assign({ ref: ref, isSearchable: autocomplete, isDisabled: disabled, defaultMenuIsOpen: initialIsOpen, isMulti: multiselect, defaultValue: getReactSelectValue(options, defaultValue), value: getReactSelectValue(options, value), options: options, onChange: (newValue) => {
|
|
53
55
|
if (!onChange)
|
|
54
56
|
return;
|
|
@@ -106,9 +106,9 @@ Required.story = {
|
|
|
106
106
|
name: "set to required",
|
|
107
107
|
};
|
|
108
108
|
export const WithAClearButton = () => (React.createElement(Select, { isClearable: true, placeholder: "Please select inventory status", options: options, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }));
|
|
109
|
-
export const
|
|
110
|
-
|
|
111
|
-
name: "with
|
|
109
|
+
export const WithAllFieldLabelProps = () => (React.createElement(Select, { placeholder: "Please select inventory status", options: options, labelText: "Inventory status", helpText: "Additional information about input", hint: "This is a hint for the input field", requirementText: "(Required)", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }));
|
|
110
|
+
WithAllFieldLabelProps.story = {
|
|
111
|
+
name: "with all field label props",
|
|
112
112
|
};
|
|
113
113
|
export const WithCustomId = () => (React.createElement(Select, { id: "my-custom-id", placeholder: "Please select inventory status", options: options, labelText: "Inventory status", helpText: "Additional information about input", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }));
|
|
114
114
|
WithCustomId.story = {
|