@lumx/react 3.20.1-alpha.28 → 3.20.1-alpha.29
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/index.js +14033 -63
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/utils/index.js +158 -3
- package/utils/index.js.map +1 -1
- package/_internal/Button-5a87fee9.js +0 -97
- package/_internal/Button-5a87fee9.js.map +0 -1
- package/_internal/ButtonRoot-bf682215.js +0 -117
- package/_internal/ButtonRoot-bf682215.js.map +0 -1
- package/_internal/Chip-8d0aae06.js +0 -143
- package/_internal/Chip-8d0aae06.js.map +0 -1
- package/_internal/ClickAwayProvider-1204f237.js +0 -95
- package/_internal/ClickAwayProvider-1204f237.js.map +0 -1
- package/_internal/DisabledStateContext-ea04260d.js +0 -29
- package/_internal/DisabledStateContext-ea04260d.js.map +0 -1
- package/_internal/HeadingLevelProvider-ebdcb0c7.js +0 -61
- package/_internal/HeadingLevelProvider-ebdcb0c7.js.map +0 -1
- package/_internal/IconButton-351389b0.js +0 -77
- package/_internal/IconButton-351389b0.js.map +0 -1
- package/_internal/ImageCaption-4109b433.js +0 -75
- package/_internal/ImageCaption-4109b433.js.map +0 -1
- package/_internal/List-b7882a99.js +0 -817
- package/_internal/List-b7882a99.js.map +0 -1
- package/_internal/PopoverDialog-2e7b9ed5.js +0 -655
- package/_internal/PopoverDialog-2e7b9ed5.js.map +0 -1
- package/_internal/Portal-3f86608e.js +0 -45
- package/_internal/Portal-3f86608e.js.map +0 -1
- package/_internal/RawClickable-2c2b6a89.js +0 -52
- package/_internal/RawClickable-2c2b6a89.js.map +0 -1
- package/_internal/Slides-83646e84.js +0 -679
- package/_internal/Slides-83646e84.js.map +0 -1
- package/_internal/ThemeContext-3181f000.js +0 -14
- package/_internal/ThemeContext-3181f000.js.map +0 -1
- package/_internal/Thumbnail-741501a5.js +0 -314
- package/_internal/Thumbnail-741501a5.js.map +0 -1
- package/_internal/check-circle-de24f857.js +0 -4
- package/_internal/check-circle-de24f857.js.map +0 -1
- package/_internal/chevron-right-827b804a.js +0 -6
- package/_internal/chevron-right-827b804a.js.map +0 -1
- package/_internal/chevron-up-0b9c76cb.js +0 -6
- package/_internal/chevron-up-0b9c76cb.js.map +0 -1
- package/_internal/close-circle-ef5d1aac.js +0 -4
- package/_internal/close-circle-ef5d1aac.js.map +0 -1
- package/_internal/close-eaf6c45a.js +0 -4
- package/_internal/close-eaf6c45a.js.map +0 -1
- package/_internal/components/alert-dialog-5df4f133.js +0 -163
- package/_internal/components/alert-dialog-5df4f133.js.map +0 -1
- package/_internal/components/autocomplete-824c779e.js +0 -261
- package/_internal/components/autocomplete-824c779e.js.map +0 -1
- package/_internal/components/avatar-69b66f01.js +0 -83
- package/_internal/components/avatar-69b66f01.js.map +0 -1
- package/_internal/components/badge-63cd3b1c.js +0 -81
- package/_internal/components/badge-63cd3b1c.js.map +0 -1
- package/_internal/components/button-eebd4e00.js +0 -47
- package/_internal/components/button-eebd4e00.js.map +0 -1
- package/_internal/components/checkbox-54943a02.js +0 -143
- package/_internal/components/checkbox-54943a02.js.map +0 -1
- package/_internal/components/chip-9ad6b318.js +0 -102
- package/_internal/components/chip-9ad6b318.js.map +0 -1
- package/_internal/components/comment-block-55a4ab3c.js +0 -138
- package/_internal/components/comment-block-55a4ab3c.js.map +0 -1
- package/_internal/components/date-picker-a824a3ae.js +0 -2
- package/_internal/components/date-picker-a824a3ae.js.map +0 -1
- package/_internal/components/dialog-5e6320b8.js +0 -238
- package/_internal/components/dialog-5e6320b8.js.map +0 -1
- package/_internal/components/divider-bdf11ba3.js +0 -50
- package/_internal/components/divider-bdf11ba3.js.map +0 -1
- package/_internal/components/drag-handle-45912fd3.js +0 -52
- package/_internal/components/drag-handle-45912fd3.js.map +0 -1
- package/_internal/components/dropdown-0216211d.js +0 -147
- package/_internal/components/dropdown-0216211d.js.map +0 -1
- package/_internal/components/expansion-panel-3ce73c6b.js +0 -167
- package/_internal/components/expansion-panel-3ce73c6b.js.map +0 -1
- package/_internal/components/flag-1b177f78.js +0 -59
- package/_internal/components/flag-1b177f78.js.map +0 -1
- package/_internal/components/flex-box-93b97715.js +0 -56
- package/_internal/components/flex-box-93b97715.js.map +0 -1
- package/_internal/components/generic-block-925f7c5b.js +0 -128
- package/_internal/components/generic-block-925f7c5b.js.map +0 -1
- package/_internal/components/grid-95fd1493.js +0 -104
- package/_internal/components/grid-95fd1493.js.map +0 -1
- package/_internal/components/grid-column-43f28cfb.js +0 -58
- package/_internal/components/grid-column-43f28cfb.js.map +0 -1
- package/_internal/components/heading-45d6e78e.js +0 -53
- package/_internal/components/heading-45d6e78e.js.map +0 -1
- package/_internal/components/icon-79195151.js +0 -2
- package/_internal/components/icon-79195151.js.map +0 -1
- package/_internal/components/image-block-aba6d2db.js +0 -110
- package/_internal/components/image-block-aba6d2db.js.map +0 -1
- package/_internal/components/image-lightbox-8b8e77c2.js +0 -759
- package/_internal/components/image-lightbox-8b8e77c2.js.map +0 -1
- package/_internal/components/inline-list-dfb9fd34.js +0 -74
- package/_internal/components/inline-list-dfb9fd34.js.map +0 -1
- package/_internal/components/input-helper-c8a0078b.js +0 -71
- package/_internal/components/input-helper-c8a0078b.js.map +0 -1
- package/_internal/components/input-label-9711398b.js +0 -59
- package/_internal/components/input-label-9711398b.js.map +0 -1
- package/_internal/components/lightbox-894abe64.js +0 -155
- package/_internal/components/lightbox-894abe64.js.map +0 -1
- package/_internal/components/link-e70e64ed.js +0 -72
- package/_internal/components/link-e70e64ed.js.map +0 -1
- package/_internal/components/link-preview-e56f3570.js +0 -117
- package/_internal/components/link-preview-e56f3570.js.map +0 -1
- package/_internal/components/list-59b7ce56.js +0 -71
- package/_internal/components/list-59b7ce56.js.map +0 -1
- package/_internal/components/message-a255dfd3.js +0 -98
- package/_internal/components/message-a255dfd3.js.map +0 -1
- package/_internal/components/mosaic-192f2270.js +0 -94
- package/_internal/components/mosaic-192f2270.js.map +0 -1
- package/_internal/components/navigation-dfe8aac0.js +0 -225
- package/_internal/components/navigation-dfe8aac0.js.map +0 -1
- package/_internal/components/notification-10f289b5.js +0 -143
- package/_internal/components/notification-10f289b5.js.map +0 -1
- package/_internal/components/popover-6c7f745b.js +0 -3
- package/_internal/components/popover-6c7f745b.js.map +0 -1
- package/_internal/components/post-block-f7dcc6e9.js +0 -109
- package/_internal/components/post-block-f7dcc6e9.js.map +0 -1
- package/_internal/components/progress-7a05fb0c.js +0 -182
- package/_internal/components/progress-7a05fb0c.js.map +0 -1
- package/_internal/components/progress-tracker-48876add.js +0 -309
- package/_internal/components/progress-tracker-48876add.js.map +0 -1
- package/_internal/components/radio-button-07cf45e9.js +0 -149
- package/_internal/components/radio-button-07cf45e9.js.map +0 -1
- package/_internal/components/select-8b54a444.js +0 -457
- package/_internal/components/select-8b54a444.js.map +0 -1
- package/_internal/components/side-navigation-7eeed3b4.js +0 -164
- package/_internal/components/side-navigation-7eeed3b4.js.map +0 -1
- package/_internal/components/skeleton-a4e84085.js +0 -166
- package/_internal/components/skeleton-a4e84085.js.map +0 -1
- package/_internal/components/slider-5d64b470.js +0 -311
- package/_internal/components/slider-5d64b470.js.map +0 -1
- package/_internal/components/slideshow-bce65cf6.js +0 -151
- package/_internal/components/slideshow-bce65cf6.js.map +0 -1
- package/_internal/components/switch-7ae55d89.js +0 -121
- package/_internal/components/switch-7ae55d89.js.map +0 -1
- package/_internal/components/table-5bdf4aec.js +0 -297
- package/_internal/components/table-5bdf4aec.js.map +0 -1
- package/_internal/components/tabs-2ad54592.js +0 -298
- package/_internal/components/tabs-2ad54592.js.map +0 -1
- package/_internal/components/text-09c81111.js +0 -2
- package/_internal/components/text-09c81111.js.map +0 -1
- package/_internal/components/text-field-3e1030f0.js +0 -359
- package/_internal/components/text-field-3e1030f0.js.map +0 -1
- package/_internal/components/thumbnail-1c5828b9.js +0 -42
- package/_internal/components/thumbnail-1c5828b9.js.map +0 -1
- package/_internal/components/toolbar-0d14efb7.js +0 -61
- package/_internal/components/toolbar-0d14efb7.js.map +0 -1
- package/_internal/components/tooltip-31181a24.js +0 -327
- package/_internal/components/tooltip-31181a24.js.map +0 -1
- package/_internal/components/uploader-845b2412.js +0 -153
- package/_internal/components/uploader-845b2412.js.map +0 -1
- package/_internal/components/user-block-91c30797.js +0 -144
- package/_internal/components/user-block-91c30797.js.map +0 -1
- package/_internal/constants-9b714e31.js +0 -2167
- package/_internal/constants-9b714e31.js.map +0 -1
- package/_internal/constants-d0e3f49e.js +0 -24
- package/_internal/constants-d0e3f49e.js.map +0 -1
- package/_internal/context-9d1336a1.js +0 -19
- package/_internal/context-9d1336a1.js.map +0 -1
- package/_internal/forwardRef-d0e90329.js +0 -82
- package/_internal/forwardRef-d0e90329.js.map +0 -1
- package/_internal/getFocusableElements-230173a8.js +0 -13
- package/_internal/getFocusableElements-230173a8.js.map +0 -1
- package/_internal/index-68e1b0af.js +0 -436
- package/_internal/index-68e1b0af.js.map +0 -1
- package/_internal/index-745f94ee.js +0 -103
- package/_internal/index-745f94ee.js.map +0 -1
- package/_internal/index-ab520e78.js +0 -117
- package/_internal/index-ab520e78.js.map +0 -1
- package/_internal/information-49bbeed3.js +0 -6
- package/_internal/information-49bbeed3.js.map +0 -1
- package/_internal/isComponent-b9762ff1.js +0 -18
- package/_internal/isComponent-b9762ff1.js.map +0 -1
- package/_internal/isComponentType-e806b848.js +0 -9
- package/_internal/isComponentType-e806b848.js.map +0 -1
- package/_internal/mergeRefs-f0d7d6ea.js +0 -30
- package/_internal/mergeRefs-f0d7d6ea.js.map +0 -1
- package/_internal/state-db358714.js +0 -130
- package/_internal/state-db358714.js.map +0 -1
- package/_internal/useBooleanState-2a3d237c.js +0 -12
- package/_internal/useBooleanState-2a3d237c.js.map +0 -1
- package/_internal/useCallbackOnEscape-0b220f9c.js +0 -62
- package/_internal/useCallbackOnEscape-0b220f9c.js.map +0 -1
- package/_internal/useDisableBodyScroll-36bd7352.js +0 -219
- package/_internal/useDisableBodyScroll-36bd7352.js.map +0 -1
- package/_internal/useDisableStateProps-69e16b7c.js +0 -36
- package/_internal/useDisableStateProps-69e16b7c.js.map +0 -1
- package/_internal/useFocusTrap-3114e5e8.js +0 -112
- package/_internal/useFocusTrap-3114e5e8.js.map +0 -1
- package/_internal/useId-3a1facc0.js +0 -18
- package/_internal/useId-3a1facc0.js.map +0 -1
- package/_internal/useRovingTabIndex-7daf0f24.js +0 -77
- package/_internal/useRovingTabIndex-7daf0f24.js.map +0 -1
- package/_internal/useTransitionVisibility-321fdbfa.js +0 -50
- package/_internal/useTransitionVisibility-321fdbfa.js.map +0 -1
- package/_internal/wrapChildrenIconWithSpaces-e6038f72.js +0 -20
- package/_internal/wrapChildrenIconWithSpaces-e6038f72.js.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { f as forwardRef, c as classNames } from '../forwardRef-d0e90329.js';
|
|
2
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
|
-
import { u as useId } from '../useId-3a1facc0.js';
|
|
4
|
-
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
5
|
-
import { u as useDisableStateProps } from '../useDisableStateProps-69e16b7c.js';
|
|
6
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { Theme } from '@lumx/core/js/constants';
|
|
8
|
-
import { InputLabel } from './input-label-9711398b.js';
|
|
9
|
-
import { InputHelper } from './input-helper-c8a0078b.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Component display name.
|
|
13
|
-
*/
|
|
14
|
-
const COMPONENT_NAME$1 = 'RadioButton';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Component default class name and class prefix.
|
|
18
|
-
*/
|
|
19
|
-
const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Component default props.
|
|
23
|
-
*/
|
|
24
|
-
const DEFAULT_PROPS = {};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* RadioButton component.
|
|
28
|
-
*
|
|
29
|
-
* @param props Component props.
|
|
30
|
-
* @param ref Component ref.
|
|
31
|
-
* @return React element.
|
|
32
|
-
*/
|
|
33
|
-
const RadioButton = forwardRef((props, ref) => {
|
|
34
|
-
const {
|
|
35
|
-
isAnyDisabled,
|
|
36
|
-
disabledStateProps,
|
|
37
|
-
otherProps
|
|
38
|
-
} = useDisableStateProps(props);
|
|
39
|
-
const defaultTheme = useTheme() || Theme.light;
|
|
40
|
-
const {
|
|
41
|
-
checked,
|
|
42
|
-
className,
|
|
43
|
-
helper,
|
|
44
|
-
id,
|
|
45
|
-
inputRef,
|
|
46
|
-
isChecked = checked,
|
|
47
|
-
label,
|
|
48
|
-
name,
|
|
49
|
-
onChange,
|
|
50
|
-
theme = defaultTheme,
|
|
51
|
-
value,
|
|
52
|
-
inputProps,
|
|
53
|
-
...forwardedProps
|
|
54
|
-
} = otherProps;
|
|
55
|
-
const generatedInputId = useId();
|
|
56
|
-
const inputId = id || generatedInputId;
|
|
57
|
-
const handleChange = event => {
|
|
58
|
-
if (onChange) {
|
|
59
|
-
onChange(value, name, event);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return /*#__PURE__*/jsxs("div", {
|
|
63
|
-
ref: ref,
|
|
64
|
-
...forwardedProps,
|
|
65
|
-
className: classNames(className, handleBasicClasses({
|
|
66
|
-
isChecked,
|
|
67
|
-
isDisabled: isAnyDisabled,
|
|
68
|
-
isUnchecked: !isChecked,
|
|
69
|
-
prefix: CLASSNAME$1,
|
|
70
|
-
theme
|
|
71
|
-
})),
|
|
72
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
73
|
-
className: `${CLASSNAME$1}__input-wrapper`,
|
|
74
|
-
children: [/*#__PURE__*/jsx("input", {
|
|
75
|
-
ref: inputRef,
|
|
76
|
-
className: `${CLASSNAME$1}__input-native`,
|
|
77
|
-
...disabledStateProps,
|
|
78
|
-
id: inputId,
|
|
79
|
-
type: "radio",
|
|
80
|
-
name: name,
|
|
81
|
-
value: value,
|
|
82
|
-
checked: isChecked,
|
|
83
|
-
onChange: handleChange,
|
|
84
|
-
readOnly: inputProps?.readOnly || isAnyDisabled,
|
|
85
|
-
"aria-describedby": helper ? `${inputId}-helper` : undefined,
|
|
86
|
-
...inputProps
|
|
87
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
88
|
-
className: `${CLASSNAME$1}__input-placeholder`,
|
|
89
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
90
|
-
className: `${CLASSNAME$1}__input-background`
|
|
91
|
-
}), /*#__PURE__*/jsx("div", {
|
|
92
|
-
className: `${CLASSNAME$1}__input-indicator`
|
|
93
|
-
})]
|
|
94
|
-
})]
|
|
95
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
96
|
-
className: `${CLASSNAME$1}__content`,
|
|
97
|
-
children: [label && /*#__PURE__*/jsx(InputLabel, {
|
|
98
|
-
htmlFor: inputId,
|
|
99
|
-
theme: theme,
|
|
100
|
-
className: `${CLASSNAME$1}__label`,
|
|
101
|
-
children: label
|
|
102
|
-
}), helper && /*#__PURE__*/jsx(InputHelper, {
|
|
103
|
-
id: `${inputId}-helper`,
|
|
104
|
-
theme: theme,
|
|
105
|
-
className: `${CLASSNAME$1}__helper`,
|
|
106
|
-
children: helper
|
|
107
|
-
})]
|
|
108
|
-
})]
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
RadioButton.displayName = COMPONENT_NAME$1;
|
|
112
|
-
RadioButton.className = CLASSNAME$1;
|
|
113
|
-
RadioButton.defaultProps = DEFAULT_PROPS;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Component display name.
|
|
117
|
-
*/
|
|
118
|
-
const COMPONENT_NAME = 'RadioGroup';
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Component default class name and class prefix.
|
|
122
|
-
*/
|
|
123
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* RadioGroup component.
|
|
127
|
-
*
|
|
128
|
-
* @param props Component props.
|
|
129
|
-
* @param ref Component ref.
|
|
130
|
-
* @return React element.
|
|
131
|
-
*/
|
|
132
|
-
const RadioGroup = forwardRef((props, ref) => {
|
|
133
|
-
const {
|
|
134
|
-
children,
|
|
135
|
-
className,
|
|
136
|
-
...forwardedProps
|
|
137
|
-
} = props;
|
|
138
|
-
return /*#__PURE__*/jsx("div", {
|
|
139
|
-
ref: ref,
|
|
140
|
-
...forwardedProps,
|
|
141
|
-
className: classNames(className, CLASSNAME),
|
|
142
|
-
children: children
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
RadioGroup.displayName = COMPONENT_NAME;
|
|
146
|
-
RadioGroup.className = CLASSNAME;
|
|
147
|
-
|
|
148
|
-
export { RadioButton, RadioGroup };
|
|
149
|
-
//# sourceMappingURL=radio-button-07cf45e9.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button-07cf45e9.js","sources":["../../../src/components/radio-button/RadioButton.tsx","../../../src/components/radio-button/RadioGroup.tsx"],"sourcesContent":["import { ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport { InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useId } from '@lumx/react/hooks/useId';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\nimport { HasAriaDisabled } from '@lumx/react/utils/type/HasAriaDisabled';\n\n/**\n * Defines the props of the component.\n */\nexport interface RadioButtonProps extends GenericProps, HasTheme, HasAriaDisabled {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Native input ref. */\n inputRef?: React.Ref<HTMLInputElement>;\n /** Whether it is checked or not. */\n isChecked?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label content. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Native input value property. */\n value?: string;\n /** On change callback. */\n onChange?(value?: string, name?: string, event?: SyntheticEvent): void;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'RadioButton';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<RadioButtonProps> = {};\n\n/**\n * RadioButton component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const RadioButton = forwardRef<RadioButtonProps, HTMLDivElement>((props, ref) => {\n const { isAnyDisabled, disabledStateProps, otherProps } = useDisableStateProps(props);\n const defaultTheme = useTheme() || Theme.light;\n const {\n checked,\n className,\n helper,\n id,\n inputRef,\n isChecked = checked,\n label,\n name,\n onChange,\n theme = defaultTheme,\n value,\n inputProps,\n ...forwardedProps\n } = otherProps;\n const generatedInputId = useId();\n const inputId = id || generatedInputId;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(value, name, event);\n }\n };\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n isChecked,\n isDisabled: isAnyDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n ref={inputRef}\n className={`${CLASSNAME}__input-native`}\n {...disabledStateProps}\n id={inputId}\n type=\"radio\"\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n readOnly={inputProps?.readOnly || isAnyDisabled}\n aria-describedby={helper ? `${inputId}-helper` : undefined}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n <div className={`${CLASSNAME}__input-indicator`} />\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} theme={theme} className={`${CLASSNAME}__label`}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper id={`${inputId}-helper`} theme={theme} className={`${CLASSNAME}__helper`}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nRadioButton.displayName = COMPONENT_NAME;\nRadioButton.className = CLASSNAME;\nRadioButton.defaultProps = DEFAULT_PROPS;\n","import { ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\n/**\n * Defines the props of the component.\n */\nexport interface RadioGroupProps extends GenericProps {\n /** RadioButton elements */\n children: ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'RadioGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * RadioGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const RadioGroup = forwardRef<RadioGroupProps, HTMLDivElement>((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n {children}\n </div>\n );\n});\nRadioGroup.displayName = COMPONENT_NAME;\nRadioGroup.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","RadioButton","forwardRef","props","ref","isAnyDisabled","disabledStateProps","otherProps","useDisableStateProps","defaultTheme","useTheme","Theme","light","checked","className","helper","id","inputRef","isChecked","label","name","onChange","theme","value","inputProps","forwardedProps","generatedInputId","useId","inputId","handleChange","event","_jsxs","classNames","handleBasicClasses","isDisabled","isUnchecked","prefix","children","_jsx","type","readOnly","undefined","InputLabel","htmlFor","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EkB,UAAU,CAAClB,SAAS,EAAEhB,SAAS,CAAE;AAAAuC,IAAAA,QAAA,EAC1EA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAEd,CAAC,EAAC;AACFU,UAAU,CAACF,WAAW,GAAGhD,cAAc,CAAA;AACvCkD,UAAU,CAACjC,SAAS,GAAGhB,SAAS;;;;"}
|
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
import { c as classNames, f as forwardRef } from '../forwardRef-d0e90329.js';
|
|
2
|
-
import { Theme, Kind, Size, Emphasis } from '@lumx/core/js/constants';
|
|
3
|
-
import { I as IconButton } from '../IconButton-351389b0.js';
|
|
4
|
-
import { C as Chip } from '../Chip-8d0aae06.js';
|
|
5
|
-
import { I as Icon, m as mdiAlertCircle } from '../index-745f94ee.js';
|
|
6
|
-
import { InputLabel } from './input-label-9711398b.js';
|
|
7
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
8
|
-
import { m as mergeRefs } from '../mergeRefs-f0d7d6ea.js';
|
|
9
|
-
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
10
|
-
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
11
|
-
import { Dropdown } from './dropdown-0216211d.js';
|
|
12
|
-
import { InputHelper } from './input-helper-c8a0078b.js';
|
|
13
|
-
import { u as useFocusTrap } from '../useFocusTrap-3114e5e8.js';
|
|
14
|
-
import { u as useId } from '../useId-3a1facc0.js';
|
|
15
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
16
|
-
import { P as Placement } from '../constants-9b714e31.js';
|
|
17
|
-
import { m as mdiCloseCircle } from '../close-circle-ef5d1aac.js';
|
|
18
|
-
import { m as mdiCheckCircle } from '../check-circle-de24f857.js';
|
|
19
|
-
import { m as mdiClose } from '../close-eaf6c45a.js';
|
|
20
|
-
|
|
21
|
-
const mdiMenuDown = 'm7 10 5 5 5-5z';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Listen on element focus to store the focus status.
|
|
25
|
-
*/
|
|
26
|
-
function useListenFocus(ref) {
|
|
27
|
-
const [isFocus, setFocus] = useState(false);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const {
|
|
30
|
-
current: element
|
|
31
|
-
} = ref;
|
|
32
|
-
if (!element) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
const onFocus = () => setFocus(true);
|
|
36
|
-
const onBlur = () => setFocus(false);
|
|
37
|
-
element.addEventListener('focus', onFocus);
|
|
38
|
-
element.addEventListener('blur', onBlur);
|
|
39
|
-
return () => {
|
|
40
|
-
element.removeEventListener('focus', onFocus);
|
|
41
|
-
element.removeEventListener('blur', onBlur);
|
|
42
|
-
};
|
|
43
|
-
}, [ref, setFocus]);
|
|
44
|
-
return isFocus;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** The display name of the component. */
|
|
48
|
-
const COMPONENT_NAME$2 = 'Select';
|
|
49
|
-
|
|
50
|
-
/** The default class name and classes prefix for this component. */
|
|
51
|
-
const CLASSNAME$2 = getRootClassName(COMPONENT_NAME$2);
|
|
52
|
-
const WithSelectContext = (SelectElement, props, ref) => {
|
|
53
|
-
const defaultTheme = useTheme() || Theme.light;
|
|
54
|
-
const {
|
|
55
|
-
children,
|
|
56
|
-
className,
|
|
57
|
-
focusElement,
|
|
58
|
-
isMultiple,
|
|
59
|
-
closeOnClick = !isMultiple,
|
|
60
|
-
disabled,
|
|
61
|
-
error,
|
|
62
|
-
hasError,
|
|
63
|
-
helper,
|
|
64
|
-
id,
|
|
65
|
-
isDisabled = disabled,
|
|
66
|
-
isEmpty,
|
|
67
|
-
isOpen,
|
|
68
|
-
isRequired,
|
|
69
|
-
isValid,
|
|
70
|
-
label,
|
|
71
|
-
onClear,
|
|
72
|
-
onDropdownClose,
|
|
73
|
-
onInfiniteScroll,
|
|
74
|
-
onInputClick,
|
|
75
|
-
placeholder,
|
|
76
|
-
theme = defaultTheme,
|
|
77
|
-
value,
|
|
78
|
-
variant,
|
|
79
|
-
...forwardedProps
|
|
80
|
-
} = props;
|
|
81
|
-
const generatedSelectId = useId();
|
|
82
|
-
const selectId = id || generatedSelectId;
|
|
83
|
-
const anchorRef = useRef(null);
|
|
84
|
-
const selectRef = useRef(null);
|
|
85
|
-
const dropdownRef = useRef(null);
|
|
86
|
-
const isFocus = useListenFocus(anchorRef);
|
|
87
|
-
const handleKeyboardNav = useCallback(evt => {
|
|
88
|
-
if ((evt.key === 'Enter' || evt.key === ' ' || evt.key === 'ArrowDown') && onInputClick) {
|
|
89
|
-
evt.preventDefault();
|
|
90
|
-
onInputClick();
|
|
91
|
-
}
|
|
92
|
-
}, [onInputClick]);
|
|
93
|
-
const onClose = () => {
|
|
94
|
-
if (onDropdownClose) {
|
|
95
|
-
onDropdownClose();
|
|
96
|
-
}
|
|
97
|
-
anchorRef?.current?.blur();
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// Handle focus trap.
|
|
101
|
-
useFocusTrap(isOpen && dropdownRef.current, focusElement?.current);
|
|
102
|
-
return /*#__PURE__*/jsxs("div", {
|
|
103
|
-
ref: mergeRefs(ref, selectRef),
|
|
104
|
-
className: classNames(className, handleBasicClasses({
|
|
105
|
-
hasError,
|
|
106
|
-
hasLabel: Boolean(label),
|
|
107
|
-
hasPlaceholder: Boolean(placeholder),
|
|
108
|
-
hasValue: !isEmpty,
|
|
109
|
-
isDisabled,
|
|
110
|
-
isEmpty,
|
|
111
|
-
isFocus,
|
|
112
|
-
isOpen,
|
|
113
|
-
isValid,
|
|
114
|
-
prefix: CLASSNAME$2,
|
|
115
|
-
theme: theme === Theme.light ? Theme.light : Theme.dark
|
|
116
|
-
})),
|
|
117
|
-
children: [/*#__PURE__*/jsx(SelectElement, {
|
|
118
|
-
...forwardedProps,
|
|
119
|
-
anchorRef: anchorRef,
|
|
120
|
-
"aria-disabled": isDisabled,
|
|
121
|
-
handleKeyboardNav: handleKeyboardNav,
|
|
122
|
-
hasError: hasError,
|
|
123
|
-
isDisabled: isDisabled,
|
|
124
|
-
isEmpty: isEmpty,
|
|
125
|
-
isRequired: isRequired,
|
|
126
|
-
isValid: isValid,
|
|
127
|
-
label: label,
|
|
128
|
-
placeholder: placeholder,
|
|
129
|
-
id: selectId,
|
|
130
|
-
theme: theme,
|
|
131
|
-
value: value,
|
|
132
|
-
variant: variant,
|
|
133
|
-
onClear: onClear,
|
|
134
|
-
onInputClick: onInputClick
|
|
135
|
-
}), /*#__PURE__*/jsx(Dropdown, {
|
|
136
|
-
anchorRef: anchorRef,
|
|
137
|
-
closeOnClick: closeOnClick,
|
|
138
|
-
closeOnClickAway: true,
|
|
139
|
-
closeOnEscape: true,
|
|
140
|
-
isOpen: !!isOpen,
|
|
141
|
-
placement: Placement.BOTTOM_START,
|
|
142
|
-
onClose: onClose,
|
|
143
|
-
onInfiniteScroll: onInfiniteScroll,
|
|
144
|
-
ref: dropdownRef,
|
|
145
|
-
children: children
|
|
146
|
-
}), hasError && error && /*#__PURE__*/jsx(InputHelper, {
|
|
147
|
-
className: `${CLASSNAME$2}__helper`,
|
|
148
|
-
kind: Kind.error,
|
|
149
|
-
theme: theme,
|
|
150
|
-
children: error
|
|
151
|
-
}), helper && /*#__PURE__*/jsx(InputHelper, {
|
|
152
|
-
className: `${CLASSNAME$2}__helper`,
|
|
153
|
-
theme: theme,
|
|
154
|
-
children: helper
|
|
155
|
-
})]
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Select variants.
|
|
161
|
-
*/
|
|
162
|
-
const SelectVariant = {
|
|
163
|
-
input: 'input',
|
|
164
|
-
chip: 'chip'
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/** The display name of the component. */
|
|
168
|
-
const COMPONENT_NAME$1 = 'Select';
|
|
169
|
-
|
|
170
|
-
/** The default class name and classes prefix for this component. */
|
|
171
|
-
const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
|
|
172
|
-
|
|
173
|
-
/** The default value of props. */
|
|
174
|
-
const DEFAULT_PROPS$1 = {
|
|
175
|
-
selectedValueRender: choice => choice,
|
|
176
|
-
variant: SelectVariant.input
|
|
177
|
-
};
|
|
178
|
-
const stopPropagation = evt => evt.stopPropagation();
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Select component.
|
|
182
|
-
*/
|
|
183
|
-
const SelectField = props => {
|
|
184
|
-
const defaultTheme = useTheme();
|
|
185
|
-
const {
|
|
186
|
-
anchorRef,
|
|
187
|
-
clearButtonProps,
|
|
188
|
-
handleKeyboardNav,
|
|
189
|
-
hasError,
|
|
190
|
-
hasInputClear,
|
|
191
|
-
icon,
|
|
192
|
-
id,
|
|
193
|
-
isDisabled,
|
|
194
|
-
isEmpty,
|
|
195
|
-
isRequired,
|
|
196
|
-
isValid,
|
|
197
|
-
label,
|
|
198
|
-
onClear,
|
|
199
|
-
onInputClick,
|
|
200
|
-
placeholder,
|
|
201
|
-
selectedValueRender,
|
|
202
|
-
theme = defaultTheme,
|
|
203
|
-
value,
|
|
204
|
-
variant,
|
|
205
|
-
selectElementRef,
|
|
206
|
-
...forwardedProps
|
|
207
|
-
} = props;
|
|
208
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
209
|
-
children: [variant === SelectVariant.input && /*#__PURE__*/jsxs(Fragment, {
|
|
210
|
-
children: [label && /*#__PURE__*/jsx("div", {
|
|
211
|
-
className: `${CLASSNAME$1}__header`,
|
|
212
|
-
children: /*#__PURE__*/jsx(InputLabel, {
|
|
213
|
-
htmlFor: id,
|
|
214
|
-
className: `${CLASSNAME$1}__label`,
|
|
215
|
-
isRequired: isRequired,
|
|
216
|
-
theme: theme,
|
|
217
|
-
children: label
|
|
218
|
-
})
|
|
219
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
220
|
-
ref: mergeRefs(anchorRef, selectElementRef),
|
|
221
|
-
id: id,
|
|
222
|
-
className: `${CLASSNAME$1}__wrapper`,
|
|
223
|
-
onClick: onInputClick,
|
|
224
|
-
onKeyDown: handleKeyboardNav,
|
|
225
|
-
tabIndex: isDisabled ? undefined : 0,
|
|
226
|
-
"aria-disabled": isDisabled || undefined,
|
|
227
|
-
...forwardedProps,
|
|
228
|
-
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
229
|
-
className: `${CLASSNAME$1}__input-icon`,
|
|
230
|
-
color: theme === Theme.dark ? 'light' : undefined,
|
|
231
|
-
icon: icon,
|
|
232
|
-
size: Size.xs
|
|
233
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
234
|
-
className: classNames([`${CLASSNAME$1}__input-native`, isEmpty && placeholder && `${CLASSNAME$1}__input-native--placeholder`]),
|
|
235
|
-
children: [!isEmpty && /*#__PURE__*/jsx("span", {
|
|
236
|
-
children: selectedValueRender?.(value)
|
|
237
|
-
}), isEmpty && placeholder && /*#__PURE__*/jsx("span", {
|
|
238
|
-
children: placeholder
|
|
239
|
-
})]
|
|
240
|
-
}), (isValid || hasError) && /*#__PURE__*/jsx("div", {
|
|
241
|
-
className: `${CLASSNAME$1}__input-validity`,
|
|
242
|
-
children: /*#__PURE__*/jsx(Icon, {
|
|
243
|
-
icon: isValid ? mdiCheckCircle : mdiAlertCircle,
|
|
244
|
-
size: Size.xxs
|
|
245
|
-
})
|
|
246
|
-
}), hasInputClear && clearButtonProps && /*#__PURE__*/jsx(IconButton, {
|
|
247
|
-
...clearButtonProps,
|
|
248
|
-
className: `${CLASSNAME$1}__input-clear`,
|
|
249
|
-
icon: mdiCloseCircle,
|
|
250
|
-
emphasis: Emphasis.low,
|
|
251
|
-
size: Size.s,
|
|
252
|
-
theme: theme,
|
|
253
|
-
onClick: onClear,
|
|
254
|
-
onKeyDown: stopPropagation
|
|
255
|
-
}), /*#__PURE__*/jsx("div", {
|
|
256
|
-
className: `${CLASSNAME$1}__input-indicator`,
|
|
257
|
-
children: /*#__PURE__*/jsx(Icon, {
|
|
258
|
-
icon: mdiMenuDown,
|
|
259
|
-
size: Size.s
|
|
260
|
-
})
|
|
261
|
-
})]
|
|
262
|
-
})]
|
|
263
|
-
}), variant === SelectVariant.chip && /*#__PURE__*/jsxs(Chip, {
|
|
264
|
-
id: id,
|
|
265
|
-
isSelected: !isEmpty,
|
|
266
|
-
isDisabled: isDisabled,
|
|
267
|
-
after: /*#__PURE__*/jsx(Icon, {
|
|
268
|
-
icon: isEmpty ? mdiMenuDown : mdiCloseCircle
|
|
269
|
-
}),
|
|
270
|
-
onAfterClick: isEmpty ? onInputClick : onClear,
|
|
271
|
-
onClick: onInputClick,
|
|
272
|
-
ref: mergeRefs(anchorRef, selectElementRef),
|
|
273
|
-
theme: theme,
|
|
274
|
-
...forwardedProps,
|
|
275
|
-
children: [isEmpty && /*#__PURE__*/jsx("span", {
|
|
276
|
-
children: label
|
|
277
|
-
}), !isEmpty && /*#__PURE__*/jsx("span", {
|
|
278
|
-
children: selectedValueRender?.(value)
|
|
279
|
-
})]
|
|
280
|
-
})]
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Select component.
|
|
286
|
-
*
|
|
287
|
-
* @param props Component props.
|
|
288
|
-
* @param ref Component ref.
|
|
289
|
-
* @return React element.
|
|
290
|
-
*/
|
|
291
|
-
const Select = forwardRef((props, ref) => {
|
|
292
|
-
const isEmpty = !props.value;
|
|
293
|
-
const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty;
|
|
294
|
-
return WithSelectContext(SelectField, {
|
|
295
|
-
...DEFAULT_PROPS$1,
|
|
296
|
-
...props,
|
|
297
|
-
className: classNames(props.className, handleBasicClasses({
|
|
298
|
-
hasInputClear,
|
|
299
|
-
hasUnique: !props.isEmpty,
|
|
300
|
-
prefix: CLASSNAME$1
|
|
301
|
-
})),
|
|
302
|
-
hasInputClear,
|
|
303
|
-
isEmpty
|
|
304
|
-
}, ref);
|
|
305
|
-
});
|
|
306
|
-
Select.displayName = COMPONENT_NAME$1;
|
|
307
|
-
Select.className = CLASSNAME$1;
|
|
308
|
-
Select.defaultProps = DEFAULT_PROPS$1;
|
|
309
|
-
Select.className = CLASSNAME$1;
|
|
310
|
-
|
|
311
|
-
/** The display name of the component. */
|
|
312
|
-
const COMPONENT_NAME = 'Select';
|
|
313
|
-
|
|
314
|
-
/** The default class name and classes prefix for this component. */
|
|
315
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
316
|
-
|
|
317
|
-
/** The default value of props. */
|
|
318
|
-
const DEFAULT_PROPS = {
|
|
319
|
-
selectedChipRender(choice, index, onClear, isDisabled, theme) {
|
|
320
|
-
const onClick = event => onClear && onClear(event, choice);
|
|
321
|
-
return /*#__PURE__*/jsx(Chip, {
|
|
322
|
-
after: onClear && /*#__PURE__*/jsx(Icon, {
|
|
323
|
-
icon: mdiClose,
|
|
324
|
-
size: Size.xxs
|
|
325
|
-
}),
|
|
326
|
-
isDisabled: isDisabled,
|
|
327
|
-
size: Size.s,
|
|
328
|
-
onAfterClick: onClick,
|
|
329
|
-
onClick: onClick,
|
|
330
|
-
theme: theme,
|
|
331
|
-
children: choice
|
|
332
|
-
}, index);
|
|
333
|
-
},
|
|
334
|
-
selectedValueRender: choice => choice,
|
|
335
|
-
variant: SelectVariant.input
|
|
336
|
-
};
|
|
337
|
-
const SelectMultipleField = props => {
|
|
338
|
-
const defaultTheme = useTheme();
|
|
339
|
-
const {
|
|
340
|
-
anchorRef,
|
|
341
|
-
handleKeyboardNav,
|
|
342
|
-
hasError,
|
|
343
|
-
icon,
|
|
344
|
-
id,
|
|
345
|
-
isDisabled,
|
|
346
|
-
isEmpty,
|
|
347
|
-
isRequired,
|
|
348
|
-
isValid,
|
|
349
|
-
label,
|
|
350
|
-
onClear,
|
|
351
|
-
onInputClick,
|
|
352
|
-
placeholder,
|
|
353
|
-
selectedChipRender,
|
|
354
|
-
selectedValueRender,
|
|
355
|
-
theme = defaultTheme,
|
|
356
|
-
value,
|
|
357
|
-
variant,
|
|
358
|
-
selectElementRef,
|
|
359
|
-
...forwardedProps
|
|
360
|
-
} = props;
|
|
361
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
362
|
-
children: [variant === SelectVariant.input && /*#__PURE__*/jsxs(Fragment, {
|
|
363
|
-
children: [label && /*#__PURE__*/jsx("div", {
|
|
364
|
-
className: `${CLASSNAME}__header`,
|
|
365
|
-
children: /*#__PURE__*/jsx(InputLabel, {
|
|
366
|
-
htmlFor: id,
|
|
367
|
-
className: `${CLASSNAME}__label`,
|
|
368
|
-
isRequired: isRequired,
|
|
369
|
-
theme: theme,
|
|
370
|
-
children: label
|
|
371
|
-
})
|
|
372
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
373
|
-
ref: mergeRefs(anchorRef, selectElementRef),
|
|
374
|
-
id: id,
|
|
375
|
-
className: `${CLASSNAME}__wrapper`,
|
|
376
|
-
onClick: onInputClick,
|
|
377
|
-
onKeyDown: handleKeyboardNav,
|
|
378
|
-
tabIndex: isDisabled ? undefined : 0,
|
|
379
|
-
"aria-disabled": isDisabled || undefined,
|
|
380
|
-
...forwardedProps,
|
|
381
|
-
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
382
|
-
className: `${CLASSNAME}__input-icon`,
|
|
383
|
-
color: theme === Theme.dark ? 'light' : undefined,
|
|
384
|
-
icon: icon,
|
|
385
|
-
size: Size.xs
|
|
386
|
-
}), /*#__PURE__*/jsx("div", {
|
|
387
|
-
className: `${CLASSNAME}__chips`,
|
|
388
|
-
children: !isEmpty && value.map((val, index) => selectedChipRender?.(val, index, onClear, isDisabled, theme))
|
|
389
|
-
}), isEmpty && placeholder && /*#__PURE__*/jsx("div", {
|
|
390
|
-
className: classNames([`${CLASSNAME}__input-native`, `${CLASSNAME}__input-native--placeholder`]),
|
|
391
|
-
children: /*#__PURE__*/jsx("span", {
|
|
392
|
-
children: placeholder
|
|
393
|
-
})
|
|
394
|
-
}), (isValid || hasError) && /*#__PURE__*/jsx("div", {
|
|
395
|
-
className: `${CLASSNAME}__input-validity`,
|
|
396
|
-
children: /*#__PURE__*/jsx(Icon, {
|
|
397
|
-
icon: isValid ? mdiCheckCircle : mdiAlertCircle,
|
|
398
|
-
size: Size.xxs
|
|
399
|
-
})
|
|
400
|
-
}), /*#__PURE__*/jsx("div", {
|
|
401
|
-
className: `${CLASSNAME}__input-indicator`,
|
|
402
|
-
children: /*#__PURE__*/jsx(Icon, {
|
|
403
|
-
icon: mdiMenuDown,
|
|
404
|
-
size: Size.s
|
|
405
|
-
})
|
|
406
|
-
})]
|
|
407
|
-
})]
|
|
408
|
-
}), variant === SelectVariant.chip && /*#__PURE__*/jsxs(Chip, {
|
|
409
|
-
id: id,
|
|
410
|
-
isSelected: !isEmpty,
|
|
411
|
-
isDisabled: isDisabled,
|
|
412
|
-
after: /*#__PURE__*/jsx(Icon, {
|
|
413
|
-
icon: isEmpty ? mdiMenuDown : mdiCloseCircle
|
|
414
|
-
}),
|
|
415
|
-
onAfterClick: isEmpty ? onInputClick : onClear,
|
|
416
|
-
onClick: onInputClick,
|
|
417
|
-
ref: mergeRefs(anchorRef, selectElementRef),
|
|
418
|
-
theme: theme,
|
|
419
|
-
...forwardedProps,
|
|
420
|
-
children: [isEmpty && /*#__PURE__*/jsx("span", {
|
|
421
|
-
children: label
|
|
422
|
-
}), !isEmpty && /*#__PURE__*/jsxs("span", {
|
|
423
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
424
|
-
children: selectedValueRender?.(value[0])
|
|
425
|
-
}), value.length > 1 && /*#__PURE__*/jsxs("span", {
|
|
426
|
-
children: ["\xA0+", value.length - 1]
|
|
427
|
-
})]
|
|
428
|
-
})]
|
|
429
|
-
})]
|
|
430
|
-
});
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* SelectMultiple component.
|
|
435
|
-
*
|
|
436
|
-
* @param props Component props.
|
|
437
|
-
* @param ref Component ref.
|
|
438
|
-
* @return React element.
|
|
439
|
-
*/
|
|
440
|
-
const SelectMultiple = forwardRef((props, ref) => {
|
|
441
|
-
return WithSelectContext(SelectMultipleField, {
|
|
442
|
-
...DEFAULT_PROPS,
|
|
443
|
-
...props,
|
|
444
|
-
className: classNames(props.className, handleBasicClasses({
|
|
445
|
-
hasMultiple: !props.isEmpty,
|
|
446
|
-
prefix: CLASSNAME
|
|
447
|
-
})),
|
|
448
|
-
isEmpty: props.value.length === 0,
|
|
449
|
-
isMultiple: true
|
|
450
|
-
}, ref);
|
|
451
|
-
});
|
|
452
|
-
SelectMultiple.displayName = COMPONENT_NAME;
|
|
453
|
-
SelectMultiple.className = CLASSNAME;
|
|
454
|
-
SelectMultiple.defaultProps = DEFAULT_PROPS;
|
|
455
|
-
|
|
456
|
-
export { Select, SelectMultiple, SelectMultipleField, SelectVariant };
|
|
457
|
-
//# sourceMappingURL=select-8b54a444.js.map
|