@festo-ui/react 10.1.0-dev.864 → 10.1.0-dev.866

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 (207) hide show
  1. package/dist/components/accordion/Accordion.css +4 -0
  2. package/dist/components/accordion/Accordion.d.ts +10 -0
  3. package/dist/components/accordion/Accordion.js +42 -0
  4. package/dist/components/accordion/AccordionContext.d.ts +11 -0
  5. package/dist/components/accordion/AccordionContext.js +3 -0
  6. package/dist/components/accordion/accordion-header/AccordionHeader.css +11 -0
  7. package/dist/components/accordion/accordion-header/AccordionHeader.d.ts +2 -0
  8. package/dist/components/accordion/accordion-header/AccordionHeader.js +12 -0
  9. package/dist/components/accordion/accordion-item/AccordionItem.css +64 -0
  10. package/dist/components/accordion/accordion-item/AccordionItem.d.ts +8 -0
  11. package/dist/components/accordion/accordion-item/AccordionItem.js +61 -0
  12. package/dist/components/accordion/accordion-item/AccordionItemContext.d.ts +7 -0
  13. package/dist/components/accordion/accordion-item/AccordionItemContext.js +3 -0
  14. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.css +76 -0
  15. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.d.ts +2 -0
  16. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +56 -0
  17. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.css +11 -0
  18. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.d.ts +2 -0
  19. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +21 -0
  20. package/dist/components/bottom-sheet/BottomSheet.css +18 -0
  21. package/dist/components/bottom-sheet/BottomSheet.d.ts +10 -0
  22. package/dist/components/bottom-sheet/BottomSheet.js +104 -0
  23. package/dist/components/breadcrumb/Breadcrumb.d.ts +13 -0
  24. package/dist/components/breadcrumb/Breadcrumb.js +61 -0
  25. package/dist/components/button/Button.d.ts +11 -0
  26. package/dist/components/button/Button.js +37 -0
  27. package/dist/components/card/Card.d.ts +3 -0
  28. package/dist/components/card/Card.js +11 -0
  29. package/dist/components/card/CardBody.d.ts +5 -0
  30. package/dist/components/card/CardBody.js +17 -0
  31. package/dist/components/card/CardHeader.d.ts +8 -0
  32. package/dist/components/card/CardHeader.js +33 -0
  33. package/dist/components/card/CardHeader.stories.helper.js +7 -0
  34. package/dist/components/card/CardNotification.d.ts +5 -0
  35. package/dist/components/card/CardNotification.js +30 -0
  36. package/dist/components/chips/chip/Chip.d.ts +16 -0
  37. package/dist/components/chips/chip/Chip.js +45 -0
  38. package/dist/components/chips/chip-container/ChipContainer.d.ts +5 -0
  39. package/dist/components/chips/chip-container/ChipContainer.js +16 -0
  40. package/dist/components/icon-wrapper/IconWrapper.d.ts +7 -0
  41. package/dist/components/icon-wrapper/IconWrapper.js +13 -0
  42. package/dist/components/loading-indicator/LoadingIndicator.d.ts +5 -0
  43. package/dist/components/loading-indicator/LoadingIndicator.js +42 -0
  44. package/dist/components/mobile-flyout/MobileFlyout.d.ts +11 -0
  45. package/dist/components/mobile-flyout/MobileFlyout.js +89 -0
  46. package/dist/components/mobile-flyout/MobileFlyoutContext.d.ts +8 -0
  47. package/dist/components/mobile-flyout/MobileFlyoutContext.js +3 -0
  48. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +18 -0
  49. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +37 -0
  50. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.css +5 -0
  51. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.d.ts +8 -0
  52. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +36 -0
  53. package/dist/components/modals/AlertModal.d.ts +12 -0
  54. package/dist/components/modals/AlertModal.js +54 -0
  55. package/dist/components/modals/ConfirmModal.d.ts +11 -0
  56. package/dist/components/modals/ConfirmModal.js +47 -0
  57. package/dist/components/modals/CustomModal.d.ts +8 -0
  58. package/dist/components/modals/CustomModal.js +39 -0
  59. package/dist/components/modals/Modal.css +39 -0
  60. package/dist/components/modals/Modal.d.ts +8 -0
  61. package/dist/components/modals/Modal.js +32 -0
  62. package/dist/components/modals/ModalBase.d.ts +10 -0
  63. package/dist/components/modals/ModalBase.js +125 -0
  64. package/dist/components/modals/ModalFooter.d.ts +2 -0
  65. package/dist/components/modals/ModalFooter.js +14 -0
  66. package/dist/components/modals/Prompt.d.ts +15 -0
  67. package/dist/components/modals/Prompt.js +61 -0
  68. package/dist/components/modals/image-gallery/ImageGallery.css +833 -0
  69. package/dist/components/modals/image-gallery/ImageGallery.d.ts +21 -0
  70. package/dist/components/modals/image-gallery/ImageGallery.helper.d.ts +2 -0
  71. package/dist/components/modals/image-gallery/ImageGallery.helper.js +13 -0
  72. package/dist/components/modals/image-gallery/ImageGallery.js +104 -0
  73. package/dist/components/modals/image-gallery/ImageGallery.stories.helper.js +112 -0
  74. package/dist/components/modals/image-gallery/ImageGalleryContent.d.ts +8 -0
  75. package/dist/components/modals/image-gallery/ImageGalleryContent.js +15 -0
  76. package/dist/components/modals/image-gallery/ImageGalleryScale.d.ts +6 -0
  77. package/dist/components/modals/image-gallery/ImageGalleryScale.js +15 -0
  78. package/dist/components/modals/image-gallery/ImageGallerySwiper.d.ts +12 -0
  79. package/dist/components/modals/image-gallery/ImageGallerySwiper.js +40 -0
  80. package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.d.ts +7 -0
  81. package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.js +27 -0
  82. package/dist/components/modals/image-gallery/internal/CloseButton.d.ts +6 -0
  83. package/dist/components/modals/image-gallery/internal/CloseButton.js +14 -0
  84. package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.d.ts +5 -0
  85. package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.js +8 -0
  86. package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.d.ts +5 -0
  87. package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.js +29 -0
  88. package/dist/components/pagination/Pagination.css +10 -0
  89. package/dist/components/pagination/Pagination.d.ts +10 -0
  90. package/dist/components/pagination/Pagination.js +98 -0
  91. package/dist/components/popovers/legend/Legend.d.ts +11 -0
  92. package/dist/components/popovers/legend/Legend.js +25 -0
  93. package/dist/components/popovers/popover/Popover.css +9 -0
  94. package/dist/components/popovers/popover/Popover.d.ts +19 -0
  95. package/dist/components/popovers/popover/Popover.js +99 -0
  96. package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +9 -0
  97. package/dist/components/popovers/popover-menu/PopoverMenu.js +33 -0
  98. package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +4 -0
  99. package/dist/components/popovers/popover-menu/PopoverMenuContext.js +5 -0
  100. package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.d.ts +9 -0
  101. package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +31 -0
  102. package/dist/components/popovers/tooltip/Tooltip.d.ts +6 -0
  103. package/dist/components/popovers/tooltip/Tooltip.js +13 -0
  104. package/dist/components/progress/Progress.d.ts +6 -0
  105. package/dist/components/progress/Progress.js +30 -0
  106. package/dist/components/search-input/SearchInput.css +25 -0
  107. package/dist/components/search-input/SearchInput.d.ts +25 -0
  108. package/dist/components/search-input/SearchInput.js +89 -0
  109. package/dist/components/search-input/SearchInputOption.d.ts +5 -0
  110. package/dist/components/search-input/SearchInputOption.js +18 -0
  111. package/dist/components/search-input/SearchResult.d.ts +8 -0
  112. package/dist/components/search-input/SearchResult.js +48 -0
  113. package/dist/components/snackbar/Snackbar.css +55 -0
  114. package/dist/components/snackbar/Snackbar.d.ts +21 -0
  115. package/dist/components/snackbar/Snackbar.js +82 -0
  116. package/dist/components/snackbar/SnackbarContext.d.ts +7 -0
  117. package/dist/components/snackbar/SnackbarContext.js +3 -0
  118. package/dist/components/snackbar/SnackbarProvider.d.ts +7 -0
  119. package/dist/components/snackbar/SnackbarProvider.js +69 -0
  120. package/dist/components/snackbar/useSnackbar.d.ts +2 -0
  121. package/dist/components/snackbar/useSnackbar.js +4 -0
  122. package/dist/components/stepper-horizontal/StepperHorizontal.css +6 -0
  123. package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +7 -0
  124. package/dist/components/stepper-horizontal/StepperHorizontal.js +49 -0
  125. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.css +24 -0
  126. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +6 -0
  127. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +17 -0
  128. package/dist/components/stepper-vertical/StepperVertical.d.ts +6 -0
  129. package/dist/components/stepper-vertical/StepperVertical.js +26 -0
  130. package/dist/components/stepper-vertical/step-vertical/StepVertical.css +10 -0
  131. package/dist/components/stepper-vertical/step-vertical/StepVertical.d.ts +11 -0
  132. package/dist/components/stepper-vertical/step-vertical/StepVertical.js +59 -0
  133. package/dist/components/tab/Tabs.css +285 -0
  134. package/dist/components/tab/Tabs.d.ts +22 -0
  135. package/dist/components/tab/Tabs.js +194 -0
  136. package/dist/components/tab/interfaces.d.ts +5 -0
  137. package/dist/components/tab/interfaces.js +0 -0
  138. package/dist/components/tab/tab-pane/TabPane.css +8 -0
  139. package/dist/components/tab/tab-pane/TabPane.d.ts +8 -0
  140. package/dist/components/tab/tab-pane/TabPane.js +22 -0
  141. package/dist/components/tab/useTabScroll.d.ts +25 -0
  142. package/dist/components/tab/useTabScroll.js +151 -0
  143. package/dist/components/table-header-cell/TableHeaderCell.d.ts +6 -0
  144. package/dist/components/table-header-cell/TableHeaderCell.js +22 -0
  145. package/dist/forms/checkbox/Checkbox.css +134 -0
  146. package/dist/forms/checkbox/Checkbox.d.ts +12 -0
  147. package/dist/forms/checkbox/Checkbox.js +83 -0
  148. package/dist/forms/combobox/ComboBox.css +124 -0
  149. package/dist/forms/combobox/ComboBox.d.ts +27 -0
  150. package/dist/forms/combobox/ComboBox.js +174 -0
  151. package/dist/forms/multi-select/MultiSelect.css +13 -0
  152. package/dist/forms/multi-select/MultiSelect.d.ts +20 -0
  153. package/dist/forms/multi-select/MultiSelect.js +192 -0
  154. package/dist/forms/radio/RadioButton.d.ts +14 -0
  155. package/dist/forms/radio/RadioButton.js +57 -0
  156. package/dist/forms/radio/RadioGroup.d.ts +12 -0
  157. package/dist/forms/radio/RadioGroup.js +51 -0
  158. package/dist/forms/radio/RadioGroupContext.d.ts +12 -0
  159. package/dist/forms/radio/RadioGroupContext.js +3 -0
  160. package/dist/forms/segment/Segment.d.ts +12 -0
  161. package/dist/forms/segment/Segment.js +60 -0
  162. package/dist/forms/segment/segment-control/SegmentControl.d.ts +10 -0
  163. package/dist/forms/segment/segment-control/SegmentControl.js +59 -0
  164. package/dist/forms/select/Select.d.ts +25 -0
  165. package/dist/forms/select/Select.js +93 -0
  166. package/dist/forms/select/internal/SelectButton.d.ts +0 -0
  167. package/dist/forms/select/internal/SelectButton.js +0 -0
  168. package/dist/forms/select/internal/SelectButtonContent.d.ts +0 -0
  169. package/dist/forms/select/internal/SelectButtonContent.js +0 -0
  170. package/dist/forms/select/internal/SelectOptionsContainer.d.ts +0 -0
  171. package/dist/forms/select/internal/SelectOptionsContainer.js +0 -0
  172. package/dist/forms/slider/Slider.css +50 -0
  173. package/dist/forms/slider/Slider.d.ts +14 -0
  174. package/dist/forms/slider/Slider.js +98 -0
  175. package/dist/forms/switch/Switch.d.ts +10 -0
  176. package/dist/forms/switch/Switch.js +48 -0
  177. package/dist/forms/text-area/TextArea.css +14 -0
  178. package/dist/forms/text-area/TextArea.d.ts +13 -0
  179. package/dist/forms/text-area/TextArea.js +116 -0
  180. package/dist/forms/text-input/TextInput.css +31 -0
  181. package/dist/forms/text-input/TextInput.d.ts +13 -0
  182. package/dist/forms/text-input/TextInput.js +65 -0
  183. package/dist/forms/time-picker/TimePicker.css +10 -0
  184. package/dist/forms/time-picker/TimePicker.d.ts +25 -0
  185. package/dist/forms/time-picker/TimePicker.js +125 -0
  186. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.css +4 -0
  187. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +19 -0
  188. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +209 -0
  189. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +9 -0
  190. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +15 -0
  191. package/dist/index.d.ts +61 -0
  192. package/dist/index.js +61 -0
  193. package/dist/utils/index.d.ts +1 -0
  194. package/dist/utils/index.js +7 -0
  195. package/dist/utils/setRef.d.ts +1 -0
  196. package/dist/utils/setRef.js +5 -0
  197. package/dist/utils/types.d.ts +23 -0
  198. package/dist/utils/types.js +0 -0
  199. package/dist/utils/useControlled.d.ts +7 -0
  200. package/dist/utils/useControlled.js +20 -0
  201. package/dist/utils/useForkRef.d.ts +2 -0
  202. package/dist/utils/useForkRef.js +15 -0
  203. package/dist/utils/useId.d.ts +1 -0
  204. package/dist/utils/useId.js +20 -0
  205. package/dist/utils/useOnClickOutside.d.ts +2 -0
  206. package/dist/utils/useOnClickOutside.js +20 -0
  207. package/package.json +1 -1
