@panneau/lists 4.1.1 → 5.0.0-alpha.1

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 (138) hide show
  1. package/README.md +116 -0
  2. package/dist/List.d.ts +26 -0
  3. package/dist/List.d.ts.map +1 -0
  4. package/dist/List.js +38 -0
  5. package/dist/List.js.map +1 -0
  6. package/dist/ListView.css +101 -0
  7. package/dist/ListView.d.ts +76 -0
  8. package/dist/ListView.d.ts.map +1 -0
  9. package/dist/ListView.js +325 -0
  10. package/dist/ListView.js.map +1 -0
  11. package/dist/ListView.module.js +28 -0
  12. package/dist/ListView.module.js.map +1 -0
  13. package/dist/actions/ActionButton.d.ts +18 -0
  14. package/dist/actions/ActionButton.d.ts.map +1 -0
  15. package/dist/actions/ActionButton.js +34 -0
  16. package/dist/actions/ActionButton.js.map +1 -0
  17. package/dist/actions/Actions.css +58 -0
  18. package/dist/actions/Actions.module.js +20 -0
  19. package/dist/actions/Actions.module.js.map +1 -0
  20. package/dist/actions/ConfirmDialog.d.ts +15 -0
  21. package/dist/actions/ConfirmDialog.d.ts.map +1 -0
  22. package/dist/actions/ConfirmDialog.js +157 -0
  23. package/dist/actions/ConfirmDialog.js.map +1 -0
  24. package/dist/actions/RowActions.d.ts +20 -0
  25. package/dist/actions/RowActions.d.ts.map +1 -0
  26. package/dist/actions/RowActions.js +99 -0
  27. package/dist/actions/RowActions.js.map +1 -0
  28. package/dist/actions/actions.d.ts +23 -0
  29. package/dist/actions/actions.d.ts.map +1 -0
  30. package/dist/actions/actions.js +56 -0
  31. package/dist/actions/actions.js.map +1 -0
  32. package/dist/actions/icons.d.ts +10 -0
  33. package/dist/actions/icons.d.ts.map +1 -0
  34. package/dist/actions/icons.js +27 -0
  35. package/dist/actions/icons.js.map +1 -0
  36. package/dist/cx.d.ts +3 -0
  37. package/dist/cx.d.ts.map +1 -0
  38. package/dist/cx.js +9 -0
  39. package/dist/cx.js.map +1 -0
  40. package/dist/displays/Displays.css +71 -0
  41. package/dist/displays/Displays.module.js +30 -0
  42. package/dist/displays/Displays.module.js.map +1 -0
  43. package/dist/displays/displays.d.ts +36 -0
  44. package/dist/displays/displays.d.ts.map +1 -0
  45. package/dist/displays/displays.js +570 -0
  46. package/dist/displays/displays.js.map +1 -0
  47. package/dist/filters/Filters.css +71 -0
  48. package/dist/filters/Filters.d.ts +38 -0
  49. package/dist/filters/Filters.d.ts.map +1 -0
  50. package/dist/filters/Filters.js +240 -0
  51. package/dist/filters/Filters.js.map +1 -0
  52. package/dist/filters/Filters.module.js +24 -0
  53. package/dist/filters/Filters.module.js.map +1 -0
  54. package/dist/filters/controls.d.ts +23 -0
  55. package/dist/filters/controls.d.ts.map +1 -0
  56. package/dist/filters/controls.js +431 -0
  57. package/dist/filters/controls.js.map +1 -0
  58. package/dist/filters/format.d.ts +16 -0
  59. package/dist/filters/format.d.ts.map +1 -0
  60. package/dist/filters/format.js +46 -0
  61. package/dist/filters/format.js.map +1 -0
  62. package/dist/index.d.ts +19 -10
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +18 -66
  65. package/dist/layouts/CardsLayout.css +72 -0
  66. package/dist/layouts/CardsLayout.d.ts +4 -0
  67. package/dist/layouts/CardsLayout.d.ts.map +1 -0
  68. package/dist/layouts/CardsLayout.js +111 -0
  69. package/dist/layouts/CardsLayout.js.map +1 -0
  70. package/dist/layouts/CardsLayout.module.js +24 -0
  71. package/dist/layouts/CardsLayout.module.js.map +1 -0
  72. package/dist/layouts/ItemTitle.d.ts +10 -0
  73. package/dist/layouts/ItemTitle.d.ts.map +1 -0
  74. package/dist/layouts/ItemTitle.js +30 -0
  75. package/dist/layouts/ItemTitle.js.map +1 -0
  76. package/dist/layouts/TableLayout.css +177 -0
  77. package/dist/layouts/TableLayout.d.ts +9 -0
  78. package/dist/layouts/TableLayout.d.ts.map +1 -0
  79. package/dist/layouts/TableLayout.js +208 -0
  80. package/dist/layouts/TableLayout.js.map +1 -0
  81. package/dist/layouts/TableLayout.module.js +32 -0
  82. package/dist/layouts/TableLayout.module.js.map +1 -0
  83. package/dist/layouts/builtIn.d.ts +6 -0
  84. package/dist/layouts/builtIn.d.ts.map +1 -0
  85. package/dist/layouts/builtIn.js +12 -0
  86. package/dist/layouts/builtIn.js.map +1 -0
  87. package/dist/layouts/link.css +16 -0
  88. package/dist/layouts/link.module.js +8 -0
  89. package/dist/layouts/link.module.js.map +1 -0
  90. package/dist/messages.d.ts +2 -0
  91. package/dist/messages.d.ts.map +1 -0
  92. package/dist/messages.js +1 -0
  93. package/dist/plugin.d.ts +13 -0
  94. package/dist/plugin.d.ts.map +1 -0
  95. package/dist/plugin.js +19 -0
  96. package/dist/plugin.js.map +1 -0
  97. package/dist/query.d.ts +21 -0
  98. package/dist/query.d.ts.map +1 -0
  99. package/dist/query.js +70 -0
  100. package/dist/query.js.map +1 -0
  101. package/dist/selection.d.ts +9 -0
  102. package/dist/selection.d.ts.map +1 -0
  103. package/dist/selection.js +19 -0
  104. package/dist/selection.js.map +1 -0
  105. package/dist/toolbar/LayoutSwitch.d.ts +8 -0
  106. package/dist/toolbar/LayoutSwitch.d.ts.map +1 -0
  107. package/dist/toolbar/LayoutSwitch.js +108 -0
  108. package/dist/toolbar/LayoutSwitch.js.map +1 -0
  109. package/dist/toolbar/Pagination.d.ts +13 -0
  110. package/dist/toolbar/Pagination.d.ts.map +1 -0
  111. package/dist/toolbar/Pagination.js +62 -0
  112. package/dist/toolbar/Pagination.js.map +1 -0
  113. package/dist/toolbar/SearchField.d.ts +9 -0
  114. package/dist/toolbar/SearchField.d.ts.map +1 -0
  115. package/dist/toolbar/SearchField.js +64 -0
  116. package/dist/toolbar/SearchField.js.map +1 -0
  117. package/dist/toolbar/SortSelect.d.ts +9 -0
  118. package/dist/toolbar/SortSelect.d.ts.map +1 -0
  119. package/dist/toolbar/SortSelect.js +90 -0
  120. package/dist/toolbar/SortSelect.js.map +1 -0
  121. package/dist/toolbar/Toolbar.css +72 -0
  122. package/dist/toolbar/Toolbar.module.js +22 -0
  123. package/dist/toolbar/Toolbar.module.js.map +1 -0
  124. package/dist/types.d.ts +106 -0
  125. package/dist/types.d.ts.map +1 -0
  126. package/dist/useDraft.d.ts +11 -0
  127. package/dist/useDraft.d.ts.map +1 -0
  128. package/dist/useDraft.js +77 -0
  129. package/dist/useDraft.js.map +1 -0
  130. package/dist/useListState.d.ts +4 -0
  131. package/dist/useListState.d.ts.map +1 -0
  132. package/dist/useListState.js +10 -0
  133. package/dist/useListState.js.map +1 -0
  134. package/dist/values.d.ts +21 -0
  135. package/dist/values.d.ts.map +1 -0
  136. package/dist/values.js +52 -0
  137. package/dist/values.js.map +1 -0
  138. package/package.json +27 -57
