@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.
Files changed (69) hide show
  1. package/dist/bridge/template-modal.js +2 -1
  2. package/dist/bridge/template-modal.mjs +2 -1
  3. package/dist/dashboard/buttons-subscription.js +65 -20
  4. package/dist/dashboard/buttons-subscription.mjs +64 -20
  5. package/dist/dashboard/card-payment-method.js +1 -1
  6. package/dist/dashboard/card-payment-method.mjs +1 -1
  7. package/dist/dashboard/card-section.js +2 -2
  8. package/dist/dashboard/card-section.mjs +2 -2
  9. package/dist/dashboard/card-setting.js +4 -3
  10. package/dist/dashboard/card-setting.mjs +4 -3
  11. package/dist/dashboard/card-task.js +22 -4
  12. package/dist/dashboard/card-task.mjs +22 -4
  13. package/dist/dashboard/card-tile.js +6 -6
  14. package/dist/dashboard/card-tile.mjs +6 -6
  15. package/dist/dashboard/drawer.js +7 -2
  16. package/dist/dashboard/drawer.mjs +8 -3
  17. package/dist/dashboard/form-organization-workflow.js +2 -2
  18. package/dist/dashboard/form-organization-workflow.mjs +2 -2
  19. package/dist/dashboard/input-combobox.js +7 -2
  20. package/dist/dashboard/input-combobox.mjs +7 -2
  21. package/dist/dashboard/lib/escape.js +48 -0
  22. package/dist/dashboard/lib/escape.mjs +25 -0
  23. package/dist/dashboard/lib/rail.js +75 -0
  24. package/dist/dashboard/lib/rail.mjs +46 -0
  25. package/dist/dashboard/lib/throttle.js +57 -0
  26. package/dist/dashboard/lib/throttle.mjs +34 -0
  27. package/dist/dashboard/list.js +1 -1
  28. package/dist/dashboard/list.mjs +1 -1
  29. package/dist/dashboard/menu.js +188 -96
  30. package/dist/dashboard/menu.mjs +189 -97
  31. package/dist/dashboard/modal.js +9 -3
  32. package/dist/dashboard/modal.mjs +10 -4
  33. package/dist/dashboard/notice.js +5 -3
  34. package/dist/dashboard/notice.mjs +5 -3
  35. package/dist/dashboard/table-cell-title.js +2 -0
  36. package/dist/dashboard/table-cell-title.mjs +2 -0
  37. package/dist/dashboard/table.js +61 -20
  38. package/dist/dashboard/table.mjs +61 -20
  39. package/dist/dashboard/template-dashboard.js +35 -133
  40. package/dist/dashboard/template-dashboard.mjs +36 -134
  41. package/dist/dashboard/template-rail.js +674 -0
  42. package/dist/dashboard/template-rail.mjs +640 -0
  43. package/dist/dashboard/template-socket.js +19 -3
  44. package/dist/dashboard/template-socket.mjs +19 -3
  45. package/dist/dashboard/template-ui.js +150 -186
  46. package/dist/dashboard/template-ui.mjs +151 -187
  47. package/dist/icons/book-open.js +46 -0
  48. package/dist/icons/book-open.mjs +27 -0
  49. package/dist/icons/task.js +46 -0
  50. package/dist/icons/task.mjs +27 -0
  51. package/dist/shared/lib/helpers.js +9 -2
  52. package/dist/shared/lib/helpers.mjs +9 -2
  53. package/dist/shared/lib/motion.js +27 -0
  54. package/dist/shared/lib/motion.mjs +4 -0
  55. package/dist/shared/overlay.js +5 -3
  56. package/dist/shared/overlay.mjs +5 -3
  57. package/package.json +27 -12
  58. package/types/dashboard/card-task.d.ts +5 -1
  59. package/types/dashboard/lib/rail.d.ts +32 -0
  60. package/types/dashboard/lib/throttle.d.ts +5 -0
  61. package/types/dashboard/table.d.ts +3 -1
  62. package/types/dashboard/template-dashboard.d.ts +4 -1
  63. package/types/dashboard/template-rail.d.ts +36 -0
  64. package/types/dashboard/template-ui.d.ts +2 -2
  65. package/types/icons/book-open.d.ts +5 -0
  66. package/types/icons/task.d.ts +5 -0
  67. package/dist/dashboard/guide.js +0 -238
  68. package/dist/dashboard/guide.mjs +0 -209
  69. package/types/dashboard/guide.d.ts +0 -23
@@ -1,17 +1,17 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { isValidElement, useEffect, useRef, useState } from "react";
2
+ import { isValidElement, useEffect, useState } from "react";
3
3
  import { keepPreviousData, useIsFetching, useQueryClient } from "@tanstack/react-query";
4
4
  import { notFound } from "next/navigation";
5
- import { useDrawer } from "./lib/hooks.mjs";
6
5
  import { iconLabel } from "../shared/lib/icon-labels.mjs";
7
6
  import ProviderResource from "./provider-resource.mjs";
7
+ import { railFirst } from "./lib/rail.mjs";
8
+ import { useRail } from "./template-rail.mjs";
8
9
  import ArrowRight from "../icons/arrow-right.mjs";
