@festo-ui/react 9.0.1-dev.781 → 9.0.1-dev.783

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 (203) hide show
  1. package/package.json +14 -18
  2. package/dist/components/accordion/Accordion.css +0 -4
  3. package/dist/components/accordion/Accordion.d.ts +0 -10
  4. package/dist/components/accordion/Accordion.js +0 -41
  5. package/dist/components/accordion/AccordionContext.d.ts +0 -11
  6. package/dist/components/accordion/AccordionContext.js +0 -3
  7. package/dist/components/accordion/accordion-header/AccordionHeader.css +0 -11
  8. package/dist/components/accordion/accordion-header/AccordionHeader.d.ts +0 -2
  9. package/dist/components/accordion/accordion-header/AccordionHeader.js +0 -11
  10. package/dist/components/accordion/accordion-item/AccordionItem.css +0 -64
  11. package/dist/components/accordion/accordion-item/AccordionItem.d.ts +0 -8
  12. package/dist/components/accordion/accordion-item/AccordionItem.js +0 -60
  13. package/dist/components/accordion/accordion-item/AccordionItemContext.d.ts +0 -7
  14. package/dist/components/accordion/accordion-item/AccordionItemContext.js +0 -3
  15. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.css +0 -76
  16. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.d.ts +0 -2
  17. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +0 -61
  18. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.css +0 -11
  19. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.d.ts +0 -2
  20. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +0 -20
  21. package/dist/components/bottom-sheet/BottomSheet.css +0 -18
  22. package/dist/components/bottom-sheet/BottomSheet.d.ts +0 -11
  23. package/dist/components/bottom-sheet/BottomSheet.js +0 -101
  24. package/dist/components/breadcrumb/Breadcrumb.d.ts +0 -14
  25. package/dist/components/breadcrumb/Breadcrumb.js +0 -87
  26. package/dist/components/button/Button.d.ts +0 -11
  27. package/dist/components/button/Button.js +0 -36
  28. package/dist/components/card/Card.d.ts +0 -4
  29. package/dist/components/card/Card.js +0 -9
  30. package/dist/components/card/CardBody.d.ts +0 -5
  31. package/dist/components/card/CardBody.js +0 -15
  32. package/dist/components/card/CardHeader.d.ts +0 -8
  33. package/dist/components/card/CardHeader.js +0 -31
  34. package/dist/components/card/CardHeader.stories.helper.js +0 -7
  35. package/dist/components/card/CardNotification.d.ts +0 -6
  36. package/dist/components/card/CardNotification.js +0 -26
  37. package/dist/components/chips/chip/Chip.d.ts +0 -17
  38. package/dist/components/chips/chip/Chip.js +0 -38
  39. package/dist/components/chips/chip-container/ChipContainer.d.ts +0 -5
  40. package/dist/components/chips/chip-container/ChipContainer.js +0 -12
  41. package/dist/components/icon-wrapper/IconWrapper.d.ts +0 -6
  42. package/dist/components/icon-wrapper/IconWrapper.js +0 -13
  43. package/dist/components/loading-indicator/LoadingIndicator.d.ts +0 -5
  44. package/dist/components/loading-indicator/LoadingIndicator.js +0 -41
  45. package/dist/components/mobile-flyout/MobileFlyout.d.ts +0 -11
  46. package/dist/components/mobile-flyout/MobileFlyout.js +0 -88
  47. package/dist/components/mobile-flyout/MobileFlyoutContext.d.ts +0 -8
  48. package/dist/components/mobile-flyout/MobileFlyoutContext.js +0 -3
  49. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +0 -17
  50. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +0 -36
  51. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.css +0 -5
  52. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.d.ts +0 -8
  53. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +0 -35
  54. package/dist/components/modals/AlertModal.d.ts +0 -12
  55. package/dist/components/modals/AlertModal.js +0 -53
  56. package/dist/components/modals/ConfirmModal.d.ts +0 -11
  57. package/dist/components/modals/ConfirmModal.js +0 -46
  58. package/dist/components/modals/CustomModal.d.ts +0 -8
  59. package/dist/components/modals/CustomModal.js +0 -38
  60. package/dist/components/modals/Modal.css +0 -39
  61. package/dist/components/modals/Modal.d.ts +0 -8
  62. package/dist/components/modals/Modal.js +0 -31
  63. package/dist/components/modals/ModalBase.d.ts +0 -9
  64. package/dist/components/modals/ModalBase.js +0 -124
  65. package/dist/components/modals/ModalFooter.d.ts +0 -2
  66. package/dist/components/modals/ModalFooter.js +0 -12
  67. package/dist/components/modals/Prompt.d.ts +0 -15
  68. package/dist/components/modals/Prompt.js +0 -58
  69. package/dist/components/modals/image-gallery/ImageGallery.css +0 -815
  70. package/dist/components/modals/image-gallery/ImageGallery.d.ts +0 -21
  71. package/dist/components/modals/image-gallery/ImageGallery.helper.d.ts +0 -2
  72. package/dist/components/modals/image-gallery/ImageGallery.helper.js +0 -13
  73. package/dist/components/modals/image-gallery/ImageGallery.js +0 -103
  74. package/dist/components/modals/image-gallery/ImageGallery.stories.helper.js +0 -112
  75. package/dist/components/modals/image-gallery/ImageGalleryContent.d.ts +0 -8
  76. package/dist/components/modals/image-gallery/ImageGalleryContent.js +0 -15
  77. package/dist/components/modals/image-gallery/ImageGalleryScale.d.ts +0 -6
  78. package/dist/components/modals/image-gallery/ImageGalleryScale.js +0 -15
  79. package/dist/components/modals/image-gallery/ImageGallerySwiper.d.ts +0 -12
  80. package/dist/components/modals/image-gallery/ImageGallerySwiper.js +0 -40
  81. package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.d.ts +0 -7
  82. package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.js +0 -27
  83. package/dist/components/modals/image-gallery/internal/CloseButton.d.ts +0 -6
  84. package/dist/components/modals/image-gallery/internal/CloseButton.js +0 -14
  85. package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.d.ts +0 -5
  86. package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.js +0 -8
  87. package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.d.ts +0 -5
  88. package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.js +0 -29
  89. package/dist/components/pagination/Pagination.css +0 -10
  90. package/dist/components/pagination/Pagination.d.ts +0 -15
  91. package/dist/components/pagination/Pagination.js +0 -100
  92. package/dist/components/popovers/legend/Legend.d.ts +0 -9
  93. package/dist/components/popovers/legend/Legend.js +0 -21
  94. package/dist/components/popovers/popover/Popover.css +0 -56
  95. package/dist/components/popovers/popover/Popover.d.ts +0 -21
  96. package/dist/components/popovers/popover/Popover.js +0 -106
  97. package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +0 -7
  98. package/dist/components/popovers/popover-menu/PopoverMenu.js +0 -37
  99. package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +0 -3
  100. package/dist/components/popovers/popover-menu/PopoverMenuContext.js +0 -5
  101. package/dist/components/popovers/popover-menu-item/PopoverMenuItem.d.ts +0 -9
  102. package/dist/components/popovers/popover-menu-item/PopoverMenuItem.js +0 -28
  103. package/dist/components/popovers/tooltip/Tooltip.d.ts +0 -5
  104. package/dist/components/popovers/tooltip/Tooltip.js +0 -12
  105. package/dist/components/progress/Progress.d.ts +0 -7
  106. package/dist/components/progress/Progress.js +0 -26
  107. package/dist/components/search-input/ClearButton.d.ts +0 -2
  108. package/dist/components/search-input/ClearButton.js +0 -10
  109. package/dist/components/search-input/SearchInput.css +0 -13
  110. package/dist/components/search-input/SearchInput.d.ts +0 -14
  111. package/dist/components/search-input/SearchInput.js +0 -61
  112. package/dist/components/search-input/SearchSuggestion.d.ts +0 -17
  113. package/dist/components/search-input/SearchSuggestion.js +0 -21
  114. package/dist/components/search-input/useSearchInput.d.ts +0 -13
  115. package/dist/components/search-input/useSearchInput.js +0 -85
  116. package/dist/components/snackbar/Snackbar.css +0 -55
  117. package/dist/components/snackbar/Snackbar.d.ts +0 -21
  118. package/dist/components/snackbar/Snackbar.js +0 -78
  119. package/dist/components/snackbar/SnackbarContext.d.ts +0 -7
  120. package/dist/components/snackbar/SnackbarContext.js +0 -3
  121. package/dist/components/snackbar/SnackbarProvider.d.ts +0 -7
  122. package/dist/components/snackbar/SnackbarProvider.js +0 -66
  123. package/dist/components/snackbar/useSnackbar.d.ts +0 -2
  124. package/dist/components/snackbar/useSnackbar.js +0 -4
  125. package/dist/components/stepper-horizontal/StepperHorizontal.css +0 -6
  126. package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +0 -7
  127. package/dist/components/stepper-horizontal/StepperHorizontal.js +0 -48
  128. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.css +0 -24
  129. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +0 -6
  130. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +0 -16
  131. package/dist/components/stepper-vertical/StepperVertical.d.ts +0 -6
  132. package/dist/components/stepper-vertical/StepperVertical.js +0 -26
  133. package/dist/components/stepper-vertical/step-vertical/StepVertical.css +0 -10
  134. package/dist/components/stepper-vertical/step-vertical/StepVertical.d.ts +0 -11
  135. package/dist/components/stepper-vertical/step-vertical/StepVertical.js +0 -58
  136. package/dist/components/tab/Tabs.css +0 -285
  137. package/dist/components/tab/Tabs.d.ts +0 -22
  138. package/dist/components/tab/Tabs.js +0 -194
  139. package/dist/components/tab/interfaces.d.ts +0 -5
  140. package/dist/components/tab/interfaces.js +0 -0
  141. package/dist/components/tab/tab-pane/TabPane.css +0 -8
  142. package/dist/components/tab/tab-pane/TabPane.d.ts +0 -9
  143. package/dist/components/tab/tab-pane/TabPane.js +0 -18
  144. package/dist/components/tab/useTabScroll.d.ts +0 -25
  145. package/dist/components/tab/useTabScroll.js +0 -151
  146. package/dist/components/table-header-cell/TableHeaderCell.d.ts +0 -5
  147. package/dist/components/table-header-cell/TableHeaderCell.js +0 -21
  148. package/dist/forms/checkbox/Checkbox.css +0 -134
  149. package/dist/forms/checkbox/Checkbox.d.ts +0 -15
  150. package/dist/forms/checkbox/Checkbox.js +0 -80
  151. package/dist/forms/combobox/ComboBox.css +0 -124
  152. package/dist/forms/combobox/ComboBox.d.ts +0 -28
  153. package/dist/forms/combobox/ComboBox.js +0 -175
  154. package/dist/forms/multi-select/MultiSelect.d.ts +0 -20
  155. package/dist/forms/multi-select/MultiSelect.js +0 -191
  156. package/dist/forms/multi-select/MultiSelect.module.js +0 -8
  157. package/dist/forms/multi-select/MultiSelect_module.css +0 -13
  158. package/dist/forms/radio/RadioButton.d.ts +0 -14
  159. package/dist/forms/radio/RadioButton.js +0 -61
  160. package/dist/forms/radio/RadioGroup.d.ts +0 -12
  161. package/dist/forms/radio/RadioGroup.js +0 -50
  162. package/dist/forms/radio/RadioGroupContext.d.ts +0 -12
  163. package/dist/forms/radio/RadioGroupContext.js +0 -3
  164. package/dist/forms/segment/Segment.d.ts +0 -13
  165. package/dist/forms/segment/Segment.js +0 -59
  166. package/dist/forms/segment/segment-control/SegmentControl.d.ts +0 -14
  167. package/dist/forms/segment/segment-control/SegmentControl.js +0 -57
  168. package/dist/forms/select/Select.d.ts +0 -25
  169. package/dist/forms/select/Select.js +0 -92
  170. package/dist/forms/slider/Slider.css +0 -50
  171. package/dist/forms/slider/Slider.d.ts +0 -17
  172. package/dist/forms/slider/Slider.js +0 -93
  173. package/dist/forms/switch/Switch.d.ts +0 -12
  174. package/dist/forms/switch/Switch.js +0 -42
  175. package/dist/forms/text-area/TextArea.css +0 -14
  176. package/dist/forms/text-area/TextArea.d.ts +0 -22
  177. package/dist/forms/text-area/TextArea.js +0 -99
  178. package/dist/forms/text-input/TextInput.d.ts +0 -24
  179. package/dist/forms/text-input/TextInput.js +0 -74
  180. package/dist/forms/time-picker/TimePicker.css +0 -10
  181. package/dist/forms/time-picker/TimePicker.d.ts +0 -24
  182. package/dist/forms/time-picker/TimePicker.js +0 -140
  183. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.css +0 -4
  184. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +0 -19
  185. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +0 -208
  186. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +0 -9
  187. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +0 -14
  188. package/dist/index.d.ts +0 -59
  189. package/dist/index.js +0 -60
  190. package/dist/utils/index.d.ts +0 -1
  191. package/dist/utils/index.js +0 -7
  192. package/dist/utils/setRef.d.ts +0 -1
  193. package/dist/utils/setRef.js +0 -5
  194. package/dist/utils/types.d.ts +0 -36
  195. package/dist/utils/types.js +0 -0
  196. package/dist/utils/useControlled.d.ts +0 -7
  197. package/dist/utils/useControlled.js +0 -20
  198. package/dist/utils/useForkRef.d.ts +0 -2
  199. package/dist/utils/useForkRef.js +0 -15
  200. package/dist/utils/useId.d.ts +0 -1
  201. package/dist/utils/useId.js +0 -20
  202. package/dist/utils/useOnClickOutside.d.ts +0 -2
  203. package/dist/utils/useOnClickOutside.js +0 -20