@@ -0,0 +1,72 @@
1
+ .panneau-cards-Z7Eoyl {
2
+ display: grid;
3
+ grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
4
+ gap: var(--panneau-space-3);
5
+ margin: 0;
6
+ padding: 0;
7
+ list-style: none;
8
+ }
9
+
10
+ .panneau-card-3yuJKc {
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: var(--panneau-space-2);
14
+ padding: var(--panneau-space-3);
15
+ background-color: var(--panneau-color-surface);
16
+ border: var(--panneau-border-width) solid var(--panneau-color-border);
17
+ border-radius: var(--panneau-radius-lg);
18
+ }
19
+
20
+ .panneau-card-3yuJKc[data-selected] {
21
+ background-color: var(--panneau-color-accent-subtle);
22
+ border-color: var(--panneau-color-border-control);
23
+ }
24
+
25
+ .panneau-header-8nkYnu {
26
+ display: flex;
27
+ align-items: flex-start;
28
+ gap: var(--panneau-space-2);
29
+ }
30
+
31
+ .panneau-title-D4GR87 {
32
+ flex: 1;
33
+ min-width: 0;
34
+ margin: 0;
35
+ font-size: var(--panneau-font-size-lg);
36
+ font-weight: var(--panneau-font-weight-medium);
37
+ line-height: var(--panneau-line-height-tight);
38
+ }
39
+
40
+ .panneau-values-JmHWF4 {
41
+ display: grid;
42
+ gap: var(--panneau-space-1);
43
+ margin: 0;
44
+ font-size: var(--panneau-font-size-md);
45
+ }
46
+
47
+ .panneau-value--4Hmov {
48
+ display: grid;
49
+ grid-template-columns: minmax(5rem, 40%) 1fr;
50
+ gap: var(--panneau-space-2);
51
+ }
52
+
53
+ .panneau-value--4Hmov dt {
54
+ color: var(--panneau-color-text-muted);
55
+ }
56
+
57
+ .panneau-value--4Hmov dd {
58
+ margin: 0;
59
+ min-width: 0;
60
+ }
61
+
62
+ .panneau-actions-gw5-oU {
63
+ display: flex;
64
+ flex-wrap: wrap;
65
+ gap: var(--panneau-space-1);
66
+ margin-top: auto;
67
+ padding-top: var(--panneau-space-1);
68
+ }
69
+
70
+ .panneau-pageSelection-r1GtpS {
71
+ margin-bottom: var(--panneau-space-2);
72
+ }
@@ -0,0 +1,4 @@
1
+ import type { ListLayoutProps } from '../types';
2
+ /** Items as cards: the first column is the title, the others are listed under it. */
3
+ export declare function CardsLayout({ items, columns, renderValue, getItemLabel, getItemHref, selectable, isSelected, onToggle, renderActions, label, pageSelection, }: ListLayoutProps): import("react").JSX.Element;
4
+ //# sourceMappingURL=CardsLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardsLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/CardsLayout.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,aAAa,EACb,KAAK,EACL,aAAa,GAChB,EAAE,eAAe,+BAqDjB"}
@@ -0,0 +1,111 @@
1
+ import { messages } from "../messages.js";
2
+ import CardsLayout_module_default from "./CardsLayout.module.js";
3
+ import { ItemTitle } from "./ItemTitle.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Checkbox, usePanneauIntl } from "@panneau/ui";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/layouts/CardsLayout.tsx
8
+ /** Items as cards: the first column is the title, the others are listed under it. */
9
+ function CardsLayout(t0) {
10
+ const $ = c(26);
11
+ const { items, columns, renderValue, getItemLabel, getItemHref, selectable, isSelected, onToggle, renderActions, label, pageSelection } = t0;
12
+ const intl = usePanneauIntl();
13
+ let t1;
14
+ let t2;
15
+ let t3;
16
+ let t4;
17
+ if ($[0] !== columns || $[1] !== getItemHref || $[2] !== getItemLabel || $[3] !== intl || $[4] !== isSelected || $[5] !== items || $[6] !== label || $[7] !== onToggle || $[8] !== pageSelection || $[9] !== renderActions || $[10] !== renderValue || $[11] !== selectable) {
18
+ const [title, ...others] = columns;
19
+ if ($[16] !== pageSelection || $[17] !== selectable) {
20
+ t4 = selectable ? /* @__PURE__ */ jsx("div", {
21
+ className: CardsLayout_module_default.pageSelection,
22
+ children: pageSelection
23
+ }) : null;
24
+ $[16] = pageSelection;
25
+ $[17] = selectable;
26
+ $[18] = t4;
27
+ } else t4 = $[18];
28
+ t1 = CardsLayout_module_default.cards;
29
+ t2 = label;
30
+ t3 = items.map((item) => {
31
+ const selected = selectable && isSelected(item);
32
+ const actions = renderActions(item);
33
+ return /* @__PURE__ */ jsxs("li", {
34
+ className: CardsLayout_module_default.card,
35
+ "data-selected": selected || void 0,
36
+ children: [
37
+ /* @__PURE__ */ jsxs("div", {
38
+ className: CardsLayout_module_default.header,
39
+ children: [/* @__PURE__ */ jsx("div", {
40
+ className: CardsLayout_module_default.title,
41
+ children: /* @__PURE__ */ jsx(ItemTitle, {
42
+ href: getItemHref?.(item) ?? null,
43
+ children: title !== void 0 ? renderValue(item, title) : getItemLabel(item)
44
+ })
45
+ }), selectable ? /* @__PURE__ */ jsx(Checkbox, {
46
+ "aria-label": intl.formatMessage(messages.selectItem, { item: getItemLabel(item) }),
47
+ isSelected: selected,
48
+ onChange: () => onToggle(item)
49
+ }) : null]
50
+ }),
51
+ others.length > 0 ? /* @__PURE__ */ jsx("dl", {
52
+ className: CardsLayout_module_default.values,
53
+ children: others.map((column) => /* @__PURE__ */ jsxs("div", {
54
+ className: CardsLayout_module_default.value,
55
+ children: [/* @__PURE__ */ jsx("dt", { children: column.label ?? column.id }), /* @__PURE__ */ jsx("dd", { children: renderValue(item, column) })]
56
+ }, column.id))
57
+ }) : null,
58
+ actions !== null ? /* @__PURE__ */ jsx("div", {
59
+ className: CardsLayout_module_default.actions,
60
+ children: actions
61
+ }) : null
62
+ ]
63
+ }, item.id);
64
+ });
65
+ $[0] = columns;
66
+ $[1] = getItemHref;
67
+ $[2] = getItemLabel;
68
+ $[3] = intl;
69
+ $[4] = isSelected;
70
+ $[5] = items;
71
+ $[6] = label;
72
+ $[7] = onToggle;
73
+ $[8] = pageSelection;
74
+ $[9] = renderActions;
75
+ $[10] = renderValue;
76
+ $[11] = selectable;
77
+ $[12] = t1;
78
+ $[13] = t2;
79
+ $[14] = t3;
80
+ $[15] = t4;
81
+ } else {
82
+ t1 = $[12];
83
+ t2 = $[13];
84
+ t3 = $[14];
85
+ t4 = $[15];
86
+ }
87
+ let t5;
88
+ if ($[19] !== t1 || $[20] !== t2 || $[21] !== t3) {
89
+ t5 = /* @__PURE__ */ jsx("ul", {
90
+ className: t1,
91
+ "aria-label": t2,
92
+ children: t3
93
+ });
94
+ $[19] = t1;
95
+ $[20] = t2;
96
+ $[21] = t3;
97
+ $[22] = t5;
98
+ } else t5 = $[22];
99
+ let t6;
100
+ if ($[23] !== t4 || $[24] !== t5) {
101
+ t6 = /* @__PURE__ */ jsxs("div", { children: [t4, t5] });
102
+ $[23] = t4;
103
+ $[24] = t5;
104
+ $[25] = t6;
105
+ } else t6 = $[25];
106
+ return t6;
107
+ }
108
+ //#endregion
109
+ export { CardsLayout };
110
+
111
+ //# sourceMappingURL=CardsLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardsLayout.js","names":["pageSelection","label","selected","actions","_c","styles"],"sources":["../../src/layouts/CardsLayout.tsx"],"sourcesContent":["import { Checkbox, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListLayoutProps } from '../types';\nimport styles from './CardsLayout.module.css';\nimport { ItemTitle } from './ItemTitle';\n\n/** Items as cards: the first column is the title, the others are listed under it. */\nexport function CardsLayout({\n items,\n columns,\n renderValue,\n getItemLabel,\n getItemHref,\n selectable,\n isSelected,\n onToggle,\n renderActions,\n label,\n pageSelection,\n}: ListLayoutProps) {\n const intl = usePanneauIntl();\n const [title, ...others] = columns;\n return (\n <div>\n {selectable ? <div className={styles.pageSelection}>{pageSelection}</div> : null}\n <ul className={styles.cards} aria-label={label}>\n {items.map((item) => {\n const selected = selectable && isSelected(item);\n const actions = renderActions(item);\n return (\n <li\n key={item.id}\n className={styles.card}\n data-selected={selected || undefined}\n >\n <div className={styles.header}>\n <div className={styles.title}>\n <ItemTitle href={getItemHref?.(item) ?? null}>\n {title !== undefined\n ? renderValue(item, title)\n : getItemLabel(item)}\n </ItemTitle>\n </div>\n {selectable ? (\n <Checkbox\n aria-label={intl.formatMessage(messages.selectItem, {\n item: getItemLabel(item),\n })}\n isSelected={selected}\n onChange={() => onToggle(item)}\n />\n ) : null}\n </div>\n {others.length > 0 ? (\n <dl className={styles.values}>\n {others.map((column) => (\n <div key={column.id} className={styles.value}>\n <dt>{column.label ?? column.id}</dt>\n <dd>{renderValue(item, column)}</dd>\n </div>\n ))}\n </dl>\n ) : null}\n {actions !== null ? (\n <div className={styles.actions}>{actions}</div>\n ) : null}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAQA,SAAO,YAAA,IAAA;CAAA,MAAA,IAAAI,EAAA,EAAA;CAAqB,MAAA,EAAA,OAAA,SAAA,aAAA,cAAA,aAAA,YAAA,YAAA,UAAA,eAAA,OAAA,kBAAA;CAaxB,MAAA,OAAa,eAAe;CAAE,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,WAAA,EAAA,OAAA,e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var card = "panneau-card-3yuJKc";
5
+ var header = "panneau-header-8nkYnu";
6
+ var title = "panneau-title-D4GR87";
7
+ var values = "panneau-values-JmHWF4";
8
+ var value = "panneau-value--4Hmov";
9
+ var actions = "panneau-actions-gw5-oU";
10
+ var pageSelection = "panneau-pageSelection-r1GtpS";
11
+ var CardsLayout_module_default = {
12
+ cards,
13
+ card,
14
+ header,
15
+ title,
16
+ values,
17
+ value,
18
+ actions,
19
+ pageSelection
20
+ };
21
+ //#endregion
22
+ export { actions, card, cards, CardsLayout_module_default as default, header, pageSelection, title, value, values };
23
+
24
+ //# sourceMappingURL=CardsLayout.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardsLayout.module.js","names":[],"sources":["../../src/layouts/CardsLayout.module.css"],"sourcesContent":[".cards {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));\n gap: var(--panneau-space-3);\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.card {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-2);\n padding: var(--panneau-space-3);\n background-color: var(--panneau-color-surface);\n border: var(--panneau-border-width) solid var(--panneau-color-border);\n border-radius: var(--panneau-radius-lg);\n}\n\n.card[data-selected] {\n background-color: var(--panneau-color-accent-subtle);\n border-color: var(--panneau-color-border-control);\n}\n\n.header {\n display: flex;\n align-items: flex-start;\n gap: var(--panneau-space-2);\n}\n\n.title {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: var(--panneau-font-size-lg);\n font-weight: var(--panneau-font-weight-medium);\n line-height: var(--panneau-line-height-tight);\n}\n\n.values {\n display: grid;\n gap: var(--panneau-space-1);\n margin: 0;\n font-size: var(--panneau-font-size-md);\n}\n\n.value {\n display: grid;\n grid-template-columns: minmax(5rem, 40%) 1fr;\n gap: var(--panneau-space-2);\n}\n\n.value dt {\n color: var(--panneau-color-text-muted);\n}\n\n.value dd {\n margin: 0;\n min-width: 0;\n}\n\n.actions {\n display: flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n margin-top: auto;\n padding-top: var(--panneau-space-1);\n}\n\n.pageSelection {\n margin-bottom: var(--panneau-space-2);\n}\n"],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * The title of an item, as a link to it when the list has one. Links go through React Aria, so an
4
+ * app's `RouterProvider` handles them with its router.
5
+ */
6
+ export declare function ItemTitle({ href, children }: {
7
+ href: string | null;
8
+ children: ReactNode;
9
+ }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
10
+ //# sourceMappingURL=ItemTitle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemTitle.d.ts","sourceRoot":"","sources":["../../src/layouts/ItemTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+TASzF"}
@@ -0,0 +1,30 @@
1
+ import link_module_default from "./link.module.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Link } from "react-aria-components";
5
+ //#region src/layouts/ItemTitle.tsx
6
+ /**
7
+ * The title of an item, as a link to it when the list has one. Links go through React Aria, so an
8
+ * app's `RouterProvider` handles them with its router.
9
+ */
10
+ function ItemTitle(t0) {
11
+ const $ = c(3);
12
+ const { href, children } = t0;
13
+ if (href === null) return children;
14
+ let t1;
15
+ if ($[0] !== children || $[1] !== href) {
16
+ t1 = /* @__PURE__ */ jsx(Link, {
17
+ className: link_module_default.link,
18
+ href,
19
+ children
20
+ });
21
+ $[0] = children;
22
+ $[1] = href;
23
+ $[2] = t1;
24
+ } else t1 = $[2];
25
+ return t1;
26
+ }
27
+ //#endregion
28
+ export { ItemTitle };
29
+
30
+ //# sourceMappingURL=ItemTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemTitle.js","names":["href","children","_c","styles"],"sources":["../../src/layouts/ItemTitle.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Link } from 'react-aria-components';\n\nimport styles from './link.module.css';\n\n/**\n * The title of an item, as a link to it when the list has one. Links go through React Aria, so an\n * app's `RouterProvider` handles them with its router.\n */\nexport function ItemTitle({ href, children }: { href: string | null; children: ReactNode }) {\n if (href === null) {\n return children;\n }\n return (\n <Link className={styles.link} href={href}>\n {children}\n </Link>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAO,UAAA,IAAA;CAAA,MAAA,IAAAE,EAAA,CAAA;CAAmB,MAAA,EAAA,MAAA,aAAA;CACtB,IAAI,SAAS,MAAI,OACN;CACV,IAAA;CAAA,IAAA,EAAA,OAAA,YAAA,EAAA,OAAA,MAAA;EAEG,KAAA,oBAAC,MAAD;GAAiB,WAAAC,oBAAM;GAAa;GAC/B;EADA,CAAA;EAEE,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAFP;AAEO"}
@@ -0,0 +1,177 @@
1
+ .panneau-scroller-dntHlH {
2
+ overflow-x: auto;
3
+ border: var(--panneau-border-width) solid var(--panneau-color-border);
4
+ border-radius: var(--panneau-radius-lg);
5
+ background-color: var(--panneau-color-surface);
6
+ }
7
+
8
+ .panneau-table-adJh-G {
9
+ width: 100%;
10
+ border-collapse: collapse;
11
+ font-size: var(--panneau-font-size-md);
12
+ }
13
+
14
+ .panneau-table-adJh-G th,
15
+ .panneau-table-adJh-G td {
16
+ padding: var(--panneau-space-2) var(--panneau-space-3);
17
+ text-align: start;
18
+ vertical-align: middle;
19
+ border-bottom: var(--panneau-border-width) solid var(--panneau-color-border);
20
+ }
21
+
22
+ .panneau-table-adJh-G th {
23
+ font-size: var(--panneau-font-size-sm);
24
+ font-weight: var(--panneau-font-weight-medium);
25
+ color: var(--panneau-color-text-muted);
26
+ white-space: nowrap;
27
+ background-color: var(--panneau-color-surface-sunken);
28
+ }
29
+
30
+ .panneau-table-adJh-G tbody tr:last-child td {
31
+ border-bottom: 0;
32
+ }
33
+
34
+ .panneau-table-adJh-G tbody tr[data-selected] {
35
+ background-color: var(--panneau-color-accent-subtle);
36
+ }
37
+
38
+ .panneau-center-Fx-12L {
39
+ text-align: center !important;
40
+ }
41
+
42
+ .panneau-end-Jr3hRc {
43
+ text-align: end !important;
44
+ }
45
+
46
+ .panneau-check-E5-IqZ {
47
+ width: 1px;
48
+ }
49
+
50
+ .panneau-actionsCell-dzoCuU {
51
+ width: 1px;
52
+ text-align: end !important;
53
+ white-space: nowrap;
54
+ }
55
+
56
+ .panneau-sort-t4x1tD {
57
+ display: inline-flex;
58
+ align-items: center;
59
+ gap: var(--panneau-space-1);
60
+ margin: calc(-1 * var(--panneau-space-1)) calc(-1 * var(--panneau-space-2));
61
+ padding: var(--panneau-space-1) var(--panneau-space-2);
62
+ font: inherit;
63
+ color: inherit;
64
+ background: none;
65
+ border: 0;
66
+ border-radius: var(--panneau-radius-sm);
67
+ cursor: pointer;
68
+ }
69
+
70
+ .panneau-sort-t4x1tD:hover {
71
+ color: var(--panneau-color-text);
72
+ background-color: var(--panneau-color-hover);
73
+ }
74
+
75
+ .panneau-sort-t4x1tD:focus-visible {
76
+ outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
77
+ outline-offset: 1px;
78
+ }
79
+
80
+ .panneau-sortIcon-5pp-ve {
81
+ opacity: 0.5;
82
+ }
83
+
84
+ .panneau-sorted-a6Fwul .panneau-sortIcon-5pp-ve {
85
+ opacity: 1;
86
+ }
87
+
88
+ .panneau-cellLabel-tiliX5 {
89
+ display: none;
90
+ }
91
+
92
+ .panneau-visuallyHidden--8qvnp {
93
+ position: absolute;
94
+ width: 1px;
95
+ height: 1px;
96
+ overflow: hidden;
97
+ clip-path: inset(50%);
98
+ white-space: nowrap;
99
+ }
100
+
101
+ /* Narrow lists (phones): each row is a block, with the label of each value next to it. */
102
+ @container panneau-list (max-width: 40rem) {
103
+ .panneau-scroller-dntHlH {
104
+ overflow: visible;
105
+ background: none;
106
+ border: 0;
107
+ }
108
+
109
+ /* The labels of the cells replace the headers, and the list's sort select their buttons. */
110
+ .panneau-table-adJh-G thead {
111
+ display: none;
112
+ }
113
+
114
+ .panneau-table-adJh-G,
115
+ .panneau-table-adJh-G tbody,
116
+ .panneau-table-adJh-G tr,
117
+ .panneau-table-adJh-G td {
118
+ display: block;
119
+ }
120
+
121
+ .panneau-table-adJh-G tbody {
122
+ display: grid;
123
+ gap: var(--panneau-space-2);
124
+ }
125
+
126
+ .panneau-table-adJh-G tr {
127
+ position: relative;
128
+ padding: var(--panneau-space-2) 0;
129
+ background-color: var(--panneau-color-surface);
130
+ border: var(--panneau-border-width) solid var(--panneau-color-border);
131
+ border-radius: var(--panneau-radius-lg);
132
+ }
133
+
134
+ .panneau-table-adJh-G td {
135
+ display: grid;
136
+ grid-template-columns: minmax(5rem, 35%) 1fr;
137
+ gap: var(--panneau-space-2);
138
+ padding: var(--panneau-space-1) var(--panneau-space-3);
139
+ text-align: start !important;
140
+ border: 0;
141
+ }
142
+
143
+ .panneau-table-adJh-G td.panneau-check-E5-IqZ,
144
+ .panneau-table-adJh-G td.panneau-actionsCell-dzoCuU {
145
+ display: flex;
146
+ width: auto;
147
+ }
148
+
149
+ .panneau-table-adJh-G td.panneau-check-E5-IqZ {
150
+ position: absolute;
151
+ top: var(--panneau-space-2);
152
+ inset-inline-end: var(--panneau-space-2);
153
+ padding: 0;
154
+ }
155
+
156
+ .panneau-table-adJh-G td.panneau-actionsCell-dzoCuU {
157
+ justify-content: flex-start;
158
+ flex-wrap: wrap;
159
+ padding-top: var(--panneau-space-2);
160
+ }
161
+
162
+ .panneau-table-adJh-G td.panneau-title-KEAnyJ {
163
+ display: block;
164
+ padding-inline-end: var(--panneau-space-10);
165
+ font-weight: var(--panneau-font-weight-medium);
166
+ }
167
+
168
+ .panneau-table-adJh-G td.panneau-title-KEAnyJ .panneau-cellLabel-tiliX5 {
169
+ display: none;
170
+ }
171
+
172
+ .panneau-cellLabel-tiliX5 {
173
+ display: block;
174
+ font-size: var(--panneau-font-size-sm);
175
+ color: var(--panneau-color-text-muted);
176
+ }
177
+ }
@@ -0,0 +1,9 @@
1
+ import type { ListColumn, ListLayoutProps } from '../types';
2
+ /** The sort direction of a column, from the first `sort` value. */
3
+ export declare function getSortDirection(sort: readonly string[], column: ListColumn): 'ascending' | 'descending' | null;
4
+ /**
5
+ * Items as a table, with sortable column headers. On narrow lists (phones), each row turns into a
6
+ * block that shows the label of each value.
7
+ */
8
+ export declare function TableLayout({ items, columns, renderValue, getItemLabel, getItemHref, selectable, isSelected, onToggle, renderActions, sort, onSort, label, pageSelection, }: ListLayoutProps): import("react").JSX.Element;
9
+ //# sourceMappingURL=TableLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/TableLayout.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI5D,mEAAmE;AACnE,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,UAAU,GACnB,WAAW,GAAG,YAAY,GAAG,IAAI,CAMnC;AASD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,MAAM,EACN,KAAK,EACL,aAAa,GAChB,EAAE,eAAe,+BAiHjB"}
@@ -0,0 +1,208 @@
1
+ import { messages } from "../messages.js";
2
+ import { ItemTitle } from "./ItemTitle.js";
3
+ import { cx } from "../cx.js";
4
+ import TableLayout_module_default from "./TableLayout.module.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { Checkbox, Icon, usePanneauIntl } from "@panneau/ui";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
9
+ //#region src/layouts/TableLayout.tsx
10
+ /** The sort direction of a column, from the first `sort` value. */
11
+ function getSortDirection(sort, column) {
12
+ const first = sort[0];
13
+ if (first === column.id) return "ascending";
14
+ return first === `-${column.id}` ? "descending" : null;
15
+ }
16
+ function alignClass(column) {
17
+ if (column.align === "center") return TableLayout_module_default.center;
18
+ return column.align === "end" ? TableLayout_module_default.end : void 0;
19
+ }
20
+ /**
21
+ * Items as a table, with sortable column headers. On narrow lists (phones), each row turns into a
22
+ * block that shows the label of each value.
23
+ */
24
+ function TableLayout(t0) {
25
+ const $ = c(52);
26
+ const { items, columns, renderValue, getItemLabel, getItemHref, selectable, isSelected, onToggle, renderActions, sort, onSort, label, pageSelection } = t0;
27
+ const intl = usePanneauIntl();
28
+ let actions;
29
+ let t1;
30
+ if ($[0] !== items || $[1] !== renderActions) {
31
+ let t2;
32
+ if ($[4] !== renderActions) {
33
+ t2 = (item) => renderActions(item);
34
+ $[4] = renderActions;
35
+ $[5] = t2;
36
+ } else t2 = $[5];
37
+ actions = items.map(t2);
38
+ t1 = actions.some(_temp);
39
+ $[0] = items;
40
+ $[1] = renderActions;
41
+ $[2] = actions;
42
+ $[3] = t1;
43
+ } else {
44
+ actions = $[2];
45
+ t1 = $[3];
46
+ }
47
+ const hasActions = t1;
48
+ let t2;
49
+ if ($[6] !== pageSelection || $[7] !== selectable) {
50
+ t2 = selectable ? /* @__PURE__ */ jsx("th", {
51
+ className: TableLayout_module_default.check,
52
+ children: pageSelection
53
+ }) : null;
54
+ $[6] = pageSelection;
55
+ $[7] = selectable;
56
+ $[8] = t2;
57
+ } else t2 = $[8];
58
+ let t3;
59
+ if ($[9] !== columns || $[10] !== onSort || $[11] !== sort) {
60
+ let t4;
61
+ if ($[13] !== onSort || $[14] !== sort) {
62
+ t4 = (column) => {
63
+ const direction = getSortDirection(sort, column);
64
+ return /* @__PURE__ */ jsx("th", {
65
+ scope: "col",
66
+ className: alignClass(column),
67
+ style: column.width !== void 0 ? { width: column.width } : void 0,
68
+ "aria-sort": column.sortable === true ? direction ?? "none" : void 0,
69
+ children: column.sortable === true ? /* @__PURE__ */ jsxs("button", {
70
+ type: "button",
71
+ className: cx(TableLayout_module_default.sort, direction !== null && TableLayout_module_default.sorted),
72
+ onClick: () => onSort(column),
73
+ children: [column.label ?? column.id, /* @__PURE__ */ jsx("span", {
74
+ className: TableLayout_module_default.sortIcon,
75
+ children: /* @__PURE__ */ jsx(Icon, {
76
+ icon: direction === "ascending" ? ArrowUp : direction === "descending" ? ArrowDown : ArrowUpDown,
77
+ size: "sm"
78
+ })
79
+ })]
80
+ }) : column.label ?? column.id
81
+ }, column.id);
82
+ };
83
+ $[13] = onSort;
84
+ $[14] = sort;
85
+ $[15] = t4;
86
+ } else t4 = $[15];
87
+ t3 = columns.map(t4);
88
+ $[9] = columns;
89
+ $[10] = onSort;
90
+ $[11] = sort;
91
+ $[12] = t3;
92
+ } else t3 = $[12];
93
+ let t4;
94
+ if ($[16] !== hasActions || $[17] !== intl) {
95
+ t4 = hasActions ? /* @__PURE__ */ jsx("th", {
96
+ className: TableLayout_module_default.actionsCell,
97
+ children: /* @__PURE__ */ jsx("span", {
98
+ className: TableLayout_module_default.visuallyHidden,
99
+ children: intl.formatMessage(messages.actions)
100
+ })
101
+ }) : null;
102
+ $[16] = hasActions;
103
+ $[17] = intl;
104
+ $[18] = t4;
105
+ } else t4 = $[18];
106
+ let t5;
107
+ if ($[19] !== t2 || $[20] !== t3 || $[21] !== t4) {
108
+ t5 = /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
109
+ t2,
110
+ t3,
111
+ t4
112
+ ] }) });
113
+ $[19] = t2;
114
+ $[20] = t3;
115
+ $[21] = t4;
116
+ $[22] = t5;
117
+ } else t5 = $[22];
118
+ let t6;
119
+ if ($[23] !== actions || $[24] !== columns || $[25] !== getItemHref || $[26] !== getItemLabel || $[27] !== hasActions || $[28] !== intl || $[29] !== isSelected || $[30] !== items || $[31] !== onToggle || $[32] !== renderValue || $[33] !== selectable) {
120
+ let t7;
121
+ if ($[35] !== actions || $[36] !== columns || $[37] !== getItemHref || $[38] !== getItemLabel || $[39] !== hasActions || $[40] !== intl || $[41] !== isSelected || $[42] !== onToggle || $[43] !== renderValue || $[44] !== selectable) {
122
+ t7 = (item_0, row) => {
123
+ const selected = selectable && isSelected(item_0);
124
+ const href = getItemHref?.(item_0) ?? null;
125
+ return /* @__PURE__ */ jsxs("tr", {
126
+ "data-selected": selected || void 0,
127
+ children: [
128
+ selectable ? /* @__PURE__ */ jsx("td", {
129
+ className: TableLayout_module_default.check,
130
+ children: /* @__PURE__ */ jsx(Checkbox, {
131
+ "aria-label": intl.formatMessage(messages.selectItem, { item: getItemLabel(item_0) }),
132
+ isSelected: selected,
133
+ onChange: () => onToggle(item_0)
134
+ })
135
+ }) : null,
136
+ columns.map((column_0, index) => /* @__PURE__ */ jsxs("td", {
137
+ className: cx(alignClass(column_0), index === 0 && TableLayout_module_default.title),
138
+ children: [/* @__PURE__ */ jsx("span", {
139
+ className: TableLayout_module_default.cellLabel,
140
+ children: column_0.label ?? column_0.id
141
+ }), /* @__PURE__ */ jsx("span", { children: index === 0 ? /* @__PURE__ */ jsx(ItemTitle, {
142
+ href,
143
+ children: renderValue(item_0, column_0)
144
+ }) : renderValue(item_0, column_0) })]
145
+ }, column_0.id)),
146
+ hasActions ? /* @__PURE__ */ jsx("td", {
147
+ className: TableLayout_module_default.actionsCell,
148
+ children: actions[row]
149
+ }) : null
150
+ ]
151
+ }, item_0.id);
152
+ };
153
+ $[35] = actions;
154
+ $[36] = columns;
155
+ $[37] = getItemHref;
156
+ $[38] = getItemLabel;
157
+ $[39] = hasActions;
158
+ $[40] = intl;
159
+ $[41] = isSelected;
160
+ $[42] = onToggle;
161
+ $[43] = renderValue;
162
+ $[44] = selectable;
163
+ $[45] = t7;
164
+ } else t7 = $[45];
165
+ t6 = items.map(t7);
166
+ $[23] = actions;
167
+ $[24] = columns;
168
+ $[25] = getItemHref;
169
+ $[26] = getItemLabel;
170
+ $[27] = hasActions;
171
+ $[28] = intl;
172
+ $[29] = isSelected;
173
+ $[30] = items;
174
+ $[31] = onToggle;
175
+ $[32] = renderValue;
176
+ $[33] = selectable;
177
+ $[34] = t6;
178
+ } else t6 = $[34];
179
+ let t7;
180
+ if ($[46] !== t6) {
181
+ t7 = /* @__PURE__ */ jsx("tbody", { children: t6 });
182
+ $[46] = t6;
183
+ $[47] = t7;
184
+ } else t7 = $[47];
185
+ let t8;
186
+ if ($[48] !== label || $[49] !== t5 || $[50] !== t7) {
187
+ t8 = /* @__PURE__ */ jsx("div", {
188
+ className: TableLayout_module_default.scroller,
189
+ children: /* @__PURE__ */ jsxs("table", {
190
+ className: TableLayout_module_default.table,
191
+ "aria-label": label,
192
+ children: [t5, t7]
193
+ })
194
+ });
195
+ $[48] = label;
196
+ $[49] = t5;
197
+ $[50] = t7;
198
+ $[51] = t8;
199
+ } else t8 = $[51];
200
+ return t8;
201
+ }
202
+ function _temp(node) {
203
+ return node !== null;
204
+ }
205
+ //#endregion
206
+ export { TableLayout, getSortDirection };
207
+
208
+ //# sourceMappingURL=TableLayout.js.map