@memobit/libs 3.9.0 → 3.10.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 -95
- package/dist/components/Confetti/Confetti2.js +26 -25
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +9 -8
- package/dist/components/InputDate/InputDate2.js +16 -15
- package/dist/components/InputEmail/InputEmail2.js +22 -21
- package/dist/components/InputFile/InputFile2.js +9 -8
- package/dist/components/InputNumber/InputNumber2.js +7 -6
- package/dist/components/InputPassword/InputPassword2.js +6 -5
- package/dist/components/InputSearch/InputSearch2.js +18 -17
- package/dist/components/InputText/InputText2.js +6 -5
- package/dist/components/InputTextarea/InputTextarea2.js +11 -10
- package/dist/components/InputTime/InputTime2.js +35 -34
- package/dist/components/InputUrl/InputUrl2.js +20 -19
- package/dist/components/QuantitySelector/QuantitySelector2.js +19 -18
- package/dist/errors.d.ts +78 -0
- package/dist/errors.js +9 -0
- package/dist/helpers/ErrorReporting.js +179 -0
- package/dist/helpers/Logger.js +31 -0
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/memobit-icons.json +1 -41
- package/dist/styles/highlight.scss +6 -6
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,95 +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
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
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
|
|
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** — `@memobit/libs/errors` (React-free, works in Node too): `installErrorReporting` / `installNodeErrorReporting` send uncaught errors, unhandled rejections, `ErrorBoundary` crashes and `console.error` / `console.warn` to a collector endpoint, batched and throttled. `logger` stands in for `console.*`, and `reportError` reports errors you have handled.
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import './Confetti.css';
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { forwardRef as B, useCallback as E, useEffect as H, useImperativeHandle as L, useRef as v } from "react";
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
4
|
+
import { jsx as N } from "react/jsx-runtime";
|
|
5
|
+
var O = [
|
|
6
6
|
"#0891b2",
|
|
7
7
|
"#06b6d4",
|
|
8
8
|
"#16a34a",
|
|
@@ -11,7 +11,7 @@ var _ = [
|
|
|
11
11
|
"#8b5cf6",
|
|
12
12
|
"#ec4899",
|
|
13
13
|
"#f97316"
|
|
14
|
-
],
|
|
14
|
+
], _ = (t) => {
|
|
15
15
|
if (t && t.length > 0) return t;
|
|
16
16
|
const a = getComputedStyle(document.documentElement), s = [
|
|
17
17
|
a.getPropertyValue("--body-accent-color").trim(),
|
|
@@ -25,7 +25,7 @@ var _ = [
|
|
|
25
25
|
"#ec4899",
|
|
26
26
|
"#f97316",
|
|
27
27
|
"#06b6d4"
|
|
28
|
-
] :
|
|
28
|
+
] : O;
|
|
29
29
|
}, I = () => {
|
|
30
30
|
const t = Math.random();
|
|
31
31
|
return t < 0.5 ? "rect" : t < 0.8 ? "circle" : "star";
|
|
@@ -40,7 +40,7 @@ var _ = [
|
|
|
40
40
|
color: b(s),
|
|
41
41
|
opacity: 1,
|
|
42
42
|
shape: I()
|
|
43
|
-
}),
|
|
43
|
+
}), j = (t, a, s) => {
|
|
44
44
|
const o = Math.random() * Math.PI * 2, c = 3 + Math.random() * 10;
|
|
45
45
|
return {
|
|
46
46
|
x: t,
|
|
@@ -68,7 +68,7 @@ var _ = [
|
|
|
68
68
|
trail: [],
|
|
69
69
|
exploded: !1,
|
|
70
70
|
children: []
|
|
71
|
-
}),
|
|
71
|
+
}), D = (t, a, s) => {
|
|
72
72
|
const o = Math.random() * Math.PI * 2, c = 1 + Math.random() * 5;
|
|
73
73
|
return {
|
|
74
74
|
x: t,
|
|
@@ -102,37 +102,37 @@ var _ = [
|
|
|
102
102
|
U(t, 0, 0, a.size / 2);
|
|
103
103
|
}
|
|
104
104
|
t.restore();
|
|
105
|
-
},
|
|
105
|
+
}, W = B(({ colors: t, duration: a = 3e3, scope: s = "fullscreen", variant: o = "confetti", particleCount: c }, P) => {
|
|
106
106
|
const h = v(null), f = v(0), d = v(0), M = v(!1), V = {
|
|
107
107
|
confetti: 150,
|
|
108
108
|
burst: 200,
|
|
109
109
|
fireworks: 8
|
|
110
|
-
},
|
|
110
|
+
}, C = E(() => {
|
|
111
111
|
M.current = !1, cancelAnimationFrame(f.current);
|
|
112
112
|
const i = h.current;
|
|
113
113
|
i && i.getContext("2d")?.clearRect(0, 0, i.width, i.height);
|
|
114
|
-
}, []),
|
|
114
|
+
}, []), R = E(() => {
|
|
115
115
|
const i = h.current;
|
|
116
116
|
if (!i || M.current) return;
|
|
117
117
|
const r = i.getContext("2d");
|
|
118
118
|
if (!r) return;
|
|
119
119
|
i.width = i.offsetWidth, i.height = i.offsetHeight;
|
|
120
|
-
const
|
|
120
|
+
const y = i.width, m = i.height, u = _(t), x = c ?? V[o];
|
|
121
121
|
M.current = !0, d.current = performance.now();
|
|
122
122
|
let l = [];
|
|
123
|
-
if (o === "confetti") l = Array.from({ length: x }, () => S(
|
|
123
|
+
if (o === "confetti") l = Array.from({ length: x }, () => S(y, m, u));
|
|
124
124
|
else if (o === "burst") {
|
|
125
|
-
const k =
|
|
126
|
-
l = Array.from({ length: x }, () =>
|
|
127
|
-
} else o === "fireworks" && (l = Array.from({ length: x }, () => F(
|
|
128
|
-
const
|
|
125
|
+
const k = y / 2, A = m / 2;
|
|
126
|
+
l = Array.from({ length: x }, () => j(k, A, u));
|
|
127
|
+
} else o === "fireworks" && (l = Array.from({ length: x }, () => F(y, m, u)));
|
|
128
|
+
const z = (k) => {
|
|
129
129
|
if (!M.current) return;
|
|
130
130
|
const A = k - d.current, g = Math.min(A / a, 1);
|
|
131
|
-
if (r.clearRect(0, 0,
|
|
131
|
+
if (r.clearRect(0, 0, y, m), o === "confetti" ? (g < 0.6 && Math.random() < 0.3 && l.push(S(y, m, u)), l = l.filter((e) => e.opacity > 0 && e.y < m + 20), l.forEach((e) => {
|
|
132
132
|
e.x += e.vx, e.y += e.vy, e.vy += 0.08, e.vx += (Math.random() - 0.5) * 0.1, e.angle += e.spin, g > 0.6 && (e.opacity -= 0.015), w(r, e);
|
|
133
133
|
})) : o === "burst" ? (l = l.filter((e) => e.opacity > 0), l.forEach((e) => {
|
|
134
134
|
e.x += e.vx, e.y += e.vy, e.vy += 0.15, e.vx *= 0.98, e.angle += e.spin, e.opacity -= 0.012, w(r, e);
|
|
135
|
-
})) : o === "fireworks" && (g < 0.85 && Math.random() < 0.04 && l.push(F(
|
|
135
|
+
})) : o === "fireworks" && (g < 0.85 && Math.random() < 0.04 && l.push(F(y, m, u)), l = l.filter((e) => e.exploded ? e.children?.some((n) => n.opacity > 0) ?? !1 : e.y > -m * 0.1), l.forEach((e) => {
|
|
136
136
|
if (e.exploded)
|
|
137
137
|
e.children?.forEach((n) => {
|
|
138
138
|
n.x += n.vx, n.y += n.vy, n.vy += 0.06, n.vx *= 0.97, n.angle += n.spin, n.opacity -= 0.014, w(r, n);
|
|
@@ -146,29 +146,30 @@ var _ = [
|
|
|
146
146
|
}), r.save(), r.globalAlpha = 1, r.fillStyle = e.color, r.beginPath(), r.arc(e.x, e.y, 3, 0, Math.PI * 2), r.fill(), r.restore(), e.x += e.vx, e.y += e.vy, e.vy += 0.18, e.vy >= 0) {
|
|
147
147
|
e.exploded = !0;
|
|
148
148
|
const n = 60 + Math.floor(Math.random() * 40);
|
|
149
|
-
e.children = Array.from({ length: n }, () =>
|
|
149
|
+
e.children = Array.from({ length: n }, () => D(e.x, e.y, u)), r.save(), r.globalAlpha = 0.8, r.fillStyle = "#ffffff", r.beginPath(), r.arc(e.x, e.y, 12, 0, Math.PI * 2), r.fill(), r.restore();
|
|
150
150
|
}
|
|
151
151
|
})), g >= 1 || l.length === 0) {
|
|
152
|
-
|
|
152
|
+
C();
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
f.current = requestAnimationFrame(
|
|
155
|
+
f.current = requestAnimationFrame(z);
|
|
156
156
|
};
|
|
157
|
-
f.current = requestAnimationFrame(
|
|
157
|
+
f.current = requestAnimationFrame(z);
|
|
158
158
|
}, [
|
|
159
159
|
t,
|
|
160
160
|
a,
|
|
161
161
|
o,
|
|
162
162
|
c,
|
|
163
|
-
|
|
163
|
+
C
|
|
164
164
|
]);
|
|
165
|
-
return L(P, () => ({ trigger:
|
|
165
|
+
return L(P, () => ({ trigger: R }), [R]), H(() => () => {
|
|
166
166
|
cancelAnimationFrame(f.current);
|
|
167
|
-
}, []), /* @__PURE__ */
|
|
167
|
+
}, []), /* @__PURE__ */ N("canvas", {
|
|
168
168
|
ref: h,
|
|
169
169
|
className: `confetti-canvas confetti-canvas--${s}`
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
+
W.displayName = "Confetti";
|
|
172
173
|
export {
|
|
173
|
-
|
|
174
|
+
W as Confetti
|
|
174
175
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import './ErrorBoundary.css';
|
|
2
|
-
import { EmptyState as
|
|
2
|
+
import { EmptyState as s } from "../EmptyState/EmptyState2.js";
|
|
3
|
+
import { reportError as a } from "../../helpers/ErrorReporting.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { Component as
|
|
5
|
+
import { Component as c } from "react";
|
|
5
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
-
var
|
|
7
|
+
var h = class extends c {
|
|
7
8
|
constructor(...r) {
|
|
8
9
|
super(...r), this.state = { error: null }, this.reset = () => {
|
|
9
10
|
this.setState({ error: null });
|
|
@@ -13,18 +14,18 @@ var u = class extends a {
|
|
|
13
14
|
return { error: r };
|
|
14
15
|
}
|
|
15
16
|
componentDidCatch(r, t) {
|
|
16
|
-
console.error("ErrorBoundary caught:", r, t.componentStack), this.props.onError?.(r, t);
|
|
17
|
+
a(r, { componentStack: t.componentStack ?? void 0 }), console.error("ErrorBoundary caught:", r, t.componentStack), this.props.onError?.(r, t);
|
|
17
18
|
}
|
|
18
19
|
render() {
|
|
19
|
-
const { error: r } = this.state, { children: t, title: n, resetLabel:
|
|
20
|
+
const { error: r } = this.state, { children: t, title: n, resetLabel: i, fallback: e } = this.props;
|
|
20
21
|
return r ? e ? e(r, this.reset) : /* @__PURE__ */ o("div", {
|
|
21
22
|
className: "error-boundary",
|
|
22
|
-
children: /* @__PURE__ */ o(
|
|
23
|
+
children: /* @__PURE__ */ o(s, {
|
|
23
24
|
icon: "warning",
|
|
24
25
|
title: n ?? "Something went wrong",
|
|
25
26
|
description: r.message || "An unexpected error occurred.",
|
|
26
27
|
primary: {
|
|
27
|
-
text:
|
|
28
|
+
text: i ?? "Try again",
|
|
28
29
|
variant: "info",
|
|
29
30
|
onClick: this.reset
|
|
30
31
|
}
|
|
@@ -33,5 +34,5 @@ var u = class extends a {
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
h as ErrorBoundary
|
|
37
38
|
};
|
|
@@ -2,17 +2,17 @@ import './InputDate.css';
|
|
|
2
2
|
import { Icon as f } from "../Icon/Icon2.js";
|
|
3
3
|
import { Tooltip as N } from "../Tooltip/Tooltip2.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { forwardRef as j, useRef as
|
|
5
|
+
import { forwardRef as j, useRef as y } from "react";
|
|
6
6
|
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
7
|
-
var
|
|
8
|
-
const m = b && u && !a && !n, h =
|
|
7
|
+
var z = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, error: c, highlighted: g, id: r, label: p, max: R, min: w, onBlur: x, onChange: o, onClick: C, onKeyDown: I, onKeyUp: $, readOnly: n = !1, required: d = !1, success: l, type: P = "date", value: u }, i) => {
|
|
8
|
+
const m = b && u && !a && !n, h = y(null);
|
|
9
9
|
return /* @__PURE__ */ s("div", {
|
|
10
10
|
className: `input-date-wrapper${g ? " input-date-highlighted" : ""}`,
|
|
11
11
|
children: [
|
|
12
|
-
|
|
13
|
-
htmlFor:
|
|
12
|
+
p && /* @__PURE__ */ s("label", {
|
|
13
|
+
htmlFor: r,
|
|
14
14
|
className: "input-date-label",
|
|
15
|
-
children: [
|
|
15
|
+
children: [p, d && /* @__PURE__ */ e("span", {
|
|
16
16
|
className: "input-date-required",
|
|
17
17
|
children: "*"
|
|
18
18
|
})]
|
|
@@ -24,8 +24,8 @@ var E = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, er
|
|
|
24
24
|
autoFocus: k,
|
|
25
25
|
disabled: a,
|
|
26
26
|
type: P === "date" ? "date" : "datetime-local",
|
|
27
|
-
className: `input-date${c ? " input-date-error" : ""}${
|
|
28
|
-
id:
|
|
27
|
+
className: `input-date${c ? " input-date-error" : ""}${l ? " input-date-success" : ""}${m ? " input-date--clearable" : ""}`,
|
|
28
|
+
id: r,
|
|
29
29
|
max: R,
|
|
30
30
|
min: w,
|
|
31
31
|
ref: (t) => {
|
|
@@ -33,10 +33,10 @@ var E = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, er
|
|
|
33
33
|
},
|
|
34
34
|
value: u ?? "",
|
|
35
35
|
onBlur: x,
|
|
36
|
-
onChange: (t) =>
|
|
36
|
+
onChange: (t) => o?.(t.target.value || void 0),
|
|
37
37
|
onClick: C,
|
|
38
|
-
onKeyDown:
|
|
39
|
-
onKeyUp:
|
|
38
|
+
onKeyDown: I,
|
|
39
|
+
onKeyUp: $,
|
|
40
40
|
readOnly: n,
|
|
41
41
|
required: d
|
|
42
42
|
}), /* @__PURE__ */ s("div", {
|
|
@@ -46,7 +46,7 @@ var E = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, er
|
|
|
46
46
|
children: /* @__PURE__ */ e("button", {
|
|
47
47
|
type: "button",
|
|
48
48
|
className: "input-date-clear",
|
|
49
|
-
onClick: () =>
|
|
49
|
+
onClick: () => o?.(void 0),
|
|
50
50
|
children: /* @__PURE__ */ e(f, {
|
|
51
51
|
name: "clear",
|
|
52
52
|
size: "sm"
|
|
@@ -75,13 +75,14 @@ var E = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, er
|
|
|
75
75
|
className: "input-date-error-message",
|
|
76
76
|
children: c
|
|
77
77
|
}),
|
|
78
|
-
|
|
78
|
+
l && /* @__PURE__ */ e("span", {
|
|
79
79
|
className: "input-date-success-message",
|
|
80
|
-
children:
|
|
80
|
+
children: l
|
|
81
81
|
})
|
|
82
82
|
]
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
|
+
z.displayName = "InputDate";
|
|
85
86
|
export {
|
|
86
|
-
|
|
87
|
+
z as InputDate
|
|
87
88
|
};
|
|
@@ -2,27 +2,27 @@ import './InputEmail.css';
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { forwardRef as F, useEffect as G, useState as N } from "react";
|
|
4
4
|
import { jsx as n, jsxs as b } from "react/jsx-runtime";
|
|
5
|
-
var L = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, M = (r) => !r || r.trim() === "" ? !0 : L.test(r.trim()),
|
|
6
|
-
const [f, u] = N(!0), [d, g] = N(!1), c = (e) =>
|
|
5
|
+
var L = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, M = (r) => !r || r.trim() === "" ? !0 : L.test(r.trim()), P = F(({ autoComplete: r = "on", autoFocus: I, disabled: A, error: $ = "Please enter a valid email address", highlighted: v, id: o, label: p, maxLength: x, onBlur: z, onChange: Z, onClick: j, onKeyDown: y, onKeyUp: B, onValidate: a, placeholder: C, readOnly: R = !1, required: s = !1, showValidation: h = !1, success: m, validateOn: i = "blur", value: l }, T) => {
|
|
6
|
+
const [f, u] = N(!0), [d, g] = N(!1), c = (e) => s && (!e || e.trim() === "") ? !1 : !e || e.trim() === "" ? !0 : M(e);
|
|
7
7
|
G(() => {
|
|
8
8
|
if (l !== void 0) {
|
|
9
9
|
const e = c(l);
|
|
10
|
-
u(e),
|
|
10
|
+
u(e), a?.(e);
|
|
11
11
|
}
|
|
12
12
|
}, [
|
|
13
13
|
l,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
a,
|
|
15
|
+
s
|
|
16
16
|
]);
|
|
17
|
-
const
|
|
17
|
+
const _ = (e) => {
|
|
18
18
|
if (Z?.(e), i === "change" || i === "both") {
|
|
19
19
|
const t = c(e);
|
|
20
|
-
u(t), g(!0),
|
|
20
|
+
u(t), g(!0), a?.(t);
|
|
21
21
|
}
|
|
22
|
-
},
|
|
22
|
+
}, w = (e) => {
|
|
23
23
|
if (g(!0), i === "blur" || i === "both") {
|
|
24
24
|
const t = c(e.target.value);
|
|
25
|
-
u(t),
|
|
25
|
+
u(t), a?.(t);
|
|
26
26
|
}
|
|
27
27
|
z?.(e);
|
|
28
28
|
}, E = h && d && !f;
|
|
@@ -32,29 +32,29 @@ var L = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, M = (r) => !r || r.t
|
|
|
32
32
|
p && /* @__PURE__ */ b("label", {
|
|
33
33
|
htmlFor: o,
|
|
34
34
|
className: "input-email-label",
|
|
35
|
-
children: [p,
|
|
35
|
+
children: [p, s && /* @__PURE__ */ n("span", {
|
|
36
36
|
className: "input-email-required",
|
|
37
37
|
children: "*"
|
|
38
38
|
})]
|
|
39
39
|
}),
|
|
40
40
|
/* @__PURE__ */ n("input", {
|
|
41
41
|
autoComplete: r,
|
|
42
|
-
autoFocus:
|
|
43
|
-
disabled:
|
|
42
|
+
autoFocus: I,
|
|
43
|
+
disabled: A,
|
|
44
44
|
type: "email",
|
|
45
45
|
className: `input-email${E ? " input-email--error" : ""}${m ? " input-email-success" : f && d && h ? " input-email--valid" : ""}`,
|
|
46
46
|
id: o,
|
|
47
47
|
maxLength: x,
|
|
48
|
-
placeholder:
|
|
49
|
-
ref:
|
|
48
|
+
placeholder: C,
|
|
49
|
+
ref: T,
|
|
50
50
|
value: l,
|
|
51
|
-
onBlur:
|
|
52
|
-
onChange: (e) =>
|
|
51
|
+
onBlur: w,
|
|
52
|
+
onChange: (e) => _(e.target.value),
|
|
53
53
|
onClick: j,
|
|
54
|
-
onKeyDown:
|
|
55
|
-
onKeyUp:
|
|
56
|
-
readOnly:
|
|
57
|
-
required:
|
|
54
|
+
onKeyDown: y,
|
|
55
|
+
onKeyUp: B,
|
|
56
|
+
readOnly: R,
|
|
57
|
+
required: s
|
|
58
58
|
}),
|
|
59
59
|
E && /* @__PURE__ */ n("span", {
|
|
60
60
|
className: "input-email-error-message",
|
|
@@ -67,7 +67,8 @@ var L = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, M = (r) => !r || r.t
|
|
|
67
67
|
]
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
+
P.displayName = "InputEmail";
|
|
70
71
|
export {
|
|
71
|
-
|
|
72
|
+
P as InputEmail,
|
|
72
73
|
M as validateEmail
|
|
73
74
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './InputFile.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { forwardRef as
|
|
3
|
+
import { forwardRef as g } from "react";
|
|
4
4
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var x = g(({ accept: p, disabled: r, error: i, highlighted: t, id: a, label: s, onChange: f, onClick: m, onKeyDown: u, placeholder: c, required: h, success: l, value: d }, o) => /* @__PURE__ */ n("div", {
|
|
6
6
|
className: `input-file-wrapper${t ? " input-file-highlighted" : ""}`,
|
|
7
7
|
children: [
|
|
8
8
|
s && /* @__PURE__ */ n("label", {
|
|
@@ -14,15 +14,15 @@ var v = N(({ accept: r, disabled: p, error: i, highlighted: t, id: a, label: s,
|
|
|
14
14
|
})]
|
|
15
15
|
}),
|
|
16
16
|
/* @__PURE__ */ e("input", {
|
|
17
|
-
accept:
|
|
18
|
-
disabled:
|
|
17
|
+
accept: p,
|
|
18
|
+
disabled: r,
|
|
19
19
|
type: "file",
|
|
20
20
|
className: `input-file${i ? " input-file-error" : ""}${l ? " input-file-success" : ""}`,
|
|
21
21
|
id: a,
|
|
22
22
|
placeholder: c,
|
|
23
|
-
ref:
|
|
24
|
-
value:
|
|
25
|
-
onChange: (
|
|
23
|
+
ref: o,
|
|
24
|
+
value: d,
|
|
25
|
+
onChange: (N) => f?.(N.target.files),
|
|
26
26
|
onClick: m,
|
|
27
27
|
onKeyDown: u
|
|
28
28
|
}),
|
|
@@ -36,6 +36,7 @@ var v = N(({ accept: r, disabled: p, error: i, highlighted: t, id: a, label: s,
|
|
|
36
36
|
})
|
|
37
37
|
]
|
|
38
38
|
}));
|
|
39
|
+
x.displayName = "InputFile";
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
x as InputFile
|
|
41
42
|
};
|
|
@@ -2,7 +2,7 @@ import './InputNumber.css';
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { forwardRef as V } from "react";
|
|
4
4
|
import { jsx as i, jsxs as o } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var j = V(({ autoComplete: d = "on", autoFocus: c, disabled: b, error: a, hideNativeControls: h, highlighted: f, id: p, label: s, onChange: m, onClick: N, onKeyDown: v, required: g, success: l, value: n, min: u, max: t, placeholder: y, step: $ }, w) => {
|
|
6
6
|
const B = (e) => {
|
|
7
7
|
if (e === void 0) return;
|
|
8
8
|
let r = e;
|
|
@@ -20,8 +20,8 @@ var E = V(({ autoComplete: c = "on", autoFocus: d, disabled: b, error: a, hideNa
|
|
|
20
20
|
})]
|
|
21
21
|
}),
|
|
22
22
|
/* @__PURE__ */ i("input", {
|
|
23
|
-
autoComplete:
|
|
24
|
-
autoFocus:
|
|
23
|
+
autoComplete: d,
|
|
24
|
+
autoFocus: c,
|
|
25
25
|
disabled: b,
|
|
26
26
|
className: `input-number${a ? " input-number-error" : ""}${l ? " input-number-success" : ""}${h ? " input-number-hide-native-controls" : ""}`,
|
|
27
27
|
id: p,
|
|
@@ -34,9 +34,9 @@ var E = V(({ autoComplete: c = "on", autoFocus: d, disabled: b, error: a, hideNa
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
onChange: (e) => m?.(e.target.value ? Number(e.target.value) : void 0),
|
|
37
|
-
onClick:
|
|
37
|
+
onClick: N,
|
|
38
38
|
onKeyDown: (e) => {
|
|
39
|
-
(e.key === "e" || e.key === "E") && e.preventDefault(),
|
|
39
|
+
(e.key === "e" || e.key === "E") && e.preventDefault(), v?.(e);
|
|
40
40
|
},
|
|
41
41
|
placeholder: y,
|
|
42
42
|
ref: w,
|
|
@@ -55,6 +55,7 @@ var E = V(({ autoComplete: c = "on", autoFocus: d, disabled: b, error: a, hideNa
|
|
|
55
55
|
]
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
+
j.displayName = "InputNumber";
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
+
j as InputNumber
|
|
60
61
|
};
|
|
@@ -2,7 +2,7 @@ import './InputPassword.css';
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { forwardRef as j } from "react";
|
|
4
4
|
import { jsx as s, jsxs as o } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var y = j(({ autoComplete: t = "on", autoFocus: i, disabled: d, error: a, highlighted: l, id: r, label: e, maxLength: m, onBlur: u, onChange: w, onClick: c, onKeyDown: h, onKeyUp: N, placeholder: f, readOnly: g = !1, required: n = !1, success: p, value: v }, x) => /* @__PURE__ */ o("div", {
|
|
6
6
|
className: `input-password-wrapper${l ? " input-password-highlighted" : ""}`,
|
|
7
7
|
children: [
|
|
8
8
|
e && /* @__PURE__ */ o("label", {
|
|
@@ -21,15 +21,15 @@ var F = j(({ autoComplete: t = "on", autoFocus: i, disabled: d, error: a, highli
|
|
|
21
21
|
className: `input-password${a ? " input-password-error" : ""}${p ? " input-password-success" : ""}`,
|
|
22
22
|
id: r,
|
|
23
23
|
maxLength: m,
|
|
24
|
-
placeholder:
|
|
24
|
+
placeholder: f,
|
|
25
25
|
ref: x,
|
|
26
26
|
value: v,
|
|
27
27
|
onBlur: u,
|
|
28
28
|
onChange: ($) => w?.($.target.value),
|
|
29
29
|
onClick: c,
|
|
30
30
|
onKeyDown: h,
|
|
31
|
-
onKeyUp:
|
|
32
|
-
readOnly:
|
|
31
|
+
onKeyUp: N,
|
|
32
|
+
readOnly: g,
|
|
33
33
|
required: n
|
|
34
34
|
}),
|
|
35
35
|
a && /* @__PURE__ */ s("span", {
|
|
@@ -42,6 +42,7 @@ var F = j(({ autoComplete: t = "on", autoFocus: i, disabled: d, error: a, highli
|
|
|
42
42
|
})
|
|
43
43
|
]
|
|
44
44
|
}));
|
|
45
|
+
y.displayName = "InputPassword";
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
+
y as InputPassword
|
|
47
48
|
};
|