@drawbridge/components 0.1.23 → 0.1.25

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.
Files changed (81) hide show
  1. package/dist/bridge/form-subdomain-embed.js +1 -0
  2. package/dist/bridge/form-subdomain-embed.mjs +1 -0
  3. package/dist/bridge/form-subdomain.js +5 -2
  4. package/dist/bridge/form-subdomain.mjs +5 -2
  5. package/dist/bridge/template-modal.js +2 -2
  6. package/dist/bridge/template-modal.mjs +2 -2
  7. package/dist/dashboard/buttons-subscription.js +27 -66
  8. package/dist/dashboard/buttons-subscription.mjs +27 -65
  9. package/dist/dashboard/card-payment-method.js +1 -1
  10. package/dist/dashboard/card-payment-method.mjs +1 -1
  11. package/dist/dashboard/card-section.js +2 -2
  12. package/dist/dashboard/card-section.mjs +2 -2
  13. package/dist/dashboard/card-setting.js +3 -4
  14. package/dist/dashboard/card-setting.mjs +3 -4
  15. package/dist/dashboard/card-task.js +4 -22
  16. package/dist/dashboard/card-task.mjs +4 -22
  17. package/dist/dashboard/card-tile.js +6 -6
  18. package/dist/dashboard/card-tile.mjs +6 -6
  19. package/dist/dashboard/drawer.js +2 -7
  20. package/dist/dashboard/drawer.mjs +3 -8
  21. package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -5
  22. package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -5
  23. package/dist/dashboard/form-organization-campaign.js +1 -1
  24. package/dist/dashboard/form-organization-campaign.mjs +1 -1
  25. package/dist/dashboard/form-organization-identity.js +3 -3
  26. package/dist/dashboard/form-organization-identity.mjs +3 -3
  27. package/dist/dashboard/form-organization-workflow.js +9 -7
  28. package/dist/dashboard/form-organization-workflow.mjs +9 -7
  29. package/dist/dashboard/form-organization.js +40 -3
  30. package/dist/dashboard/form-organization.mjs +40 -3
  31. package/dist/dashboard/guide.js +238 -0
  32. package/dist/dashboard/guide.mjs +209 -0
  33. package/dist/dashboard/input-combobox.js +2 -7
  34. package/dist/dashboard/input-combobox.mjs +2 -7
  35. package/dist/dashboard/list.js +1 -1
  36. package/dist/dashboard/list.mjs +1 -1
  37. package/dist/dashboard/menu.js +96 -188
  38. package/dist/dashboard/menu.mjs +97 -189
  39. package/dist/dashboard/modal.js +3 -9
  40. package/dist/dashboard/modal.mjs +4 -10
  41. package/dist/dashboard/notice.js +3 -5
  42. package/dist/dashboard/notice.mjs +3 -5
  43. package/dist/dashboard/table-cell-title.js +0 -2
  44. package/dist/dashboard/table-cell-title.mjs +0 -2
  45. package/dist/dashboard/table.js +20 -61
  46. package/dist/dashboard/table.mjs +20 -61
  47. package/dist/dashboard/template-dashboard.js +133 -35
  48. package/dist/dashboard/template-dashboard.mjs +134 -36
  49. package/dist/dashboard/template-socket.js +3 -19
  50. package/dist/dashboard/template-socket.mjs +3 -19
  51. package/dist/dashboard/template-ui.js +186 -150
  52. package/dist/dashboard/template-ui.mjs +187 -151
  53. package/dist/shared/lib/helpers.js +2 -9
  54. package/dist/shared/lib/helpers.mjs +2 -9
  55. package/dist/shared/overlay.js +3 -5
  56. package/dist/shared/overlay.mjs +3 -5
  57. package/package.json +13 -28
  58. package/types/dashboard/card-task.d.ts +1 -5
  59. package/types/dashboard/guide.d.ts +23 -0
  60. package/types/dashboard/table.d.ts +1 -3
  61. package/types/dashboard/template-dashboard.d.ts +1 -4
  62. package/types/dashboard/template-ui.d.ts +2 -2
  63. package/dist/dashboard/lib/escape.js +0 -48
  64. package/dist/dashboard/lib/escape.mjs +0 -25
  65. package/dist/dashboard/lib/rail.js +0 -75
  66. package/dist/dashboard/lib/rail.mjs +0 -46
  67. package/dist/dashboard/lib/throttle.js +0 -57
  68. package/dist/dashboard/lib/throttle.mjs +0 -34
  69. package/dist/dashboard/template-rail.js +0 -674
  70. package/dist/dashboard/template-rail.mjs +0 -640
  71. package/dist/icons/book-open.js +0 -46
  72. package/dist/icons/book-open.mjs +0 -27
  73. package/dist/icons/task.js +0 -46
  74. package/dist/icons/task.mjs +0 -27
  75. package/dist/shared/lib/motion.js +0 -27
  76. package/dist/shared/lib/motion.mjs +0 -4
  77. package/types/dashboard/lib/rail.d.ts +0 -32
  78. package/types/dashboard/lib/throttle.d.ts +0 -5
  79. package/types/dashboard/template-rail.d.ts +0 -36
  80. package/types/icons/book-open.d.ts +0 -5
  81. package/types/icons/task.d.ts +0 -5
