@festo-ui/react 9.0.1-dev.772 → 9.0.1-dev.776

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.
Files changed (38) hide show
  1. package/dist/forms/combobox/ComboBox.css +3 -42
  2. package/dist/forms/combobox/ComboBox.js +16 -15
  3. package/dist/forms/multi-select/MultiSelect.d.ts +20 -0
  4. package/dist/forms/multi-select/MultiSelect.js +186 -0
  5. package/dist/forms/multi-select/MultiSelect.module.js +8 -0
  6. package/dist/forms/multi-select/MultiSelect_module.css +13 -0
  7. package/dist/forms/select/Select.d.ts +12 -13
  8. package/dist/forms/select/Select.js +74 -82
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +2 -2
  11. package/package.json +1 -1
  12. package/dist/forms/select/Select.css +0 -160
  13. package/dist/forms/select/internal/HiddenInput.d.ts +0 -8
  14. package/dist/forms/select/internal/HiddenInput.js +0 -15
  15. package/dist/forms/select/internal/ListItem.d.ts +0 -18
  16. package/dist/forms/select/internal/ListItem.js +0 -69
  17. package/dist/forms/select/internal/SelectButton.d.ts +0 -12
  18. package/dist/forms/select/internal/SelectButton.js +0 -49
  19. package/dist/forms/select/internal/SelectButtonContent.d.ts +0 -7
  20. package/dist/forms/select/internal/SelectButtonContent.js +0 -31
  21. package/dist/forms/select/internal/SelectCheckbox.d.ts +0 -4
  22. package/dist/forms/select/internal/SelectCheckbox.js +0 -13
  23. package/dist/forms/select/internal/SelectLabel.d.ts +0 -7
  24. package/dist/forms/select/internal/SelectLabel.js +0 -12
  25. package/dist/forms/select/internal/SelectOptionsContainer.d.ts +0 -17
  26. package/dist/forms/select/internal/SelectOptionsContainer.js +0 -103
  27. package/dist/forms/select/internal/SelectScrollContainer.d.ts +0 -8
  28. package/dist/forms/select/internal/SelectScrollContainer.js +0 -15
  29. package/dist/forms/select/internal/SelectWrapper.d.ts +0 -6
  30. package/dist/forms/select/internal/SelectWrapper.js +0 -12
  31. package/dist/forms/select/internal/index.d.ts +0 -6
  32. package/dist/forms/select/internal/index.js +0 -7
  33. package/dist/forms/select/internal/utils.d.ts +0 -7
  34. package/dist/forms/select/internal/utils.js +0 -30
  35. package/dist/forms/select/select-option/SelectOption.d.ts +0 -14
  36. package/dist/forms/select/select-option/SelectOption.js +0 -12
  37. package/dist/forms/select/utils.d.ts +0 -2
  38. package/dist/forms/select/utils.js +0 -12
