@memobit/libs 3.15.0 → 3.16.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.
- package/README.md +96 -96
- package/dist/components/AnalogClock/AnalogClock2.js +156 -146
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +1 -1
- package/dist/components/Dropdown/Dropdown.css +1 -1
- package/dist/components/Dropdown/Dropdown2.js +40 -33
- package/dist/components/InputTime/InputTime.css +1 -1
- package/dist/components/InputTime/InputTime2.js +74 -53
- package/dist/helpers/FilterOptions.js +36 -32
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +152 -148
- package/dist/styles/base.scss +36 -36
- package/dist/styles/effects.scss +72 -72
- package/dist/styles/highlight.scss +6 -6
- package/dist/styles/scrollbars.scss +30 -30
- package/dist/styles/utilities.scss +238 -238
- package/dist/styles/utility-classes.scss +93 -93
- package/dist/styles/variables.scss +73 -73
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +147 -147
- /package/dist/{node_modules → D_/Projects/Web Apps/LIBRARIES/memobit-react/node_modules}/qrcode.react/lib/esm/index.js +0 -0
package/README.md
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
# @memobit/libs
|
|
2
|
-
|
|
3
|
-
A TypeScript-first React component library — 100+ components, 70+ themes, plus the hooks and helpers needed to glue them together. Built for, and battle-tested across, the [Memobit](https://memobit.ro) family of apps.
|
|
4
|
-
|
|
5
|
-
**📚 Live documentation & component playground → [react.memobit.ro](https://react.memobit.ro/)**
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install @memobit/libs
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Peer dependencies (you provide these in your own app):
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install react@^19 react-dom@^19 @memobit/core
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Quick start
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import { Button, Card, ToastProvider, useToast } from '@memobit/libs';
|
|
25
|
-
import '@memobit/libs/dist/index.css';
|
|
26
|
-
import '@memobit/libs/dist/styles/themes.scss'; // optional — only if you want the bundled themes
|
|
27
|
-
|
|
28
|
-
function App() {
|
|
29
|
-
return (
|
|
30
|
-
<ToastProvider>
|
|
31
|
-
<Demo />
|
|
32
|
-
</ToastProvider>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Demo() {
|
|
37
|
-
const { showToast } = useToast();
|
|
38
|
-
return (
|
|
39
|
-
<Card>
|
|
40
|
-
<Button onClick={() => showToast({ type: 'success', message: 'Hello' })}>
|
|
41
|
-
Click me
|
|
42
|
-
</Button>
|
|
43
|
-
</Card>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## What's in the box
|
|
49
|
-
|
|
50
|
-
- **Components** — Buttons, forms (Input/Select/Checkbox/DatePicker/ColorPicker/EmojiPicker/FileDropzone…), navigation (Breadcrumb/AppHeader/ControlPanel/Tabs…), overlays (Drawer/Modal/ConfirmDialog/ContextMenu/Tooltip…), data (DataView/Table/Calendar/CalendarHeatmap/Chart…), feedback (Toast/Banner/Badge/Chip/EmptyState…), and many more.
|
|
51
|
-
- **Icons** — 470+ stroke icons, each tree-shakeable.
|
|
52
|
-
- **Themes** — 70+ ready-made SCSS themes (Arctic Blue, Midnight Atlas, Terracotta Kitchen, Neon Tokyo, …). Theme tokens are pure CSS custom properties, so you can author your own.
|
|
53
|
-
- **Hooks** — `useBreakpoint`, `useBodyScrollLock`, `useComponentEffect`, `useAppPersistence`, `useAuth`.
|
|
54
|
-
- **Helpers** — date formatting, number formatting, string utilities, search/highlight, pagination, URL helpers.
|
|
55
|
-
- **Error reporting** — lives in [`@memobit/core`](https://www.npmjs.com/package/@memobit/core) (React-free, works in Node too), a peer dependency: `ErrorBoundary` crashes are reported through it once the app calls `installErrorReporting`.
|
|
56
|
-
|
|
57
|
-
See the [component reference](https://react.memobit.ro/) for props, variants, and live examples.
|
|
58
|
-
|
|
59
|
-
## Theming
|
|
60
|
-
|
|
61
|
-
Themes ship as standalone SCSS files. Pick what you need:
|
|
62
|
-
|
|
63
|
-
```scss
|
|
64
|
-
// import everything
|
|
65
|
-
@use '@memobit/libs/dist/styles/themes.scss';
|
|
66
|
-
|
|
67
|
-
// or a single theme
|
|
68
|
-
@use '@memobit/libs/dist/styles/theming/arctic-blue.scss';
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
All tokens — spacing, typography, radii, transitions, colors — are exposed as CSS custom properties (`--spacing-8`, `--card-bg`, `--button-primary-bg`, etc.) so you can override per-component or per-route without forking the library.
|
|
72
|
-
|
|
73
|
-
Token reference:
|
|
74
|
-
|
|
75
|
-
- Sizing / spacing / radii / transitions → `@memobit/libs/dist/styles/variables.scss`
|
|
76
|
-
- Theme colors → `@memobit/libs/dist/styles/theming/*.scss`
|
|
77
|
-
|
|
78
|
-
## Requirements
|
|
79
|
-
|
|
80
|
-
- React **19.2+** and React DOM **19.2+** (peer deps)
|
|
81
|
-
- ESM-only (your bundler must support ESM — Vite, Next.js 13+, Webpack 5, esbuild, Rollup all do)
|
|
82
|
-
- For SCSS imports: a Sass-capable bundler
|
|
83
|
-
|
|
84
|
-
## TypeScript
|
|
85
|
-
|
|
86
|
-
Type definitions are bundled (`dist/index.d.ts`). No `@types/...` package required.
|
|
87
|
-
|
|
88
|
-
## License
|
|
89
|
-
|
|
90
|
-
[Apache 2.0](./LICENSE) © Iulian Cristea
|
|
91
|
-
|
|
92
|
-
## Links
|
|
93
|
-
|
|
94
|
-
- 📚 Docs & playground — https://react.memobit.ro/
|
|
95
|
-
- 🐙 Source — https://github.com/CristeaIulian/memobit-react-library
|
|
96
|
-
- 📦 npm — https://www.npmjs.com/package/@memobit/libs
|
|
1
|
+
# @memobit/libs
|
|
2
|
+
|
|
3
|
+
A TypeScript-first React component library — 100+ components, 70+ themes, plus the hooks and helpers needed to glue them together. Built for, and battle-tested across, the [Memobit](https://memobit.ro) family of apps.
|
|
4
|
+
|
|
5
|
+
**📚 Live documentation & component playground → [react.memobit.ro](https://react.memobit.ro/)**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @memobit/libs
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Peer dependencies (you provide these in your own app):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install react@^19 react-dom@^19 @memobit/core
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Button, Card, ToastProvider, useToast } from '@memobit/libs';
|
|
25
|
+
import '@memobit/libs/dist/index.css';
|
|
26
|
+
import '@memobit/libs/dist/styles/themes.scss'; // optional — only if you want the bundled themes
|
|
27
|
+
|
|
28
|
+
function App() {
|
|
29
|
+
return (
|
|
30
|
+
<ToastProvider>
|
|
31
|
+
<Demo />
|
|
32
|
+
</ToastProvider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function Demo() {
|
|
37
|
+
const { showToast } = useToast();
|
|
38
|
+
return (
|
|
39
|
+
<Card>
|
|
40
|
+
<Button onClick={() => showToast({ type: 'success', message: 'Hello' })}>
|
|
41
|
+
Click me
|
|
42
|
+
</Button>
|
|
43
|
+
</Card>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## What's in the box
|
|
49
|
+
|
|
50
|
+
- **Components** — Buttons, forms (Input/Select/Checkbox/DatePicker/ColorPicker/EmojiPicker/FileDropzone…), navigation (Breadcrumb/AppHeader/ControlPanel/Tabs…), overlays (Drawer/Modal/ConfirmDialog/ContextMenu/Tooltip…), data (DataView/Table/Calendar/CalendarHeatmap/Chart…), feedback (Toast/Banner/Badge/Chip/EmptyState…), and many more.
|
|
51
|
+
- **Icons** — 470+ stroke icons, each tree-shakeable.
|
|
52
|
+
- **Themes** — 70+ ready-made SCSS themes (Arctic Blue, Midnight Atlas, Terracotta Kitchen, Neon Tokyo, …). Theme tokens are pure CSS custom properties, so you can author your own.
|
|
53
|
+
- **Hooks** — `useBreakpoint`, `useBodyScrollLock`, `useComponentEffect`, `useAppPersistence`, `useAuth`.
|
|
54
|
+
- **Helpers** — date formatting, number formatting, string utilities, search/highlight, pagination, URL helpers.
|
|
55
|
+
- **Error reporting** — lives in [`@memobit/core`](https://www.npmjs.com/package/@memobit/core) (React-free, works in Node too), a peer dependency: `ErrorBoundary` crashes are reported through it once the app calls `installErrorReporting`.
|
|
56
|
+
|
|
57
|
+
See the [component reference](https://react.memobit.ro/) for props, variants, and live examples.
|
|
58
|
+
|
|
59
|
+
## Theming
|
|
60
|
+
|
|
61
|
+
Themes ship as standalone SCSS files. Pick what you need:
|
|
62
|
+
|
|
63
|
+
```scss
|
|
64
|
+
// import everything
|
|
65
|
+
@use '@memobit/libs/dist/styles/themes.scss';
|
|
66
|
+
|
|
67
|
+
// or a single theme
|
|
68
|
+
@use '@memobit/libs/dist/styles/theming/arctic-blue.scss';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
All tokens — spacing, typography, radii, transitions, colors — are exposed as CSS custom properties (`--spacing-8`, `--card-bg`, `--button-primary-bg`, etc.) so you can override per-component or per-route without forking the library.
|
|
72
|
+
|
|
73
|
+
Token reference:
|
|
74
|
+
|
|
75
|
+
- Sizing / spacing / radii / transitions → `@memobit/libs/dist/styles/variables.scss`
|
|
76
|
+
- Theme colors → `@memobit/libs/dist/styles/theming/*.scss`
|
|
77
|
+
|
|
78
|
+
## Requirements
|
|
79
|
+
|
|
80
|
+
- React **19.2+** and React DOM **19.2+** (peer deps)
|
|
81
|
+
- ESM-only (your bundler must support ESM — Vite, Next.js 13+, Webpack 5, esbuild, Rollup all do)
|
|
82
|
+
- For SCSS imports: a Sass-capable bundler
|
|
83
|
+
|
|
84
|
+
## TypeScript
|
|
85
|
+
|
|
86
|
+
Type definitions are bundled (`dist/index.d.ts`). No `@types/...` package required.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
[Apache 2.0](./LICENSE) © Iulian Cristea
|
|
91
|
+
|
|
92
|
+
## Links
|
|
93
|
+
|
|
94
|
+
- 📚 Docs & playground — https://react.memobit.ro/
|
|
95
|
+
- 🐙 Source — https://github.com/CristeaIulian/memobit-react-library
|
|
96
|
+
- 📦 npm — https://www.npmjs.com/package/@memobit/libs
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import './AnalogClock.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { useMemo as b, useRef as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
var
|
|
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:
|
|
9
|
-
y:
|
|
8
|
+
x: n + g * Math.cos(k),
|
|
9
|
+
y: n + g * Math.sin(k)
|
|
10
10
|
};
|
|
11
|
-
},
|
|
12
|
-
const [
|
|
13
|
-
const
|
|
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:
|
|
16
|
-
knobRadius:
|
|
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 = (
|
|
22
|
-
|
|
23
|
-
},
|
|
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
|
-
},
|
|
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: (
|
|
39
|
+
selected: (n.hours % 12 || 12) === o,
|
|
40
40
|
value: o
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
|
-
const
|
|
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:
|
|
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:
|
|
58
|
-
selected:
|
|
57
|
+
label: M(o),
|
|
58
|
+
selected: n.hours === o,
|
|
59
59
|
value: o
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
|
-
return [...
|
|
62
|
+
return [...e, ...c];
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
return Array.from({ length: 12 }, (
|
|
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:
|
|
71
|
-
selected:
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]),
|
|
82
|
-
degrees:
|
|
83
|
-
radius: h === "24h" &&
|
|
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" ?
|
|
86
|
-
radius:
|
|
85
|
+
degrees: (s === "minutes" ? n.minutes : n.seconds) * 6,
|
|
86
|
+
radius: t.outerRadius
|
|
87
87
|
}, [
|
|
88
88
|
s,
|
|
89
89
|
h,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
]),
|
|
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 = (
|
|
99
|
-
let
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
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
|
|
103
|
+
const K = m === 0 ? 12 : m;
|
|
104
104
|
return {
|
|
105
|
-
...
|
|
106
|
-
hours:
|
|
105
|
+
...n,
|
|
106
|
+
hours: p ? K % 12 + 12 : K % 12
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
const
|
|
109
|
+
const rr = v < t.ringThreshold ? m === 0 ? 0 : m + 12 : m === 0 ? 12 : m;
|
|
110
110
|
return {
|
|
111
|
-
...
|
|
112
|
-
hours:
|
|
111
|
+
...n,
|
|
112
|
+
hours: rr
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const B = s === "minutes" ? w : D, F = Math.round(Math.round(R / 6) / B) * B % 60;
|
|
116
116
|
return s === "minutes" ? {
|
|
117
|
-
...
|
|
118
|
-
minutes:
|
|
117
|
+
...n,
|
|
118
|
+
minutes: F
|
|
119
119
|
} : {
|
|
120
|
-
...
|
|
121
|
-
seconds:
|
|
120
|
+
...n,
|
|
121
|
+
seconds: F
|
|
122
122
|
};
|
|
123
|
-
},
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
|
143
|
+
const e = ((n.hours % 12 || 12) - 1 + r + 12) % 12 + 1;
|
|
136
144
|
g({
|
|
137
|
-
...
|
|
138
|
-
hours:
|
|
145
|
+
...n,
|
|
146
|
+
hours: p ? e % 12 + 12 : e % 12
|
|
139
147
|
});
|
|
140
148
|
return;
|
|
141
149
|
}
|
|
142
150
|
g({
|
|
143
|
-
...
|
|
144
|
-
hours: (
|
|
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
|
-
...
|
|
151
|
-
minutes: (
|
|
158
|
+
...n,
|
|
159
|
+
minutes: (n.minutes + r * w + 60) % 60
|
|
152
160
|
});
|
|
153
161
|
return;
|
|
154
162
|
}
|
|
155
163
|
g({
|
|
156
|
-
...
|
|
157
|
-
seconds: (
|
|
164
|
+
...n,
|
|
165
|
+
seconds: (n.seconds + r * D + 60) % 60
|
|
158
166
|
});
|
|
159
|
-
},
|
|
160
|
-
if (!
|
|
161
|
-
if (
|
|
162
|
-
|
|
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 (
|
|
166
|
-
|
|
173
|
+
if (r.key === "ArrowDown" || r.key === "ArrowLeft") {
|
|
174
|
+
r.preventDefault(), H(-1);
|
|
167
175
|
return;
|
|
168
176
|
}
|
|
169
|
-
(
|
|
177
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), N());
|
|
170
178
|
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
...
|
|
174
|
-
hours:
|
|
179
|
+
}, U = (r) => {
|
|
180
|
+
u || r === p || g({
|
|
181
|
+
...n,
|
|
182
|
+
hours: r ? n.hours % 12 + 12 : n.hours % 12
|
|
175
183
|
});
|
|
176
|
-
},
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
className: `analog-clock${
|
|
179
|
-
children: [q && /* @__PURE__ */
|
|
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__ */
|
|
189
|
+
children: [/* @__PURE__ */ f("div", {
|
|
182
190
|
className: "analog-clock__readout",
|
|
183
191
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ l("button", {
|
|
185
193
|
type: "button",
|
|
186
|
-
className:
|
|
187
|
-
disabled:
|
|
194
|
+
className: A("hours"),
|
|
195
|
+
disabled: u,
|
|
188
196
|
onClick: () => y("hours"),
|
|
189
|
-
children:
|
|
197
|
+
children: M(z)
|
|
190
198
|
}),
|
|
191
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ l("span", {
|
|
192
200
|
className: "analog-clock__separator",
|
|
193
201
|
children: ":"
|
|
194
202
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ l("button", {
|
|
196
204
|
type: "button",
|
|
197
|
-
className:
|
|
198
|
-
disabled:
|
|
205
|
+
className: A("minutes"),
|
|
206
|
+
disabled: u,
|
|
199
207
|
onClick: () => y("minutes"),
|
|
200
|
-
children:
|
|
208
|
+
children: M(n.minutes)
|
|
201
209
|
}),
|
|
202
|
-
k && /* @__PURE__ */
|
|
210
|
+
k && /* @__PURE__ */ f(tr, { children: [/* @__PURE__ */ l("span", {
|
|
203
211
|
className: "analog-clock__separator",
|
|
204
212
|
children: ":"
|
|
205
|
-
}), /* @__PURE__ */
|
|
213
|
+
}), /* @__PURE__ */ l("button", {
|
|
206
214
|
type: "button",
|
|
207
|
-
className:
|
|
208
|
-
disabled:
|
|
215
|
+
className: A("seconds"),
|
|
216
|
+
disabled: u,
|
|
209
217
|
onClick: () => y("seconds"),
|
|
210
|
-
children:
|
|
218
|
+
children: M(n.seconds)
|
|
211
219
|
})] })
|
|
212
220
|
]
|
|
213
|
-
}), h === "12h" && /* @__PURE__ */
|
|
221
|
+
}), h === "12h" && /* @__PURE__ */ f("div", {
|
|
214
222
|
className: "analog-clock__period",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
223
|
+
children: [/* @__PURE__ */ l("button", {
|
|
216
224
|
type: "button",
|
|
217
|
-
className: `analog-clock__period-button${
|
|
218
|
-
disabled:
|
|
219
|
-
onClick: () =>
|
|
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__ */
|
|
229
|
+
}), /* @__PURE__ */ l("button", {
|
|
222
230
|
type: "button",
|
|
223
|
-
className: `analog-clock__period-button${
|
|
224
|
-
disabled:
|
|
225
|
-
onClick: () =>
|
|
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__ */
|
|
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:
|
|
236
|
-
onPointerDown:
|
|
237
|
-
onPointerMove:
|
|
238
|
-
onPointerUp:
|
|
239
|
-
|
|
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__ */
|
|
251
|
+
/* @__PURE__ */ l("circle", {
|
|
242
252
|
className: "analog-clock__face",
|
|
243
|
-
cx:
|
|
244
|
-
cy:
|
|
245
|
-
r:
|
|
253
|
+
cx: t.center,
|
|
254
|
+
cy: t.center,
|
|
255
|
+
r: t.center - 1
|
|
246
256
|
}),
|
|
247
|
-
s !== "hours" && Array.from({ length: 60 }, (
|
|
248
|
-
const c =
|
|
249
|
-
return /* @__PURE__ */
|
|
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-${
|
|
265
|
+
}, `tick-${e}`);
|
|
256
266
|
}),
|
|
257
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ l("line", {
|
|
258
268
|
className: "analog-clock__hand",
|
|
259
|
-
x1:
|
|
260
|
-
y1:
|
|
261
|
-
x2:
|
|
262
|
-
y2:
|
|
269
|
+
x1: t.center,
|
|
270
|
+
y1: t.center,
|
|
271
|
+
x2: P.x,
|
|
272
|
+
y2: P.y
|
|
263
273
|
}),
|
|
264
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ l("circle", {
|
|
265
275
|
className: "analog-clock__knob",
|
|
266
|
-
cx:
|
|
267
|
-
cy:
|
|
268
|
-
r:
|
|
276
|
+
cx: P.x,
|
|
277
|
+
cy: P.y,
|
|
278
|
+
r: t.knobRadius
|
|
269
279
|
}),
|
|
270
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ l("circle", {
|
|
271
281
|
className: "analog-clock__pivot",
|
|
272
|
-
cx:
|
|
273
|
-
cy:
|
|
282
|
+
cx: t.center,
|
|
283
|
+
cy: t.center,
|
|
274
284
|
r: d * 0.017
|
|
275
285
|
}),
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
return /* @__PURE__ */
|
|
279
|
-
className: `analog-clock__number${
|
|
280
|
-
x:
|
|
281
|
-
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:
|
|
285
|
-
}, `${s}-${
|
|
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
|
-
|
|
302
|
+
ir as AnalogClock
|
|
293
303
|
};
|
|
@@ -6,7 +6,7 @@ import { InputPassword as B } from "../../InputPassword/InputPassword2.js";
|
|
|
6
6
|
import { Toast as X } from "../../Toast/Toast2.js";
|
|
7
7
|
import { HttpMethod as F, buildRequestHeaders as Y } from "../../../helpers/Http.js";
|
|
8
8
|
import { useAuth as Z } from "../../../hooks/useAuth/useAuth.js";
|
|
9
|
-
import { QRCodeSVG as ee } from "../../../node_modules/qrcode.react/lib/esm/index.js";
|
|
9
|
+
import { QRCodeSVG as ee } from "../../../D_/Projects/Web Apps/LIBRARIES/memobit-react/node_modules/qrcode.react/lib/esm/index.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { useCallback as U, useEffect as ae, useState as r } from "react";
|
|
12
12
|
import { Fragment as A, jsx as e, jsxs as s } from "react/jsx-runtime";
|