@companix/uikit 0.0.64 → 0.0.66
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/Select/index.d.ts +1 -1
- package/dist/__utils/utils.d.ts +4 -0
- package/dist/bundle.es12.js +30 -29
- package/dist/bundle.es13.js +66 -64
- package/dist/bundle.es14.js +2 -2
- package/dist/bundle.es16.js +1 -1
- package/dist/bundle.es22.js +1 -1
- package/dist/bundle.es23.js +1 -1
- package/dist/bundle.es24.js +1 -1
- package/dist/bundle.es27.js +1 -1
- package/dist/bundle.es28.js +3 -3
- package/dist/bundle.es29.js +1 -1
- package/dist/bundle.es32.js +48 -48
- package/dist/bundle.es42.js +1 -1
- package/dist/bundle.es50.js +47 -43
- package/dist/bundle.es51.js +73 -23
- package/dist/bundle.es52.js +20 -35
- package/dist/bundle.es53.js +39 -5
- package/dist/bundle.es54.js +5 -14
- package/dist/bundle.es55.js +13 -13
- package/dist/bundle.es56.js +13 -69
- package/dist/bundle.es57.js +68 -66
- package/dist/bundle.es58.js +67 -69
- package/dist/bundle.es60.js +1 -1
- package/dist/bundle.es64.js +74 -13
- package/dist/bundle.es65.js +45 -71
- package/dist/bundle.es66.js +13 -48
- package/package.json +1 -1
package/dist/Select/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface SelectParams extends SelectOptionsPopoverParams {
|
|
|
16
16
|
scrollTo: (index: number) => void;
|
|
17
17
|
}>;
|
|
18
18
|
}
|
|
19
|
-
export type SelectProps<T> = OptionsSource<T> & Omit<SelectFormProps, 'value'
|
|
19
|
+
export type SelectProps<T> = OptionsSource<T> & Omit<SelectFormProps, 'value'> & SelectParams & OnChangeValueType<T> & {
|
|
20
20
|
value: T | null;
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
};
|
package/dist/__utils/utils.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare const getMonthMaxDay: (month: number, year: number) => number;
|
|
|
3
3
|
export declare const getFirstDay: (month: number, year: number) => number;
|
|
4
4
|
export declare const getDayIndex: (day: number) => number;
|
|
5
5
|
export declare const createVoids: (length: number) => any[];
|
|
6
|
+
export declare const arrays: {
|
|
7
|
+
add: <T>(values: T[], value: T) => T[];
|
|
8
|
+
remove: <T>(values: T[], value: T) => T[];
|
|
9
|
+
};
|
|
6
10
|
export declare const dateToFormat: (date: Date) => DateFormat;
|
|
7
11
|
export declare const createDateValidation: ({ min, max }: {
|
|
8
12
|
min: DateFormat;
|
package/dist/bundle.es12.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { useFroozeClosing as
|
|
5
|
-
import { SelectInput as
|
|
6
|
-
import { useScrollListController as
|
|
7
|
-
import { OptionsPopover as
|
|
8
|
-
import { mergeRefs as
|
|
9
|
-
const
|
|
2
|
+
import { useRef as L, useMemo as j, useImperativeHandle as k } from "react";
|
|
3
|
+
import { Popover as q } from "./bundle.es10.js";
|
|
4
|
+
import { useFroozeClosing as w } from "./bundle.es47.js";
|
|
5
|
+
import { SelectInput as H } from "./bundle.es48.js";
|
|
6
|
+
import { useScrollListController as M } from "./bundle.es49.js";
|
|
7
|
+
import { OptionsPopover as N } from "./bundle.es50.js";
|
|
8
|
+
import { mergeRefs as W } from "react-merge-refs";
|
|
9
|
+
const Z = (t) => {
|
|
10
10
|
const {
|
|
11
11
|
onChange: i,
|
|
12
|
-
value:
|
|
12
|
+
value: n,
|
|
13
13
|
matchTarget: u = "width",
|
|
14
14
|
children: f,
|
|
15
15
|
scrollRef: m,
|
|
@@ -20,22 +20,23 @@ const Y = (t) => {
|
|
|
20
20
|
required: v,
|
|
21
21
|
className: h,
|
|
22
22
|
clearButtonIcon: O,
|
|
23
|
-
leftElement:
|
|
24
|
-
inputRef:
|
|
25
|
-
onClear:
|
|
23
|
+
leftElement: R,
|
|
24
|
+
inputRef: C,
|
|
25
|
+
onClear: y,
|
|
26
26
|
fill: P,
|
|
27
27
|
size: g,
|
|
28
28
|
placeholder: E,
|
|
29
29
|
onClick: A,
|
|
30
30
|
// options popover
|
|
31
31
|
...S
|
|
32
|
-
} = t,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
}, [t.options, t.defaultOptions])
|
|
38
|
-
|
|
32
|
+
} = t, r = L({});
|
|
33
|
+
j(() => {
|
|
34
|
+
(t.options ?? t.defaultOptions ?? []).forEach((e) => {
|
|
35
|
+
r.current[e.value] = e;
|
|
36
|
+
});
|
|
37
|
+
}, [t.options, t.defaultOptions]);
|
|
38
|
+
const x = n === null ? null : r.current[n] ?? null, { popoverRef: z, froozePopoverPosition: B, handleAnimationEnd: F } = w(), { scrollToElement: c, optionsWrapperRef: I, scrollBoxRef: T } = M();
|
|
39
|
+
k(m, () => ({
|
|
39
40
|
scrollTo: (o) => c(o, "top")
|
|
40
41
|
}));
|
|
41
42
|
const b = (o, e) => {
|
|
@@ -44,10 +45,10 @@ const Y = (t) => {
|
|
|
44
45
|
o.stopPropagation(), s && i(null);
|
|
45
46
|
};
|
|
46
47
|
return /* @__PURE__ */ l(
|
|
47
|
-
|
|
48
|
+
q,
|
|
48
49
|
{
|
|
49
50
|
minimal: !0,
|
|
50
|
-
ref:
|
|
51
|
+
ref: W([z, d]),
|
|
51
52
|
sideOffset: 0,
|
|
52
53
|
matchTarget: u,
|
|
53
54
|
onAnimationEnd: F,
|
|
@@ -55,28 +56,28 @@ const Y = (t) => {
|
|
|
55
56
|
onCloseAutoFocus: (o) => o.preventDefault(),
|
|
56
57
|
disabled: a,
|
|
57
58
|
content: ({ close: o }) => /* @__PURE__ */ l(
|
|
58
|
-
|
|
59
|
+
N,
|
|
59
60
|
{
|
|
60
61
|
...S,
|
|
61
|
-
isActive: (e) => e ===
|
|
62
|
+
isActive: (e) => e === n,
|
|
62
63
|
onSelect: (e) => b(e, o),
|
|
63
64
|
scrollboxRef: T,
|
|
64
65
|
optionsWrapperRef: I,
|
|
65
66
|
onOpened: (e) => c(e, "center"),
|
|
66
67
|
onOptionsLoaded: (e) => {
|
|
67
|
-
e.forEach((
|
|
68
|
-
p
|
|
68
|
+
e.forEach((p) => {
|
|
69
|
+
r.current[p.value] = p;
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
),
|
|
73
74
|
children: f ?? /* @__PURE__ */ l(
|
|
74
|
-
|
|
75
|
+
H,
|
|
75
76
|
{
|
|
76
77
|
required: v,
|
|
77
78
|
className: h,
|
|
78
|
-
leftElement:
|
|
79
|
-
inputRef:
|
|
79
|
+
leftElement: R,
|
|
80
|
+
inputRef: C,
|
|
80
81
|
onClear: D,
|
|
81
82
|
fill: P,
|
|
82
83
|
size: g,
|
|
@@ -92,5 +93,5 @@ const Y = (t) => {
|
|
|
92
93
|
);
|
|
93
94
|
};
|
|
94
95
|
export {
|
|
95
|
-
|
|
96
|
+
Z as Select
|
|
96
97
|
};
|
package/dist/bundle.es13.js
CHANGED
|
@@ -1,68 +1,70 @@
|
|
|
1
1
|
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { mergeRefs as T } from "react-merge-refs";
|
|
3
|
+
import { useState as M, useRef as h, useMemo as j } from "react";
|
|
4
|
+
import { matchPattern as q } from "@companix/utils-js";
|
|
5
|
+
import { faXmark as V, faChevronDown as $ } from "@companix/icons-solid";
|
|
6
|
+
import { useFroozeClosing as B } from "./bundle.es47.js";
|
|
7
|
+
import { Popover as L } from "./bundle.es10.js";
|
|
5
8
|
import { Icon as g } from "./bundle.es33.js";
|
|
6
|
-
import { attr as
|
|
7
|
-
import { mergeRefs as L } from "react-merge-refs";
|
|
8
|
-
import { faXmark as X, faChevronDown as G } from "@companix/icons-solid";
|
|
9
|
+
import { attr as l, getActiveElementByAnotherElement as X, contains as G } from "@companix/utils-browser";
|
|
9
10
|
import { OptionsPopover as H } from "./bundle.es50.js";
|
|
10
|
-
import {
|
|
11
|
-
const ne = (
|
|
11
|
+
import { arrays as v } from "./bundle.es51.js";
|
|
12
|
+
const ne = (r) => {
|
|
12
13
|
const {
|
|
13
|
-
closeAfterSelect:
|
|
14
|
-
placeholder:
|
|
15
|
-
onChange:
|
|
16
|
-
onInputChange:
|
|
17
|
-
readOnly:
|
|
18
|
-
size:
|
|
19
|
-
fill:
|
|
14
|
+
closeAfterSelect: C,
|
|
15
|
+
placeholder: x,
|
|
16
|
+
onChange: c,
|
|
17
|
+
onInputChange: N,
|
|
18
|
+
readOnly: u,
|
|
19
|
+
size: O = "md",
|
|
20
|
+
fill: R,
|
|
20
21
|
value: n,
|
|
21
|
-
inputRef:
|
|
22
|
-
disabled:
|
|
23
|
-
required:
|
|
22
|
+
inputRef: A,
|
|
23
|
+
disabled: f,
|
|
24
|
+
required: P,
|
|
24
25
|
// options popover
|
|
25
|
-
...
|
|
26
|
-
} =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
...b
|
|
27
|
+
} = r, [m, z] = M(""), a = h(null), D = h(null), i = h({});
|
|
28
|
+
j(() => {
|
|
29
|
+
(r.options ?? r.defaultOptions ?? []).forEach((t) => {
|
|
30
|
+
i.current[t.value] = t;
|
|
31
|
+
});
|
|
32
|
+
}, [r.options, r.defaultOptions]);
|
|
33
|
+
const { popoverRef: d, froozePopoverPosition: E, handleAnimationEnd: S } = B(), k = (e, t) => {
|
|
34
|
+
C ? (E(), c(e), t()) : c(e);
|
|
33
35
|
}, y = (e) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
e.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
36
|
+
if (f) return;
|
|
37
|
+
d.current && d.current.getAttribute("data-state") === "open" && e.preventDefault();
|
|
38
|
+
const t = X(e.currentTarget);
|
|
39
|
+
e.defaultPrevented || G(e.currentTarget, t) || a.current && a.current.focus();
|
|
40
|
+
}, I = (e) => {
|
|
41
|
+
e.target !== a.current && e.preventDefault();
|
|
42
|
+
}, w = (e, t) => {
|
|
43
|
+
e.stopPropagation(), c(v.remove(n, t));
|
|
44
|
+
}, F = ({ target: e }) => {
|
|
45
|
+
z(e.value), N?.(e.value);
|
|
46
|
+
};
|
|
45
47
|
return /* @__PURE__ */ o(
|
|
46
|
-
|
|
48
|
+
L,
|
|
47
49
|
{
|
|
48
50
|
minimal: !0,
|
|
49
51
|
ref: d,
|
|
50
52
|
sideOffset: 0,
|
|
51
53
|
matchTarget: "width",
|
|
52
|
-
onAnimationEnd:
|
|
54
|
+
onAnimationEnd: S,
|
|
53
55
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
54
56
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
55
57
|
content: ({ close: e }) => /* @__PURE__ */ o(
|
|
56
58
|
H,
|
|
57
59
|
{
|
|
58
|
-
...
|
|
60
|
+
...b,
|
|
59
61
|
isActive: (t) => n.includes(t),
|
|
60
|
-
onSelect: (t) =>
|
|
61
|
-
disableFiltering: !
|
|
62
|
-
filterOptions: ({ title: t }) =>
|
|
62
|
+
onSelect: (t) => k(v.add(n, t), e),
|
|
63
|
+
disableFiltering: !m.trim(),
|
|
64
|
+
filterOptions: ({ title: t }) => q(t, m),
|
|
63
65
|
onOptionsLoaded: (t) => {
|
|
64
|
-
t.forEach((
|
|
65
|
-
|
|
66
|
+
t.forEach((s) => {
|
|
67
|
+
i.current[s.value] = s;
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -71,46 +73,46 @@ const ne = (a) => {
|
|
|
71
73
|
"div",
|
|
72
74
|
{
|
|
73
75
|
className: "form",
|
|
74
|
-
onClick:
|
|
75
|
-
onMouseDown:
|
|
76
|
-
"data-size":
|
|
77
|
-
"data-fill":
|
|
78
|
-
"data-required":
|
|
79
|
-
"data-disabled":
|
|
76
|
+
onClick: y,
|
|
77
|
+
onMouseDown: I,
|
|
78
|
+
"data-size": O ?? "md",
|
|
79
|
+
"data-fill": l(R),
|
|
80
|
+
"data-required": l(P),
|
|
81
|
+
"data-disabled": l(f),
|
|
80
82
|
children: /* @__PURE__ */ p("div", { className: "select-tags-container", children: [
|
|
81
83
|
/* @__PURE__ */ p("div", { className: "select-tags", children: [
|
|
82
84
|
n.length > 0 && /* @__PURE__ */ o(
|
|
83
85
|
"div",
|
|
84
86
|
{
|
|
85
87
|
className: "tag-container",
|
|
86
|
-
ref:
|
|
88
|
+
ref: D,
|
|
87
89
|
role: "listbox",
|
|
88
|
-
"data-readonly":
|
|
89
|
-
children: n.map((e, t) =>
|
|
90
|
-
/* @__PURE__ */ o("span", { className: "tag-name", children:
|
|
91
|
-
/* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (
|
|
90
|
+
"data-readonly": l(u),
|
|
91
|
+
children: n.map((e, t) => i.current[e] ? /* @__PURE__ */ p("div", { className: "tag", children: [
|
|
92
|
+
/* @__PURE__ */ o("span", { className: "tag-name", children: i.current[e].title }),
|
|
93
|
+
/* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => w(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: V, size: "xxxs" }) })
|
|
92
94
|
] }, `tag-option-${e}-${t}`) : null)
|
|
93
95
|
}
|
|
94
96
|
),
|
|
95
|
-
(!
|
|
97
|
+
(!u || n.length === 0) && /* @__PURE__ */ o(
|
|
96
98
|
"input",
|
|
97
99
|
{
|
|
98
|
-
ref:
|
|
100
|
+
ref: T([A, a]),
|
|
99
101
|
type: "text",
|
|
100
102
|
autoCapitalize: "none",
|
|
101
103
|
autoComplete: "off",
|
|
102
104
|
autoCorrect: "off",
|
|
103
105
|
className: "form-input",
|
|
104
106
|
spellCheck: !1,
|
|
105
|
-
value:
|
|
106
|
-
disabled:
|
|
107
|
-
readOnly:
|
|
108
|
-
placeholder:
|
|
109
|
-
onChange:
|
|
107
|
+
value: m,
|
|
108
|
+
disabled: f,
|
|
109
|
+
readOnly: u,
|
|
110
|
+
placeholder: x,
|
|
111
|
+
onChange: F
|
|
110
112
|
}
|
|
111
113
|
)
|
|
112
114
|
] }),
|
|
113
|
-
/* @__PURE__ */ o(g, { className: "expand-icon", icon:
|
|
115
|
+
/* @__PURE__ */ o(g, { className: "expand-icon", icon: $, size: "xxxs" })
|
|
114
116
|
] })
|
|
115
117
|
}
|
|
116
118
|
)
|
package/dist/bundle.es14.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as b, useRef as R } from "react";
|
|
3
3
|
import { mergeRefs as c } from "react-merge-refs";
|
|
4
|
-
import { InputElement as x } from "./bundle.
|
|
5
|
-
import { InputContainer as I } from "./bundle.
|
|
4
|
+
import { InputElement as x } from "./bundle.es52.js";
|
|
5
|
+
import { InputContainer as I } from "./bundle.es53.js";
|
|
6
6
|
import g from "classnames";
|
|
7
7
|
const N = b(
|
|
8
8
|
({
|
package/dist/bundle.es16.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import C from "classnames";
|
|
3
3
|
import { forwardRef as j, useRef as w } from "react";
|
|
4
4
|
import { mergeRefs as y } from "react-merge-refs";
|
|
5
|
-
import { InputContainer as F } from "./bundle.
|
|
5
|
+
import { InputContainer as F } from "./bundle.es53.js";
|
|
6
6
|
import { NumericFormat as V } from "react-number-format";
|
|
7
7
|
const D = j(
|
|
8
8
|
({
|
package/dist/bundle.es22.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
|
2
2
|
import f from "classnames";
|
|
3
3
|
import * as o from "@radix-ui/react-dialog";
|
|
4
4
|
import { VisuallyHidden as a } from "@radix-ui/react-visually-hidden";
|
|
5
|
-
import { RemoveListener as v } from "./bundle.
|
|
5
|
+
import { RemoveListener as v } from "./bundle.es54.js";
|
|
6
6
|
const g = (l) => {
|
|
7
7
|
const { size: n = "s", open: r, onOpenChange: s, children: c, onClosed: t, disableEsc: p, className: d } = l, m = (h) => {
|
|
8
8
|
p && h.preventDefault();
|
package/dist/bundle.es23.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import * as r from "@radix-ui/react-alert-dialog";
|
|
3
3
|
import { Button as c } from "./bundle.es4.js";
|
|
4
|
-
import { RemoveListener as N } from "./bundle.
|
|
4
|
+
import { RemoveListener as N } from "./bundle.es54.js";
|
|
5
5
|
import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
|
|
6
6
|
const C = ({
|
|
7
7
|
open: d,
|
package/dist/bundle.es24.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { Button as m } from "./bundle.es4.js";
|
|
3
|
-
import { useLoading as p } from "./bundle.
|
|
3
|
+
import { useLoading as p } from "./bundle.es55.js";
|
|
4
4
|
const g = ({ onClick: o, appearance: r = "primary", ...i }) => {
|
|
5
5
|
const { isLoading: n, isError: t, handleClick: a } = p({ onClick: o });
|
|
6
6
|
return /* @__PURE__ */ e(
|
package/dist/bundle.es27.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { useResizeTextarea as x } from "./bundle.
|
|
2
|
+
import { useResizeTextarea as x } from "./bundle.es56.js";
|
|
3
3
|
import { attr as e, callMultiple as u } from "@companix/utils-browser";
|
|
4
4
|
import { useEffect as z } from "react";
|
|
5
5
|
import { mergeRefs as R } from "react-merge-refs";
|
package/dist/bundle.es28.js
CHANGED
|
@@ -2,10 +2,10 @@ import { jsx as u } from "react/jsx-runtime";
|
|
|
2
2
|
import { Popover as T } from "./bundle.es10.js";
|
|
3
3
|
import { Input as w } from "./bundle.es14.js";
|
|
4
4
|
import { useState as A, useRef as j } from "react";
|
|
5
|
-
import { Calendar as E } from "./bundle.
|
|
6
|
-
import { useDayDisableCheker as N } from "./bundle.
|
|
5
|
+
import { Calendar as E } from "./bundle.es57.js";
|
|
6
|
+
import { useDayDisableCheker as N } from "./bundle.es58.js";
|
|
7
7
|
import { getNum as h, formatTime as v } from "@companix/utils-js";
|
|
8
|
-
import { removeDigits as O } from "./bundle.
|
|
8
|
+
import { removeDigits as O } from "./bundle.es51.js";
|
|
9
9
|
import { SelectRightElements as Y } from "./bundle.es59.js";
|
|
10
10
|
const i = {
|
|
11
11
|
char: "-",
|
package/dist/bundle.es29.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as D, jsx as h } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as M, useEffect as C } from "react";
|
|
3
3
|
import { Select as c } from "./bundle.es12.js";
|
|
4
|
-
import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.
|
|
4
|
+
import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es51.js";
|
|
5
5
|
import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es60.js";
|
|
6
6
|
const B = ({
|
|
7
7
|
min: o = j,
|
package/dist/bundle.es32.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { getNum as
|
|
4
|
-
import { getTimesOptions as
|
|
5
|
-
import { SelectRightElements as
|
|
6
|
-
import { Select as
|
|
7
|
-
import { Input as
|
|
8
|
-
const
|
|
2
|
+
import { useRef as b, useMemo as I, useState as E, useCallback as A } from "react";
|
|
3
|
+
import { getNum as S } from "@companix/utils-js";
|
|
4
|
+
import { getTimesOptions as W, getTimeValue as q, removeDigits as w, convertTimeToOption as y } from "./bundle.es51.js";
|
|
5
|
+
import { SelectRightElements as z } from "./bundle.es59.js";
|
|
6
|
+
import { Select as F } from "./bundle.es12.js";
|
|
7
|
+
import { Input as G } from "./bundle.es14.js";
|
|
8
|
+
const o = {
|
|
9
9
|
char: ":",
|
|
10
|
-
toString: (s) => s ?
|
|
10
|
+
toString: (s) => s ? y(s, o.char) : "",
|
|
11
11
|
toValue: (s) => {
|
|
12
|
-
const n = s.split(
|
|
12
|
+
const n = s.split(o.char);
|
|
13
13
|
if (n.length === 2) {
|
|
14
|
-
const [e,
|
|
15
|
-
if (e !== null &&
|
|
16
|
-
return { hours: e, minutes:
|
|
14
|
+
const [e, u] = [S(n[0]), S(n[1])];
|
|
15
|
+
if (e !== null && u !== null && e < 24 && e >= 0 && u < 60 && u >= 0)
|
|
16
|
+
return { hours: e, minutes: u };
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
},
|
|
21
|
-
const { value: n, onChange: e, clearButton:
|
|
20
|
+
}, Y = (s) => {
|
|
21
|
+
const { value: n, onChange: e, clearButton: u, clearButtonIcon: _, disabled: a, ...T } = s, m = b(null), p = b(null), h = I(() => W(10), []), k = I(() => {
|
|
22
22
|
if (n && !n.minutes.toString().endsWith("0")) {
|
|
23
|
-
const t = n.hours * 6 + Math.trunc(n.minutes / 10),
|
|
24
|
-
return
|
|
23
|
+
const t = n.hours * 6 + Math.trunc(n.minutes / 10), r = [...h];
|
|
24
|
+
return r.splice(t + 1, 0, q(n)), r;
|
|
25
25
|
}
|
|
26
26
|
return h;
|
|
27
|
-
}, [h, n]), [
|
|
28
|
-
l(t);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
},
|
|
27
|
+
}, [h, n]), [i, l] = E(() => o.toString(n)), v = (t) => {
|
|
28
|
+
l(t), N(t);
|
|
29
|
+
const r = o.toValue(t);
|
|
30
|
+
r && e?.(r);
|
|
31
|
+
}, x = (t) => {
|
|
32
32
|
a || m.current && m.current.getAttribute("data-state") === "open" && t.preventDefault();
|
|
33
|
-
},
|
|
34
|
-
|
|
33
|
+
}, B = () => {
|
|
34
|
+
o.toValue(i) === null && l(o.toString(n ?? null));
|
|
35
|
+
}, O = (t) => {
|
|
36
|
+
e?.(o.toValue(t)), l(t);
|
|
35
37
|
}, R = (t) => {
|
|
36
|
-
e?.(r.toValue(t)), l(t);
|
|
37
|
-
}, k = (t) => {
|
|
38
38
|
t.stopPropagation(), l(""), e?.(null);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, N = [V(t), V(u)].join(":"), f = r.toValue(N);
|
|
39
|
+
}, N = A((t) => {
|
|
40
|
+
if (t && t !== "__:__") {
|
|
41
|
+
const [r, M] = t.split(":"), d = (c) => {
|
|
42
|
+
const [C, V] = c.split(""), [j, D] = [C === "_" ? "0" : C, V === "_" ? "0" : V];
|
|
43
|
+
return j + D;
|
|
44
|
+
}, P = [d(r), d(M)].join(":"), f = o.toValue(P);
|
|
46
45
|
if (f) {
|
|
47
46
|
const c = f.hours * 6 + Math.trunc(f.minutes / 10);
|
|
48
47
|
c !== -1 && p.current && p.current.scrollTo(c);
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
}, [
|
|
52
|
-
|
|
50
|
+
}, []);
|
|
51
|
+
return /* @__PURE__ */ g(
|
|
52
|
+
F,
|
|
53
53
|
{
|
|
54
54
|
minimalOptions: !0,
|
|
55
|
-
options:
|
|
56
|
-
onChange:
|
|
57
|
-
value:
|
|
55
|
+
options: k,
|
|
56
|
+
onChange: O,
|
|
57
|
+
value: i,
|
|
58
58
|
popoverRef: m,
|
|
59
59
|
scrollRef: p,
|
|
60
60
|
disabled: a,
|
|
61
61
|
children: /* @__PURE__ */ g(
|
|
62
|
-
|
|
62
|
+
G,
|
|
63
63
|
{
|
|
64
64
|
...T,
|
|
65
|
-
value:
|
|
65
|
+
value: i,
|
|
66
66
|
disabled: a,
|
|
67
|
-
onClick:
|
|
68
|
-
onValueChange:
|
|
69
|
-
onBlur:
|
|
67
|
+
onClick: x,
|
|
68
|
+
onValueChange: v,
|
|
69
|
+
onBlur: B,
|
|
70
70
|
mask: "99:99",
|
|
71
71
|
placeholder: "00:00",
|
|
72
72
|
rightElement: /* @__PURE__ */ g(
|
|
73
|
-
|
|
73
|
+
z,
|
|
74
74
|
{
|
|
75
|
-
clearButton:
|
|
76
|
-
clearButtonIcon:
|
|
77
|
-
value: !!
|
|
78
|
-
onClear:
|
|
75
|
+
clearButton: u,
|
|
76
|
+
clearButtonIcon: _,
|
|
77
|
+
value: !!w(i, [":", "_"]),
|
|
78
|
+
onClear: R
|
|
79
79
|
}
|
|
80
80
|
)
|
|
81
81
|
}
|
|
@@ -84,5 +84,5 @@ const r = {
|
|
|
84
84
|
);
|
|
85
85
|
};
|
|
86
86
|
export {
|
|
87
|
-
|
|
87
|
+
Y as TimePicker
|
|
88
88
|
};
|
package/dist/bundle.es42.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import * as t from "@radix-ui/react-toast";
|
|
3
3
|
import { attr as T } from "@companix/utils-browser";
|
|
4
4
|
import { useState as d, useRef as b, useEffect as j, useLayoutEffect as E } from "react";
|
|
5
|
-
import { RemoveListener as I } from "./bundle.
|
|
5
|
+
import { RemoveListener as I } from "./bundle.es54.js";
|
|
6
6
|
const m = (o) => {
|
|
7
7
|
const [r, u] = d(!0), [p, f] = d(!1), s = b(null), {
|
|
8
8
|
appearance: C = "neutral",
|