@layers-app/shared 0.4.1 → 0.4.2
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/AnimatedFigurePage/AnimatedFigurePage.module.css.js +13 -13
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +55 -59
- package/dist/components/AttachmentsGalleryModal/styles.module.css.js +24 -22
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +109 -83
- package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerList.js +62 -63
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerToolbar.js +128 -120
- package/dist/components/ColorPicker/icons.js +3 -3
- package/dist/components/ColorPicker/types.d.ts +3 -1
- package/dist/components/ColorPicker/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/types.js +11 -5
- package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
- package/dist/components/CommentComposer/CommentEditorHotkeys.js +55 -45
- package/dist/components/FilePicker/FilePicker.d.ts +3 -1
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +44 -42
- package/dist/components/FilePicker/FilePickerUpload.d.ts +3 -1
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +28 -28
- package/dist/components/LanguagePicker/LanguagePicker.d.ts +13 -3
- package/dist/components/LanguagePicker/LanguagePicker.d.ts.map +1 -1
- package/dist/components/LanguagePicker/LanguagePicker.js +65 -43
- package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts +6 -1
- package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts.map +1 -1
- package/dist/components/OnboardingTour/OnboardingTourFooter.js +39 -21
- package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts +4 -5
- package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts.map +1 -1
- package/dist/components/OnboardingTour/OnboardingTourWrapper.js +86 -118
- package/dist/components/OnboardingTour/index.d.ts +1 -1
- package/dist/components/OnboardingTour/index.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts +4 -0
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.js +65 -36
- package/dist/components/UserAvatar/index.d.ts.map +1 -1
- package/dist/components/UserAvatar/index.js +38 -31
- package/dist/config/brand.d.ts +2 -0
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +28 -22
- package/dist/config/envConfig.d.ts +4 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +445 -439
- package/dist/lang/locales/ui_ru.json.js +1 -1
- package/dist/store/featureProgress.d.ts +3 -6
- package/dist/store/featureProgress.d.ts.map +1 -1
- package/dist/store/featureProgress.js +56 -22
- package/dist/store/plansModal.d.ts.map +1 -1
- package/dist/store/plansModal.js +10 -10
- package/package.json +2 -2
|
@@ -1,55 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import {
|
|
4
|
-
import { HugeiconsIcon as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
11
|
-
ru:
|
|
12
|
-
en:
|
|
13
|
-
es:
|
|
14
|
-
},
|
|
1
|
+
import { jsxs as w, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as m, useMemo as N } from "react";
|
|
3
|
+
import { Tick02Icon as P, ArrowDown01Icon as j } from "@hugeicons/core-free-icons";
|
|
4
|
+
import { HugeiconsIcon as f } from "@hugeicons/react";
|
|
5
|
+
import { Group as y, Image as u, Select as z } from "@mantine/core";
|
|
6
|
+
import C from "../../assets/svg/flags/es.svg.js";
|
|
7
|
+
import D from "../../assets/svg/flags/ru.svg.js";
|
|
8
|
+
import M from "../../assets/svg/flags/us.svg.js";
|
|
9
|
+
import s from "./LanguagePicker.module.css.js";
|
|
10
|
+
const O = {
|
|
11
|
+
ru: D,
|
|
12
|
+
en: M,
|
|
13
|
+
es: C
|
|
14
|
+
}, A = [
|
|
15
15
|
{ value: "en", label: "English" },
|
|
16
16
|
{ value: "ru", label: "Русский" },
|
|
17
17
|
{ value: "es", label: "Español (España)" }
|
|
18
|
-
],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className: l.tickIcon
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
] }), A = ({
|
|
34
|
-
value: e,
|
|
35
|
-
onChange: a,
|
|
36
|
-
label: c
|
|
18
|
+
], B = ({
|
|
19
|
+
value: a,
|
|
20
|
+
onChange: t,
|
|
21
|
+
label: g,
|
|
22
|
+
data: p,
|
|
23
|
+
flagMap: d,
|
|
24
|
+
size: b,
|
|
25
|
+
radius: v,
|
|
26
|
+
variant: x,
|
|
27
|
+
disabled: h,
|
|
28
|
+
searchable: k,
|
|
29
|
+
withinPortal: F
|
|
37
30
|
}) => {
|
|
38
|
-
const
|
|
31
|
+
const l = p ?? A, r = d ?? O, I = m(
|
|
32
|
+
({ option: e, checked: S }) => /* @__PURE__ */ w(y, { flex: "1", gap: "xs", children: [
|
|
33
|
+
r[e.value] && /* @__PURE__ */ o(u, { src: r[e.value], className: s.image }),
|
|
34
|
+
e.label,
|
|
35
|
+
S && /* @__PURE__ */ o(
|
|
36
|
+
f,
|
|
37
|
+
{
|
|
38
|
+
color: "var(--mantine-primary-color-filled)",
|
|
39
|
+
size: 16,
|
|
40
|
+
icon: P,
|
|
41
|
+
className: s.tickIcon
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] }),
|
|
45
|
+
[r]
|
|
46
|
+
), c = l[0]?.value ?? a, n = N(
|
|
47
|
+
() => l.find((e) => e.value === a) ? a : c,
|
|
48
|
+
[a, l, c]
|
|
49
|
+
), E = m(
|
|
50
|
+
(e) => {
|
|
51
|
+
e && t(e);
|
|
52
|
+
},
|
|
53
|
+
[t]
|
|
54
|
+
), i = r[n];
|
|
39
55
|
return /* @__PURE__ */ o(
|
|
40
|
-
|
|
56
|
+
z,
|
|
41
57
|
{
|
|
42
|
-
label:
|
|
58
|
+
label: g,
|
|
43
59
|
flex: 1,
|
|
44
|
-
onChange:
|
|
45
|
-
leftSection: /* @__PURE__ */ o(
|
|
46
|
-
value:
|
|
47
|
-
data:
|
|
48
|
-
rightSection: /* @__PURE__ */ o(
|
|
49
|
-
renderOption:
|
|
60
|
+
onChange: E,
|
|
61
|
+
leftSection: i ? /* @__PURE__ */ o(u, { src: i, className: s.image }) : void 0,
|
|
62
|
+
value: n,
|
|
63
|
+
data: l,
|
|
64
|
+
rightSection: /* @__PURE__ */ o(f, { size: 16, icon: j }),
|
|
65
|
+
renderOption: I,
|
|
66
|
+
size: b,
|
|
67
|
+
radius: v,
|
|
68
|
+
variant: x,
|
|
69
|
+
disabled: h,
|
|
70
|
+
searchable: k,
|
|
71
|
+
comboboxProps: F ? { withinPortal: !0 } : void 0
|
|
50
72
|
}
|
|
51
73
|
);
|
|
52
74
|
};
|
|
53
75
|
export {
|
|
54
|
-
|
|
76
|
+
B as LanguagePicker
|
|
55
77
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type OnboardingTourController } from '@
|
|
1
|
+
import { type OnboardingTourController } from '@layers-app/onboarding-tour';
|
|
2
2
|
export declare const DefaultSingleFooter: ({ controller, label, }: {
|
|
3
3
|
controller: OnboardingTourController;
|
|
4
4
|
label: string;
|
|
@@ -12,6 +12,11 @@ export declare const DefaultMultiFooter: ({ controller, stepIndex, totalSteps, l
|
|
|
12
12
|
back: string;
|
|
13
13
|
next: string;
|
|
14
14
|
done: string;
|
|
15
|
+
continue?: string;
|
|
15
16
|
};
|
|
16
17
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const DefaultTourHeader: ({ controller, title, }: {
|
|
19
|
+
controller: OnboardingTourController;
|
|
20
|
+
title: React.ReactNode;
|
|
21
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
22
|
//# sourceMappingURL=OnboardingTourFooter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingTourFooter.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"OnboardingTourFooter.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAI5E,eAAO,MAAM,mBAAmB,GAAI,wBAGjC;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf,4CAMA,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,gDAKhC;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,4CAiCA,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,wBAG/B;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,4CAaA,CAAC"}
|
|
@@ -1,40 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Group as r, Button as s, Text as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { Group as r, Button as s, Text as p, ActionIcon as d } from "@mantine/core";
|
|
3
|
+
import { IconX as f } from "@tabler/icons-react";
|
|
4
|
+
const g = ({
|
|
5
|
+
controller: i,
|
|
6
|
+
label: t
|
|
7
|
+
}) => /* @__PURE__ */ e(r, { justify: "flex-end", children: /* @__PURE__ */ e(s, { size: "sm", onClick: () => i.endTour(), children: t }) }), k = ({
|
|
8
|
+
controller: i,
|
|
9
|
+
stepIndex: t,
|
|
10
|
+
totalSteps: u,
|
|
10
11
|
labels: n
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
!
|
|
13
|
+
const c = t === 0, a = t === u - 1, l = c && n.continue ? n.continue : n.next;
|
|
14
|
+
return /* @__PURE__ */ o(r, { justify: "space-between", children: [
|
|
15
|
+
/* @__PURE__ */ e(p, { size: "sm", c: "gray.5", children: n.stepOf }),
|
|
16
|
+
/* @__PURE__ */ o(r, { gap: "xs", children: [
|
|
17
|
+
!c && /* @__PURE__ */ e(
|
|
17
18
|
s,
|
|
18
19
|
{
|
|
19
20
|
variant: "subtle",
|
|
20
21
|
color: "gray.5",
|
|
21
22
|
size: "sm",
|
|
22
|
-
onClick: () =>
|
|
23
|
+
onClick: () => i.prevStep(),
|
|
23
24
|
children: n.back
|
|
24
25
|
}
|
|
25
26
|
),
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ e(
|
|
27
28
|
s,
|
|
28
29
|
{
|
|
29
30
|
size: "sm",
|
|
30
|
-
onClick: () =>
|
|
31
|
-
children:
|
|
31
|
+
onClick: () => a ? i.endTour() : i.nextStep(),
|
|
32
|
+
children: a ? n.done : l
|
|
32
33
|
}
|
|
33
34
|
)
|
|
34
35
|
] })
|
|
35
36
|
] });
|
|
36
|
-
}
|
|
37
|
+
}, y = ({
|
|
38
|
+
controller: i,
|
|
39
|
+
title: t
|
|
40
|
+
}) => /* @__PURE__ */ o(r, { justify: "space-between", align: "flex-start", gap: "xs", wrap: "nowrap", children: [
|
|
41
|
+
/* @__PURE__ */ e("div", { style: { flex: 1 }, children: t }),
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
d,
|
|
44
|
+
{
|
|
45
|
+
variant: "subtle",
|
|
46
|
+
color: "gray",
|
|
47
|
+
size: "sm",
|
|
48
|
+
onClick: () => i.skipTour(),
|
|
49
|
+
"aria-label": "Skip tour",
|
|
50
|
+
children: /* @__PURE__ */ e(f, { size: 16 })
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
37
54
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
k as DefaultMultiFooter,
|
|
56
|
+
g as DefaultSingleFooter,
|
|
57
|
+
y as DefaultTourHeader
|
|
40
58
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import { type OnboardingTourProps, type OnboardingTourStep } from '@
|
|
3
|
-
import './OnboardingTourWrapper.css';
|
|
1
|
+
import { type MutableRefObject, type ReactNode } from 'react';
|
|
2
|
+
import { type OnboardingTourController, type OnboardingTourProps, type OnboardingTourStep } from '@layers-app/onboarding-tour';
|
|
4
3
|
export interface OnboardingTourWrapperProps extends Partial<Omit<OnboardingTourProps, 'tour' | 'started' | 'children'>> {
|
|
5
4
|
featureKey: string;
|
|
6
5
|
tour: OnboardingTourStep[];
|
|
7
6
|
children: ReactNode;
|
|
8
7
|
onComplete?: () => void;
|
|
9
8
|
dependsOn?: string;
|
|
10
|
-
|
|
9
|
+
controllerRef?: MutableRefObject<OnboardingTourController | null>;
|
|
11
10
|
}
|
|
12
|
-
export declare const OnboardingTourWrapper: ({ featureKey, tour, children, onComplete, dependsOn,
|
|
11
|
+
export declare const OnboardingTourWrapper: ({ featureKey, tour, children, onComplete, dependsOn, controllerRef, classNames, focusRevealProps: externalFocusRevealProps, onOnboardingTourEnd: externalOnEnd, onOnboardingTourSkip: externalOnClose, onOnboardingTourChange: externalOnChange, onOnboardingTourStart: externalOnStart, ...rest }: OnboardingTourWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
//# sourceMappingURL=OnboardingTourWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingTourWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"OnboardingTourWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAcrC,MAAM,WAAW,0BACf,SAAQ,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,gBAAgB,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;CACnE;AA4BD,eAAO,MAAM,qBAAqB,GAAI,oSAcnC,0BAA0B,4CA4J5B,CAAC"}
|
|
@@ -1,160 +1,128 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { OnboardingTour as
|
|
5
|
-
import { Text as
|
|
6
|
-
import { DefaultSingleFooter as
|
|
7
|
-
import { useOnboardingTour as
|
|
8
|
-
/*
|
|
9
|
-
|
|
10
|
-
featureKey: n,
|
|
1
|
+
import { jsx as a, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as b, useCallback as m } from "react";
|
|
3
|
+
import { useTranslation as F } from "react-i18next";
|
|
4
|
+
import { OnboardingTour as M } from "@layers-app/onboarding-tour";
|
|
5
|
+
import { Text as v } from "@mantine/core";
|
|
6
|
+
import { DefaultSingleFooter as H, DefaultMultiFooter as N, DefaultTourHeader as W } from "./OnboardingTourFooter.js";
|
|
7
|
+
import { useOnboardingTour as q, getSavedStepIndex as A, saveStepIndex as G } from "./useOnboardingTour.js";
|
|
8
|
+
const J = (o) => typeof o == "string" ? /* @__PURE__ */ a(v, { fw: 500, size: "md", c: "white", mb: 4, children: o }) : o, L = (o) => typeof o == "string" ? /* @__PURE__ */ a(v, { size: "sm", c: "gray.3", children: o }) : o, $ = ({
|
|
9
|
+
featureKey: o,
|
|
11
10
|
tour: d,
|
|
12
|
-
children:
|
|
13
|
-
onComplete:
|
|
14
|
-
dependsOn:
|
|
15
|
-
|
|
16
|
-
classNames:
|
|
17
|
-
focusRevealProps:
|
|
18
|
-
onOnboardingTourEnd:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
children: l,
|
|
12
|
+
onComplete: p,
|
|
13
|
+
dependsOn: k,
|
|
14
|
+
controllerRef: s,
|
|
15
|
+
classNames: x = {},
|
|
16
|
+
focusRevealProps: c,
|
|
17
|
+
onOnboardingTourEnd: T,
|
|
18
|
+
onOnboardingTourSkip: S,
|
|
19
|
+
onOnboardingTourChange: h,
|
|
20
|
+
onOnboardingTourStart: O,
|
|
21
|
+
...I
|
|
22
22
|
}) => {
|
|
23
|
-
const { t:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
23
|
+
const { t: e } = F("pages"), { started: P, complete: u } = q(o, { dependsOn: k }), y = b(
|
|
24
|
+
() => A(o),
|
|
25
|
+
[o]
|
|
26
|
+
), B = m(
|
|
27
|
+
(n) => {
|
|
28
|
+
const i = d.findIndex((r) => r.id === n.id);
|
|
29
|
+
i >= 0 && G(o, i), h?.(n);
|
|
30
|
+
},
|
|
31
|
+
[o, d, h]
|
|
32
|
+
), C = m(() => {
|
|
33
|
+
u(), p?.(), T?.();
|
|
34
|
+
}, [u, p, T]), D = m(() => {
|
|
35
|
+
u(), p?.(), S?.();
|
|
36
|
+
}, [u, p, S]), j = b(() => {
|
|
37
|
+
const n = d.length, i = n === 1;
|
|
38
|
+
return d.map((r, w) => {
|
|
39
|
+
const g = J(r.title), f = {
|
|
29
40
|
...r,
|
|
30
|
-
title:
|
|
31
|
-
|
|
41
|
+
title: void 0,
|
|
42
|
+
header: (t) => /* @__PURE__ */ a(
|
|
43
|
+
W,
|
|
44
|
+
{
|
|
45
|
+
controller: t,
|
|
46
|
+
title: typeof g == "function" ? g(t) : g
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
content: L(r.content)
|
|
32
50
|
};
|
|
33
|
-
return r.footer === void 0 && (
|
|
34
|
-
|
|
51
|
+
return r.footer === void 0 && (i ? f.footer = (t) => (s && (s.current = t), /* @__PURE__ */ a(
|
|
52
|
+
H,
|
|
35
53
|
{
|
|
36
|
-
controller:
|
|
37
|
-
label:
|
|
54
|
+
controller: t,
|
|
55
|
+
label: e("onboarding.continue")
|
|
38
56
|
}
|
|
39
|
-
) :
|
|
40
|
-
|
|
57
|
+
)) : f.footer = (t) => (s && (s.current = t), /* @__PURE__ */ a(
|
|
58
|
+
N,
|
|
41
59
|
{
|
|
42
|
-
controller:
|
|
43
|
-
stepIndex:
|
|
44
|
-
totalSteps:
|
|
60
|
+
controller: t,
|
|
61
|
+
stepIndex: w,
|
|
62
|
+
totalSteps: n,
|
|
45
63
|
labels: {
|
|
46
|
-
stepOf:
|
|
47
|
-
current:
|
|
48
|
-
total:
|
|
64
|
+
stepOf: e("onboarding.stepOf", {
|
|
65
|
+
current: w + 1,
|
|
66
|
+
total: n
|
|
49
67
|
}),
|
|
50
|
-
back:
|
|
51
|
-
next:
|
|
52
|
-
done:
|
|
68
|
+
back: e("onboarding.back"),
|
|
69
|
+
next: e("onboarding.next"),
|
|
70
|
+
done: e("onboarding.done"),
|
|
71
|
+
continue: e("onboarding.continue")
|
|
53
72
|
}
|
|
54
73
|
}
|
|
55
|
-
)),
|
|
74
|
+
))), f;
|
|
56
75
|
});
|
|
57
|
-
}, [d,
|
|
58
|
-
const
|
|
76
|
+
}, [d, e, s]), z = b(() => {
|
|
77
|
+
const n = typeof c == "object" ? c : void 0, i = n?.popoverProps ?? {}, r = i.styles ?? {};
|
|
59
78
|
return {
|
|
60
|
-
...
|
|
61
|
-
disableTargetInteraction:
|
|
62
|
-
overlayProps: {
|
|
63
|
-
blur: 0,
|
|
64
|
-
...e?.overlayProps
|
|
65
|
-
},
|
|
79
|
+
...n,
|
|
80
|
+
disableTargetInteraction: n?.disableTargetInteraction ?? !0,
|
|
66
81
|
popoverProps: {
|
|
67
82
|
position: "bottom",
|
|
68
83
|
offset: 10,
|
|
69
|
-
|
|
70
|
-
duration: 0,
|
|
71
|
-
...o.transitionProps ?? {}
|
|
72
|
-
},
|
|
73
|
-
...o,
|
|
74
|
-
classNames: {
|
|
75
|
-
...r,
|
|
76
|
-
dropdown: a
|
|
77
|
-
},
|
|
84
|
+
...i,
|
|
78
85
|
styles: {
|
|
79
|
-
...
|
|
86
|
+
...r,
|
|
80
87
|
dropdown: {
|
|
81
88
|
backgroundColor: "var(--mantine-color-dark-7)",
|
|
82
89
|
padding: 16,
|
|
83
90
|
color: "white",
|
|
84
91
|
border: "none",
|
|
85
92
|
width: 300,
|
|
86
|
-
...
|
|
93
|
+
...r.dropdown
|
|
87
94
|
},
|
|
88
95
|
arrow: {
|
|
89
96
|
backgroundColor: "var(--mantine-color-dark-7)",
|
|
90
97
|
border: "none",
|
|
91
|
-
...
|
|
98
|
+
...r.arrow
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
};
|
|
96
|
-
}, [
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
let e = 0;
|
|
100
|
-
const o = document.createElement("style");
|
|
101
|
-
o.setAttribute("data-onboarding-tour-popover-animation", "true"), o.textContent = `.${v}:not([${h}]) { opacity: 0 !important; pointer-events: none !important; }`, document.head.appendChild(o);
|
|
102
|
-
const r = (t) => {
|
|
103
|
-
t.removeAttribute(h), t.style.removeProperty("position"), t.style.removeProperty("top"), t.style.removeProperty("left"), t.style.removeProperty("width"), t.style.removeProperty("transform"), t.style.removeProperty("opacity"), t.style.removeProperty("pointer-events"), t.style.removeProperty("will-change"), t.style.removeProperty("transition");
|
|
104
|
-
}, s = (t) => {
|
|
105
|
-
const i = t.getBoundingClientRect();
|
|
106
|
-
if (i.width === 0 || i.height === 0) return;
|
|
107
|
-
const g = i.top, y = i.left, _ = m.current?.top ?? g, j = m.current?.left ?? y;
|
|
108
|
-
c.current && c.current !== t && r(c.current), c.current = t, t.setAttribute(h, "true"), Object.assign(t.style, {
|
|
109
|
-
position: "fixed",
|
|
110
|
-
top: `${_}px`,
|
|
111
|
-
left: `${j}px`,
|
|
112
|
-
width: `${i.width}px`,
|
|
113
|
-
transform: "none",
|
|
114
|
-
opacity: "1",
|
|
115
|
-
pointerEvents: "auto",
|
|
116
|
-
willChange: "top, left",
|
|
117
|
-
transition: "top 260ms cubic-bezier(0.2, 0, 0, 1), left 260ms cubic-bezier(0.2, 0, 0, 1)"
|
|
118
|
-
}), requestAnimationFrame(() => {
|
|
119
|
-
t.isConnected && (t.style.top = `${g}px`, t.style.left = `${y}px`);
|
|
120
|
-
}), m.current = { top: g, left: y };
|
|
121
|
-
}, a = () => {
|
|
122
|
-
const t = Array.from(
|
|
123
|
-
document.querySelectorAll(`.${v}`)
|
|
124
|
-
), i = t[t.length - 1];
|
|
125
|
-
i && s(i);
|
|
126
|
-
}, p = new MutationObserver(() => {
|
|
127
|
-
cancelAnimationFrame(e), e = requestAnimationFrame(a);
|
|
128
|
-
});
|
|
129
|
-
return a(), p.observe(document.body, { childList: !0, subtree: !0 }), () => {
|
|
130
|
-
p.disconnect(), cancelAnimationFrame(e), o.remove(), c.current && (r(c.current), c.current = null), m.current = null;
|
|
131
|
-
};
|
|
132
|
-
}, [b, T]), d.length === 0 ? /* @__PURE__ */ u(z, { children: w }) : /* @__PURE__ */ u(
|
|
133
|
-
W,
|
|
103
|
+
}, [c]);
|
|
104
|
+
return d.length === 0 ? /* @__PURE__ */ a(E, { children: l }) : /* @__PURE__ */ a(
|
|
105
|
+
M,
|
|
134
106
|
{
|
|
135
|
-
tour:
|
|
136
|
-
started:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
onOnboardingTourEnd: E,
|
|
107
|
+
tour: j,
|
|
108
|
+
started: P,
|
|
109
|
+
initialStepIndex: y,
|
|
110
|
+
onOnboardingTourStart: O,
|
|
111
|
+
onOnboardingTourChange: B,
|
|
112
|
+
onOnboardingTourEnd: C,
|
|
113
|
+
onOnboardingTourSkip: D,
|
|
144
114
|
withPrevButton: !1,
|
|
145
115
|
withNextButton: !1,
|
|
146
116
|
withSkipButton: !1,
|
|
147
117
|
withStepper: !1,
|
|
148
118
|
maw: 300,
|
|
149
|
-
classNames:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
...$,
|
|
154
|
-
children: w
|
|
119
|
+
classNames: x,
|
|
120
|
+
focusRevealProps: z,
|
|
121
|
+
...I,
|
|
122
|
+
children: l
|
|
155
123
|
}
|
|
156
124
|
);
|
|
157
125
|
};
|
|
158
126
|
export {
|
|
159
|
-
|
|
127
|
+
$ as OnboardingTourWrapper
|
|
160
128
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { OnboardingTourWrapper } from './OnboardingTourWrapper';
|
|
2
2
|
export type { OnboardingTourWrapperProps } from './OnboardingTourWrapper';
|
|
3
|
-
export { useOnboardingTour, isOnboardingCompleted, resetOnboarding, } from './useOnboardingTour';
|
|
3
|
+
export { useOnboardingTour, isOnboardingCompleted, resetOnboarding, getSavedStepIndex, saveStepIndex, clearSavedStep, setOnboardingUserId, } from './useOnboardingTour';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export declare const setOnboardingUserId: (userId: string | null) => void;
|
|
1
2
|
export declare const isOnboardingCompleted: (featureKey: string) => boolean;
|
|
2
3
|
export declare const resetOnboarding: (featureKey: string) => void;
|
|
4
|
+
export declare const getSavedStepIndex: (featureKey: string) => number | undefined;
|
|
5
|
+
export declare const saveStepIndex: (featureKey: string, stepIndex: number) => void;
|
|
6
|
+
export declare const clearSavedStep: (featureKey: string) => void;
|
|
3
7
|
interface UseOnboardingTourOptions {
|
|
4
8
|
dependsOn?: string;
|
|
5
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnboardingTour.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/useOnboardingTour.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOnboardingTour.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/useOnboardingTour.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,GAAG,IAAI,KAAG,IAE3D,CAAC;AA4CF,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,KAAG,OAE1D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,KAAG,IAUpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,KAAG,MAAM,GAAG,SAI/D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,MAAM,EAAE,WAAW,MAAM,KAAG,IAIrE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,KAAG,IAInD,CAAC;AAEF,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,GAC5B,YAAY,MAAM,EAClB,UAAU,wBAAwB,KACjC,uBAyDF,CAAC"}
|
|
@@ -1,50 +1,79 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
1
|
+
import { useState as O, useEffect as M, useCallback as b } from "react";
|
|
2
|
+
const m = "onboarding-completed", u = "onboarding-step", E = "onboarding-completed", S = "onboarding-reset";
|
|
3
|
+
let o = null;
|
|
4
|
+
const R = (t) => {
|
|
5
|
+
o = t;
|
|
6
|
+
}, d = (t) => {
|
|
3
7
|
try {
|
|
4
|
-
return JSON.parse(localStorage.getItem(
|
|
8
|
+
return JSON.parse(localStorage.getItem(t) || "{}");
|
|
5
9
|
} catch {
|
|
6
10
|
return {};
|
|
7
11
|
}
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
}, g = () => o ? d(m)[o] ?? {} : {}, I = (t) => {
|
|
13
|
+
if (o)
|
|
14
|
+
try {
|
|
15
|
+
const e = d(m);
|
|
16
|
+
e[o] = t, localStorage.setItem(m, JSON.stringify(e));
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}, a = () => o ? d(u)[o] ?? {} : {}, w = (t) => {
|
|
20
|
+
if (o)
|
|
21
|
+
try {
|
|
22
|
+
const e = d(u);
|
|
23
|
+
e[o] = t, localStorage.setItem(u, JSON.stringify(e));
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}, c = (t) => !!g()[t], L = (t) => {
|
|
28
|
+
const e = g();
|
|
29
|
+
delete e[t], I(e);
|
|
30
|
+
const n = a();
|
|
31
|
+
delete n[t], w(n), window.dispatchEvent(
|
|
32
|
+
new CustomEvent(S, { detail: t })
|
|
17
33
|
);
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
}, f = (t) => {
|
|
35
|
+
const n = a()[t];
|
|
36
|
+
return typeof n == "number" ? n : void 0;
|
|
37
|
+
}, A = (t, e) => {
|
|
38
|
+
const n = a();
|
|
39
|
+
n[t] = e, w(n);
|
|
40
|
+
}, _ = (t) => {
|
|
41
|
+
const e = a();
|
|
42
|
+
delete e[t], w(e);
|
|
43
|
+
}, G = (t, e) => {
|
|
44
|
+
const { dependsOn: n } = e ?? {}, [i, v] = O(
|
|
45
|
+
() => c(t)
|
|
46
|
+
), [p, r] = O(
|
|
47
|
+
() => !c(t) && (n ? c(n) : !0)
|
|
23
48
|
);
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
|
|
49
|
+
M(() => {
|
|
50
|
+
if (i || !n || p) return;
|
|
51
|
+
const s = (l) => {
|
|
52
|
+
l.detail === n && !c(t) && r(!0);
|
|
28
53
|
};
|
|
29
|
-
return window.addEventListener(
|
|
30
|
-
}, [n,
|
|
31
|
-
const
|
|
32
|
-
|
|
54
|
+
return window.addEventListener(E, s), () => window.removeEventListener(E, s);
|
|
55
|
+
}, [n, i, p, t]), M(() => {
|
|
56
|
+
const s = (l) => {
|
|
57
|
+
l.detail === t && (v(!1), r(!0));
|
|
33
58
|
};
|
|
34
|
-
return window.addEventListener(
|
|
59
|
+
return window.addEventListener(S, s), () => window.removeEventListener(S, s);
|
|
35
60
|
}, [t]);
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
new CustomEvent(
|
|
61
|
+
const N = b(() => {
|
|
62
|
+
const s = g();
|
|
63
|
+
s[t] = !0, I(s), _(t), v(!0), r(!1), window.dispatchEvent(
|
|
64
|
+
new CustomEvent(E, { detail: t })
|
|
40
65
|
);
|
|
41
|
-
}, [t]), C =
|
|
42
|
-
|
|
66
|
+
}, [t]), C = b(() => {
|
|
67
|
+
r(!0);
|
|
43
68
|
}, []);
|
|
44
|
-
return { started:
|
|
69
|
+
return { started: p, completed: i, start: C, complete: N };
|
|
45
70
|
};
|
|
46
71
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
_ as clearSavedStep,
|
|
73
|
+
f as getSavedStepIndex,
|
|
74
|
+
c as isOnboardingCompleted,
|
|
75
|
+
L as resetOnboarding,
|
|
76
|
+
A as saveStepIndex,
|
|
77
|
+
R as setOnboardingUserId,
|
|
78
|
+
G as useOnboardingTour
|
|
50
79
|
};
|