@@ -0,0 +1,23 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+
3
+ export interface GuideStep {
4
+ content?: ReactNode[];
5
+ // data.video is an mp4 shown above the content; other keys are the
6
+ // caller's callback hooks ( e.g. 'next.step:before' ).
7
+ data?: { video?: string; [ key: string ]: unknown };
8
+ disableBeacon?: boolean;
9
+ placement?: string;
10
+ target: string | HTMLElement;
11
+ title?: ReactNode;
12
+ [ key: string ]: unknown;
13
+ }
14
+
15
+ // Everything else is passed to react-joyride ( run, stepIndex, callback… ).
16
+ export interface GuideProps {
17
+ steps?: GuideStep[];
18
+ [ key: string ]: unknown;
19
+ }
20
+
21
+ declare const Guide: ComponentType<GuideProps>;
22
+
23
+ export default Guide;
@@ -53,7 +53,7 @@ export interface TableRowLoading {
53
53
  export type TableColumn<TData = any> = ColumnDef<TData, any> & {
54
54
  // Maps to tanstack's enableSorting.
55
55
  sortable?: boolean;
56
- meta?: { className?: string; classNameCell?: string; classNameHeader?: string; shrink?: boolean };
56
+ meta?: { className?: string; classNameCell?: string; classNameHeader?: string };
57
57
  };
58
58
 
59
59
  export interface TableProps<TData = any> {
@@ -71,8 +71,6 @@ export interface TableProps<TData = any> {
71
71
  onSortingChange?: OnChangeFn<SortingState>;
72
72
  sorting?: SortingState;
73
73
  truncate?: boolean;
74
- // false: the actions scroll with the row, for a list too wide for any laptop.
75
- fixedActions?: boolean;
76
74
  }
77
75
 
78
76
  export type TableCellRenderer = ( context: Pick<CellContext<any, any>, 'getValue'> & Partial<Pick<CellContext<any, any>, 'row'>> ) => ReactNode;
@@ -25,13 +25,10 @@ export interface TemplateDashboardBadge {
25
25
 
26
26
  // An organization or campaign task, as the api's tasks list ships it.
27
27
  export interface TemplateDashboardTask {
28
- area?: string;
29
- button?: string;
30
28
  complete?: boolean;
31
29
  href?: string;
32
- kind?: 'recommended' | 'required';
30
+ increment?: boolean;
33
31
  title: ReactNode;
34
- why?: string;
35
32
  [ key: string ]: unknown;
36
33
  }
37
34
 
@@ -3,12 +3,12 @@ import { ComponentType, ReactNode } from 'react';
3
3
  export interface TemplateUiProps {
4
4
  // The page, right of the sidebar.
5
5
  children?: ReactNode;
6
- // Key into the account's guide ( e.g. 'organization.campaigns' ) for this page's steps on the rail.
6
+ // Key into the account's guide ( e.g. 'organization.campaigns' ) for this page's tour.
7
7
  guide?: string;
8
8
  }
9
9
 
10
10
  // The dashboard shell: sidebar header, the menu for the route ( organization,
11
- // campaign, app, admin or account ), the account dropdown and the rail.
11
+ // campaign, app, admin or account ) and the account dropdown.
12
12
  declare const TemplateUi: ComponentType<TemplateUiProps>;
13
13
 
14
14
  export default TemplateUi;
@@ -1,48 +0,0 @@
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
- });
@@ -1,25 +0,0 @@
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
- };
@@ -1,75 +0,0 @@
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
- });
@@ -1,46 +0,0 @@
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
- };
@@ -1,57 +0,0 @@
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
- });
@@ -1,34 +0,0 @@
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
- };