@alxgrn/telefrag-ui 0.0.52 → 0.0.53

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,4 +1,4 @@
1
- import { jsxs as y, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as e } from "react/jsx-runtime";
2
2
  import { useRef as k, useState as s, useEffect as H } from "react";
3
3
  import R from "../label/Label.js";
4
4
  import { Menu as N } from "../../ui/menu/Menu.js";
@@ -30,26 +30,28 @@ import O from "../../icons/Check.js";
30
30
  /* empty css */
31
31
  /* empty css */
32
32
  const xr = ({
33
- id: f,
34
- value: d,
33
+ id: d,
34
+ value: m,
35
35
  step: x = 1,
36
- onChange: e,
36
+ onChange: o,
37
37
  label: g,
38
38
  top: M,
39
39
  bottom: b,
40
40
  required: $ = !1,
41
- disabled: m = !1
41
+ disabled: p = !1
42
42
  }) => {
43
- const p = k(null), a = k(null), [n, C] = s(""), [l, I] = s(""), [j, w] = s([]), [z, E] = s([]), [S, c] = s(!1), [T, u] = s(!1);
43
+ const a = k(null), c = k(null), [n, C] = s(""), [l, I] = s(""), [j, w] = s([]), [z, E] = s([]), [S, u] = s(!1), [T, f] = s(!1);
44
44
  H(() => {
45
- let [r, t] = d.split(":");
46
- r = parseInt(r), t = parseInt(t), (isNaN(r) || r < 0 || r > 23) && (r = 0), (isNaN(t) || t < 0 || t > 59) && (t = 0), r = `0${r}`.slice(-2), t = `0${t}`.slice(-2), C(r), I(t), e && e(`${r}:${t}`);
47
- }, [d, e]), H(() => {
45
+ let [r, t] = m.split(":");
46
+ r = parseInt(r), t = parseInt(t), (isNaN(r) || r < 0 || r > 23) && (r = 0), (isNaN(t) || t < 0 || t > 59) && (t = 0), r = `0${r}`.slice(-2), t = `0${t}`.slice(-2), C(r), I(t);
47
+ const i = `${r}:${t}`;
48
+ i !== m && o && o(i);
49
+ }, [m, o]), H(() => {
48
50
  const r = [], t = [];
49
- for (let o = 0; o < 24; o++)
50
- r.push(`0${o}`.slice(-2));
51
- for (let o = 0; o < 60; o += x)
52
- t.push(`0${o}`.slice(-2));
51
+ for (let i = 0; i < 24; i++)
52
+ r.push(`0${i}`.slice(-2));
53
+ for (let i = 0; i < 60; i += x)
54
+ t.push(`0${i}`.slice(-2));
53
55
  w(r), E(t);
54
56
  }, [x]);
55
57
  const h = () => !!($ && (!n || !l)), v = () => {
@@ -59,74 +61,74 @@ const xr = ({
59
61
  backgroundColor: "var(--alxgrn-input-bg-error)"
60
62
  };
61
63
  }, F = (r) => {
62
- c(!1), e && e(`${r.text ?? ""}:${l}`);
64
+ u(!1), o && o(`${r.text ?? ""}:${l}`);
63
65
  }, L = (r) => {
64
- u(!1), e && e(`${n}:${r.text ?? ""}`);
66
+ f(!1), o && o(`${n}:${r.text ?? ""}`);
65
67
  };
66
68
  return /* @__PURE__ */ y("div", { className: "FormItem", children: [
67
- /* @__PURE__ */ i(
69
+ /* @__PURE__ */ e(
68
70
  R,
69
71
  {
70
72
  top: M,
71
73
  bottom: b,
72
74
  label: g,
73
75
  required: $,
74
- disabled: m,
76
+ disabled: p,
75
77
  error: h(),
76
78
  children: /* @__PURE__ */ y("div", { className: "Time", children: [
77
- /* @__PURE__ */ i(
79
+ /* @__PURE__ */ e(
78
80
  "input",
79
81
  {
80
- id: `${f}-hor`,
81
- ref: p,
82
+ id: `${d}-hor`,
83
+ ref: a,
82
84
  type: "text",
83
85
  value: n,
84
86
  style: v(),
85
- disabled: !!m,
86
- onClick: () => c(!0),
87
+ disabled: !!p,
88
+ onClick: () => u(!0),
87
89
  readOnly: !0
88
90
  }
89
91
  ),
90
- /* @__PURE__ */ i("div", { children: ":" }),
91
- /* @__PURE__ */ i(
92
+ /* @__PURE__ */ e("div", { children: ":" }),
93
+ /* @__PURE__ */ e(
92
94
  "input",
93
95
  {
94
- id: `${f}-min`,
95
- ref: a,
96
+ id: `${d}-min`,
97
+ ref: c,
96
98
  type: "text",
97
99
  value: l,
98
100
  style: v(),
99
- disabled: !!m,
100
- onClick: () => u(!0),
101
+ disabled: !!p,
102
+ onClick: () => f(!0),
101
103
  readOnly: !0
102
104
  }
103
105
  )
104
106
  ] })
105
107
  }
106
108
  ),
107
- p.current && /* @__PURE__ */ i(
109
+ a.current && /* @__PURE__ */ e(
108
110
  N,
109
111
  {
110
- parent: p.current,
112
+ parent: a.current,
111
113
  isOpen: S,
112
- onClose: () => c(!1),
114
+ onClose: () => u(!1),
113
115
  horizontal: "inner-left",
114
116
  margin: "var(--alxgrn-unit-small)",
115
- items: j.map((r) => ({ id: r, text: r, icon: r === n ? /* @__PURE__ */ i(O, {}) : /* @__PURE__ */ i("div", { className: "empty" }) })),
117
+ items: j.map((r) => ({ id: r, text: r, icon: r === n ? /* @__PURE__ */ e(O, {}) : /* @__PURE__ */ e("div", { className: "empty" }) })),
116
118
  onClick: F,
117
119
  maxHeight: "auto",
118
120
  width: "auto"
119
121
  }
120
122
  ),
121
- a.current && /* @__PURE__ */ i(
123
+ c.current && /* @__PURE__ */ e(
122
124
  N,
123
125
  {
124
- parent: a.current,
126
+ parent: c.current,
125
127
  isOpen: T,
126
- onClose: () => u(!1),
128
+ onClose: () => f(!1),
127
129
  horizontal: "inner-right",
128
130
  margin: "var(--alxgrn-unit-small)",
129
- items: z.map((r) => ({ id: r, text: r, icon: r === l ? /* @__PURE__ */ i(O, {}) : /* @__PURE__ */ i("div", { className: "empty" }) })),
131
+ items: z.map((r) => ({ id: r, text: r, icon: r === l ? /* @__PURE__ */ e(O, {}) : /* @__PURE__ */ e("div", { className: "empty" }) })),
130
132
  onClick: L,
131
133
  maxHeight: "auto",
132
134
  width: "auto"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alxgrn/telefrag-ui",
3
3
  "description": "UI library for The Daily Telefrag project",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "private": false,
6
6
  "author": "Alexander Fedorov <alex@molner.ru>",
7
7
  "license": "Apache-2.0",