@memobit/libs 3.16.0 → 3.18.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/Auth/MfaSetupModal/MfaSetupModal2.js +1 -1
- package/dist/components/NotificationPanel/NotificationPanel.css +1 -1
- package/dist/components/NotificationPanel/NotificationPanel2.js +1 -1
- package/dist/components/Toolbar/Toolbar.css +1 -1
- package/dist/components/Toolbar/Toolbar2.js +71 -67
- package/dist/components/Tooltip/Tooltip2.js +67 -57
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +4 -0
- 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 +1 -1
- /package/dist/{D_/Projects/Web Apps/LIBRARIES/memobit-react/node_modules → 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
|
|
@@ -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 "../../../
|
|
9
|
+
import { QRCodeSVG as ee } from "../../../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";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.NotificationPanel{position:relative}.NotificationPanel__button{align-items:center;gap:var(--spacing-8);border:1px solid var(--border-color);border-radius:var(--radius);background:var(--card-background-color);color:var(--body-title-color);padding:var(--spacing-8) var(--spacing-12);cursor:pointer;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);display:inline-flex}.NotificationPanel__button--critical{border-color:color-mix(in srgb, var(--button-danger-border-color) 55%, var(--border-color));background:color-mix(in srgb, var(--button-danger-border-color) 12%, transparent)}.NotificationPanel__badge{min-width:var(--spacing-20);height:var(--spacing-20);border-radius:var(--radius-full);font-size:var(--font-size-xs);background:var(--button-danger-background-color);color:var(--button-danger-color);padding:0 var(--spacing-4);justify-content:center;align-items:center;display:inline-flex}.NotificationPanel__backdrop{z-index:9998;position:fixed;inset:0}.NotificationPanel__panel{z-index:9999;background:var(--card-background-color);border:1px solid var(--border-color);border-radius:var(--radius);width:min(420px,80vw);box-shadow:var(--card-box-shadow);padding:var(--spacing-12);position:fixed;top:0;left:0}.NotificationPanel__title{margin:0 0 var(--spacing-8) 0;font-size:var(--font-size-sm);color:var(--body-title-color);font-weight:var(--font-weight-medium)}.NotificationPanel__list{gap:var(--spacing-4);flex-direction:column;max-height:260px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.NotificationPanel__list::-webkit-scrollbar{width:var(--scrollbar-size)}.NotificationPanel__list::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.NotificationPanel__list::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb-color);border-radius:var(--scrollbar-radius)}.NotificationPanel__list::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover-color)}.NotificationPanel__list{scrollbar-width:thin;scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color)}.NotificationPanel__item{font-size:var(--font-size-sm);color:var(--body-color);padding:var(--spacing-8);border-radius:var(--radius-sm);border:1px solid #0000}.NotificationPanel__item--critical{border-color:color-mix(in srgb, var(--button-danger-border-color) 50%, var(--border-color));background:color-mix(in srgb, var(--button-danger-border-color) 10%, transparent)}.NotificationPanel__item--clickable{cursor:pointer;transition:background-color var(--transition-fast)}.NotificationPanel__item--clickable:hover{background:color-mix(in srgb, var(--body-accent-color) 14%, transparent)}.NotificationPanel__empty{color:var(--body-sub-title-color);font-size:var(--font-size-sm);margin:0}
|
|
1
|
+
.NotificationPanel{position:relative}.NotificationPanel__button{align-items:center;gap:var(--spacing-8);border:1px solid var(--border-color);border-radius:var(--radius);background:var(--card-background-color);color:var(--body-title-color);padding:var(--spacing-8) var(--spacing-12);cursor:pointer;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);display:inline-flex}.NotificationPanel__button--critical{border-color:color-mix(in srgb, var(--button-danger-border-color) 55%, var(--border-color));background:color-mix(in srgb, var(--button-danger-border-color) 12%, transparent)}.NotificationPanel__badge{min-width:var(--spacing-20);height:var(--spacing-20);border-radius:var(--radius-full);font-size:var(--font-size-xs);background:var(--button-danger-background-color);color:var(--button-danger-color);padding:0 var(--spacing-4);justify-content:center;align-items:center;display:inline-flex}.NotificationPanel__backdrop{z-index:9998;position:fixed;inset:0}.NotificationPanel__panel{z-index:9999;background:var(--card-background-color);border:1px solid var(--border-color);border-radius:var(--radius);width:min(420px,80vw);box-shadow:var(--card-box-shadow);padding:var(--spacing-12);position:fixed;top:0;left:0}.NotificationPanel__title{margin:0 0 var(--spacing-8) 0;font-size:var(--font-size-sm);color:var(--body-title-color);font-weight:var(--font-weight-medium)}.NotificationPanel__list{gap:var(--spacing-4);flex-direction:column;max-height:260px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.NotificationPanel__list::-webkit-scrollbar{width:var(--scrollbar-size)}.NotificationPanel__list::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.NotificationPanel__list::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb-color);border-radius:var(--scrollbar-radius)}.NotificationPanel__list::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover-color)}.NotificationPanel__list{scrollbar-width:thin;scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color)}.NotificationPanel__item{font-size:var(--font-size-sm);color:var(--body-color);padding:var(--spacing-8);border-radius:var(--radius-sm);border:1px solid #0000}.NotificationPanel__item--critical{border-color:color-mix(in srgb, var(--button-danger-border-color) 50%, var(--border-color));background:color-mix(in srgb, var(--button-danger-border-color) 10%, transparent)}.NotificationPanel__item--warning{border-color:color-mix(in srgb, var(--button-warning-border-color) 50%, var(--border-color));background:color-mix(in srgb, var(--button-warning-border-color) 8%, transparent)}.NotificationPanel__item--clickable{cursor:pointer;transition:background-color var(--transition-fast)}.NotificationPanel__item--clickable:hover{background:color-mix(in srgb, var(--body-accent-color) 14%, transparent)}.NotificationPanel__empty{color:var(--body-sub-title-color);font-size:var(--font-size-sm);margin:0}
|
|
@@ -56,7 +56,7 @@ var B = ({ items: i, buttonLabel: y = "Alerts", panelTitle: P = "Notifications",
|
|
|
56
56
|
children: i.map((t) => /* @__PURE__ */ n("li", {
|
|
57
57
|
className: [
|
|
58
58
|
"NotificationPanel__item",
|
|
59
|
-
t.severity
|
|
59
|
+
`NotificationPanel__item--${t.severity}`,
|
|
60
60
|
m ? "NotificationPanel__item--clickable" : ""
|
|
61
61
|
].filter(Boolean).join(" "),
|
|
62
62
|
onClick: m ? () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.memobit-toolbar{background-color:var(--header-background-color);border-bottom:var(--spacing-1) solid var(--header-border-bottom-color);border-radius:var(--spacing-16);align-items:flex-end;gap:var(--spacing-16);padding:var(--spacing-16);display:flex}.memobit-toolbar__control-panel-toggle,.memobit-
|
|
1
|
+
.memobit-toolbar{background-color:var(--header-background-color);border-bottom:var(--spacing-1) solid var(--header-border-bottom-color);border-radius:var(--spacing-16);align-items:flex-end;gap:var(--spacing-16);padding:var(--spacing-16);flex-wrap:wrap;display:flex}.memobit-toolbar__control-panel-toggle,.memobit-toolbar__sort{flex:none}.memobit-toolbar__control-panel-toggle-count{min-width:var(--spacing-20);height:var(--spacing-20);padding:0 var(--spacing-6);background:var(--body-accent-color);color:var(--button-info-color);font-size:var(--font-size-xs);font-weight:var(--font-weight-semibold);border-radius:999px;justify-content:center;align-items:center;display:inline-flex}.memobit-toolbar__heading{align-items:center;gap:var(--spacing-8);flex:0 auto;align-self:center;min-width:0;display:flex}.memobit-toolbar__heading--clickable{cursor:pointer}.memobit-toolbar__heading-icon{flex:none;align-items:center;display:inline-flex}.memobit-toolbar__heading-copy{gap:var(--spacing-2);flex-direction:column;min-width:0;display:flex}.memobit-toolbar__heading-title{color:var(--body-title-color);font-family:var(--font-family-display);font-size:var(--font-size-lg);font-weight:var(--font-weight-bold);line-height:1.2}.memobit-toolbar__heading-description{color:var(--body-color-muted);font-size:var(--font-size-sm);text-transform:uppercase;letter-spacing:.05em;line-height:1.3}.memobit-toolbar__content{display:contents}.memobit-toolbar__search{flex:1000 280px;min-width:180px}.memobit-toolbar__search-input,.memobit-toolbar__search-input .input-text{width:100%}.memobit-toolbar__sort{min-width:220px}.memobit-toolbar__custom{align-self:stretch;align-items:flex-end;gap:var(--spacing-16);flex:auto;min-width:0;display:flex}.memobit-toolbar__end{align-items:flex-end;gap:var(--spacing-16);flex:auto;min-width:0;display:flex}.memobit-toolbar__actions{align-items:center;gap:var(--spacing-8);flex:0 auto;min-width:0;margin-left:auto;display:flex}.memobit-toolbar__actions>.NotificationPanel{align-self:stretch}.memobit-toolbar__actions>.NotificationPanel>.NotificationPanel__button{height:100%}.memobit-toolbar--no-card{background-color:#0000;border-bottom:0;border-radius:0;padding:0}@media (width<=768px){.memobit-toolbar{align-items:center;gap:var(--spacing-8);padding:var(--spacing-8)}.memobit-toolbar__control-panel-toggle{order:1}.memobit-toolbar__heading{flex:auto;order:1}.memobit-toolbar__actions{order:2;margin-left:auto}.memobit-toolbar__end{display:contents}.memobit-toolbar__content{align-items:stretch;gap:var(--spacing-8);flex-direction:column;flex:100%;order:3;width:100%;display:flex}.memobit-toolbar__search,.memobit-toolbar__custom{flex:auto;width:100%;min-width:0}.memobit-toolbar__sort{flex:100%;order:4;min-width:0}.memobit-toolbar__custom{gap:var(--spacing-8);flex-wrap:wrap}.memobit-toolbar__custom>*{flex:auto;min-width:0;max-width:100%}}
|
|
@@ -2,72 +2,72 @@ import './Toolbar.css';
|
|
|
2
2
|
import { Icon as S } from "../Icon/Icon2.js";
|
|
3
3
|
import { Button as w } from "../Button/Button2.js";
|
|
4
4
|
import { Tooltip as x } from "../Tooltip/Tooltip2.js";
|
|
5
|
-
import { Dropdown as
|
|
5
|
+
import { Dropdown as k } from "../Dropdown/Dropdown2.js";
|
|
6
6
|
import { InputSearch as y } from "../InputSearch/InputSearch2.js";
|
|
7
7
|
import { useControlPanelContext as B } from "../ControlPanel/useControlPanel.js";
|
|
8
8
|
import { MenuHamburger as $ } from "../MenuHamburger/MenuHamburger2.js";
|
|
9
9
|
import { NotificationPanel as R } from "../NotificationPanel/NotificationPanel2.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import "react";
|
|
12
|
-
import { jsx as a, jsxs as
|
|
13
|
-
var c = "::",
|
|
14
|
-
value: `${
|
|
15
|
-
label:
|
|
12
|
+
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
13
|
+
var c = "::", M = (o) => typeof o == "object" ? o.label : void 0, O = (o) => "fields" in o ? o.fields.flatMap((t) => [{
|
|
14
|
+
value: `${t.value}${c}asc`,
|
|
15
|
+
label: t.label,
|
|
16
16
|
suffixIcon: "arrow-up"
|
|
17
17
|
}, {
|
|
18
|
-
value: `${
|
|
19
|
-
label:
|
|
18
|
+
value: `${t.value}${c}desc`,
|
|
19
|
+
label: t.label,
|
|
20
20
|
suffixIcon: "arrow-down"
|
|
21
|
-
}]) :
|
|
22
|
-
const u = B(),
|
|
21
|
+
}]) : o.options, A = (o) => "fields" in o ? o.value ? `${o.value.field}${c}${o.value.direction}` : null : o.value, K = ({ actions: o, children: t, className: f = "", controlPanelToggle: r, heading: l, noCard: _ = !1, menuItems: v, notifications: n, search: s, sort: e }) => {
|
|
22
|
+
const u = B(), h = !!(r && u?.isMobile), d = typeof r == "object" ? r.count ?? 0 : 0, N = [
|
|
23
23
|
"memobit-toolbar",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
].filter(Boolean).join(" "),
|
|
27
|
-
if (
|
|
24
|
+
_ ? "memobit-toolbar--no-card" : "",
|
|
25
|
+
f
|
|
26
|
+
].filter(Boolean).join(" "), C = !!(s || t), g = (m) => {
|
|
27
|
+
if (e) {
|
|
28
28
|
if (!m || Array.isArray(m)) {
|
|
29
|
-
"fields" in
|
|
29
|
+
"fields" in e || e.onChange("", null);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
if ("fields" in
|
|
33
|
-
const b = String(m.value), p = b.lastIndexOf(c),
|
|
34
|
-
|
|
35
|
-
field:
|
|
36
|
-
direction:
|
|
32
|
+
if ("fields" in e) {
|
|
33
|
+
const b = String(m.value), p = b.lastIndexOf(c), j = b.substring(0, p), I = b.substring(p + 2);
|
|
34
|
+
e.onChange({
|
|
35
|
+
field: j,
|
|
36
|
+
direction: I
|
|
37
37
|
});
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
e.onChange(String(m.value), m);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
className:
|
|
43
|
+
return /* @__PURE__ */ i("div", {
|
|
44
|
+
className: N,
|
|
45
45
|
children: [
|
|
46
|
-
|
|
46
|
+
h && /* @__PURE__ */ a(x, {
|
|
47
47
|
title: "Filters",
|
|
48
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ i(w, {
|
|
49
49
|
className: "memobit-toolbar__control-panel-toggle",
|
|
50
50
|
icon: "tune",
|
|
51
51
|
onClick: u?.toggle,
|
|
52
52
|
size: "medium",
|
|
53
53
|
variant: "default",
|
|
54
|
-
children: [
|
|
54
|
+
children: [r && M(r), d > 0 && /* @__PURE__ */ a("span", {
|
|
55
55
|
className: "memobit-toolbar__control-panel-toggle-count",
|
|
56
56
|
children: d
|
|
57
57
|
})]
|
|
58
58
|
})
|
|
59
59
|
}),
|
|
60
|
-
l && /* @__PURE__ */
|
|
60
|
+
l && /* @__PURE__ */ i("div", {
|
|
61
61
|
className: ["memobit-toolbar__heading", l.onClick ? "memobit-toolbar__heading--clickable" : ""].filter(Boolean).join(" "),
|
|
62
62
|
onClick: l.onClick,
|
|
63
|
-
children: [(l.svg || l.icon || l.emoji) && /* @__PURE__ */
|
|
63
|
+
children: [(l.svg || l.icon || l.emoji) && /* @__PURE__ */ i("span", {
|
|
64
64
|
className: "memobit-toolbar__heading-icon",
|
|
65
65
|
children: [
|
|
66
66
|
l.svg,
|
|
67
67
|
l.icon && /* @__PURE__ */ a(S, { name: l.icon }),
|
|
68
68
|
l.emoji
|
|
69
69
|
]
|
|
70
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ i("div", {
|
|
71
71
|
className: "memobit-toolbar__heading-copy",
|
|
72
72
|
children: [/* @__PURE__ */ a("span", {
|
|
73
73
|
className: "memobit-toolbar__heading-title",
|
|
@@ -78,52 +78,56 @@ var c = "::", k = (e) => typeof e == "object" ? e.label : void 0, M = (e) => "fi
|
|
|
78
78
|
})]
|
|
79
79
|
})]
|
|
80
80
|
}),
|
|
81
|
-
|
|
81
|
+
C && /* @__PURE__ */ i("div", {
|
|
82
82
|
className: "memobit-toolbar__content",
|
|
83
|
-
children: [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
className: ["memobit-toolbar__search-input", s.className].filter(Boolean).join(" ")
|
|
89
|
-
})
|
|
90
|
-
}),
|
|
91
|
-
e && /* @__PURE__ */ a("div", {
|
|
92
|
-
className: "memobit-toolbar__custom",
|
|
93
|
-
children: e
|
|
94
|
-
}),
|
|
95
|
-
o && /* @__PURE__ */ a("div", {
|
|
96
|
-
className: ["memobit-toolbar__sort", o.className].filter(Boolean).join(" "),
|
|
97
|
-
children: /* @__PURE__ */ a(I, {
|
|
98
|
-
highlighted: o.highlighted,
|
|
99
|
-
label: o.label,
|
|
100
|
-
name: o.name ?? "toolbar-sort",
|
|
101
|
-
onChange: g,
|
|
102
|
-
options: M(o),
|
|
103
|
-
placeholder: o.placeholder,
|
|
104
|
-
searchable: o.searchable ?? !1,
|
|
105
|
-
usePortal: !1,
|
|
106
|
-
value: O(o)
|
|
107
|
-
})
|
|
83
|
+
children: [s && /* @__PURE__ */ a("div", {
|
|
84
|
+
className: "memobit-toolbar__search",
|
|
85
|
+
children: /* @__PURE__ */ a(y, {
|
|
86
|
+
...s,
|
|
87
|
+
className: ["memobit-toolbar__search-input", s.className].filter(Boolean).join(" ")
|
|
108
88
|
})
|
|
109
|
-
|
|
89
|
+
}), t && /* @__PURE__ */ a("div", {
|
|
90
|
+
className: "memobit-toolbar__custom",
|
|
91
|
+
children: t
|
|
92
|
+
})]
|
|
110
93
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
className: "memobit-
|
|
113
|
-
children: [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
/* @__PURE__ */ i("div", {
|
|
95
|
+
className: "memobit-toolbar__end",
|
|
96
|
+
children: [e && /* @__PURE__ */ a("div", {
|
|
97
|
+
className: ["memobit-toolbar__sort", e.className].filter(Boolean).join(" "),
|
|
98
|
+
children: /* @__PURE__ */ a(k, {
|
|
99
|
+
highlighted: e.highlighted,
|
|
100
|
+
label: e.label,
|
|
101
|
+
name: e.name ?? "toolbar-sort",
|
|
102
|
+
onChange: g,
|
|
103
|
+
options: O(e),
|
|
104
|
+
placeholder: e.placeholder,
|
|
105
|
+
searchable: e.searchable ?? !1,
|
|
106
|
+
usePortal: !1,
|
|
107
|
+
value: A(e)
|
|
108
|
+
})
|
|
109
|
+
}), /* @__PURE__ */ i("div", {
|
|
110
|
+
className: "memobit-toolbar__actions",
|
|
111
|
+
children: [
|
|
112
|
+
o,
|
|
113
|
+
n && /* @__PURE__ */ a(R, {
|
|
114
|
+
items: n.items,
|
|
115
|
+
buttonLabel: n.buttonLabel,
|
|
116
|
+
panelTitle: n.panelTitle,
|
|
117
|
+
emptyMessage: n.emptyMessage,
|
|
118
|
+
onItemClick: n.onItemClick
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ a($, {
|
|
121
|
+
items: v,
|
|
122
|
+
disableResponsive: !0,
|
|
123
|
+
showLabel: !1
|
|
124
|
+
})
|
|
125
|
+
]
|
|
122
126
|
})]
|
|
123
127
|
})
|
|
124
128
|
]
|
|
125
129
|
});
|
|
126
130
|
};
|
|
127
131
|
export {
|
|
128
|
-
|
|
132
|
+
K as Toolbar
|
|
129
133
|
};
|
|
@@ -1,98 +1,108 @@
|
|
|
1
1
|
import './Tooltip.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
var
|
|
7
|
-
const [
|
|
3
|
+
import { createContext as U, useCallback as F, useContext as W, useEffect as C, useRef as d, useState as M } from "react";
|
|
4
|
+
import { Fragment as X, jsx as $, jsxs as I } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal as Y } from "react-dom";
|
|
6
|
+
var j = U(null), re = ({ title: y, position: h = "top", delay: z = 200, children: V, disabled: E = !1, className: O = "", maxWidth: p, maxHeight: a }) => {
|
|
7
|
+
const [g, u] = M(!1), [D, q] = M(0), w = W(j), [x, A] = M({
|
|
8
8
|
top: 0,
|
|
9
9
|
left: 0
|
|
10
|
-
}), c =
|
|
11
|
-
|
|
10
|
+
}), c = d(null), n = d(null), l = d(null), f = d(null), m = d(!1), v = a !== void 0, b = v ? 150 : 0, B = !!y && !E, L = g && B && D === 0, N = g && B || D > 0, G = F((t) => {
|
|
11
|
+
q((e) => Math.max(0, e + (t ? 1 : -1)));
|
|
12
|
+
}, []);
|
|
13
|
+
C(() => {
|
|
14
|
+
if (!(!w || !N))
|
|
15
|
+
return w(!0), () => w(!1);
|
|
16
|
+
}, [N, w]);
|
|
17
|
+
const T = F(() => {
|
|
18
|
+
if (!l.current || !f.current) return;
|
|
12
19
|
const t = l.current.firstElementChild?.getBoundingClientRect();
|
|
13
20
|
let e = t && t.width > 0 ? t : l.current.getBoundingClientRect();
|
|
14
21
|
if (e.width === 0 && e.height === 0) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
(
|
|
22
|
+
const _ = document.createRange();
|
|
23
|
+
_.selectNodeContents(l.current);
|
|
24
|
+
const P = _.getBoundingClientRect();
|
|
25
|
+
(P.width > 0 || P.height > 0) && (e = P);
|
|
19
26
|
}
|
|
20
|
-
const
|
|
27
|
+
const r = f.current.getBoundingClientRect(), R = 8;
|
|
21
28
|
let o = 0, i = 0;
|
|
22
|
-
switch (
|
|
29
|
+
switch (h) {
|
|
23
30
|
case "top":
|
|
24
|
-
o = e.top -
|
|
31
|
+
o = e.top - r.height - R, i = e.left + e.width / 2 - r.width / 2;
|
|
25
32
|
break;
|
|
26
33
|
case "bottom":
|
|
27
|
-
o = e.bottom +
|
|
34
|
+
o = e.bottom + R, i = e.left + e.width / 2 - r.width / 2;
|
|
28
35
|
break;
|
|
29
36
|
case "left":
|
|
30
|
-
o = e.top + e.height / 2 -
|
|
37
|
+
o = e.top + e.height / 2 - r.height / 2, i = e.left - r.width - R;
|
|
31
38
|
break;
|
|
32
39
|
case "right":
|
|
33
|
-
o = e.top + e.height / 2 -
|
|
40
|
+
o = e.top + e.height / 2 - r.height / 2, i = e.right + R;
|
|
34
41
|
}
|
|
35
|
-
const
|
|
36
|
-
i <
|
|
42
|
+
const s = 8;
|
|
43
|
+
i < s && (i = s), i + r.width > window.innerWidth - s && (i = window.innerWidth - r.width - s), o < s && (o = s), o + r.height > window.innerHeight - s && (o = window.innerHeight - r.height - s), A({
|
|
37
44
|
top: o,
|
|
38
45
|
left: i
|
|
39
46
|
});
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
t.pointerType !== "touch" && t.pointerType !== "pen" ||
|
|
47
|
+
}, [h]), S = () => {
|
|
48
|
+
E || m.current || (n.current && (clearTimeout(n.current), n.current = null), c.current = setTimeout(() => {
|
|
49
|
+
u(!0);
|
|
50
|
+
}, z));
|
|
51
|
+
}, k = () => {
|
|
52
|
+
m.current || (c.current && clearTimeout(c.current), b > 0 ? n.current = setTimeout(() => u(!1), b) : u(!1));
|
|
53
|
+
}, J = (t) => {
|
|
54
|
+
t.pointerType !== "touch" && t.pointerType !== "pen" || E || (m.current = !0, c.current && (clearTimeout(c.current), c.current = null), t.stopPropagation(), u((e) => !e));
|
|
48
55
|
};
|
|
49
|
-
|
|
50
|
-
if (!
|
|
56
|
+
C(() => {
|
|
57
|
+
if (!L) return;
|
|
51
58
|
const t = (e) => {
|
|
52
|
-
e.target instanceof Node &&
|
|
59
|
+
e.target instanceof Node && f.current?.contains(e.target) || u(!1);
|
|
53
60
|
};
|
|
54
61
|
return T(), window.addEventListener("scroll", t, !0), window.addEventListener("resize", T), () => {
|
|
55
62
|
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", T);
|
|
56
63
|
};
|
|
57
|
-
}, [
|
|
58
|
-
if (!
|
|
64
|
+
}, [L, T]), C(() => {
|
|
65
|
+
if (!g) return;
|
|
59
66
|
const t = (e) => {
|
|
60
|
-
l.current?.contains(e.target) ||
|
|
67
|
+
l.current?.contains(e.target) || f.current?.contains(e.target) || u(!1);
|
|
61
68
|
};
|
|
62
69
|
return document.addEventListener("pointerdown", t), () => {
|
|
63
|
-
document.removeEventListener("pointerdown", t),
|
|
70
|
+
document.removeEventListener("pointerdown", t), m.current = !1;
|
|
64
71
|
};
|
|
65
|
-
}, [
|
|
66
|
-
c.current && clearTimeout(c.current),
|
|
72
|
+
}, [g]), C(() => () => {
|
|
73
|
+
c.current && clearTimeout(c.current), n.current && clearTimeout(n.current);
|
|
67
74
|
}, []);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
|
|
75
|
+
const K = () => {
|
|
76
|
+
v && n.current && (clearTimeout(n.current), n.current = null);
|
|
77
|
+
}, Q = () => {
|
|
78
|
+
v && (n.current = setTimeout(() => u(!1), b));
|
|
72
79
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ I(X, { children: [/* @__PURE__ */ $("span", {
|
|
74
81
|
ref: l,
|
|
75
82
|
className: "tooltip-trigger",
|
|
76
|
-
onMouseEnter:
|
|
77
|
-
onMouseLeave:
|
|
78
|
-
onFocus:
|
|
79
|
-
onBlur:
|
|
80
|
-
onPointerDown:
|
|
81
|
-
children:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
onMouseEnter: S,
|
|
84
|
+
onMouseLeave: k,
|
|
85
|
+
onFocus: S,
|
|
86
|
+
onBlur: k,
|
|
87
|
+
onPointerDown: J,
|
|
88
|
+
children: /* @__PURE__ */ $(j.Provider, {
|
|
89
|
+
value: G,
|
|
90
|
+
children: V
|
|
91
|
+
})
|
|
92
|
+
}), L && Y(/* @__PURE__ */ I("div", {
|
|
93
|
+
ref: f,
|
|
94
|
+
className: `tooltip tooltip--${h} ${v ? "tooltip--scrollable" : ""} ${O}`,
|
|
85
95
|
style: {
|
|
86
|
-
top: `${
|
|
87
|
-
left: `${
|
|
88
|
-
...
|
|
96
|
+
top: `${x.top}px`,
|
|
97
|
+
left: `${x.left}px`,
|
|
98
|
+
...p !== void 0 && { maxWidth: typeof p == "number" ? `${p}px` : p },
|
|
89
99
|
...a !== void 0 && { maxHeight: typeof a == "number" ? `${a}px` : a }
|
|
90
100
|
},
|
|
91
|
-
onMouseEnter:
|
|
92
|
-
onMouseLeave:
|
|
93
|
-
children: [
|
|
101
|
+
onMouseEnter: K,
|
|
102
|
+
onMouseLeave: Q,
|
|
103
|
+
children: [y, /* @__PURE__ */ $("div", { className: `tooltip__arrow tooltip__arrow--${h}` })]
|
|
94
104
|
}), document.body)] });
|
|
95
105
|
};
|
|
96
106
|
export {
|
|
97
|
-
|
|
107
|
+
re as Tooltip
|
|
98
108
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3572,9 +3572,13 @@ export declare interface ToolbarNotificationsConfig {
|
|
|
3572
3572
|
buttonLabel?: string;
|
|
3573
3573
|
panelTitle?: string;
|
|
3574
3574
|
emptyMessage?: string;
|
|
3575
|
+
onItemClick?: (item: NotificationPanelItem) => void;
|
|
3575
3576
|
}
|
|
3576
3577
|
|
|
3577
3578
|
export declare interface ToolbarProps {
|
|
3579
|
+
/** Buttons or status shown beside the menu: at the right on desktop, in the top row on mobile. */
|
|
3580
|
+
actions?: ReactNode;
|
|
3581
|
+
/** Extra filters or controls, laid out with the search. */
|
|
3578
3582
|
children?: ReactNode;
|
|
3579
3583
|
className?: string;
|
|
3580
3584
|
controlPanelToggle?: boolean | ToolbarControlPanelToggleConfig;
|