@norges-domstoler/dds-components 5.0.0 → 5.1.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/cjs/components/Select/CustomSelect.stories.d.ts +66 -0
- package/dist/cjs/components/Select/MultiSelect.stories.d.ts +1 -1
- package/dist/cjs/components/Select/Select.d.ts +4 -2
- package/dist/cjs/components/Select/Select.stories.d.ts +1 -1
- package/dist/cjs/icons/tsx/questionAnswer.d.ts +1 -1
- package/dist/cjs/index.js +26 -6
- package/dist/cjs/types/BaseComponentProps.d.ts +1 -1
- package/dist/components/Select/CustomSelect.stories.d.ts +66 -0
- package/dist/components/Select/MultiSelect.stories.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +4 -2
- package/dist/components/Select/Select.js +24 -4
- package/dist/components/Select/Select.stories.d.ts +1 -1
- package/dist/icons/tsx/questionAnswer.d.ts +1 -1
- package/dist/icons/tsx/questionAnswer.js +2 -2
- package/dist/index.js +1 -1
- package/dist/types/BaseComponentProps.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectOption, SelectProps } from '.';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | React.MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
6
|
+
argTypes: {
|
|
7
|
+
label: {
|
|
8
|
+
control: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
tip: {
|
|
13
|
+
control: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
errorMessage: {
|
|
18
|
+
control: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
width: {
|
|
23
|
+
control: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
placeholder: {
|
|
28
|
+
control: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
isDisabled: {
|
|
33
|
+
control: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
isClearable: {
|
|
38
|
+
control: {
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
required: {
|
|
43
|
+
control: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
readOnly: {
|
|
48
|
+
control: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
isLoading: {
|
|
53
|
+
control: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
parameters: {
|
|
59
|
+
controls: {
|
|
60
|
+
exclude: string[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default _default;
|
|
65
|
+
declare type SingleSelectProps = SelectProps<SelectOption, false>;
|
|
66
|
+
export declare const Overview: (args: SingleSelectProps) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectProps } from './Select';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
4
|
+
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
5
5
|
argTypes: {
|
|
6
6
|
label: {
|
|
7
7
|
control: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Property } from 'csstype';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { GroupBase, Props as ReactSelectProps, SelectInstance } from 'react-select';
|
|
3
|
+
import { GroupBase, OptionProps, Props as ReactSelectProps, SelectInstance, SingleValueProps } from 'react-select';
|
|
4
4
|
import { WithRequiredIf } from '../../types/utils';
|
|
5
5
|
export declare type SelectOption<TValue = unknown> = {
|
|
6
6
|
label: string | number;
|
|
@@ -26,7 +26,9 @@ export declare type SelectProps<TOption extends Record<string, unknown>, IsMulti
|
|
|
26
26
|
className?: string;
|
|
27
27
|
/** Inline styling. */
|
|
28
28
|
style?: React.CSSProperties;
|
|
29
|
+
customOptionElement?: (props: OptionProps<TOption, IsMulti, GroupBase<TOption>>) => JSX.Element;
|
|
30
|
+
customSingleValueElement?: (props: SingleValueProps<TOption, IsMulti, GroupBase<TOption>>) => JSX.Element;
|
|
29
31
|
} & WrappedReactSelectProps<TOption, IsMulti, GroupBase<TOption>>;
|
|
30
32
|
declare type ForwardRefType<TOption, IsMulti extends boolean> = React.ForwardedRef<SelectInstance<TOption, IsMulti, GroupBase<TOption>>>;
|
|
31
|
-
export declare const Select: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ForwardRefType<TOption, IsMulti>) => JSX.Element;
|
|
33
|
+
export declare const Select: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ForwardRefType<TOption, IsMulti>) => JSX.Element;
|
|
32
34
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectOption, SelectProps } from '.';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
4
|
+
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
5
5
|
argTypes: {
|
|
6
6
|
label: {
|
|
7
7
|
control: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SvgProps } from '../utils/propTypes';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function QuestionAnswerIcon(props: SvgProps): JSX.Element;
|
package/dist/cjs/index.js
CHANGED
|
@@ -2890,7 +2890,7 @@ function PublishIcon(props) {
|
|
|
2890
2890
|
}));
|
|
2891
2891
|
}
|
|
2892
2892
|
|
|
2893
|
-
function
|
|
2893
|
+
function QuestionAnswerIcon(props) {
|
|
2894
2894
|
var title = props.title,
|
|
2895
2895
|
rest = tslib.__rest(props, ["title"]);
|
|
2896
2896
|
|
|
@@ -5898,7 +5898,8 @@ var getCustomStyles = function getCustomStyles() {
|
|
|
5898
5898
|
|
|
5899
5899
|
var DdsOption = ReactSelect.components.Option,
|
|
5900
5900
|
NoOptionsMessage = ReactSelect.components.NoOptionsMessage,
|
|
5901
|
-
Input$2 = ReactSelect.components.Input
|
|
5901
|
+
Input$2 = ReactSelect.components.Input,
|
|
5902
|
+
SingleValue = ReactSelect.components.SingleValue;
|
|
5902
5903
|
var createSelectOptions = function createSelectOptions() {
|
|
5903
5904
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5904
5905
|
args[_key] = arguments[_key];
|
|
@@ -5921,6 +5922,18 @@ var IconOption = function IconOption(props) {
|
|
|
5921
5922
|
}));
|
|
5922
5923
|
};
|
|
5923
5924
|
|
|
5925
|
+
var CustomOption = function CustomOption(props, Element) {
|
|
5926
|
+
return jsxRuntime.jsx(DdsOption, Object.assign({}, props, {
|
|
5927
|
+
children: jsxRuntime.jsx(Element, Object.assign({}, props))
|
|
5928
|
+
}));
|
|
5929
|
+
};
|
|
5930
|
+
|
|
5931
|
+
var CustomSingleValue = function CustomSingleValue(props, Element) {
|
|
5932
|
+
return jsxRuntime.jsx(SingleValue, Object.assign({}, props, {
|
|
5933
|
+
children: jsxRuntime.jsx(Element, Object.assign({}, props))
|
|
5934
|
+
}));
|
|
5935
|
+
};
|
|
5936
|
+
|
|
5924
5937
|
var NoOptionsMessageCustom = function NoOptionsMessageCustom(props) {
|
|
5925
5938
|
return jsxRuntime.jsx(NoOptionsMessage, Object.assign({}, props, {
|
|
5926
5939
|
children: "Ingen treff"
|
|
@@ -5959,7 +5972,9 @@ var SelectInner = function SelectInner(_a, ref) {
|
|
|
5959
5972
|
isClearable = _a$isClearable === void 0 ? true : _a$isClearable,
|
|
5960
5973
|
_a$placeholder = _a.placeholder,
|
|
5961
5974
|
placeholder = _a$placeholder === void 0 ? '-- Velg fra listen --' : _a$placeholder,
|
|
5962
|
-
|
|
5975
|
+
customOptionElement = _a.customOptionElement,
|
|
5976
|
+
customSingleValueElement = _a.customSingleValueElement,
|
|
5977
|
+
rest = tslib.__rest(_a, ["id", "label", "errorMessage", "tip", "required", "readOnly", "options", "isMulti", "value", "defaultValue", "width", "closeMenuOnSelect", "className", "style", "isDisabled", "isClearable", "placeholder", "customOptionElement", "customSingleValueElement"]);
|
|
5963
5978
|
|
|
5964
5979
|
var _useState = React.useState(id !== null && id !== void 0 ? id : "select-".concat(nextUniqueId$c++)),
|
|
5965
5980
|
_useState2 = _slicedToArray(_useState, 1),
|
|
@@ -6006,9 +6021,14 @@ var SelectInner = function SelectInner(_a, ref) {
|
|
|
6006
6021
|
return searchFilter(label, inputValue) || inputValue === '';
|
|
6007
6022
|
},
|
|
6008
6023
|
components: {
|
|
6009
|
-
Option:
|
|
6024
|
+
Option: customOptionElement ? function (props) {
|
|
6025
|
+
return CustomOption(props, customOptionElement);
|
|
6026
|
+
} : IconOption,
|
|
6010
6027
|
NoOptionsMessage: NoOptionsMessageCustom,
|
|
6011
|
-
Input: CustomInput
|
|
6028
|
+
Input: CustomInput,
|
|
6029
|
+
SingleValue: customSingleValueElement ? function (props) {
|
|
6030
|
+
return CustomSingleValue(props, customSingleValueElement);
|
|
6031
|
+
} : SingleValue
|
|
6012
6032
|
},
|
|
6013
6033
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
6014
6034
|
}, rest);
|
|
@@ -10646,7 +10666,7 @@ exports.PopoverGroup = PopoverGroup;
|
|
|
10646
10666
|
exports.PrintIcon = PrintIcon;
|
|
10647
10667
|
exports.PropertyIcon = PropertyIcon;
|
|
10648
10668
|
exports.PublishIcon = PublishIcon;
|
|
10649
|
-
exports.
|
|
10669
|
+
exports.QuestionAnswerIcon = QuestionAnswerIcon;
|
|
10650
10670
|
exports.RadioButton = RadioButton;
|
|
10651
10671
|
exports.RadioButtonGroup = RadioButtonGroup;
|
|
10652
10672
|
exports.ReceiptIcon = ReceiptIcon;
|
|
@@ -19,7 +19,7 @@ export declare type BaseComponentProps<TElement extends Element, TOtherProps ext
|
|
|
19
19
|
*
|
|
20
20
|
* {@link BaseComponentProps}
|
|
21
21
|
*/
|
|
22
|
-
export declare type BaseComponentPropsWithChildren<T extends Element, TProps extends Record<string, unknown>, THTMLProps extends HTMLAttributes<T> = HTMLAttributes<T>> = BaseComponentProps<T, PropsWithChildren<TProps>, THTMLProps>;
|
|
22
|
+
export declare type BaseComponentPropsWithChildren<T extends Element, TProps extends Record<string, unknown> = Record<string, unknown>, THTMLProps extends HTMLAttributes<T> = HTMLAttributes<T>> = BaseComponentProps<T, PropsWithChildren<TProps>, THTMLProps>;
|
|
23
23
|
export declare const joinClassNames: (...classNames: (string | undefined)[]) => string;
|
|
24
24
|
declare type GetBaseHTMLProps = {
|
|
25
25
|
<T extends Element>(id: HTMLAttributes<T>['id'], className: HTMLAttributes<T>['className'], htmlProps: HTMLAttributes<T> | undefined, unknownProps: object): HTMLAttributes<T> & object;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectOption, SelectProps } from '.';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | React.MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
6
|
+
argTypes: {
|
|
7
|
+
label: {
|
|
8
|
+
control: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
tip: {
|
|
13
|
+
control: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
errorMessage: {
|
|
18
|
+
control: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
width: {
|
|
23
|
+
control: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
placeholder: {
|
|
28
|
+
control: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
isDisabled: {
|
|
33
|
+
control: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
isClearable: {
|
|
38
|
+
control: {
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
required: {
|
|
43
|
+
control: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
readOnly: {
|
|
48
|
+
control: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
isLoading: {
|
|
53
|
+
control: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
parameters: {
|
|
59
|
+
controls: {
|
|
60
|
+
exclude: string[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default _default;
|
|
65
|
+
declare type SingleSelectProps = SelectProps<SelectOption, false>;
|
|
66
|
+
export declare const Overview: (args: SingleSelectProps) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectProps } from './Select';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
4
|
+
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
5
5
|
argTypes: {
|
|
6
6
|
label: {
|
|
7
7
|
control: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Property } from 'csstype';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { GroupBase, Props as ReactSelectProps, SelectInstance } from 'react-select';
|
|
3
|
+
import { GroupBase, OptionProps, Props as ReactSelectProps, SelectInstance, SingleValueProps } from 'react-select';
|
|
4
4
|
import { WithRequiredIf } from '../../types/utils';
|
|
5
5
|
export declare type SelectOption<TValue = unknown> = {
|
|
6
6
|
label: string | number;
|
|
@@ -26,7 +26,9 @@ export declare type SelectProps<TOption extends Record<string, unknown>, IsMulti
|
|
|
26
26
|
className?: string;
|
|
27
27
|
/** Inline styling. */
|
|
28
28
|
style?: React.CSSProperties;
|
|
29
|
+
customOptionElement?: (props: OptionProps<TOption, IsMulti, GroupBase<TOption>>) => JSX.Element;
|
|
30
|
+
customSingleValueElement?: (props: SingleValueProps<TOption, IsMulti, GroupBase<TOption>>) => JSX.Element;
|
|
29
31
|
} & WrappedReactSelectProps<TOption, IsMulti, GroupBase<TOption>>;
|
|
30
32
|
declare type ForwardRefType<TOption, IsMulti extends boolean> = React.ForwardedRef<SelectInstance<TOption, IsMulti, GroupBase<TOption>>>;
|
|
31
|
-
export declare const Select: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ForwardRefType<TOption, IsMulti>) => JSX.Element;
|
|
33
|
+
export declare const Select: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ForwardRefType<TOption, IsMulti>) => JSX.Element;
|
|
32
34
|
export {};
|
|
@@ -13,7 +13,8 @@ import { derivativeIdGenerator, spaceSeparatedIdListGenerator } from '../../util
|
|
|
13
13
|
|
|
14
14
|
var DdsOption = components.Option,
|
|
15
15
|
NoOptionsMessage = components.NoOptionsMessage,
|
|
16
|
-
Input = components.Input
|
|
16
|
+
Input = components.Input,
|
|
17
|
+
SingleValue = components.SingleValue;
|
|
17
18
|
var createSelectOptions = function createSelectOptions() {
|
|
18
19
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
20
|
args[_key] = arguments[_key];
|
|
@@ -36,6 +37,18 @@ var IconOption = function IconOption(props) {
|
|
|
36
37
|
}));
|
|
37
38
|
};
|
|
38
39
|
|
|
40
|
+
var CustomOption = function CustomOption(props, Element) {
|
|
41
|
+
return jsx(DdsOption, Object.assign({}, props, {
|
|
42
|
+
children: jsx(Element, Object.assign({}, props))
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var CustomSingleValue = function CustomSingleValue(props, Element) {
|
|
47
|
+
return jsx(SingleValue, Object.assign({}, props, {
|
|
48
|
+
children: jsx(Element, Object.assign({}, props))
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
|
|
39
52
|
var NoOptionsMessageCustom = function NoOptionsMessageCustom(props) {
|
|
40
53
|
return jsx(NoOptionsMessage, Object.assign({}, props, {
|
|
41
54
|
children: "Ingen treff"
|
|
@@ -74,7 +87,9 @@ var SelectInner = function SelectInner(_a, ref) {
|
|
|
74
87
|
isClearable = _a$isClearable === void 0 ? true : _a$isClearable,
|
|
75
88
|
_a$placeholder = _a.placeholder,
|
|
76
89
|
placeholder = _a$placeholder === void 0 ? '-- Velg fra listen --' : _a$placeholder,
|
|
77
|
-
|
|
90
|
+
customOptionElement = _a.customOptionElement,
|
|
91
|
+
customSingleValueElement = _a.customSingleValueElement,
|
|
92
|
+
rest = __rest(_a, ["id", "label", "errorMessage", "tip", "required", "readOnly", "options", "isMulti", "value", "defaultValue", "width", "closeMenuOnSelect", "className", "style", "isDisabled", "isClearable", "placeholder", "customOptionElement", "customSingleValueElement"]);
|
|
78
93
|
|
|
79
94
|
var _useState = useState(id !== null && id !== void 0 ? id : "select-".concat(nextUniqueId++)),
|
|
80
95
|
_useState2 = _slicedToArray(_useState, 1),
|
|
@@ -121,9 +136,14 @@ var SelectInner = function SelectInner(_a, ref) {
|
|
|
121
136
|
return searchFilter(label, inputValue) || inputValue === '';
|
|
122
137
|
},
|
|
123
138
|
components: {
|
|
124
|
-
Option:
|
|
139
|
+
Option: customOptionElement ? function (props) {
|
|
140
|
+
return CustomOption(props, customOptionElement);
|
|
141
|
+
} : IconOption,
|
|
125
142
|
NoOptionsMessage: NoOptionsMessageCustom,
|
|
126
|
-
Input: CustomInput
|
|
143
|
+
Input: CustomInput,
|
|
144
|
+
SingleValue: customSingleValueElement ? function (props) {
|
|
145
|
+
return CustomSingleValue(props, customSingleValueElement);
|
|
146
|
+
} : SingleValue
|
|
127
147
|
},
|
|
128
148
|
'aria-invalid': hasErrorMessage ? true : undefined
|
|
129
149
|
}, rest);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectOption, SelectProps } from '.';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
4
|
+
component: <TOption extends Record<string, unknown>, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, customOptionElement, customSingleValueElement, ...rest }: SelectProps<TOption, IsMulti>, ref: ((instance: import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null) => void) | import("react").MutableRefObject<import("react-select").SelectInstance<TOption, IsMulti, import("react-select").GroupBase<TOption>> | null> | null) => JSX.Element;
|
|
5
5
|
argTypes: {
|
|
6
6
|
label: {
|
|
7
7
|
control: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SvgProps } from '../utils/propTypes';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function QuestionAnswerIcon(props: SvgProps): JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { __rest } from 'tslib';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { StyledSvg } from '../utils/StyledSvg.js';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function QuestionAnswerIcon(props) {
|
|
6
6
|
var title = props.title,
|
|
7
7
|
rest = __rest(props, ["title"]);
|
|
8
8
|
|
|
@@ -22,4 +22,4 @@ function QestionAnswerIcon(props) {
|
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export {
|
|
25
|
+
export { QuestionAnswerIcon };
|
package/dist/index.js
CHANGED
|
@@ -161,7 +161,7 @@ export { PlusCircledIcon } from './icons/tsx/plusCircled.js';
|
|
|
161
161
|
export { PrintIcon } from './icons/tsx/print.js';
|
|
162
162
|
export { PropertyIcon } from './icons/tsx/property.js';
|
|
163
163
|
export { PublishIcon } from './icons/tsx/publish.js';
|
|
164
|
-
export {
|
|
164
|
+
export { QuestionAnswerIcon } from './icons/tsx/questionAnswer.js';
|
|
165
165
|
export { ReceiptIcon } from './icons/tsx/receipt.js';
|
|
166
166
|
export { RedoIcon } from './icons/tsx/redo.js';
|
|
167
167
|
export { RefreshIcon } from './icons/tsx/refresh.js';
|
|
@@ -19,7 +19,7 @@ export declare type BaseComponentProps<TElement extends Element, TOtherProps ext
|
|
|
19
19
|
*
|
|
20
20
|
* {@link BaseComponentProps}
|
|
21
21
|
*/
|
|
22
|
-
export declare type BaseComponentPropsWithChildren<T extends Element, TProps extends Record<string, unknown>, THTMLProps extends HTMLAttributes<T> = HTMLAttributes<T>> = BaseComponentProps<T, PropsWithChildren<TProps>, THTMLProps>;
|
|
22
|
+
export declare type BaseComponentPropsWithChildren<T extends Element, TProps extends Record<string, unknown> = Record<string, unknown>, THTMLProps extends HTMLAttributes<T> = HTMLAttributes<T>> = BaseComponentProps<T, PropsWithChildren<TProps>, THTMLProps>;
|
|
23
23
|
export declare const joinClassNames: (...classNames: (string | undefined)[]) => string;
|
|
24
24
|
declare type GetBaseHTMLProps = {
|
|
25
25
|
<T extends Element>(id: HTMLAttributes<T>['id'], className: HTMLAttributes<T>['className'], htmlProps: HTMLAttributes<T> | undefined, unknownProps: object): HTMLAttributes<T> & object;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/preset-react": "^7.16.7",
|
|
48
48
|
"@mdx-js/react": "^2.1.1",
|
|
49
49
|
"@rollup/plugin-babel": "^5.3.1",
|
|
50
|
-
"@rollup/plugin-commonjs": "^
|
|
50
|
+
"@rollup/plugin-commonjs": "^22.0.2",
|
|
51
51
|
"@rollup/plugin-image": "^2.1.1",
|
|
52
52
|
"@rollup/plugin-node-resolve": "^13.2.0",
|
|
53
53
|
"@storybook/addon-actions": "^6.5.9",
|