@companix/uikit 0.0.2 → 0.0.4
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/Button/index.d.ts +20 -0
- package/dist/ButtonGroup/index.d.ts +7 -0
- package/dist/Checkbox/index.d.ts +10 -0
- package/dist/Countdown/index.d.ts +7 -0
- package/dist/DateInput/index.d.ts +13 -0
- package/dist/DatePicker/Calendar.d.ts +14 -0
- package/dist/DatePicker/CalendarHeader.d.ts +10 -0
- package/dist/DatePicker/index.d.ts +12 -0
- package/dist/Dialog/index.d.ts +12 -0
- package/dist/DialogAlert/Alert.d.ts +19 -0
- package/dist/DialogAlert/Viewport.d.ts +8 -0
- package/dist/DialogAlert/index.d.ts +11 -0
- package/dist/Drawer/index.d.ts +13 -0
- package/dist/File/index.d.ts +10 -0
- package/dist/Form/index.d.ts +17 -0
- package/dist/Icon/index.d.ts +7 -0
- package/dist/LoadButton/index.d.ts +5 -0
- package/dist/NumberInput/index.d.ts +6 -0
- package/dist/OptionItem/OptionItem.d.ts +7 -0
- package/dist/OptionItem/OptionsList.d.ts +8 -0
- package/dist/Popover/index.d.ts +26 -0
- package/dist/Radio/index.d.ts +20 -0
- package/dist/Scrollable/ImitateScroll.d.ts +10 -0
- package/dist/Scrollable/index.d.ts +33 -0
- package/dist/Select/SelectInput.d.ts +14 -0
- package/dist/Select/index.d.ts +15 -0
- package/dist/SelectTags/index.d.ts +15 -0
- package/dist/Spinner/index.d.ts +8 -0
- package/dist/Stepper/index.d.ts +8 -0
- package/dist/Switch/index.d.ts +10 -0
- package/dist/Tabs/index.d.ts +13 -0
- package/dist/TextArea/index.d.ts +7 -0
- package/dist/Toaster/RemoveListener.d.ts +3 -0
- package/dist/Toaster/Toast.d.ts +9 -0
- package/dist/Toaster/Viewport.d.ts +13 -0
- package/dist/Toaster/index.d.ts +15 -0
- package/dist/Tooltip/index.d.ts +8 -0
- package/dist/__hooks/use-frooze-closing.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-stepper-input.d.ts +13 -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/utils.d.ts +25 -0
- package/dist/bundle.es.js +58 -0
- package/dist/bundle.es10.js +38 -0
- package/dist/bundle.es11.js +33 -0
- package/dist/bundle.es12.js +18 -0
- package/dist/bundle.es13.js +10 -0
- package/dist/bundle.es14.js +35 -0
- package/dist/bundle.es15.js +27 -0
- package/dist/bundle.es16.js +23 -0
- package/dist/bundle.es17.js +24 -0
- package/dist/bundle.es18.js +15 -0
- package/dist/bundle.es19.js +40 -0
- package/dist/bundle.es2.js +45 -0
- package/dist/bundle.es20.js +18 -0
- package/dist/bundle.es21.js +36 -0
- package/dist/bundle.es22.js +23 -0
- package/dist/bundle.es23.js +42 -0
- package/dist/bundle.es24.js +113 -0
- package/dist/bundle.es25.js +114 -0
- package/dist/bundle.es26.js +38 -0
- package/dist/bundle.es27.js +13 -0
- package/dist/bundle.es28.js +27 -0
- package/dist/bundle.es29.js +38 -0
- package/dist/bundle.es3.js +13 -0
- package/dist/bundle.es30.js +26 -0
- package/dist/bundle.es31.js +83 -0
- package/dist/bundle.es32.js +20 -0
- package/dist/bundle.es33.js +16 -0
- package/dist/bundle.es34.js +24 -0
- package/dist/bundle.es35.js +7 -0
- package/dist/bundle.es36.js +23 -0
- package/dist/bundle.es37.js +16 -0
- package/dist/bundle.es38.js +72 -0
- package/dist/bundle.es39.js +70 -0
- package/dist/bundle.es4.js +87 -0
- package/dist/bundle.es40.js +34 -0
- package/dist/bundle.es41.js +70 -0
- package/dist/bundle.es42.js +33 -0
- package/dist/bundle.es43.js +77 -0
- package/dist/bundle.es44.js +51 -0
- package/dist/bundle.es45.js +45 -0
- package/dist/bundle.es5.js +87 -0
- package/dist/bundle.es6.js +80 -0
- package/dist/bundle.es7.js +28 -0
- package/dist/bundle.es8.js +87 -0
- package/dist/bundle.es9.js +75 -0
- package/dist/index.d.ts +30 -0
- package/{src → dist}/index.scss +3 -0
- package/{src → dist}/mixins.scss +4 -3
- package/{src → dist}/theme.scss +0 -2
- package/dist/types.d.ts +13 -0
- package/package.json +10 -6
- package/.eslintrc +0 -54
- package/declaration.d.ts +0 -4
- package/index.html +0 -12
- package/playground/App.tsx +0 -166
- package/playground/Example.tsx +0 -14
- package/playground/Test.tsx +0 -44
- package/playground/animation-test-1/index.scss +0 -20
- package/playground/animation-test-1/index.tsx +0 -17
- package/playground/animation-test-2/index.scss +0 -62
- package/playground/animation-test-2/index.tsx +0 -32
- package/playground/bootstrap.tsx +0 -19
- package/playground/buttons/index.tsx +0 -132
- package/playground/checkbox/index.tsx +0 -64
- package/playground/date-input/index.tsx +0 -45
- package/playground/date-picker/index.tsx +0 -41
- package/playground/dialog/index.tsx +0 -92
- package/playground/dialog-alert/index.tsx +0 -47
- package/playground/drawer/index.tsx +0 -55
- package/playground/index.css +0 -33
- package/playground/index.scss +0 -270
- package/playground/input/index.tsx +0 -112
- package/playground/number-inputs/index.tsx +0 -50
- package/playground/popovers/index.tsx +0 -70
- package/playground/radio-group/index.tsx +0 -69
- package/playground/select/index.tsx +0 -72
- package/playground/select-tags/index.tsx +0 -36
- package/playground/styles.scss +0 -2
- package/playground/switch/index.tsx +0 -44
- package/playground/tabs/index.tsx +0 -16
- package/playground/test.scss +0 -0
- package/playground/text-area/index.tsx +0 -17
- package/playground/text-input/index.tsx +0 -12
- package/playground/toaster/index.tsx +0 -156
- package/playground/tooltip/index.tsx +0 -26
- package/src/Button/index.tsx +0 -72
- package/src/ButtonGroup/index.tsx +0 -20
- package/src/Checkbox/index.tsx +0 -46
- package/src/Countdown/index.tsx +0 -54
- package/src/DateInput/index.tsx +0 -96
- package/src/DatePicker/Calendar.tsx +0 -157
- package/src/DatePicker/CalendarHeader.tsx +0 -139
- package/src/DatePicker/index.tsx +0 -177
- package/src/Dialog/index.tsx +0 -31
- package/src/DialogAlert/Alert.tsx +0 -78
- package/src/DialogAlert/Viewport.tsx +0 -52
- package/src/DialogAlert/index.tsx +0 -37
- package/src/Drawer/index.tsx +0 -46
- package/src/File/index.tsx +0 -60
- package/src/Form/index.tsx +0 -131
- package/src/Icon/index.tsx +0 -43
- package/src/LoadButton/index.tsx +0 -17
- package/src/NumberInput/index.tsx +0 -74
- package/src/OptionItem/OptionItem.tsx +0 -49
- package/src/OptionItem/OptionsList.tsx +0 -26
- package/src/Popover/index.tsx +0 -117
- package/src/Radio/index.tsx +0 -68
- package/src/Scrollable/ImitateScroll.tsx +0 -141
- package/src/Scrollable/index.tsx +0 -141
- package/src/Select/SelectInput.tsx +0 -131
- package/src/Select/index.tsx +0 -134
- package/src/SelectTags/index.tsx +0 -192
- package/src/Spinner/index.tsx +0 -19
- package/src/Stepper/index.tsx +0 -76
- package/src/Switch/index.tsx +0 -49
- package/src/Tabs/index.tsx +0 -89
- package/src/TextArea/index.tsx +0 -51
- package/src/Toaster/RemoveListener.tsx +0 -11
- package/src/Toaster/Toast.tsx +0 -69
- package/src/Toaster/Viewport.tsx +0 -117
- package/src/Toaster/index.tsx +0 -52
- package/src/Tooltip/index.tsx +0 -33
- package/src/__hooks/use-frooze-closing.ts +0 -51
- package/src/__hooks/use-loading.ts +0 -34
- package/src/__hooks/use-local-storage.ts +0 -19
- package/src/__hooks/use-popover-position.ts +0 -24
- package/src/__hooks/use-previos.ts +0 -25
- package/src/__hooks/use-resize.ts +0 -41
- package/src/__hooks/use-scrollbox.ts +0 -45
- package/src/__hooks/use-stepper-input.ts +0 -82
- package/src/__hooks/use-update.ts +0 -19
- package/src/__hooks/useCalendar.ts +0 -104
- package/src/__hooks/useCalendarOptions-copy.ts +0 -87
- package/src/__hooks/useCalendarOptions.ts +0 -68
- package/src/__libs/calendar.ts +0 -175
- package/src/__utils/utils.ts +0 -137
- package/src/index.ts +0 -36
- package/src/types.ts +0 -14
- package/tailwind.config.js +0 -91
- package/themes/classic/animations.scss +0 -179
- package/themes/classic/classic.scss +0 -493
- package/tsconfig.json +0 -27
- package/vite.build.ts +0 -35
- package/vite.config.ts +0 -33
- /package/{src → dist}/Button/Button.scss +0 -0
- /package/{src → dist}/ButtonGroup/ButtonGroup.scss +0 -0
- /package/{src → dist}/Checkbox/Checkbox.scss +0 -0
- /package/{src → dist}/DateInput/DateInput.scss +0 -0
- /package/{src → dist}/DatePicker/Calendar.scss +0 -0
- /package/{src → dist}/DatePicker/DatePicker.scss +0 -0
- /package/{src → dist}/Dialog/Dialog.scss +0 -0
- /package/{src → dist}/Dialog/Popup.scss +0 -0
- /package/{src → dist}/DialogAlert/Alert.scss +0 -0
- /package/{src → dist}/Drawer/Drawer.scss +0 -0
- /package/{src → dist}/Form/Form.scss +0 -0
- /package/{src → dist}/Form/Input.scss +0 -0
- /package/{src → dist}/Icon/icon.scss +0 -0
- /package/{src → dist}/OptionItem/Option.scss +0 -0
- /package/{src → dist}/Popover/Popover.scss +0 -0
- /package/{src → dist}/Radio/Radio.scss +0 -0
- /package/{src → dist}/Scrollable/Scrollable.scss +0 -0
- /package/{src → dist}/Select/Select.scss +0 -0
- /package/{src → dist}/SelectTags/SelectTags.scss +0 -0
- /package/{src → dist}/Spinner/Spinner.scss +0 -0
- /package/{src → dist}/Stepper/StepperInput.scss +0 -0
- /package/{src → dist}/Switch/Switch.scss +0 -0
- /package/{src → dist}/Tabs/Tabs.scss +0 -0
- /package/{src → dist}/TextArea/TextArea.scss +0 -0
- /package/{src → dist}/Toaster/Toaster.scss +0 -0
- /package/{src → dist}/Tooltip/Tooltip.scss +0 -0
- /package/{src/css.scss → dist/css-properties.scss} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useFroozeClosing as F } from "./bundle.es30.js";
|
|
3
|
+
import { Popover as I } from "./bundle.es6.js";
|
|
4
|
+
import { OptionItem as L } from "./bundle.es10.js";
|
|
5
|
+
import { OptionsList as M } from "./bundle.es12.js";
|
|
6
|
+
import { useState as j, useRef as d, useMemo as h } from "react";
|
|
7
|
+
import { Icon as g } from "./bundle.es34.js";
|
|
8
|
+
import { faClose as V, faChevronDown as B } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
import { attr as H, getActiveElementByAnotherElement as Q, contains as q } from "@companix/utils-browser";
|
|
10
|
+
const ee = (v) => {
|
|
11
|
+
const {
|
|
12
|
+
options: r,
|
|
13
|
+
closeAfterSelect: x,
|
|
14
|
+
placeholder: C,
|
|
15
|
+
onChange: l,
|
|
16
|
+
emptyText: N = "Ничего не найдено",
|
|
17
|
+
readOnly: m,
|
|
18
|
+
size: z = "md",
|
|
19
|
+
value: n,
|
|
20
|
+
disabled: f
|
|
21
|
+
} = v, [a, A] = j(""), i = d(null), y = d(null), { popoverRef: u, froozePopoverPosition: D, handleAnimationEnd: R } = F(), b = h(() => {
|
|
22
|
+
const e = {};
|
|
23
|
+
return r.forEach((t) => {
|
|
24
|
+
e[t.value] = t;
|
|
25
|
+
}), e;
|
|
26
|
+
}, [r]), w = (e) => n.includes(e) ? [...n] : [...n, e], E = (e) => n.filter((t) => e !== t), O = (e, t) => {
|
|
27
|
+
x ? (D(), l(e), t()) : l(e);
|
|
28
|
+
}, p = h(() => a.trim() ? r.filter(({ title: e }) => {
|
|
29
|
+
const t = e.toLowerCase(), s = a.trim().toLowerCase();
|
|
30
|
+
return t.indexOf(s) >= 0;
|
|
31
|
+
}) : r, [a, r]), P = (e) => {
|
|
32
|
+
if (f) return;
|
|
33
|
+
u.current && u.current.getAttribute("data-state") === "open" && e.preventDefault();
|
|
34
|
+
const t = Q(e.currentTarget);
|
|
35
|
+
e.defaultPrevented || q(e.currentTarget, t) || i.current && i.current.focus();
|
|
36
|
+
}, T = (e) => {
|
|
37
|
+
e.target !== i.current && e.preventDefault();
|
|
38
|
+
}, k = (e, t) => {
|
|
39
|
+
e.stopPropagation(), l(E(t));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ o(
|
|
42
|
+
I,
|
|
43
|
+
{
|
|
44
|
+
minimal: !0,
|
|
45
|
+
ref: u,
|
|
46
|
+
sideOffset: 0,
|
|
47
|
+
matchTarget: "width",
|
|
48
|
+
onAnimationEnd: R,
|
|
49
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
50
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
51
|
+
content: ({ close: e }) => /* @__PURE__ */ c(M, { maxHeight: 300, children: [
|
|
52
|
+
p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: N }),
|
|
53
|
+
p.map(({ value: t, title: s, icon: S }, $) => /* @__PURE__ */ o(
|
|
54
|
+
L,
|
|
55
|
+
{
|
|
56
|
+
active: n.includes(t),
|
|
57
|
+
onClick: () => O(w(t), e),
|
|
58
|
+
title: s,
|
|
59
|
+
icon: S
|
|
60
|
+
},
|
|
61
|
+
`option-item-${t}-${$}`
|
|
62
|
+
))
|
|
63
|
+
] }),
|
|
64
|
+
children: /* @__PURE__ */ o(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: "form",
|
|
68
|
+
onClick: P,
|
|
69
|
+
onMouseDown: T,
|
|
70
|
+
"data-size": z,
|
|
71
|
+
children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
|
|
72
|
+
/* @__PURE__ */ c("div", { className: "select-tags", children: [
|
|
73
|
+
n.length > 0 && /* @__PURE__ */ o(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: "tag-container",
|
|
77
|
+
ref: y,
|
|
78
|
+
role: "listbox",
|
|
79
|
+
"data-readonly": H(m),
|
|
80
|
+
children: n.map((e, t) => /* @__PURE__ */ c("div", { className: "tag", children: [
|
|
81
|
+
/* @__PURE__ */ o("span", { className: "tag-name", children: b[e].title }),
|
|
82
|
+
/* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => k(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: V, size: "xxxs" }) })
|
|
83
|
+
] }, `tag-option-${e}-${t}`))
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
(!m || n.length === 0) && /* @__PURE__ */ o(
|
|
87
|
+
"input",
|
|
88
|
+
{
|
|
89
|
+
ref: i,
|
|
90
|
+
type: "text",
|
|
91
|
+
autoCapitalize: "none",
|
|
92
|
+
autoComplete: "off",
|
|
93
|
+
autoCorrect: "off",
|
|
94
|
+
className: "form-input",
|
|
95
|
+
spellCheck: !1,
|
|
96
|
+
value: a,
|
|
97
|
+
disabled: f,
|
|
98
|
+
readOnly: m,
|
|
99
|
+
placeholder: C,
|
|
100
|
+
onChange: ({ target: e }) => A(e.value)
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ o(g, { className: "expand-icon", icon: B, size: "xxxs" })
|
|
105
|
+
] })
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
export {
|
|
112
|
+
ee as SelectTags
|
|
113
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as l, jsxs as O, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as z } from "./bundle.es6.js";
|
|
3
|
+
import { Form as Y } from "./bundle.es9.js";
|
|
4
|
+
import { faClose as E, faChevronDown as S } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
+
import { Icon as F } from "./bundle.es34.js";
|
|
6
|
+
import { useState as _, useRef as q } from "react";
|
|
7
|
+
import { Calendar as G } from "./bundle.es38.js";
|
|
8
|
+
import { useDayDisableCheker as H } from "./bundle.es39.js";
|
|
9
|
+
import { formatTime as I, getNum as d } from "@companix/utils-js";
|
|
10
|
+
const h = (t, i = "-") => {
|
|
11
|
+
if (t) {
|
|
12
|
+
const n = I(t.getDate()), r = I(t.getMonth() + 1), s = t.getFullYear();
|
|
13
|
+
return [n, r, s].join(i);
|
|
14
|
+
}
|
|
15
|
+
return "";
|
|
16
|
+
}, y = (t, i = "-") => {
|
|
17
|
+
const n = t.split(i);
|
|
18
|
+
if (n.length === 3) {
|
|
19
|
+
const [r, s, a] = [d(n[0]), d(n[1]), d(n[2])];
|
|
20
|
+
if (r && s && a) {
|
|
21
|
+
const o = new Date(a, s - 1, r);
|
|
22
|
+
if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === s - 1)
|
|
23
|
+
return o;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}, te = (t) => {
|
|
28
|
+
const {
|
|
29
|
+
minimalOptions: i,
|
|
30
|
+
clearButton: n,
|
|
31
|
+
clearButtonIcon: r,
|
|
32
|
+
children: s,
|
|
33
|
+
disabled: a,
|
|
34
|
+
// calendar props
|
|
35
|
+
value: o,
|
|
36
|
+
enableTime: P,
|
|
37
|
+
disablePickers: v,
|
|
38
|
+
showNeighboringMonth: A,
|
|
39
|
+
onChange: u,
|
|
40
|
+
shouldDisableDate: g,
|
|
41
|
+
viewDate: N,
|
|
42
|
+
disablePast: D,
|
|
43
|
+
disableFuture: C,
|
|
44
|
+
minDateTime: b,
|
|
45
|
+
maxDateTime: x,
|
|
46
|
+
// input props
|
|
47
|
+
...T
|
|
48
|
+
} = t, [m, c] = _(() => h(o ?? null)), p = q(null), k = H({
|
|
49
|
+
disableFuture: C,
|
|
50
|
+
disablePast: D,
|
|
51
|
+
shouldDisableDate: g,
|
|
52
|
+
minDateTime: b,
|
|
53
|
+
maxDateTime: x
|
|
54
|
+
}), w = (e) => {
|
|
55
|
+
a || p.current && p.current.getAttribute("data-state") === "open" && e.preventDefault();
|
|
56
|
+
}, B = (e) => {
|
|
57
|
+
e.stopPropagation(), c(""), u?.(null);
|
|
58
|
+
}, V = (e) => {
|
|
59
|
+
c(e);
|
|
60
|
+
const f = y(e);
|
|
61
|
+
f && !k(f) && u?.(f);
|
|
62
|
+
}, j = () => {
|
|
63
|
+
const e = y(m);
|
|
64
|
+
(!e || k(e)) && c(h(o ?? null));
|
|
65
|
+
}, M = (e) => {
|
|
66
|
+
u?.(e), c(h(e));
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ l(
|
|
69
|
+
z,
|
|
70
|
+
{
|
|
71
|
+
minimal: !0,
|
|
72
|
+
ref: p,
|
|
73
|
+
sideOffset: 0,
|
|
74
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
75
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
76
|
+
disabled: a,
|
|
77
|
+
content: () => /* @__PURE__ */ l(
|
|
78
|
+
G,
|
|
79
|
+
{
|
|
80
|
+
value: o,
|
|
81
|
+
disablePast: D,
|
|
82
|
+
disableFuture: C,
|
|
83
|
+
enableTime: P,
|
|
84
|
+
disablePickers: v,
|
|
85
|
+
showNeighboringMonth: A,
|
|
86
|
+
onChange: M,
|
|
87
|
+
shouldDisableDate: g,
|
|
88
|
+
viewDate: N,
|
|
89
|
+
minDateTime: b,
|
|
90
|
+
maxDateTime: x
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
children: /* @__PURE__ */ l(
|
|
94
|
+
Y,
|
|
95
|
+
{
|
|
96
|
+
...T,
|
|
97
|
+
value: m,
|
|
98
|
+
disabled: a,
|
|
99
|
+
onClick: w,
|
|
100
|
+
onValueChange: V,
|
|
101
|
+
onBlur: j,
|
|
102
|
+
mask: "99-99-9999",
|
|
103
|
+
rightElement: /* @__PURE__ */ O(R, { children: [
|
|
104
|
+
n && J(m) && /* @__PURE__ */ l("button", { className: "select-close-button", onClick: B, children: r ?? /* @__PURE__ */ l(F, { className: "select-close-icon", icon: E, size: "xxxs" }) }),
|
|
105
|
+
/* @__PURE__ */ l(F, { className: "expand-icon select-expand", icon: S, size: "xxxs" })
|
|
106
|
+
] })
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}, J = (t) => t.trim().replaceAll("-", "").replaceAll("_", "");
|
|
112
|
+
export {
|
|
113
|
+
te as DatePicker
|
|
114
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { VisuallyHidden as s } from "@radix-ui/react-visually-hidden";
|
|
3
|
+
import { useRef as p } from "react";
|
|
4
|
+
const d = ({
|
|
5
|
+
onChange: n,
|
|
6
|
+
disabled: r,
|
|
7
|
+
mimes: l,
|
|
8
|
+
children: a,
|
|
9
|
+
multiple: i,
|
|
10
|
+
className: f
|
|
11
|
+
}) => {
|
|
12
|
+
const e = p(null), u = (t) => {
|
|
13
|
+
r || (t.target.files && n?.(Array.from(t.target.files)), e.current && (e.current.value = ""));
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ c("label", { className: f, children: [
|
|
16
|
+
a,
|
|
17
|
+
/* @__PURE__ */ o(s, { asChild: !0, children: /* @__PURE__ */ o(
|
|
18
|
+
"input",
|
|
19
|
+
{
|
|
20
|
+
ref: e,
|
|
21
|
+
hidden: !0,
|
|
22
|
+
type: "file",
|
|
23
|
+
autoComplete: "off",
|
|
24
|
+
autoCapitalize: "none",
|
|
25
|
+
autoCorrect: "off",
|
|
26
|
+
spellCheck: "false",
|
|
27
|
+
"aria-autocomplete": "none",
|
|
28
|
+
multiple: i,
|
|
29
|
+
accept: (l ?? []).join(", "),
|
|
30
|
+
onChange: u,
|
|
31
|
+
disabled: r
|
|
32
|
+
}
|
|
33
|
+
) })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
d as FileOverlay
|
|
38
|
+
};
|
|
@@ -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.es40.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,38 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { hash as d } from "@companix/utils-js";
|
|
3
|
+
import { Viewport as s } from "./bundle.es41.js";
|
|
4
|
+
import { useRef as c, useMemo as l } from "react";
|
|
5
|
+
const f = (i = {}) => {
|
|
6
|
+
const t = {
|
|
7
|
+
emit: (e) => {
|
|
8
|
+
console.error("uninitialized", e);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
send: (e) => {
|
|
13
|
+
t.emit({ ...e, id: d() });
|
|
14
|
+
},
|
|
15
|
+
Viewport: (e = {}) => {
|
|
16
|
+
const n = c(null);
|
|
17
|
+
return l(() => {
|
|
18
|
+
t.emit = (r) => {
|
|
19
|
+
n.current && n.current.addToast(r);
|
|
20
|
+
};
|
|
21
|
+
}, []), /* @__PURE__ */ a(
|
|
22
|
+
s,
|
|
23
|
+
{
|
|
24
|
+
ref: n,
|
|
25
|
+
align: e.align ?? i.align,
|
|
26
|
+
closeIcon: e.closeIcon ?? i.closeIcon,
|
|
27
|
+
duration: e.duration ?? i.duration,
|
|
28
|
+
gap: e.gap ?? i.gap,
|
|
29
|
+
side: e.side ?? i.side,
|
|
30
|
+
swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
f as createToaster
|
|
38
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import n from "classnames";
|
|
3
|
+
const d = ({ size: r = 40, className: t, width: e = 4, color: i = "inherit" }) => /* @__PURE__ */ o(
|
|
4
|
+
"div",
|
|
5
|
+
{
|
|
6
|
+
style: { width: `${r}px`, height: `${r}px`, color: i, borderWidth: `${e}px` },
|
|
7
|
+
className: n("spinner-border", t),
|
|
8
|
+
role: "status"
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
d as Spinner
|
|
13
|
+
};
|
|
@@ -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,83 @@
|
|
|
1
|
+
import { jsxs as n, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import { attr as r } from "@companix/utils-browser";
|
|
4
|
+
import { forwardRef as g, useRef as w, useCallback as y } from "react";
|
|
5
|
+
import { Icon as a } from "./bundle.es34.js";
|
|
6
|
+
import { faClose as D, faChevronDown as R } from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
import { VisuallyHidden as T } from "@radix-ui/react-visually-hidden";
|
|
8
|
+
const V = g(
|
|
9
|
+
({
|
|
10
|
+
required: u,
|
|
11
|
+
size: d,
|
|
12
|
+
fill: m,
|
|
13
|
+
leftElement: l,
|
|
14
|
+
className: p,
|
|
15
|
+
value: o,
|
|
16
|
+
clearButton: f,
|
|
17
|
+
placeholder: C,
|
|
18
|
+
clearButtonIcon: h,
|
|
19
|
+
disabled: s,
|
|
20
|
+
onClear: I,
|
|
21
|
+
...i
|
|
22
|
+
}, N) => {
|
|
23
|
+
const e = w(null), k = y(
|
|
24
|
+
(t) => {
|
|
25
|
+
if (!e.current || !document)
|
|
26
|
+
return;
|
|
27
|
+
t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
|
|
28
|
+
},
|
|
29
|
+
[e]
|
|
30
|
+
), x = (t) => {
|
|
31
|
+
document && document.activeElement === e.current && t.preventDefault();
|
|
32
|
+
}, v = (t) => {
|
|
33
|
+
s || k(t);
|
|
34
|
+
}, F = (t) => {
|
|
35
|
+
x(t);
|
|
36
|
+
}, z = (t) => {
|
|
37
|
+
e.current && e.current.focus(), I?.(t);
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ n(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
ref: N,
|
|
43
|
+
className: b("form select", p),
|
|
44
|
+
"data-size": d ?? "md",
|
|
45
|
+
"data-fill": r(m),
|
|
46
|
+
"data-required": r(u),
|
|
47
|
+
"data-disabled": r(s),
|
|
48
|
+
onMouseDown: F,
|
|
49
|
+
...i,
|
|
50
|
+
onClick: v,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ n("div", { className: "select-layout form-input", children: [
|
|
53
|
+
l && /* @__PURE__ */ c("div", { className: "select-element", children: l }),
|
|
54
|
+
/* @__PURE__ */ c("div", { className: "select-content", children: /* @__PURE__ */ n("div", { className: "select-content-text", "aria-disabled": s, children: [
|
|
55
|
+
!o && /* @__PURE__ */ c("span", { className: "select-placeholder", children: C }),
|
|
56
|
+
o
|
|
57
|
+
] }) }),
|
|
58
|
+
/* @__PURE__ */ n("div", { className: "select-element", children: [
|
|
59
|
+
f && o && /* @__PURE__ */ c("button", { className: "select-close-button", onClick: z, children: h ?? /* @__PURE__ */ c(a, { className: "select-close-icon", icon: D, size: "xxxs" }) }),
|
|
60
|
+
/* @__PURE__ */ c(a, { className: "expand-icon select-expand", icon: R, size: "xxxs" })
|
|
61
|
+
] })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ c(T, { asChild: !0, children: /* @__PURE__ */ c(
|
|
64
|
+
"input",
|
|
65
|
+
{
|
|
66
|
+
ref: e,
|
|
67
|
+
autoComplete: "off",
|
|
68
|
+
autoCapitalize: "none",
|
|
69
|
+
autoCorrect: "off",
|
|
70
|
+
spellCheck: "false",
|
|
71
|
+
"aria-autocomplete": "none",
|
|
72
|
+
onClick: i.onClick,
|
|
73
|
+
readOnly: !0
|
|
74
|
+
}
|
|
75
|
+
) })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
export {
|
|
82
|
+
V as SelectInput
|
|
83
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useRef as i, useCallback as T } from "react";
|
|
2
|
+
const a = () => {
|
|
3
|
+
const t = i(null), l = i(null);
|
|
4
|
+
return { scrollToElement: T(
|
|
5
|
+
(r, u = !1) => {
|
|
6
|
+
const o = t.current, s = l.current;
|
|
7
|
+
if (!o || !s || r < 0 || r > s.children.length)
|
|
8
|
+
return;
|
|
9
|
+
const n = s.children[r];
|
|
10
|
+
if (!n)
|
|
11
|
+
return;
|
|
12
|
+
const c = o.offsetHeight, f = o.scrollTop, e = n.offsetTop, p = n.offsetHeight;
|
|
13
|
+
u ? o.scrollTop = e - c / 2 + p / 2 : e + p > c + f ? o.scrollTop = e - c + p : e < f && (o.scrollTop = e);
|
|
14
|
+
},
|
|
15
|
+
[l, t]
|
|
16
|
+
), scrollBoxRef: t, optionsWrapperRef: l };
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
a as useScrollListController
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useRef as u, useLayoutEffect as f, useEffect as s } from "react";
|
|
2
|
+
const o = (t, r) => {
|
|
3
|
+
const e = u(!1);
|
|
4
|
+
f(() => {
|
|
5
|
+
e.current = !0, t();
|
|
6
|
+
}, []), s(() => {
|
|
7
|
+
if (e.current) {
|
|
8
|
+
e.current = !1;
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
t();
|
|
12
|
+
}, r);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
o as useLayoutAndUpdate
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import f from "classnames";
|
|
3
|
+
import { forwardRef as l } from "react";
|
|
4
|
+
const g = l(
|
|
5
|
+
({ icon: r, className: t, size: i = "m", ...e }, a) => {
|
|
6
|
+
const [n, c, , , m] = r.icon;
|
|
7
|
+
return /* @__PURE__ */ o(
|
|
8
|
+
"svg",
|
|
9
|
+
{
|
|
10
|
+
ref: a,
|
|
11
|
+
"data-prefix": r.prefix,
|
|
12
|
+
"data-icon": r.iconName,
|
|
13
|
+
viewBox: `0 0 ${n} ${c}`,
|
|
14
|
+
className: f(`icon icon-size-${i}`, t),
|
|
15
|
+
...e,
|
|
16
|
+
role: "img",
|
|
17
|
+
children: /* @__PURE__ */ o(s, { paths: m })
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
), s = ({ 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 });
|
|
22
|
+
export {
|
|
23
|
+
g as Icon
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState as a } from "react";
|
|
2
|
+
const l = ({ onClick: i }) => {
|
|
3
|
+
const [e, s] = a({ isLoading: !1, isError: !1 });
|
|
4
|
+
return {
|
|
5
|
+
...e,
|
|
6
|
+
handleClick: (o) => {
|
|
7
|
+
e.isLoading || i(() => s({ isLoading: !0, isError: !1 }), o).then(() => {
|
|
8
|
+
s({
|
|
9
|
+
isLoading: !1,
|
|
10
|
+
isError: !1
|
|
11
|
+
});
|
|
12
|
+
}).catch((r) => {
|
|
13
|
+
console.log(r), s({
|
|
14
|
+
isLoading: !1,
|
|
15
|
+
isError: !0
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
l as useLoading
|
|
23
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useRef as i, useCallback as o } from "react";
|
|
2
|
+
const f = (e, s) => {
|
|
3
|
+
const r = i(null), c = i(void 0), n = o(
|
|
4
|
+
(t) => {
|
|
5
|
+
s && t.offsetParent && (t.style.height = "", t.style.height = `${t.scrollHeight}px`, t.scrollHeight !== c.current && e && (e(t), c.current = t.scrollHeight));
|
|
6
|
+
},
|
|
7
|
+
[s, e]
|
|
8
|
+
), l = o(() => {
|
|
9
|
+
const t = r.current;
|
|
10
|
+
t && n(t);
|
|
11
|
+
}, [r, n]);
|
|
12
|
+
return [r, l];
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
f as useResizeTextarea
|
|
16
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as D, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es42.js";
|
|
3
|
+
import { CalendarHeader as F } from "./bundle.es43.js";
|
|
4
|
+
import { useCalendar as j } from "./bundle.es44.js";
|
|
5
|
+
import { attr as m } from "@companix/utils-browser";
|
|
6
|
+
import { isSameDate as f } from "./bundle.es39.js";
|
|
7
|
+
import { useLayoutEffect as I } from "react";
|
|
8
|
+
const T = ({ disablePickers: c, value: e, onChange: i, ...l }) => {
|
|
9
|
+
const {
|
|
10
|
+
viewDate: n,
|
|
11
|
+
setViewDate: r,
|
|
12
|
+
setNextMonth: N,
|
|
13
|
+
setPrevMonth: x,
|
|
14
|
+
isMonthDisabled: M,
|
|
15
|
+
isYearDisabled: v,
|
|
16
|
+
isDayDisabled: w
|
|
17
|
+
} = j(l);
|
|
18
|
+
I(() => {
|
|
19
|
+
e && r(e);
|
|
20
|
+
}, [e]);
|
|
21
|
+
const o = $(n), h = n.getMonth(), y = n.getFullYear(), C = /* @__PURE__ */ new Date();
|
|
22
|
+
return /* @__PURE__ */ D("div", { className: "calendar", children: [
|
|
23
|
+
/* @__PURE__ */ t(
|
|
24
|
+
F,
|
|
25
|
+
{
|
|
26
|
+
viewDate: n,
|
|
27
|
+
onChange: r,
|
|
28
|
+
onNextMonth: N,
|
|
29
|
+
onPrevMonth: x,
|
|
30
|
+
disablePickers: c,
|
|
31
|
+
isMonthDisabled: M,
|
|
32
|
+
isYearDisabled: v
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ t("div", { className: "calendar-names", children: g.map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-name", children: d }, `week-name-${a}`)) }),
|
|
36
|
+
/* @__PURE__ */ D("div", { className: "calendar-days", children: [
|
|
37
|
+
p(b(u(o.month, o.year))).map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-day", "data-void": !0 }, `void-${d}-${a}`)),
|
|
38
|
+
p(k(o.month, o.year)).map((d, a) => {
|
|
39
|
+
const s = new Date(y, h, a + 1);
|
|
40
|
+
return /* @__PURE__ */ t(
|
|
41
|
+
P,
|
|
42
|
+
{
|
|
43
|
+
day: a + 1,
|
|
44
|
+
disabled: w(s),
|
|
45
|
+
selected: !!(e && f(e, s)),
|
|
46
|
+
today: f(s, C),
|
|
47
|
+
onSelect: () => i?.(s)
|
|
48
|
+
},
|
|
49
|
+
`date-${d}-${y}-${h}-${a}`
|
|
50
|
+
);
|
|
51
|
+
})
|
|
52
|
+
] })
|
|
53
|
+
] });
|
|
54
|
+
}, P = ({ day: c, disabled: e, selected: i, today: l, onSelect: n }) => {
|
|
55
|
+
const r = () => {
|
|
56
|
+
e || n?.();
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ t(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "calendar-day",
|
|
62
|
+
"data-disabled": m(e),
|
|
63
|
+
"data-selected": m(i),
|
|
64
|
+
"data-today": m(l),
|
|
65
|
+
onClick: r,
|
|
66
|
+
children: /* @__PURE__ */ t("span", { className: "calendar-day-number", children: c })
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
T as Calendar
|
|
72
|
+
};
|