chop-logic-components 4.2.0 → 4.4.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/form/FormContext.d.ts +1 -0
- package/dist/components/contexts/form/FormContext.js +1 -1
- 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/NumericInput.controller.js +2 -1
- 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/Form.controller.d.ts +17 -9
- package/dist/components/organisms/form/Form.controller.js +41 -21
- package/dist/components/organisms/form/Form.css +1 -1
- package/dist/components/organisms/form/Form2.js +38 -29
- package/dist/components/organisms/gallery/Gallery.helpers.js +2 -2
- package/dist/components/organisms/gallery/Gallery2.js +8 -8
- package/dist/components/organisms/gallery/full-screen-viewer/FullscreenViewer2.js +7 -7
- package/dist/components/organisms/gallery/viewer-navigation/ViewerNavigation2.js +8 -8
- package/dist/components/organisms/grid/Grid.controller.js +4 -2
- package/dist/components/organisms/grid/checkbox/GridCheckbox2.js +4 -4
- package/dist/components/organisms/index.d.ts +1 -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/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/use-click-outside/use-click-outside.js +1 -1
- package/dist/hooks/use-form-pending/index.js +2 -0
- package/dist/hooks/use-form-pending/use-form-pending.d.ts +1 -0
- package/dist/hooks/use-form-pending/use-form-pending.js +9 -0
- package/dist/hooks/use-remaining-timer/use-remaining-timer.js +3 -1
- package/dist/index.es.js +62 -57
- package/dist/types/form.d.ts +6 -3
- package/dist/types/image.d.ts +16 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/preview-card.d.ts +38 -0
- package/package.json +18 -18
|
@@ -1,6 +1,6 @@
|
|
|
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 i from "../../atoms/header/Header2.js";
|
|
6
6
|
import a from "../../atoms/portal/Portal.js";
|
|
@@ -8,11 +8,11 @@ import { useIsMounted as o } from "../../../hooks/use-is-mounted/use-is-mounted.
|
|
|
8
8
|
import { useKeyPress as s } from "../../../hooks/use-key-press/use-key-press.js";
|
|
9
9
|
import { useModalFocusTrap as c } from "../../../hooks/use-modal-focus-trap/use-modal-focus-trap.js";
|
|
10
10
|
import './Dialog.css';/* empty css */
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { useRef as l } from "react";
|
|
12
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
13
13
|
//#region src/components/organisms/dialog/Dialog.tsx
|
|
14
14
|
var f = ({ isOpened: f, onClose: p, title: m, children: h, icon: g, ..._ }) => {
|
|
15
|
-
let v = o(f), y = v && !f, b =
|
|
15
|
+
let v = o(f), y = v && !f, b = l(null);
|
|
16
16
|
return c({
|
|
17
17
|
modalRef: b,
|
|
18
18
|
isOpened: f
|
|
@@ -20,28 +20,28 @@ var f = ({ isOpened: f, onClose: p, title: m, children: h, icon: g, ..._ }) => {
|
|
|
20
20
|
keyCode: "Escape",
|
|
21
21
|
ref: b,
|
|
22
22
|
onKeyPress: p
|
|
23
|
-
}), v ? /* @__PURE__ */
|
|
24
|
-
className:
|
|
25
|
-
children: /* @__PURE__ */
|
|
23
|
+
}), v ? /* @__PURE__ */ u(a, { children: /* @__PURE__ */ u("div", {
|
|
24
|
+
className: n(["cl-dialog", { "cl-dialog_closing": y }]),
|
|
25
|
+
children: /* @__PURE__ */ d("div", {
|
|
26
26
|
ref: b,
|
|
27
27
|
role: "dialog",
|
|
28
28
|
"aria-modal": "true",
|
|
29
29
|
..._,
|
|
30
30
|
className: "cl-dialog__layout",
|
|
31
31
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
icon:
|
|
34
|
-
view:
|
|
32
|
+
/* @__PURE__ */ u(r, {
|
|
33
|
+
icon: t.X,
|
|
34
|
+
view: e.Icon,
|
|
35
35
|
label: "Close modal window",
|
|
36
36
|
onClick: p,
|
|
37
37
|
className: "cl-dialog__button"
|
|
38
38
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ u("header", { children: /* @__PURE__ */ u(i, {
|
|
40
40
|
as: "h3",
|
|
41
41
|
icon: g,
|
|
42
42
|
children: m
|
|
43
43
|
}) }),
|
|
44
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ u("div", { children: h })
|
|
45
45
|
]
|
|
46
46
|
})
|
|
47
47
|
}) }) : null;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { FormInputParams, FormValues } from '../../../types';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { SubmitEvent, SubmitEventHandler } from 'react';
|
|
3
|
+
interface UseFormControllerParams<TActionState = void> {
|
|
4
4
|
initialValues?: FormValues;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
resetOnSuccess?: boolean;
|
|
6
|
+
onReset?: SubmitEventHandler<HTMLFormElement>;
|
|
7
|
+
action?: (prevState: TActionState, formData: FormData) => TActionState | Promise<TActionState>;
|
|
8
|
+
actionInitialState?: TActionState;
|
|
9
|
+
onActionComplete?: (state: TActionState) => void;
|
|
10
|
+
onSubmit?: (data: FormValues) => void | Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
interface UseFormControllerReturn {
|
|
9
13
|
handleInputChange: (params: FormInputParams) => void;
|
|
10
|
-
|
|
11
|
-
handleReset: (event: FormEvent<HTMLFormElement>) => void;
|
|
14
|
+
handleReset: (event: SubmitEvent<HTMLFormElement>) => void;
|
|
12
15
|
resetSignal: number;
|
|
13
16
|
valid: boolean;
|
|
14
|
-
|
|
17
|
+
isPending: boolean;
|
|
18
|
+
formAction?: (formData: FormData) => void;
|
|
19
|
+
handleSubmit?: (event: SubmitEvent<HTMLFormElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function useFormController<TActionState = void>({ initialValues, resetOnSuccess, onReset, action, actionInitialState, onActionComplete, onSubmit, }: UseFormControllerParams<TActionState>): UseFormControllerReturn;
|
|
22
|
+
export {};
|
|
@@ -1,29 +1,49 @@
|
|
|
1
1
|
import { getInitialValidationState as e, isFormDataValid as t, updateValidationState as n } from "./Form.helpers.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useActionState as r, useCallback as i, useState as a } from "react";
|
|
3
3
|
//#region src/components/organisms/form/Form.controller.ts
|
|
4
|
-
function
|
|
5
|
-
let [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
function o({ initialValues: o, resetOnSuccess: s = !1, onReset: c, action: l, actionInitialState: u, onActionComplete: d, onSubmit: f }) {
|
|
5
|
+
let [p, m] = a(o), [h, g] = a(e(o)), [_, v] = a(0), [y, b] = a(!1), x = (e) => {
|
|
6
|
+
let t = {
|
|
7
|
+
...p,
|
|
8
|
+
[e.name]: e.value
|
|
9
|
+
};
|
|
10
|
+
m(t), g(n(h, e));
|
|
11
|
+
}, S = i(() => {
|
|
12
|
+
m(o), v((e) => e + 1), g(e(o));
|
|
13
|
+
}, [o]), C = (e) => {
|
|
14
|
+
c?.(e), S();
|
|
15
|
+
}, w = t(h), [, T, E] = r(async (e, t) => {
|
|
16
|
+
if (!l) return e;
|
|
17
|
+
let n = await l(e, t);
|
|
18
|
+
return d?.(n), s && S(), n;
|
|
19
|
+
}, u);
|
|
20
|
+
return l ? {
|
|
21
|
+
handleInputChange: x,
|
|
22
|
+
handleReset: C,
|
|
23
|
+
resetSignal: _,
|
|
24
|
+
valid: w,
|
|
25
|
+
isPending: E,
|
|
26
|
+
formAction: T
|
|
27
|
+
} : {
|
|
28
|
+
handleInputChange: x,
|
|
29
|
+
handleReset: C,
|
|
30
|
+
resetSignal: _,
|
|
31
|
+
valid: w,
|
|
32
|
+
isPending: y,
|
|
33
|
+
handleSubmit: async (e) => {
|
|
34
|
+
if (e.preventDefault(), !w || !f) return;
|
|
15
35
|
let t = {
|
|
16
36
|
...Object.fromEntries(new FormData(e.target)),
|
|
17
|
-
...
|
|
37
|
+
...p
|
|
18
38
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
b(!0);
|
|
40
|
+
try {
|
|
41
|
+
await f(t), s && S();
|
|
42
|
+
} finally {
|
|
43
|
+
b(!1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
26
46
|
};
|
|
27
47
|
}
|
|
28
48
|
//#endregion
|
|
29
|
-
export {
|
|
49
|
+
export { o as useFormController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.cl-form{align-items:end;gap:var(--cl-l-gap);grid-template-rows:auto;grid-template-columns:auto;display:grid}@media screen and (width>=640px){.cl-form{grid-template-columns:repeat(2,1fr)}}@media screen and (width>=1024px){.cl-form{grid-template-columns:repeat(3,1fr)}}@media screen and (width>=1280px){.cl-form{grid-template-columns:repeat(4,1fr)}}.cl-form__buttons{padding-top:var(--cl-l-gap);grid-column:1/-1;justify-content:space-between;align-items:center;display:flex}
|
|
1
|
+
.cl-form{align-items:end;gap:var(--cl-l-gap);grid-template-rows:auto;grid-template-columns:auto;display:grid}@media screen and (width>=640px){.cl-form{grid-template-columns:repeat(2,1fr)}}@media screen and (width>=1024px){.cl-form{grid-template-columns:repeat(3,1fr)}}@media screen and (width>=1280px){.cl-form{grid-template-columns:repeat(4,1fr)}}.cl-form__buttons{padding-top:var(--cl-l-gap);grid-column:1/-1;justify-content:space-between;align-items:center;display:flex}.cl-form_pending{opacity:.7;pointer-events:none}
|
|
@@ -1,48 +1,57 @@
|
|
|
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
|
-
var l = ({ children: l, initialValues: u, onReset: d, onSubmit: f,
|
|
12
|
-
let { handleInputChange:
|
|
11
|
+
var l = ({ children: l, initialValues: u, onReset: d, onSubmit: f, action: p, actionInitialState: m, onActionComplete: h, resetOnSuccess: g = !1, hasReset: _ = !0, className: v }) => {
|
|
12
|
+
let { handleInputChange: y, handleSubmit: b, handleReset: x, formAction: S, resetSignal: C, valid: w, isPending: T } = a({
|
|
13
13
|
initialValues: u,
|
|
14
|
+
resetOnSuccess: g,
|
|
14
15
|
onReset: d,
|
|
15
16
|
onSubmit: f,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
action: p,
|
|
18
|
+
actionInitialState: m,
|
|
19
|
+
onActionComplete: h
|
|
20
|
+
}), E = n([
|
|
21
|
+
"cl-form",
|
|
22
|
+
v,
|
|
23
|
+
{ "cl-form_pending": T }
|
|
24
|
+
]), D = o(() => ({
|
|
25
|
+
onChangeFormInput: y,
|
|
19
26
|
initialValues: u,
|
|
20
|
-
resetSignal:
|
|
27
|
+
resetSignal: C,
|
|
28
|
+
isPending: T
|
|
21
29
|
}), [
|
|
22
|
-
|
|
30
|
+
y,
|
|
23
31
|
u,
|
|
24
|
-
|
|
32
|
+
C,
|
|
33
|
+
T
|
|
25
34
|
]);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
onSubmit:
|
|
28
|
-
onReset:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
children: [l, /* @__PURE__ */ s("div", {
|
|
35
|
+
return /* @__PURE__ */ s("form", {
|
|
36
|
+
...p ? { action: S } : { onSubmit: b },
|
|
37
|
+
onReset: x,
|
|
38
|
+
className: E,
|
|
39
|
+
children: /* @__PURE__ */ c(i.Provider, {
|
|
40
|
+
value: D,
|
|
41
|
+
children: [l, /* @__PURE__ */ c("div", {
|
|
34
42
|
className: "cl-form__buttons",
|
|
35
|
-
children: [
|
|
43
|
+
children: [_ && /* @__PURE__ */ s(r, {
|
|
36
44
|
type: "reset",
|
|
37
|
-
text: "
|
|
38
|
-
icon:
|
|
39
|
-
view:
|
|
40
|
-
|
|
45
|
+
text: "Clear",
|
|
46
|
+
icon: t.Trash,
|
|
47
|
+
view: e.Secondary,
|
|
48
|
+
disabled: T
|
|
49
|
+
}), /* @__PURE__ */ s(r, {
|
|
41
50
|
type: "submit",
|
|
42
51
|
text: "Submit",
|
|
43
|
-
icon:
|
|
44
|
-
extended: !
|
|
45
|
-
disabled: !
|
|
52
|
+
icon: t.ArrowRight,
|
|
53
|
+
extended: !_,
|
|
54
|
+
disabled: !w || T
|
|
46
55
|
})]
|
|
47
56
|
})]
|
|
48
57
|
})
|
|
@@ -4,7 +4,7 @@ var e = (e) => {
|
|
|
4
4
|
let t, n = 0;
|
|
5
5
|
for (let r of e) {
|
|
6
6
|
let e = r.descriptor?.trim();
|
|
7
|
-
if (e
|
|
7
|
+
if (e?.endsWith("w")) {
|
|
8
8
|
let i = e.slice(0, -1), a = Number.parseInt(i, 10);
|
|
9
9
|
!Number.isNaN(a) && a > n && (n = a, t = r);
|
|
10
10
|
}
|
|
@@ -26,4 +26,4 @@ var e = (e) => {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
|
-
export { t as getFullscreenImageProps };
|
|
29
|
+
export { t as getFullscreenImageProps, e as getLargestImageSource };
|
|
@@ -5,11 +5,11 @@ import './Gallery.css';/* empty css */
|
|
|
5
5
|
import r from "./gallery-image-item/GalleryImageItem2.js";
|
|
6
6
|
import { useCarouselScroll as i } from "./hooks/use-carousel-scroll.js";
|
|
7
7
|
import { useFullscreenViewer as a } from "./hooks/use-fullscreen-viewer.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useRef as o } from "react";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/organisms/gallery/Gallery.tsx
|
|
11
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 =
|
|
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
13
|
"cl-gallery__container",
|
|
14
14
|
{ "cl-gallery__container_grid": u === "grid" },
|
|
15
15
|
{ "cl-gallery__container_masonry": u === "masonry" },
|
|
@@ -19,31 +19,31 @@ var l = ({ images: l = [], layout: u = "grid", columns: d = 3, rows: f, gap: p,
|
|
|
19
19
|
"--gallery-rows": f,
|
|
20
20
|
"--gallery-gap": p
|
|
21
21
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ c("section", {
|
|
23
23
|
className: k,
|
|
24
24
|
"aria-label": m ?? g ?? "Image gallery",
|
|
25
25
|
title: g,
|
|
26
26
|
...v,
|
|
27
27
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ s("div", {
|
|
29
29
|
ref: y,
|
|
30
30
|
className: A,
|
|
31
31
|
style: j,
|
|
32
32
|
tabIndex: u === "carousel" ? 0 : void 0,
|
|
33
|
-
children: l.map((e, t) => /* @__PURE__ */
|
|
33
|
+
children: l.map((e, t) => /* @__PURE__ */ s(r, {
|
|
34
34
|
item: e,
|
|
35
35
|
index: t,
|
|
36
36
|
enableFullscreen: _,
|
|
37
37
|
onOpenViewer: S
|
|
38
38
|
}, e.src))
|
|
39
39
|
}),
|
|
40
|
-
u === "carousel" && /* @__PURE__ */
|
|
40
|
+
u === "carousel" && /* @__PURE__ */ s(t, {
|
|
41
41
|
showPrev: T,
|
|
42
42
|
showNext: E,
|
|
43
43
|
onScrollBackward: O,
|
|
44
44
|
onScrollForward: D
|
|
45
45
|
}),
|
|
46
|
-
_ && /* @__PURE__ */
|
|
46
|
+
_ && /* @__PURE__ */ s(n, {
|
|
47
47
|
images: l,
|
|
48
48
|
currentIndex: x,
|
|
49
49
|
isOpen: b,
|
|
@@ -7,11 +7,11 @@ import './FullscreenViewer.css';/* empty css */
|
|
|
7
7
|
import { getFullscreenImageProps as a } from "../Gallery.helpers.js";
|
|
8
8
|
import o from "../viewer-close-button/ViewerCloseButton2.js";
|
|
9
9
|
import s from "../viewer-overlay/ViewerOverlay2.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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
12
|
//#region src/components/organisms/gallery/full-screen-viewer/FullscreenViewer.tsx
|
|
13
13
|
var p = ({ images: p, currentIndex: m, isOpen: h, onClose: g, onNavigate: _ }) => {
|
|
14
|
-
let v =
|
|
14
|
+
let v = u(null), y = n(h, 300), b = y && !h;
|
|
15
15
|
i({
|
|
16
16
|
modalRef: v,
|
|
17
17
|
isOpened: h
|
|
@@ -19,7 +19,7 @@ var p = ({ images: p, currentIndex: m, isOpen: h, onClose: g, onNavigate: _ }) =
|
|
|
19
19
|
keyCode: "Escape",
|
|
20
20
|
ref: v,
|
|
21
21
|
onKeyPress: g
|
|
22
|
-
}),
|
|
22
|
+
}), c(() => {
|
|
23
23
|
let e = (e) => {
|
|
24
24
|
e.code === "ArrowLeft" && m > 0 ? _(m - 1) : e.code === "ArrowRight" && m < p.length - 1 && _(m + 1);
|
|
25
25
|
};
|
|
@@ -29,12 +29,12 @@ var p = ({ images: p, currentIndex: m, isOpen: h, onClose: g, onNavigate: _ }) =
|
|
|
29
29
|
p.length,
|
|
30
30
|
_
|
|
31
31
|
]);
|
|
32
|
-
let x = p[m], S =
|
|
33
|
-
return !y || !x || !S ? null : /* @__PURE__ */
|
|
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
34
|
ref: v,
|
|
35
35
|
className: e(["cl-fullscreen-viewer", { "cl-fullscreen-viewer_closing": b }]),
|
|
36
36
|
"data-testid": "fullscreen-image-viewer",
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ d(o, { onClose: g }), /* @__PURE__ */ d(s, {
|
|
38
38
|
fullscreenImageProps: S,
|
|
39
39
|
caption: x.caption,
|
|
40
40
|
currentIndex: m,
|
|
@@ -1,6 +1,6 @@
|
|
|
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 './ViewerNavigation.css';/* empty css */
|
|
6
6
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
@@ -10,16 +10,16 @@ var s = ({ currentIndex: s, totalImages: c, onNavigate: l }) => {
|
|
|
10
10
|
l(s - 1);
|
|
11
11
|
}, p = () => {
|
|
12
12
|
l(s + 1);
|
|
13
|
-
}, m =
|
|
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
14
|
return /* @__PURE__ */ o(i, { children: [u && /* @__PURE__ */ a(r, {
|
|
15
|
-
view:
|
|
16
|
-
icon:
|
|
15
|
+
view: e.Icon,
|
|
16
|
+
icon: t.ChevronLeft,
|
|
17
17
|
label: "Previous image",
|
|
18
18
|
onClick: f,
|
|
19
19
|
className: m
|
|
20
20
|
}), d && /* @__PURE__ */ a(r, {
|
|
21
|
-
view:
|
|
22
|
-
icon:
|
|
21
|
+
view: e.Icon,
|
|
22
|
+
icon: t.ChevronRight,
|
|
23
23
|
label: "Next image",
|
|
24
24
|
onClick: p,
|
|
25
25
|
className: h
|
|
@@ -17,10 +17,12 @@ var n = ({ data: n, id: r, onSelect: i }) => {
|
|
|
17
17
|
d([]);
|
|
18
18
|
},
|
|
19
19
|
handleSelectRowById: (e) => {
|
|
20
|
-
|
|
20
|
+
let t = [...o, e];
|
|
21
|
+
d(t);
|
|
21
22
|
},
|
|
22
23
|
handleDeselectRowById: (e) => {
|
|
23
|
-
|
|
24
|
+
let t = o.filter((t) => t !== e);
|
|
25
|
+
d(t);
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
28
|
};
|
|
@@ -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
|
};
|
|
@@ -3,4 +3,5 @@ export { default as Form } from './form/Form';
|
|
|
3
3
|
export { default as Gallery } from './gallery/Gallery';
|
|
4
4
|
export { default as Grid } from './grid/Grid';
|
|
5
5
|
export { default as Menu } from './menu/Menu';
|
|
6
|
+
export { default as PreviewCard } from './preview-card/PreviewCard';
|
|
6
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,
|
|
@@ -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 { MenuLeaf as n } from "../leaf/MenuLeaf2.js";
|
|
4
4
|
import { SubMenu as r } from "../sub-menu/SubMenu2.js";
|
|
5
5
|
import './MenuListItem.css';/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useState as i } from "react";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/organisms/menu/list-item/MenuListItem.tsx
|
|
9
9
|
var o = ({ item: s, mode: c, openedOn: l }) => {
|
|
10
|
-
let u = !s?.nestedItems?.length, [d, f] =
|
|
11
|
-
return u ? /* @__PURE__ */
|
|
10
|
+
let u = !s?.nestedItems?.length, [d, f] = i(!1), p = t(["cl-sub-menu-bar", { "cl-sub-menu-bar_horizontal": c === e.Horizontal }]);
|
|
11
|
+
return u ? /* @__PURE__ */ a(n, { item: s }) : /* @__PURE__ */ a(r, {
|
|
12
12
|
item: s,
|
|
13
13
|
isSubMenuOpened: d,
|
|
14
14
|
toggleSubMenu: () => {
|
|
@@ -22,11 +22,11 @@ var o = ({ item: s, mode: c, openedOn: l }) => {
|
|
|
22
22
|
},
|
|
23
23
|
mode: c,
|
|
24
24
|
openedOn: l,
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ a("ul", {
|
|
26
26
|
className: p,
|
|
27
27
|
role: "menu",
|
|
28
28
|
"aria-label": s.label,
|
|
29
|
-
children: s?.nestedItems?.map((e) => /* @__PURE__ */
|
|
29
|
+
children: s?.nestedItems?.map((e) => /* @__PURE__ */ a(o, {
|
|
30
30
|
item: e,
|
|
31
31
|
mode: c,
|
|
32
32
|
openedOn: l
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ElementSize as e } from "../../../../enums/element-size.js";
|
|
2
|
+
import { IconName as t } from "../../../../enums/icon-name.js";
|
|
3
|
+
import { OrientationMode as n } from "../../../../enums/orientation-mode.js";
|
|
4
|
+
import { getClassName as r } from "../../../../utils/get-class-name.js";
|
|
5
5
|
import i from "../../../atoms/icon/Icon2.js";
|
|
6
6
|
import { useClickOutside as a } from "../../../../hooks/use-click-outside/use-click-outside.js";
|
|
7
7
|
import './SubMenu.css';/* empty css */
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useRef as o } from "react";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/organisms/menu/sub-menu/SubMenu.tsx
|
|
11
11
|
var l = ({ item: l, isSubMenuOpened: u, toggleSubMenu: d, closeSubMenu: f, openSubMenu: p, openedOn: m, mode: h, children: g }) => {
|
|
12
|
-
let { icon: _, link: v, label: y } = l, b =
|
|
12
|
+
let { icon: _, link: v, label: y } = l, b = o(null), x = o(null), S = r(["cl-sub-menu__icon", { "cl-sub-menu__icon_opened": u }]), C = v ? /* @__PURE__ */ c("a", {
|
|
13
13
|
href: v,
|
|
14
14
|
target: "_blank",
|
|
15
15
|
rel: "noreferrer",
|
|
16
|
-
children: [/* @__PURE__ */
|
|
16
|
+
children: [/* @__PURE__ */ s(i, {
|
|
17
17
|
name: _,
|
|
18
|
-
size:
|
|
18
|
+
size: e.Small
|
|
19
19
|
}), y]
|
|
20
|
-
}) : /* @__PURE__ */
|
|
20
|
+
}) : /* @__PURE__ */ c("span", { children: [/* @__PURE__ */ s(i, {
|
|
21
21
|
name: _,
|
|
22
|
-
size:
|
|
22
|
+
size: e.Small
|
|
23
23
|
}), y] }), w = (e) => {
|
|
24
24
|
e.stopPropagation(), e.key === " " && d();
|
|
25
25
|
};
|
|
@@ -27,9 +27,9 @@ var l = ({ item: l, isSubMenuOpened: u, toggleSubMenu: d, closeSubMenu: f, openS
|
|
|
27
27
|
ref: b,
|
|
28
28
|
dependentRef: x,
|
|
29
29
|
onClickOutsideHandler: () => {
|
|
30
|
-
h !==
|
|
30
|
+
h !== n.Vertical && f();
|
|
31
31
|
}
|
|
32
|
-
}), /* @__PURE__ */
|
|
32
|
+
}), /* @__PURE__ */ c("li", {
|
|
33
33
|
className: "cl-sub-menu",
|
|
34
34
|
tabIndex: 0,
|
|
35
35
|
role: "menuitem",
|
|
@@ -39,15 +39,15 @@ var l = ({ item: l, isSubMenuOpened: u, toggleSubMenu: d, closeSubMenu: f, openS
|
|
|
39
39
|
onMouseEnter: m === "hover" ? p : void 0,
|
|
40
40
|
onMouseLeave: m === "hover" ? f : void 0,
|
|
41
41
|
ref: b,
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ c("span", {
|
|
43
43
|
className: "cl-sub-menu__text",
|
|
44
44
|
ref: x,
|
|
45
45
|
onClick: d,
|
|
46
46
|
onKeyDown: w,
|
|
47
|
-
children: [C, /* @__PURE__ */
|
|
48
|
-
name:
|
|
47
|
+
children: [C, /* @__PURE__ */ s(i, {
|
|
48
|
+
name: t.ChevronDown,
|
|
49
49
|
className: S,
|
|
50
|
-
size:
|
|
50
|
+
size: e.Small
|
|
51
51
|
})]
|
|
52
52
|
}), u && g]
|
|
53
53
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cl-preview-card{border:var(--cl-light-border);border-radius:var(--cl-border-radius);background-color:var(--cl-surface-a0);color:var(--cl-base-font-color);font-family:var(--cl-core-font);box-shadow:var(--cl-box-shadow);flex-direction:column;width:30rem;display:flex;overflow:hidden}.cl-preview-card__image{border-bottom:var(--cl-light-border);border-radius:0!important}.cl-preview-card__image-link{line-height:0;text-decoration:none;display:block}.cl-preview-card__image-link:focus{outline:2px solid var(--cl-accent-a0);outline-offset:-2px}.cl-preview-card__title{padding:var(--cl-l-gap) var(--cl-l-gap) var(--cl-s-gap);margin:0}.cl-preview-card__summary{padding:0 var(--cl-l-gap) var(--cl-m-gap);margin:0}.cl-preview-card__authors{gap:var(--cl-m-gap);padding:var(--cl-m-gap) var(--cl-l-gap);flex-wrap:wrap;margin:0;list-style:none;display:flex}.cl-preview-card__author-item{align-items:center;gap:var(--cl-s-gap);font-style:italic;display:inline-flex}.cl-preview-card__tags{gap:var(--cl-s-gap);padding:var(--cl-m-gap) var(--cl-l-gap) var(--cl-l-gap);flex-wrap:wrap;margin:0;list-style:none;display:flex}.cl-preview-card__tag-item{display:inline-flex}.cl-preview-card__summary,.cl-preview-card__author-item{font-family:var(--cl-core-font);font-size:var(--cl-typography-base-mobile);letter-spacing:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;line-height:1.2}@media (width>=640px){.cl-preview-card__summary,.cl-preview-card__author-item{font-size:var(--cl-typography-base-tablet)}}@media (width>=1024px){.cl-preview-card__summary,.cl-preview-card__author-item{font-size:var(--cl-typography-base-desktop)}}
|