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

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 (209) 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 +41 -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 +11 -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 +60 -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 +61 -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 +20 -0
  20. package/dist/components/bottom-sheet/BottomSheet.css +18 -0
  21. package/dist/components/bottom-sheet/BottomSheet.d.ts +11 -0
  22. package/dist/components/bottom-sheet/BottomSheet.js +101 -0
  23. package/dist/components/breadcrumb/Breadcrumb.d.ts +14 -0
  24. package/dist/components/breadcrumb/Breadcrumb.js +87 -0
  25. package/dist/components/button/Button.d.ts +11 -0
  26. package/dist/components/button/Button.js +36 -0
  27. package/dist/components/card/Card.d.ts +5 -0
  28. package/dist/components/card/Card.js +9 -0
  29. package/dist/components/card/CardBody.d.ts +5 -0
  30. package/dist/components/card/CardBody.js +15 -0
  31. package/dist/components/card/CardHeader.d.ts +8 -0
  32. package/dist/components/card/CardHeader.js +31 -0
  33. package/dist/components/card/CardHeader.stories.helper.js +7 -0
  34. package/dist/components/card/CardNotification.d.ts +6 -0
  35. package/dist/components/card/CardNotification.js +26 -0
  36. package/dist/components/chips/chip/Chip.d.ts +17 -0
  37. package/dist/components/chips/chip/Chip.js +38 -0
  38. package/dist/components/chips/chip-container/ChipContainer.d.ts +5 -0
  39. package/dist/components/chips/chip-container/ChipContainer.js +12 -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 +41 -0
  44. package/dist/components/mobile-flyout/MobileFlyout.d.ts +11 -0
  45. package/dist/components/mobile-flyout/MobileFlyout.js +88 -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 +17 -0
  49. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +36 -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 +35 -0
  53. package/dist/components/modals/AlertModal.d.ts +12 -0
  54. package/dist/components/modals/AlertModal.js +53 -0
  55. package/dist/components/modals/ConfirmModal.d.ts +11 -0
  56. package/dist/components/modals/ConfirmModal.js +46 -0
  57. package/dist/components/modals/CustomModal.d.ts +8 -0
  58. package/dist/components/modals/CustomModal.js +38 -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 +31 -0
  62. package/dist/components/modals/ModalBase.d.ts +9 -0
  63. package/dist/components/modals/ModalBase.js +124 -0
  64. package/dist/components/modals/ModalFooter.d.ts +2 -0
  65. package/dist/components/modals/ModalFooter.js +12 -0
  66. package/dist/components/modals/Prompt.d.ts +16 -0
  67. package/dist/components/modals/Prompt.js +58 -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 +103 -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 +15 -0
  90. package/dist/components/pagination/Pagination.js +100 -0
  91. package/dist/components/popovers/legend/Legend.d.ts +10 -0
  92. package/dist/components/popovers/legend/Legend.js +22 -0
  93. package/dist/components/popovers/popover/Popover.css +8 -0
  94. package/dist/components/popovers/popover/Popover.d.ts +19 -0
  95. package/dist/components/popovers/popover/Popover.js +82 -0
  96. package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +7 -0
  97. package/dist/components/popovers/popover-menu/PopoverMenu.js +31 -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 +7 -0
  101. package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +27 -0
  102. package/dist/components/popovers/tooltip/Tooltip.d.ts +5 -0
  103. package/dist/components/popovers/tooltip/Tooltip.js +12 -0
  104. package/dist/components/progress/Progress.d.ts +7 -0
  105. package/dist/components/progress/Progress.js +26 -0
  106. package/dist/components/search-input/ClearButton.d.ts +2 -0
  107. package/dist/components/search-input/ClearButton.js +10 -0
  108. package/dist/components/search-input/SearchInput.css +13 -0
  109. package/dist/components/search-input/SearchInput.d.ts +14 -0
  110. package/dist/components/search-input/SearchInput.js +61 -0
  111. package/dist/components/search-input/SearchSuggestion.d.ts +17 -0
  112. package/dist/components/search-input/SearchSuggestion.js +21 -0
  113. package/dist/components/search-input/useSearchInput.d.ts +13 -0
  114. package/dist/components/search-input/useSearchInput.js +85 -0
  115. package/dist/components/snackbar/Snackbar.css +55 -0
  116. package/dist/components/snackbar/Snackbar.d.ts +21 -0
  117. package/dist/components/snackbar/Snackbar.js +78 -0
  118. package/dist/components/snackbar/SnackbarContext.d.ts +7 -0
  119. package/dist/components/snackbar/SnackbarContext.js +3 -0
  120. package/dist/components/snackbar/SnackbarProvider.d.ts +7 -0
  121. package/dist/components/snackbar/SnackbarProvider.js +66 -0
  122. package/dist/components/snackbar/useSnackbar.d.ts +2 -0
  123. package/dist/components/snackbar/useSnackbar.js +4 -0
  124. package/dist/components/stepper-horizontal/StepperHorizontal.css +6 -0
  125. package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +7 -0
  126. package/dist/components/stepper-horizontal/StepperHorizontal.js +48 -0
  127. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.css +24 -0
  128. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +6 -0
  129. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +16 -0
  130. package/dist/components/stepper-vertical/StepperVertical.d.ts +6 -0
  131. package/dist/components/stepper-vertical/StepperVertical.js +25 -0
  132. package/dist/components/stepper-vertical/step-vertical/StepVertical.css +10 -0
  133. package/dist/components/stepper-vertical/step-vertical/StepVertical.d.ts +11 -0
  134. package/dist/components/stepper-vertical/step-vertical/StepVertical.js +58 -0
  135. package/dist/components/tab/Tabs.css +285 -0
  136. package/dist/components/tab/Tabs.d.ts +22 -0
  137. package/dist/components/tab/Tabs.js +193 -0
  138. package/dist/components/tab/interfaces.d.ts +5 -0
  139. package/dist/components/tab/interfaces.js +0 -0
  140. package/dist/components/tab/tab-pane/TabPane.css +8 -0
  141. package/dist/components/tab/tab-pane/TabPane.d.ts +9 -0
  142. package/dist/components/tab/tab-pane/TabPane.js +18 -0
  143. package/dist/components/tab/useTabScroll.d.ts +25 -0
  144. package/dist/components/tab/useTabScroll.js +151 -0
  145. package/dist/components/table-header-cell/TableHeaderCell.d.ts +5 -0
  146. package/dist/components/table-header-cell/TableHeaderCell.js +21 -0
  147. package/dist/forms/checkbox/Checkbox.css +134 -0
  148. package/dist/forms/checkbox/Checkbox.d.ts +15 -0
  149. package/dist/forms/checkbox/Checkbox.js +80 -0
  150. package/dist/forms/combobox/ComboBox.css +124 -0
  151. package/dist/forms/combobox/ComboBox.d.ts +28 -0
  152. package/dist/forms/combobox/ComboBox.js +175 -0
  153. package/dist/forms/multi-select/MultiSelect.d.ts +20 -0
  154. package/dist/forms/multi-select/MultiSelect.js +191 -0
  155. package/dist/forms/multi-select/MultiSelect.module.js +8 -0
  156. package/dist/forms/multi-select/MultiSelect_module.css +13 -0
  157. package/dist/forms/radio/RadioButton.d.ts +14 -0
  158. package/dist/forms/radio/RadioButton.js +61 -0
  159. package/dist/forms/radio/RadioGroup.d.ts +12 -0
  160. package/dist/forms/radio/RadioGroup.js +50 -0
  161. package/dist/forms/radio/RadioGroupContext.d.ts +12 -0
  162. package/dist/forms/radio/RadioGroupContext.js +3 -0
  163. package/dist/forms/segment/Segment.d.ts +13 -0
  164. package/dist/forms/segment/Segment.js +58 -0
  165. package/dist/forms/segment/segment-control/SegmentControl.d.ts +14 -0
  166. package/dist/forms/segment/segment-control/SegmentControl.js +57 -0
  167. package/dist/forms/select/Select.d.ts +25 -0
  168. package/dist/forms/select/Select.js +92 -0
  169. package/dist/forms/select/internal/SelectButton.d.ts +0 -0
  170. package/dist/forms/select/internal/SelectButton.js +0 -0
  171. package/dist/forms/select/internal/SelectButtonContent.d.ts +0 -0
  172. package/dist/forms/select/internal/SelectButtonContent.js +0 -0
  173. package/dist/forms/select/internal/SelectOptionsContainer.d.ts +0 -0
  174. package/dist/forms/select/internal/SelectOptionsContainer.js +0 -0
  175. package/dist/forms/slider/Slider.css +50 -0
  176. package/dist/forms/slider/Slider.d.ts +17 -0
  177. package/dist/forms/slider/Slider.js +93 -0
  178. package/dist/forms/switch/Switch.d.ts +12 -0
  179. package/dist/forms/switch/Switch.js +42 -0
  180. package/dist/forms/text-area/TextArea.css +14 -0
  181. package/dist/forms/text-area/TextArea.d.ts +22 -0
  182. package/dist/forms/text-area/TextArea.js +99 -0
  183. package/dist/forms/text-input/TextInput.d.ts +24 -0
  184. package/dist/forms/text-input/TextInput.js +74 -0
  185. package/dist/forms/time-picker/TimePicker.css +10 -0
  186. package/dist/forms/time-picker/TimePicker.d.ts +24 -0
  187. package/dist/forms/time-picker/TimePicker.js +123 -0
  188. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.css +4 -0
  189. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +19 -0
  190. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +208 -0
  191. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +9 -0
  192. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +14 -0
  193. package/dist/index.d.ts +60 -0
  194. package/dist/index.js +60 -0
  195. package/dist/utils/index.d.ts +1 -0
  196. package/dist/utils/index.js +7 -0
  197. package/dist/utils/setRef.d.ts +1 -0
  198. package/dist/utils/setRef.js +5 -0
  199. package/dist/utils/types.d.ts +36 -0
  200. package/dist/utils/types.js +0 -0
  201. package/dist/utils/useControlled.d.ts +7 -0
  202. package/dist/utils/useControlled.js +20 -0
  203. package/dist/utils/useForkRef.d.ts +2 -0
  204. package/dist/utils/useForkRef.js +15 -0
  205. package/dist/utils/useId.d.ts +1 -0
  206. package/dist/utils/useId.js +20 -0
  207. package/dist/utils/useOnClickOutside.d.ts +2 -0
  208. package/dist/utils/useOnClickOutside.js +20 -0
  209. package/package.json +1 -1
