@drawbridge/components 0.1.31 → 0.1.33

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 +87 -65
  18. package/dist/dashboard/form-organization-workflow.mjs +87 -65
  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 +28 -13
  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,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Fragment } from "react";
3
+ import { Fragment, useEffect, useRef, useState } from "react";
4
4
  import Link from "./link.mjs";
5
5
  import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/react";
6
6
  import { useQuery } from "@tanstack/react-query";
@@ -44,6 +44,79 @@ const icons = {
44
44
  star: Star,
45
45
  users: Users
46
46
  };
47
+ const Reveal = ({
48
+ children,
49
+ className,
50
+ shown
51
+ }) => {
52
+ const box = useRef(null);
53
+ useEffect(
54
+ () => {
55
+ if (box.current) box.current.inert = !shown;
56
+ },
57
+ [shown]
58
+ );
59
+ return /* @__PURE__ */ jsx(
60
+ "div",
61
+ {
62
+ ...{
63
+ className: "grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none " + (shown ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
64
+ ref: box
65
+ },
66
+ children: /* @__PURE__ */ jsx(
67
+ "div",
68
+ {
69
+ ...{
70
+ className: "min-h-0 overflow-hidden"
71
+ },
72
+ children: /* @__PURE__ */ jsx(
73
+ "div",
74
+ {
75
+ ...{
76
+ className
77
+ },
78
+ children: children.map((child, index) => /* @__PURE__ */ jsx(
79
+ "div",
80
+ {
81
+ ...{
82
+ className: "transition-opacity ease-out motion-reduce:transition-none " + (shown ? "opacity-100 duration-150" : "opacity-0 duration-75"),
83
+ ...shown && {
84
+ style: {
85
+ transitionDelay: index * 30 + "ms"
86
+ }
87
+ }
88
+ },
89
+ children: child
90
+ },
91
+ index
92
+ ))
93
+ }
94
+ )
95
+ }
96
+ )
97
+ }
98
+ );
99
+ };
100
+ const opened = /* @__PURE__ */ new Set();
101
+ let primed = false;
102
+ const useShown = (key, open, enabled) => {
103
+ const [shown, setShown] = useState(() => primed ? opened.has(key) : open);
104
+ useEffect(
105
+ () => {
106
+ if (!enabled) return void 0;
107
+ primed = true;
108
+ if (open) {
109
+ opened.add(key);
110
+ } else {
111
+ opened.delete(key);
112
+ }
113
+ const frame = window.requestAnimationFrame(() => setShown(open));
114
+ return () => window.cancelAnimationFrame(frame);
115
+ },
116
+ [enabled, key, open]
117
+ );
118
+ return shown;
119
+ };
47
120
  const MenuItem = ({
48
121
  active,
49
122
  badge,
@@ -62,6 +135,7 @@ const MenuItem = ({
62
135
  ...rest
63
136
  }) => {
64
137
  const Icon = icons[icon];
138
+ const shown = useShown(rest.href || title, open, children.length > 0);
65
139
  const classes = {
66
140
  row: [
67
141
  "flex items-center justify-between w-full transform duration-300 text-left py-1 rounded",
@@ -177,11 +251,12 @@ const MenuItem = ({
177
251
  children: content
178
252
  }
179
253
  ),
180
- open && children.length > 0 && /* @__PURE__ */ jsx(
181
- "div",
254
+ children.length > 0 && /* @__PURE__ */ jsx(
255
+ Reveal,
182
256
  {
183
257
  ...{
184
- className: "mt-0.5 mb-2"
258
+ className: "pt-0.5 pb-2",
259
+ shown
185
260
  },
186
261
  children: children.map(({ key: childKey, exact, ...props }, key) => /* @__PURE__ */ jsx(
187
262
  MenuItem,
@@ -583,11 +658,10 @@ const MenuAccountDropdown = ({
583
658
  account,
584
659
  balance,
585
660
  actions,
586
- guide,
587
661
  modal,
588
662
  onClick
589
663
  }) => {
590
- var _a, _b, _c, _d, _e, _f, _g;
664
+ var _a, _b, _c, _d, _e;
591
665
  const app = useQuery({
592
666
  queryKey: ["app"]
593
667
  });
@@ -607,15 +681,6 @@ const MenuAccountDropdown = ({
607
681
  title: "Account"
608
682
  }
609
683
  ];
610
- if (guide) {
611
- items.push({
612
- "data-guide": "menu-item-account-guide",
613
- element: "button",
614
- onClick: actions.guide,
615
- title: "Screen guide"
616
- });
617
- }
618
- ;
619
684
  if (process.env.NEXT_PUBLIC_SUPPORT_URI) {
620
685
  items.push({
621
686
  "data-guide": "menu-item-account-support",
@@ -744,95 +809,122 @@ const MenuAccountDropdown = ({
744
809
  "div",
745
810
  {
746
811
  ...{
747
- className: "flex flex-col justify-between p-6 space-y-4" + (banded ? "" : " border-t border-gray-dark")
812
+ // No space-y: the always-drawn panel would leave its gap under a closed menu;
813
+ // the gap rides inside the panel's reveal.
814
+ className: "flex flex-col justify-between p-6" + (banded ? "" : " border-t border-gray-dark")
748
815
  },
749
- children: /* @__PURE__ */ jsxs(Disclosure, { children: [
750
- /* @__PURE__ */ jsx(
751
- DisclosureButton,
752
- {
753
- ...{
754
- as: Button,
755
- variant: "link"
756
- },
757
- children: /* @__PURE__ */ jsxs(
758
- "span",
759
- {
760
- ...{
761
- className: "flex items-center w-full space-x-3"
762
- },
763
- children: [
764
- /* @__PURE__ */ jsxs(
765
- "span",
766
- {
767
- ...{
768
- className: "relative w-8 h-8 shrink-0"
769
- },
770
- children: [
771
- Boolean(inbox) && /* @__PURE__ */ jsx(
772
- "span",
773
- {
774
- ...{
775
- className: "w-3 h-3 z-10 flex items-center justify-center absolute -top-[3px] -right-[3px] border-2 border-black rounded-full overflow-hidden"
776
- },
777
- children: /* @__PURE__ */ jsx(
778
- Indicator,
779
- {
780
- ...{
781
- type: "warning"
816
+ children: /* @__PURE__ */ jsx(Disclosure, { children: ({ open }) => {
817
+ var _a2, _b2;
818
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
819
+ /* @__PURE__ */ jsx(
820
+ DisclosureButton,
821
+ {
822
+ ...{
823
+ as: Button,
824
+ variant: "link"
825
+ },
826
+ children: /* @__PURE__ */ jsxs(
827
+ "span",
828
+ {
829
+ ...{
830
+ className: "flex items-center w-full space-x-3"
831
+ },
832
+ children: [
833
+ /* @__PURE__ */ jsxs(
834
+ "span",
835
+ {
836
+ ...{
837
+ // The avatar's own size: a fixed w-8 box let the 40 px avatar
838
+ // spill down and right, off the text's centre and into the gap.
839
+ // A gray ring: the black initials circle is otherwise lost on
840
+ // the black sidebar, leaving the dot floating.
841
+ className: "relative flex shrink-0 rounded-full ring-1 ring-gray-dark"
842
+ },
843
+ children: [
844
+ Boolean(inbox) && /* @__PURE__ */ jsx(
845
+ "span",
846
+ {
847
+ ...{
848
+ // On the circle's edge, at its top right.
849
+ className: "w-3 h-3 z-10 flex items-center justify-center absolute top-0 right-0 border-2 border-black rounded-full overflow-hidden"
850
+ },
851
+ children: /* @__PURE__ */ jsx(
852
+ Indicator,
853
+ {
854
+ ...{
855
+ type: "warning"
856
+ }
782
857
  }
858
+ )
859
+ }
860
+ ),
861
+ /* @__PURE__ */ jsx(
862
+ Avatar,
863
+ {
864
+ ...{
865
+ email: (_a2 = account == null ? void 0 : account.data) == null ? void 0 : _a2.email,
866
+ image: (_b2 = account == null ? void 0 : account.data) == null ? void 0 : _b2.image,
867
+ name: formatUserName(account == null ? void 0 : account.data)
783
868
  }
784
- )
785
- }
786
- ),
787
- /* @__PURE__ */ jsx(
788
- Avatar,
789
- {
790
- ...{
791
- email: (_f = account == null ? void 0 : account.data) == null ? void 0 : _f.email,
792
- image: (_g = account == null ? void 0 : account.data) == null ? void 0 : _g.image,
793
- name: formatUserName(account == null ? void 0 : account.data)
794
869
  }
795
- }
796
- )
797
- ]
798
- }
799
- ),
800
- /* @__PURE__ */ jsxs(
801
- "span",
870
+ )
871
+ ]
872
+ }
873
+ ),
874
+ /* @__PURE__ */ jsxs(
875
+ "span",
876
+ {
877
+ ...{
878
+ className: "w-full flex flex-col text-left leading-none space-y-[3px]"
879
+ },
880
+ children: [
881
+ /* @__PURE__ */ jsx(
882
+ "span",
883
+ {
884
+ ...{
885
+ className: "block text-white"
886
+ },
887
+ children: formatUserName(account == null ? void 0 : account.data)
888
+ }
889
+ ),
890
+ renderStatus()
891
+ ]
892
+ }
893
+ )
894
+ ]
895
+ }
896
+ )
897
+ }
898
+ ),
899
+ /* @__PURE__ */ jsx(
900
+ DisclosurePanel,
901
+ {
902
+ ...{
903
+ static: true
904
+ },
905
+ children: /* @__PURE__ */ jsx(
906
+ Reveal,
907
+ {
908
+ ...{
909
+ className: "pt-4",
910
+ shown: open
911
+ },
912
+ children: items.map((item, key) => /* @__PURE__ */ jsx(
913
+ MenuItem,
802
914
  {
803
915
  ...{
804
- className: "w-full flex flex-col text-left leading-none space-y-[3px]"
805
- },
806
- children: [
807
- /* @__PURE__ */ jsx(
808
- "span",
809
- {
810
- ...{
811
- className: "block text-white"
812
- },
813
- children: formatUserName(account == null ? void 0 : account.data)
814
- }
815
- ),
816
- renderStatus()
817
- ]
818
- }
819
- )
820
- ]
821
- }
822
- )
823
- }
824
- ),
825
- /* @__PURE__ */ jsx(DisclosurePanel, { children: items.map((item, key) => /* @__PURE__ */ jsx(
826
- MenuItem,
827
- {
828
- ...{
829
- ...item,
830
- onClick: item.onClick || onClick
916
+ ...item,
917
+ onClick: item.onClick || onClick
918
+ }
919
+ },
920
+ key
921
+ ))
922
+ }
923
+ )
831
924
  }
832
- },
833
- key
834
- )) })
835
- ] })
925
+ )
926
+ ] });
927
+ } })
836
928
  }
837
929
  )
838
930
  ] });
@@ -34,10 +34,12 @@ module.exports = __toCommonJS(modal_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_react = require("react");
36
36
  var import_react2 = require("@headlessui/react");
37
+ var import_motion = require("../shared/lib/motion");
37
38
  var import_times = __toESM(require("../icons/times"));
38
39
  var import_button = __toESM(require("../shared/button"));
39
40
  var import_form = require("../shared/lib/form");
40
41
  var import_overlay = __toESM(require("../shared/overlay"));
42
+ var import_escape = require("./lib/escape");
41
43
  var import_hooks = require("./lib/hooks");
42
44
  let open = 0;
43
45
  const Modal = ({
@@ -57,6 +59,8 @@ const Modal = ({
57
59
  queryClient
58
60
  });
59
61
  const close = onClose || modal.close;
62
+ const button = (0, import_react.useRef)(null);
63
+ (0, import_escape.useEscape)(active, button);
60
64
  const classes = {
61
65
  body: [
62
66
  "relative w-full max-w-md overflow-hidden rounded-2xl bg-white text-left align-middle shadow-xl"
@@ -69,10 +73,11 @@ const Modal = ({
69
73
  // the dialog transformed during that window — an interrupted reopen
70
74
  // stuck mid-scale, and anchored children measured against the
71
75
  // transformed box (the select-width bug). Leave stays immediate;
72
- // the overlay lingers 300ms so the dialog animates out first.
73
- "transition duration-200 ease-in",
76
+ // the overlay lingers 100ms so the dialog animates out first.
77
+ import_motion.motion,
74
78
  "data-[closed]:opacity-0",
75
- "data-[closed]:scale-95"
79
+ "data-[closed]:scale-95",
80
+ "data-[closed]:translate-y-2"
76
81
  ],
77
82
  inner: [
78
83
  "flex min-h-full items-center justify-center"
@@ -158,6 +163,7 @@ const Modal = ({
158
163
  // form inside the modal has unsaved edits.
159
164
  ...!onClose && { "data-guard": "modal" },
160
165
  onClick: () => close(),
166
+ ref: button,
161
167
  variant: "link"
162
168
  }
163
169
  }
@@ -1,11 +1,13 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Fragment, useEffect } from "react";
3
+ import { Fragment, useEffect, useRef } from "react";
4
4
  import { Transition } from "@headlessui/react";
5
+ import { motion } from "../shared/lib/motion.mjs";
5
6
  import Times from "../icons/times.mjs";
6
7
  import Button from "../shared/button.mjs";
7
8
  import { FormScope } from "../shared/lib/form.mjs";
8
9
  import Overlay from "../shared/overlay.mjs";
10
+ import { useEscape } from "./lib/escape.mjs";
9
11
  import { useModal } from "./lib/hooks.mjs";
10
12
  let open = 0;
11
13
  const Modal = ({
@@ -25,6 +27,8 @@ const Modal = ({
25
27
  queryClient
26
28
  });
27
29
  const close = onClose || modal.close;
30
+ const button = useRef(null);
31
+ useEscape(active, button);
28
32
  const classes = {
29
33
  body: [
30
34
  "relative w-full max-w-md overflow-hidden rounded-2xl bg-white text-left align-middle shadow-xl"
@@ -37,10 +41,11 @@ const Modal = ({
37
41
  // the dialog transformed during that window — an interrupted reopen
38
42
  // stuck mid-scale, and anchored children measured against the
39
43
  // transformed box (the select-width bug). Leave stays immediate;
40
- // the overlay lingers 300ms so the dialog animates out first.
41
- "transition duration-200 ease-in",
44
+ // the overlay lingers 100ms so the dialog animates out first.
45
+ motion,
42
46
  "data-[closed]:opacity-0",
43
- "data-[closed]:scale-95"
47
+ "data-[closed]:scale-95",
48
+ "data-[closed]:translate-y-2"
44
49
  ],
45
50
  inner: [
46
51
  "flex min-h-full items-center justify-center"
@@ -126,6 +131,7 @@ const Modal = ({
126
131
  // form inside the modal has unsaved edits.
127
132
  ...!onClose && { "data-guard": "modal" },
128
133
  onClick: () => close(),
134
+ ref: button,
129
135
  variant: "link"
130
136
  }
131
137
  }
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(notice_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_react = require("react");
36
36
  var import_react2 = require("@headlessui/react");
37
+ var import_motion = require("../shared/lib/motion");
37
38
  var import_times = __toESM(require("../icons/times"));
38
39
  var import_link = __toESM(require("./link"));
39
40
  var import_button = __toESM(require("../shared/button"));
@@ -66,10 +67,11 @@ const Notice = ({
66
67
  );
67
68
  const classes = {
68
69
  container: [
69
- "z-50 fixed right-0 bottom-0 w-full p-6 bg-white border-t",
70
+ "z-50 fixed right-0 md:right-12 bottom-0 w-full p-6 bg-white border-t",
70
71
  "md:border-t-0 md:w-auto md:p-0 md:m-6 md:bg-transparent",
71
- "transition duration-200 ease-in",
72
- "data-[closed]:translate-y-full"
72
+ import_motion.motion,
73
+ "data-[closed]:translate-y-full",
74
+ "data-[closed]:opacity-0"
73
75
  ],
74
76
  inner: [
75
77
  "flex items-center justify-between space-x-4 p-4 rounded md:p-6",
@@ -2,6 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect } from "react";
4
4
  import { Transition } from "@headlessui/react";
5
+ import { motion } from "../shared/lib/motion.mjs";
5
6
  import Times from "../icons/times.mjs";
6
7
  import Link from "./link.mjs";
7
8
  import Button from "../shared/button.mjs";
@@ -34,10 +35,11 @@ const Notice = ({
34
35
  );
35
36
  const classes = {
36
37
  container: [
37
- "z-50 fixed right-0 bottom-0 w-full p-6 bg-white border-t",
38
+ "z-50 fixed right-0 md:right-12 bottom-0 w-full p-6 bg-white border-t",
38
39
  "md:border-t-0 md:w-auto md:p-0 md:m-6 md:bg-transparent",
39
- "transition duration-200 ease-in",
40
- "data-[closed]:translate-y-full"
40
+ motion,
41
+ "data-[closed]:translate-y-full",
42
+ "data-[closed]:opacity-0"
41
43
  ],
42
44
  inner: [
43
45
  "flex items-center justify-between space-x-4 p-4 rounded md:p-6",
@@ -160,6 +160,8 @@ const TableCellTitle = (props) => {
160
160
  import_badge.default,
161
161
  {
162
162
  ...{
163
+ // The title gives way when the column does; the badge keeps its width.
164
+ className: "shrink-0",
163
165
  size: "small",
164
166
  type: badge.type
165
167
  },
@@ -127,6 +127,8 @@ const TableCellTitle = (props) => {
127
127
  Badge,
128
128
  {
129
129
  ...{
130
+ // The title gives way when the column does; the badge keeps its width.
131
+ className: "shrink-0",
130
132
  size: "small",
131
133
  type: badge.type
132
134
  },
@@ -63,6 +63,7 @@ var import_form_action = __toESM(require("./form-action"));
63
63
  var import_warning = __toESM(require("../icons/warning"));
64
64
  var import_tooltip = __toESM(require("../shared/tooltip"));
65
65
  var import_wrapper_gradient = require("../wrapper-gradient");
66
+ const CELL_PADDING = "px-4 @max-[1279px]:px-1.5";
66
67
  const STICKY_ACTIONS_FADE_BASE = "before:content-[''] before:absolute before:right-full before:top-0 before:bottom-0 before:w-8 before:bg-gradient-to-l before:from-30% before:to-transparent before:pointer-events-none";
67
68
  const STICKY_ACTIONS_FADE_BODY = STICKY_ACTIONS_FADE_BASE + " before:from-white";
68
69
  const STICKY_ACTIONS_FADE_HEADER = STICKY_ACTIONS_FADE_BASE + " before:from-gray-light";
@@ -126,7 +127,7 @@ const TableContainer = ({
126
127
  );
127
128
  };
128
129
  const TableHeader = ({
129
- classNameHeader = "px-4",
130
+ classNameHeader = CELL_PADDING,
130
131
  classNameRow,
131
132
  headers,
132
133
  headerGroups
@@ -266,7 +267,7 @@ const TableCell = ({
266
267
  // alignment (e.g. text-right) pass their own full className — the
267
268
  // default is replaced rather than merged, so there's no source-order
268
269
  // collision on `text-align`.
269
- className = "px-4 text-left",
270
+ className = CELL_PADDING + " text-left",
270
271
  truncate = true,
271
272
  ...rest
272
273
  }) => {
@@ -284,6 +285,28 @@ const TableCell = ({
284
285
  }
285
286
  );
286
287
  };
288
+ const TableCellShrink = ({
289
+ children,
290
+ first,
291
+ truncate
292
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
293
+ "div",
294
+ {
295
+ ...{
296
+ className: "grid grid-cols-[minmax(0,max-content)] " + (first ? "min-w-30" : "min-w-16")
297
+ },
298
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
299
+ "div",
300
+ {
301
+ ...{
302
+ // A table that wraps its text ( truncate false ) wraps here too.
303
+ className: truncate ? "min-w-0 truncate" : "min-w-0"
304
+ },
305
+ children
306
+ }
307
+ )
308
+ }
309
+ );
287
310
  const TableBody = ({
288
311
  children
289
312
  }) => {
@@ -391,19 +414,25 @@ const TableActionsCell = ({
391
414
  children: buttonConfig.text
392
415
  }
393
416
  );
394
- if (buttonConfig.tooltip) {
395
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
396
- import_tooltip.default,
397
- {
398
- ...{
399
- content: buttonConfig.tooltip
400
- },
401
- children: buttonEl
402
- }
403
- );
404
- }
405
- ;
406
- return buttonEl;
417
+ const shown = buttonConfig.tooltip ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
418
+ import_tooltip.default,
419
+ {
420
+ ...{
421
+ content: buttonConfig.tooltip
422
+ },
423
+ children: buttonEl
424
+ }
425
+ ) : buttonEl;
426
+ if (controls.length > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
427
+ "div",
428
+ {
429
+ ...{
430
+ className: "flex justify-end min-w-24"
431
+ },
432
+ children: shown
433
+ }
434
+ );
435
+ return shown;
407
436
  })()
408
437
  ]
409
438
  }
@@ -664,6 +693,9 @@ const TableRowProcessing = ({
664
693
  );
665
694
  };
666
695
  const Table = ({
696
+ // false: the actions scroll with the row. For a list too wide for any laptop,
697
+ // whose last columns would otherwise sit under them.
698
+ fixedActions = true,
667
699
  actions,
668
700
  className,
669
701
  classNameColumn,
@@ -695,7 +727,7 @@ const Table = ({
695
727
  header: "",
696
728
  enableSorting: false,
697
729
  meta: {
698
- className: "sticky right-0 z-10",
730
+ className: fixedActions ? "sticky right-0 z-10" : "z-10",
699
731
  classNameHeader: "bg-gray-light",
700
732
  classNameCell: "bg-white"
701
733
  },
@@ -710,7 +742,7 @@ const Table = ({
710
742
  }
711
743
  ];
712
744
  },
713
- [actions, columns]
745
+ [actions, columns, fixedActions]
714
746
  );
715
747
  const table = (0, import_react_table.useReactTable)({
716
748
  columns: tableColumns,
@@ -751,9 +783,18 @@ const Table = ({
751
783
  row.id
752
784
  );
753
785
  }
754
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { className: classNameRow, children: row.getVisibleCells().map((cell) => {
755
- var _a2, _b;
756
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { truncate, className: [(_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.className, (_b = cell.column.columnDef.meta) == null ? void 0 : _b.classNameCell, classNameColumn].filter(Boolean).join(" ") || void 0, children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
786
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { className: classNameRow, children: row.getVisibleCells().map((cell, index) => {
787
+ var _a2, _b, _c;
788
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { truncate, className: [(_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.className, (_b = cell.column.columnDef.meta) == null ? void 0 : _b.classNameCell, classNameColumn].filter(Boolean).join(" ") || void 0, children: index === 0 || ((_c = cell.column.columnDef.meta) == null ? void 0 : _c.shrink) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
789
+ TableCellShrink,
790
+ {
791
+ ...{
792
+ first: index === 0,
793
+ truncate
794
+ },
795
+ children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
796
+ }
797
+ ) : (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
757
798
  }) }, row.id);
758
799
  }) })
759
800
  ] });