@drawbridge/components 0.1.22 → 0.1.23
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/dist/bridge/template-modal.js +2 -1
- package/dist/bridge/template-modal.mjs +2 -1
- package/dist/dashboard/buttons-subscription.js +65 -20
- package/dist/dashboard/buttons-subscription.mjs +64 -20
- package/dist/dashboard/card-payment-method.js +1 -1
- package/dist/dashboard/card-payment-method.mjs +1 -1
- package/dist/dashboard/card-section.js +2 -2
- package/dist/dashboard/card-section.mjs +2 -2
- package/dist/dashboard/card-setting.js +4 -3
- package/dist/dashboard/card-setting.mjs +4 -3
- package/dist/dashboard/card-task.js +22 -4
- package/dist/dashboard/card-task.mjs +22 -4
- package/dist/dashboard/card-tile.js +6 -6
- package/dist/dashboard/card-tile.mjs +6 -6
- package/dist/dashboard/drawer.js +7 -2
- package/dist/dashboard/drawer.mjs +8 -3
- package/dist/dashboard/form-organization-workflow.js +2 -2
- package/dist/dashboard/form-organization-workflow.mjs +2 -2
- package/dist/dashboard/input-combobox.js +7 -2
- package/dist/dashboard/input-combobox.mjs +7 -2
- package/dist/dashboard/lib/escape.js +48 -0
- package/dist/dashboard/lib/escape.mjs +25 -0
- package/dist/dashboard/lib/rail.js +75 -0
- package/dist/dashboard/lib/rail.mjs +46 -0
- package/dist/dashboard/lib/throttle.js +57 -0
- package/dist/dashboard/lib/throttle.mjs +34 -0
- package/dist/dashboard/list.js +1 -1
- package/dist/dashboard/list.mjs +1 -1
- package/dist/dashboard/menu.js +188 -96
- package/dist/dashboard/menu.mjs +189 -97
- package/dist/dashboard/modal.js +9 -3
- package/dist/dashboard/modal.mjs +10 -4
- package/dist/dashboard/notice.js +5 -3
- package/dist/dashboard/notice.mjs +5 -3
- package/dist/dashboard/table-cell-title.js +2 -0
- package/dist/dashboard/table-cell-title.mjs +2 -0
- package/dist/dashboard/table.js +61 -20
- package/dist/dashboard/table.mjs +61 -20
- package/dist/dashboard/template-dashboard.js +35 -133
- package/dist/dashboard/template-dashboard.mjs +36 -134
- package/dist/dashboard/template-rail.js +674 -0
- package/dist/dashboard/template-rail.mjs +640 -0
- package/dist/dashboard/template-socket.js +19 -3
- package/dist/dashboard/template-socket.mjs +19 -3
- package/dist/dashboard/template-ui.js +150 -186
- package/dist/dashboard/template-ui.mjs +151 -187
- package/dist/icons/book-open.js +46 -0
- package/dist/icons/book-open.mjs +27 -0
- package/dist/icons/task.js +46 -0
- package/dist/icons/task.mjs +27 -0
- package/dist/shared/lib/helpers.js +9 -2
- package/dist/shared/lib/helpers.mjs +9 -2
- package/dist/shared/lib/motion.js +27 -0
- package/dist/shared/lib/motion.mjs +4 -0
- package/dist/shared/overlay.js +5 -3
- package/dist/shared/overlay.mjs +5 -3
- package/package.json +27 -12
- package/types/dashboard/card-task.d.ts +5 -1
- package/types/dashboard/lib/rail.d.ts +32 -0
- package/types/dashboard/lib/throttle.d.ts +5 -0
- package/types/dashboard/table.d.ts +3 -1
- package/types/dashboard/template-dashboard.d.ts +4 -1
- package/types/dashboard/template-rail.d.ts +36 -0
- package/types/dashboard/template-ui.d.ts +2 -2
- package/types/icons/book-open.d.ts +5 -0
- package/types/icons/task.d.ts +5 -0
- package/dist/dashboard/guide.js +0 -238
- package/dist/dashboard/guide.mjs +0 -209
- package/types/dashboard/guide.d.ts +0 -23
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from "react";
|
|
2
|
+
import { Fragment, useRef } from "react";
|
|
3
3
|
import { Transition } from "@headlessui/react";
|
|
4
|
+
import { useEscape } from "./lib/escape.mjs";
|
|
5
|
+
import { motion } from "../shared/lib/motion.mjs";
|
|
4
6
|
import Times from "../icons/times.mjs";
|
|
5
7
|
import Button from "../shared/button.mjs";
|
|
6
8
|
import { FormScope } from "../shared/lib/form.mjs";
|
|
@@ -14,6 +16,8 @@ const Drawer = ({
|
|
|
14
16
|
overlay = true,
|
|
15
17
|
title
|
|
16
18
|
}) => {
|
|
19
|
+
const close = useRef(null);
|
|
20
|
+
useEscape(active, close);
|
|
17
21
|
const classes = {
|
|
18
22
|
drawer: [
|
|
19
23
|
className,
|
|
@@ -22,9 +26,9 @@ const Drawer = ({
|
|
|
22
26
|
// Enter slides in immediately (no delay): the panel used to wait
|
|
23
27
|
// 300ms at translate-x-full, so a reopen before the previous leave
|
|
24
28
|
// finished re-entered stuck off-screen for that delay. Leave stays
|
|
25
|
-
// immediate; the overlay lingers
|
|
29
|
+
// immediate; the overlay lingers 100ms so the panel slides out
|
|
26
30
|
// first on close.
|
|
27
|
-
|
|
31
|
+
motion,
|
|
28
32
|
"data-[closed]:translate-x-full"
|
|
29
33
|
],
|
|
30
34
|
header: [
|
|
@@ -71,6 +75,7 @@ const Drawer = ({
|
|
|
71
75
|
"data-guard": "drawer",
|
|
72
76
|
inline: true,
|
|
73
77
|
onClick: onClose,
|
|
78
|
+
ref: close,
|
|
74
79
|
variant: "link"
|
|
75
80
|
},
|
|
76
81
|
children: /* @__PURE__ */ jsx(
|
|
@@ -87,9 +87,9 @@ const messageSteps = [...emailSteps, "step.sms.send"];
|
|
|
87
87
|
const renderedSteps = [...emailSteps, ...teamSteps];
|
|
88
88
|
const RESPONSE = "step.response.send";
|
|
89
89
|
const firstEntryOnly = ({ campaign, event, type }) => {
|
|
90
|
-
var _a
|
|
90
|
+
var _a;
|
|
91
91
|
if (event !== "lead.insert" || !type || emailSteps.includes(type) || type === RESPONSE) return false;
|
|
92
|
-
if (type === "step.sms.send") return ((
|
|
92
|
+
if (type === "step.sms.send") return ((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) !== "phone";
|
|
93
93
|
return true;
|
|
94
94
|
};
|
|
95
95
|
const stepPrefills = {
|
|
@@ -35,9 +35,9 @@ const messageSteps = [...emailSteps, "step.sms.send"];
|
|
|
35
35
|
const renderedSteps = [...emailSteps, ...teamSteps];
|
|
36
36
|
const RESPONSE = "step.response.send";
|
|
37
37
|
const firstEntryOnly = ({ campaign, event, type }) => {
|
|
38
|
-
var _a
|
|
38
|
+
var _a;
|
|
39
39
|
if (event !== "lead.insert" || !type || emailSteps.includes(type) || type === RESPONSE) return false;
|
|
40
|
-
if (type === "step.sms.send") return ((
|
|
40
|
+
if (type === "step.sms.send") return ((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) !== "phone";
|
|
41
41
|
return true;
|
|
42
42
|
};
|
|
43
43
|
const stepPrefills = {
|
|
@@ -259,8 +259,13 @@ const InputCombobox = ({
|
|
|
259
259
|
import_react2.ComboboxOptions,
|
|
260
260
|
{
|
|
261
261
|
...{
|
|
262
|
-
anchor:
|
|
263
|
-
|
|
262
|
+
// The gap from the anchor, not a margin: a margin pushed a list that
|
|
263
|
+
// flipped upward 8 px into its own input.
|
|
264
|
+
anchor: {
|
|
265
|
+
gap: 8,
|
|
266
|
+
to: "bottom start"
|
|
267
|
+
},
|
|
268
|
+
className: "z-50 w-[var(--input-width)]",
|
|
264
269
|
...panelWidth && {
|
|
265
270
|
style: {
|
|
266
271
|
width: panelWidth
|
|
@@ -233,8 +233,13 @@ const InputCombobox = ({
|
|
|
233
233
|
ComboboxOptions,
|
|
234
234
|
{
|
|
235
235
|
...{
|
|
236
|
-
anchor:
|
|
237
|
-
|
|
236
|
+
// The gap from the anchor, not a margin: a margin pushed a list that
|
|
237
|
+
// flipped upward 8 px into its own input.
|
|
238
|
+
anchor: {
|
|
239
|
+
gap: 8,
|
|
240
|
+
to: "bottom start"
|
|
241
|
+
},
|
|
242
|
+
className: "z-50 w-[var(--input-width)]",
|
|
238
243
|
...panelWidth && {
|
|
239
244
|
style: {
|
|
240
245
|
width: panelWidth
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var escape_exports = {};
|
|
19
|
+
__export(escape_exports, {
|
|
20
|
+
useEscape: () => useEscape
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(escape_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
const layers = [];
|
|
25
|
+
const useEscape = (active, button) => {
|
|
26
|
+
(0, import_react.useEffect)(
|
|
27
|
+
() => {
|
|
28
|
+
if (!active) return void 0;
|
|
29
|
+
const layer = {};
|
|
30
|
+
layers.push(layer);
|
|
31
|
+
const onKeyDown = (event) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || layers[layers.length - 1] !== layer) return;
|
|
34
|
+
(_a = button.current) == null ? void 0 : _a.click();
|
|
35
|
+
};
|
|
36
|
+
document.addEventListener("keydown", onKeyDown);
|
|
37
|
+
return () => {
|
|
38
|
+
layers.splice(layers.indexOf(layer), 1);
|
|
39
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
[active, button]
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
useEscape
|
|
48
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
const layers = [];
|
|
3
|
+
const useEscape = (active, button) => {
|
|
4
|
+
useEffect(
|
|
5
|
+
() => {
|
|
6
|
+
if (!active) return void 0;
|
|
7
|
+
const layer = {};
|
|
8
|
+
layers.push(layer);
|
|
9
|
+
const onKeyDown = (event) => {
|
|
10
|
+
var _a;
|
|
11
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || layers[layers.length - 1] !== layer) return;
|
|
12
|
+
(_a = button.current) == null ? void 0 : _a.click();
|
|
13
|
+
};
|
|
14
|
+
document.addEventListener("keydown", onKeyDown);
|
|
15
|
+
return () => {
|
|
16
|
+
layers.splice(layers.indexOf(layer), 1);
|
|
17
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
[active, button]
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
useEscape
|
|
25
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var rail_exports = {};
|
|
19
|
+
__export(rail_exports, {
|
|
20
|
+
railCount: () => railCount,
|
|
21
|
+
railFirst: () => railFirst,
|
|
22
|
+
railItems: () => railItems,
|
|
23
|
+
railOnScreen: () => railOnScreen,
|
|
24
|
+
railOverlap: () => railOverlap,
|
|
25
|
+
railTabTarget: () => railTabTarget,
|
|
26
|
+
railView: () => railView
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(rail_exports);
|
|
29
|
+
const required = (items = []) => items.filter(({ kind }) => kind === "required");
|
|
30
|
+
const railItems = ({
|
|
31
|
+
account,
|
|
32
|
+
campaign,
|
|
33
|
+
organization,
|
|
34
|
+
page,
|
|
35
|
+
params = {},
|
|
36
|
+
path = ""
|
|
37
|
+
}) => {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f;
|
|
39
|
+
if (path.startsWith("/admin")) return [];
|
|
40
|
+
if (!params.organization) return ((_a = account == null ? void 0 : account.tasks) == null ? void 0 : _a.items) || [];
|
|
41
|
+
if (!params.campaign) return ((_b = organization == null ? void 0 : organization.tasks) == null ? void 0 : _b.items) || [];
|
|
42
|
+
const list = ((_c = organization == null ? void 0 : organization.tasks) == null ? void 0 : _c.list) || {};
|
|
43
|
+
const others = Object.keys(list).filter((key) => !["billing", "campaigns"].includes(key));
|
|
44
|
+
return [
|
|
45
|
+
...params.page ? ((_d = page == null ? void 0 : page.tasks) == null ? void 0 : _d.items) || [] : [],
|
|
46
|
+
...required((_e = list.billing) == null ? void 0 : _e.items),
|
|
47
|
+
...((_f = campaign == null ? void 0 : campaign.tasks) == null ? void 0 : _f.items) || [],
|
|
48
|
+
...others.flatMap((key) => {
|
|
49
|
+
var _a2;
|
|
50
|
+
return required((_a2 = list[key]) == null ? void 0 : _a2.items);
|
|
51
|
+
})
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
const railCount = (items = []) => required(items).length;
|
|
55
|
+
const railFirst = (items = []) => required(items)[0] || items[0];
|
|
56
|
+
const railView = ({ guide, panel }) => panel === "guide" && !guide ? "next" : panel || null;
|
|
57
|
+
const railOverlap = (a, b) => a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
|
|
58
|
+
const railOnScreen = (rect, { height, width }) => rect.bottom > 0 && rect.right > 0 && rect.top < height && rect.left < width;
|
|
59
|
+
const railTabTarget = ({ active, items, shift }) => {
|
|
60
|
+
if (items.length === 0) return null;
|
|
61
|
+
const first = items[0];
|
|
62
|
+
const last = items[items.length - 1];
|
|
63
|
+
if (shift) return active === first || !items.includes(active) ? last : null;
|
|
64
|
+
return active === last ? first : null;
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
railCount,
|
|
69
|
+
railFirst,
|
|
70
|
+
railItems,
|
|
71
|
+
railOnScreen,
|
|
72
|
+
railOverlap,
|
|
73
|
+
railTabTarget,
|
|
74
|
+
railView
|
|
75
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const required = (items = []) => items.filter(({ kind }) => kind === "required");
|
|
2
|
+
const railItems = ({
|
|
3
|
+
account,
|
|
4
|
+
campaign,
|
|
5
|
+
organization,
|
|
6
|
+
page,
|
|
7
|
+
params = {},
|
|
8
|
+
path = ""
|
|
9
|
+
}) => {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
|
+
if (path.startsWith("/admin")) return [];
|
|
12
|
+
if (!params.organization) return ((_a = account == null ? void 0 : account.tasks) == null ? void 0 : _a.items) || [];
|
|
13
|
+
if (!params.campaign) return ((_b = organization == null ? void 0 : organization.tasks) == null ? void 0 : _b.items) || [];
|
|
14
|
+
const list = ((_c = organization == null ? void 0 : organization.tasks) == null ? void 0 : _c.list) || {};
|
|
15
|
+
const others = Object.keys(list).filter((key) => !["billing", "campaigns"].includes(key));
|
|
16
|
+
return [
|
|
17
|
+
...params.page ? ((_d = page == null ? void 0 : page.tasks) == null ? void 0 : _d.items) || [] : [],
|
|
18
|
+
...required((_e = list.billing) == null ? void 0 : _e.items),
|
|
19
|
+
...((_f = campaign == null ? void 0 : campaign.tasks) == null ? void 0 : _f.items) || [],
|
|
20
|
+
...others.flatMap((key) => {
|
|
21
|
+
var _a2;
|
|
22
|
+
return required((_a2 = list[key]) == null ? void 0 : _a2.items);
|
|
23
|
+
})
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
const railCount = (items = []) => required(items).length;
|
|
27
|
+
const railFirst = (items = []) => required(items)[0] || items[0];
|
|
28
|
+
const railView = ({ guide, panel }) => panel === "guide" && !guide ? "next" : panel || null;
|
|
29
|
+
const railOverlap = (a, b) => a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
|
|
30
|
+
const railOnScreen = (rect, { height, width }) => rect.bottom > 0 && rect.right > 0 && rect.top < height && rect.left < width;
|
|
31
|
+
const railTabTarget = ({ active, items, shift }) => {
|
|
32
|
+
if (items.length === 0) return null;
|
|
33
|
+
const first = items[0];
|
|
34
|
+
const last = items[items.length - 1];
|
|
35
|
+
if (shift) return active === first || !items.includes(active) ? last : null;
|
|
36
|
+
return active === last ? first : null;
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
railCount,
|
|
40
|
+
railFirst,
|
|
41
|
+
railItems,
|
|
42
|
+
railOnScreen,
|
|
43
|
+
railOverlap,
|
|
44
|
+
railTabTarget,
|
|
45
|
+
railView
|
|
46
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var throttle_exports = {};
|
|
19
|
+
__export(throttle_exports, {
|
|
20
|
+
trailingThrottle: () => trailingThrottle
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(throttle_exports);
|
|
23
|
+
const trailingThrottle = ({
|
|
24
|
+
now = Date.now,
|
|
25
|
+
schedule = setTimeout,
|
|
26
|
+
wait
|
|
27
|
+
}) => {
|
|
28
|
+
const entries = /* @__PURE__ */ new Map();
|
|
29
|
+
return (key, run) => {
|
|
30
|
+
const entry = entries.get(key) || {
|
|
31
|
+
last: -Infinity,
|
|
32
|
+
pending: false
|
|
33
|
+
};
|
|
34
|
+
entries.set(key, entry);
|
|
35
|
+
entry.run = run;
|
|
36
|
+
if (entry.pending) return;
|
|
37
|
+
const left = entry.last + wait - now();
|
|
38
|
+
if (left <= 0) {
|
|
39
|
+
entry.last = now();
|
|
40
|
+
run();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
entry.pending = true;
|
|
44
|
+
schedule(
|
|
45
|
+
() => {
|
|
46
|
+
entry.last = now();
|
|
47
|
+
entry.pending = false;
|
|
48
|
+
entry.run();
|
|
49
|
+
},
|
|
50
|
+
left
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
trailingThrottle
|
|
57
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const trailingThrottle = ({
|
|
2
|
+
now = Date.now,
|
|
3
|
+
schedule = setTimeout,
|
|
4
|
+
wait
|
|
5
|
+
}) => {
|
|
6
|
+
const entries = /* @__PURE__ */ new Map();
|
|
7
|
+
return (key, run) => {
|
|
8
|
+
const entry = entries.get(key) || {
|
|
9
|
+
last: -Infinity,
|
|
10
|
+
pending: false
|
|
11
|
+
};
|
|
12
|
+
entries.set(key, entry);
|
|
13
|
+
entry.run = run;
|
|
14
|
+
if (entry.pending) return;
|
|
15
|
+
const left = entry.last + wait - now();
|
|
16
|
+
if (left <= 0) {
|
|
17
|
+
entry.last = now();
|
|
18
|
+
run();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
entry.pending = true;
|
|
22
|
+
schedule(
|
|
23
|
+
() => {
|
|
24
|
+
entry.last = now();
|
|
25
|
+
entry.pending = false;
|
|
26
|
+
entry.run();
|
|
27
|
+
},
|
|
28
|
+
left
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
trailingThrottle
|
|
34
|
+
};
|
package/dist/dashboard/list.js
CHANGED
|
@@ -49,7 +49,7 @@ const List = ({
|
|
|
49
49
|
className
|
|
50
50
|
},
|
|
51
51
|
// icon and element shape the row; left in rest they reach the DOM.
|
|
52
|
-
children: items.map(({ complete, element, icon,
|
|
52
|
+
children: items.map(({ complete, element, icon, title, ...rest }, key) => {
|
|
53
53
|
const same = Boolean(rest == null ? void 0 : rest.href) && rest.href === pathname;
|
|
54
54
|
const linked = Boolean(rest == null ? void 0 : rest.href) && !same;
|
|
55
55
|
const IconComponent = icon || import_arrow_right.default;
|
package/dist/dashboard/list.mjs
CHANGED
|
@@ -17,7 +17,7 @@ const List = ({
|
|
|
17
17
|
className
|
|
18
18
|
},
|
|
19
19
|
// icon and element shape the row; left in rest they reach the DOM.
|
|
20
|
-
children: items.map(({ complete, element, icon,
|
|
20
|
+
children: items.map(({ complete, element, icon, title, ...rest }, key) => {
|
|
21
21
|
const same = Boolean(rest == null ? void 0 : rest.href) && rest.href === pathname;
|
|
22
22
|
const linked = Boolean(rest == null ? void 0 : rest.href) && !same;
|
|
23
23
|
const IconComponent = icon || ArrowRight;
|