@nongt/visql 0.4.2 → 0.5.0

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.
@@ -0,0 +1,112 @@
1
+ import { jsx as M } from "react/jsx-runtime";
2
+ import { useCallback as a, useMemo as s } from "react";
3
+ import { DatePicker as g } from "@mui/x-date-pickers/DatePicker";
4
+ import { c as x } from "./calendarDate-CYlr9TvX.js";
5
+ import { DateTimePicker as p } from "@mui/x-date-pickers/DateTimePicker";
6
+ import { TimePicker as U } from "@mui/x-date-pickers/TimePicker";
7
+ import { t as T } from "./tokens-BTaVMSOx.js";
8
+ const D = ".MuiPickersOutlinedInput-notchedOutline";
9
+ function f(r, i = !1) {
10
+ return {
11
+ width: "fit-content",
12
+ ...i ? { "& .MuiPickersSectionList-root": { width: "auto" } } : {},
13
+ "& .MuiPickersOutlinedInput-root": {
14
+ ...r ? { height: 38, borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } : {},
15
+ [`& ${D}`]: { borderColor: T("fieldBorder") },
16
+ [`&:hover:not(.Mui-focused):not(.Mui-disabled) ${D}`]: {
17
+ borderColor: T("fieldBorderHover")
18
+ }
19
+ },
20
+ // The calendar/clock button: the size of the other fields' arrows.
21
+ "& .MuiInputAdornment-root .MuiIconButton-root": { padding: "4px" },
22
+ "& .MuiInputAdornment-root .MuiSvgIcon-root": { fontSize: 20 }
23
+ };
24
+ }
25
+ const z = ({
26
+ className: r,
27
+ grouped: i,
28
+ value: t,
29
+ onChange: e,
30
+ disabled: l
31
+ }) => {
32
+ const d = a((u) => {
33
+ e == null || e(u ? x(u.getFullYear(), u.getMonth() + 1, u.getDate()) : void 0);
34
+ }, [e]), m = s(() => t ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : null, [t]), n = s(() => ({
35
+ className: r,
36
+ sx: f(i, !0),
37
+ size: "small"
38
+ }), [r, i]), o = s(() => ({
39
+ textField: n
40
+ }), [n]);
41
+ return /* @__PURE__ */ M(
42
+ g,
43
+ {
44
+ disabled: l,
45
+ value: m,
46
+ slotProps: o,
47
+ onChange: d
48
+ }
49
+ );
50
+ }, B = ({
51
+ className: r,
52
+ grouped: i,
53
+ value: t,
54
+ onChange: e,
55
+ disabled: l
56
+ }) => {
57
+ const d = a((o) => {
58
+ e == null || e(o ? new Date(Date.UTC(
59
+ o.getFullYear(),
60
+ o.getMonth(),
61
+ o.getDate(),
62
+ o.getHours(),
63
+ o.getMinutes()
64
+ )) : void 0);
65
+ }, [e]), m = s(() => t ? new Date(
66
+ t.getUTCFullYear(),
67
+ t.getUTCMonth(),
68
+ t.getUTCDate(),
69
+ t.getUTCHours(),
70
+ t.getUTCMinutes()
71
+ ) : null, [t]), n = s(() => ({
72
+ textField: { className: r, sx: f(i), size: "small" }
73
+ }), [r, i]);
74
+ return /* @__PURE__ */ M(
75
+ p,
76
+ {
77
+ disabled: l,
78
+ value: m,
79
+ slotProps: n,
80
+ onChange: d
81
+ }
82
+ );
83
+ }, c = (r) => String(r).padStart(2, "0"), H = ({
84
+ className: r,
85
+ grouped: i,
86
+ value: t,
87
+ onChange: e,
88
+ disabled: l
89
+ }) => {
90
+ const d = a((o) => {
91
+ e == null || e(o ? `${c(o.getHours())}:${c(o.getMinutes())}:${c(o.getSeconds())}` : void 0);
92
+ }, [e]), m = s(() => {
93
+ const [o, u, P] = (t ?? "").split(":").map(Number);
94
+ return t ? new Date(2e3, 0, 1, o, u, P || 0) : null;
95
+ }, [t]), n = s(() => ({
96
+ textField: { className: r, sx: f(i, !0), size: "small" }
97
+ }), [r, i]);
98
+ return /* @__PURE__ */ M(
99
+ U,
100
+ {
101
+ disabled: l,
102
+ value: m,
103
+ slotProps: n,
104
+ onChange: d
105
+ }
106
+ );
107
+ };
108
+ export {
109
+ z as M,
110
+ B as a,
111
+ H as b
112
+ };