9
10
  import LoaderIcon from "../icons/loader.mjs";
10
11
  import Refresh from "../icons/refresh.mjs";
11
12
  import Empty from "../shared/empty.mjs";
12
13
  import Badge from "../shared/badge.mjs";
13
14
  import Button from "../shared/button.mjs";
14
- import List from "./list.mjs";
15
15
  import LinkBack from "./link-back.mjs";
16
16
  import WrapperGradient from "../wrapper-gradient.mjs";
17
17
  import Image from "next/image";
@@ -340,143 +340,45 @@ const TemplateDashboardError = ({
340
340
  const TemplateDashboardTasks = ({
341
341
  items = []
342
342
  }) => {
343
- const queryClient = useQueryClient();
344
- const { close, open } = useDrawer({
345
- queryClient
346
- });
347
- const array = [...items];
348
- const first = array.shift();
349
- const nextSteps = () => ({
350
- title: /* @__PURE__ */ jsxs(
351
- "span",
352
- {
353
- ...{
354
- className: "flex items-center space-x-3"
355
- },
356
- children: [
357
- /* @__PURE__ */ jsx("span", { children: "Next steps" }),
358
- /* @__PURE__ */ jsx(
359
- Badge,
343
+ const { set } = useRail();
344
+ const first = railFirst(items);
345
+ if (!first) return null;
346
+ return /* @__PURE__ */ jsx(
347
+ "div",
348
+ {
349
+ ...{
350
+ className: "px-6 md:px-12"
351
+ },
352
+ children: /* @__PURE__ */ jsx(
353
+ "div",
354
+ {
355
+ ...{
356
+ className: "bg-white border border-gray rounded px-4 py-3"
357
+ },
358
+ children: /* @__PURE__ */ jsx(
359
+ Button,
360
360
  {
361
361
  ...{
362
- type: "warning"
362
+ icon: ArrowRight,
363
+ justify: "between",
364
+ onClick: () => set("next"),
365
+ variant: "link"
363
366
  },
364
- children: array.length + 1
365
- }
366
- )
367
- ]
368
- }
369
- ),
370
- children: /* @__PURE__ */ jsx(
371
- "div",
372
- {
373
- ...{
374
- className: "p-6"
375
- },
376
- children: /* @__PURE__ */ jsx(
377
- List,
378
- {
379
- ...{
380
- items: [
367
+ children: /* @__PURE__ */ jsx(
368
+ "span",
381
369
  {
382
- ...first,
383
- onClick: () => close()
384
- },
385
- ...array.map((props) => ({
386
- ...props,
387
- onClick: () => close()
388
- }))
389
- ]
370
+ ...{
371
+ className: "flex-1 min-w-0 text-left whitespace-normal hover:underline"
372
+ },
373
+ children: first.title
374
+ }
375
+ )
390
376
  }
391
- }
392
- )
393
- }
394
- )
395
- });
396
- const shown = useRef(null);
397
- const openAll = () => {
398
- const props = nextSteps();
399
- shown.current = props.children;
400
- open(props);
401
- };
402
- useEffect(
403
- () => {
404
- const drawer = queryClient.getQueryData(["drawer"]);
405
- if (!shown.current || !(drawer == null ? void 0 : drawer.active) || drawer.children !== shown.current) return;
406
- if (!first) {
407
- shown.current = null;
408
- close();
409
- return;
410
- }
411
- openAll();
412
- },
413
- // The tasks are the trigger; the rest follows them.
414
- // eslint-disable-next-line react-hooks/exhaustive-deps
415
- [items]
377
+ )
378
+ }
379
+ )
380
+ }
416
381
  );
417
- if (first) {
418
- return /* @__PURE__ */ jsx(
419
- "div",
420
- {
421
- ...{
422
- className: "px-6 md:px-12"
423
- },
424
- children: /* @__PURE__ */ jsx(
425
- "div",
426
- {
427
- ...{
428
- className: "bg-white border border-gray rounded px-4 py-3"
429
- },
430
- children: /* @__PURE__ */ jsxs(
431
- "div",
432
- {
433
- ...{
434
- className: "flex items-center justify-between space-x-6"
435
- },
436
- children: [
437
- first && /* @__PURE__ */ jsx(
438
- List,
439
- {
440
- ...{
441
- items: [
442
- {
443
- ...first,
444
- onClick: () => close()
445
- }
446
- ],
447
- svg: false
448
- }
449
- }
450
- ),
451
- (array == null ? void 0 : array.length) > 0 && /* @__PURE__ */ jsx(
452
- Button,
453
- {
454
- ...{
455
- icon: ArrowRight,
456
- inline: true,
457
- onClick: openAll,
458
- variant: "link"
459
- },
460
- children: /* @__PURE__ */ jsx(
461
- Badge,
462
- {
463
- ...{
464
- type: "warning"
465
- },
466
- children: array.length + 1
467
- }
468
- )
469
- }
470
- )
471
- ]
472
- }
473
- )
474
- }
475
- )
476
- }
477
- );
478
- }
479
- return null;
480
382
  };
481
383
  const SETTLE_QUIET = 50;
482
384
  const SETTLE_CAP = 3e3;