@nulogy/components 11.0.0-beta.2 → 11.0.0-beta.4
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 +12 -10
- package/dist/main.module.js +12 -10
- package/dist/src/Select/Select.d.ts +7 -5
- package/dist/src/Select/Select.story.d.ts +3 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -50434,13 +50434,14 @@
|
|
|
50434
50434
|
size = _a.size,
|
|
50435
50435
|
windowThreshold = _a.windowThreshold,
|
|
50436
50436
|
options = _a.options,
|
|
50437
|
-
|
|
50437
|
+
styles = _a.styles,
|
|
50438
|
+
props = __rest(_a, ["autocomplete", "value", "onChange", "defaultValue", "labelText", "required", "requirementText", "helpText", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "maxHeight", "multiselect", "placeholder", "components", "size", "windowThreshold", "options", "styles"]);
|
|
50438
50439
|
|
|
50439
50440
|
var _useTranslation = useTranslation(),
|
|
50440
50441
|
t = _useTranslation.t;
|
|
50441
50442
|
|
|
50442
50443
|
var theme = styled.useTheme();
|
|
50443
|
-
var
|
|
50444
|
+
var styledProps = getSubset(props, addStyledProps);
|
|
50444
50445
|
var error = !!(errorMessage || errorList);
|
|
50445
50446
|
var optionsRef = React__default["default"].useRef(options);
|
|
50446
50447
|
var componentSize = useComponentSize(size);
|
|
@@ -50452,7 +50453,14 @@
|
|
|
50452
50453
|
checkOptionsAreValid(options);
|
|
50453
50454
|
optionsRef.current = options;
|
|
50454
50455
|
}, [options]);
|
|
50455
|
-
|
|
50456
|
+
var stylesConfig = customStyles({
|
|
50457
|
+
theme: theme,
|
|
50458
|
+
error: error,
|
|
50459
|
+
maxHeight: maxHeight,
|
|
50460
|
+
size: componentSize,
|
|
50461
|
+
windowed: options.length > windowThreshold
|
|
50462
|
+
});
|
|
50463
|
+
return /*#__PURE__*/React__default["default"].createElement(Field, Object.assign({}, styledProps), /*#__PURE__*/React__default["default"].createElement(MaybeFieldLabel, {
|
|
50456
50464
|
labelText: labelText,
|
|
50457
50465
|
requirementText: requirementText,
|
|
50458
50466
|
helpText: helpText
|
|
@@ -50476,13 +50484,7 @@
|
|
|
50476
50484
|
required: required,
|
|
50477
50485
|
"aria-invalid": error,
|
|
50478
50486
|
inputId: id,
|
|
50479
|
-
styles:
|
|
50480
|
-
theme: theme,
|
|
50481
|
-
error: error,
|
|
50482
|
-
maxHeight: maxHeight,
|
|
50483
|
-
size: componentSize,
|
|
50484
|
-
windowed: options.length > windowThreshold
|
|
50485
|
-
}),
|
|
50487
|
+
styles: styles ? styles(stylesConfig) : stylesConfig,
|
|
50486
50488
|
components: Object.assign(Object.assign({
|
|
50487
50489
|
Option: function Option(props) {
|
|
50488
50490
|
return /*#__PURE__*/React__default["default"].createElement(SelectOption$1, Object.assign({
|
package/dist/main.module.js
CHANGED
|
@@ -50417,13 +50417,14 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
50417
50417
|
size = _a.size,
|
|
50418
50418
|
windowThreshold = _a.windowThreshold,
|
|
50419
50419
|
options = _a.options,
|
|
50420
|
-
|
|
50420
|
+
styles = _a.styles,
|
|
50421
|
+
props = __rest(_a, ["autocomplete", "value", "onChange", "defaultValue", "labelText", "required", "requirementText", "helpText", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "maxHeight", "multiselect", "placeholder", "components", "size", "windowThreshold", "options", "styles"]);
|
|
50421
50422
|
|
|
50422
50423
|
var _useTranslation = useTranslation(),
|
|
50423
50424
|
t = _useTranslation.t;
|
|
50424
50425
|
|
|
50425
50426
|
var theme = useTheme();
|
|
50426
|
-
var
|
|
50427
|
+
var styledProps = getSubset(props, addStyledProps);
|
|
50427
50428
|
var error = !!(errorMessage || errorList);
|
|
50428
50429
|
var optionsRef = React__default.useRef(options);
|
|
50429
50430
|
var componentSize = useComponentSize(size);
|
|
@@ -50435,7 +50436,14 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
50435
50436
|
checkOptionsAreValid(options);
|
|
50436
50437
|
optionsRef.current = options;
|
|
50437
50438
|
}, [options]);
|
|
50438
|
-
|
|
50439
|
+
var stylesConfig = customStyles({
|
|
50440
|
+
theme: theme,
|
|
50441
|
+
error: error,
|
|
50442
|
+
maxHeight: maxHeight,
|
|
50443
|
+
size: componentSize,
|
|
50444
|
+
windowed: options.length > windowThreshold
|
|
50445
|
+
});
|
|
50446
|
+
return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, styledProps), /*#__PURE__*/React__default.createElement(MaybeFieldLabel, {
|
|
50439
50447
|
labelText: labelText,
|
|
50440
50448
|
requirementText: requirementText,
|
|
50441
50449
|
helpText: helpText
|
|
@@ -50459,13 +50467,7 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
50459
50467
|
required: required,
|
|
50460
50468
|
"aria-invalid": error,
|
|
50461
50469
|
inputId: id,
|
|
50462
|
-
styles:
|
|
50463
|
-
theme: theme,
|
|
50464
|
-
error: error,
|
|
50465
|
-
maxHeight: maxHeight,
|
|
50466
|
-
size: componentSize,
|
|
50467
|
-
windowed: options.length > windowThreshold
|
|
50468
|
-
}),
|
|
50470
|
+
styles: styles ? styles(stylesConfig) : stylesConfig,
|
|
50469
50471
|
components: Object.assign(Object.assign({
|
|
50470
50472
|
Option: function Option(props) {
|
|
50471
50473
|
return /*#__PURE__*/React__default.createElement(SelectOption$1, Object.assign({
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import Select from "react-select/base";
|
|
3
3
|
import { PropsValue } from "react-select";
|
|
4
|
-
import type { GroupBase, Props } from "react-select";
|
|
4
|
+
import type { GroupBase, Props, StylesConfig } from "react-select";
|
|
5
|
+
import { StyledProps } from "../StyledProps";
|
|
5
6
|
import { ComponentSize } from "../NDSProvider/ComponentSizeContext";
|
|
6
7
|
export type NDSOptionValue = string | number | boolean | null;
|
|
7
8
|
export interface NDSOption {
|
|
8
|
-
label:
|
|
9
|
+
label: ReactNode;
|
|
9
10
|
value: NDSOptionValue;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
interface CustomProps<IsMulti extends boolean, Group extends GroupBase<NDSOption>> extends StyledProps {
|
|
12
13
|
autocomplete?: Props<NDSOption, IsMulti, Group>["isSearchable"];
|
|
13
14
|
labelText?: string;
|
|
14
15
|
size?: ComponentSize;
|
|
@@ -25,7 +26,8 @@ type CustomProps<IsMulti extends boolean, Group extends GroupBase<NDSOption>> =
|
|
|
25
26
|
options: NDSOption[];
|
|
26
27
|
onChange?: (newValue: PropsValue<NDSOptionValue>) => void;
|
|
27
28
|
windowThreshold?: number;
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
styles?: (selectStyles: StylesConfig<NDSOption, IsMulti, Group>) => StylesConfig<NDSOption, IsMulti, Group>;
|
|
30
|
+
}
|
|
31
|
+
export type NDSSelectProps<IsMulti extends boolean = boolean, Group extends GroupBase<NDSOption> = GroupBase<NDSOption>> = Omit<Props<NDSOption, IsMulti, Group>, keyof CustomProps<IsMulti, Group> | "isSearchable" | "isDisabled" | "defaultMenuIsOpen" | "isMulti" | "styles"> & CustomProps<IsMulti, Group>;
|
|
30
32
|
declare const NDSSelect: React.ForwardRefExoticComponent<Omit<Props<NDSOption, boolean, GroupBase<NDSOption>>, "isDisabled" | "isMulti" | "isSearchable" | "defaultMenuIsOpen" | keyof CustomProps<IsMulti, Group>> & CustomProps<boolean, GroupBase<NDSOption>> & React.RefAttributes<Select<NDSOption, boolean, GroupBase<NDSOption>>>>;
|
|
31
33
|
export default NDSSelect;
|
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
export default _default;
|
|
6
6
|
export declare const _Select: () => React.JSX.Element;
|
|
7
7
|
export declare const WithDifferentSizes: () => React.JSX.Element;
|
|
8
|
+
export declare const WithStyledProps: () => React.JSX.Element;
|
|
8
9
|
export declare const WithABlankValue: {
|
|
9
10
|
(): React.JSX.Element;
|
|
10
11
|
story: {
|
|
@@ -103,10 +104,6 @@ export declare const WithCustomOptionComponent: {
|
|
|
103
104
|
name: string;
|
|
104
105
|
};
|
|
105
106
|
};
|
|
106
|
-
export declare const UsingRefToControlFocus:
|
|
107
|
-
(): React.JSX.Element;
|
|
108
|
-
story: {
|
|
109
|
-
name: string;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
107
|
+
export declare const UsingRefToControlFocus: () => React.JSX.Element;
|
|
112
108
|
export declare const WithTopMenuPlacement: () => React.JSX.Element;
|
|
109
|
+
export declare const WithCustomStyles: () => React.JSX.Element;
|