chop-logic-components 4.1.1 → 4.3.0
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/dist/components/atoms/avatar/Avatar.css +1 -0
- package/dist/components/atoms/avatar/Avatar.d.ts +7 -0
- package/dist/components/atoms/avatar/Avatar2.js +44 -0
- package/dist/components/atoms/button/Button2.js +11 -11
- package/dist/components/atoms/button/icon-button/IconButton2.js +4 -4
- package/dist/components/atoms/button/inner-button/InnerButton2.js +4 -4
- package/dist/components/atoms/button/primary-button/PrimaryButton2.js +4 -4
- package/dist/components/atoms/button/secondary-button/SecondaryButton2.js +4 -4
- package/dist/components/atoms/editable-text/EditView.js +4 -4
- package/dist/components/atoms/editable-text/EditableText2.js +8 -8
- package/dist/components/atoms/icon/Icon2.js +10 -10
- package/dist/components/atoms/image/BasicImage.d.ts +2 -0
- package/dist/components/atoms/image/BasicImage.js +4 -9
- package/dist/components/atoms/image/Image.css +1 -1
- package/dist/components/atoms/image/Image2.js +16 -16
- package/dist/components/atoms/image/ResponsivePicture.d.ts +1 -0
- package/dist/components/atoms/image/ResponsivePicture.js +16 -9
- package/dist/components/atoms/index.d.ts +2 -0
- package/dist/components/atoms/input/Input2.js +5 -5
- package/dist/components/atoms/label/Label2.js +4 -4
- package/dist/components/atoms/link/Link2.js +4 -4
- package/dist/components/atoms/tag/Tag.css +1 -0
- package/dist/components/atoms/tag/Tag.d.ts +7 -0
- package/dist/components/atoms/tag/Tag2.js +15 -0
- package/dist/components/atoms/tooltip/Tooltip2.js +9 -8
- package/dist/components/contexts/theme/ThemeProvider.js +8 -8
- package/dist/components/hocs/with-error-boundary/with-error-boundary.js +8 -8
- package/dist/components/hocs/with-figure-caption/Figure.css +1 -1
- package/dist/components/molecules/alert/Alert2.js +19 -19
- package/dist/components/molecules/checkbox/CheckboxStateful.js +6 -6
- package/dist/components/molecules/checkbox/CheckboxStateless.js +6 -6
- package/dist/components/molecules/multi-select/MultiSelect.Combobox.js +6 -6
- package/dist/components/molecules/multi-select/MultiSelect.js +7 -7
- package/dist/components/molecules/multi-select/Option.js +8 -8
- package/dist/components/molecules/numeric-input/NumericInputStateful.js +8 -8
- package/dist/components/molecules/numeric-input/NumericInputStateless.js +8 -8
- package/dist/components/molecules/search/Search2.js +16 -16
- package/dist/components/molecules/select/Select2.js +7 -7
- package/dist/components/molecules/select/combobox/Combobox2.js +6 -6
- package/dist/components/molecules/select/option/Option2.js +6 -6
- package/dist/components/molecules/text-input/TextInputStateless.js +8 -8
- package/dist/components/organisms/dialog/Dialog2.js +14 -14
- package/dist/components/organisms/form/Form2.js +14 -14
- package/dist/components/organisms/gallery/Gallery.css +1 -0
- package/dist/components/organisms/gallery/Gallery.d.ts +4 -0
- package/dist/components/organisms/gallery/Gallery.helpers.d.ts +3 -0
- package/dist/components/organisms/gallery/Gallery.helpers.js +29 -0
- package/dist/components/organisms/gallery/Gallery2.js +57 -0
- package/dist/components/organisms/gallery/carousel-navigation/CarouselNavigation.css +1 -0
- package/dist/components/organisms/gallery/carousel-navigation/CarouselNavigation.d.ts +9 -0
- package/dist/components/organisms/gallery/carousel-navigation/CarouselNavigation2.js +25 -0
- package/dist/components/organisms/gallery/full-screen-viewer/FullscreenViewer.css +1 -0
- package/dist/components/organisms/gallery/full-screen-viewer/FullscreenViewer.d.ts +11 -0
- package/dist/components/organisms/gallery/full-screen-viewer/FullscreenViewer2.js +48 -0
- package/dist/components/organisms/gallery/gallery-image-item/GalleryImageItem.css +1 -0
- package/dist/components/organisms/gallery/gallery-image-item/GalleryImageItem.d.ts +10 -0
- package/dist/components/organisms/gallery/gallery-image-item/GalleryImageItem2.js +17 -0
- package/dist/components/organisms/gallery/hooks/use-carousel-scroll.d.ts +10 -0
- package/dist/components/organisms/gallery/hooks/use-carousel-scroll.js +50 -0
- package/dist/components/organisms/gallery/hooks/use-fullscreen-viewer.d.ts +11 -0
- package/dist/components/organisms/gallery/hooks/use-fullscreen-viewer.js +23 -0
- package/dist/components/organisms/gallery/viewer-close-button/ViewerCloseButton.css +1 -0
- package/dist/components/organisms/gallery/viewer-close-button/ViewerCloseButton.d.ts +6 -0
- package/dist/components/organisms/gallery/viewer-close-button/ViewerCloseButton2.js +15 -0
- package/dist/components/organisms/gallery/viewer-counter/ViewerCounter.css +1 -0
- package/dist/components/organisms/gallery/viewer-counter/ViewerCounter.d.ts +7 -0
- package/dist/components/organisms/gallery/viewer-counter/ViewerCounter2.js +14 -0
- package/dist/components/organisms/gallery/viewer-image-container/ViewerImageContainer.css +1 -0
- package/dist/components/organisms/gallery/viewer-image-container/ViewerImageContainer.d.ts +8 -0
- package/dist/components/organisms/gallery/viewer-image-container/ViewerImageContainer2.js +14 -0
- package/dist/components/organisms/gallery/viewer-navigation/ViewerNavigation.css +1 -0
- package/dist/components/organisms/gallery/viewer-navigation/ViewerNavigation.d.ts +8 -0
- package/dist/components/organisms/gallery/viewer-navigation/ViewerNavigation2.js +29 -0
- package/dist/components/organisms/gallery/viewer-overlay/ViewerOverlay.css +1 -0
- package/dist/components/organisms/gallery/viewer-overlay/ViewerOverlay.d.ts +12 -0
- package/dist/components/organisms/gallery/viewer-overlay/ViewerOverlay2.js +33 -0
- package/dist/components/organisms/grid/checkbox/GridCheckbox2.js +4 -4
- package/dist/components/organisms/index.d.ts +2 -0
- package/dist/components/organisms/menu/Menu2.js +5 -5
- package/dist/components/organisms/menu/list-item/MenuListItem2.js +8 -8
- package/dist/components/organisms/menu/sub-menu/SubMenu2.js +17 -17
- package/dist/components/organisms/preview-card/PreviewCard.css +1 -0
- package/dist/components/organisms/preview-card/PreviewCard.d.ts +4 -0
- package/dist/components/organisms/preview-card/PreviewCard2.js +57 -0
- package/dist/components/organisms/tabs/Tabs2.js +11 -11
- package/dist/components/organisms/tabs/button/TabButton2.js +23 -23
- package/dist/components/organisms/tabs/edit-input/TabEditInput2.js +9 -9
- package/dist/components/organisms/tabs/list/TabList2.js +12 -12
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/index.js +1 -0
- package/dist/enums/link-target.d.ts +6 -0
- package/dist/enums/link-target.js +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +61 -56
- package/dist/styles/main.css +1 -1
- package/dist/types/gallery.d.ts +13 -0
- package/dist/types/image.d.ts +16 -3
- package/dist/types/index.d.ts +3 -1
- package/dist/types/preview-card.d.ts +38 -0
- package/package.json +18 -18
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ButtonView as e } from "../../../enums/button-view.js";
|
|
2
|
+
import { IconName as t } from "../../../enums/icon-name.js";
|
|
3
|
+
import { getClassName as n } from "../../../utils/get-class-name.js";
|
|
4
4
|
import r from "../../atoms/button/Button2.js";
|
|
5
5
|
import { FormContext as i } from "../../contexts/form/FormContext.js";
|
|
6
6
|
import { useFormController as a } from "./Form.controller.js";
|
|
7
7
|
import './Form.css';/* empty css */
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useMemo as o } from "react";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/organisms/form/Form.tsx
|
|
11
11
|
var l = ({ children: l, initialValues: u, onReset: d, onSubmit: f, onClickSubmit: p, hasReset: m = !0, className: h, ...g }) => {
|
|
12
12
|
let { handleInputChange: _, handleSubmit: v, handleReset: y, resetSignal: b, valid: x } = a({
|
|
@@ -14,7 +14,7 @@ var l = ({ children: l, initialValues: u, onReset: d, onSubmit: f, onClickSubmit
|
|
|
14
14
|
onReset: d,
|
|
15
15
|
onSubmit: f,
|
|
16
16
|
onClickSubmit: p
|
|
17
|
-
}), S =
|
|
17
|
+
}), S = n(["cl-form", h]), C = o(() => ({
|
|
18
18
|
onChangeFormInput: _,
|
|
19
19
|
initialValues: u,
|
|
20
20
|
resetSignal: b
|
|
@@ -23,24 +23,24 @@ var l = ({ children: l, initialValues: u, onReset: d, onSubmit: f, onClickSubmit
|
|
|
23
23
|
u,
|
|
24
24
|
b
|
|
25
25
|
]);
|
|
26
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ s("form", {
|
|
27
27
|
onSubmit: v,
|
|
28
28
|
onReset: y,
|
|
29
29
|
...g,
|
|
30
30
|
className: S,
|
|
31
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ c(i.Provider, {
|
|
32
32
|
value: C,
|
|
33
|
-
children: [l, /* @__PURE__ */
|
|
33
|
+
children: [l, /* @__PURE__ */ c("div", {
|
|
34
34
|
className: "cl-form__buttons",
|
|
35
|
-
children: [m && /* @__PURE__ */
|
|
35
|
+
children: [m && /* @__PURE__ */ s(r, {
|
|
36
36
|
type: "reset",
|
|
37
37
|
text: "Reset",
|
|
38
|
-
icon:
|
|
39
|
-
view:
|
|
40
|
-
}), /* @__PURE__ */
|
|
38
|
+
icon: t.Delete,
|
|
39
|
+
view: e.Secondary
|
|
40
|
+
}), /* @__PURE__ */ s(r, {
|
|
41
41
|
type: "submit",
|
|
42
42
|
text: "Submit",
|
|
43
|
-
icon:
|
|
43
|
+
icon: t.ArrowRight,
|
|
44
44
|
extended: !m,
|
|
45
45
|
disabled: !x
|
|
46
46
|
})]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-gallery{position:relative}.cl-gallery__container{width:100%}.cl-gallery__container_grid{grid-template-columns:repeat(min(var(--gallery-columns), 2), 1fr);gap:var(--gallery-gap,var(--cl-m-gap));grid-auto-rows:1fr;display:grid}.cl-gallery__container_grid[style*=--gallery-rows]{grid-template-rows:repeat(var(--gallery-rows), 1fr);max-height:calc((100% / var(--gallery-columns)) * var(--gallery-rows) + var(--gallery-gap,var(--cl-m-gap)) * (var(--gallery-rows) - 1));overflow:hidden}.cl-gallery__container_grid .cl-gallery__item{width:100%;height:100%}.cl-gallery__container_grid .cl-gallery__item img{object-fit:cover;width:100%;height:100%}.cl-gallery__container_masonry{column-count:1;column-gap:var(--gallery-gap,var(--cl-m-gap))}.cl-gallery__container_masonry .cl-gallery__item{break-inside:avoid;margin-bottom:var(--gallery-gap,var(--cl-m-gap))}.cl-gallery__container_carousel{scroll-behavior:smooth;gap:var(--gallery-gap,var(--cl-m-gap));scrollbar-width:none;flex-wrap:nowrap;display:flex;overflow-x:scroll}.cl-gallery__container_carousel::-webkit-scrollbar{display:none}.cl-gallery__container_carousel .cl-gallery__item{flex-shrink:0}@media (width>=640px){.cl-gallery__container_grid{grid-template-columns:repeat(var(--gallery-columns), 1fr)}.cl-gallery__container_masonry{column-count:2}}@media (width>=1024px){.cl-gallery__container_masonry{column-count:var(--gallery-columns,3)}}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/components/organisms/gallery/Gallery.helpers.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
if (e.length === 0) return;
|
|
4
|
+
let t, n = 0;
|
|
5
|
+
for (let r of e) {
|
|
6
|
+
let e = r.descriptor?.trim();
|
|
7
|
+
if (e?.endsWith("w")) {
|
|
8
|
+
let i = e.slice(0, -1), a = Number.parseInt(i, 10);
|
|
9
|
+
!Number.isNaN(a) && a > n && (n = a, t = r);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return t ?? e.at(-1);
|
|
13
|
+
}, t = (t) => {
|
|
14
|
+
let { caption: n, sources: r, ...i } = t;
|
|
15
|
+
if (r && r.length > 0) {
|
|
16
|
+
let t = e(r);
|
|
17
|
+
if (t) return {
|
|
18
|
+
...i,
|
|
19
|
+
src: t.src,
|
|
20
|
+
sources: void 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
...i,
|
|
25
|
+
sources: r
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { t as getFullscreenImageProps, e as getLargestImageSource };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getClassName as e } from "../../../utils/get-class-name.js";
|
|
2
|
+
import t from "./carousel-navigation/CarouselNavigation2.js";
|
|
3
|
+
import n from "./full-screen-viewer/FullscreenViewer2.js";
|
|
4
|
+
import './Gallery.css';/* empty css */
|
|
5
|
+
import r from "./gallery-image-item/GalleryImageItem2.js";
|
|
6
|
+
import { useCarouselScroll as i } from "./hooks/use-carousel-scroll.js";
|
|
7
|
+
import { useFullscreenViewer as a } from "./hooks/use-fullscreen-viewer.js";
|
|
8
|
+
import { useRef as o } from "react";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/organisms/gallery/Gallery.tsx
|
|
11
|
+
var l = ({ images: l = [], layout: u = "grid", columns: d = 3, rows: f, gap: p, label: m, className: h, title: g, enableFullscreen: _ = !1, ...v }) => {
|
|
12
|
+
let y = o(null), { isViewerOpen: b, currentImageIndex: x, openViewer: S, closeViewer: C, handleNavigate: w } = a(), { showPrev: T, showNext: E, scrollForward: D, scrollBackward: O } = i(y, u), k = e(["cl-gallery", h]), A = e([
|
|
13
|
+
"cl-gallery__container",
|
|
14
|
+
{ "cl-gallery__container_grid": u === "grid" },
|
|
15
|
+
{ "cl-gallery__container_masonry": u === "masonry" },
|
|
16
|
+
{ "cl-gallery__container_carousel": u === "carousel" }
|
|
17
|
+
]), j = {
|
|
18
|
+
"--gallery-columns": d,
|
|
19
|
+
"--gallery-rows": f,
|
|
20
|
+
"--gallery-gap": p
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ c("section", {
|
|
23
|
+
className: k,
|
|
24
|
+
"aria-label": m ?? g ?? "Image gallery",
|
|
25
|
+
title: g,
|
|
26
|
+
...v,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ s("div", {
|
|
29
|
+
ref: y,
|
|
30
|
+
className: A,
|
|
31
|
+
style: j,
|
|
32
|
+
tabIndex: u === "carousel" ? 0 : void 0,
|
|
33
|
+
children: l.map((e, t) => /* @__PURE__ */ s(r, {
|
|
34
|
+
item: e,
|
|
35
|
+
index: t,
|
|
36
|
+
enableFullscreen: _,
|
|
37
|
+
onOpenViewer: S
|
|
38
|
+
}, e.src))
|
|
39
|
+
}),
|
|
40
|
+
u === "carousel" && /* @__PURE__ */ s(t, {
|
|
41
|
+
showPrev: T,
|
|
42
|
+
showNext: E,
|
|
43
|
+
onScrollBackward: O,
|
|
44
|
+
onScrollForward: D
|
|
45
|
+
}),
|
|
46
|
+
_ && /* @__PURE__ */ s(n, {
|
|
47
|
+
images: l,
|
|
48
|
+
currentIndex: x,
|
|
49
|
+
isOpen: b,
|
|
50
|
+
onClose: C,
|
|
51
|
+
onNavigate: w
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { l as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-gallery__button{height:100%;position:absolute;top:0}.cl-gallery__button_prev{left:var(--cl-l-gap)}.cl-gallery__button_next{right:var(--cl-l-gap)}.cl-gallery__button_prev .cl-icon-button__icon:before,.cl-gallery__button_next .cl-icon-button__icon:before{color:#fff!important}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface CarouselNavigationProps {
|
|
3
|
+
showPrev: boolean;
|
|
4
|
+
showNext: boolean;
|
|
5
|
+
onScrollBackward: () => void;
|
|
6
|
+
onScrollForward: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const CarouselNavigation: FC<CarouselNavigationProps>;
|
|
9
|
+
export default CarouselNavigation;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ButtonView as e } from "../../../../enums/button-view.js";
|
|
2
|
+
import { IconName as t } from "../../../../enums/icon-name.js";
|
|
3
|
+
import n from "../../../atoms/button/Button2.js";
|
|
4
|
+
import './CarouselNavigation.css';/* empty css */
|
|
5
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/organisms/gallery/carousel-navigation/CarouselNavigation.tsx
|
|
7
|
+
var o = ({ showPrev: o, showNext: s, onScrollBackward: c, onScrollForward: l }) => /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(n, {
|
|
8
|
+
view: e.Icon,
|
|
9
|
+
icon: t.ChevronLeft,
|
|
10
|
+
label: "Previous images",
|
|
11
|
+
className: "cl-gallery__button cl-gallery__button_prev",
|
|
12
|
+
onClick: c,
|
|
13
|
+
style: { visibility: o ? "visible" : "hidden" },
|
|
14
|
+
"aria-hidden": !o
|
|
15
|
+
}), /* @__PURE__ */ i(n, {
|
|
16
|
+
view: e.Icon,
|
|
17
|
+
icon: t.ChevronRight,
|
|
18
|
+
label: "Next images",
|
|
19
|
+
className: "cl-gallery__button cl-gallery__button_next",
|
|
20
|
+
onClick: l,
|
|
21
|
+
style: { visibility: s ? "visible" : "hidden" },
|
|
22
|
+
"aria-hidden": !s
|
|
23
|
+
})] });
|
|
24
|
+
//#endregion
|
|
25
|
+
export { o as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-fullscreen-viewer{width:100%;height:100%;z-index:var(--cl-z-index-modal);background-color:var(--cl-shadow-background-deep);justify-content:center;align-items:center;animation:.4s cl-fade-in;display:flex;position:fixed;top:0;left:0}.cl-fullscreen-viewer_closing{animation:.4s cl-fade-out}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GalleryItem } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface FullscreenViewerProps {
|
|
4
|
+
images: GalleryItem[];
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onNavigate: (index: number) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const FullscreenViewer: FC<FullscreenViewerProps>;
|
|
11
|
+
export default FullscreenViewer;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getClassName as e } from "../../../../utils/get-class-name.js";
|
|
2
|
+
import t from "../../../atoms/portal/Portal.js";
|
|
3
|
+
import { useIsMounted as n } from "../../../../hooks/use-is-mounted/use-is-mounted.js";
|
|
4
|
+
import { useKeyPress as r } from "../../../../hooks/use-key-press/use-key-press.js";
|
|
5
|
+
import { useModalFocusTrap as i } from "../../../../hooks/use-modal-focus-trap/use-modal-focus-trap.js";
|
|
6
|
+
import './FullscreenViewer.css';/* empty css */
|
|
7
|
+
import { getFullscreenImageProps as a } from "../Gallery.helpers.js";
|
|
8
|
+
import o from "../viewer-close-button/ViewerCloseButton2.js";
|
|
9
|
+
import s from "../viewer-overlay/ViewerOverlay2.js";
|
|
10
|
+
import { useEffect as c, useMemo as l, useRef as u } from "react";
|
|
11
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/organisms/gallery/full-screen-viewer/FullscreenViewer.tsx
|
|
13
|
+
var p = ({ images: p, currentIndex: m, isOpen: h, onClose: g, onNavigate: _ }) => {
|
|
14
|
+
let v = u(null), y = n(h, 300), b = y && !h;
|
|
15
|
+
i({
|
|
16
|
+
modalRef: v,
|
|
17
|
+
isOpened: h
|
|
18
|
+
}), r({
|
|
19
|
+
keyCode: "Escape",
|
|
20
|
+
ref: v,
|
|
21
|
+
onKeyPress: g
|
|
22
|
+
}), c(() => {
|
|
23
|
+
let e = (e) => {
|
|
24
|
+
e.code === "ArrowLeft" && m > 0 ? _(m - 1) : e.code === "ArrowRight" && m < p.length - 1 && _(m + 1);
|
|
25
|
+
};
|
|
26
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
27
|
+
}, [
|
|
28
|
+
m,
|
|
29
|
+
p.length,
|
|
30
|
+
_
|
|
31
|
+
]);
|
|
32
|
+
let x = p[m], S = l(() => x ? a(x) : null, [x]);
|
|
33
|
+
return !y || !x || !S ? null : /* @__PURE__ */ d(t, { children: /* @__PURE__ */ f("div", {
|
|
34
|
+
ref: v,
|
|
35
|
+
className: e(["cl-fullscreen-viewer", { "cl-fullscreen-viewer_closing": b }]),
|
|
36
|
+
"data-testid": "fullscreen-image-viewer",
|
|
37
|
+
children: [/* @__PURE__ */ d(o, { onClose: g }), /* @__PURE__ */ d(s, {
|
|
38
|
+
fullscreenImageProps: S,
|
|
39
|
+
caption: x.caption,
|
|
40
|
+
currentIndex: m,
|
|
41
|
+
totalImages: p.length,
|
|
42
|
+
onClose: g,
|
|
43
|
+
onNavigate: _
|
|
44
|
+
})]
|
|
45
|
+
}) });
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { p as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-gallery__item{overflow:hidden}.cl-gallery__item_fullscreen{cursor:pointer}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GalleryItem } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface GalleryImageItemProps {
|
|
4
|
+
item: GalleryItem;
|
|
5
|
+
index: number;
|
|
6
|
+
enableFullscreen: boolean;
|
|
7
|
+
onOpenViewer?: (index: number, element: HTMLElement) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const GalleryImageItem: FC<GalleryImageItemProps>;
|
|
10
|
+
export default GalleryImageItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getClassName as e } from "../../../../utils/get-class-name.js";
|
|
2
|
+
import t from "../../../atoms/image/Image2.js";
|
|
3
|
+
import './GalleryImageItem.css';/* empty css */
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/organisms/gallery/gallery-image-item/GalleryImageItem.tsx
|
|
6
|
+
var r = ({ item: r, index: i, enableFullscreen: a, onOpenViewer: o }) => /* @__PURE__ */ n("div", {
|
|
7
|
+
className: e(["cl-gallery__item", { "cl-gallery__item_fullscreen": a }]),
|
|
8
|
+
onClick: (e) => {
|
|
9
|
+
a && o && o(i, e.currentTarget);
|
|
10
|
+
},
|
|
11
|
+
onKeyDown: (e) => {
|
|
12
|
+
a && o && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o(i, e.currentTarget));
|
|
13
|
+
},
|
|
14
|
+
children: /* @__PURE__ */ n(t, { ...r })
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GalleryMode } from '../../../../types';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
interface CarouselScrollState {
|
|
4
|
+
showPrev: boolean;
|
|
5
|
+
showNext: boolean;
|
|
6
|
+
scrollForward: () => void;
|
|
7
|
+
scrollBackward: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useCarouselScroll: (containerRef: RefObject<HTMLDivElement | null>, layout: GalleryMode) => CarouselScrollState;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useState as n } from "react";
|
|
2
|
+
//#region src/components/organisms/gallery/hooks/use-carousel-scroll.ts
|
|
3
|
+
var r = (r, i) => {
|
|
4
|
+
let [a, o] = n(!1), [s, c] = n(!1), l = e(() => {
|
|
5
|
+
let e = r.current;
|
|
6
|
+
if (!e) return;
|
|
7
|
+
let { scrollLeft: t, scrollWidth: n, clientWidth: i } = e;
|
|
8
|
+
if (n <= i) {
|
|
9
|
+
o(!1), c(!1);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
o(t > 1), c(t < n - i - 1);
|
|
13
|
+
}, [r]);
|
|
14
|
+
return t(() => {
|
|
15
|
+
if (i !== "carousel") {
|
|
16
|
+
o(!1), c(!1);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let e = r.current;
|
|
20
|
+
if (!e) return;
|
|
21
|
+
l();
|
|
22
|
+
let t = new ResizeObserver(l);
|
|
23
|
+
return t.observe(e), e.addEventListener("scroll", l), () => {
|
|
24
|
+
e.removeEventListener("scroll", l), t.disconnect();
|
|
25
|
+
};
|
|
26
|
+
}, [
|
|
27
|
+
i,
|
|
28
|
+
r,
|
|
29
|
+
l
|
|
30
|
+
]), {
|
|
31
|
+
showPrev: a,
|
|
32
|
+
showNext: s,
|
|
33
|
+
scrollForward: e(() => {
|
|
34
|
+
let e = r.current;
|
|
35
|
+
e && e.scrollBy({
|
|
36
|
+
left: e.clientWidth,
|
|
37
|
+
behavior: "smooth"
|
|
38
|
+
});
|
|
39
|
+
}, [r]),
|
|
40
|
+
scrollBackward: e(() => {
|
|
41
|
+
let e = r.current;
|
|
42
|
+
e && e.scrollBy({
|
|
43
|
+
left: -e.clientWidth,
|
|
44
|
+
behavior: "smooth"
|
|
45
|
+
});
|
|
46
|
+
}, [r])
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { r as useCarouselScroll };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
interface FullscreenViewerState {
|
|
3
|
+
isViewerOpen: boolean;
|
|
4
|
+
currentImageIndex: number;
|
|
5
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
6
|
+
openViewer: (index: number, element: HTMLElement) => void;
|
|
7
|
+
closeViewer: () => void;
|
|
8
|
+
handleNavigate: (index: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const useFullscreenViewer: () => FullscreenViewerState;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback as e, useRef as t, useState as n } from "react";
|
|
2
|
+
//#region src/components/organisms/gallery/hooks/use-fullscreen-viewer.ts
|
|
3
|
+
var r = () => {
|
|
4
|
+
let [r, i] = n(!1), [a, o] = n(0), s = t(null);
|
|
5
|
+
return {
|
|
6
|
+
isViewerOpen: r,
|
|
7
|
+
currentImageIndex: a,
|
|
8
|
+
triggerRef: s,
|
|
9
|
+
openViewer: e((e, t) => {
|
|
10
|
+
s.current = t, o(e), i(!0);
|
|
11
|
+
}, []),
|
|
12
|
+
closeViewer: e(() => {
|
|
13
|
+
i(!1), setTimeout(() => {
|
|
14
|
+
s.current?.focus(), s.current = null;
|
|
15
|
+
}, 300);
|
|
16
|
+
}, []),
|
|
17
|
+
handleNavigate: e((e) => {
|
|
18
|
+
o(e);
|
|
19
|
+
}, [])
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { r as useFullscreenViewer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-fullscreen-viewer__close-button{top:var(--cl-m-gap);right:var(--cl-m-gap);z-index:var(--cl-z-index-menu);position:absolute}.cl-fullscreen-viewer__close-button .cl-icon-button__icon:before{color:#fff!important}@media (width>=640px){.cl-fullscreen-viewer__close-button{top:var(--cl-l-gap);right:var(--cl-l-gap)}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtonView as e } from "../../../../enums/button-view.js";
|
|
2
|
+
import { IconName as t } from "../../../../enums/icon-name.js";
|
|
3
|
+
import n from "../../../atoms/button/Button2.js";
|
|
4
|
+
import './ViewerCloseButton.css';/* empty css */
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/organisms/gallery/viewer-close-button/ViewerCloseButton.tsx
|
|
7
|
+
var i = ({ onClose: i }) => /* @__PURE__ */ r(n, {
|
|
8
|
+
view: e.Icon,
|
|
9
|
+
icon: t.X,
|
|
10
|
+
label: "Close fullscreen view",
|
|
11
|
+
onClick: i,
|
|
12
|
+
className: "cl-fullscreen-viewer__close-button"
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { i as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-fullscreen-viewer__counter{bottom:var(--cl-l-gap);font-family:var(--cl-core-font);font-size:var(--cl-typography-base-mobile);position:absolute;left:50%;color:#fff!important}@media (width>=640px){.cl-fullscreen-viewer__counter{font-size:var(--cl-typography-base-tablet)}}@media (width>=1024px){.cl-fullscreen-viewer__counter{font-size:var(--cl-typography-base-desktop)}}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './ViewerCounter.css';/* empty css */
|
|
2
|
+
import { jsxs as e } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/organisms/gallery/viewer-counter/ViewerCounter.tsx
|
|
4
|
+
var t = ({ currentIndex: t, totalImages: n }) => n <= 1 ? null : /* @__PURE__ */ e("span", {
|
|
5
|
+
className: "cl-fullscreen-viewer__counter",
|
|
6
|
+
"aria-live": "polite",
|
|
7
|
+
children: [
|
|
8
|
+
t + 1,
|
|
9
|
+
" / ",
|
|
10
|
+
n
|
|
11
|
+
]
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { t as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-fullscreen-viewer__image-container{flex-direction:column;align-items:center;max-width:90vw;max-height:90vh;display:flex}.cl-fullscreen-viewer__image-container .cl-image{min-height:0;display:flex}.cl-fullscreen-viewer__image-container .cl-figure{flex-direction:column;min-height:0;display:flex}.cl-fullscreen-viewer__image-container figcaption{color:#fff!important}@media (width>=640px){.cl-fullscreen-viewer__caption{font-size:var(--cl-typography-base-tablet)}}@media (width>=1024px){.cl-fullscreen-viewer__caption{font-size:var(--cl-typography-base-desktop)}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GalleryItem, ImageProps } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface ViewerImageContainerProps {
|
|
4
|
+
fullscreenImageProps: Omit<ImageProps, 'caption'>;
|
|
5
|
+
caption?: GalleryItem['caption'];
|
|
6
|
+
}
|
|
7
|
+
declare const ViewerImageContainer: FC<ViewerImageContainerProps>;
|
|
8
|
+
export default ViewerImageContainer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import e from "../../../atoms/image/Image2.js";
|
|
2
|
+
import './ViewerImageContainer.css';/* empty css */
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/organisms/gallery/viewer-image-container/ViewerImageContainer.tsx
|
|
5
|
+
var n = ({ fullscreenImageProps: n, caption: r }) => /* @__PURE__ */ t("div", {
|
|
6
|
+
className: "cl-fullscreen-viewer__image-container",
|
|
7
|
+
children: /* @__PURE__ */ t(e, {
|
|
8
|
+
...n,
|
|
9
|
+
caption: r,
|
|
10
|
+
loading: "eager"
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-fullscreen-viewer__nav-button{height:90%;z-index:var(--cl-z-index-base);position:absolute;top:5%}.cl-fullscreen-viewer__nav-button .cl-icon-button__icon:before{color:#fff!important}.cl-fullscreen-viewer__nav-button_prev{left:var(--cl-l-gap)}.cl-fullscreen-viewer__nav-button_next{right:var(--cl-l-gap)}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ButtonView as e } from "../../../../enums/button-view.js";
|
|
2
|
+
import { IconName as t } from "../../../../enums/icon-name.js";
|
|
3
|
+
import { getClassName as n } from "../../../../utils/get-class-name.js";
|
|
4
|
+
import r from "../../../atoms/button/Button2.js";
|
|
5
|
+
import './ViewerNavigation.css';/* empty css */
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/organisms/gallery/viewer-navigation/ViewerNavigation.tsx
|
|
8
|
+
var s = ({ currentIndex: s, totalImages: c, onNavigate: l }) => {
|
|
9
|
+
let u = s > 0, d = s < c - 1, f = () => {
|
|
10
|
+
l(s - 1);
|
|
11
|
+
}, p = () => {
|
|
12
|
+
l(s + 1);
|
|
13
|
+
}, m = n(["cl-fullscreen-viewer__nav-button", "cl-fullscreen-viewer__nav-button_prev"]), h = n(["cl-fullscreen-viewer__nav-button", "cl-fullscreen-viewer__nav-button_next"]);
|
|
14
|
+
return /* @__PURE__ */ o(i, { children: [u && /* @__PURE__ */ a(r, {
|
|
15
|
+
view: e.Icon,
|
|
16
|
+
icon: t.ChevronLeft,
|
|
17
|
+
label: "Previous image",
|
|
18
|
+
onClick: f,
|
|
19
|
+
className: m
|
|
20
|
+
}), d && /* @__PURE__ */ a(r, {
|
|
21
|
+
view: e.Icon,
|
|
22
|
+
icon: t.ChevronRight,
|
|
23
|
+
label: "Next image",
|
|
24
|
+
onClick: p,
|
|
25
|
+
className: h
|
|
26
|
+
})] });
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { s as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-fullscreen-viewer__overlay{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;top:0;left:0}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GalleryItem, ImageProps } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export interface ViewerOverlayProps {
|
|
4
|
+
fullscreenImageProps: Omit<ImageProps, 'caption'>;
|
|
5
|
+
caption?: GalleryItem['caption'];
|
|
6
|
+
currentIndex: number;
|
|
7
|
+
totalImages: number;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onNavigate: (index: number) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const ViewerOverlay: FC<ViewerOverlayProps>;
|
|
12
|
+
export default ViewerOverlay;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import e from "../viewer-counter/ViewerCounter2.js";
|
|
2
|
+
import t from "../viewer-image-container/ViewerImageContainer2.js";
|
|
3
|
+
import n from "../viewer-navigation/ViewerNavigation2.js";
|
|
4
|
+
import './ViewerOverlay.css';/* empty css */
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/organisms/gallery/viewer-overlay/ViewerOverlay.tsx
|
|
7
|
+
var a = ({ fullscreenImageProps: a, caption: o, currentIndex: s, totalImages: c, onClose: l, onNavigate: u }) => /* @__PURE__ */ i("div", {
|
|
8
|
+
className: "cl-fullscreen-viewer__overlay",
|
|
9
|
+
onClick: (e) => {
|
|
10
|
+
e.target === e.currentTarget && l();
|
|
11
|
+
},
|
|
12
|
+
onKeyDown: (e) => {
|
|
13
|
+
(e.key === "Enter" || e.key === " ") && e.target === e.currentTarget && (e.preventDefault(), l());
|
|
14
|
+
},
|
|
15
|
+
"data-testid": "viewer-overlay",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ r(t, {
|
|
18
|
+
fullscreenImageProps: a,
|
|
19
|
+
caption: o
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ r(e, {
|
|
22
|
+
currentIndex: s,
|
|
23
|
+
totalImages: c
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ r(n, {
|
|
26
|
+
currentIndex: s,
|
|
27
|
+
totalImages: c,
|
|
28
|
+
onNavigate: u
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { a as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconName as e } from "../../../../enums/icon-name.js";
|
|
2
|
+
import { getClassName as t } from "../../../../utils/get-class-name.js";
|
|
3
3
|
import n from "../../../atoms/label/Label2.js";
|
|
4
4
|
import { useElementIds as r } from "../../../../hooks/use-element-ids/use-element-ids.js";
|
|
5
5
|
import './GridCheckbox.css';/* empty css */
|
|
@@ -8,7 +8,7 @@ import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
|
8
8
|
var o = ({ name: o, label: s, disabled: c, required: l = !1, onChange: u, checked: d = !1, ...f }) => {
|
|
9
9
|
let { elementId: p } = r(f?.id);
|
|
10
10
|
return /* @__PURE__ */ a("div", {
|
|
11
|
-
className:
|
|
11
|
+
className: t(["cl-grid-checkbox", {
|
|
12
12
|
"cl-grid-checkbox_disabled": !!c,
|
|
13
13
|
"cl-grid-checkbox_checked": !!d
|
|
14
14
|
}]),
|
|
@@ -27,7 +27,7 @@ var o = ({ name: o, label: s, disabled: c, required: l = !1, onChange: u, checke
|
|
|
27
27
|
inputId: p,
|
|
28
28
|
isTextHidden: !0,
|
|
29
29
|
iconPosition: "left",
|
|
30
|
-
icon: d ?
|
|
30
|
+
icon: d ? e.CheckSquare : e.Square
|
|
31
31
|
})]
|
|
32
32
|
});
|
|
33
33
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as Dialog } from './dialog/Dialog';
|
|
2
2
|
export { default as Form } from './form/Form';
|
|
3
|
+
export { default as Gallery } from './gallery/Gallery';
|
|
3
4
|
export { default as Grid } from './grid/Grid';
|
|
4
5
|
export { default as Menu } from './menu/Menu';
|
|
6
|
+
export { default as PreviewCard } from './preview-card/PreviewCard';
|
|
5
7
|
export { default as Tabs } from './tabs/Tabs';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OrientationMode as e } from "../../../enums/orientation-mode.js";
|
|
2
|
+
import { getClassName as t } from "../../../utils/get-class-name.js";
|
|
3
3
|
import { MenuListItem as n } from "./list-item/MenuListItem2.js";
|
|
4
4
|
import './Menu.css';/* empty css */
|
|
5
5
|
import { jsx as r } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/organisms/menu/Menu.tsx
|
|
7
|
-
var i = ({ items: i = [], mode: a =
|
|
8
|
-
let l =
|
|
7
|
+
var i = ({ items: i = [], mode: a = e.Vertical, openedOn: o = "click", className: s, ...c }) => {
|
|
8
|
+
let l = t([
|
|
9
9
|
"cl-menu-bar",
|
|
10
10
|
s,
|
|
11
|
-
{ "cl-menu-bar_vertical": a ===
|
|
11
|
+
{ "cl-menu-bar_vertical": a === e.Vertical }
|
|
12
12
|
]);
|
|
13
13
|
return /* @__PURE__ */ r("menu", {
|
|
14
14
|
...c,
|