@@ -1,160 +0,0 @@
1
- .fwe-select-wrapper {
2
- width: inherit;
3
- min-width: 48px;
4
- display: flex;
5
- }
6
-
7
- .fwe-select-wrapper .fr-select-input {
8
- opacity: 0;
9
- pointer-events: none;
10
- box-sizing: border-box;
11
- width: 100%;
12
- position: absolute;
13
- bottom: 0;
14
- left: 0;
15
- }
16
-
17
- .fwe-select-wrapper.fwe-disabled:before {
18
- color: var(--fwe-text-disabled);
19
- }
20
-
21
- .fwe-select-wrapper .fwe-select {
22
- text-align: left;
23
- cursor: pointer;
24
- height: unset;
25
- background: none;
26
- min-height: 33px;
27
- padding: 0;
28
- }
29
-
30
- .fwe-select-wrapper .fwe-select .fwe-select-content {
31
- white-space: nowrap;
32
- text-overflow: ellipsis;
33
- padding-right: 24px;
34
- line-height: 1.5rem;
35
- overflow: hidden;
36
- }
37
-
38
- .fwe-select-wrapper .fwe-select.fwe-required:not(.fwe-disabled) ~ .fwe-select-label:after {
39
- content: "*";
40
- display: inline-block;
41
- position: relative;
42
- left: 3px;
43
- }
44
-
45
- .fwe-select-wrapper .fwe-select.fwe-required:not(.fwe-disabled):not(.fwe-invalid) ~ .fwe-select-valid {
46
- display: block;
47
- }
48
-
49
- .fwe-select-wrapper .fwe-select:focus:not(:disabled) {
50
- color: var(--fwe-hero);
51
- }
52
-
53
- .fwe-select-wrapper .fwe-select:focus:not(:disabled) option {
54
- color: var(--fwe-text);
55
- }
56
-
57
- .fwe-select-wrapper .fwe-select:focus:not(:disabled) {
58
- border-color: var(--fwe-hero);
59
- }
60
-
61
- .fwe-select-wrapper .fwe-select:focus:invalid {
62
- border-color: var(--fwe-red);
63
- }
64
-
65
- .fwe-select-wrapper .fwe-select.fwe-disabled {
66
- cursor: default;
67
- border-color: var(--fwe-control-disabled) !important;
68
- }
69
-
70
- .fwe-select-wrapper .fwe-select.fwe-disabled ~ .fwe-select-label, .fwe-select-wrapper .fwe-select.fwe-disabled .fwe-select-content {
71
- color: var(--fwe-text-disabled);
72
- }
73
-
74
- .fwe-select-wrapper .fwe-select.fwe-disabled .fwe-chip {
75
- color: var(--fwe-text-disabled);
76
- border: 1px solid var(--fwe-control-disabled);
77
- pointer-events: none;
78
- }
79
-
80
- .fwe-select-wrapper .fwe-select.fwe-invalid.fwe-select:hover, .fwe-select-wrapper .fwe-select.fwe-invalid.fwe-select:focus {
81
- border-color: var(--fwe-red);
82
- }
83
-
84
- .fwe-select-wrapper .fwe-select.fwe-invalid ~ .fwe-select-invalid {
85
- display: block;
86
- }
87
-
88
- .fwe-select-wrapper .fwe-select.fwe-invalid ~ .fwe-select-description {
89
- display: none;
90
- }
91
-
92
- .fr-select-scroll {
93
- overflow-y: scroll;
94
- }
95
-
96
- .fwe-select-options-container {
97
- z-index: var(--fwe-z-index-popover);
98
- max-width: 100vw;
99
- font-size: var(--fwe-font-size-base);
100
- background-color: var(--fwe-white);
101
- border: 1px solid var(--fwe-gray-200);
102
- border-radius: 4px;
103
- margin: 0;
104
- padding: 8px;
105
- list-style: none;
106
- box-shadow: 0 1px 4px #00000029;
107
- }
108
-
109
- .fwe-select-options-container .fwe-select-option {
110
- cursor: pointer;
111
- min-height: 24px;
112
- padding: 12px 8px;
113
- line-height: 24px;
114
- position: relative;
115
- }
116
-
117
- .fwe-select-options-container .fwe-select-option:hover, .fwe-select-options-container .fwe-select-option:focus {
118
- background-color: var(--fwe-gray-100);
119
- outline: none;
120
- }
121
-
122
- .fwe-select-options-container .fwe-select-option:last-child {
123
- border-bottom: none;
124
- }
125
-
126
- .fwe-select-options-container .fwe-select-option .fwe-select-option-content {
127
- white-space: nowrap;
128
- text-overflow: ellipsis;
129
- min-height: 24px;
130
- line-height: 24px;
131
- display: block;
132
- overflow: hidden;
133
- }
134
-
135
- .fr-backdrop {
136
- z-index: var(--fwe-z-index-modal);
137
- position: fixed;
138
- inset: 0;
139
- }
140
-
141
- .chip-text-truncate {
142
- white-space: nowrap;
143
- text-overflow: ellipsis;
144
- display: inline-block;
145
- overflow: hidden;
146
- }
147
-
148
- .chip-removable {
149
- cursor: pointer;
150
- border: none;
151
- padding: 0;
152
- }
153
-
154
- .fwe-chip .chip-removable svg {
155
- margin: 0;
156
- position: absolute;
157
- top: 4px;
158
- right: 5px;
159
- }
160
-
@@ -1,8 +0,0 @@
1
- import type { SelectOptionType } from '../select-option/SelectOption';
2
- interface HiddenInputProps<T> {
3
- value: any;
4
- onChange: (value: SelectOptionType<T>) => void;
5
- options: SelectOptionType<T>[];
6
- }
7
- export declare function HiddenInput<T>({ value, onChange, options, }: HiddenInputProps<T>): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,15 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- function HiddenInput({ value, onChange, options }) {
3
- function handleChange(event) {
4
- const child = options.find(({ data })=>data === event.target.value);
5
- if (void 0 !== child) onChange(child);
6
- }
7
- return /*#__PURE__*/ jsx("input", {
8
- className: "fr-select-input",
9
- "aria-hidden": true,
10
- tabIndex: -1,
11
- value: value,
12
- onChange: handleChange
13
- });
14
- }
15
- export { HiddenInput };
@@ -1,18 +0,0 @@
1
- import React, { type Ref, type RefObject } from 'react';
2
- import type { SelectOptionProps, SelectOptionType } from '../select-option/SelectOption';
3
- export interface ListItemProps<T> extends React.ComponentPropsWithoutRef<'li'> {
4
- empty?: boolean;
5
- item: SelectOptionType<T> | React.ReactElement<SelectOptionProps<T>>;
6
- options: SelectOptionType<T>[];
7
- index: number;
8
- onOptionChange: (option: SelectOptionType<T>) => void;
9
- onFocusChange: (index: number) => void;
10
- onClose: () => void;
11
- selectedLabel?: string | string[];
12
- withCheckbox?: boolean;
13
- }
14
- declare function ListItemComponent<T>({ children, className, empty, options, onClose, onOptionChange, index, selectedLabel, item, withCheckbox, onFocusChange, ...restProps }: ListItemProps<T>, ref: Ref<RefObject<HTMLLIElement>[]>): import("react/jsx-runtime").JSX.Element;
15
- export declare const ListItem: <T>(props: ListItemProps<T> & {
16
- ref?: Ref<RefObject<HTMLLIElement>[]>;
17
- }) => ReturnType<typeof ListItemComponent>;
18
- export {};
@@ -1,69 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import react, { forwardRef } from "react";
4
- import { SelectCheckbox } from "./SelectCheckbox.js";
5
- function ListItemComponent({ children, className, empty, options, onClose, onOptionChange, index, selectedLabel, item, withCheckbox, onFocusChange, ...restProps }, ref) {
6
- const isChild = /*#__PURE__*/ react.isValidElement(item);
7
- const option = isChild ? item.props.option : item;
8
- const propsWithoutOption = isChild ? {
9
- ...item.props,
10
- option: void 0
11
- } : {};
12
- const checked = Array.isArray(selectedLabel) ? selectedLabel.includes(option.label) : selectedLabel === option.label;
13
- function handleKeyDown(e) {
14
- const arrowKeys = [
15
- 'ArrowDown',
16
- 'ArrowUp'
17
- ];
18
- const validKeys = [
19
- 'Enter',
20
- ' '
21
- ];
22
- if (arrowKeys.concat(validKeys).includes(e.key)) e.preventDefault();
23
- if ('ArrowDown' === e.key) onFocusChange((index + 1) % options.length);
24
- if ('ArrowUp' === e.key) {
25
- const nextIndex = (index - 1 + options.length) % options.length;
26
- onFocusChange(nextIndex);
27
- }
28
- if ([
29
- 'Enter',
30
- ' '
31
- ].includes(e.key)) {
32
- if (option.disabled) return;
33
- onOptionChange(option);
34
- }
35
- if ('Escape' === e.key) onClose();
36
- }
37
- function handleClick() {
38
- if (option.disabled) return;
39
- onOptionChange(option);
40
- }
41
- const itemRef = 'function' != typeof ref ? ref?.current?.[index] : void 0;
42
- return /*#__PURE__*/ jsx("li", {
43
- onClick: handleClick,
44
- ref: itemRef,
45
- role: "option",
46
- onKeyDown: handleKeyDown,
47
- "aria-selected": checked,
48
- className: classnames('fwe-select-option', {
49
- 'fwe-empty': !option.label
50
- }, className),
51
- tabIndex: 0,
52
- ...restProps,
53
- children: /*#__PURE__*/ jsx(SelectCheckbox, {
54
- disabled: option.disabled,
55
- onClick: (e)=>e.stopPropagation(),
56
- checked: checked,
57
- withCheckbox: withCheckbox,
58
- children: isChild ? /*#__PURE__*/ jsx("span", {
59
- ...propsWithoutOption
60
- }) : /*#__PURE__*/ jsx("span", {
61
- className: "fwe-select-option-content",
62
- "data-testid": "fwe-select-option-content",
63
- children: option.label
64
- })
65
- })
66
- });
67
- }
68
- const ListItem = /*#__PURE__*/ forwardRef(ListItemComponent);
69
- export { ListItem };
@@ -1,12 +0,0 @@
1
- interface SelectButtonProps {
2
- onToggle: () => void;
3
- focused?: boolean;
4
- required: boolean;
5
- error?: string;
6
- disabled?: boolean;
7
- onChipClick: (label: string) => void;
8
- label?: string | string[];
9
- renderLabelContent?: (label?: string | string[]) => JSX.Element;
10
- }
11
- export declare const SelectButton: (props: SelectButtonProps & import("react").RefAttributes<HTMLButtonElement>) => React.ReactElement | null;
12
- export {};
@@ -1,49 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import { forwardRef } from "react";
4
- import { SelectButtonContent } from "./SelectButtonContent.js";
5
- const SelectButton = /*#__PURE__*/ forwardRef(({ onToggle, disabled, label, focused, required, error, onChipClick, renderLabelContent }, ref)=>{
6
- const empty = void 0 === label && !focused;
7
- function handleKeyDown(e) {
8
- if (disabled) return;
9
- const validKeys = [
10
- 'Enter',
11
- ' ',
12
- 'ArrowUp',
13
- 'ArrowDown'
14
- ];
15
- if (validKeys.includes(e.key)) {
16
- e.preventDefault();
17
- onToggle();
18
- }
19
- }
20
- function handleClick(e) {
21
- if (disabled) return;
22
- e.stopPropagation();
23
- onToggle();
24
- }
25
- return /*#__PURE__*/ jsx("button", {
26
- type: "button",
27
- tabIndex: 0,
28
- className: classnames('fwe-select', {
29
- 'fwe-focus': focused,
30
- 'fwe-empty': empty,
31
- 'fwe-required': required,
32
- 'fwe-disabled': disabled,
33
- 'fwe-invalid': error
34
- }),
35
- onClick: handleClick,
36
- ref: ref,
37
- onKeyDown: handleKeyDown,
38
- disabled: disabled,
39
- children: /*#__PURE__*/ jsx("div", {
40
- className: "fwe-select-content",
41
- children: /*#__PURE__*/ jsx(SelectButtonContent, {
42
- onClick: onChipClick,
43
- label: label,
44
- renderLabelContent: renderLabelContent
45
- })
46
- })
47
- });
48
- });
49
- export { SelectButton };
@@ -1,7 +0,0 @@
1
- interface SelectButtonContentProps {
2
- label?: string | string[];
3
- renderLabelContent?: (label?: string | string[]) => JSX.Element;
4
- onClick: (label: string) => void;
5
- }
6
- export declare function SelectButtonContent({ label, renderLabelContent, onClick, }: SelectButtonContentProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,31 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { IconCloseSmall } from "@festo-ui/react-icons";
3
- function SelectButtonContent({ label, renderLabelContent, onClick }) {
4
- const handleChipClick = (chipLabel)=>(e)=>{
5
- e.stopPropagation();
6
- onClick(chipLabel);
7
- };
8
- if (renderLabelContent) return renderLabelContent(label);
9
- if (Array.isArray(label)) return /*#__PURE__*/ jsx("div", {
10
- className: "fwe-chip-container",
11
- children: label.map((v)=>/*#__PURE__*/ jsxs("div", {
12
- className: "fwe-chip chip-text-truncate fwe-pr-4",
13
- title: v,
14
- children: [
15
- v,
16
- /*#__PURE__*/ jsx("button", {
17
- type: "button",
18
- className: "chip-removable",
19
- onClick: handleChipClick(v),
20
- children: /*#__PURE__*/ jsx(IconCloseSmall, {
21
- size: 16
22
- })
23
- })
24
- ]
25
- }, v))
26
- });
27
- return /*#__PURE__*/ jsx(Fragment, {
28
- children: label
29
- });
30
- }
31
- export { SelectButtonContent };
@@ -1,4 +0,0 @@
1
- import { type CheckboxProps } from '../../checkbox/Checkbox';
2
- export declare function SelectCheckbox({ children, withCheckbox, ...props }: CheckboxProps & {
3
- withCheckbox?: boolean;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +0,0 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { Checkbox } from "../../checkbox/Checkbox.js";
3
- function SelectCheckbox({ children, withCheckbox, ...props }) {
4
- if (withCheckbox) return /*#__PURE__*/ jsx(Checkbox, {
5
- tabIndex: -1,
6
- ...props,
7
- children: children
8
- });
9
- return /*#__PURE__*/ jsx(Fragment, {
10
- children: children
11
- });
12
- }
13
- export { SelectCheckbox };
@@ -1,7 +0,0 @@
1
- interface SelectLabelProps {
2
- hideLabel?: boolean;
3
- label?: string;
4
- id?: string;
5
- }
6
- export declare function SelectLabel({ hideLabel, label, id }: SelectLabelProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,12 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- function SelectLabel({ hideLabel, label, id }) {
4
- return /*#__PURE__*/ jsx("label", {
5
- className: classnames('fwe-select-label', {
6
- 'fwe-sr-only': hideLabel
7
- }),
8
- htmlFor: id,
9
- children: label || ''
10
- });
11
- }
12
- export { SelectLabel };
@@ -1,17 +0,0 @@
1
- import { type Key, type Ref } from 'react';
2
- import type { SelectConfiguration } from '../../../utils/types';
3
- import type { SelectOptionType } from '../select-option/SelectOption';
4
- interface SelectOptionsContainerProps<T> {
5
- options?: SelectOptionType<T>[];
6
- config?: SelectConfiguration;
7
- onClose: () => void;
8
- label?: string | string[];
9
- onOptionChange: (option: SelectOptionType<T>) => void;
10
- multiple?: boolean;
11
- children: React.ReactNode;
12
- }
13
- declare function SelectOptionsContainerComponent<T extends Key | null | undefined>({ options, config, onClose, label, onOptionChange, multiple, children, }: SelectOptionsContainerProps<T>, ref: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
14
- export declare const SelectOptionsContainer: <T>(props: SelectOptionsContainerProps<T> & {
15
- ref?: Ref<HTMLDivElement>;
16
- }) => ReturnType<typeof SelectOptionsContainerComponent>;
17
- export {};
@@ -1,103 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { createRef, forwardRef, isValidElement, useEffect, useRef, useState } from "react";
3
- import { usePopper } from "react-popper";
4
- import { ListItem } from "./ListItem.js";
5
- import { SelectScrollContainer } from "./SelectScrollContainer.js";
6
- import { getChildren } from "./utils.js";
7
- function SelectOptionsContainerComponent({ options, config, onClose, label, onOptionChange, multiple, children }, ref) {
8
- const [popperElement, setPopperElement] = useState(null);
9
- const refObject = 'function' != typeof ref ? ref?.current : null;
10
- const { styles, attributes } = usePopper(refObject, popperElement, {
11
- placement: 'bottom-start',
12
- modifiers: [
13
- {
14
- name: 'offset',
15
- options: {
16
- offset: [
17
- 0,
18
- 3
19
- ]
20
- }
21
- },
22
- {
23
- name: 'flip',
24
- options: {
25
- fallbackPlacements: [
26
- 'bottom-start',
27
- 'top-start'
28
- ]
29
- }
30
- }
31
- ]
32
- });
33
- function getCssProperies() {
34
- if (config?.contentWidth) return {
35
- ...styles.popper,
36
- minWidth: `${refObject?.clientWidth}px`,
37
- width: config?.contentWidth
38
- };
39
- return {
40
- ...styles.popper,
41
- minWidth: `${refObject?.clientWidth}px`
42
- };
43
- }
44
- const allChildren = getChildren(children);
45
- const childrenList = allChildren.childrenList;
46
- const usedOptions = options ?? childrenList.map((child)=>child.props.option);
47
- const { length } = usedOptions;
48
- const listItemRef = useRef(Array.from({
49
- length
50
- }, ()=>/*#__PURE__*/ createRef()));
51
- const selectedIndex = Array.isArray(label) ? usedOptions.findIndex((option)=>option.label === label.at(-1)) : usedOptions.findIndex((option)=>option.label === label);
52
- const [init, setInit] = useState(false);
53
- useEffect(()=>{
54
- if (!init) requestAnimationFrame(()=>{
55
- setInit(true);
56
- const index = -1 === selectedIndex ? 0 : selectedIndex;
57
- listItemRef.current?.[index].current?.focus();
58
- });
59
- }, [
60
- selectedIndex,
61
- init
62
- ]);
63
- return /*#__PURE__*/ jsxs(Fragment, {
64
- children: [
65
- /*#__PURE__*/ jsx("div", {
66
- "aria-hidden": true,
67
- className: "fr-backdrop",
68
- onClick: onClose
69
- }),
70
- /*#__PURE__*/ jsxs("ul", {
71
- ref: setPopperElement,
72
- style: getCssProperies(),
73
- ...attributes.popper,
74
- className: "fwe-select-options-container",
75
- role: "listbox",
76
- children: [
77
- allChildren.before,
78
- /*#__PURE__*/ jsx(SelectScrollContainer, {
79
- length: length,
80
- config: config,
81
- children: [
82
- ...options || [],
83
- ...childrenList
84
- ].map((item, i)=>/*#__PURE__*/ jsx(ListItem, {
85
- withCheckbox: multiple,
86
- item: item,
87
- selectedLabel: label,
88
- onClose: onClose,
89
- onFocusChange: (index)=>listItemRef.current[index].current?.focus(),
90
- onOptionChange: onOptionChange,
91
- ref: listItemRef,
92
- index: i,
93
- options: usedOptions
94
- }, /*#__PURE__*/ (isValidElement(item) ? item.props.option : item).data))
95
- }),
96
- allChildren.after
97
- ]
98
- })
99
- ]
100
- });
101
- }
102
- const SelectOptionsContainer = /*#__PURE__*/ forwardRef(SelectOptionsContainerComponent);
103
- export { SelectOptionsContainer };
@@ -1,8 +0,0 @@
1
- import type { SelectConfiguration } from '../../../utils/types';
2
- interface SelectScrollContainerProps {
3
- readonly config?: SelectConfiguration;
4
- readonly children: React.ReactNode;
5
- readonly length: number;
6
- }
7
- export declare function SelectScrollContainer({ config, children, length, }: SelectScrollContainerProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,15 +0,0 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { calcVirtualScrollHeight } from "../utils.js";
3
- function SelectScrollContainer({ config, children, length }) {
4
- if (config?.scroll?.enabled) return /*#__PURE__*/ jsx("div", {
5
- className: "fr-select-scroll",
6
- style: {
7
- height: calcVirtualScrollHeight(config, length)
8
- },
9
- children: children
10
- });
11
- return /*#__PURE__*/ jsx(Fragment, {
12
- children: children
13
- });
14
- }
15
- export { SelectScrollContainer };
@@ -1,6 +0,0 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- interface SelectWrapperProps extends ComponentPropsWithoutRef<'div'> {
3
- disabled?: boolean;
4
- }
5
- export declare const SelectWrapper: (props: SelectWrapperProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
6
- export {};
@@ -1,12 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import { forwardRef } from "react";
4
- const SelectWrapper = /*#__PURE__*/ forwardRef(({ children, disabled, className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
5
- ...props,
6
- ref: ref,
7
- className: classnames('fwe-select-wrapper', {
8
- 'fwe-disabled': disabled
9
- }, className),
10
- children: children
11
- }));
12
- export { SelectWrapper };
@@ -1,6 +0,0 @@
1
- export { HiddenInput } from './HiddenInput';
2
- export { ListItem } from './ListItem';
3
- export { SelectButton } from './SelectButton';
4
- export { SelectLabel } from './SelectLabel';
5
- export { SelectOptionsContainer } from './SelectOptionsContainer';
6
- export { SelectWrapper } from './SelectWrapper';
@@ -1,7 +0,0 @@
1
- import { HiddenInput } from "./HiddenInput.js";
2
- import { ListItem } from "./ListItem.js";
3
- import { SelectButton } from "./SelectButton.js";
4
- import { SelectLabel } from "./SelectLabel.js";
5
- import { SelectOptionsContainer } from "./SelectOptionsContainer.js";
6
- import { SelectWrapper } from "./SelectWrapper.js";
7
- export { HiddenInput, ListItem, SelectButton, SelectLabel, SelectOptionsContainer, SelectWrapper };
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { SelectOptionProps } from '../select-option/SelectOption';
3
- export declare function getChildren<T>(children: React.ReactNode): {
4
- childrenList: React.ReactElement<SelectOptionProps<T>, string | React.JSXElementConstructor<any>>[];
5
- after: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
6
- before: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
7
- };
@@ -1,30 +0,0 @@
1
- import classnames from "classnames";
2
- import react from "react";
3
- import { SelectOption } from "../select-option/SelectOption.js";
4
- function getChildren(children) {
5
- const before = [];
6
- const childrenList = [];
7
- const after = [];
8
- let foundFirstOption = false;
9
- react.Children.forEach(children, (element)=>{
10
- if (react.isValidElement(element)) if (react.isValidElement(element) && element.type === SelectOption) {
11
- foundFirstOption = true;
12
- const className = classnames('fwe-select-option-content', element.props.className);
13
- const { props } = element;
14
- childrenList.push({
15
- ...element,
16
- props: {
17
- ...props,
18
- className
19
- }
20
- });
21
- } else if (foundFirstOption) after.push(element);
22
- else before.push(element);
23
- });
24
- return {
25
- childrenList,
26
- after,
27
- before
28
- };
29
- }
30
- export { getChildren };
@@ -1,14 +0,0 @@
1
- import { type ComponentPropsWithoutRef, type Ref } from 'react';
2
- export interface SelectOptionType<T> {
3
- readonly label: string;
4
- readonly data: T;
5
- readonly disabled?: boolean;
6
- }
7
- export interface SelectOptionProps<T> extends ComponentPropsWithoutRef<'span'> {
8
- option: SelectOptionType<T>;
9
- }
10
- declare function SelectOptionComponent<T>({ children, className, ...props }: SelectOptionProps<T>, ref: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
11
- export declare const SelectOption: <T>(props: SelectOptionProps<T> & {
12
- ref?: Ref<HTMLDivElement>;
13
- }) => ReturnType<typeof SelectOptionComponent>;
14
- export {};