@companix/uikit 0.0.36 → 0.0.38
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/Avatar/Avatar.scss +64 -0
- package/dist/Avatar/helpers.d.ts +10 -0
- package/dist/Avatar/index.d.ts +8 -0
- package/dist/Avatar/types.d.ts +2 -0
- package/dist/Button/Button.scss +128 -0
- package/dist/Button/index.d.ts +21 -0
- package/dist/ButtonGroup/ButtonGroup.scss +18 -0
- package/dist/ButtonGroup/index.d.ts +6 -0
- package/dist/Calendar/Calendar.d.ts +14 -0
- package/dist/Calendar/Calendar.scss +125 -0
- package/dist/Calendar/CalendarHeader.d.ts +10 -0
- package/dist/Checkbox/Checkbox.scss +115 -0
- package/dist/Checkbox/index.d.ts +10 -0
- package/dist/Countdown/index.d.ts +6 -0
- package/dist/DateInput/DateInput.scss +11 -0
- package/dist/DateInput/index.d.ts +13 -0
- package/dist/DatePicker/index.d.ts +9 -0
- package/dist/Dialog/Dialog.scss +25 -0
- package/dist/Dialog/Popup.scss +55 -0
- package/dist/Dialog/index.d.ts +16 -0
- package/dist/DialogAlert/Alert.d.ts +19 -0
- package/dist/DialogAlert/Alert.scss +52 -0
- package/dist/DialogAlert/Viewport.d.ts +8 -0
- package/dist/DialogAlert/index.d.ts +11 -0
- package/dist/Drawer/Drawer.scss +112 -0
- package/dist/Drawer/index.d.ts +13 -0
- package/dist/File/index.d.ts +10 -0
- package/dist/FormGroup/FormGroup.scss +32 -0
- package/dist/FormGroup/index.d.ts +9 -0
- package/dist/Icon/icon.scss +18 -0
- package/dist/Icon/index.d.ts +7 -0
- package/dist/Input/Form.scss +67 -0
- package/dist/Input/InlineInput.d.ts +0 -0
- package/dist/Input/Input.d.ts +14 -0
- package/dist/Input/Input.scss +47 -0
- package/dist/Input/InputContainer.d.ts +11 -0
- package/dist/Input/InputElement.d.ts +9 -0
- package/dist/LoadingButton/index.d.ts +5 -0
- package/dist/NumberInput/index.d.ts +23 -0
- package/dist/OptionItem/Option.scss +89 -0
- package/dist/OptionItem/OptionItem.d.ts +6 -0
- package/dist/OptionItem/OptionsList.d.ts +7 -0
- package/dist/Popover/Popover.scss +80 -0
- package/dist/Popover/index.d.ts +27 -0
- package/dist/Progress/Progress.scss +47 -0
- package/dist/Progress/index.d.ts +5 -0
- package/dist/Radio/Radio.scss +148 -0
- package/dist/Radio/index.d.ts +20 -0
- package/dist/Scrollable/ImitateScroll.d.ts +10 -0
- package/dist/Scrollable/Scrollable.scss +50 -0
- package/dist/Scrollable/index.d.ts +33 -0
- package/dist/Segments/Segments.scss +57 -0
- package/dist/Segments/index.d.ts +11 -0
- package/dist/Select/Select.scss +80 -0
- package/dist/Select/SelectInput.d.ts +15 -0
- package/dist/Select/SelectOptions.d.ts +12 -0
- package/dist/Select/SelectRight.d.ts +8 -0
- package/dist/Select/index.d.ts +24 -0
- package/dist/SelectTags/SelectTags.scss +67 -0
- package/dist/SelectTags/index.d.ts +17 -0
- package/dist/Spinner/Spinner.scss +14 -0
- package/dist/Spinner/index.d.ts +7 -0
- package/dist/Switch/Switch.scss +102 -0
- package/dist/Switch/index.d.ts +10 -0
- package/dist/Tabs/Tabs.scss +58 -0
- package/dist/Tabs/index.d.ts +13 -0
- package/dist/TextArea/TextArea.scss +34 -0
- package/dist/TextArea/index.d.ts +7 -0
- package/dist/ThemeProvider/helpers.d.ts +4 -0
- package/dist/ThemeProvider/index.d.ts +12 -0
- package/dist/ThemeProvider/script.d.ts +8 -0
- package/dist/ThemeProvider/types.d.ts +2 -0
- package/dist/TimePicker/index.d.ts +10 -0
- package/dist/Toaster/Toast.d.ts +15 -0
- package/dist/Toaster/Toaster.scss +155 -0
- package/dist/Toaster/Viewport.d.ts +13 -0
- package/dist/Toaster/index.d.ts +20 -0
- package/dist/Tooltip/Tooltip.scss +28 -0
- package/dist/Tooltip/index.d.ts +7 -0
- package/dist/__helpers/createDialogRegistry.d.ts +26 -0
- package/dist/__helpers/createPopoversRegistry.d.ts +19 -0
- package/dist/__hooks/use-frooze-closing.d.ts +5 -0
- package/dist/__hooks/use-input-padding.d.ts +5 -0
- package/dist/__hooks/use-loading.d.ts +8 -0
- package/dist/__hooks/use-local-storage.d.ts +1 -0
- package/dist/__hooks/use-popover-position.d.ts +8 -0
- package/dist/__hooks/use-previos.d.ts +2 -0
- package/dist/__hooks/use-resize.d.ts +3 -0
- package/dist/__hooks/use-scrollbox.d.ts +7 -0
- package/dist/__hooks/use-update.d.ts +1 -0
- package/dist/__hooks/useCalendar.d.ts +17 -0
- package/dist/__hooks/useCalendarOptions-copy.d.ts +22 -0
- package/dist/__hooks/useCalendarOptions.d.ts +31 -0
- package/dist/__libs/calendar.d.ts +25 -0
- package/dist/__utils/RemoveListener.d.ts +3 -0
- package/dist/__utils/utils.d.ts +39 -0
- package/dist/bundle.es.js +88 -0
- package/dist/bundle.es10.js +82 -0
- package/dist/bundle.es11.js +28 -0
- package/dist/bundle.es12.js +77 -0
- package/dist/bundle.es13.js +43 -0
- package/dist/bundle.es14.js +38 -0
- package/dist/bundle.es15.js +58 -0
- package/dist/bundle.es16.js +23 -0
- package/dist/bundle.es17.js +35 -0
- package/dist/bundle.es18.js +27 -0
- package/dist/bundle.es19.js +47 -0
- package/dist/bundle.es2.js +44 -0
- package/dist/bundle.es20.js +25 -0
- package/dist/bundle.es21.js +31 -0
- package/dist/bundle.es22.js +40 -0
- package/dist/bundle.es23.js +18 -0
- package/dist/bundle.es24.js +36 -0
- package/dist/bundle.es25.js +23 -0
- package/dist/bundle.es26.js +44 -0
- package/dist/bundle.es27.js +117 -0
- package/dist/bundle.es28.js +123 -0
- package/dist/bundle.es29.js +76 -0
- package/dist/bundle.es3.js +4 -0
- package/dist/bundle.es30.js +35 -0
- package/dist/bundle.es31.js +14 -0
- package/dist/bundle.es32.js +88 -0
- package/dist/bundle.es33.js +22 -0
- package/dist/bundle.es34.js +9 -0
- package/dist/bundle.es35.js +37 -0
- package/dist/bundle.es36.js +24 -0
- package/dist/bundle.es37.js +13 -0
- package/dist/bundle.es38.js +27 -0
- package/dist/bundle.es39.js +41 -0
- package/dist/bundle.es4.js +47 -0
- package/dist/bundle.es40.js +53 -0
- package/dist/bundle.es41.js +45 -0
- package/dist/bundle.es42.js +11 -0
- package/dist/bundle.es43.js +27 -0
- package/dist/bundle.es44.js +26 -0
- package/dist/bundle.es45.js +89 -0
- package/dist/bundle.es46.js +20 -0
- package/dist/bundle.es47.js +22 -0
- package/dist/bundle.es48.js +26 -0
- package/dist/bundle.es49.js +41 -0
- package/dist/bundle.es5.js +10 -0
- package/dist/bundle.es50.js +7 -0
- package/dist/bundle.es51.js +16 -0
- package/dist/bundle.es52.js +16 -0
- package/dist/bundle.es53.js +72 -0
- package/dist/bundle.es54.js +70 -0
- package/dist/bundle.es55.js +72 -0
- package/dist/bundle.es56.js +13 -0
- package/dist/bundle.es57.js +45 -0
- package/dist/bundle.es58.js +17 -0
- package/dist/bundle.es59.js +34 -0
- package/dist/bundle.es6.js +13 -0
- package/dist/bundle.es60.js +72 -0
- package/dist/bundle.es61.js +16 -0
- package/dist/bundle.es62.js +77 -0
- package/dist/bundle.es63.js +51 -0
- package/dist/bundle.es64.js +16 -0
- package/dist/bundle.es7.js +87 -0
- package/dist/bundle.es8.js +87 -0
- package/dist/bundle.es9.js +24 -0
- package/dist/css-properties.scss +120 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.scss +28 -0
- package/dist/mixins.scss +102 -0
- package/dist/theme.scss +101 -0
- package/dist/types.d.ts +17 -0
- package/package.json +6 -6
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as _, useMemo as b, useState as P, useEffect as j } from "react";
|
|
3
|
+
import { getNum as v } from "@companix/utils-js";
|
|
4
|
+
import { getTimesOptions as D, getTimeValue as A, removeDigits as W, convertTimeToOption as q } from "./bundle.es55.js";
|
|
5
|
+
import { SelectRightElements as w } from "./bundle.es56.js";
|
|
6
|
+
import { Select as y } from "./bundle.es12.js";
|
|
7
|
+
import { Input as z } from "./bundle.es13.js";
|
|
8
|
+
const r = {
|
|
9
|
+
char: ":",
|
|
10
|
+
toString: (s) => s ? q(s, r.char) : "",
|
|
11
|
+
toValue: (s) => {
|
|
12
|
+
const n = s.split(r.char);
|
|
13
|
+
if (n.length === 2) {
|
|
14
|
+
const [e, i] = [v(n[0]), v(n[1])];
|
|
15
|
+
if (e !== null && i !== null && e < 24 && e >= 0 && i < 60 && i >= 0)
|
|
16
|
+
return { hours: e, minutes: i };
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}, U = (s) => {
|
|
21
|
+
const { value: n, onChange: e, clearButton: i, clearButtonIcon: I, disabled: a, ...T } = s, m = _(null), p = _(null), h = b(() => D(10), []), d = b(() => {
|
|
22
|
+
if (n && !n.minutes.toString().endsWith("0")) {
|
|
23
|
+
const t = n.hours * 6 + Math.trunc(n.minutes / 10), u = [...h];
|
|
24
|
+
return u.splice(t + 1, 0, A(n)), u;
|
|
25
|
+
}
|
|
26
|
+
return h;
|
|
27
|
+
}, [h, n]), [o, l] = P(() => r.toString(n)), x = (t) => {
|
|
28
|
+
l(t);
|
|
29
|
+
const u = r.toValue(t);
|
|
30
|
+
u && e?.(u);
|
|
31
|
+
}, B = (t) => {
|
|
32
|
+
a || m.current && m.current.getAttribute("data-state") === "open" && t.preventDefault();
|
|
33
|
+
}, O = () => {
|
|
34
|
+
r.toValue(o) === null && l(r.toString(n ?? null));
|
|
35
|
+
}, R = (t) => {
|
|
36
|
+
e?.(r.toValue(t)), l(t);
|
|
37
|
+
}, k = (t) => {
|
|
38
|
+
t.stopPropagation(), l(""), e?.(null);
|
|
39
|
+
};
|
|
40
|
+
return j(() => {
|
|
41
|
+
if (o && o !== "__:__") {
|
|
42
|
+
const [t, u] = o.split(":"), V = (c) => {
|
|
43
|
+
const [C, S] = c.split(""), [E, M] = [C === "_" ? "0" : C, S === "_" ? "0" : S];
|
|
44
|
+
return E + M;
|
|
45
|
+
}, N = [V(t), V(u)].join(":"), f = r.toValue(N);
|
|
46
|
+
if (f) {
|
|
47
|
+
const c = f.hours * 6 + Math.trunc(f.minutes / 10);
|
|
48
|
+
c !== -1 && p.current && p.current.scrollTo(c);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [d, o]), /* @__PURE__ */ g(
|
|
52
|
+
y,
|
|
53
|
+
{
|
|
54
|
+
minimalOptions: !0,
|
|
55
|
+
options: d,
|
|
56
|
+
onChange: R,
|
|
57
|
+
value: o,
|
|
58
|
+
popoverRef: m,
|
|
59
|
+
scrollRef: p,
|
|
60
|
+
disabled: a,
|
|
61
|
+
children: /* @__PURE__ */ g(
|
|
62
|
+
z,
|
|
63
|
+
{
|
|
64
|
+
...T,
|
|
65
|
+
value: o,
|
|
66
|
+
disabled: a,
|
|
67
|
+
onClick: B,
|
|
68
|
+
onValueChange: x,
|
|
69
|
+
onBlur: O,
|
|
70
|
+
mask: "99:99",
|
|
71
|
+
placeholder: "00:00",
|
|
72
|
+
rightElement: /* @__PURE__ */ g(
|
|
73
|
+
w,
|
|
74
|
+
{
|
|
75
|
+
clearButton: i,
|
|
76
|
+
clearButtonIcon: I,
|
|
77
|
+
value: !!W(o, [":", "_"]),
|
|
78
|
+
onClear: k
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
U as TimePicker
|
|
88
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import m from "classnames";
|
|
3
|
+
import { forwardRef as s } from "react";
|
|
4
|
+
const g = s(
|
|
5
|
+
({ icon: r, className: t, size: i = "m", ...e }, n) => {
|
|
6
|
+
const [c, a, , , l] = r;
|
|
7
|
+
return /* @__PURE__ */ o(
|
|
8
|
+
"svg",
|
|
9
|
+
{
|
|
10
|
+
ref: n,
|
|
11
|
+
viewBox: `0 0 ${c} ${a}`,
|
|
12
|
+
className: m(`icon icon-size-${i}`, t),
|
|
13
|
+
...e,
|
|
14
|
+
role: "img",
|
|
15
|
+
children: /* @__PURE__ */ o(f, { paths: l })
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
), f = ({ paths: r }) => Array.isArray(r) ? /* @__PURE__ */ o("g", { children: r.map((t, i) => /* @__PURE__ */ o("path", { fill: "currentColor", d: t }, `-d-${i}`)) }) : /* @__PURE__ */ o("path", { fill: "currentColor", d: r });
|
|
20
|
+
export {
|
|
21
|
+
g as Icon
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { clamp as o, pc as p } from "@companix/utils-browser";
|
|
3
|
+
const i = ({ appearance: a = "primary", value: e }) => {
|
|
4
|
+
const s = 100 * o(e, 0, 1);
|
|
5
|
+
return /* @__PURE__ */ r("div", { "aria-valuemax": 100, "aria-valuemin": 0, role: "progressbar", className: "progress-bar", children: /* @__PURE__ */ r("div", { className: "progress-bar-thumb", "data-appearance": a, style: { width: p(s) } }) });
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
i as ProgressBar
|
|
9
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as c, createContext as f, useContext as w } from "react";
|
|
3
|
+
import { getColorScheme as v, updateDOM as m } from "./bundle.es58.js";
|
|
4
|
+
const i = f({
|
|
5
|
+
setColorScheme: () => {
|
|
6
|
+
}
|
|
7
|
+
}), y = () => w(i), p = (d) => {
|
|
8
|
+
const { defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = d, [r, a] = h(() => v(n, o)), s = (e) => {
|
|
9
|
+
a(e), localStorage.setItem(n, e);
|
|
10
|
+
};
|
|
11
|
+
return c(() => {
|
|
12
|
+
const e = window ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
|
|
13
|
+
if (!e)
|
|
14
|
+
return;
|
|
15
|
+
const t = () => {
|
|
16
|
+
r === "system" && m("system");
|
|
17
|
+
};
|
|
18
|
+
return e.addEventListener?.("change", t), t(), () => {
|
|
19
|
+
e.removeEventListener?.("change", t);
|
|
20
|
+
};
|
|
21
|
+
}, [r]), c(() => {
|
|
22
|
+
if (!window)
|
|
23
|
+
return;
|
|
24
|
+
const e = (t) => {
|
|
25
|
+
t.key === n && (t.newValue ? a(t.newValue) : s(o));
|
|
26
|
+
};
|
|
27
|
+
return window.addEventListener("storage", e), () => {
|
|
28
|
+
window.removeEventListener("storage", e);
|
|
29
|
+
};
|
|
30
|
+
}, [s, o]), c(() => {
|
|
31
|
+
m(r);
|
|
32
|
+
}, [r]), /* @__PURE__ */ u(i.Provider, { value: { colorScheme: r, setColorScheme: s }, children: l });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
p as ThemeProvider,
|
|
36
|
+
y as useTheme
|
|
37
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { memo as n } from "react";
|
|
3
|
+
const i = n(({ storageKey: t, defaultColorScheme: o }) => /* @__PURE__ */ l(
|
|
4
|
+
"script",
|
|
5
|
+
{
|
|
6
|
+
suppressHydrationWarning: !0,
|
|
7
|
+
dangerouslySetInnerHTML: {
|
|
8
|
+
__html: `(${a.toString()})("${t}", "${o}")`
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
)), a = (t, o) => {
|
|
12
|
+
const [r, c] = ["theme-light", "theme-dark"];
|
|
13
|
+
try {
|
|
14
|
+
let e = localStorage.getItem(t) || o;
|
|
15
|
+
e === "system" && (e = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
16
|
+
const s = e === "dark" ? c : r;
|
|
17
|
+
document.documentElement.classList.remove(r, c), document.documentElement.classList.add(s), document.documentElement.style.colorScheme = e;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
i as ColorSchemeScript,
|
|
23
|
+
a as colorSchemeScript
|
|
24
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useState as s, useEffect as c } from "react";
|
|
2
|
+
const l = (e, a) => {
|
|
3
|
+
const [t, o] = s(() => {
|
|
4
|
+
const r = localStorage.getItem(e);
|
|
5
|
+
return r ? JSON.parse(r) : a;
|
|
6
|
+
});
|
|
7
|
+
return c(() => {
|
|
8
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
9
|
+
}, [t]), [t, o];
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
l as useLocalStorage
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { hash as m } from "@companix/utils-js";
|
|
3
|
+
import { useRef as n, useMemo as s } from "react";
|
|
4
|
+
import { Viewport as u } from "./bundle.es59.js";
|
|
5
|
+
const h = (t = {}) => {
|
|
6
|
+
const e = {
|
|
7
|
+
emit: (r) => {
|
|
8
|
+
console.error("uninitialized", r);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
show: (r) => {
|
|
13
|
+
e.emit({ ...r, id: m() });
|
|
14
|
+
},
|
|
15
|
+
Viewport: () => {
|
|
16
|
+
const r = n(null);
|
|
17
|
+
return s(() => {
|
|
18
|
+
e.emit = (o) => {
|
|
19
|
+
r.current && r.current.showAlert(o);
|
|
20
|
+
};
|
|
21
|
+
}, []), /* @__PURE__ */ i(u, { ref: r, ...t });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
h as createAlertAgent
|
|
27
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { hash as r } from "@companix/utils-js";
|
|
3
|
+
import { Viewport as a } from "./bundle.es60.js";
|
|
4
|
+
import { useRef as c, useMemo as h } from "react";
|
|
5
|
+
const m = (i = {}) => {
|
|
6
|
+
const o = {
|
|
7
|
+
showToast: (e) => {
|
|
8
|
+
console.error("uninitialized", e);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
api: {
|
|
13
|
+
show: (e) => {
|
|
14
|
+
const n = e.id ?? r();
|
|
15
|
+
return o.showToast({ ...e, id: n }), n;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
Viewport: (e = {}) => {
|
|
19
|
+
const n = c(null);
|
|
20
|
+
return h(() => {
|
|
21
|
+
o.showToast = (s) => {
|
|
22
|
+
n.current && n.current.showToast(s);
|
|
23
|
+
};
|
|
24
|
+
}, []), /* @__PURE__ */ t(
|
|
25
|
+
a,
|
|
26
|
+
{
|
|
27
|
+
ref: n,
|
|
28
|
+
align: e.align ?? i.align,
|
|
29
|
+
closeIcon: e.closeIcon ?? i.closeIcon,
|
|
30
|
+
duration: e.duration ?? i.duration,
|
|
31
|
+
gap: e.gap ?? i.gap,
|
|
32
|
+
side: e.side ?? i.side,
|
|
33
|
+
swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
m as createToaster
|
|
41
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as e, jsxs as x, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import j from "classnames";
|
|
3
|
+
import { Spinner as k } from "./bundle.es6.js";
|
|
4
|
+
import { forwardRef as w } from "react";
|
|
5
|
+
import { attr as r } from "@companix/utils-browser";
|
|
6
|
+
const F = w(
|
|
7
|
+
({
|
|
8
|
+
children: d,
|
|
9
|
+
fill: l,
|
|
10
|
+
text: i,
|
|
11
|
+
active: c,
|
|
12
|
+
mode: f = "default",
|
|
13
|
+
appearance: s = "neutral",
|
|
14
|
+
size: p = "md",
|
|
15
|
+
align: u,
|
|
16
|
+
icon: m,
|
|
17
|
+
loading: t,
|
|
18
|
+
className: b,
|
|
19
|
+
iconRight: n,
|
|
20
|
+
Component: o = "button",
|
|
21
|
+
...a
|
|
22
|
+
}, v) => /* @__PURE__ */ e(
|
|
23
|
+
o,
|
|
24
|
+
{
|
|
25
|
+
ref: v,
|
|
26
|
+
className: j("button", b),
|
|
27
|
+
"data-size": p,
|
|
28
|
+
"data-loading": r(t),
|
|
29
|
+
"data-align": t ? "center" : u ?? (m && n ? "left" : "center"),
|
|
30
|
+
"data-appearance": s,
|
|
31
|
+
"data-mode": f,
|
|
32
|
+
"data-fill": r(l),
|
|
33
|
+
"data-active": r(c),
|
|
34
|
+
type: o === "button" ? "button" : void 0,
|
|
35
|
+
...a,
|
|
36
|
+
onClick: t ?? a.disabled ? void 0 : a.onClick,
|
|
37
|
+
children: t ? /* @__PURE__ */ e(k, { size: 14, width: 2 }) : /* @__PURE__ */ x(h, { children: [
|
|
38
|
+
m,
|
|
39
|
+
(d ?? i) && /* @__PURE__ */ e("span", { className: "button-text", children: i ?? d }),
|
|
40
|
+
n
|
|
41
|
+
] })
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
export {
|
|
46
|
+
F as Button
|
|
47
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as t from "@radix-ui/react-toast";
|
|
3
|
+
import { attr as T } from "@companix/utils-browser";
|
|
4
|
+
import { useState as d, useRef as b, useEffect as j, useLayoutEffect as E } from "react";
|
|
5
|
+
import { RemoveListener as I } from "./bundle.es50.js";
|
|
6
|
+
const m = (o) => {
|
|
7
|
+
const [r, u] = d(!0), [p, f] = d(!1), s = b(null), {
|
|
8
|
+
appearance: C = "neutral",
|
|
9
|
+
icon: a,
|
|
10
|
+
title: n,
|
|
11
|
+
description: c,
|
|
12
|
+
duration: L,
|
|
13
|
+
closeIcon: h,
|
|
14
|
+
onClosing: v,
|
|
15
|
+
onClosed: N,
|
|
16
|
+
closable: x = !0,
|
|
17
|
+
onInitialized: g
|
|
18
|
+
} = o;
|
|
19
|
+
j(() => {
|
|
20
|
+
f(!0);
|
|
21
|
+
}, []), E(() => {
|
|
22
|
+
s.current && g(s.current);
|
|
23
|
+
}, []);
|
|
24
|
+
const R = (i) => {
|
|
25
|
+
i || v(), u(i);
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ l(
|
|
28
|
+
t.Root,
|
|
29
|
+
{
|
|
30
|
+
ref: s,
|
|
31
|
+
"data-expanded": !0,
|
|
32
|
+
"data-appearance": C,
|
|
33
|
+
"data-mounted": T(p),
|
|
34
|
+
className: "toaster",
|
|
35
|
+
open: r,
|
|
36
|
+
onOpenChange: R,
|
|
37
|
+
duration: L,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ e(I, { callback: N }),
|
|
40
|
+
a && /* @__PURE__ */ e("div", { className: "toaster-icon", children: a }),
|
|
41
|
+
/* @__PURE__ */ l("div", { className: "toaster-content", children: [
|
|
42
|
+
n && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: n }),
|
|
43
|
+
c && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: c })
|
|
44
|
+
] }),
|
|
45
|
+
x && /* @__PURE__ */ e(m.Close, { className: "toaster-close toaster-close-placement", closeIcon: h })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
m.Close = ({ closeIcon: o, className: r } = {}) => /* @__PURE__ */ e(t.Close, { className: r, children: o ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) });
|
|
51
|
+
export {
|
|
52
|
+
m as Toast
|
|
53
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as r, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as C, createContext as g, useState as h, useEffect as x, useCallback as u } from "react";
|
|
3
|
+
import { Dialog as D } from "./bundle.es21.js";
|
|
4
|
+
import { hash as v } from "@companix/utils-js";
|
|
5
|
+
const $ = (t) => {
|
|
6
|
+
const e = {}, n = {}, l = [], c = v();
|
|
7
|
+
for (const o in t)
|
|
8
|
+
e[o] = () => {
|
|
9
|
+
}, n[o] = () => {
|
|
10
|
+
}, l.push(() => /* @__PURE__ */ r(O, { Open: e, Close: n, name: o, Content: t[o] }));
|
|
11
|
+
return {
|
|
12
|
+
Open: e,
|
|
13
|
+
Close: n,
|
|
14
|
+
Overlay: () => /* @__PURE__ */ r(m, { children: l.map((o, s) => /* @__PURE__ */ r(o, {}, `popup-${c}-${s}`)) })
|
|
15
|
+
};
|
|
16
|
+
}, O = ({ name: t, Open: e, Close: n, Content: l }) => {
|
|
17
|
+
const [{ data: c, open: o }, s] = h({ data: null, open: !1 });
|
|
18
|
+
x(() => {
|
|
19
|
+
e[t] = (a) => {
|
|
20
|
+
s({ data: a, open: !0 });
|
|
21
|
+
}, n[t] = () => {
|
|
22
|
+
o && p();
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
const p = u(() => {
|
|
26
|
+
s(({ data: a }) => ({ data: a, open: !1 }));
|
|
27
|
+
}, []), f = u(() => {
|
|
28
|
+
s({ data: null, open: !1 });
|
|
29
|
+
}, []), d = u((a) => {
|
|
30
|
+
a || p();
|
|
31
|
+
}, []);
|
|
32
|
+
return c ? /* @__PURE__ */ r(i.Provider, { value: { open: o, onOpenChange: d, onClosed: f }, children: /* @__PURE__ */ r(l, { data: c, close: p }) }) : null;
|
|
33
|
+
}, i = g(null), S = () => {
|
|
34
|
+
const t = C(i);
|
|
35
|
+
if (!t)
|
|
36
|
+
throw new Error("Dialog context not provided");
|
|
37
|
+
return t;
|
|
38
|
+
}, b = ({ children: t, ...e }) => {
|
|
39
|
+
const n = S();
|
|
40
|
+
return /* @__PURE__ */ r(D, { ...n, ...e, children: t });
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
b as DialogShell,
|
|
44
|
+
$ as createDialogsRegistry
|
|
45
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as m } from "./bundle.es10.js";
|
|
3
|
+
const i = (o) => {
|
|
4
|
+
const r = {};
|
|
5
|
+
for (const t in o)
|
|
6
|
+
r[t] = ({ data: e, ...n }) => /* @__PURE__ */ c(m, { content: ({ close: s }) => o[t]({ data: e, close: s }), ...n });
|
|
7
|
+
return r;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
i as createPopoversRegistry
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const _ = (e) => {
|
|
2
|
+
if (e <= 16)
|
|
3
|
+
return 5;
|
|
4
|
+
if (e <= 24)
|
|
5
|
+
return 8;
|
|
6
|
+
if (e <= 32)
|
|
7
|
+
return 10;
|
|
8
|
+
if (e <= 36)
|
|
9
|
+
return 13;
|
|
10
|
+
if (e <= 44)
|
|
11
|
+
return 14;
|
|
12
|
+
if (e <= 48)
|
|
13
|
+
return 17;
|
|
14
|
+
if (e < 56)
|
|
15
|
+
return 18;
|
|
16
|
+
if (e <= 64)
|
|
17
|
+
return 21;
|
|
18
|
+
if (e <= 88)
|
|
19
|
+
return 26;
|
|
20
|
+
if (e <= 96)
|
|
21
|
+
return 30;
|
|
22
|
+
const n = Math.ceil(e * 0.3125), E = n % 2;
|
|
23
|
+
return n + E;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
_ as getInitialsFontSize
|
|
27
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRef as s, useCallback as c } from "react";
|
|
2
|
+
const p = () => {
|
|
3
|
+
const t = s(null), r = s({ cb: null }), i = c(() => {
|
|
4
|
+
if (t.current && t.current.parentElement) {
|
|
5
|
+
const e = t.current.parentElement, u = e.style.getPropertyValue("--radix-popper-anchor-width"), n = e.style.getPropertyValue("transform"), o = new MutationObserver(() => {
|
|
6
|
+
e.style.transform !== n && e.style.setProperty("transform", n);
|
|
7
|
+
});
|
|
8
|
+
o.observe(e, {
|
|
9
|
+
attributes: !0,
|
|
10
|
+
attributeFilter: ["style"]
|
|
11
|
+
}), r.current.cb = () => {
|
|
12
|
+
o.disconnect();
|
|
13
|
+
}, t.current.style.setProperty("--radix-popover-trigger-width", u);
|
|
14
|
+
}
|
|
15
|
+
}, []), l = c(() => {
|
|
16
|
+
r.current.cb && (r.current.cb(), r.current.cb = null);
|
|
17
|
+
}, []);
|
|
18
|
+
return {
|
|
19
|
+
popoverRef: t,
|
|
20
|
+
handleAnimationEnd: l,
|
|
21
|
+
froozePopoverPosition: i
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
p as useFroozeClosing
|
|
26
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs as o, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import A from "classnames";
|
|
3
|
+
import { attr as l } from "@companix/utils-browser";
|
|
4
|
+
import { forwardRef as y, useRef as S, useCallback as T } from "react";
|
|
5
|
+
import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
|
|
6
|
+
import { mergeRefs as w } from "react-merge-refs";
|
|
7
|
+
import { SelectRightElements as z } from "./bundle.es56.js";
|
|
8
|
+
const V = y(
|
|
9
|
+
({
|
|
10
|
+
required: a,
|
|
11
|
+
size: u,
|
|
12
|
+
fill: d,
|
|
13
|
+
leftElement: s,
|
|
14
|
+
className: m,
|
|
15
|
+
value: n,
|
|
16
|
+
clearButton: f,
|
|
17
|
+
placeholder: p,
|
|
18
|
+
clearButtonIcon: h,
|
|
19
|
+
disabled: r,
|
|
20
|
+
onClear: C,
|
|
21
|
+
inputRef: I,
|
|
22
|
+
...i
|
|
23
|
+
}, k) => {
|
|
24
|
+
const e = S(null), N = T(
|
|
25
|
+
(t) => {
|
|
26
|
+
if (!e.current || !document)
|
|
27
|
+
return;
|
|
28
|
+
t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
|
|
29
|
+
},
|
|
30
|
+
[e]
|
|
31
|
+
), v = (t) => {
|
|
32
|
+
document && document.activeElement === e.current && t.preventDefault();
|
|
33
|
+
}, F = (t) => {
|
|
34
|
+
r || N(t);
|
|
35
|
+
}, g = (t) => {
|
|
36
|
+
v(t);
|
|
37
|
+
}, R = (t) => {
|
|
38
|
+
e.current && e.current.focus(), C?.(t);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ o(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
ref: k,
|
|
44
|
+
className: A("form select", m),
|
|
45
|
+
"data-size": u ?? "md",
|
|
46
|
+
"data-fill": l(d),
|
|
47
|
+
"data-required": l(a),
|
|
48
|
+
"data-disabled": l(r),
|
|
49
|
+
onMouseDown: g,
|
|
50
|
+
...i,
|
|
51
|
+
onClick: F,
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
|
|
54
|
+
s && /* @__PURE__ */ c("div", { className: "select-element", children: s }),
|
|
55
|
+
/* @__PURE__ */ c("div", { className: "select-content", children: /* @__PURE__ */ o("div", { className: "select-content-text", "aria-disabled": r, children: [
|
|
56
|
+
!n && /* @__PURE__ */ c("span", { className: "select-placeholder", children: p }),
|
|
57
|
+
n
|
|
58
|
+
] }) }),
|
|
59
|
+
/* @__PURE__ */ c("div", { className: "select-element", children: /* @__PURE__ */ c(
|
|
60
|
+
z,
|
|
61
|
+
{
|
|
62
|
+
clearButton: f,
|
|
63
|
+
value: !!n,
|
|
64
|
+
clearButtonIcon: h,
|
|
65
|
+
onClear: R
|
|
66
|
+
}
|
|
67
|
+
) })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ c(j, { asChild: !0, children: /* @__PURE__ */ c(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
ref: w([I, e]),
|
|
73
|
+
autoComplete: "off",
|
|
74
|
+
autoCapitalize: "none",
|
|
75
|
+
autoCorrect: "off",
|
|
76
|
+
spellCheck: "false",
|
|
77
|
+
"aria-autocomplete": "none",
|
|
78
|
+
onClick: i.onClick,
|
|
79
|
+
readOnly: !0
|
|
80
|
+
}
|
|
81
|
+
) })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
export {
|
|
88
|
+
V as SelectInput
|
|
89
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useRef as u, useCallback as T } from "react";
|
|
2
|
+
const g = () => {
|
|
3
|
+
const l = u(null), t = u(null);
|
|
4
|
+
return { scrollToElement: T(
|
|
5
|
+
(r, f) => {
|
|
6
|
+
const o = l.current, s = t.current;
|
|
7
|
+
if (!o || !s || r < 0 || r > s.children.length)
|
|
8
|
+
return;
|
|
9
|
+
const c = s.children[r];
|
|
10
|
+
if (!c)
|
|
11
|
+
return;
|
|
12
|
+
const n = o.offsetHeight, i = o.scrollTop, e = c.offsetTop, p = c.offsetHeight;
|
|
13
|
+
f === "center" ? o.scrollTop = e - n / 2 + p / 2 : f === "top" ? o.scrollTop = e : e + p > n + i ? o.scrollTop = e - n + p : e < i && (o.scrollTop = e);
|
|
14
|
+
},
|
|
15
|
+
[t, l]
|
|
16
|
+
), scrollBoxRef: l, optionsWrapperRef: t };
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
g as useScrollListController
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as a } from "react";
|
|
3
|
+
import { OptionItem as f } from "./bundle.es14.js";
|
|
4
|
+
import { OptionsList as O } from "./bundle.es16.js";
|
|
5
|
+
const h = (t) => {
|
|
6
|
+
const { active: i, onOpened: m, scrollboxRef: n, optionsWrapperRef: r, options: p, onSelect: s, minimalOptions: c } = t;
|
|
7
|
+
return a(() => {
|
|
8
|
+
m?.();
|
|
9
|
+
}, []), /* @__PURE__ */ o(O, { scrollboxRef: n, optionsWrapperRef: r, maxHeight: 300, children: p.map((e, l) => /* @__PURE__ */ o(
|
|
10
|
+
f,
|
|
11
|
+
{
|
|
12
|
+
active: i === e.value,
|
|
13
|
+
onClick: () => s?.(e.value),
|
|
14
|
+
minimal: c,
|
|
15
|
+
...e
|
|
16
|
+
},
|
|
17
|
+
`select-option-${l}`
|
|
18
|
+
)) });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
h as SelectOptions
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useCallback as i } from "react";
|
|
3
|
+
import c from "react-input-mask";
|
|
4
|
+
const I = m(
|
|
5
|
+
({ mask: r, maskChar: f = "_", onChange: n, onValueChange: o, ...a }, e) => {
|
|
6
|
+
const p = i(
|
|
7
|
+
(t) => {
|
|
8
|
+
n?.(t), o?.(t.target.value, t.target);
|
|
9
|
+
},
|
|
10
|
+
[n, o]
|
|
11
|
+
);
|
|
12
|
+
return r ? /* @__PURE__ */ u(
|
|
13
|
+
c,
|
|
14
|
+
{
|
|
15
|
+
inputRef: e,
|
|
16
|
+
mask: r,
|
|
17
|
+
maskChar: f,
|
|
18
|
+
onChange: p,
|
|
19
|
+
...a
|
|
20
|
+
}
|
|
21
|
+
) : /* @__PURE__ */ u("input", { ref: e, ...a, onChange: p });
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
export {
|
|
25
|
+
I as InputElement
|
|
26
|
+
};
|