xtreme-ui 0.0.123 → 0.0.125
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/ActionCard/exports.js +6 -4
- package/dist/components/Avatar/exports.js +6 -4
- package/dist/components/Button/exports.js +6 -4
- package/dist/components/ColorPicker/exports.js +4 -3
- package/dist/components/ColorPopper/exports.js +4 -3
- package/dist/components/DatePicker/exports.js +6 -4
- package/dist/components/FilePicker/exports.js +6 -4
- package/dist/components/ImageEditor/exports.js +4 -3
- package/dist/components/Navigation/exports.js +4 -3
- package/dist/components/ProgressBar/exports.js +4 -3
- package/dist/components/Select/exports.js +4 -3
- package/dist/components/Sider/exports.js +4 -3
- package/dist/components/SiderModal/exports.js +4 -3
- package/dist/components/Spinner/exports.js +5 -3
- package/dist/components/Textfield/exports.js +4 -3
- package/dist/components/ThemePicker/exports.js +4 -3
- package/dist/components/ThemeSelect/exports.js +4 -3
- package/dist/components/ThemeSwitch/exports.js +4 -3
- package/dist/components/base/ActionCard/ActionCard.js +27 -0
- package/dist/components/base/ActionCard/types.js +4 -0
- package/dist/components/base/Avatar/Avatar.js +33 -0
- package/dist/components/base/Avatar/types.js +4 -0
- package/dist/components/base/Button/Button.js +21 -0
- package/dist/components/base/Button/types.js +4 -0
- package/dist/components/base/ColorPicker/ColorPicker.js +20 -0
- package/dist/components/base/ColorPopper/ColorPopper.js +195 -0
- package/dist/components/base/DatePicker/DatePicker.js +55 -0
- package/dist/components/base/DatePicker/types.js +4 -0
- package/dist/components/base/FilePicker/FilePicker.js +38 -0
- package/dist/components/base/FilePicker/getFilePickerIcon.js +19 -0
- package/dist/components/base/FilePicker/types.js +33 -0
- package/dist/components/base/ProgressBar/ProgressBar.js +13 -0
- package/dist/{Select-N5Uw9cYv.js → components/base/Select/Select.js} +5 -3
- package/dist/components/base/Spinner/Spinner.js +25 -0
- package/dist/components/base/Spinner/types.js +4 -0
- package/dist/{Textfield-DD7cRuMt.js → components/base/Textfield/Textfield.js} +13 -11
- package/dist/components/context/Data/DataContext.js +15 -0
- package/dist/components/context/Theme/ThemeContext.js +40 -0
- package/dist/components/context/Theme/types.js +6 -0
- package/dist/components/context/index.js +8 -0
- package/dist/components/context/useContext.js +8 -0
- package/dist/components/hooks/useDebouncedEffect.js +11 -0
- package/dist/components/hooks/usePersistingState.js +13 -0
- package/dist/components/hooks/useScreen.js +30 -0
- package/dist/components/layout/ImageEditor/ImageEditor.js +59 -0
- package/dist/{Navigation-CZ6ofO5o.js → components/layout/Navigation/Navigation.js} +8 -6
- package/dist/{Sider-WB4MCj13.js → components/layout/Sider/Sider.js} +12 -10
- package/dist/components/layout/Sider/types.js +4 -0
- package/dist/components/layout/SiderModal/SiderModal.js +27 -0
- package/dist/components/layout/ThemePicker/ThemePicker.js +59 -0
- package/dist/components/layout/ThemeSelect/ThemeSelect.js +36 -0
- package/dist/components/layout/ThemeSwitch/ThemeSwitch.js +60 -0
- package/dist/index.js +101 -178
- package/dist/utils/constants/iconCollection.js +109 -0
- package/dist/{theme-ykEJBufR.js → utils/constants/theme.js} +12 -13
- package/dist/{common-JWQuqtVw.js → utils/function/common.js} +1 -1
- package/dist/utils/function/localStorage.js +19 -0
- package/dist/utils/function/mergeRefs.js +19 -0
- package/dist/utils/function/string.js +6 -0
- package/dist/utils/helper/colorHelper.js +21 -0
- package/dist/utils/helper/domHelper.js +36 -0
- package/dist/{imageHelper-VIHg_IWS.js → utils/helper/imageHelper.js} +12 -12
- package/dist/utils/helper/themeController.js +47 -0
- package/package.json +2 -3
- package/dist/ActionCard-B8grjL52.js +0 -26
- package/dist/Avatar-soTst6QB.js +0 -138
- package/dist/Button-8OfYrlfv.js +0 -20
- package/dist/ColorPicker-DTlIMXCI.js +0 -18
- package/dist/ColorPopper-DD-LwyH4.js +0 -208
- package/dist/FilePicker-B0CAFe_F.js +0 -77
- package/dist/ImageEditor-CHAOpQQ3.js +0 -57
- package/dist/ProgressBar-BYsdT_xg.js +0 -11
- package/dist/SiderModal-0iZz0k9s.js +0 -25
- package/dist/Spinner-DvZRWrE7.js +0 -24
- package/dist/ThemePicker-CcMoStgj.js +0 -57
- package/dist/ThemeSelect-vklTxFpw.js +0 -33
- package/dist/ThemeSwitch-DEvhyHpt.js +0 -57
- package/dist/types-BZuGVOZ5.js +0 -55
- package/dist/useContext-J6sc--E9.js +0 -47
- package/dist/useScreen-W3HOVFnS.js +0 -47
- /package/dist/{ActionCard.css → components/base/ActionCard/actionCard.css} +0 -0
- /package/dist/{Avatar.css → components/base/Avatar/avatar.css} +0 -0
- /package/dist/{Button.css → components/base/Button/button.css} +0 -0
- /package/dist/{ColorPicker.css → components/base/ColorPicker/colorPicker.css} +0 -0
- /package/dist/{ColorPopper.css → components/base/ColorPopper/colorPopper.css} +0 -0
- /package/dist/{types.css → components/base/DatePicker/datePicker.css} +0 -0
- /package/dist/{FilePicker.css → components/base/FilePicker/filePicker.css} +0 -0
- /package/dist/{ProgressBar.css → components/base/ProgressBar/progressbar.css} +0 -0
- /package/dist/{Select.css → components/base/Select/select.css} +0 -0
- /package/dist/{Spinner.css → components/base/Spinner/spinner.css} +0 -0
- /package/dist/{Textfield.css → components/base/Textfield/textfield.css} +0 -0
- /package/dist/{ImageEditor.css → components/layout/ImageEditor/imageEditor.css} +0 -0
- /package/dist/{Navigation.css → components/layout/Navigation/navigation.css} +0 -0
- /package/dist/{Sider.css → components/layout/Sider/sider.css} +0 -0
- /package/dist/{SiderModal.css → components/layout/SiderModal/siderModal.css} +0 -0
- /package/dist/{ThemePicker.css → components/layout/ThemePicker/themePicker.css} +0 -0
- /package/dist/{ThemeSelect.css → components/layout/ThemeSelect/themeSelect.css} +0 -0
- /package/dist/{ThemeSwitch.css → components/layout/ThemeSwitch/themeSwitch.css} +0 -0
- /package/dist/{index.css → styles/index.css} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/ActionCard/actionCard.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ActionCard as m } from "../base/ActionCard/ActionCard.js";
|
|
4
|
+
import { EActionCardSize as e } from "../base/ActionCard/types.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
m as ActionCard,
|
|
7
|
+
e as EActionCardSize
|
|
6
8
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/Avatar/avatar.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Avatar as m } from "../base/Avatar/Avatar.js";
|
|
4
|
+
import { EAvatarSize as e } from "../base/Avatar/types.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
m as Avatar,
|
|
7
|
+
e as EAvatarSize
|
|
6
8
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/Button/button.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Button as m } from "../base/Button/Button.js";
|
|
4
|
+
import { EButtonTypes as f } from "../base/Button/types.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
m as Button,
|
|
7
|
+
f as EButtonTypes
|
|
6
8
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/ColorPicker/colorPicker.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ColorPicker as p } from "../base/ColorPicker/ColorPicker.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
p as ColorPicker
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/ColorPopper/colorPopper.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ColorPopper as t } from "../base/ColorPopper/ColorPopper.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
t as ColorPopper
|
|
5
6
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/DatePicker/datePicker.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { DatePicker as p } from "../base/DatePicker/DatePicker.js";
|
|
4
|
+
import { EDatePickerTypes as m } from "../base/DatePicker/types.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
p as DatePicker,
|
|
7
|
+
m as EDatePickerTypes
|
|
6
8
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/FilePicker/filePicker.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { FilePicker as m } from "../base/FilePicker/FilePicker.js";
|
|
4
|
+
import { FilePickerIcon as t } from "../base/FilePicker/types.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
m as FilePicker,
|
|
7
|
+
t as FilePickerIcon
|
|
6
8
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/ImageEditor/imageEditor.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ImageEditor as i } from "../layout/ImageEditor/ImageEditor.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
i as ImageEditor
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/Navigation/navigation.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Navigation as m } from "../layout/Navigation/Navigation.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
m as Navigation
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/ProgressBar/progressbar.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ProgressBar as t } from "../base/ProgressBar/ProgressBar.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
t as ProgressBar
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/Select/select.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Select as m } from "../base/Select/Select.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
m as Select
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/Sider/sider.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Sider as p } from "../layout/Sider/Sider.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
p as Sider
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/SiderModal/siderModal.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { SiderModal as p } from "../layout/SiderModal/SiderModal.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
p as SiderModal
|
|
5
6
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/Spinner/spinner.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Spinner as i } from "../base/Spinner/Spinner.js";
|
|
4
|
+
import { ESpinnerSize as n } from "../base/Spinner/types.js";
|
|
3
5
|
export {
|
|
4
6
|
n as ESpinnerSize,
|
|
5
|
-
|
|
7
|
+
i as Spinner
|
|
6
8
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../base/Textfield/textfield.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Textfield as i } from "../base/Textfield/Textfield.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
i as Textfield
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/ThemePicker/themePicker.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ThemePicker as i } from "../layout/ThemePicker/ThemePicker.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
i as ThemePicker
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/ThemeSelect/themeSelect.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ThemeSelect as t } from "../layout/ThemeSelect/ThemeSelect.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
t as ThemeSelect
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../index.css';/* empty css
|
|
2
|
-
|
|
1
|
+
import '../layout/ThemeSwitch/themeSwitch.css';import '../../styles/index.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { ThemeSwitch as e } from "../layout/ThemeSwitch/ThemeSwitch.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
e as ThemeSwitch
|
|
5
6
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import m from "clsx";
|
|
4
|
+
import { forwardRef as p } from "react";
|
|
5
|
+
import './actionCard.css';/* empty css */
|
|
6
|
+
import { EActionCardSize as t } from "./types.js";
|
|
7
|
+
const f = p((i, a) => {
|
|
8
|
+
const { className: e, children: c, style: s = {}, size: r = "default", onClick: d } = i, o = Array.isArray(r) ? r : [t[r], t[r]], n = m("xtrActionCard", "shadowRipple", `${r}Size`, e);
|
|
9
|
+
return /* @__PURE__ */ l(
|
|
10
|
+
"footer",
|
|
11
|
+
{
|
|
12
|
+
ref: a,
|
|
13
|
+
className: n,
|
|
14
|
+
style: {
|
|
15
|
+
"--cardWidth": `${o[0]}px`,
|
|
16
|
+
"--cardHeight": `${o[1]}px`,
|
|
17
|
+
...s
|
|
18
|
+
},
|
|
19
|
+
onClick: d,
|
|
20
|
+
children: c
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
f.displayName = "ActionCard";
|
|
25
|
+
export {
|
|
26
|
+
f as ActionCard
|
|
27
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import z from "clsx";
|
|
4
|
+
import { Icon as E } from "gliff";
|
|
5
|
+
import { forwardRef as C, useState as c, useEffect as F } from "react";
|
|
6
|
+
import { FACE_ICONS as m } from "../../../utils/constants/iconCollection.js";
|
|
7
|
+
import { readImageFile as L, readImageSrc as b } from "../../../utils/helper/imageHelper.js";
|
|
8
|
+
import './avatar.css';/* empty css */
|
|
9
|
+
import { EAvatarSize as M } from "./types.js";
|
|
10
|
+
const R = C((h, g) => {
|
|
11
|
+
const { className: u, src: a, file: o, alt: v, placeholderIcon: y, size: l = "default", onClick: I } = h, [n, f] = c(), [x, A] = c(m.happy[0]), [N, t] = c(!!a || !!o), [p, r] = c(!1), d = typeof l == "number" ? l : M[l], S = z("xtrAvatar", u, N && "loading", p && "error"), s = (e) => {
|
|
12
|
+
e && setTimeout(() => f(e), 300), setTimeout(() => t(!1), 1e3);
|
|
13
|
+
};
|
|
14
|
+
return F(() => {
|
|
15
|
+
A(m.happy[Math.floor(Math.random() * m.happy.length)]);
|
|
16
|
+
try {
|
|
17
|
+
o ? (t(!0), r(!1), L(o).then((e) => s(e)).catch((e) => {
|
|
18
|
+
console.log(e), t(!1), r(!0);
|
|
19
|
+
})) : a ? (t(!0), r(!1), b(a).then((e) => s(e)).catch((e) => {
|
|
20
|
+
console.log(e, a), t(!1), r(!0);
|
|
21
|
+
})) : (f(void 0), s());
|
|
22
|
+
} catch {
|
|
23
|
+
s();
|
|
24
|
+
}
|
|
25
|
+
}, [a, o]), /* @__PURE__ */ i("div", { ref: g, className: S, style: { "--avatarSize": `${d}px` }, onClick: I, role: "img", children: n ? (
|
|
26
|
+
// biome-ignore lint/performance/noImgElement: library component wrapping img
|
|
27
|
+
/* @__PURE__ */ i("img", { className: "image", src: n, alt: v })
|
|
28
|
+
) : /* @__PURE__ */ i(E, { className: "placeholder", type: "solid", size: 8 + d / 4, code: p ? "e1b7" : y ?? x }) });
|
|
29
|
+
});
|
|
30
|
+
R.displayName = "Avatar";
|
|
31
|
+
export {
|
|
32
|
+
R as Avatar
|
|
33
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as N, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import x from "clsx";
|
|
4
|
+
import { Icon as B } from "gliff";
|
|
5
|
+
import { forwardRef as b } from "react";
|
|
6
|
+
import { ProgressBar as g } from "../ProgressBar/ProgressBar.js";
|
|
7
|
+
import './button.css';/* empty css */
|
|
8
|
+
import { EButtonTypes as h } from "./types.js";
|
|
9
|
+
const T = b((a, c) => {
|
|
10
|
+
const { className: m, style: p = {}, label: o, type: n = "primary", size: i = "default", disabled: d = !1, loading: l = !1, icon: e, iconType: f, iconPosition: s = "left", onClick: u } = a, r = e ? /* @__PURE__ */ t(B, { className: "icon", code: e, type: f, size: i }) : null, y = x("xtrButton", "shadowRipple", `${n}Type`, `${i}Size`, !o && "iconOnly", l && "loading", m);
|
|
11
|
+
return !o && !e ? null : /* @__PURE__ */ N("button", { ref: c, className: y, style: p, onClick: u, disabled: d, children: [
|
|
12
|
+
n.includes(h.link) && /* @__PURE__ */ t(g, { className: "underline", intermediate: l }),
|
|
13
|
+
s === "left" && r,
|
|
14
|
+
o && /* @__PURE__ */ t("span", { className: "label", children: o }),
|
|
15
|
+
s === "right" && r
|
|
16
|
+
] });
|
|
17
|
+
});
|
|
18
|
+
T.displayName = "Button";
|
|
19
|
+
export {
|
|
20
|
+
T as Button
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import p from "@uiw/react-color-alpha";
|
|
4
|
+
import d from "@uiw/react-color-shade-slider";
|
|
5
|
+
import C from "@uiw/react-color-wheel";
|
|
6
|
+
import f from "clsx";
|
|
7
|
+
import { forwardRef as x } from "react";
|
|
8
|
+
import './colorPicker.css';/* empty css */
|
|
9
|
+
const s = 180, N = x((l, t) => {
|
|
10
|
+
const { className: h, shade: m = !0, alpha: i = !0, color: o = { h: 0, s: 0, v: 100, a: 1 }, setColor: e } = l, c = f("xtrColorPicker", h);
|
|
11
|
+
return /* @__PURE__ */ n("div", { ref: t, className: c, children: [
|
|
12
|
+
/* @__PURE__ */ a(C, { className: "wheel", color: o, width: s, height: s, onChange: (r) => e(r.hsva) }),
|
|
13
|
+
m && /* @__PURE__ */ a(d, { className: "shade", hsva: o, onChange: ({ v: r }) => e({ ...o, v: r }) }),
|
|
14
|
+
i && /* @__PURE__ */ a(p, { className: "alpha", hsva: o, onChange: ({ a: r }) => e({ ...o, a: r }) })
|
|
15
|
+
] });
|
|
16
|
+
});
|
|
17
|
+
N.displayName = "ColorPicker";
|
|
18
|
+
export {
|
|
19
|
+
N as ColorPicker
|
|
20
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as a, Fragment as ie, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useFloating as ae, autoUpdate as ce, shift as he, flip as de, offset as me, useTransitionStyles as pe, useInteractions as ue, useClick as fe, useDismiss as Ce } from "@floating-ui/react";
|
|
4
|
+
import C from "clsx";
|
|
5
|
+
import { colord as s, getFormat as ge } from "colord";
|
|
6
|
+
import { Icon as ve } from "gliff";
|
|
7
|
+
import { forwardRef as xe, useMemo as w, useState as g, useRef as ye, useEffect as V } from "react";
|
|
8
|
+
import { ColorPicker as He } from "../ColorPicker/ColorPicker.js";
|
|
9
|
+
import { Textfield as be } from "../Textfield/Textfield.js";
|
|
10
|
+
import { useScreenType as Ne } from "../../hooks/useScreen.js";
|
|
11
|
+
import { getColorLabel as $e } from "../../../utils/helper/colorHelper.js";
|
|
12
|
+
import { THEME_SCHEME as Pe } from "../../../utils/constants/theme.js";
|
|
13
|
+
import { mergeRefs as Te } from "../../../utils/function/mergeRefs.js";
|
|
14
|
+
import { Button as M } from "../Button/Button.js";
|
|
15
|
+
import './colorPopper.css';/* empty css */
|
|
16
|
+
function O(j, z) {
|
|
17
|
+
const {
|
|
18
|
+
className: R,
|
|
19
|
+
popperClassName: A,
|
|
20
|
+
input: v = "textfield",
|
|
21
|
+
size: q = "default",
|
|
22
|
+
placeholder: D = "Color Picker",
|
|
23
|
+
colorHeading: m = "Pick color",
|
|
24
|
+
schemeHeading: I,
|
|
25
|
+
themeScheme: x,
|
|
26
|
+
setThemeScheme: U,
|
|
27
|
+
showReset: W = !0,
|
|
28
|
+
alpha: _,
|
|
29
|
+
shade: G,
|
|
30
|
+
swatch: y,
|
|
31
|
+
hideWheel: E = !1,
|
|
32
|
+
color: c,
|
|
33
|
+
setColor: p
|
|
34
|
+
} = j, J = Ne(), r = w(() => s(c), []), u = w(() => ge(c), [c]), [H, h] = g(r.toHsv()), [l, d] = g(r.toHex()), [K, Q] = g(m), b = ye(!1), [F, N] = g(!1), { refs: $, floatingStyles: X, context: P } = ae({
|
|
35
|
+
open: F,
|
|
36
|
+
onOpenChange: N,
|
|
37
|
+
middleware: [he({ crossAxis: !0, padding: 18 }), de(), me(({ placement: e }) => e === "bottom" ? 10 : 16)],
|
|
38
|
+
whileElementsMounted: ce
|
|
39
|
+
}), { isMounted: Y, styles: Z } = pe(P, {
|
|
40
|
+
duration: 200,
|
|
41
|
+
initial: ({ side: e }) => ({
|
|
42
|
+
opacity: 0,
|
|
43
|
+
translate: e === "bottom" ? "0px 8px" : "0px -8px"
|
|
44
|
+
})
|
|
45
|
+
}), { getReferenceProps: L, getFloatingProps: ee } = ue([fe(P), Ce(P)]), [T, oe, S] = w(() => {
|
|
46
|
+
const e = s(H), o = e.toHsl(), n = r.toHsl();
|
|
47
|
+
return [
|
|
48
|
+
`${Math.round(o.h)} ${Math.round(o.s)}% ${Math.round(o.l)}%`,
|
|
49
|
+
`${Math.round(n.h)} ${Math.round(n.s)}% ${Math.round(n.l)}%`,
|
|
50
|
+
e.isLight() ? "black" : "white"
|
|
51
|
+
];
|
|
52
|
+
}, [r, H]), te = l !== r.toHex(), k = v === "button" || v === "buttonLabel", f = (e) => {
|
|
53
|
+
b.current = !0, u === "rgb" ? p(e.toRgb()) : u === "hex" ? p(e.toHex()) : u === "hsl" ? p(e.toHsl()) : u === "hsv" && p(e.toHsv());
|
|
54
|
+
}, B = (e) => {
|
|
55
|
+
d(e);
|
|
56
|
+
const o = s(e);
|
|
57
|
+
o.isValid() && (h(o.toHsv()), f(o));
|
|
58
|
+
}, se = (e) => {
|
|
59
|
+
const o = s(e);
|
|
60
|
+
h(e), d(o.toHex()), f(o);
|
|
61
|
+
}, re = (e) => {
|
|
62
|
+
const o = s(e);
|
|
63
|
+
h(o.toHsv()), d(o.toHex()), f(o);
|
|
64
|
+
}, le = () => {
|
|
65
|
+
h(r.toHsv()), d(r.toHex()), f(r);
|
|
66
|
+
};
|
|
67
|
+
return V(() => {
|
|
68
|
+
if (!b.current) {
|
|
69
|
+
const e = s(c);
|
|
70
|
+
h(e.toHsv()), d(e.toHex());
|
|
71
|
+
}
|
|
72
|
+
b.current = !1;
|
|
73
|
+
}, [c]), V(() => {
|
|
74
|
+
Q($e(s(l).toHsl()) ?? m);
|
|
75
|
+
}, [m, l]), /* @__PURE__ */ a(ie, { children: [
|
|
76
|
+
k ? /* @__PURE__ */ t(
|
|
77
|
+
M,
|
|
78
|
+
{
|
|
79
|
+
className: "xtrColorButton",
|
|
80
|
+
ref: $.setReference,
|
|
81
|
+
size: q,
|
|
82
|
+
icon: "f53f",
|
|
83
|
+
iconType: "solid",
|
|
84
|
+
label: v === "buttonLabel" ? l : void 0,
|
|
85
|
+
style: {
|
|
86
|
+
"--themeColor": T,
|
|
87
|
+
"--iconColor": S,
|
|
88
|
+
color: S
|
|
89
|
+
},
|
|
90
|
+
onClick: () => N(!0),
|
|
91
|
+
...L()
|
|
92
|
+
}
|
|
93
|
+
) : /* @__PURE__ */ t(
|
|
94
|
+
be,
|
|
95
|
+
{
|
|
96
|
+
className: C("xtrColorInput", R),
|
|
97
|
+
ref: $.setReference,
|
|
98
|
+
placeholder: D,
|
|
99
|
+
icon: "f53f",
|
|
100
|
+
iconType: "solid",
|
|
101
|
+
active: F,
|
|
102
|
+
value: l,
|
|
103
|
+
onChange: (e) => B(e.target.value),
|
|
104
|
+
style: {
|
|
105
|
+
"--colorBrandPrimary": T,
|
|
106
|
+
"--iconColor": S
|
|
107
|
+
},
|
|
108
|
+
onFocus: () => N(!0),
|
|
109
|
+
...L()
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
Y && /* @__PURE__ */ a(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
ref: Te([z, $.setFloating]),
|
|
116
|
+
className: C("xtrColorPopper", A),
|
|
117
|
+
style: { ...X, ...Z, "--colorBrandPrimary": T },
|
|
118
|
+
...ee(),
|
|
119
|
+
children: [
|
|
120
|
+
(y || !E) && /* @__PURE__ */ a("div", { className: C("header", k && "withInput"), children: [
|
|
121
|
+
/* @__PURE__ */ a("div", { className: "heading", children: [
|
|
122
|
+
/* @__PURE__ */ a("div", { children: [
|
|
123
|
+
/* @__PURE__ */ t("h1", { children: K }),
|
|
124
|
+
k && /* @__PURE__ */ t(
|
|
125
|
+
"input",
|
|
126
|
+
{
|
|
127
|
+
placeholder: "#Hex",
|
|
128
|
+
className: C("popperInput", R),
|
|
129
|
+
value: l,
|
|
130
|
+
autoFocus: J.isLargest,
|
|
131
|
+
onChange: (e) => B(e.target.value)
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
] }),
|
|
135
|
+
/* @__PURE__ */ t("h1", { children: m })
|
|
136
|
+
] }),
|
|
137
|
+
W && /* @__PURE__ */ t(
|
|
138
|
+
ve,
|
|
139
|
+
{
|
|
140
|
+
code: "f1da",
|
|
141
|
+
type: "solid",
|
|
142
|
+
style: {
|
|
143
|
+
"--colorBrandPrimary": oe,
|
|
144
|
+
visibility: te ? "visible" : "hidden"
|
|
145
|
+
},
|
|
146
|
+
onClick: le
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }),
|
|
150
|
+
y && /* @__PURE__ */ t("div", { className: "swatch", children: y.map((e, o) => {
|
|
151
|
+
const n = s(l).isEqual(e), i = s(e).toHsl(), ne = `${i.h} ${i.s}% ${i.l}%`;
|
|
152
|
+
return /* @__PURE__ */ t(
|
|
153
|
+
M,
|
|
154
|
+
{
|
|
155
|
+
className: "swatchItem",
|
|
156
|
+
icon: "f00c",
|
|
157
|
+
iconType: "solid",
|
|
158
|
+
size: "mini",
|
|
159
|
+
style: {
|
|
160
|
+
"--themeColor": ne,
|
|
161
|
+
color: n ? "white" : "transparent"
|
|
162
|
+
},
|
|
163
|
+
onClick: () => re(i)
|
|
164
|
+
},
|
|
165
|
+
`ThemeColor-${i.h}${i.s}${i.l}-${o}`
|
|
166
|
+
);
|
|
167
|
+
}) }),
|
|
168
|
+
!E && /* @__PURE__ */ t(He, { className: "colorPicker", alpha: _, shade: G, color: H, setColor: se }),
|
|
169
|
+
I && /* @__PURE__ */ a("div", { className: "themeScheme", children: [
|
|
170
|
+
/* @__PURE__ */ t("div", { className: "header", children: /* @__PURE__ */ a("div", { className: "heading", children: [
|
|
171
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t("h1", { children: x }) }),
|
|
172
|
+
/* @__PURE__ */ t("h1", { children: I })
|
|
173
|
+
] }) }),
|
|
174
|
+
/* @__PURE__ */ t("div", { className: "schemeSelector", children: Pe.map(({ name: e, icon: o }, n) => /* @__PURE__ */ t(
|
|
175
|
+
M,
|
|
176
|
+
{
|
|
177
|
+
icon: o,
|
|
178
|
+
iconType: "solid",
|
|
179
|
+
disabled: x === e,
|
|
180
|
+
type: x === e ? "primary" : "secondary",
|
|
181
|
+
onClick: () => U?.(e)
|
|
182
|
+
},
|
|
183
|
+
`ThemeScheme-${e}-${n}`
|
|
184
|
+
)) })
|
|
185
|
+
] })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] });
|
|
190
|
+
}
|
|
191
|
+
const Ae = xe(O);
|
|
192
|
+
O.displayName = "ColorPopper";
|
|
193
|
+
export {
|
|
194
|
+
Ae as ColorPopper
|
|
195
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import M from "clsx";
|
|
4
|
+
import { Icon as m } from "gliff";
|
|
5
|
+
import e from "react-datetime-picker";
|
|
6
|
+
import './datePicker.css';/* empty css */
|
|
7
|
+
const u = {
|
|
8
|
+
date: "dd-MM-yyyy",
|
|
9
|
+
dateRange: "dd-MM-yyyy",
|
|
10
|
+
time: "h:mm:ss a",
|
|
11
|
+
timeRange: "h:mm:ss a",
|
|
12
|
+
dateTime: "dd-MM-yyyy h:mm:ss a",
|
|
13
|
+
dateTimeRange: "dd-MM-yyyy h:mm:ss a"
|
|
14
|
+
}, x = {
|
|
15
|
+
date: e,
|
|
16
|
+
dateRange: e,
|
|
17
|
+
time: e,
|
|
18
|
+
timeRange: e,
|
|
19
|
+
dateTime: e,
|
|
20
|
+
dateTimeRange: e
|
|
21
|
+
}, b = (r) => {
|
|
22
|
+
const {
|
|
23
|
+
className: c,
|
|
24
|
+
type: t = "date",
|
|
25
|
+
format: d,
|
|
26
|
+
dayPlaceholder: s = "dd",
|
|
27
|
+
monthPlaceholder: n = "mm",
|
|
28
|
+
yearPlaceholder: l = "yyyy",
|
|
29
|
+
hourPlaceholder: i = "hh",
|
|
30
|
+
minutePlaceholder: y = "mm",
|
|
31
|
+
secondPlaceholder: h = "ss",
|
|
32
|
+
placeholder: o = "Select a Date",
|
|
33
|
+
icon: p = "f784",
|
|
34
|
+
value: P,
|
|
35
|
+
onChange: D
|
|
36
|
+
} = r, f = {
|
|
37
|
+
className: M("xtrDatePicker", c),
|
|
38
|
+
calendarIcon: /* @__PURE__ */ a(m, { code: p, type: "regular" }),
|
|
39
|
+
clearIcon: /* @__PURE__ */ a(m, { code: "e59b", type: "solid" }),
|
|
40
|
+
format: d ?? u[t],
|
|
41
|
+
dayPlaceholder: s,
|
|
42
|
+
monthPlaceholder: n,
|
|
43
|
+
yearPlaceholder: l,
|
|
44
|
+
hourPlaceholder: i,
|
|
45
|
+
minutePlaceholder: y,
|
|
46
|
+
secondPlaceholder: h,
|
|
47
|
+
placeholder: o,
|
|
48
|
+
value: P,
|
|
49
|
+
onChange: D
|
|
50
|
+
}, g = x[t];
|
|
51
|
+
return /* @__PURE__ */ a(g, { "data-testid": o, ...f });
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
b as DatePicker
|
|
55
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, Fragment as f, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import C from "clsx";
|
|
4
|
+
import { Icon as x } from "gliff";
|
|
5
|
+
import { createPortal as b } from "react-dom";
|
|
6
|
+
import { useFilePicker as P } from "use-file-picker";
|
|
7
|
+
import { ImageEditor as u } from "../../layout/ImageEditor/ImageEditor.js";
|
|
8
|
+
import { Button as N } from "../Button/Button.js";
|
|
9
|
+
import './filePicker.css';/* empty css */
|
|
10
|
+
import { getFilePickerIcon as y } from "./getFilePickerIcon.js";
|
|
11
|
+
import { imageExts as E } from "./types.js";
|
|
12
|
+
const v = (F) => {
|
|
13
|
+
const { className: g, children: n, draggable: d = !1, editable: h = !1, multiple: l = !1, accept: o = "*/*", onChange: t } = F, s = h && !l && (o.includes("image") || E.includes(o?.split?.(",")?.[0]?.replace(".", ""))), { openFilePicker: a, loading: k, plainFiles: r, clear: p } = P({
|
|
14
|
+
accept: o,
|
|
15
|
+
multiple: l,
|
|
16
|
+
onFilesSuccessfullySelected: ({ plainFiles: e }) => {
|
|
17
|
+
s || t(e);
|
|
18
|
+
}
|
|
19
|
+
}), m = C("xtrFilePicker", n && "wrapper", d && "draggable", g);
|
|
20
|
+
return n ? /* @__PURE__ */ c(f, { children: [
|
|
21
|
+
/* @__PURE__ */ i("div", { className: m, onClick: a, children: n }),
|
|
22
|
+
s && r?.[0] && b(/* @__PURE__ */ i(u, { file: r?.[0], clearFile: p, onChange: (e) => t(e.blob ? [e.blob] : []) }), document.body)
|
|
23
|
+
] }) : d ? /* @__PURE__ */ c("div", { className: m, onClick: a, children: [
|
|
24
|
+
/* @__PURE__ */ i(x, { code: "f0ed", set: "duotone", size: 64 }),
|
|
25
|
+
/* @__PURE__ */ c("h2", { children: [
|
|
26
|
+
"Drop File",
|
|
27
|
+
l ? "s" : "",
|
|
28
|
+
" Here"
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ i("p", { children: "or click here to open file chooser" })
|
|
31
|
+
] }) : /* @__PURE__ */ c(f, { children: [
|
|
32
|
+
/* @__PURE__ */ i(N, { className: m, label: `Choose File${l ? "s" : ""}`, icon: y(o), onClick: a, loading: k }),
|
|
33
|
+
s && r?.[0] && b(/* @__PURE__ */ i(u, { file: r?.[0], clearFile: p, onChange: (e) => t(e.blob ? [e.blob] : []) }), document.body)
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
v as FilePicker
|
|
38
|
+
};
|