triafly-ui-kit 1.0.23 → 1.0.25
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/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/_virtual/index2.js +7 -0
- package/dist/_virtual/index3.js +4 -0
- package/dist/_virtual/papaparse.min.js +7 -0
- package/dist/_virtual/papaparse.min2.js +4 -0
- package/dist/_virtual/react-paginate.js +7 -0
- package/dist/_virtual/react-paginate2.js +4 -0
- package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
- package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
- package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
- package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
- package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
- package/dist/assets/src/components/Ui/Accordeon/Accordeon.css +1 -0
- package/dist/assets/src/components/Ui/Alert/Alert.css +1 -0
- package/dist/assets/src/components/Ui/Avatar/Avatar.css +1 -0
- package/dist/assets/src/components/Ui/Badge/Badge.module.css +1 -0
- package/dist/assets/src/components/Ui/Button/Button.css +1 -0
- package/dist/assets/src/components/Ui/ButtonsArray/ButtonsArray.css +1 -0
- package/dist/assets/src/components/Ui/Checkbox/Checkbox.css +1 -0
- package/dist/assets/src/components/Ui/CliTextareaInput/CliTextareaInput.css +1 -0
- package/dist/assets/src/components/Ui/CustomLink/CustomLink.css +1 -0
- package/dist/assets/src/components/Ui/DatePicker/DatePicker.css +1 -0
- package/dist/assets/src/components/Ui/DropdownInput/DropdownInput.css +1 -0
- package/dist/assets/src/components/Ui/DropdownMenu/DropdownMenu.css +1 -0
- package/dist/assets/src/components/Ui/FileUpload/FileUpload.css +1 -0
- package/dist/assets/src/components/Ui/Form/FormRoot/Form.css +1 -0
- package/dist/assets/src/components/Ui/Loader/Loader.css +1 -0
- package/dist/assets/src/components/Ui/ModalWindow/ModalWindow.css +1 -0
- package/dist/assets/src/components/Ui/Pagination/Pagination.css +1 -0
- package/dist/assets/src/components/Ui/Radio/Radio.css +1 -0
- package/dist/assets/src/components/Ui/SearchInput/SearchInput.css +1 -0
- package/dist/assets/src/components/Ui/Skeleton/Skeleton.module.css +1 -0
- package/dist/assets/src/components/Ui/Switch/Switch.css +1 -0
- package/dist/assets/src/components/Ui/Table/Table.css +1 -0
- package/dist/assets/src/components/Ui/Tabs/Tabs.css +1 -0
- package/dist/assets/src/components/Ui/TextInput/TextInput.css +1 -0
- package/dist/assets/src/components/Ui/TextareaInput/TextareaInput.css +1 -0
- package/dist/assets/src/components/Ui/Tooltip/Tooltip.css +1 -0
- package/dist/assets/src/components/Ui/Tooltip/Tooltip.stories.module.css +1 -0
- package/dist/assets/src/context/ToastContext/ToastContext.module.css +1 -0
- package/dist/components/Ui/Accordeon/Accordeon.js +34 -0
- package/dist/components/Ui/Accordeon/Accordeon.stories.js +72 -0
- package/dist/components/Ui/Accordeon/index.js +4 -0
- package/dist/components/Ui/Alert/Alert.js +15 -0
- package/dist/components/Ui/Alert/index.js +4 -0
- package/dist/components/Ui/Avatar/Avatar.js +11 -0
- package/dist/components/Ui/Avatar/index.js +4 -0
- package/dist/components/Ui/Badge/Badge.js +30 -0
- package/dist/components/Ui/Badge/index.js +4 -0
- package/dist/components/Ui/Button/Button.js +50 -0
- package/dist/components/Ui/Button/index.js +4 -0
- package/dist/components/Ui/ButtonsArray/ButtonsArray.js +29 -0
- package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +78 -0
- package/dist/components/Ui/ButtonsArray/index.js +4 -0
- package/dist/components/Ui/Checkbox/Checkbox.js +40 -0
- package/dist/components/Ui/Checkbox/Checkbox.stories.js +120 -0
- package/dist/components/Ui/Checkbox/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +122 -0
- package/dist/components/Ui/CliTextareaInput/index.js +23 -0
- package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +12 -0
- package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +20 -0
- package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +17 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +29 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +34 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +45 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +5 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +17 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +13 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +37 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +14 -0
- package/dist/components/Ui/CliTextareaInput/utils/index.js +21 -0
- package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +11 -0
- package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +8 -0
- package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +27 -0
- package/dist/components/Ui/CliTextareaInput/utils/types.js +1 -0
- package/dist/components/Ui/CustomLink/CustomLink.js +50 -0
- package/dist/components/Ui/CustomLink/index.js +4 -0
- package/dist/components/Ui/DatePicker/DatePicker.js +183 -0
- package/dist/components/Ui/DatePicker/DatePicker.stories.js +120 -0
- package/dist/components/Ui/DropdownInput/DropdownInput.js +92 -0
- package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +77 -0
- package/dist/components/Ui/DropdownInput/index.js +4 -0
- package/dist/components/Ui/DropdownMenu/DropdownMenu.js +84 -0
- package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +50 -0
- package/dist/components/Ui/DropdownMenu/index.js +4 -0
- package/dist/components/Ui/FileUpload/FileUpload.js +197 -0
- package/dist/components/Ui/FileUpload/fn.js +10 -0
- package/dist/components/Ui/FileUpload/index.js +4 -0
- package/dist/components/Ui/FileUpload/types.js +1 -0
- package/dist/components/Ui/Form/FormContext/FormContext.js +5 -0
- package/dist/components/Ui/Form/FormItem/FormItem.js +107 -0
- package/dist/components/Ui/Form/FormItem/fn.js +25 -0
- package/dist/components/Ui/Form/FormItem/types.js +1 -0
- package/dist/components/Ui/Form/FormRoot/FormRoot.js +26 -0
- package/dist/components/Ui/Form/FormRoot/index.js +4 -0
- package/dist/components/Ui/Form/FormRoot/types.js +1 -0
- package/dist/components/Ui/Form/index.js +6 -0
- package/dist/components/Ui/Form/useForm/index.js +4 -0
- package/dist/components/Ui/Form/useForm/useForm.js +111 -0
- package/dist/components/Ui/Form/utils/fn.js +31 -0
- package/dist/components/Ui/Form/utils/types.js +1 -0
- package/dist/components/Ui/Icons/Icons.js +577 -0
- package/dist/components/Ui/Icons/index.js +97 -0
- package/dist/components/Ui/Icons/utils/CreateIcon.js +23 -0
- package/dist/components/Ui/Loader/Loader.js +7 -0
- package/dist/components/Ui/Loader/index.js +4 -0
- package/dist/components/Ui/ModalWindow/ModalWindow.js +51 -0
- package/dist/components/Ui/ModalWindow/index.js +4 -0
- package/dist/components/Ui/Pagination/Pagination.js +39 -0
- package/dist/components/Ui/Pagination/index.js +4 -0
- package/dist/components/Ui/Radio/Radio.js +31 -0
- package/dist/components/Ui/Radio/Radio.stories.js +42 -0
- package/dist/components/Ui/Radio/index.js +4 -0
- package/dist/components/Ui/SearchInput/SearchData.js +30 -0
- package/dist/components/Ui/SearchInput/SearchInput.js +110 -0
- package/dist/components/Ui/Skeleton/Skeleton.js +26 -0
- package/dist/components/Ui/Skeleton/index.js +4 -0
- package/dist/components/Ui/Switch/Switch.js +26 -0
- package/dist/components/Ui/Switch/index.js +4 -0
- package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +50 -0
- package/dist/components/Ui/Table/Table.js +161 -0
- package/dist/components/Ui/Table/TableTypes.js +1 -0
- package/dist/components/Ui/Table/index.js +4 -0
- package/dist/components/Ui/Tabs/Tabs.js +25 -0
- package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
- package/dist/components/Ui/Tabs/index.js +4 -0
- package/dist/components/Ui/TextInput/TextInput.js +86 -0
- package/dist/components/Ui/TextInput/TextInput.stories.js +225 -0
- package/dist/components/Ui/TextInput/index.js +4 -0
- package/dist/components/Ui/TextareaInput/TextareaInput.js +69 -0
- package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +19 -0
- package/dist/components/Ui/TextareaInput/index.js +4 -0
- package/dist/components/Ui/Tooltip/Tooltip.js +93 -0
- package/dist/components/Ui/Tooltip/Tooltip.stories.js +87 -0
- package/dist/components/Ui/Tooltip/index.js +4 -0
- package/dist/context/ToastContext/ToastContext.js +38 -0
- package/dist/context/ToastContext/index.js +5 -0
- package/dist/context/TriaflyContext/TriaflyContext.types.js +1 -0
- package/dist/context/TriaflyContext/TriaflyProvider.js +27 -0
- package/dist/context/TriaflyContext/hooks/index.js +8 -0
- package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +4 -0
- package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +11 -0
- package/dist/context/TriaflyContext/hooks/useModal/index.js +4 -0
- package/dist/context/TriaflyContext/hooks/useModal/useModal.js +16 -0
- package/dist/context/TriaflyContext/hooks/useTheme/index.js +4 -0
- package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +17 -0
- package/dist/context/TriaflyContext/index.js +12 -0
- package/dist/main.d.ts +1229 -0
- package/dist/main.js +162 -0
- package/dist/node_modules/classnames/index.js +42 -0
- package/dist/node_modules/fast-deep-equal/index.js +31 -0
- package/dist/node_modules/papaparse/papaparse.min.js +421 -0
- package/dist/node_modules/react-paginate/dist/react-paginate.js +259 -0
- package/dist/src/components/Ui/Badge/Badge.module.scss.js +30 -0
- package/dist/src/components/Ui/Skeleton/Skeleton.module.scss.js +9 -0
- package/dist/src/components/Ui/Tooltip/Tooltip.stories.module.css.js +15 -0
- package/dist/src/context/ToastContext/ToastContext.module.scss.js +9 -0
- package/dist/styles/_mixins.scss +22 -0
- package/dist/styles/fix.scss +4 -0
- package/dist/styles/main.scss +27 -0
- package/dist/styles/reset.scss +106 -0
- package/dist/styles/typography.scss +102 -0
- package/dist/styles/variables.scss +278 -0
- package/dist/vite-env.d.js +1 -0
- package/package.json +6 -2
- package/src/styles/_mixins.scss +22 -0
- package/src/styles/fix.scss +4 -0
- package/src/styles/main.scss +27 -0
- package/src/styles/reset.scss +106 -0
- package/src/styles/typography.scss +102 -0
- package/src/styles/variables.scss +278 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
import { jsxs as I, jsx as O } from "react/jsx-runtime";
|
2
|
+
import { useState as g, useRef as C, useCallback as u, useEffect as m } from "react";
|
3
|
+
import '../../../assets/src/components/Ui/Tooltip/Tooltip.css';/* empty css */
|
4
|
+
const W = ({
|
5
|
+
content: E,
|
6
|
+
children: y,
|
7
|
+
position: n = "top",
|
8
|
+
trigger: l = "hover",
|
9
|
+
clickBehavior: d = "toggle",
|
10
|
+
className: L = ""
|
11
|
+
}) => {
|
12
|
+
const [o, v] = g(!1), [P, T] = g(n), [k, w] = g(!1), f = C(null), c = C(null), b = u(() => {
|
13
|
+
if (!c.current || !f.current) return n;
|
14
|
+
const e = c.current.getBoundingClientRect(), r = f.current.getBoundingClientRect(), a = {
|
15
|
+
top: {
|
16
|
+
fits: e.top - r.height - 8 > 0,
|
17
|
+
space: e.top
|
18
|
+
},
|
19
|
+
bottom: {
|
20
|
+
fits: window.innerHeight - e.bottom - r.height - 8 > 0,
|
21
|
+
space: window.innerHeight - e.bottom
|
22
|
+
},
|
23
|
+
left: {
|
24
|
+
fits: e.left - r.width - 8 > 0,
|
25
|
+
space: e.left
|
26
|
+
},
|
27
|
+
right: {
|
28
|
+
fits: window.innerWidth - e.right - r.width - 8 > 0,
|
29
|
+
space: window.innerWidth - e.right
|
30
|
+
}
|
31
|
+
};
|
32
|
+
if (a[n].fits) return n;
|
33
|
+
const p = ["top", "right", "bottom", "left"], M = p.indexOf(n);
|
34
|
+
for (let s = 1; s <= p.length; s++) {
|
35
|
+
const h = p[(M + s) % p.length];
|
36
|
+
if (a[h].fits) return h;
|
37
|
+
}
|
38
|
+
return Object.entries(a).reduce(
|
39
|
+
(s, [h, { space: j }]) => j > a[s].space ? h : s,
|
40
|
+
n
|
41
|
+
);
|
42
|
+
}, [n]), i = u(() => {
|
43
|
+
w(!1), v(!0);
|
44
|
+
}, []), t = u(() => {
|
45
|
+
v(!1), w(!1);
|
46
|
+
}, []), R = u(() => {
|
47
|
+
o ? t() : i();
|
48
|
+
}, [o, t, i]), x = u(() => {
|
49
|
+
d === "toggle" ? R() : d === "show" ? i() : d === "hide" && t();
|
50
|
+
}, [d, R, i, t]);
|
51
|
+
return m(() => {
|
52
|
+
o && f.current && (T(b()), w(!0));
|
53
|
+
}, [o, b]), m(() => {
|
54
|
+
if (o) {
|
55
|
+
const e = () => t();
|
56
|
+
return window.addEventListener("scroll", e, !0), () => {
|
57
|
+
window.removeEventListener("scroll", e, !0);
|
58
|
+
};
|
59
|
+
}
|
60
|
+
}, [o, t]), m(() => {
|
61
|
+
if ((l === "click" || l === "mixed") && o) {
|
62
|
+
const e = (r) => {
|
63
|
+
c.current && !c.current.contains(r.target) && t();
|
64
|
+
};
|
65
|
+
return document.addEventListener("mousedown", e), () => {
|
66
|
+
document.removeEventListener("mousedown", e);
|
67
|
+
};
|
68
|
+
}
|
69
|
+
}, [o, l, t]), /* @__PURE__ */ I("div", { className: "tooltip-wrapper", ref: c, ...l === "hover" ? { onMouseEnter: i, onMouseLeave: t } : l === "click" ? { onClick: x } : {
|
70
|
+
onMouseEnter: i,
|
71
|
+
onMouseLeave: t,
|
72
|
+
onClick: x
|
73
|
+
}, children: [
|
74
|
+
y,
|
75
|
+
/* @__PURE__ */ O(
|
76
|
+
"div",
|
77
|
+
{
|
78
|
+
className: `tooltip-content ${L} tooltip-${P}`,
|
79
|
+
ref: f,
|
80
|
+
role: "tooltip",
|
81
|
+
style: {
|
82
|
+
visibility: o ? "visible" : "hidden",
|
83
|
+
opacity: k ? 1 : 0,
|
84
|
+
transition: "opacity 0.15s ease-out"
|
85
|
+
},
|
86
|
+
children: E
|
87
|
+
}
|
88
|
+
)
|
89
|
+
] });
|
90
|
+
};
|
91
|
+
export {
|
92
|
+
W as Tooltip
|
93
|
+
};
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { jsxs as e, jsx as i } from "react/jsx-runtime";
|
2
|
+
import t from "../../../src/components/Ui/Tooltip/Tooltip.stories.module.css.js";
|
3
|
+
import { Tooltip as o } from "./Tooltip.js";
|
4
|
+
const n = {
|
5
|
+
title: "UIKit/Tooltip",
|
6
|
+
component: o,
|
7
|
+
tags: ["autodocs"],
|
8
|
+
argTypes: {
|
9
|
+
position: {
|
10
|
+
control: "select",
|
11
|
+
options: ["top", "bottom", "left", "right"]
|
12
|
+
},
|
13
|
+
trigger: {
|
14
|
+
control: "select",
|
15
|
+
options: ["hover", "click", "mixed"]
|
16
|
+
},
|
17
|
+
clickBehavior: {
|
18
|
+
control: "select",
|
19
|
+
options: ["toggle", "show", "hide"]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}, s = {
|
23
|
+
render: () => /* @__PURE__ */ e("div", { className: t.container, children: [
|
24
|
+
/* @__PURE__ */ i(o, { content: "Top-left tooltip", className: "white", position: "top", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Top-left (hover)" }) }),
|
25
|
+
/* @__PURE__ */ i(o, { content: "Top-right tooltip", position: "top", trigger: "click", clickBehavior: "toggle", children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Top-right (click toggle)" }) }),
|
26
|
+
/* @__PURE__ */ i(o, { content: "Center tooltip", position: "bottom", trigger: "mixed", clickBehavior: "hide", children: /* @__PURE__ */ i("div", { className: t.mixedTrigger, children: "Center (hover + click hide)" }) }),
|
27
|
+
/* @__PURE__ */ i(o, { content: "Bottom-left tooltip", position: "left", trigger: "click", clickBehavior: "show", children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Bottom-left (click show)" }) }),
|
28
|
+
/* @__PURE__ */ i(o, { content: "Bottom-right tooltip", position: "right", trigger: "mixed", clickBehavior: "hide", children: /* @__PURE__ */ i("div", { className: t.mixedTrigger, children: "Bottom-right (hover + click hide)" }) })
|
29
|
+
] })
|
30
|
+
}, h = {
|
31
|
+
render: () => /* @__PURE__ */ e("div", { className: t.positionsContainer, children: [
|
32
|
+
/* @__PURE__ */ i("h3", { children: "Hover Triggers" }),
|
33
|
+
/* @__PURE__ */ e("div", { className: t.positionGroup, children: [
|
34
|
+
/* @__PURE__ */ i(o, { content: "Top tooltip", position: "top", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Top" }) }),
|
35
|
+
/* @__PURE__ */ i(o, { content: "Right tooltip", position: "right", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Right" }) }),
|
36
|
+
/* @__PURE__ */ i(o, { content: "Bottom tooltip", position: "bottom", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Bottom" }) }),
|
37
|
+
/* @__PURE__ */ i(o, { content: "Left tooltip", position: "left", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Left" }) })
|
38
|
+
] }),
|
39
|
+
/* @__PURE__ */ i("h3", { children: "Click Triggers" }),
|
40
|
+
/* @__PURE__ */ e("div", { className: t.positionGroup, children: [
|
41
|
+
/* @__PURE__ */ i(o, { content: "Top tooltip (click toggle)", position: "top", trigger: "click", children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Top (toggle)" }) }),
|
42
|
+
/* @__PURE__ */ i(
|
43
|
+
o,
|
44
|
+
{
|
45
|
+
content: "Right tooltip (click show)",
|
46
|
+
position: "right",
|
47
|
+
trigger: "click",
|
48
|
+
clickBehavior: "show",
|
49
|
+
children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Right (show)" })
|
50
|
+
}
|
51
|
+
),
|
52
|
+
/* @__PURE__ */ i(
|
53
|
+
o,
|
54
|
+
{
|
55
|
+
content: "Bottom tooltip (click hide)",
|
56
|
+
position: "bottom",
|
57
|
+
trigger: "click",
|
58
|
+
clickBehavior: "hide",
|
59
|
+
children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Bottom (hide)" })
|
60
|
+
}
|
61
|
+
),
|
62
|
+
/* @__PURE__ */ i(
|
63
|
+
o,
|
64
|
+
{
|
65
|
+
content: "Left tooltip (mixed)",
|
66
|
+
position: "left",
|
67
|
+
trigger: "mixed",
|
68
|
+
clickBehavior: "hide",
|
69
|
+
children: /* @__PURE__ */ i("div", { className: t.mixedTrigger, children: "Left (hover+click)" })
|
70
|
+
}
|
71
|
+
)
|
72
|
+
] })
|
73
|
+
] })
|
74
|
+
}, g = {
|
75
|
+
args: {
|
76
|
+
content: "Interactive tooltip content",
|
77
|
+
children: /* @__PURE__ */ i("button", { style: { padding: "8px 16px" }, type: "button", children: "Hover or click me" }),
|
78
|
+
position: "top",
|
79
|
+
trigger: "hover"
|
80
|
+
}
|
81
|
+
};
|
82
|
+
export {
|
83
|
+
h as AllPositions,
|
84
|
+
s as EdgeCases,
|
85
|
+
g as InteractiveExample,
|
86
|
+
n as default
|
87
|
+
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { jsxs as v, jsx as d } from "react/jsx-runtime";
|
2
|
+
import { createContext as f, useState as h, useCallback as u, useMemo as w, useContext as C } from "react";
|
3
|
+
import P from "react-dom";
|
4
|
+
import m from "../../src/context/ToastContext/ToastContext.module.scss.js";
|
5
|
+
const l = f(void 0), y = () => {
|
6
|
+
const e = C(l);
|
7
|
+
if (!e)
|
8
|
+
throw new Error("useToast must be used within a ToastProvider");
|
9
|
+
return e;
|
10
|
+
}, M = ({ children: e }) => {
|
11
|
+
const [T, a] = h([]), p = 3, n = 4e3, c = u((t) => {
|
12
|
+
a((o) => o.filter((s) => s.id !== t));
|
13
|
+
}, []), i = u(
|
14
|
+
(t) => {
|
15
|
+
const o = {
|
16
|
+
id: Date.now(),
|
17
|
+
message: t,
|
18
|
+
duration: n
|
19
|
+
};
|
20
|
+
a((s) => {
|
21
|
+
const r = [...s, o];
|
22
|
+
return r.length > p ? r.slice(1) : r;
|
23
|
+
}), setTimeout(() => c(o.id), n);
|
24
|
+
},
|
25
|
+
[c]
|
26
|
+
), x = w(() => ({ addToast: i }), [i]);
|
27
|
+
return /* @__PURE__ */ v(l.Provider, { value: x, children: [
|
28
|
+
e,
|
29
|
+
P.createPortal(
|
30
|
+
/* @__PURE__ */ d("div", { className: m.Wrapper, children: T.map((t) => /* @__PURE__ */ d("div", { className: m.Toast, children: t.message }, t.id)) }),
|
31
|
+
document.body
|
32
|
+
)
|
33
|
+
] });
|
34
|
+
};
|
35
|
+
export {
|
36
|
+
M as ToastProvider,
|
37
|
+
y as useToast
|
38
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
2
|
+
import { createContext as s, useMemo as m, useContext as a } from "react";
|
3
|
+
import { useBreakpointValueTriafly as u } from "./hooks/useBreakpointValue/useBreakpointValue.js";
|
4
|
+
import { useThemeLogic as f } from "./hooks/useTheme/useTheme.js";
|
5
|
+
import { useModalState as l } from "./hooks/useModal/useModal.js";
|
6
|
+
const t = s(void 0), y = () => {
|
7
|
+
const e = a(t);
|
8
|
+
if (!e)
|
9
|
+
throw new Error("useTriafly must be used within a TriaflyProvider");
|
10
|
+
return e;
|
11
|
+
}, h = ({ children: e }) => {
|
12
|
+
const { theme: o, toggleTheme: r } = f(), i = m(
|
13
|
+
() => ({
|
14
|
+
theme: o,
|
15
|
+
toggleTheme: r,
|
16
|
+
useBreakpointValueTriafly: u,
|
17
|
+
useModalState: l
|
18
|
+
}),
|
19
|
+
[o, r]
|
20
|
+
);
|
21
|
+
return /* @__PURE__ */ n(t.Provider, { value: i, children: e });
|
22
|
+
};
|
23
|
+
export {
|
24
|
+
t as TriaflyContext,
|
25
|
+
h as TriaflyProvider,
|
26
|
+
y as useTriafly
|
27
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { useBreakpointValueTriafly as r } from "./useBreakpointValue/useBreakpointValue.js";
|
2
|
+
import { useThemeLogic as a } from "./useTheme/useTheme.js";
|
3
|
+
import { useModalState as m } from "./useModal/useModal.js";
|
4
|
+
export {
|
5
|
+
r as useBreakpointValueTriafly,
|
6
|
+
m as useModalState,
|
7
|
+
a as useThemeLogic
|
8
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { useState as t, useEffect as d } from "react";
|
2
|
+
const w = (i) => {
|
3
|
+
const [n, r] = t(window.innerWidth);
|
4
|
+
return d(() => {
|
5
|
+
const e = () => r(window.innerWidth);
|
6
|
+
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
7
|
+
}, []), n >= 1280 && i.xl !== void 0 ? i.xl : n >= 1024 && i.lg !== void 0 ? i.lg : n >= 768 && i.md !== void 0 ? i.md : n >= 480 && i.sm !== void 0 ? i.sm : i.base !== void 0 ? i.base : null;
|
8
|
+
};
|
9
|
+
export {
|
10
|
+
w as useBreakpointValueTriafly
|
11
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { useState as a, useCallback as s } from "react";
|
2
|
+
const r = () => {
|
3
|
+
const [t, e] = a(!1), o = s(() => {
|
4
|
+
e(!0);
|
5
|
+
}, []), n = s(() => {
|
6
|
+
e(!1);
|
7
|
+
}, []);
|
8
|
+
return {
|
9
|
+
isOpen: t,
|
10
|
+
onOpen: o,
|
11
|
+
onClose: n
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export {
|
15
|
+
r as useModalState
|
16
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { useSyncExternalStore as n } from "react";
|
2
|
+
const o = () => {
|
3
|
+
const t = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
4
|
+
return localStorage.getItem("theme") || (t ? "dark" : "light");
|
5
|
+
}, m = o();
|
6
|
+
document.documentElement.setAttribute("data-theme", m);
|
7
|
+
const c = () => {
|
8
|
+
const t = n((e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e)), o), r = (e) => {
|
9
|
+
localStorage.setItem("theme", e), localStorage.setItem("chakra-ui-color-mode", e), document.documentElement.setAttribute("data-theme", e), window.dispatchEvent(new Event("storage"));
|
10
|
+
};
|
11
|
+
return { theme: t, toggleTheme: () => {
|
12
|
+
r(t === "light" ? "dark" : "light");
|
13
|
+
} };
|
14
|
+
};
|
15
|
+
export {
|
16
|
+
c as useThemeLogic
|
17
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { TriaflyContext as o, TriaflyProvider as t, useTriafly as a } from "./TriaflyProvider.js";
|
2
|
+
import { useBreakpointValueTriafly as i } from "./hooks/useBreakpointValue/useBreakpointValue.js";
|
3
|
+
import { useThemeLogic as m } from "./hooks/useTheme/useTheme.js";
|
4
|
+
import { useModalState as u } from "./hooks/useModal/useModal.js";
|
5
|
+
export {
|
6
|
+
o as TriaflyContext,
|
7
|
+
t as TriaflyProvider,
|
8
|
+
i as useBreakpointValueTriafly,
|
9
|
+
u as useModalState,
|
10
|
+
m as useThemeLogic,
|
11
|
+
a as useTriafly
|
12
|
+
};
|