@@ -0,0 +1,193 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import "./Tabs.css";
3
+ import classnames from "classnames";
4
+ import react, { forwardRef, isValidElement, useEffect, useRef, useState } from "react";
5
+ import { useForkRef } from "../../utils/useForkRef.js";
6
+ import { IconWrapper } from "../icon-wrapper/IconWrapper.js";
7
+ import { useTabScroll } from "./useTabScroll.js";
8
+ let nextId = 0;
9
+ const Tabs = /*#__PURE__*/ forwardRef(({ config, children, className, onChange, viewType = 'responsive', showDivider = false, ...props }, ref)=>{
10
+ const [useCompactDensity, setCompactDensity] = useState(true);
11
+ const componentId = useRef(`tabs-${++nextId}`);
12
+ const elRef = useRef(null);
13
+ const combinedRef = useForkRef(ref, elRef);
14
+ const scrollContent = useRef(null);
15
+ const scrollArea = useRef(null);
16
+ const observer = useRef(null);
17
+ let activeId = '';
18
+ react.Children.forEach(children, (element, i)=>{
19
+ if (/*#__PURE__*/ react.isValidElement(element)) {
20
+ if ('' === activeId || element.props.active) activeId = `${componentId.current}-tab-panel-${i}`;
21
+ }
22
+ });
23
+ const [currentId, setId] = useState(activeId);
24
+ const innerChildren = react.Children.map(children, (element, i)=>{
25
+ if (/*#__PURE__*/ isValidElement(element)) {
26
+ const newId = `${componentId.current}-tab-panel-${i}`;
27
+ return /*#__PURE__*/ react.cloneElement(element, {
28
+ isVisible: newId === currentId,
29
+ active: newId === currentId,
30
+ id: newId,
31
+ tabId: `${componentId.current}-tab-${i}`,
32
+ ...element.props
33
+ });
34
+ }
35
+ });
36
+ const [handleTabScroll, classes, style] = useTabScroll(innerChildren?.length ?? 0, componentId.current, {
37
+ elRef,
38
+ scrollContent,
39
+ scrollArea
40
+ });
41
+ useEffect(()=>{
42
+ const { current } = scrollArea;
43
+ if (current) {
44
+ const initialWidth = current.offsetWidth;
45
+ if (initialWidth > 768) setCompactDensity(false);
46
+ observer.current = new ResizeObserver(()=>{
47
+ const width = current.offsetWidth;
48
+ if (width > 768 && useCompactDensity) setCompactDensity(false);
49
+ else if (width <= 768 && !useCompactDensity) setCompactDensity(true);
50
+ });
51
+ if (current) observer.current.observe(current);
52
+ }
53
+ return ()=>{
54
+ if (current && observer && observer.current) observer.current.unobserve(current);
55
+ };
56
+ }, [
57
+ useCompactDensity
58
+ ]);
59
+ const showTabPane = (id)=>{
60
+ if (null == id) return;
61
+ if (onChange) onChange({
62
+ previous: currentId,
63
+ current: id
64
+ });
65
+ setId(id);
66
+ };
67
+ function handleClick(e, index, id) {
68
+ handleTabScroll(e, index);
69
+ if (void 0 !== id) showTabPane(id);
70
+ }
71
+ return /*#__PURE__*/ jsx(Fragment, {
72
+ children: 'legacy' === viewType ? /*#__PURE__*/ jsxs("div", {
73
+ className: classnames('fwe-legacy-tabs', className),
74
+ children: [
75
+ /*#__PURE__*/ jsx("ul", {
76
+ role: "tablist",
77
+ className: classnames('fwe-legacy-tab-bar', {
78
+ 'fwe-legacy-tab-bar-full-width': config?.tabBar?.fullWidth
79
+ }, {
80
+ 'fwe-legacy-tab-items-equal-width': config?.tabItems?.appearance === 'equal'
81
+ }, {
82
+ 'fwe-legacy-tab-items-fill': config?.tabItems?.appearance === 'fill'
83
+ }),
84
+ children: innerChildren?.map((child, i)=>{
85
+ const { active, icon, name, id, tabId } = child.props;
86
+ return /*#__PURE__*/ jsx("li", {
87
+ className: classnames('fwe-legacy-tab-item', {
88
+ 'fwe-active': active
89
+ }),
90
+ children: icon ? /*#__PURE__*/ jsxs("button", {
91
+ type: "button",
92
+ id: tabId,
93
+ className: classnames('fwe-legacy-tab-link', {
94
+ 'fwe-can-swap-icon': 2 === innerChildren.length && 1 === i
95
+ }),
96
+ role: "tab",
97
+ "aria-controls": id,
98
+ "aria-selected": active,
99
+ onClick: ()=>showTabPane(id),
100
+ children: [
101
+ /*#__PURE__*/ jsx(IconWrapper, {
102
+ icon: icon
103
+ }),
104
+ /*#__PURE__*/ jsx("span", {
105
+ children: name
106
+ })
107
+ ]
108
+ }) : /*#__PURE__*/ jsx("button", {
109
+ type: "button",
110
+ id: tabId,
111
+ className: "fwe-legacy-tab-link",
112
+ role: "tab",
113
+ "aria-controls": id,
114
+ "aria-selected": active,
115
+ onClick: ()=>showTabPane(id),
116
+ children: name
117
+ })
118
+ }, tabId);
119
+ })
120
+ }),
121
+ /*#__PURE__*/ jsx("div", {
122
+ className: "fwe-legacy-tab-panel-content",
123
+ children: innerChildren
124
+ })
125
+ ]
126
+ }) : /*#__PURE__*/ jsxs("div", {
127
+ className: "fr-tab-bar",
128
+ role: "tablist",
129
+ ref: combinedRef,
130
+ ...props,
131
+ children: [
132
+ /*#__PURE__*/ jsx("div", {
133
+ className: classnames('fr-tab-scroller', classes),
134
+ children: /*#__PURE__*/ jsx("div", {
135
+ className: classnames('fr-tab-scroller-scroll-area fr-tab-scroller-scroll-area--scroll', {
136
+ 'fr-tab-scroller-scroll-area--compact': useCompactDensity
137
+ }),
138
+ ref: scrollArea,
139
+ children: /*#__PURE__*/ jsxs("div", {
140
+ className: classnames('fr-tab-scroller-scroll-content', {
141
+ 'fr-tab-scroller-scroll-content--with-divider': showDivider
142
+ }),
143
+ ref: scrollContent,
144
+ style: style,
145
+ children: [
146
+ innerChildren?.map((child, i)=>{
147
+ const { active, name, id, tabId } = child.props;
148
+ return /*#__PURE__*/ jsxs("button", {
149
+ type: "button",
150
+ role: "tab",
151
+ className: classnames('fr-tab', {
152
+ 'fr-tab--active': active
153
+ }),
154
+ id: tabId,
155
+ "aria-controls": id,
156
+ "aria-selected": active,
157
+ tabIndex: 0 === i ? 0 : 1,
158
+ onClick: (e)=>handleClick(e, i, id),
159
+ children: [
160
+ /*#__PURE__*/ jsx("span", {
161
+ className: "fr-tab-content",
162
+ children: /*#__PURE__*/ jsx("span", {
163
+ className: "fr-tab-text-label",
164
+ children: name
165
+ })
166
+ }),
167
+ /*#__PURE__*/ jsx("span", {
168
+ className: classnames('fr-tab-indicator', {
169
+ 'fr-tab-indicator--active': active
170
+ }),
171
+ children: /*#__PURE__*/ jsx("span", {
172
+ className: "fr-tab-indicator-content fr-tab-indicator-content--underline"
173
+ })
174
+ })
175
+ ]
176
+ }, tabId);
177
+ }),
178
+ /*#__PURE__*/ jsx("div", {
179
+ className: "fr-tab-scroller-divider-line"
180
+ })
181
+ ]
182
+ })
183
+ })
184
+ }),
185
+ /*#__PURE__*/ jsx("div", {
186
+ className: "fr-tab-panel-content",
187
+ children: innerChildren
188
+ })
189
+ ]
190
+ })
191
+ });
192
+ });
193
+ export { Tabs };
@@ -0,0 +1,5 @@
1
+ export type Tab = {
2
+ icon?: React.ReactNode;
3
+ active?: boolean;
4
+ name: string;
5
+ };
File without changes
@@ -0,0 +1,8 @@
1
+ .fr-show {
2
+ display: block;
3
+ }
4
+
5
+ .fr-hide {
6
+ display: none;
7
+ }
8
+
@@ -0,0 +1,9 @@
1
+ import './TabPane.scss';
2
+ import type { ClassNamePropsWithChildren } from '../../../utils/types';
3
+ import type { Tab } from '../interfaces';
4
+ export interface TabPaneProps extends ClassNamePropsWithChildren, Tab {
5
+ readonly id?: string;
6
+ readonly isVisible?: boolean;
7
+ readonly tabId?: string;
8
+ }
9
+ export declare function TabPane({ isVisible, children, className, tabId, id, }: TabPaneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "./TabPane.css";
3
+ import classnames from "classnames";
4
+ function TabPane({ isVisible = false, children, className, tabId, id }) {
5
+ const tabPaneClasses = classnames({
6
+ 'fr-show': isVisible
7
+ }, {
8
+ 'fr-hide': !isVisible
9
+ }, className);
10
+ return /*#__PURE__*/ jsx("div", {
11
+ id: id,
12
+ role: "tabpanel",
13
+ "aria-labelledby": tabId,
14
+ className: tabPaneClasses,
15
+ children: children
16
+ });
17
+ }
18
+ export { TabPane };
@@ -0,0 +1,25 @@
1
+ import type React from 'react';
2
+ import { type CSSProperties } from 'react';
3
+ export interface TabDimensions {
4
+ rootLeft: number;
5
+ rootRight: number;
6
+ contentLeft: number;
7
+ contentRight: number;
8
+ }
9
+ export interface TabScrollAnimation {
10
+ finalScrollPosition: number;
11
+ scrollDelta: number;
12
+ }
13
+ export interface TabScrollHorizontalEdges {
14
+ left: number;
15
+ right: number;
16
+ }
17
+ type TypeHandleTabScroll = (e: React.MouseEvent<HTMLButtonElement>, index: number) => void;
18
+ interface Refs {
19
+ elRef: React.MutableRefObject<HTMLDivElement | null>;
20
+ scrollContent: React.MutableRefObject<HTMLDivElement | null>;
21
+ scrollArea: React.MutableRefObject<HTMLDivElement | null>;
22
+ }
23
+ type TypeUseTabScroll = (tabLength: number, componentId: string, refs: Refs) => [TypeHandleTabScroll, string, CSSProperties];
24
+ export declare const useTabScroll: TypeUseTabScroll;
25
+ export {};
@@ -0,0 +1,151 @@
1
+ import { useState } from "react";
2
+ const useTabScroll = (tabLength, componentId, refs)=>{
3
+ const { elRef, scrollContent, scrollArea } = refs;
4
+ const [style, setStyle] = useState({});
5
+ const [classes, setClasses] = useState('');
6
+ function getScrollContentStyleValue(propName) {
7
+ return scrollContent.current ? window.getComputedStyle(scrollContent.current).getPropertyValue(propName) : '';
8
+ }
9
+ function calculateCurrentTranslateX() {
10
+ const transformValue = getScrollContentStyleValue('transform');
11
+ if ('none' === transformValue) return 0;
12
+ const match = /\((.+?)\)/.exec(transformValue);
13
+ if (!match) return 0;
14
+ const matrixParams = match[1];
15
+ const [_a, _b, _c, _d, tx, _ty] = matrixParams.split(',');
16
+ return parseFloat(tx);
17
+ }
18
+ function getScrollPosition() {
19
+ const currentTranslateX = calculateCurrentTranslateX();
20
+ const scrollLeft = scrollArea.current?.scrollLeft ?? 0;
21
+ return scrollLeft - currentTranslateX;
22
+ }
23
+ function calculateScrollEdges() {
24
+ const scrollContentWidth = scrollContent.current?.offsetWidth ?? 0;
25
+ const scrollAreaWidth = scrollArea.current?.offsetWidth ?? 0;
26
+ return {
27
+ left: 0,
28
+ right: scrollContentWidth - scrollAreaWidth
29
+ };
30
+ }
31
+ function clampScrollValue(scrollX) {
32
+ const edges = calculateScrollEdges();
33
+ return Math.min(Math.max(edges.left, scrollX), edges.right);
34
+ }
35
+ function getIncrementScrollOperation(scrollX) {
36
+ const currentScrollX = getScrollPosition();
37
+ const targetScrollX = scrollX + currentScrollX;
38
+ const safeScrollX = clampScrollValue(targetScrollX);
39
+ const scrollDelta = safeScrollX - currentScrollX;
40
+ return {
41
+ finalScrollPosition: safeScrollX,
42
+ scrollDelta
43
+ };
44
+ }
45
+ function getAnimatingScrollPosition() {
46
+ const currentTranslateX = calculateCurrentTranslateX();
47
+ const scrollLeft = scrollArea.current?.scrollLeft ?? 0;
48
+ return scrollLeft - currentTranslateX;
49
+ }
50
+ function stopScrollAnimation() {
51
+ const currentScrollPosition = getAnimatingScrollPosition();
52
+ setClasses('');
53
+ setStyle({
54
+ transform: 'translateX(0px)'
55
+ });
56
+ if (scrollArea.current) scrollArea.current.scrollLeft = currentScrollPosition;
57
+ }
58
+ function animate(animation) {
59
+ if (0 === animation.scrollDelta) return;
60
+ stopScrollAnimation();
61
+ if (scrollArea.current) scrollArea.current.scrollLeft = animation.finalScrollPosition;
62
+ setStyle({
63
+ transform: `translateX(${animation.scrollDelta}px)`
64
+ });
65
+ if (scrollArea.current) scrollArea.current.getBoundingClientRect();
66
+ requestAnimationFrame(()=>{
67
+ setClasses('fr-tab-scroller--animating');
68
+ setStyle({
69
+ transform: 'none'
70
+ });
71
+ });
72
+ }
73
+ function incrementScroll(scrollXIncrement) {
74
+ if (0 === scrollXIncrement) return;
75
+ const scrollOperation = getIncrementScrollOperation(scrollXIncrement);
76
+ animate(scrollOperation);
77
+ }
78
+ function computeDimensions(tab) {
79
+ const rootWidth = tab.offsetWidth;
80
+ const rootLeft = tab.offsetLeft;
81
+ const tabContent = tab.querySelector('.fr-tab-content');
82
+ const contentWidth = tabContent?.offsetWidth ?? 0;
83
+ const contentLeft = tabContent?.offsetLeft ?? 0;
84
+ return {
85
+ contentLeft: rootLeft + contentLeft,
86
+ contentRight: rootLeft + contentLeft + contentWidth,
87
+ rootLeft,
88
+ rootRight: rootLeft + rootWidth
89
+ };
90
+ }
91
+ function calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth) {
92
+ const nextTab = elRef.current?.querySelector(`#${componentId}-tab-${nextIndex}`);
93
+ if (null == nextTab) return 0;
94
+ const nextTabDimensions = computeDimensions(nextTab);
95
+ const relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
96
+ const relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
97
+ const leftIncrement = relativeContentRight - 48;
98
+ const rightIncrement = relativeContentLeft + 48;
99
+ if (nextIndex < index) return Math.min(leftIncrement, 0);
100
+ return Math.max(rightIncrement, 0);
101
+ }
102
+ function findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth) {
103
+ const relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
104
+ const relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
105
+ const relativeRootDelta = relativeRootLeft + relativeRootRight;
106
+ const leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
107
+ const rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
108
+ if (leftEdgeIsCloser) return index - 1;
109
+ if (rightEdgeIsCloser) return index + 1;
110
+ return -1;
111
+ }
112
+ function indexIsInRange(index) {
113
+ return index >= 0 && index < tabLength;
114
+ }
115
+ function scrollIntoView(index, tab) {
116
+ const scrollPosition = getScrollPosition();
117
+ const barWidth = scrollArea.current?.offsetWidth ?? 0;
118
+ const tabDimensions = computeDimensions(tab);
119
+ const nextIndex = findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth);
120
+ if (!indexIsInRange(nextIndex)) return;
121
+ const scrollIncrement = calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth);
122
+ incrementScroll(scrollIncrement);
123
+ }
124
+ function scrollTo(scrollX) {
125
+ const currentScrollX = getScrollPosition();
126
+ const safeScrollX = clampScrollValue(scrollX);
127
+ const scrollDelta = safeScrollX - currentScrollX;
128
+ animate({
129
+ finalScrollPosition: safeScrollX,
130
+ scrollDelta
131
+ });
132
+ }
133
+ function handleTabScroll(e, index) {
134
+ const scrollContentWidth = scrollContent.current?.offsetWidth ?? 0;
135
+ const scrollAreaWidth = scrollArea.current?.offsetWidth ?? 0;
136
+ if (scrollAreaWidth > scrollContentWidth) return;
137
+ if (!indexIsInRange(index)) return;
138
+ if (0 === index) return void scrollTo(0);
139
+ if (index === tabLength - 1 && scrollContent.current) return void scrollTo(scrollContent.current.offsetWidth);
140
+ if (e.currentTarget instanceof HTMLElement) {
141
+ const currentTab = e.currentTarget;
142
+ scrollIntoView(index, currentTab);
143
+ }
144
+ }
145
+ return [
146
+ handleTabScroll,
147
+ classes,
148
+ style
149
+ ];
150
+ };
151
+ export { useTabScroll };
@@ -0,0 +1,5 @@
1
+ export interface TableHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
2
+ readonly active?: boolean;
3
+ readonly ascending: boolean;
4
+ }
5
+ export declare const TableHeaderCell: (props: TableHeaderCellProps & import("react").RefAttributes<HTMLTableCellElement>) => React.ReactElement | null;
@@ -0,0 +1,21 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import { forwardRef } from "react";
4
+ const TableHeaderCell = /*#__PURE__*/ forwardRef(({ active, ascending, className, ...props }, ref)=>{
5
+ function handleClick(event) {
6
+ if (props.onClick) props.onClick(event);
7
+ }
8
+ return /*#__PURE__*/ jsx("th", {
9
+ ...props,
10
+ className: classnames('fwe-table-order', {
11
+ 'fwe-active': active
12
+ }, {
13
+ 'fwe-table-order-ascending': active && ascending
14
+ }, {
15
+ 'fwe-table-order-descending': active && !ascending
16
+ }, className),
17
+ onClick: handleClick,
18
+ ref: ref
19
+ });
20
+ });
21
+ export { TableHeaderCell };
@@ -0,0 +1,134 @@
1
+ .fwe-checkbox-container {
2
+ font-family: var(--fwe-font-family-sans-serif);
3
+ user-select: none;
4
+ cursor: pointer;
5
+ flex-direction: row;
6
+ align-items: center;
7
+ display: flex;
8
+ }
9
+
10
+ .fwe-checkbox-container.fwe-label-below {
11
+ flex-direction: column;
12
+ }
13
+
14
+ .fwe-checkbox-container.fwe-label-below .fwe-checkbox-title {
15
+ margin: 8px 0 0;
16
+ }
17
+
18
+ .fwe-checkbox-container.fwe-label-before {
19
+ flex-direction: row-reverse;
20
+ justify-content: flex-end;
21
+ }
22
+
23
+ .fwe-checkbox-container.fwe-label-before .fwe-checkbox-title {
24
+ margin: 0 8px 0 0;
25
+ }
26
+
27
+ .fwe-checkbox-container .fwe-checkbox-indicator-container {
28
+ position: relative;
29
+ }
30
+
31
+ .fwe-checkbox-container input {
32
+ opacity: 0;
33
+ cursor: pointer;
34
+ width: 0;
35
+ height: 0;
36
+ }
37
+
38
+ .fwe-checkbox-container .fwe-checkbox-title {
39
+ color: var(--fwe-text);
40
+ user-select: none;
41
+ margin-left: 8px;
42
+ line-height: 24px;
43
+ }
44
+
45
+ .fwe-checkbox-container .fwe-checkbox-indicator-background {
46
+ box-sizing: border-box;
47
+ background: var(--fwe-white);
48
+ border: 1px solid var(--fwe-text-light);
49
+ border-radius: 2px;
50
+ width: 16px;
51
+ height: 16px;
52
+ transition: border-width .2s ease-out;
53
+ }
54
+
55
+ .fwe-checkbox-container .fwe-indeterminate-indicator {
56
+ background: #fff;
57
+ width: 10px;
58
+ height: 2px;
59
+ position: absolute;
60
+ top: 7px;
61
+ left: 3px;
62
+ }
63
+
64
+ .fwe-checkbox-container .fwe-checkbox-indicator-background + svg {
65
+ display: block;
66
+ position: absolute;
67
+ top: 0;
68
+ left: 0;
69
+ }
70
+
71
+ .fwe-checkbox-container.fr-checkbox-large .fwe-checkbox-indicator-background {
72
+ border-radius: 4px;
73
+ width: 24px;
74
+ height: 24px;
75
+ }
76
+
77
+ .fwe-checkbox-container.fr-checkbox-large .fwe-indeterminate-indicator {
78
+ width: 14px;
79
+ top: 11px;
80
+ left: 5px;
81
+ }
82
+
83
+ .fwe-checkbox-container.fr-checkbox-large.fwe-checked .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-large.fr-checkbox-indeterminate .fwe-checkbox-indicator-background {
84
+ border: 12px solid var(--fwe-hero);
85
+ }
86
+
87
+ .fwe-checkbox-container:hover .fwe-checkbox-indicator-background {
88
+ background-color: var(--fwe-control);
89
+ }
90
+
91
+ .fwe-checkbox-container:active .fwe-checkbox-indicator-background {
92
+ background-color: var(--fwe-control-hover);
93
+ }
94
+
95
+ .fwe-checkbox-container.fwe-checked .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-indeterminate .fwe-checkbox-indicator-background {
96
+ border: 8px solid var(--fwe-hero);
97
+ }
98
+
99
+ .fwe-checkbox-container.fwe-checked:hover .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-indeterminate:hover .fwe-checkbox-indicator-background {
100
+ border-color: var(--fwe-hero-hover);
101
+ }
102
+
103
+ .fwe-checkbox-container.fwe-checked:active .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-indeterminate:active .fwe-checkbox-indicator-background {
104
+ border-color: var(--fwe-hero-active);
105
+ }
106
+
107
+ .fwe-checkbox-container.fr-checkbox-invalid .fwe-checkbox-indicator-background {
108
+ border: 1px solid var(--fwe-red);
109
+ background: var(--fwe-white);
110
+ }
111
+
112
+ .fwe-checkbox-container.fwe-disabled {
113
+ cursor: default;
114
+ }
115
+
116
+ .fwe-checkbox-container.fwe-disabled .fwe-checkbox-indicator-background {
117
+ background-color: var(--fwe-white);
118
+ border: 1px solid var(--fwe-control);
119
+ }
120
+
121
+ .fwe-checkbox-container.fwe-disabled.fwe-checked .fwe-checkbox-indicator-background, .fwe-checkbox-container.fwe-disabled.fr-checkbox-indeterminate .fwe-checkbox-indicator-background {
122
+ background-color: var(--fwe-control);
123
+ border: 1px solid var(--fwe-control);
124
+ }
125
+
126
+ .fwe-checkbox-container.fwe-disabled.fr-checkbox-invalid .fwe-checkbox-indicator-background {
127
+ background-color: var(--fwe-white);
128
+ border: 1px solid var(--fwe-control);
129
+ }
130
+
131
+ .fwe-checkbox-container.fwe-disabled .fwe-checkbox-title {
132
+ color: var(--fwe-text-disabled);
133
+ }
134
+
@@ -0,0 +1,15 @@
1
+ import './Checkbox.scss';
2
+ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
3
+ readonly id?: string;
4
+ readonly checked?: boolean;
5
+ readonly defaultChecked?: boolean;
6
+ readonly onChange?: (value: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;
7
+ readonly name?: string;
8
+ readonly large?: boolean;
9
+ readonly valid?: boolean;
10
+ readonly labelPosition?: 'before' | 'after' | 'below';
11
+ readonly required?: boolean;
12
+ readonly disabled?: boolean;
13
+ readonly indeterminate?: boolean;
14
+ }
15
+ export declare function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, name, large, valid, labelPosition, required, disabled, indeterminate, children, className, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,80 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "./Checkbox.css";
3
+ import classnames from "classnames";
4
+ import { useControlled } from "../../utils/useControlled.js";
5
+ function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, name, large = false, valid = true, labelPosition = 'after', required, disabled = false, indeterminate = false, children, className, ...props }) {
6
+ const [isChecked, setChecked] = useControlled({
7
+ controlled: checkedProp,
8
+ default: defaultChecked ?? false
9
+ });
10
+ const handleChange = (e)=>{
11
+ const newChecked = !isChecked;
12
+ setChecked(newChecked);
13
+ onChange?.(newChecked, e);
14
+ };
15
+ const containerClasses = classnames('fwe-checkbox-container', {
16
+ 'fr-checkbox-large': large
17
+ }, {
18
+ 'fr-checkbox-invalid': !valid || required
19
+ }, {
20
+ 'fwe-disabled': disabled
21
+ }, {
22
+ 'fwe-checked': isChecked
23
+ }, {
24
+ 'fwe-label-below': 'below' === labelPosition
25
+ }, {
26
+ 'fwe-label-before': 'before' === labelPosition
27
+ }, {
28
+ 'fr-checkbox-indeterminate': indeterminate
29
+ }, className);
30
+ return /*#__PURE__*/ jsxs("label", {
31
+ className: containerClasses,
32
+ htmlFor: id,
33
+ children: [
34
+ /*#__PURE__*/ jsx("input", {
35
+ name: name,
36
+ type: "checkbox",
37
+ id: id,
38
+ disabled: disabled,
39
+ required: required,
40
+ onChange: (e)=>handleChange(e),
41
+ ...props,
42
+ checked: isChecked
43
+ }),
44
+ /*#__PURE__*/ jsxs("div", {
45
+ className: "fwe-checkbox-indicator-container",
46
+ children: [
47
+ /*#__PURE__*/ jsx("div", {
48
+ className: "fwe-checkbox-indicator-background"
49
+ }),
50
+ !indeterminate && isChecked && (large ? /*#__PURE__*/ jsx("svg", {
51
+ width: "24px",
52
+ height: "24px",
53
+ "aria-hidden": "true",
54
+ children: /*#__PURE__*/ jsx("path", {
55
+ d: "M17.5 7L10 14.5 7.501 12l-1.5 1.501L10 17.5l9-9z",
56
+ fill: "#fff"
57
+ })
58
+ }) : /*#__PURE__*/ jsx("svg", {
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ width: "16",
61
+ height: "16",
62
+ "aria-hidden": "true",
63
+ children: /*#__PURE__*/ jsx("path", {
64
+ d: "M6 12L3 9l1.25-1.25L6 9.5l5.75-5.75L13 5l-7 7z",
65
+ fill: "#fff"
66
+ })
67
+ })),
68
+ indeterminate && /*#__PURE__*/ jsx("div", {
69
+ className: "fwe-indeterminate-indicator"
70
+ })
71
+ ]
72
+ }),
73
+ /*#__PURE__*/ jsx("div", {
74
+ className: "fwe-checkbox-title",
75
+ children: children
76
+ })
77
+ ]
78
+ });
79
+ }
80
+ export { Checkbox };