@memobit/libs 3.15.0 → 3.15.1

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,26 +1,26 @@
1
1
  import './AnalogClock.css';
2
2
  /* empty css */
3
- import { useMemo as b, useRef as K, useState as nn } from "react";
4
- import { Fragment as rn, jsx as u, jsxs as m } from "react/jsx-runtime";
5
- var p = (r) => r.toString().padStart(2, "0"), N = (r, g, h) => {
3
+ import { useMemo as b, useRef as L, useState as nr } from "react";
4
+ import { Fragment as tr, jsx as l, jsxs as f } from "react/jsx-runtime";
5
+ var M = (n) => n.toString().padStart(2, "0"), x = (n, g, h) => {
6
6
  const k = (h - 90) * Math.PI / 180;
7
7
  return {
8
- x: r + g * Math.cos(k),
9
- y: r + g * Math.sin(k)
8
+ x: n + g * Math.cos(k),
9
+ y: n + g * Math.sin(k)
10
10
  };
11
- }, en = (r) => r === 0 || r > 12, an = ({ value: r, onChange: g, format: h = "24h", withSeconds: k = !1, minuteStep: A = 1, secondStep: w = 1, size: d = 232, disabled: l = !1, showHeader: q = !0, autoAdvance: E = !0, mode: D, onModeChange: L, className: X = "" }) => {
12
- const [Y, G] = nn("hours"), I = K(null), M = K(!1), s = D ?? Y, f = r.hours >= 12, e = b(() => {
13
- const n = d / 2, t = d * 0.078, c = n - t - d * 0.018, a = c - t * 1.85;
11
+ }, er = (n) => n === 0 || n > 12, ir = ({ value: n, onChange: g, format: h = "24h", withSeconds: k = !1, minuteStep: w = 1, secondStep: D = 1, size: d = 232, disabled: u = !1, showHeader: q = !0, autoAdvance: E = !0, mode: C, onModeChange: X, className: Y = "" }) => {
12
+ const [G, J] = nr("hours"), I = L(null), _ = L(!1), s = C ?? G, p = n.hours >= 12, t = b(() => {
13
+ const r = d / 2, e = d * 0.078, c = r - e - d * 0.018, a = c - e * 1.85;
14
14
  return {
15
- center: n,
16
- knobRadius: t,
15
+ center: r,
16
+ knobRadius: e,
17
17
  outerRadius: c,
18
18
  innerRadius: a,
19
19
  ringThreshold: (c + a) / 2
20
20
  };
21
- }, [d]), y = (n) => {
22
- D === void 0 && G(n), L?.(n);
23
- }, C = () => {
21
+ }, [d]), y = (r) => {
22
+ C === void 0 && J(r), X?.(r);
23
+ }, N = () => {
24
24
  if (E) {
25
25
  if (s === "hours") {
26
26
  y("minutes");
@@ -28,7 +28,7 @@ var p = (r) => r.toString().padStart(2, "0"), N = (r, g, h) => {
28
28
  }
29
29
  s === "minutes" && k && y("seconds");
30
30
  }
31
- }, J = b(() => {
31
+ }, O = b(() => {
32
32
  if (s === "hours") {
33
33
  if (h === "12h") return Array.from({ length: 12 }, (a, i) => {
34
34
  const o = i + 1;
@@ -36,17 +36,17 @@ var p = (r) => r.toString().padStart(2, "0"), N = (r, g, h) => {
36
36
  degrees: o * 30,
37
37
  inner: !1,
38
38
  label: `${o}`,
39
- selected: (r.hours % 12 || 12) === o,
39
+ selected: (n.hours % 12 || 12) === o,
40
40
  value: o
41
41
  };
42
42
  });
43
- const t = Array.from({ length: 12 }, (a, i) => {
43
+ const e = Array.from({ length: 12 }, (a, i) => {
44
44
  const o = i + 1;
45
45
  return {
46
46
  degrees: o * 30,
47
47
  inner: !1,
48
48
  label: `${o}`,
49
- selected: r.hours === o,
49
+ selected: n.hours === o,
50
50
  value: o
51
51
  };
52
52
  }), c = Array.from({ length: 12 }, (a, i) => {
@@ -54,240 +54,250 @@ var p = (r) => r.toString().padStart(2, "0"), N = (r, g, h) => {
54
54
  return {
55
55
  degrees: i * 30,
56
56
  inner: !0,
57
- label: p(o),
58
- selected: r.hours === o,
57
+ label: M(o),
58
+ selected: n.hours === o,
59
59
  value: o
60
60
  };
61
61
  });
62
- return [...t, ...c];
62
+ return [...e, ...c];
63
63
  }
64
- const n = s === "minutes" ? r.minutes : r.seconds;
65
- return Array.from({ length: 12 }, (t, c) => {
64
+ const r = s === "minutes" ? n.minutes : n.seconds;
65
+ return Array.from({ length: 12 }, (e, c) => {
66
66
  const a = c * 5;
67
67
  return {
68
68
  degrees: a * 6,
69
69
  inner: !1,
70
- label: p(a),
71
- selected: n === a,
70
+ label: M(a),
71
+ selected: r === a,
72
72
  value: a
73
73
  };
74
74
  });
75
75
  }, [
76
76
  s,
77
77
  h,
78
- r.hours,
79
- r.minutes,
80
- r.seconds
81
- ]), j = b(() => s === "hours" ? {
82
- degrees: r.hours % 12 * 30,
83
- radius: h === "24h" && en(r.hours) ? e.innerRadius : e.outerRadius
78
+ n.hours,
79
+ n.minutes,
80
+ n.seconds
81
+ ]), T = b(() => s === "hours" ? {
82
+ degrees: n.hours % 12 * 30,
83
+ radius: h === "24h" && er(n.hours) ? t.innerRadius : t.outerRadius
84
84
  } : {
85
- degrees: (s === "minutes" ? r.minutes : r.seconds) * 6,
86
- radius: e.outerRadius
85
+ degrees: (s === "minutes" ? n.minutes : n.seconds) * 6,
86
+ radius: t.outerRadius
87
87
  }, [
88
88
  s,
89
89
  h,
90
- e.innerRadius,
91
- e.outerRadius,
92
- r.hours,
93
- r.minutes,
94
- r.seconds
95
- ]), R = N(e.center, j.radius, j.degrees), O = (n, t) => {
90
+ t.innerRadius,
91
+ t.outerRadius,
92
+ n.hours,
93
+ n.minutes,
94
+ n.seconds
95
+ ]), P = x(t.center, T.radius, T.degrees), Q = (r, e) => {
96
96
  const c = I.current?.getBoundingClientRect();
97
97
  if (!c || c.width === 0) return;
98
- const a = d / c.width, i = (n - c.left) * a - e.center, o = (t - c.top) * a - e.center, z = Math.sqrt(i * i + o * o);
99
- let x = Math.atan2(i, -o) * 180 / Math.PI;
100
- if (x < 0 && (x += 360), s === "hours") {
101
- const _ = Math.round(x / 30) % 12;
98
+ const a = d / c.width, i = (r - c.left) * a - t.center, o = (e - c.top) * a - t.center, v = Math.sqrt(i * i + o * o);
99
+ let R = Math.atan2(i, -o) * 180 / Math.PI;
100
+ if (R < 0 && (R += 360), s === "hours") {
101
+ const m = Math.round(R / 30) % 12;
102
102
  if (h === "12h") {
103
- const F = _ === 0 ? 12 : _;
103
+ const K = m === 0 ? 12 : m;
104
104
  return {
105
- ...r,
106
- hours: f ? F % 12 + 12 : F % 12
105
+ ...n,
106
+ hours: p ? K % 12 + 12 : K % 12
107
107
  };
108
108
  }
109
- const v = z < e.ringThreshold ? _ === 0 ? 0 : _ + 12 : _ === 0 ? 12 : _;
109
+ const rr = v < t.ringThreshold ? m === 0 ? 0 : m + 12 : m === 0 ? 12 : m;
110
110
  return {
111
- ...r,
112
- hours: v
111
+ ...n,
112
+ hours: rr
113
113
  };
114
114
  }
115
- const U = s === "minutes" ? A : w, B = Math.round(Math.round(x / 6) / U) * U % 60;
115
+ const B = s === "minutes" ? w : D, F = Math.round(Math.round(R / 6) / B) * B % 60;
116
116
  return s === "minutes" ? {
117
- ...r,
118
- minutes: B
117
+ ...n,
118
+ minutes: F
119
119
  } : {
120
- ...r,
121
- seconds: B
120
+ ...n,
121
+ seconds: F
122
122
  };
123
- }, P = (n) => {
124
- const t = O(n.clientX, n.clientY);
125
- t && g(t);
126
- }, Q = (n) => {
127
- l || (M.current = !0, n.currentTarget.setPointerCapture(n.pointerId), P(n));
128
- }, S = (n) => {
129
- l || !M.current || P(n);
130
- }, V = (n) => {
131
- l || !M.current || (M.current = !1, n.currentTarget.releasePointerCapture(n.pointerId), P(n), C());
132
- }, H = (n) => {
123
+ }, $ = (r) => {
124
+ const e = Q(r.clientX, r.clientY);
125
+ e && g(e);
126
+ }, S = (r) => {
127
+ if (!u) {
128
+ _.current = !0, $(r);
129
+ try {
130
+ r.currentTarget.setPointerCapture(r.pointerId);
131
+ } catch {
132
+ }
133
+ }
134
+ }, V = (r) => {
135
+ u || !_.current || $(r);
136
+ }, W = (r) => {
137
+ u || !_.current || (_.current = !1, r.currentTarget.hasPointerCapture(r.pointerId) && r.currentTarget.releasePointerCapture(r.pointerId), $(r), N());
138
+ }, j = () => {
139
+ u || !_.current || (_.current = !1, N());
140
+ }, H = (r) => {
133
141
  if (s === "hours") {
134
142
  if (h === "12h") {
135
- const t = ((r.hours % 12 || 12) - 1 + n + 12) % 12 + 1;
143
+ const e = ((n.hours % 12 || 12) - 1 + r + 12) % 12 + 1;
136
144
  g({
137
- ...r,
138
- hours: f ? t % 12 + 12 : t % 12
145
+ ...n,
146
+ hours: p ? e % 12 + 12 : e % 12
139
147
  });
140
148
  return;
141
149
  }
142
150
  g({
143
- ...r,
144
- hours: (r.hours + n + 24) % 24
151
+ ...n,
152
+ hours: (n.hours + r + 24) % 24
145
153
  });
146
154
  return;
147
155
  }
148
156
  if (s === "minutes") {
149
157
  g({
150
- ...r,
151
- minutes: (r.minutes + n * A + 60) % 60
158
+ ...n,
159
+ minutes: (n.minutes + r * w + 60) % 60
152
160
  });
153
161
  return;
154
162
  }
155
163
  g({
156
- ...r,
157
- seconds: (r.seconds + n * w + 60) % 60
164
+ ...n,
165
+ seconds: (n.seconds + r * D + 60) % 60
158
166
  });
159
- }, W = (n) => {
160
- if (!l) {
161
- if (n.key === "ArrowUp" || n.key === "ArrowRight") {
162
- n.preventDefault(), H(1);
167
+ }, Z = (r) => {
168
+ if (!u) {
169
+ if (r.key === "ArrowUp" || r.key === "ArrowRight") {
170
+ r.preventDefault(), H(1);
163
171
  return;
164
172
  }
165
- if (n.key === "ArrowDown" || n.key === "ArrowLeft") {
166
- n.preventDefault(), H(-1);
173
+ if (r.key === "ArrowDown" || r.key === "ArrowLeft") {
174
+ r.preventDefault(), H(-1);
167
175
  return;
168
176
  }
169
- (n.key === "Enter" || n.key === " ") && (n.preventDefault(), C());
177
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), N());
170
178
  }
171
- }, T = (n) => {
172
- l || n === f || g({
173
- ...r,
174
- hours: n ? r.hours % 12 + 12 : r.hours % 12
179
+ }, U = (r) => {
180
+ u || r === p || g({
181
+ ...n,
182
+ hours: r ? n.hours % 12 + 12 : n.hours % 12
175
183
  });
176
- }, $ = (n) => `analog-clock__segment${s === n ? " analog-clock__segment--active" : ""}`, Z = h === "12h" ? r.hours % 12 || 12 : r.hours;
177
- return /* @__PURE__ */ m("div", {
178
- className: `analog-clock${l ? " analog-clock--disabled" : ""} ${X}`.trim(),
179
- children: [q && /* @__PURE__ */ m("div", {
184
+ }, A = (r) => `analog-clock__segment${s === r ? " analog-clock__segment--active" : ""}`, z = h === "12h" ? n.hours % 12 || 12 : n.hours;
185
+ return /* @__PURE__ */ f("div", {
186
+ className: `analog-clock${u ? " analog-clock--disabled" : ""} ${Y}`.trim(),
187
+ children: [q && /* @__PURE__ */ f("div", {
180
188
  className: "analog-clock__header",
181
- children: [/* @__PURE__ */ m("div", {
189
+ children: [/* @__PURE__ */ f("div", {
182
190
  className: "analog-clock__readout",
183
191
  children: [
184
- /* @__PURE__ */ u("button", {
192
+ /* @__PURE__ */ l("button", {
185
193
  type: "button",
186
- className: $("hours"),
187
- disabled: l,
194
+ className: A("hours"),
195
+ disabled: u,
188
196
  onClick: () => y("hours"),
189
- children: p(Z)
197
+ children: M(z)
190
198
  }),
191
- /* @__PURE__ */ u("span", {
199
+ /* @__PURE__ */ l("span", {
192
200
  className: "analog-clock__separator",
193
201
  children: ":"
194
202
  }),
195
- /* @__PURE__ */ u("button", {
203
+ /* @__PURE__ */ l("button", {
196
204
  type: "button",
197
- className: $("minutes"),
198
- disabled: l,
205
+ className: A("minutes"),
206
+ disabled: u,
199
207
  onClick: () => y("minutes"),
200
- children: p(r.minutes)
208
+ children: M(n.minutes)
201
209
  }),
202
- k && /* @__PURE__ */ m(rn, { children: [/* @__PURE__ */ u("span", {
210
+ k && /* @__PURE__ */ f(tr, { children: [/* @__PURE__ */ l("span", {
203
211
  className: "analog-clock__separator",
204
212
  children: ":"
205
- }), /* @__PURE__ */ u("button", {
213
+ }), /* @__PURE__ */ l("button", {
206
214
  type: "button",
207
- className: $("seconds"),
208
- disabled: l,
215
+ className: A("seconds"),
216
+ disabled: u,
209
217
  onClick: () => y("seconds"),
210
- children: p(r.seconds)
218
+ children: M(n.seconds)
211
219
  })] })
212
220
  ]
213
- }), h === "12h" && /* @__PURE__ */ m("div", {
221
+ }), h === "12h" && /* @__PURE__ */ f("div", {
214
222
  className: "analog-clock__period",
215
- children: [/* @__PURE__ */ u("button", {
223
+ children: [/* @__PURE__ */ l("button", {
216
224
  type: "button",
217
- className: `analog-clock__period-button${f ? "" : " analog-clock__period-button--active"}`,
218
- disabled: l,
219
- onClick: () => T(!1),
225
+ className: `analog-clock__period-button${p ? "" : " analog-clock__period-button--active"}`,
226
+ disabled: u,
227
+ onClick: () => U(!1),
220
228
  children: "AM"
221
- }), /* @__PURE__ */ u("button", {
229
+ }), /* @__PURE__ */ l("button", {
222
230
  type: "button",
223
- className: `analog-clock__period-button${f ? " analog-clock__period-button--active" : ""}`,
224
- disabled: l,
225
- onClick: () => T(!0),
231
+ className: `analog-clock__period-button${p ? " analog-clock__period-button--active" : ""}`,
232
+ disabled: u,
233
+ onClick: () => U(!0),
226
234
  children: "PM"
227
235
  })]
228
236
  })]
229
- }), /* @__PURE__ */ m("svg", {
237
+ }), /* @__PURE__ */ f("svg", {
230
238
  ref: I,
231
239
  className: "analog-clock__dial",
232
240
  width: d,
233
241
  height: d,
234
242
  viewBox: `0 0 ${d} ${d}`,
235
- tabIndex: l ? -1 : 0,
236
- onPointerDown: Q,
237
- onPointerMove: S,
238
- onPointerUp: V,
239
- onKeyDown: W,
243
+ tabIndex: u ? -1 : 0,
244
+ onPointerDown: S,
245
+ onPointerMove: V,
246
+ onPointerUp: W,
247
+ onPointerCancel: j,
248
+ onLostPointerCapture: j,
249
+ onKeyDown: Z,
240
250
  children: [
241
- /* @__PURE__ */ u("circle", {
251
+ /* @__PURE__ */ l("circle", {
242
252
  className: "analog-clock__face",
243
- cx: e.center,
244
- cy: e.center,
245
- r: e.center - 1
253
+ cx: t.center,
254
+ cy: t.center,
255
+ r: t.center - 1
246
256
  }),
247
- s !== "hours" && Array.from({ length: 60 }, (n, t) => {
248
- const c = t % 5 === 0, a = N(e.center, e.outerRadius + e.knobRadius * 0.55, t * 6), i = N(e.center, e.outerRadius + e.knobRadius * (c ? 0.95 : 0.8), t * 6);
249
- return /* @__PURE__ */ u("line", {
257
+ s !== "hours" && Array.from({ length: 60 }, (r, e) => {
258
+ const c = e % 5 === 0, a = x(t.center, t.outerRadius + t.knobRadius * 0.55, e * 6), i = x(t.center, t.outerRadius + t.knobRadius * (c ? 0.95 : 0.8), e * 6);
259
+ return /* @__PURE__ */ l("line", {
250
260
  className: `analog-clock__tick${c ? " analog-clock__tick--major" : ""}`,
251
261
  x1: a.x,
252
262
  y1: a.y,
253
263
  x2: i.x,
254
264
  y2: i.y
255
- }, `tick-${t}`);
265
+ }, `tick-${e}`);
256
266
  }),
257
- /* @__PURE__ */ u("line", {
267
+ /* @__PURE__ */ l("line", {
258
268
  className: "analog-clock__hand",
259
- x1: e.center,
260
- y1: e.center,
261
- x2: R.x,
262
- y2: R.y
269
+ x1: t.center,
270
+ y1: t.center,
271
+ x2: P.x,
272
+ y2: P.y
263
273
  }),
264
- /* @__PURE__ */ u("circle", {
274
+ /* @__PURE__ */ l("circle", {
265
275
  className: "analog-clock__knob",
266
- cx: R.x,
267
- cy: R.y,
268
- r: e.knobRadius
276
+ cx: P.x,
277
+ cy: P.y,
278
+ r: t.knobRadius
269
279
  }),
270
- /* @__PURE__ */ u("circle", {
280
+ /* @__PURE__ */ l("circle", {
271
281
  className: "analog-clock__pivot",
272
- cx: e.center,
273
- cy: e.center,
282
+ cx: t.center,
283
+ cy: t.center,
274
284
  r: d * 0.017
275
285
  }),
276
- J.map((n) => {
277
- const t = N(e.center, n.inner ? e.innerRadius : e.outerRadius, n.degrees);
278
- return /* @__PURE__ */ u("text", {
279
- className: `analog-clock__number${n.inner ? " analog-clock__number--inner" : ""}${n.selected ? " analog-clock__number--selected" : ""}`,
280
- x: t.x,
281
- y: t.y,
286
+ O.map((r) => {
287
+ const e = x(t.center, r.inner ? t.innerRadius : t.outerRadius, r.degrees);
288
+ return /* @__PURE__ */ l("text", {
289
+ className: `analog-clock__number${r.inner ? " analog-clock__number--inner" : ""}${r.selected ? " analog-clock__number--selected" : ""}`,
290
+ x: e.x,
291
+ y: e.y,
282
292
  textAnchor: "middle",
283
293
  dominantBaseline: "central",
284
- children: n.label
285
- }, `${s}-${n.inner ? "inner" : "outer"}-${n.value}`);
294
+ children: r.label
295
+ }, `${s}-${r.inner ? "inner" : "outer"}-${r.value}`);
286
296
  })
287
297
  ]
288
298
  })]
289
299
  });
290
300
  };
291
301
  export {
292
- an as AnalogClock
302
+ ir as AnalogClock
293
303
  };
@@ -1 +1 @@
1
- .input-time-wrapper{gap:var(--spacing-8);flex-direction:column;display:flex}.input-time-wrapper .input-time-label{color:var(--form-control-label-color,var(--form-control-color));font-size:var(--form-control-label-font-size,var(--font-size-sm));font-weight:var(--form-control-label-font-weight,var(--font-weight-medium));letter-spacing:var(--form-control-label-letter-spacing,normal);text-transform:var(--form-control-label-text-transform,none)}.input-time-wrapper .input-time-label .input-time-required{color:var(--body-danger-color,#dc2626);margin-left:var(--spacing-2)}.input-time-wrapper .input-time{background-color:var(--form-control-background-color);color:var(--form-control-color);border:var(--spacing-1) solid var(--form-control-border-color);border-radius:var(--radius-sm);padding:var(--spacing-12);font-family:var(--form-control-font-family);font-size:var(--font-size-sm);line-height:var(--line-height-normal);box-sizing:border-box;width:100%}.input-time-wrapper .input-time:focus{background-color:var(--form-control-focus-background-color);border-color:var(--form-control-focus-border-color);color:var(--form-control-focus-color);box-shadow:0 0 0 var(--spacing-2) var(--box-shadow);outline:none}.input-time-wrapper .input-time::placeholder{color:var(--form-control-placeholder-color)}.input-time-wrapper .input-time::-webkit-calendar-picker-indicator{filter:invert(.5);cursor:pointer;opacity:.7}.input-time-wrapper .input-time::-webkit-calendar-picker-indicator:hover{opacity:1}.input-time-wrapper .input-time.input-time-error{background-color:var(--form-control-error-background-color);border-color:var(--form-control-error-border-color);color:var(--form-control-error-color)}.input-time-wrapper .input-time.input-time-error:focus{background-color:var(--form-control-error-background-color);border-color:var(--form-control-error-border-color);box-shadow:0 0 0 var(--spacing-2) var(--box-shadow)}.input-time-wrapper .input-time.input-time-success{background-color:var(--form-control-success-background-color);border-color:var(--form-control-success-border-color);color:var(--form-control-success-color)}.input-time-wrapper .input-time.input-time-success:focus{background-color:var(--form-control-success-background-color);border-color:var(--form-control-success-border-color);box-shadow:0 0 0 var(--spacing-2) var(--box-shadow)}.input-time-wrapper.input-time-highlighted .input-time{border-color:var(--form-control-focus-border-color)}.input-time-wrapper .input-time-error-message{font-size:var(--font-size-xs);color:var(--form-control-error-color)}.input-time-wrapper .input-time-success-message{font-size:var(--font-size-xs);color:var(--form-control-success-color)}.input-time-field{align-items:center;display:flex;position:relative}.input-time-field--with-clock .input-time{padding-right:var(--spacing-40)}.input-time-field--with-clock .input-time::-webkit-calendar-picker-indicator{display:none}.input-time-clock-button{border-radius:var(--radius-sm);color:var(--form-control-color);cursor:pointer;font-size:var(--font-size-md);padding:var(--spacing-4);right:var(--spacing-8);transition:background-color var(--transition-fast), color var(--transition-fast);background-color:#0000;border:none;justify-content:center;align-items:center;line-height:1;display:flex;position:absolute}.input-time-clock-button:hover:not(:disabled){background-color:var(--calendar-day-hover-background-color)}.input-time-clock-button--active{background-color:var(--calendar-day-selected-background-color);color:var(--calendar-day-selected-color)}.input-time-clock-button:disabled{cursor:not-allowed;opacity:.5}
1
+ .input-time-wrapper{gap:var(--spacing-8);flex-direction:column;display:flex}.input-time-wrapper .input-time-label{color:var(--form-control-label-color,var(--form-control-color));font-size:var(--form-control-label-font-size,var(--font-size-sm));font-weight:var(--form-control-label-font-weight,var(--font-weight-medium));letter-spacing:var(--form-control-label-letter-spacing,normal);text-transform:var(--form-control-label-text-transform,none)}.input-time-wrapper .input-time-label .input-time-required{color:var(--body-danger-color,#dc2626);margin-left:var(--spacing-2)}.input-time-wrapper .input-time{background-color:var(--form-control-background-color);color:var(--form-control-color);border:var(--spacing-1) solid var(--form-control-border-color);border-radius:var(--radius-sm);padding:var(--spacing-12);font-family:var(--form-control-font-family);font-size:var(--font-size-sm);line-height:var(--line-height-normal);box-sizing:border-box;width:100%}.input-time-wrapper .input-time:focus{background-color:var(--form-control-focus-background-color);border-color:var(--form-control-focus-border-color);color:var(--form-control-focus-color);box-shadow:0 0 0 var(--spacing-2) var(--box-shadow);outline:none}.input-time-wrapper .input-time::placeholder{color:var(--form-control-placeholder-color)}.input-time-wrapper .input-time.input-time-error{background-color:var(--form-control-error-background-color);border-color:var(--form-control-error-border-color);color:var(--form-control-error-color)}.input-time-wrapper .input-time.input-time-error:focus{background-color:var(--form-control-error-background-color);border-color:var(--form-control-error-border-color);box-shadow:0 0 0 var(--spacing-2) var(--box-shadow)}.input-time-wrapper .input-time.input-time-success{background-color:var(--form-control-success-background-color);border-color:var(--form-control-success-border-color);color:var(--form-control-success-color)}.input-time-wrapper .input-time.input-time-success:focus{background-color:var(--form-control-success-background-color);border-color:var(--form-control-success-border-color);box-shadow:0 0 0 var(--spacing-2) var(--box-shadow)}.input-time-wrapper.input-time-highlighted .input-time{border-color:var(--form-control-focus-border-color)}.input-time-wrapper .input-time-error-message{font-size:var(--font-size-xs);color:var(--form-control-error-color)}.input-time-wrapper .input-time-success-message{font-size:var(--font-size-xs);color:var(--form-control-success-color)}.input-time-field{align-items:center;display:flex;position:relative}.input-time-field--with-clock .input-time{padding-right:var(--spacing-40)}.input-time-clock-button{border-radius:var(--radius-sm);color:var(--form-control-color);cursor:pointer;font-size:var(--font-size-md);padding:var(--spacing-4);right:var(--spacing-8);transition:background-color var(--transition-fast), color var(--transition-fast);background-color:#0000;border:none;justify-content:center;align-items:center;line-height:1;display:flex;position:absolute}.input-time-clock-button:hover:not(:disabled){background-color:var(--calendar-day-hover-background-color)}.input-time-clock-button--active{background-color:var(--calendar-day-selected-background-color);color:var(--calendar-day-selected-color)}.input-time-clock-button:disabled{cursor:not-allowed;opacity:.5}
@@ -1,86 +1,107 @@
1
1
  import './InputTime.css';
2
- import { Icon as R } from "../Icon/Icon2.js";
3
- import { Popover as S } from "../Popover/Popover2.js";
4
- import { TimePicker as j } from "../TimePicker/TimePicker2.js";
2
+ import { Icon as L } from "../Icon/Icon2.js";
3
+ import { Popover as M } from "../Popover/Popover2.js";
4
+ import { TimePicker as O } from "../TimePicker/TimePicker2.js";
5
5
  /* empty css */
6
- import { forwardRef as w, useRef as y, useState as E } from "react";
7
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
8
- var b = (i) => i.toString().padStart(2, "0"), O = (i) => {
9
- const [n, t] = (i ?? "").split(":").map(Number);
6
+ import { forwardRef as q, useRef as z, useState as R } from "react";
7
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
8
+ var c = (i) => i.toString().padStart(2, "0"), y = (i, s) => {
9
+ const t = i.trim().match(/^(\d{1,2}):?(\d{2})$/) ?? (s ? i.trim().match(/^(\d{1,2})()$/) : null);
10
+ if (!t) return;
11
+ const l = Number(t[1]), a = t[2] === "" ? 0 : Number(t[2]);
12
+ if (!(l > 23 || a > 59))
13
+ return `${c(l)}:${c(a)}`;
14
+ }, A = (i) => {
15
+ const [s, t] = (i ?? "").split(":").map(Number);
10
16
  return {
11
- hours: Number.isFinite(n) ? n : 0,
17
+ hours: Number.isFinite(s) ? s : 0,
12
18
  minutes: Number.isFinite(t) ? t : 0,
13
19
  seconds: 0
14
20
  };
15
- }, q = w(({ autoFocus: i, disabled: n, error: t, highlighted: v, id: o, label: c, max: k, min: g, minuteStep: C = 1, onBlur: $, onChange: p, onClick: I, onKeyDown: T, onKeyUp: x, readOnly: u = !1, required: d = !1, success: a, value: f, withClock: l = !1 }, F) => {
16
- const [m, h] = E(!1), N = y(null), P = (s) => {
17
- p?.(`${b(s.hours)}:${b(s.minutes)}`);
21
+ }, G = q(({ autoFocus: i, disabled: s, error: t, highlighted: l, id: a, label: v, max: N, min: b, minuteStep: F = 1, onBlur: P, onChange: o, onClick: S, onKeyDown: j, onKeyUp: w, readOnly: $ = !1, required: k = !1, success: u, value: g, withClock: p = !1 }, x) => {
22
+ const [d, I] = R(!1), [m, f] = R(void 0), C = z(null), T = (e) => (!b || e >= b) && (!N || e <= N), B = (e) => {
23
+ f(void 0), o?.(`${c(e.hours)}:${c(e.minutes)}`);
24
+ }, D = (e) => {
25
+ f(e);
26
+ const r = y(e, !1);
27
+ r && T(r) && o?.(r);
28
+ }, E = (e) => {
29
+ if (m !== void 0) {
30
+ if (m.trim() === "") o?.(void 0);
31
+ else {
32
+ const r = y(m, !0);
33
+ r && T(r) && o?.(r);
34
+ }
35
+ f(void 0);
36
+ }
37
+ P?.(e);
18
38
  };
19
- return /* @__PURE__ */ r("div", {
20
- className: `input-time-wrapper${v ? " input-time-highlighted" : ""}`,
39
+ return /* @__PURE__ */ h("div", {
40
+ className: `input-time-wrapper${l ? " input-time-highlighted" : ""}`,
21
41
  children: [
22
- c && /* @__PURE__ */ r("label", {
23
- htmlFor: o,
42
+ v && /* @__PURE__ */ h("label", {
43
+ htmlFor: a,
24
44
  className: "input-time-label",
25
- children: [c, d && /* @__PURE__ */ e("span", {
45
+ children: [v, k && /* @__PURE__ */ n("span", {
26
46
  className: "input-time-required",
27
47
  children: "*"
28
48
  })]
29
49
  }),
30
- /* @__PURE__ */ r("div", {
31
- ref: N,
32
- className: `input-time-field${l ? " input-time-field--with-clock" : ""}`,
33
- children: [/* @__PURE__ */ e("input", {
50
+ /* @__PURE__ */ h("div", {
51
+ ref: C,
52
+ className: `input-time-field${p ? " input-time-field--with-clock" : ""}`,
53
+ children: [/* @__PURE__ */ n("input", {
34
54
  autoFocus: i,
35
- disabled: n,
36
- type: "time",
37
- className: `input-time${t ? " input-time-error" : ""}${a ? " input-time-success" : ""}`,
38
- id: o,
39
- max: k,
40
- min: g,
41
- ref: F,
42
- value: f ?? "",
43
- onBlur: $,
44
- onChange: (s) => p?.(s.target.value || void 0),
45
- onClick: I,
46
- onKeyDown: T,
47
- onKeyUp: x,
48
- readOnly: u,
49
- required: d
50
- }), l && /* @__PURE__ */ e("button", {
51
- className: `input-time-clock-button${m ? " input-time-clock-button--active" : ""}`,
52
- disabled: n || u,
53
- onClick: () => h(!m),
55
+ disabled: s,
56
+ type: "text",
57
+ inputMode: "numeric",
58
+ maxLength: 5,
59
+ placeholder: "--:--",
60
+ className: `input-time${t ? " input-time-error" : ""}${u ? " input-time-success" : ""}`,
61
+ id: a,
62
+ ref: x,
63
+ value: m ?? g?.slice(0, 5) ?? "",
64
+ onBlur: E,
65
+ onChange: (e) => D(e.target.value),
66
+ onClick: S,
67
+ onKeyDown: j,
68
+ onKeyUp: w,
69
+ readOnly: $,
70
+ required: k
71
+ }), p && /* @__PURE__ */ n("button", {
72
+ className: `input-time-clock-button${d ? " input-time-clock-button--active" : ""}`,
73
+ disabled: s || $,
74
+ onClick: () => I(!d),
54
75
  title: "Pick on a clock",
55
76
  type: "button",
56
- children: /* @__PURE__ */ e(R, { name: "time" })
77
+ children: /* @__PURE__ */ n(L, { name: "time" })
57
78
  })]
58
79
  }),
59
- t && /* @__PURE__ */ e("span", {
80
+ t && /* @__PURE__ */ n("span", {
60
81
  className: "input-time-error-message",
61
82
  children: t
62
83
  }),
63
- a && /* @__PURE__ */ e("span", {
84
+ u && /* @__PURE__ */ n("span", {
64
85
  className: "input-time-success-message",
65
- children: a
86
+ children: u
66
87
  }),
67
- l && /* @__PURE__ */ e(S, {
68
- visible: m,
69
- onClose: () => h(!1),
70
- anchorEl: N.current,
71
- children: /* @__PURE__ */ e(j, {
88
+ p && /* @__PURE__ */ n(M, {
89
+ visible: d,
90
+ onClose: () => I(!1),
91
+ anchorEl: C.current,
92
+ children: /* @__PURE__ */ n(O, {
72
93
  collapsibleClock: !1,
73
94
  label: "",
74
- minuteStep: C,
75
- onChange: P,
76
- value: O(f),
95
+ minuteStep: F,
96
+ onChange: B,
97
+ value: A(g),
77
98
  withClock: !0
78
99
  })
79
100
  })
80
101
  ]
81
102
  });
82
103
  });
83
- q.displayName = "InputTime";
104
+ G.displayName = "InputTime";
84
105
  export {
85
- q as InputTime
106
+ G as InputTime
86
107
  };
@@ -23,7 +23,7 @@ var r = (i) => {
23
23
  const o = {
24
24
  ...i,
25
25
  lib: d,
26
- libBuildNumber: 563,
26
+ libBuildNumber: 565,
27
27
  libCommit: n,
28
28
  libBuildDate: t
29
29
  };
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- var I = "3.15.0", B = 563, L = "a5c437b", _ = "2026-10-25T15:04:49.385Z", a = "563";
1
+ var I = "3.15.1", B = 565, L = "781b6ae", _ = "2026-10-25T15:06:51.141Z", a = "565";
2
2
  export {
3
3
  _ as LIB_BUILD_DATE,
4
4
  a as LIB_BUILD_ID,
package/dist/version.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "3.15.0",
3
- "buildNumber": 563,
4
- "commit": "a5c437b",
5
- "buildDate": "2026-10-25T15:04:49.385Z"
2
+ "version": "3.15.1",
3
+ "buildNumber": 565,
4
+ "commit": "781b6ae",
5
+ "buildDate": "2026-10-25T15:06:51.141Z"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memobit/libs",
3
- "version": "3.15.0",
3
+ "version": "3.15.1",
4
4
  "description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
5
5
  "keywords": [
6
6
  "react",