@hybridcore/ui 1.5.3 → 1.5.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.
@@ -1,73 +1,75 @@
1
- import { jsxs as d, Fragment as w, jsx as e } from "react/jsx-runtime";
2
- import { useState as y, useMemo as F } from "react";
3
- import { useTheme as P, Stack as B, Box as E, IconButton as I, Menu as R, MenuItem as Z } from "@mui/material";
4
- import { DatePicker as $ } from "@mui/x-date-pickers";
1
+ import { jsxs as c, Fragment as y, jsx as e } from "react/jsx-runtime";
2
+ import { useState as F, useMemo as P } from "react";
3
+ import { useTheme as B, Stack as E, Box as I, IconButton as R, Menu as Z, MenuItem as $ } from "@mui/material";
4
+ import { DatePicker as j } from "@mui/x-date-pickers";
5
5
  import g from "dayjs";
6
- import Y from "lodash";
7
- import { PatternFormat as j } from "react-number-format";
8
- import { Schedule as v } from "@mui/icons-material";
9
- import z from "../../hooks/useMenuLogic.js";
10
- const Q = ({
11
- value: c,
6
+ import M from "lodash";
7
+ import { PatternFormat as v } from "react-number-format";
8
+ import { Schedule as z } from "@mui/icons-material";
9
+ import L from "../../hooks/useMenuLogic.js";
10
+ const U = ({
11
+ value: p,
12
12
  name: D,
13
- minDate: M,
13
+ minDate: m,
14
14
  variant: r,
15
15
  label: x,
16
- size: b = "small",
17
- minuteStep: a = 30,
18
- pattern: C = "##:##:##",
19
- onChange: p
16
+ size: H = "small",
17
+ minuteStep: d = 30,
18
+ pattern: b = "##:##:##",
19
+ onChange: u
20
20
  }) => {
21
- const n = z(), [t, u] = y(c ? g(c) : null), h = P(), H = F(() => {
21
+ const n = L(), [t, h] = F(p ? g(p) : null), f = B(), S = P(() => {
22
22
  const o = [];
23
- for (let s = 0; s < 24; s++)
24
- for (let i = 0; i < 60 / a; i++) {
25
- const l = Y.padStart(s.toString(), 2, "0"), m = Y.padStart(
26
- (i * a).toString(),
23
+ let a = 0;
24
+ m && t && m.format("YYYY-MM-DD") === t.format("YYYY-MM-DD") && (a = Number(m.format("HH")));
25
+ for (let s = a; s < 24; s++)
26
+ for (let i = 0; i < 60 / d; i++) {
27
+ const l = M.padStart(s.toString(), 2, "0"), k = M.padStart(
28
+ (i * d).toString(),
27
29
  2,
28
30
  "0"
29
- ), k = `${l}:${m}`;
30
- o.push(k);
31
+ ), w = `${l}:${k}`;
32
+ o.push(w);
31
33
  }
32
34
  return o;
33
- }, [a]), S = (o) => {
34
- o && (u(o), p(o.format("YYYY-MM-DDTHH:mm:ssZ")));
35
- }, f = (o) => {
36
- const [s, i, l] = o.target.value.split(":"), m = g(t).set("hour", s ?? 0).set("m", i ?? 0).set("s", l ?? 0);
37
- u(m), p(m.format("YYYY-MM-DDTHH:mm:ssZ"));
35
+ }, [d, t]), C = (o) => {
36
+ o && (h(o), u(o.format("YYYY-MM-DDTHH:mm:ssZ")));
37
+ }, Y = (o) => {
38
+ const [a, s, i] = o.target.value.split(":"), l = g(t).set("hour", a ?? 0).set("m", s ?? 0).set("s", i ?? 0);
39
+ h(l), u(l.format("YYYY-MM-DDTHH:mm:ssZ"));
38
40
  }, T = (o) => () => {
39
- f({
41
+ Y({
40
42
  target: {
41
43
  value: o
42
44
  }
43
45
  }), n.action.close();
44
46
  };
45
- return /* @__PURE__ */ d(w, { children: [
46
- /* @__PURE__ */ d(B, { direction: "row", spacing: 2, mb: 1, alignItems: "flex-end", children: [
47
+ return /* @__PURE__ */ c(y, { children: [
48
+ /* @__PURE__ */ c(E, { direction: "row", spacing: 2, mb: 1, alignItems: "flex-end", children: [
47
49
  /* @__PURE__ */ e(
48
- $,
50
+ j,
49
51
  {
50
52
  label: x,
51
53
  value: t,
52
54
  format: "DD/MM/YYYY",
53
- minDate: M,
54
- onChange: S,
55
+ minDate: m,
56
+ onChange: C,
55
57
  slotProps: {
56
58
  textField: {
57
59
  variant: r,
58
- size: b
60
+ size: H
59
61
  }
60
62
  }
61
63
  }
62
64
  ),
63
- /* @__PURE__ */ d(E, { position: "relative", children: [
65
+ /* @__PURE__ */ c(I, { position: "relative", children: [
64
66
  /* @__PURE__ */ e(
65
- j,
67
+ v,
66
68
  {
67
- format: C,
69
+ format: b,
68
70
  allowEmptyFormatting: !0,
69
71
  value: t == null ? void 0 : t.format("HH:mm:ss"),
70
- onChange: f,
72
+ onChange: Y,
71
73
  style: {
72
74
  fontSize: 16,
73
75
  width: 120,
@@ -80,15 +82,15 @@ const Q = ({
80
82
  ...r === "outlined" && {
81
83
  height: 54,
82
84
  border: "1px solid",
83
- borderRadius: h.shape.borderRadius,
85
+ borderRadius: f.shape.borderRadius,
84
86
  padding: "0 10px"
85
87
  },
86
- borderColor: h.palette.action.disabled
88
+ borderColor: f.palette.action.disabled
87
89
  }
88
90
  }
89
91
  ),
90
92
  /* @__PURE__ */ e(
91
- I,
93
+ R,
92
94
  {
93
95
  onClick: n.action.open,
94
96
  sx: {
@@ -101,24 +103,24 @@ const Q = ({
101
103
  top: 8
102
104
  }
103
105
  },
104
- children: /* @__PURE__ */ e(v, {})
106
+ children: /* @__PURE__ */ e(z, {})
105
107
  }
106
108
  )
107
109
  ] })
108
110
  ] }),
109
111
  /* @__PURE__ */ e(
110
- R,
112
+ Z,
111
113
  {
112
114
  id: "time-menu",
113
115
  anchorEl: n.state.anchorEl,
114
116
  open: n.state.isOpen,
115
117
  onClose: n.action.close,
116
- children: H.map((o) => /* @__PURE__ */ e(Z, { onClick: T(o), children: o }, o))
118
+ children: S.map((o) => /* @__PURE__ */ e($, { onClick: T(o), children: o }, o))
117
119
  }
118
120
  ),
119
121
  /* @__PURE__ */ e("input", { type: "hidden", name: D, value: (t == null ? void 0 : t.format()) ?? "" })
120
122
  ] });
121
123
  };
122
124
  export {
123
- Q as DateTimePicker
125
+ U as DateTimePicker
124
126
  };
@@ -4,44 +4,45 @@ import { V as x } from "../../../../index-JgBxaIU2.js";
4
4
  import _ from "lodash";
5
5
  import { Box as d } from "@mui/material";
6
6
  function V({
7
- template: o,
7
+ template: n,
8
8
  value: i,
9
9
  mapboxAccessToken: a,
10
10
  variant: f = "outlined",
11
- fieldOptions: n,
12
- onChange: s
11
+ fieldOptions: o,
12
+ onChange: c
13
13
  }) {
14
- const c = p.useMemo(() => {
15
- let r = o == null ? void 0 : o.properties.filter((e) => e.visible);
14
+ const s = p.useMemo(() => {
15
+ let r = n == null ? void 0 : n.properties.filter((e) => e.visible);
16
16
  return r = _.orderBy(r, "id"), r;
17
- }, [o]), l = (r) => {
17
+ }, [n]), m = (r) => {
18
18
  const e = {
19
19
  target: {
20
20
  value: { ...i, ...r }
21
21
  }
22
22
  };
23
- s(e);
23
+ c(e);
24
24
  };
25
- return o === void 0 ? /* @__PURE__ */ t(h, {}) : /* @__PURE__ */ t(d, { display: "flex", flexDirection: "column", children: c.filter((r) => {
25
+ return n === void 0 ? /* @__PURE__ */ t(h, {}) : /* @__PURE__ */ t(d, { display: "flex", flexDirection: "column", children: s.filter((r) => {
26
26
  var e;
27
- return n ? !((e = n[r.propertyId]) != null && e.hidden) : !0;
27
+ return o ? !((e = o[r.propertyId]) != null && e.hidden) : !0;
28
28
  }).map((r, e) => {
29
29
  var u;
30
- const m = i ? i[r.propertyId] : "";
30
+ const l = i ? i[r.propertyId] : "";
31
31
  return /* @__PURE__ */ t(
32
32
  d,
33
33
  {
34
- ...n && ((u = n[r.propertyId]) == null ? void 0 : u.order) && {
35
- order: n[r.propertyId].order
34
+ ...o && ((u = o[r.propertyId]) == null ? void 0 : u.order) && {
35
+ order: o[r.propertyId].order
36
36
  },
37
37
  children: /* @__PURE__ */ t(
38
38
  x,
39
39
  {
40
40
  property: r,
41
- value: m,
41
+ value: l,
42
42
  mapboxAccessToken: a,
43
43
  variant: f,
44
- onChange: l
44
+ fieldOptions: o,
45
+ onChange: m
45
46
  }
46
47
  )
47
48
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.5.3",
4
+ "version": "1.5.4",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",