@@ -0,0 +1,57 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import { forwardRef, useContext } from "react";
4
+ import { useId } from "../../utils/useId.js";
5
+ import { RadioGroupContext } from "./RadioGroupContext.js";
6
+ const RadioButton = /*#__PURE__*/ forwardRef(({ id: idProps, onChange, value, name, defaultChecked: defaultCheckedProp, checked, labelPosition = 'after', large = false, disabled = false, required = false, children, className, ...props }, ref)=>{
7
+ const { disabled: groupDisabled, labelPosition: groupLabelPosition, large: groupLarge, name: groupName, value: groupValue, required: groupRequired, handleValueChange: onGroupValueChange, isControlled } = useContext(RadioGroupContext);
8
+ const innerLabelPosition = groupLabelPosition ?? labelPosition;
9
+ const classes = classnames('fwe-radio', {
10
+ 'fwe-radio-label-below': 'below' === innerLabelPosition
11
+ }, {
12
+ 'fwe-radio-label-before': 'before' === innerLabelPosition
13
+ }, {
14
+ 'fwe-radio-lg': large || groupLarge
15
+ }, className);
16
+ const controlledChecked = void 0 !== checked || isControlled && void 0 !== groupValue ? Boolean(checked || groupValue === value) : void 0;
17
+ function getDefaultChecked() {
18
+ if (void 0 !== controlledChecked) return;
19
+ if (void 0 !== defaultCheckedProp) return defaultCheckedProp;
20
+ if (!isControlled && void 0 !== groupValue) return groupValue === value;
21
+ }
22
+ const defaultChecked = getDefaultChecked();
23
+ function handleChange(event) {
24
+ const newValue = event.target.value;
25
+ if (newValue) onGroupValueChange?.(newValue);
26
+ onChange?.(newValue, event);
27
+ }
28
+ const id = useId(idProps);
29
+ return /*#__PURE__*/ jsxs("label", {
30
+ className: classes,
31
+ htmlFor: id,
32
+ ref: ref,
33
+ children: [
34
+ /*#__PURE__*/ jsx("input", {
35
+ defaultChecked: defaultChecked,
36
+ checked: controlledChecked,
37
+ type: "radio",
38
+ id: id,
39
+ name: groupName || name,
40
+ value: value,
41
+ onChange: handleChange,
42
+ disabled: disabled || groupDisabled,
43
+ required: required || groupRequired,
44
+ ...props
45
+ }),
46
+ /*#__PURE__*/ jsx("div", {
47
+ className: "fwe-radio-checkmark"
48
+ }),
49
+ /*#__PURE__*/ jsx("div", {
50
+ className: "fwe-radio-label-content",
51
+ children: children
52
+ })
53
+ ]
54
+ });
55
+ });
56
+ RadioButton.displayName = 'RadioButton';
57
+ export { RadioButton };
@@ -0,0 +1,12 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue'> {
3
+ readonly name?: string;
4
+ readonly required?: boolean;
5
+ readonly disabled?: boolean;
6
+ readonly value?: string;
7
+ readonly defaultValue?: string;
8
+ readonly onValueChange?: (value: string) => void;
9
+ readonly labelPosition?: 'before' | 'after' | 'below';
10
+ readonly large?: boolean;
11
+ }
12
+ export declare const RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -0,0 +1,51 @@
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
+ RadioGroup.displayName = 'RadioGroup';
51
+ export { RadioGroup };
@@ -0,0 +1,12 @@
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 {};
@@ -0,0 +1,3 @@
1
+ import { createContext } from "react";
2
+ const RadioGroupContext = /*#__PURE__*/ createContext({});
3
+ export { RadioGroupContext };
@@ -0,0 +1,12 @@
1
+ import React, { type ChangeEvent, type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
2
+ export interface SegmentConfiguration {
3
+ readonly outline?: boolean;
4
+ readonly iconOnly?: boolean;
5
+ }
6
+ export interface SegmentProps extends PropsWithChildren, Omit<ComponentPropsWithoutRef<'fieldset'>, 'onChange' | 'defaultValue' | 'required' | 'disabled'> {
7
+ readonly legend: string;
8
+ readonly config?: SegmentConfiguration;
9
+ readonly onChange?: (value: any, event: ChangeEvent<HTMLInputElement>) => void;
10
+ readonly value?: any;
11
+ }
12
+ export declare const Segment: (props: SegmentProps & React.RefAttributes<HTMLFieldSetElement>) => React.ReactElement | null;
@@ -0,0 +1,60 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import react, { Children, forwardRef, isValidElement } from "react";
4
+ import { useControlled } from "../../utils/useControlled.js";
5
+ const defaultConfig = {
6
+ outline: true,
7
+ iconOnly: true
8
+ };
9
+ const Segment = /*#__PURE__*/ forwardRef(({ children, legend, config, onChange, className, value: valueProps, ...props }, ref)=>{
10
+ const innerConfig = {
11
+ ...defaultConfig,
12
+ ...config
13
+ };
14
+ let useIcon = false;
15
+ let useIconAndText = false;
16
+ let tmpValue = '';
17
+ Children.forEach(children, (child, index)=>{
18
+ if (!/*#__PURE__*/ isValidElement(child)) return null;
19
+ if (0 === index && null !== child.props.icon) if (innerConfig.iconOnly) useIcon = true;
20
+ else useIconAndText = true;
21
+ if (child.props.checked) tmpValue = child.props.value;
22
+ return null;
23
+ });
24
+ const [value, setValue] = useControlled({
25
+ controlled: valueProps,
26
+ default: tmpValue
27
+ });
28
+ const handleChange = (_value, event)=>{
29
+ if (onChange) onChange(_value, event);
30
+ setValue(_value);
31
+ };
32
+ return /*#__PURE__*/ jsxs("fieldset", {
33
+ className: classnames('fwe-segment', {
34
+ 'fwe-segment-outline': innerConfig.outline,
35
+ 'fwe-segment-icon': useIcon,
36
+ 'fwe-segment-icon-text': useIconAndText
37
+ }, className),
38
+ ref: ref,
39
+ ...props,
40
+ children: [
41
+ /*#__PURE__*/ jsx("legend", {
42
+ className: "fwe-sr-only fwe-d-inline-block",
43
+ children: legend
44
+ }),
45
+ /*#__PURE__*/ jsx("div", {
46
+ className: "fwe-segment-group",
47
+ children: react.Children.map(children, (child)=>{
48
+ if (!/*#__PURE__*/ react.isValidElement(child)) return null;
49
+ return /*#__PURE__*/ react.cloneElement(child, {
50
+ onChange: handleChange,
51
+ iconOnly: innerConfig.iconOnly,
52
+ checked: child.props.value === value
53
+ });
54
+ })
55
+ })
56
+ ]
57
+ });
58
+ });
59
+ Segment.displayName = 'Segment';
60
+ export { Segment };
@@ -0,0 +1,10 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ export interface SegmentControlProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'value'> {
3
+ readonly label: string;
4
+ readonly value: any;
5
+ readonly checked?: boolean;
6
+ readonly icon?: React.ReactNode;
7
+ readonly onChange?: (value: any, event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ readonly iconOnly?: boolean;
9
+ }
10
+ export declare const SegmentControl: (props: SegmentControlProps & import("react").RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
@@ -0,0 +1,59 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import { forwardRef, useRef } from "react";
4
+ import { IconWrapper } from "../../../components/icon-wrapper/IconWrapper.js";
5
+ const SegmentControl = /*#__PURE__*/ forwardRef(({ label, checked, disabled, name, value, icon, onChange, id, className, iconOnly, ...props }, ref)=>{
6
+ const componentId = useRef(id ?? (Math.random() * Date.now()).toString().replace('.', '-'));
7
+ let viewMode = 'text';
8
+ if (icon) viewMode = iconOnly ? 'icon' : 'icon-text';
9
+ const handleChange = (event)=>{
10
+ if (onChange) onChange(value, event);
11
+ };
12
+ return /*#__PURE__*/ jsxs(Fragment, {
13
+ children: [
14
+ /*#__PURE__*/ jsx("input", {
15
+ className: "fwe-segment-input",
16
+ type: "radio",
17
+ id: componentId.current,
18
+ name: name,
19
+ value: value,
20
+ checked: checked,
21
+ disabled: disabled,
22
+ onChange: (e)=>handleChange(e),
23
+ ...props
24
+ }),
25
+ /*#__PURE__*/ jsxs("label", {
26
+ className: classnames('fwe-segment-label', className),
27
+ htmlFor: componentId.current,
28
+ ref: ref,
29
+ children: [
30
+ 'icon' === viewMode && /*#__PURE__*/ jsxs(Fragment, {
31
+ children: [
32
+ /*#__PURE__*/ jsx("span", {
33
+ className: "fwe-sr-only",
34
+ children: label
35
+ }),
36
+ /*#__PURE__*/ jsx(IconWrapper, {
37
+ icon: icon
38
+ })
39
+ ]
40
+ }),
41
+ 'text' === viewMode && label,
42
+ 'icon-text' === viewMode && /*#__PURE__*/ jsxs(Fragment, {
43
+ children: [
44
+ /*#__PURE__*/ jsx(IconWrapper, {
45
+ icon: icon
46
+ }),
47
+ /*#__PURE__*/ jsx("span", {
48
+ className: "fwe-ml-xxs",
49
+ children: label
50
+ })
51
+ ]
52
+ })
53
+ ]
54
+ })
55
+ ]
56
+ });
57
+ });
58
+ SegmentControl.displayName = 'SegmentControl';
59
+ export { SegmentControl };
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type Ref } from 'react';
3
+ export interface SelectOption<T> {
4
+ readonly data: T;
5
+ readonly label: ReactNode;
6
+ readonly disabled?: boolean;
7
+ }
8
+ export interface SelectProps<T> extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange' | 'value' | 'defaultValue'> {
9
+ readonly value?: T;
10
+ readonly defaultValue?: T;
11
+ readonly name?: string;
12
+ readonly disabled?: boolean;
13
+ readonly required?: boolean;
14
+ readonly label?: string;
15
+ readonly options?: SelectOption<T>[];
16
+ readonly hint?: string;
17
+ readonly error?: string;
18
+ readonly placeholder?: string;
19
+ readonly onChange?: (value: T) => void;
20
+ }
21
+ declare function SelectComponent<T>({ defaultValue, value: controlled, label, options, onChange, disabled, name, id: idProp, hint, error, placeholder, className, ...props }: SelectProps<T>, ref: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
22
+ export declare const Select: <T>(props: SelectProps<T> & {
23
+ ref?: Ref<HTMLDivElement>;
24
+ }) => ReturnType<typeof SelectComponent>;
25
+ export {};
@@ -0,0 +1,93 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headlessui/react";
3
+ import classnames from "classnames";
4
+ import { forwardRef, useMemo } from "react";
5
+ import { useControlled } from "../../utils/useControlled.js";
6
+ import { useId } from "../../utils/useId.js";
7
+ function SelectComponent({ defaultValue = '', value: controlled, label, options = [], onChange, disabled, name, id: idProp, hint, error, placeholder, className, ...props }, ref) {
8
+ const id = useId(idProp);
9
+ const labelId = `${id}-label`;
10
+ const [value, setValue] = useControlled({
11
+ controlled,
12
+ default: defaultValue,
13
+ onChange
14
+ });
15
+ const selectedOption = useMemo(()=>options.find((option)=>option.data === value && !option.disabled), [
16
+ options,
17
+ value
18
+ ]);
19
+ function handleChange(option) {
20
+ if (!option || option.disabled) return;
21
+ setValue(option.data);
22
+ }
23
+ return /*#__PURE__*/ jsx(Listbox, {
24
+ value: selectedOption ?? null,
25
+ onChange: handleChange,
26
+ disabled: disabled,
27
+ children: /*#__PURE__*/ jsxs("div", {
28
+ className: classnames(className, 'fwe-select-wrapper', {
29
+ 'fwe-disabled': disabled
30
+ }),
31
+ ref: ref,
32
+ ...props,
33
+ children: [
34
+ /*#__PURE__*/ jsx(ListboxButton, {
35
+ className: classnames('fwe-select', {
36
+ 'fwe-invalid': error
37
+ }),
38
+ id: id,
39
+ "aria-labelledby": label ? labelId : void 0,
40
+ disabled: disabled,
41
+ children: selectedOption ? selectedOption.label : placeholder ?? ''
42
+ }),
43
+ /*#__PURE__*/ jsx("label", {
44
+ className: "fwe-select-label",
45
+ id: labelId,
46
+ htmlFor: id,
47
+ children: label || ''
48
+ }),
49
+ /*#__PURE__*/ jsx(ListboxOptions, {
50
+ className: "fwe-options-container",
51
+ as: "ul",
52
+ portal: false,
53
+ style: {
54
+ minWidth: 'var(--button-width)'
55
+ },
56
+ anchor: {
57
+ to: 'bottom start',
58
+ gap: 12,
59
+ padding: 8
60
+ },
61
+ children: options.map((option)=>/*#__PURE__*/ jsx(ListboxOption, {
62
+ value: option,
63
+ disabled: option.disabled,
64
+ as: "li",
65
+ className: ({ focus, selected, disabled: isDisabled })=>classnames('fwe-combobox-option', {
66
+ 'fwe-selected': selected,
67
+ 'fwe-focus': focus,
68
+ 'fwe-disabled': isDisabled
69
+ }),
70
+ children: option.label
71
+ }, String(option.data)))
72
+ }),
73
+ name && /*#__PURE__*/ jsx("input", {
74
+ type: "hidden",
75
+ name: name,
76
+ value: String(value ?? ''),
77
+ disabled: disabled
78
+ }),
79
+ hint && !error && /*#__PURE__*/ jsx("div", {
80
+ className: "fwe-select-description",
81
+ children: hint
82
+ }),
83
+ error && /*#__PURE__*/ jsx("div", {
84
+ className: "fwe-select-invalid",
85
+ children: error
86
+ })
87
+ ]
88
+ })
89
+ });
90
+ }
91
+ const Select = /*#__PURE__*/ forwardRef(SelectComponent);
92
+ Select.displayName = 'Select';
93
+ export { Select };
File without changes
File without changes
@@ -0,0 +1,50 @@
1
+ label.fwe-slider {
2
+ display: block;
3
+ position: relative;
4
+ }
5
+
6
+ label.fwe-slider .fr-slider-indicator {
7
+ background: var(--fwe-hero);
8
+ height: 2px;
9
+ position: absolute;
10
+ bottom: 22px;
11
+ left: 0;
12
+ }
13
+
14
+ label.fwe-slider .fr-slider-indicator.disabled {
15
+ background: var(--fwe-border);
16
+ }
17
+
18
+ label.fwe-slider.fr-slider-value {
19
+ height: 56px;
20
+ }
21
+
22
+ label.fwe-slider.fr-slider-value .fr-slider-indicator {
23
+ bottom: 38px;
24
+ }
25
+
26
+ label.fwe-slider.fr-slider-label {
27
+ height: 67px;
28
+ }
29
+
30
+ label.fwe-slider.fr-slider-label .fr-slider-indicator {
31
+ bottom: 22px;
32
+ }
33
+
34
+ label.fwe-slider.fr-slider-value-label {
35
+ height: 83px;
36
+ }
37
+
38
+ label.fwe-slider.fr-slider-value-label .fr-slider-indicator {
39
+ bottom: 38px;
40
+ }
41
+
42
+ label.fwe-slider .fr-slider-value {
43
+ color: var(--fwe-text);
44
+ font-size: var(--fwe-font-size-base);
45
+ user-select: none;
46
+ margin-bottom: 0;
47
+ position: absolute;
48
+ bottom: 0;
49
+ }
50
+
@@ -0,0 +1,14 @@
1
+ import './Slider.scss';
2
+ import { type ComponentPropsWithoutRef } from 'react';
3
+ export interface SliderProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'value' | 'defaultValue' | 'min' | 'max' | 'step'> {
4
+ readonly min: number;
5
+ readonly max: number;
6
+ readonly step?: number;
7
+ readonly value: number;
8
+ readonly onChangeCommitted?: (value: number) => void;
9
+ readonly label?: string;
10
+ readonly showValue?: boolean;
11
+ readonly onChange?: (value: number, event: React.ChangeEvent<HTMLInputElement>) => void;
12
+ readonly widthOffset?: number;
13
+ }
14
+ export declare const Slider: (props: SliderProps & import("react").RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
@@ -0,0 +1,98 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "./Slider.css";
3
+ import classnames from "classnames";
4
+ import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
5
+ import { useForkRef } from "../../utils/useForkRef.js";
6
+ import { useId } from "../../utils/useId.js";
7
+ const Slider = /*#__PURE__*/ forwardRef(({ disabled = false, label, name, max, min, onChange, onChangeCommitted, step, value, showValue = true, className, id: idProps, widthOffset = 8, ...props }, ref)=>{
8
+ const id = useId(idProps);
9
+ const [innerValue, setInnerValue] = useState(value);
10
+ const [left, setLeft] = useState(null);
11
+ const [numberOffset, setNumberOffset] = useState(0);
12
+ const labelEl = useRef(null);
13
+ const handleRef = useForkRef(ref, labelEl);
14
+ const classes = classnames('fwe-slider', {
15
+ 'fr-slider-value': !label && showValue
16
+ }, {
17
+ 'fr-slider-label': label && !showValue
18
+ }, {
19
+ 'fr-slider-value-label': label && showValue
20
+ }, className);
21
+ useEffect(()=>{
22
+ setInnerValue(value);
23
+ }, [
24
+ value
25
+ ]);
26
+ const updateValuePosition = useCallback(()=>{
27
+ if (labelEl.current) {
28
+ const { width } = labelEl.current.getBoundingClientRect();
29
+ const diff = max - min;
30
+ setLeft((innerValue - min) / diff * (width - widthOffset));
31
+ setNumberOffset(8 - 6 * innerValue.toString().length);
32
+ }
33
+ }, [
34
+ innerValue,
35
+ max,
36
+ min,
37
+ widthOffset
38
+ ]);
39
+ const handleAfterChange = ()=>{
40
+ if (onChangeCommitted) onChangeCommitted(innerValue);
41
+ };
42
+ const handleChange = (e)=>{
43
+ const newValue = Number.parseFloat(e.target.value);
44
+ setInnerValue(newValue);
45
+ if (onChange) onChange(newValue, e);
46
+ };
47
+ useEffect(()=>{
48
+ function handleResize() {
49
+ updateValuePosition();
50
+ }
51
+ window.addEventListener('resize', handleResize);
52
+ handleResize();
53
+ return ()=>window.removeEventListener('resize', handleResize);
54
+ }, [
55
+ updateValuePosition
56
+ ]);
57
+ return /*#__PURE__*/ jsxs("label", {
58
+ ref: handleRef,
59
+ className: classes,
60
+ htmlFor: id,
61
+ children: [
62
+ label && /*#__PURE__*/ jsx("span", {
63
+ children: label
64
+ }),
65
+ /*#__PURE__*/ jsx("input", {
66
+ id: id,
67
+ className: "fwe-slider-input",
68
+ type: "range",
69
+ name: name,
70
+ disabled: disabled,
71
+ min: min,
72
+ max: max,
73
+ step: step,
74
+ onChange: handleChange,
75
+ value: innerValue,
76
+ onKeyUp: handleAfterChange,
77
+ onMouseUp: handleAfterChange,
78
+ onTouchEnd: handleAfterChange,
79
+ ...props
80
+ }),
81
+ showValue && null !== left && /*#__PURE__*/ jsx("span", {
82
+ className: "fr-slider-value",
83
+ style: {
84
+ left: `${left + numberOffset}px`
85
+ },
86
+ children: innerValue
87
+ }),
88
+ /*#__PURE__*/ jsx("div", {
89
+ className: `fr-slider-indicator${disabled ? ' disabled' : ''}`,
90
+ style: {
91
+ width: `${left}px`
92
+ }
93
+ })
94
+ ]
95
+ });
96
+ });
97
+ Slider.displayName = 'Slider';
98
+ export { Slider };
@@ -0,0 +1,10 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ export interface SwitchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'value' | 'defaultValue' | 'checked'> {
3
+ readonly labelPosition?: 'before' | 'after' | 'below';
4
+ readonly large?: boolean;
5
+ readonly title: string;
6
+ readonly value?: boolean;
7
+ readonly defaultValue?: boolean;
8
+ readonly onChange?: (value: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
9
+ }
10
+ export declare const Switch: (props: SwitchProps & import("react").RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
@@ -0,0 +1,48 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import { forwardRef } from "react";
4
+ import { useControlled } from "../../utils/useControlled.js";
5
+ import { useId } from "../../utils/useId.js";
6
+ const Switch = /*#__PURE__*/ forwardRef(({ labelPosition = 'after', large = false, title, name, required = false, value, defaultValue, disabled = false, onChange, className, id: idProps, ...props }, ref)=>{
7
+ const id = useId(idProps);
8
+ const labelClassName = classnames('fwe-switch', {
9
+ [`fwe-switch-label-${labelPosition}`]: true
10
+ }, {
11
+ 'fwe-switch-lg': large
12
+ }, className);
13
+ const [currentValue, setCurrentValue] = useControlled({
14
+ controlled: value,
15
+ default: defaultValue
16
+ });
17
+ const handleChange = (event)=>{
18
+ const newValue = !currentValue;
19
+ setCurrentValue(newValue);
20
+ if (onChange) onChange(newValue, event);
21
+ };
22
+ return /*#__PURE__*/ jsxs("label", {
23
+ className: labelClassName,
24
+ htmlFor: id,
25
+ ref: ref,
26
+ children: [
27
+ /*#__PURE__*/ jsx("input", {
28
+ type: "checkbox",
29
+ name: name,
30
+ required: required,
31
+ disabled: disabled,
32
+ checked: currentValue,
33
+ onChange: handleChange,
34
+ id: id,
35
+ ...props
36
+ }),
37
+ /*#__PURE__*/ jsx("div", {
38
+ className: "fwe-switch-track"
39
+ }),
40
+ /*#__PURE__*/ jsx("div", {
41
+ className: "fwe-switch-label-content",
42
+ children: title
43
+ })
44
+ ]
45
+ });
46
+ });
47
+ Switch.displayName = 'Switch';
48
+ export { Switch };
@@ -0,0 +1,14 @@
1
+ label.fwe-input-text .fwe-input-text-count {
2
+ line-height: var(--fwe-line-height-base);
3
+ color: var(--fwe-text-disabled);
4
+ font-size: var(--fwe-font-size-small);
5
+ display: block;
6
+ position: absolute;
7
+ bottom: 0;
8
+ right: 0;
9
+ }
10
+
11
+ label.fwe-input-text .fr-textarea {
12
+ overflow: visible;
13
+ }
14
+