@@ -1,175 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import "./ComboBox.css";
3
- import { Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions } from "@headlessui/react";
4
- import classnames from "classnames";
5
- import { forwardRef, useMemo, useState } from "react";
6
- import { useControlled } from "../../utils/useControlled.js";
7
- import { useId } from "../../utils/useId.js";
8
- function getHighlightedLabel(label, query) {
9
- if (!query) return [
10
- {
11
- text: label,
12
- highlighted: false
13
- }
14
- ];
15
- const parts = [];
16
- const lowerLabel = label.toLowerCase();
17
- const lowerQuery = query.toLowerCase();
18
- let currentIndex = 0;
19
- while(currentIndex < label.length){
20
- const matchIndex = lowerLabel.indexOf(lowerQuery, currentIndex);
21
- if (-1 === matchIndex) {
22
- parts.push({
23
- text: label.slice(currentIndex),
24
- highlighted: false
25
- });
26
- break;
27
- }
28
- if (matchIndex > currentIndex) parts.push({
29
- text: label.slice(currentIndex, matchIndex),
30
- highlighted: false
31
- });
32
- parts.push({
33
- text: label.slice(matchIndex, matchIndex + query.length),
34
- highlighted: true
35
- });
36
- currentIndex = matchIndex + query.length;
37
- }
38
- return parts;
39
- }
40
- function ComboBoxComponent({ defaultValue = '', value: controlled, label, options = [], onChange, required = false, disabled, name, id: idProp, hint, error, placeholder, onInputChange, emptyMessage = 'No results found', className, ...props }, ref) {
41
- const id = useId(idProp);
42
- const [value, setValue] = useControlled({
43
- controlled,
44
- default: defaultValue,
45
- onChange
46
- });
47
- const [query, setQuery] = useState('');
48
- const selectedOption = useMemo(()=>options.find((option)=>option.data === value && !option.disabled), [
49
- options,
50
- value
51
- ]);
52
- const filteredOptions = useMemo(()=>{
53
- if (!query) return options;
54
- const normalizedQuery = query.toLowerCase();
55
- return options.filter((option)=>option.label.toLowerCase().includes(normalizedQuery));
56
- }, [
57
- options,
58
- query
59
- ]);
60
- function handleChange(option) {
61
- if (!option || option.disabled) return;
62
- setValue(option.data);
63
- setQuery('');
64
- }
65
- function handleInputChange(inputValue) {
66
- setQuery(inputValue);
67
- onInputChange?.(inputValue);
68
- }
69
- const inputClasses = classnames('fr-combobox-input', {
70
- 'fr-required': required,
71
- 'fr-disabled': disabled,
72
- 'fr-invalid': error,
73
- 'fr-empty': !query && !selectedOption
74
- });
75
- return /*#__PURE__*/ jsx(Combobox, {
76
- value: selectedOption ?? null,
77
- onChange: handleChange,
78
- disabled: disabled,
79
- immediate: true,
80
- children: /*#__PURE__*/ jsxs("div", {
81
- className: classnames(className, 'fr-combobox-wrapper', {
82
- 'fr-disabled': disabled,
83
- 'fr-invalid': error,
84
- 'fr-required': required
85
- }),
86
- ref: ref,
87
- ...props,
88
- children: [
89
- /*#__PURE__*/ jsx("label", {
90
- className: "fr-combobox-label",
91
- htmlFor: id,
92
- children: label || ''
93
- }),
94
- /*#__PURE__*/ jsxs("div", {
95
- className: "fr-combobox-control",
96
- children: [
97
- /*#__PURE__*/ jsx(ComboboxInput, {
98
- className: inputClasses,
99
- id: id,
100
- required: required,
101
- disabled: disabled,
102
- placeholder: placeholder,
103
- autoComplete: "off",
104
- displayValue: (option)=>option?.label ?? '',
105
- onChange: (event)=>handleInputChange(event.target.value)
106
- }),
107
- /*#__PURE__*/ jsx(ComboboxButton, {
108
- className: "fr-combobox-button",
109
- disabled: disabled,
110
- "aria-label": "Optionen anzeigen"
111
- })
112
- ]
113
- }),
114
- name && /*#__PURE__*/ jsx("input", {
115
- type: "hidden",
116
- name: name,
117
- value: String(value ?? ''),
118
- disabled: disabled
119
- }),
120
- /*#__PURE__*/ jsxs(ComboboxOptions, {
121
- className: "fwe-options-container",
122
- as: "ul",
123
- portal: false,
124
- style: {
125
- minWidth: 'var(--input-width)'
126
- },
127
- anchor: {
128
- to: 'bottom start',
129
- gap: 12,
130
- padding: 8
131
- },
132
- children: [
133
- 0 === filteredOptions.length && /*#__PURE__*/ jsx("li", {
134
- className: "fwe-combobox-option fwe-combobox-empty",
135
- children: /*#__PURE__*/ jsx("span", {
136
- className: "fwe-combobox-option-content",
137
- children: emptyMessage
138
- })
139
- }),
140
- filteredOptions.map((option)=>/*#__PURE__*/ jsx(ComboboxOption, {
141
- value: option,
142
- disabled: option.disabled,
143
- as: "li",
144
- className: ({ focus, selected, disabled: isDisabled })=>classnames('fwe-combobox-option', {
145
- 'fwe-selected': selected,
146
- 'fwe-focus': focus,
147
- 'fwe-disabled': isDisabled
148
- }),
149
- children: /*#__PURE__*/ jsx("span", {
150
- className: "fwe-combobox-option-content",
151
- "data-testid": "fwe-combobox-option-content",
152
- children: getHighlightedLabel(option.label, query).map((part, index)=>/*#__PURE__*/ jsx("span", {
153
- className: classnames({
154
- 'fwe-combobox-highlight': part.highlighted
155
- }),
156
- children: part.text
157
- }, `${part.text}-${index}`))
158
- })
159
- }, String(option.data)))
160
- ]
161
- }),
162
- hint && !error && /*#__PURE__*/ jsx("div", {
163
- className: "fr-combobox-description",
164
- children: hint
165
- }),
166
- error && /*#__PURE__*/ jsx("div", {
167
- className: "fr-combobox-invalid",
168
- children: error
169
- })
170
- ]
171
- })
172
- });
173
- }
174
- const ComboBox = /*#__PURE__*/ forwardRef(ComboBoxComponent);
175
- export { ComboBox };
@@ -1,20 +0,0 @@
1
- import type { Ref } from 'react';
2
- import type { ComponentBase } from '../../utils/types';
3
- import type { SelectOption } from '../select/Select';
4
- export interface MultiSelectProps<T> extends ComponentBase {
5
- readonly defaultValue?: T[];
6
- readonly value?: T[];
7
- readonly label?: string;
8
- readonly options?: SelectOption<T>[];
9
- readonly onChange?: (value: T[]) => void;
10
- readonly disabled?: boolean;
11
- readonly name?: string;
12
- readonly hint?: string;
13
- readonly error?: string;
14
- readonly placeholder?: string;
15
- }
16
- declare function MultiSelectComponent<T>({ defaultValue, value: controlled, label, options, onChange, disabled, name, id: idProp, hint, error, placeholder, className, ...props }: MultiSelectProps<T>, ref: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
17
- export declare const MultiSelect: <T>(props: MultiSelectProps<T> & {
18
- ref?: Ref<HTMLDivElement>;
19
- }) => ReturnType<typeof MultiSelectComponent>;
20
- export {};
@@ -1,191 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headlessui/react";
3
- import classnames from "classnames";
4
- import { forwardRef, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
5
- import { useControlled } from "../../utils/useControlled.js";
6
- import { useId } from "../../utils/useId.js";
7
- import MultiSelect_module from "./MultiSelect.module.js";
8
- function MultiSelectComponent({ defaultValue = [], value: controlled, label, options = [], onChange, disabled, name, id: idProp, hint, error, placeholder, className, ...props }, ref) {
9
- const id = useId(idProp);
10
- const labelId = `${id}-label`;
11
- const [value, setValue] = useControlled({
12
- controlled,
13
- default: defaultValue,
14
- onChange
15
- });
16
- const selectedOptions = useMemo(()=>options.filter((option)=>!option.disabled && (value ?? []).includes(option.data)), [
17
- options,
18
- value
19
- ]);
20
- function handleChange(nextOptions) {
21
- setValue(nextOptions.map((option)=>option.data));
22
- }
23
- const chipsRef = useRef(null);
24
- const [overflowCount, setOverflowCount] = useState(0);
25
- const measureOverflow = useCallback((optionCount)=>{
26
- const container = chipsRef.current;
27
- if (!container) return void setOverflowCount(0);
28
- const allChildren = Array.from(container.children);
29
- const optionChildren = allChildren.filter((child)=>'true' === child.dataset.optionChip);
30
- for (const child of optionChildren)child.style.display = '';
31
- const containerRect = container.getBoundingClientRect();
32
- const isOverflow = optionChildren.some((child)=>{
33
- const childRect = child.getBoundingClientRect();
34
- return childRect.right > containerRect.right;
35
- });
36
- if (isOverflow && optionCount > 1) {
37
- let remainingWidth = containerRect.width - 64;
38
- let count = 0;
39
- for (const child of optionChildren){
40
- const width = child.getBoundingClientRect().width + 8;
41
- if (width <= remainingWidth) {
42
- remainingWidth -= width;
43
- child.style.display = '';
44
- } else {
45
- count++;
46
- child.style.display = 'none';
47
- }
48
- }
49
- setOverflowCount(count);
50
- } else setOverflowCount(0);
51
- }, []);
52
- useLayoutEffect(()=>{
53
- measureOverflow(selectedOptions.length);
54
- const container = chipsRef.current;
55
- if (!container) return;
56
- const observer = new ResizeObserver(()=>{
57
- measureOverflow(selectedOptions.length);
58
- });
59
- observer.observe(container);
60
- return ()=>observer.disconnect();
61
- }, [
62
- selectedOptions,
63
- measureOverflow
64
- ]);
65
- return /*#__PURE__*/ jsx(Listbox, {
66
- value: selectedOptions,
67
- onChange: handleChange,
68
- disabled: disabled,
69
- multiple: true,
70
- children: /*#__PURE__*/ jsxs("div", {
71
- className: classnames(className, 'fwe-select-wrapper', {
72
- 'fwe-disabled': disabled
73
- }),
74
- ref: ref,
75
- ...props,
76
- children: [
77
- /*#__PURE__*/ jsx(ListboxButton, {
78
- className: classnames('fwe-select', {
79
- 'fwe-invalid': error
80
- }),
81
- id: id,
82
- "aria-labelledby": label ? labelId : void 0,
83
- disabled: disabled,
84
- children: selectedOptions.length > 0 ? /*#__PURE__*/ jsxs("span", {
85
- ref: chipsRef,
86
- className: MultiSelect_module["chip-container"],
87
- children: [
88
- selectedOptions.map((o)=>/*#__PURE__*/ jsx("span", {
89
- "data-option-chip": "true",
90
- className: classnames('fwe-chip', {
91
- 'fwe-disabled': disabled
92
- }),
93
- style: {
94
- minWidth: 0,
95
- flexShrink: 1 === selectedOptions.length ? 1 : 0
96
- },
97
- children: /*#__PURE__*/ jsx("span", {
98
- className: MultiSelect_module["chip-ellipsis"],
99
- children: o.label
100
- })
101
- }, String(o.data))),
102
- overflowCount > 0 && /*#__PURE__*/ jsxs(Fragment, {
103
- children: [
104
- /*#__PURE__*/ jsx("span", {
105
- children: "..."
106
- }),
107
- /*#__PURE__*/ jsx("span", {
108
- className: "fwe-chip",
109
- children: overflowCount
110
- })
111
- ]
112
- })
113
- ]
114
- }) : placeholder ?? ''
115
- }),
116
- /*#__PURE__*/ jsx("label", {
117
- className: "fwe-select-label",
118
- id: labelId,
119
- htmlFor: id,
120
- children: label || ''
121
- }),
122
- /*#__PURE__*/ jsx(ListboxOptions, {
123
- className: "fwe-options-container fwe-options-container--multi-select",
124
- as: "ul",
125
- portal: false,
126
- style: {
127
- minWidth: 'var(--button-width)'
128
- },
129
- anchor: {
130
- to: 'bottom start',
131
- gap: 12,
132
- padding: 8
133
- },
134
- children: options.map((option)=>/*#__PURE__*/ jsx(ListboxOption, {
135
- value: option,
136
- disabled: option.disabled,
137
- as: "li",
138
- style: {
139
- cursor: option.disabled ? 'default' : 'pointer'
140
- },
141
- children: ({ selected })=>/*#__PURE__*/ jsxs("label", {
142
- className: classnames('fwe-checkbox', {
143
- 'fwe-disabled': option.disabled
144
- }),
145
- style: {
146
- pointerEvents: 'none',
147
- cursor: 'pointer'
148
- },
149
- children: [
150
- /*#__PURE__*/ jsx("input", {
151
- type: "checkbox",
152
- checked: selected,
153
- disabled: option.disabled,
154
- readOnly: true,
155
- tabIndex: -1,
156
- style: {
157
- pointerEvents: 'none',
158
- cursor: 'pointer'
159
- }
160
- }),
161
- /*#__PURE__*/ jsx("span", {
162
- className: "fwe-checkbox-checkmark"
163
- }),
164
- /*#__PURE__*/ jsx("span", {
165
- className: "fwe-checkbox-label-content",
166
- children: option.label
167
- })
168
- ]
169
- })
170
- }, String(option.data)))
171
- }),
172
- name && (value ?? []).map((selectedValue, index)=>/*#__PURE__*/ jsx("input", {
173
- type: "hidden",
174
- name: name,
175
- value: String(selectedValue),
176
- disabled: disabled
177
- }, `${name}-${String(selectedValue)}-${index}`)),
178
- hint && !error && /*#__PURE__*/ jsx("div", {
179
- className: "fwe-select-description",
180
- children: hint
181
- }),
182
- error && /*#__PURE__*/ jsx("div", {
183
- className: "fwe-select-invalid",
184
- children: error
185
- })
186
- ]
187
- })
188
- });
189
- }
190
- const MultiSelect = /*#__PURE__*/ forwardRef(MultiSelectComponent);
191
- export { MultiSelect };
@@ -1,8 +0,0 @@
1
- import "./MultiSelect_module.css";
2
- const MultiSelect_module = {
3
- "chip-container": "chip-container-VYPHrz",
4
- chipContainer: "chip-container-VYPHrz",
5
- "chip-ellipsis": "chip-ellipsis-AW26fc",
6
- chipEllipsis: "chip-ellipsis-AW26fc"
7
- };
8
- export { MultiSelect_module as default };
@@ -1,13 +0,0 @@
1
- .chip-container-VYPHrz {
2
- flex-wrap: nowrap;
3
- gap: 8px;
4
- display: flex;
5
- overflow: hidden;
6
- }
7
-
8
- .chip-ellipsis-AW26fc {
9
- text-overflow: ellipsis;
10
- white-space: nowrap;
11
- overflow: hidden;
12
- }
13
-
@@ -1,14 +0,0 @@
1
- import type { ClassNamePropsWithChildren } from '../../utils/types';
2
- export interface RadioButtonProps extends ClassNamePropsWithChildren {
3
- readonly id?: string;
4
- readonly defaultChecked?: boolean;
5
- readonly checked?: boolean;
6
- readonly onChange?: (value: string) => void;
7
- readonly name?: string;
8
- readonly value?: string;
9
- readonly labelPosition?: 'before' | 'after' | 'below';
10
- readonly large?: boolean;
11
- readonly disabled?: boolean;
12
- readonly required?: boolean;
13
- }
14
- export declare function RadioButton(props: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,61 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import { useContext } from "react";
4
- import { useId } from "../../utils/useId.js";
5
- import { RadioGroupContext } from "./RadioGroupContext.js";
6
- function RadioButton(props) {
7
- const { id: idProps, onChange, value, name, defaultChecked: defaultCheckedProp, checked, labelPosition = 'after', large = false, disabled = false, required = false, children, className } = props;
8
- const { disabled: groupDisabled, labelPosition: groupLabelPosition, large: groupLarge, name: groupName, value: groupValue, required: groupRequired, handleValueChange: onGroupValueChange, isControlled } = useContext(RadioGroupContext);
9
- const innerLabelPosition = groupLabelPosition ?? labelPosition;
10
- const classes = classnames('fwe-radio', {
11
- 'fwe-radio-label-below': 'below' === innerLabelPosition
12
- }, {
13
- 'fwe-radio-label-before': 'before' === innerLabelPosition
14
- }, {
15
- 'fwe-radio-lg': large || groupLarge
16
- }, className);
17
- const controlledChecked = void 0 !== checked || isControlled && void 0 !== groupValue ? Boolean(checked || groupValue === value) : void 0;
18
- const getDefaultChecked = ()=>{
19
- if (void 0 !== controlledChecked) return;
20
- if (void 0 !== defaultCheckedProp) return defaultCheckedProp;
21
- if (!isControlled && void 0 !== groupValue) return groupValue === value;
22
- };
23
- const defaultChecked = getDefaultChecked();
24
- function handleChange(event) {
25
- const newValue = event.target.value;
26
- if (newValue) onGroupValueChange?.(newValue);
27
- onChange?.(newValue);
28
- }
29
- const id = useId(idProps);
30
- return /*#__PURE__*/ jsxs("label", {
31
- className: classes,
32
- htmlFor: id,
33
- children: [
34
- /*#__PURE__*/ jsxs("div", {
35
- className: "fwe-radio-check",
36
- children: [
37
- /*#__PURE__*/ jsx("input", {
38
- defaultChecked: defaultChecked,
39
- checked: controlledChecked,
40
- type: "radio",
41
- id: id,
42
- name: groupName || name,
43
- value: value,
44
- onChange: handleChange,
45
- disabled: disabled || groupDisabled,
46
- required: required || groupRequired
47
- }),
48
- /*#__PURE__*/ jsx("div", {
49
- className: "fwe-radio-checkmark"
50
- }),
51
- ' '
52
- ]
53
- }),
54
- /*#__PURE__*/ jsx("div", {
55
- className: "fwe-radio-label-content",
56
- children: children
57
- })
58
- ]
59
- });
60
- }
61
- export { RadioButton };
@@ -1,12 +0,0 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export interface RadioGroupProps extends ComponentPropsWithoutRef<'div'> {
3
- readonly name?: string;
4
- readonly defaultValue?: string;
5
- readonly onValueChange?: (value: string) => void;
6
- readonly value?: string;
7
- readonly labelPosition?: 'before' | 'after' | 'below';
8
- readonly large?: boolean;
9
- readonly disabled?: boolean;
10
- readonly required?: boolean;
11
- }
12
- export declare const RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -1,50 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import { forwardRef, useCallback, useMemo } from "react";
4
- import { useControlled } from "../../utils/useControlled.js";
5
- import { useId } from "../../utils/useId.js";
6
- import { RadioGroupContext } from "./RadioGroupContext.js";
7
- const RadioGroup = /*#__PURE__*/ forwardRef(({ children, className, onValueChange, value: controlledValue, defaultValue, name, labelPosition, large, disabled, required, ...props }, ref)=>{
8
- const contextName = useId(name);
9
- const [value, setValue] = useControlled({
10
- controlled: controlledValue,
11
- default: defaultValue
12
- });
13
- const handleValueChange = useCallback((newValue)=>{
14
- onValueChange?.(newValue);
15
- setValue(newValue);
16
- }, [
17
- onValueChange,
18
- setValue
19
- ]);
20
- const contextValue = useMemo(()=>({
21
- labelPosition,
22
- large,
23
- disabled,
24
- required,
25
- handleValueChange,
26
- value,
27
- isControlled: void 0 !== controlledValue,
28
- name: contextName
29
- }), [
30
- controlledValue,
31
- handleValueChange,
32
- labelPosition,
33
- large,
34
- disabled,
35
- required,
36
- value,
37
- contextName
38
- ]);
39
- return /*#__PURE__*/ jsx(RadioGroupContext.Provider, {
40
- value: contextValue,
41
- children: /*#__PURE__*/ jsx("div", {
42
- ref: ref,
43
- className: classnames('fwe-radio-group', className),
44
- role: "radiogroup",
45
- ...props,
46
- children: children
47
- })
48
- });
49
- });
50
- export { RadioGroup };
@@ -1,12 +0,0 @@
1
- interface ContextProps {
2
- name: string;
3
- value: string;
4
- isControlled: boolean;
5
- labelPosition: 'before' | 'after' | 'below';
6
- large: boolean;
7
- handleValueChange: (value: string) => void;
8
- disabled: boolean;
9
- required: boolean;
10
- }
11
- export declare const RadioGroupContext: import("react").Context<Partial<ContextProps>>;
12
- export {};
@@ -1,3 +0,0 @@
1
- import { createContext } from "react";
2
- const RadioGroupContext = /*#__PURE__*/ createContext({});
3
- export { RadioGroupContext };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { ClassNamePropsWithChildren } from '../../utils/types';
3
- export interface SegmentConfiguration {
4
- readonly outline?: boolean;
5
- readonly iconOnly?: boolean;
6
- }
7
- export interface SegmentProps extends ClassNamePropsWithChildren {
8
- readonly legend: string;
9
- readonly config?: SegmentConfiguration;
10
- readonly onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any) => void;
11
- readonly value?: any;
12
- }
13
- export declare function Segment(props: SegmentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,59 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import react from "react";
4
- import { useControlled } from "../../utils/useControlled.js";
5
- const defaultConfig = {
6
- outline: true,
7
- iconOnly: true
8
- };
9
- function Segment(props) {
10
- const { children, legend, config, onChange, className, value: valueProps } = props;
11
- const innerConfig = {
12
- ...defaultConfig,
13
- ...config
14
- };
15
- let useIcon = false;
16
- let useIconAndText = false;
17
- let tmpValue = '';
18
- react.Children.forEach(children, (child, index)=>{
19
- if (!/*#__PURE__*/ react.isValidElement(child)) return null;
20
- if (0 === index && null !== child.props.icon) if (innerConfig.iconOnly) useIcon = true;
21
- else useIconAndText = true;
22
- if (child.props.checked) tmpValue = child.props.value;
23
- return null;
24
- });
25
- const [value, setValue] = useControlled({
26
- controlled: valueProps,
27
- default: tmpValue
28
- });
29
- const handleChange = (event, _value)=>{
30
- if (onChange) onChange(event, _value);
31
- setValue(_value);
32
- };
33
- return /*#__PURE__*/ jsxs("fieldset", {
34
- className: classnames('fwe-segment', {
35
- 'fwe-segment-outline': innerConfig.outline,
36
- 'fwe-segment-icon': useIcon,
37
- 'fwe-segment-icon-text': useIconAndText
38
- }, className),
39
- children: [
40
- /*#__PURE__*/ jsx("legend", {
41
- className: "fwe-sr-only fwe-d-inline-block",
42
- children: legend
43
- }),
44
- /*#__PURE__*/ jsx("div", {
45
- className: "fwe-segment-group",
46
- children: react.Children.map(children, (child)=>{
47
- if (!/*#__PURE__*/ react.isValidElement(child)) return null;
48
- return /*#__PURE__*/ react.cloneElement(child, {
49
- ...child.props,
50
- onChange: handleChange,
51
- iconOnly: innerConfig.iconOnly,
52
- checked: child.props.value === value
53
- });
54
- })
55
- })
56
- ]
57
- });
58
- }
59
- export { Segment };
@@ -1,14 +0,0 @@
1
- import type React from 'react';
2
- import type { ClassNameProps } from '../../../utils/types';
3
- export interface SegmentControlProps extends ClassNameProps {
4
- readonly label: string;
5
- readonly name: string;
6
- readonly value: any;
7
- readonly checked?: boolean;
8
- readonly disabled?: boolean;
9
- readonly icon?: React.ReactNode;
10
- readonly onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any) => void;
11
- readonly id?: string;
12
- readonly iconOnly?: boolean;
13
- }
14
- export declare function SegmentControl(props: SegmentControlProps): import("react/jsx-runtime").JSX.Element;