@festo-ui/react 5.0.1 → 5.1.0-dev.162
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +2 -2
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/lib/components/accordion/Accordion.d.ts +1 -1
- package/lib/components/accordion/Accordion.js +1 -1
- package/lib/components/accordion/accordion-header/AccordionHeader.d.ts +1 -1
- package/lib/components/accordion/accordion-item/AccordionItem.d.ts +1 -1
- package/lib/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.d.ts +1 -1
- package/lib/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.d.ts +1 -1
- package/lib/components/loading-indicator/LoadingIndicator.d.ts +1 -1
- package/lib/components/mobile-flyout/MobileFlyout.d.ts +12 -0
- package/lib/components/mobile-flyout/MobileFlyout.js +83 -0
- package/lib/components/mobile-flyout/MobileFlyoutContext.d.ts +9 -0
- package/lib/components/mobile-flyout/MobileFlyoutContext.js +2 -0
- package/lib/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +19 -0
- package/lib/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +54 -0
- package/lib/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.d.ts +8 -0
- package/lib/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +47 -0
- package/lib/components/modals/Modal.d.ts +5 -7
- package/lib/components/modals/Modal.js +28 -61
- package/lib/components/modals/ModalBase.d.ts +9 -0
- package/lib/components/modals/ModalBase.js +68 -0
- package/lib/components/modals/ModalFooter.d.ts +1 -1
- package/lib/components/modals/imageGallery/BaseGallery.d.ts +18 -0
- package/lib/components/modals/imageGallery/BaseGallery.js +77 -0
- package/lib/components/modals/imageGallery/ImageGallery.d.ts +15 -0
- package/lib/components/modals/imageGallery/ImageGallery.helper.d.ts +3 -0
- package/lib/components/modals/imageGallery/ImageGallery.helper.js +11 -0
- package/lib/components/modals/imageGallery/ImageGallery.js +77 -0
- package/lib/components/modals/imageGallery/ImageGallery.stories.helper.d.ts +3 -0
- package/lib/components/modals/imageGallery/ImageGallery.stories.helper.js +108 -0
- package/lib/components/modals/imageGallery/ImageGalleryContent.d.ts +10 -0
- package/lib/components/modals/imageGallery/ImageGalleryContent.js +16 -0
- package/lib/components/modals/imageGallery/ImageGalleryPagination.d.ts +8 -0
- package/lib/components/modals/imageGallery/ImageGalleryPagination.js +30 -0
- package/lib/components/modals/imageGallery/useClasses.d.ts +0 -0
- package/lib/components/modals/imageGallery/useClasses.js +0 -0
- package/lib/components/snackbar/SnackbarProvider.js +4 -4
- package/lib/components/stepper-horizontal/StepperHorizontal.d.ts +1 -1
- package/lib/components/stepper-horizontal/StepperHorizontal.js +1 -1
- package/lib/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +1 -1
- package/lib/components/stepper-vertical/StepperVertical.d.ts +1 -1
- package/lib/components/stepper-vertical/StepperVertical.js +1 -1
- package/lib/components/stepper-vertical/step-vertical/StepVertical.d.ts +1 -1
- package/lib/components/tab/Tabs.d.ts +1 -1
- package/lib/components/tab/Tabs.js +3 -0
- package/lib/components/tab/useTabScroll.js +0 -1
- package/lib/components/table-header-cell/TableHeaderCell.d.ts +1 -1
- package/lib/components/table-header-cell/TableHeaderCell.js +10 -4
- package/lib/forms/checkbox/Checkbox.d.ts +5 -4
- package/lib/forms/checkbox/Checkbox.js +16 -18
- package/lib/forms/radio/RadioGroup.js +1 -1
- package/lib/forms/select/Select.d.ts +4 -10
- package/lib/forms/select/Select.js +96 -126
- package/lib/forms/select/list-item/ListItem.d.ts +6 -0
- package/lib/forms/select/list-item/ListItem.js +24 -0
- package/lib/forms/select/select-option/SelectOption.d.ts +2 -2
- package/lib/forms/select/utils.d.ts +2 -0
- package/lib/forms/select/utils.js +17 -0
- package/lib/forms/text-editor/TextEditor.d.ts +2 -1
- package/lib/forms/text-editor/TextEditor.js +29 -14
- package/lib/forms/text-input/TextInput.d.ts +1 -1
- package/lib/forms/time-picker/TimePicker.d.ts +1 -1
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +1 -1
- package/lib/helper/types.d.ts +17 -0
- package/lib/helper/useId.js +2 -1
- package/node/index.js +30 -2
- package/node/lib/components/accordion/Accordion.js +2 -3
- package/node/lib/components/accordion/AccordionContext.js +1 -2
- package/node/lib/components/accordion/accordion-header/AccordionHeader.js +1 -2
- package/node/lib/components/accordion/accordion-item/AccordionItem.js +1 -2
- package/node/lib/components/accordion/accordion-item/AccordionItemContext.js +1 -2
- package/node/lib/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +1 -2
- package/node/lib/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +1 -2
- package/node/lib/components/breadcrumb/Breadcrumb.js +1 -2
- package/node/lib/components/buttons/button/Button.js +1 -2
- package/node/lib/components/card/Card.js +1 -2
- package/node/lib/components/card/CardBody.js +1 -2
- package/node/lib/components/card/CardHeader.js +1 -2
- package/node/lib/components/card/CardNotification.js +1 -2
- package/node/lib/components/chips/chip/Chip.js +2 -4
- package/node/lib/components/chips/chip-container/ChipContainer.js +1 -2
- package/node/lib/components/link-button/LinkButton.js +1 -2
- package/node/lib/components/loading-indicator/LoadingIndicator.js +2 -4
- package/node/lib/components/mobile-flyout/MobileFlyout.js +89 -0
- package/node/lib/components/mobile-flyout/MobileFlyoutContext.js +8 -0
- package/node/lib/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +77 -0
- package/node/lib/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +53 -0
- package/node/lib/components/modals/AlertModal.js +1 -2
- package/node/lib/components/modals/ConfirmModal.js +1 -2
- package/node/lib/components/modals/Modal.js +30 -63
- package/node/lib/components/modals/ModalBase.js +73 -0
- package/node/lib/components/modals/ModalFooter.js +1 -2
- package/node/lib/components/modals/Prompt.js +2 -2
- package/node/lib/components/modals/imageGallery/BaseGallery.js +83 -0
- package/node/lib/components/modals/imageGallery/ImageGallery.helper.js +18 -0
- package/node/lib/components/modals/imageGallery/ImageGallery.js +82 -0
- package/node/lib/components/modals/imageGallery/ImageGallery.stories.helper.js +123 -0
- package/node/lib/components/modals/imageGallery/ImageGalleryContent.js +20 -0
- package/node/lib/components/modals/imageGallery/ImageGalleryPagination.js +34 -0
- package/node/lib/components/modals/imageGallery/useClasses.js +1 -0
- package/node/lib/components/pagination/Pagination.js +4 -6
- package/node/lib/components/popovers/legend/Legend.js +1 -2
- package/node/lib/components/popovers/popover/Popover.js +3 -4
- package/node/lib/components/popovers/popover-menu/PopoverMenu.js +1 -2
- package/node/lib/components/popovers/tooltip/Tooltip.js +1 -2
- package/node/lib/components/progress/Progress.js +1 -2
- package/node/lib/components/search-input/SearchInput.js +1 -2
- package/node/lib/components/snackbar/Snackbar.js +1 -2
- package/node/lib/components/snackbar/SnackbarContext.js +1 -2
- package/node/lib/components/snackbar/SnackbarProvider.js +4 -5
- package/node/lib/components/stepper-horizontal/StepperHorizontal.js +5 -6
- package/node/lib/components/stepper-horizontal/step-horizontal/StepHorizontal.js +1 -2
- package/node/lib/components/stepper-vertical/StepperVertical.js +5 -6
- package/node/lib/components/stepper-vertical/step-vertical/StepVertical.js +1 -2
- package/node/lib/components/tab/Tabs.js +5 -4
- package/node/lib/components/tab/tab-pane/TabPane.js +1 -2
- package/node/lib/components/tab/useTabScroll.js +3 -2
- package/node/lib/components/table-header-cell/TableHeaderCell.js +11 -6
- package/node/lib/forms/checkbox/Checkbox.js +17 -22
- package/node/lib/forms/color-indicator/ColorIndicator.js +3 -4
- package/node/lib/forms/color-picker/ColorPicker.js +4 -6
- package/node/lib/forms/date-picker/DatePicker.js +1 -2
- package/node/lib/forms/date-range-picker/DateRangePicker.js +1 -2
- package/node/lib/forms/radio/RadioButton.js +1 -2
- package/node/lib/forms/radio/RadioGroup.js +2 -3
- package/node/lib/forms/radio/RadioGroupContext.js +1 -2
- package/node/lib/forms/segment/Segment.js +1 -2
- package/node/lib/forms/segment/segment-control/SegmentControl.js +3 -4
- package/node/lib/forms/select/Select.js +99 -130
- package/node/lib/forms/select/list-item/ListItem.js +33 -0
- package/node/lib/forms/select/select-option/SelectOption.js +4 -6
- package/node/lib/forms/select/utils.js +23 -0
- package/node/lib/forms/slider/Slider.js +3 -4
- package/node/lib/forms/switch/Switch.js +1 -2
- package/node/lib/forms/text-area/TextArea.js +3 -4
- package/node/lib/forms/text-editor/TextEditor.js +29 -15
- package/node/lib/forms/text-editor/TextEditorButton.js +1 -2
- package/node/lib/forms/text-input/TextInput.js +3 -4
- package/node/lib/forms/time-picker/TimePicker.js +3 -4
- package/node/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +3 -4
- package/node/lib/helper/index.js +1 -2
- package/node/lib/helper/useId.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import MobileFlyoutContext from '../MobileFlyoutContext';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export const MobileFlyoutPage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
7
|
+
let {
|
|
8
|
+
back,
|
|
9
|
+
children,
|
|
10
|
+
name,
|
|
11
|
+
root,
|
|
12
|
+
...props
|
|
13
|
+
} = _ref;
|
|
14
|
+
const {
|
|
15
|
+
visible,
|
|
16
|
+
setVisible,
|
|
17
|
+
back: backContext
|
|
18
|
+
} = useContext(MobileFlyoutContext);
|
|
19
|
+
const innerVisible = root || name && visible.includes(name);
|
|
20
|
+
const innerBack = back ?? backContext ?? 'Back';
|
|
21
|
+
function handleChange() {
|
|
22
|
+
if (name) {
|
|
23
|
+
setVisible(name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
27
|
+
className: cn('fwe-mobile-flyout-page', {
|
|
28
|
+
'fwe-opened': innerVisible
|
|
29
|
+
}),
|
|
30
|
+
ref: ref,
|
|
31
|
+
...props,
|
|
32
|
+
children: [!root && /*#__PURE__*/_jsxs("div", {
|
|
33
|
+
tabIndex: 0,
|
|
34
|
+
role: "button",
|
|
35
|
+
className: "fwe-page-back",
|
|
36
|
+
onClick: handleChange,
|
|
37
|
+
onKeyUp: handleChange,
|
|
38
|
+
children: [/*#__PURE__*/_jsx("i", {}), /*#__PURE__*/_jsx("div", {
|
|
39
|
+
children: innerBack
|
|
40
|
+
})]
|
|
41
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: "fwe-mobile-flyout-item-container",
|
|
43
|
+
children: children
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
export default MobileFlyoutPage;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ClassNamePropsWithChildren } from '../../helper/types';
|
|
3
1
|
import './Modal.scss';
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ModalBaseProps } from './ModalBase';
|
|
4
|
+
export interface ModalProps extends ModalBaseProps {
|
|
6
5
|
body: React.ReactNode;
|
|
7
|
-
|
|
8
|
-
head: React.ReactNode;
|
|
6
|
+
head?: React.ReactNode;
|
|
9
7
|
}
|
|
10
|
-
declare const Modal:
|
|
8
|
+
declare const Modal: (props: ModalProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
11
9
|
export default Modal;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import
|
|
3
|
-
import { CSSTransition } from 'react-transition-group';
|
|
4
|
-
import OutsideClickHandler from 'react-outside-click-handler';
|
|
5
|
-
import useForkRef from '../../helper/useForkRef';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import ModalBase from './ModalBase';
|
|
6
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
5
|
const Modal = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
10
6
|
let {
|
|
11
7
|
head,
|
|
@@ -15,62 +11,33 @@ const Modal = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
15
11
|
className,
|
|
16
12
|
children
|
|
17
13
|
} = _ref;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
return /*#__PURE__*/_jsxs(ModalBase, {
|
|
15
|
+
isOpen: isOpen,
|
|
16
|
+
className: className,
|
|
17
|
+
ref: ref,
|
|
18
|
+
onClose: onClose,
|
|
19
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
20
|
+
className: "fwe-modal-close",
|
|
21
|
+
children: /*#__PURE__*/_jsxs("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
"aria-label": "Close",
|
|
24
|
+
className: "fwe-btn fwe-btn-link fwe-dark",
|
|
25
|
+
onClick: onClose,
|
|
26
|
+
children: [/*#__PURE__*/_jsx("i", {
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
className: "fwe-icon fwe-icon-close-small"
|
|
29
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
30
|
+
className: "fwe-sr-only",
|
|
31
|
+
children: "Close"
|
|
32
|
+
})]
|
|
34
33
|
})
|
|
35
|
-
}), /*#__PURE__*/_jsx(
|
|
36
|
-
|
|
37
|
-
children:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
in: isOpen,
|
|
43
|
-
timeout: {
|
|
44
|
-
exit: 600
|
|
45
|
-
},
|
|
46
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
47
|
-
ref: combinedRef,
|
|
48
|
-
className: classNames('fr-modal fwe-modal', className),
|
|
49
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
50
|
-
className: "fwe-modal-close",
|
|
51
|
-
children: /*#__PURE__*/_jsxs("button", {
|
|
52
|
-
type: "button",
|
|
53
|
-
"aria-label": "Close",
|
|
54
|
-
className: "fwe-btn fwe-btn-link fwe-dark",
|
|
55
|
-
onClick: onClose,
|
|
56
|
-
children: [/*#__PURE__*/_jsx("i", {
|
|
57
|
-
"aria-hidden": "true",
|
|
58
|
-
className: "fwe-icon fwe-icon-close-small"
|
|
59
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
60
|
-
className: "fwe-sr-only",
|
|
61
|
-
children: "Close"
|
|
62
|
-
})]
|
|
63
|
-
})
|
|
64
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
65
|
-
className: "fwe-modal-header",
|
|
66
|
-
children: head
|
|
67
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
68
|
-
className: "fwe-modal-body",
|
|
69
|
-
children: body
|
|
70
|
-
}), children]
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
})]
|
|
34
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
35
|
+
className: "fwe-modal-header",
|
|
36
|
+
children: head
|
|
37
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
38
|
+
className: "fwe-modal-body",
|
|
39
|
+
children: body
|
|
40
|
+
}), children]
|
|
74
41
|
});
|
|
75
42
|
});
|
|
76
43
|
export default Modal;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './Modal.scss';
|
|
3
|
+
import { ClassNamePropsWithChildren } from '../../helper/types';
|
|
4
|
+
export interface ModalBaseProps extends ClassNamePropsWithChildren {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const ModalBase: (props: ModalBaseProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
9
|
+
export default ModalBase;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { forwardRef, useEffect, useRef } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import { CSSTransition } from 'react-transition-group';
|
|
5
|
+
import useForkRef from '../../helper/useForkRef';
|
|
6
|
+
import useOnClickOutside from '../../helper/useOnClickOutside';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const ModalBase = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
|
+
let {
|
|
12
|
+
isOpen,
|
|
13
|
+
onClose,
|
|
14
|
+
className,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
const backdropRef = useRef(null);
|
|
18
|
+
const modalRef = useRef(null);
|
|
19
|
+
const divRef = useRef(null);
|
|
20
|
+
const combinedRef = useForkRef(ref, modalRef);
|
|
21
|
+
const allRefs = useForkRef(combinedRef, divRef);
|
|
22
|
+
const container = divRef?.current?.ownerDocument || document;
|
|
23
|
+
useOnClickOutside(divRef, () => onClose?.());
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const handleKeyDown = event => {
|
|
26
|
+
if (event.key === 'Escape') {
|
|
27
|
+
onClose?.();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
container.addEventListener('keydown', handleKeyDown);
|
|
31
|
+
return () => container.removeEventListener('keydown', handleKeyDown);
|
|
32
|
+
}, [onClose, container]);
|
|
33
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
34
|
+
children: /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsxs(_Fragment, {
|
|
35
|
+
children: [/*#__PURE__*/_jsx(CSSTransition, {
|
|
36
|
+
nodeRef: backdropRef,
|
|
37
|
+
unmountOnExit: true,
|
|
38
|
+
timeout: {
|
|
39
|
+
exit: 600
|
|
40
|
+
},
|
|
41
|
+
in: isOpen,
|
|
42
|
+
classNames: "fr-modal-backdrop",
|
|
43
|
+
appear: true,
|
|
44
|
+
component: null,
|
|
45
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
46
|
+
ref: backdropRef,
|
|
47
|
+
className: "fr-modal-backdrop fwe-modal-backdrop"
|
|
48
|
+
})
|
|
49
|
+
}), /*#__PURE__*/_jsx(CSSTransition, {
|
|
50
|
+
ref: modalRef,
|
|
51
|
+
unmountOnExit: true,
|
|
52
|
+
classNames: "fr-modal",
|
|
53
|
+
appear: true,
|
|
54
|
+
in: isOpen,
|
|
55
|
+
timeout: {
|
|
56
|
+
exit: 600
|
|
57
|
+
},
|
|
58
|
+
component: null,
|
|
59
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
60
|
+
ref: allRefs,
|
|
61
|
+
className: classNames('fr-modal fwe-modal', className),
|
|
62
|
+
children: children
|
|
63
|
+
})
|
|
64
|
+
})]
|
|
65
|
+
}), container.body)
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
export default ModalBase;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ClassNamePropsWithChildren } from '../../helper/types';
|
|
3
|
-
declare const ModalFooter: import("react").
|
|
3
|
+
declare const ModalFooter: (props: ClassNamePropsWithChildren & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
4
4
|
export default ModalFooter;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'swiper/css';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { ClassNamePropsWithChildren } from '../../../helper/types';
|
|
4
|
+
import { ImageDescriptiveContent } from './ImageGalleryContent';
|
|
5
|
+
export interface ImageGalleryItemDataBase extends ComponentPropsWithoutRef<'img'>, Record<string, unknown> {
|
|
6
|
+
containMode?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type ImageGalleryItemData = {
|
|
9
|
+
content?: ImageDescriptiveContent;
|
|
10
|
+
} & ImageGalleryItemDataBase;
|
|
11
|
+
interface BaseGalleryProps extends ClassNamePropsWithChildren {
|
|
12
|
+
images: ImageGalleryItemData[];
|
|
13
|
+
thumbnailImages?: ImageGalleryItemDataBase[];
|
|
14
|
+
onSlideChanged?: (value: number) => void;
|
|
15
|
+
startIndex?: number;
|
|
16
|
+
}
|
|
17
|
+
export default function BaseGallery({ images, thumbnailImages, onSlideChanged, startIndex, }: BaseGalleryProps): JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import 'swiper/css';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Navigation, Thumbs } from 'swiper';
|
|
5
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export default function BaseGallery(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
images,
|
|
11
|
+
thumbnailImages,
|
|
12
|
+
onSlideChanged,
|
|
13
|
+
startIndex
|
|
14
|
+
} = _ref;
|
|
15
|
+
const [thumbsSwiper, setThumbsSwiper] = useState(null);
|
|
16
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
17
|
+
className: "fwe-image-gallery-wrapper",
|
|
18
|
+
children: [/*#__PURE__*/_jsx(Swiper, {
|
|
19
|
+
initialSlide: startIndex,
|
|
20
|
+
thumbs: {
|
|
21
|
+
swiper: thumbsSwiper
|
|
22
|
+
},
|
|
23
|
+
modules: [Thumbs, Navigation],
|
|
24
|
+
navigation: {
|
|
25
|
+
nextEl: '.fwe-navigate-btn-up',
|
|
26
|
+
prevEl: '.fwe-navigate-btn-down'
|
|
27
|
+
},
|
|
28
|
+
zoom: true,
|
|
29
|
+
className: "gallery-swiper fwe-image-gallery",
|
|
30
|
+
spaceBetween: 0,
|
|
31
|
+
onSlideChange: slider => onSlideChanged?.(slider.activeIndex),
|
|
32
|
+
children: images.map(_ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
containMode,
|
|
35
|
+
alt,
|
|
36
|
+
content,
|
|
37
|
+
...image
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return /*#__PURE__*/_jsx(SwiperSlide, {
|
|
40
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
41
|
+
className: "swiper-zoom-container",
|
|
42
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
43
|
+
...image,
|
|
44
|
+
className: cn({
|
|
45
|
+
'fwe-object-fit-contain fwe-p-m': containMode
|
|
46
|
+
}, image.className),
|
|
47
|
+
alt: alt
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
}, image.src);
|
|
51
|
+
})
|
|
52
|
+
}), thumbnailImages && /*#__PURE__*/_jsx(Swiper, {
|
|
53
|
+
freeMode: true,
|
|
54
|
+
slidesPerView: "auto",
|
|
55
|
+
className: "thumbs-swiper fwe-image-gallery-thumbs",
|
|
56
|
+
modules: [Thumbs],
|
|
57
|
+
watchSlidesProgress: true,
|
|
58
|
+
onSwiper: setThumbsSwiper,
|
|
59
|
+
children: thumbnailImages.map(_ref3 => {
|
|
60
|
+
let {
|
|
61
|
+
containMode,
|
|
62
|
+
alt,
|
|
63
|
+
...image
|
|
64
|
+
} = _ref3;
|
|
65
|
+
return /*#__PURE__*/_jsx(SwiperSlide, {
|
|
66
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
67
|
+
...image,
|
|
68
|
+
className: cn({
|
|
69
|
+
'fwe-object-fit-contain fwe-p-xxxs': containMode
|
|
70
|
+
}, image.className),
|
|
71
|
+
alt: alt
|
|
72
|
+
})
|
|
73
|
+
}, image.src);
|
|
74
|
+
})
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './ImageGallery.scss';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { ModalBaseProps } from '../ModalBase';
|
|
4
|
+
import { ImageGalleryItemData, ImageGalleryItemDataBase } from './BaseGallery';
|
|
5
|
+
interface ImageGalleryProps extends ComponentPropsWithoutRef<'div'>, ModalBaseProps {
|
|
6
|
+
/** Index number of initial slide. */
|
|
7
|
+
startIndex: number;
|
|
8
|
+
images: ImageGalleryItemData[];
|
|
9
|
+
thumbnailImages?: ImageGalleryItemDataBase[];
|
|
10
|
+
pagination?: boolean;
|
|
11
|
+
descriptiveContent?: boolean;
|
|
12
|
+
onSlideChanged?: (index: number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const ImageGallery: (props: ImageGalleryProps & import("react").RefAttributes<HTMLImageElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
15
|
+
export default ImageGallery;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
const getClasses = (thumbnailImages, descriptiveContent, className) => {
|
|
3
|
+
const base = 'fwe-modal-image-gallery';
|
|
4
|
+
const thumbnail = `${base}--with-thumbnails`;
|
|
5
|
+
const container = `${base}--with-container`;
|
|
6
|
+
return cn(base, {
|
|
7
|
+
[thumbnail]: [thumbnailImages],
|
|
8
|
+
[container]: descriptiveContent
|
|
9
|
+
}, className);
|
|
10
|
+
};
|
|
11
|
+
export default getClasses;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { forwardRef, useState } from 'react';
|
|
2
|
+
import ModalBase from '../ModalBase';
|
|
3
|
+
import BaseGallery from './BaseGallery';
|
|
4
|
+
import ImageGalleryContent from './ImageGalleryContent';
|
|
5
|
+
import ImageGalleryPagination from './ImageGalleryPagination';
|
|
6
|
+
import getClasses from './ImageGallery.helper';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
+
const ImageGallery = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
|
+
let {
|
|
12
|
+
isOpen,
|
|
13
|
+
startIndex,
|
|
14
|
+
images,
|
|
15
|
+
thumbnailImages,
|
|
16
|
+
descriptiveContent,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
pagination,
|
|
20
|
+
onClose,
|
|
21
|
+
onSlideChanged,
|
|
22
|
+
...props
|
|
23
|
+
} = _ref;
|
|
24
|
+
const [currentIndex, setCurrentIndex] = useState(startIndex + 1);
|
|
25
|
+
function handleChange(index) {
|
|
26
|
+
setCurrentIndex(index + 1);
|
|
27
|
+
onSlideChanged?.(index);
|
|
28
|
+
}
|
|
29
|
+
function handleClose() {
|
|
30
|
+
setCurrentIndex(startIndex + 1);
|
|
31
|
+
onClose?.();
|
|
32
|
+
}
|
|
33
|
+
const classes = getClasses(thumbnailImages, descriptiveContent, className);
|
|
34
|
+
return /*#__PURE__*/_jsx(ModalBase, {
|
|
35
|
+
onClose: handleClose,
|
|
36
|
+
className: classes,
|
|
37
|
+
...props,
|
|
38
|
+
isOpen: isOpen,
|
|
39
|
+
ref: ref,
|
|
40
|
+
children: isOpen && /*#__PURE__*/_jsxs(_Fragment, {
|
|
41
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
42
|
+
className: "fwe-image-gallery-header",
|
|
43
|
+
children: [/*#__PURE__*/_jsx(ImageGalleryPagination, {
|
|
44
|
+
currentIndex: currentIndex,
|
|
45
|
+
length: images.length,
|
|
46
|
+
pagination: pagination
|
|
47
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
48
|
+
"aria-label": "close",
|
|
49
|
+
type: "button",
|
|
50
|
+
className: "fwe-btn fwe-btn-link fwe-ml-auto",
|
|
51
|
+
onClick: handleClose,
|
|
52
|
+
children: /*#__PURE__*/_jsx("i", {
|
|
53
|
+
className: "fwe-icon fwe-icon-lg fwe-color-white fwe-icon-menu-close fwe-modal-image-gallery-close"
|
|
54
|
+
})
|
|
55
|
+
})]
|
|
56
|
+
}), descriptiveContent ? /*#__PURE__*/_jsxs("div", {
|
|
57
|
+
className: "fwe-image-gallery-container",
|
|
58
|
+
children: [/*#__PURE__*/_jsx(BaseGallery, {
|
|
59
|
+
startIndex: startIndex,
|
|
60
|
+
images: images,
|
|
61
|
+
thumbnailImages: thumbnailImages,
|
|
62
|
+
onSlideChanged: handleChange,
|
|
63
|
+
children: children
|
|
64
|
+
}), /*#__PURE__*/_jsx(ImageGalleryContent, {
|
|
65
|
+
imageContent: images[currentIndex - 1]?.content
|
|
66
|
+
})]
|
|
67
|
+
}) : /*#__PURE__*/_jsx(BaseGallery, {
|
|
68
|
+
startIndex: startIndex,
|
|
69
|
+
images: images,
|
|
70
|
+
thumbnailImages: thumbnailImages,
|
|
71
|
+
onSlideChanged: handleChange,
|
|
72
|
+
children: children
|
|
73
|
+
})]
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
export default ImageGallery;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* eslint-disable import/no-relative-packages */
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import Asset1 from '../../../../../../web-essentials/stories/assets/gallery-01.webp';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import Asset2 from '../../../../../../web-essentials/stories/assets/gallery-02.webp';
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import Asset3 from '../../../../../../web-essentials/stories/assets/gallery-03.webp';
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import Asset4 from '../../../../../../web-essentials/stories/assets/gallery-04.webp';
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import Asset5 from '../../../../../../web-essentials/stories/assets/gallery-05.webp';
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
import Asset6 from '../../../../../../web-essentials/stories/assets/gallery-06.webp';
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
import Asset7 from '../../../../../../web-essentials/stories/assets/gallery-07.webp';
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import Asset8 from '../../../../../../web-essentials/stories/assets/gallery-08.webp';
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
import Asset9 from '../../../../../../web-essentials/stories/assets/gallery-09.webp';
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
import AssetTen from '../../../../../../web-essentials/stories/assets/gallery-10.webp';
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
|
+
const images = [{
|
|
26
|
+
src: Asset1,
|
|
27
|
+
alt: 'Asset1',
|
|
28
|
+
content: {
|
|
29
|
+
title: 'Asset 1',
|
|
30
|
+
body: 'Asset 1 description'
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
src: Asset2,
|
|
34
|
+
alt: 'Asset2',
|
|
35
|
+
containMode: true,
|
|
36
|
+
content: {
|
|
37
|
+
title: 'Asset 2',
|
|
38
|
+
body: /*#__PURE__*/_jsxs(_Fragment, {
|
|
39
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
40
|
+
children: "Asset 2 description with some html inside."
|
|
41
|
+
}), /*#__PURE__*/_jsxs("ul", {
|
|
42
|
+
children: [/*#__PURE__*/_jsx("li", {
|
|
43
|
+
children: "bullet point 1"
|
|
44
|
+
}), /*#__PURE__*/_jsx("li", {
|
|
45
|
+
children: "bullet point 2"
|
|
46
|
+
})]
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
src: Asset3,
|
|
52
|
+
alt: 'Asset3',
|
|
53
|
+
containMode: true,
|
|
54
|
+
content: {
|
|
55
|
+
title: 'Asset 3',
|
|
56
|
+
body: 'Asset 3 description'
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
src: Asset4,
|
|
60
|
+
alt: 'Asset4',
|
|
61
|
+
content: {
|
|
62
|
+
title: 'Asset 4',
|
|
63
|
+
body: 'Asset 4 description'
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
src: Asset5,
|
|
67
|
+
alt: 'Asset5',
|
|
68
|
+
content: {
|
|
69
|
+
title: 'Asset 5',
|
|
70
|
+
body: 'Asset 5 description'
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
src: Asset6,
|
|
74
|
+
alt: 'Asset6',
|
|
75
|
+
content: {
|
|
76
|
+
title: 'Asset 6',
|
|
77
|
+
body: 'Asset 6 description'
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
src: Asset7,
|
|
81
|
+
alt: 'Asset7',
|
|
82
|
+
content: {
|
|
83
|
+
title: 'Asset 7',
|
|
84
|
+
body: 'Asset 7 description'
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
src: Asset8,
|
|
88
|
+
alt: 'Asset8',
|
|
89
|
+
content: {
|
|
90
|
+
title: 'Asset 8',
|
|
91
|
+
body: 'Asset 8 description'
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
src: Asset9,
|
|
95
|
+
alt: 'Asset9',
|
|
96
|
+
content: {
|
|
97
|
+
title: 'Asset 9',
|
|
98
|
+
body: 'Asset 9 description'
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
src: AssetTen,
|
|
102
|
+
alt: 'Asset10',
|
|
103
|
+
content: {
|
|
104
|
+
title: 'Asset 10',
|
|
105
|
+
body: 'Asset 1ß description'
|
|
106
|
+
}
|
|
107
|
+
}];
|
|
108
|
+
export default images;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ImageDescriptiveContent {
|
|
3
|
+
title: string;
|
|
4
|
+
body: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface ImageGalleryContentProps {
|
|
7
|
+
imageContent?: ImageDescriptiveContent;
|
|
8
|
+
}
|
|
9
|
+
export default function ImageGalleryContent({ imageContent }: ImageGalleryContentProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
export default function ImageGalleryContent(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
imageContent
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
9
|
+
children: imageContent && /*#__PURE__*/_jsxs("div", {
|
|
10
|
+
className: "fwe-image-gallery-content",
|
|
11
|
+
children: [/*#__PURE__*/_jsx("h3", {
|
|
12
|
+
children: imageContent.title
|
|
13
|
+
}), imageContent.body]
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ImageGalleryPaginationProps {
|
|
3
|
+
pagination?: boolean;
|
|
4
|
+
currentIndex: number;
|
|
5
|
+
length: number;
|
|
6
|
+
}
|
|
7
|
+
export default function ImageGalleryPagination({ pagination, currentIndex, length, }: ImageGalleryPaginationProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
export default function ImageGalleryPagination(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
pagination,
|
|
7
|
+
currentIndex,
|
|
8
|
+
length
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
11
|
+
children: pagination && /*#__PURE__*/_jsxs("div", {
|
|
12
|
+
className: "fwe-pagination fwe-pagination--on-dark-bg",
|
|
13
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
14
|
+
"aria-label": "previous",
|
|
15
|
+
type: "button",
|
|
16
|
+
className: "fwe-navigate-btn-down"
|
|
17
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
18
|
+
className: "fwe-page-current",
|
|
19
|
+
children: currentIndex
|
|
20
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
21
|
+
className: "fwe-page-max",
|
|
22
|
+
children: length
|
|
23
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
24
|
+
"aria-label": "next",
|
|
25
|
+
type: "button",
|
|
26
|
+
className: "fwe-navigate-btn-up"
|
|
27
|
+
})]
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
File without changes
|
|
File without changes
|