@panneau/lists 5.0.0-alpha.2 → 5.0.0-alpha.21
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/README.md +17 -15
- package/dist/ItemDetails.css +50 -0
- package/dist/ItemDetails.d.ts +27 -0
- package/dist/ItemDetails.d.ts.map +1 -0
- package/dist/ItemDetails.js +134 -0
- package/dist/ItemDetails.js.map +1 -0
- package/dist/ItemDetails.module.js +20 -0
- package/dist/ItemDetails.module.js.map +1 -0
- package/dist/List.d.ts +3 -3
- package/dist/List.d.ts.map +1 -1
- package/dist/List.js +31 -10
- package/dist/List.js.map +1 -1
- package/dist/ListSkeleton.d.ts +19 -0
- package/dist/ListSkeleton.d.ts.map +1 -0
- package/dist/ListSkeleton.js +115 -0
- package/dist/ListSkeleton.js.map +1 -0
- package/dist/ListView.d.ts +73 -8
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +616 -218
- package/dist/ListView.js.map +1 -1
- package/dist/actions/ActionButton.d.ts +8 -2
- package/dist/actions/ActionButton.d.ts.map +1 -1
- package/dist/actions/ActionButton.js +98 -26
- package/dist/actions/ActionButton.js.map +1 -1
- package/dist/actions/Actions.css +16 -38
- package/dist/actions/Actions.module.js +6 -6
- package/dist/actions/Actions.module.js.map +1 -1
- package/dist/actions/ConfirmDialog.d.ts +20 -4
- package/dist/actions/ConfirmDialog.d.ts.map +1 -1
- package/dist/actions/ConfirmDialog.js +110 -92
- package/dist/actions/ConfirmDialog.js.map +1 -1
- package/dist/actions/RowActions.d.ts +25 -9
- package/dist/actions/RowActions.d.ts.map +1 -1
- package/dist/actions/RowActions.js +151 -80
- package/dist/actions/RowActions.js.map +1 -1
- package/dist/actions/actions.d.ts +5 -4
- package/dist/actions/actions.d.ts.map +1 -1
- package/dist/actions/actions.js +7 -14
- package/dist/actions/actions.js.map +1 -1
- package/dist/actions/fit.d.ts +25 -0
- package/dist/actions/fit.d.ts.map +1 -0
- package/dist/actions/fit.js +197 -0
- package/dist/actions/fit.js.map +1 -0
- package/dist/actions/icons.d.ts +5 -0
- package/dist/actions/icons.d.ts.map +1 -1
- package/dist/actions/icons.js +15 -1
- package/dist/actions/icons.js.map +1 -1
- package/dist/columns.d.ts +10 -0
- package/dist/columns.d.ts.map +1 -0
- package/dist/columns.js +25 -0
- package/dist/columns.js.map +1 -0
- package/dist/cx.js.map +1 -1
- package/dist/displays/Displays.css +48 -0
- package/dist/displays/Displays.module.js +18 -2
- package/dist/displays/Displays.module.js.map +1 -1
- package/dist/displays/displays.d.ts +62 -6
- package/dist/displays/displays.d.ts.map +1 -1
- package/dist/displays/displays.js +1151 -89
- package/dist/displays/displays.js.map +1 -1
- package/dist/filters/Filters.css +25 -11
- package/dist/filters/Filters.d.ts +1 -1
- package/dist/filters/Filters.js.map +1 -1
- package/dist/filters/Filters.module.js +5 -1
- package/dist/filters/Filters.module.js.map +1 -1
- package/dist/filters/controls.d.ts +1 -1
- package/dist/filters/controls.d.ts.map +1 -1
- package/dist/filters/controls.js +57 -35
- package/dist/filters/controls.js.map +1 -1
- package/dist/filters/format.d.ts +1 -1
- package/dist/filters/format.js.map +1 -1
- package/dist/images.d.ts +7 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +39 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +22 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/inline/Inline.css +58 -0
- package/dist/inline/Inline.module.js +20 -0
- package/dist/inline/Inline.module.js.map +1 -0
- package/dist/inline/InlineCell.d.ts +29 -0
- package/dist/inline/InlineCell.d.ts.map +1 -0
- package/dist/inline/InlineCell.js +490 -0
- package/dist/inline/InlineCell.js.map +1 -0
- package/dist/inline/editable.d.ts +12 -0
- package/dist/inline/editable.d.ts.map +1 -0
- package/dist/inline/editable.js +29 -0
- package/dist/inline/editable.js.map +1 -0
- package/dist/layouts/CalendarLayout.css +153 -0
- package/dist/layouts/CalendarLayout.d.ts +9 -0
- package/dist/layouts/CalendarLayout.d.ts.map +1 -0
- package/dist/layouts/CalendarLayout.js +303 -0
- package/dist/layouts/CalendarLayout.js.map +1 -0
- package/dist/layouts/CalendarLayout.module.js +28 -0
- package/dist/layouts/CalendarLayout.module.js.map +1 -0
- package/dist/layouts/CardsLayout.css +5 -0
- package/dist/layouts/CardsLayout.d.ts +2 -2
- package/dist/layouts/CardsLayout.d.ts.map +1 -1
- package/dist/layouts/CardsLayout.js +92 -91
- package/dist/layouts/CardsLayout.js.map +1 -1
- package/dist/layouts/CardsLayout.module.js.map +1 -1
- package/dist/layouts/GalleryLayout.css +87 -0
- package/dist/layouts/GalleryLayout.d.ts +8 -0
- package/dist/layouts/GalleryLayout.d.ts.map +1 -0
- package/dist/layouts/GalleryLayout.js +152 -0
- package/dist/layouts/GalleryLayout.js.map +1 -0
- package/dist/layouts/GalleryLayout.module.js +26 -0
- package/dist/layouts/GalleryLayout.module.js.map +1 -0
- package/dist/layouts/ItemTitle.d.ts +3 -1
- package/dist/layouts/ItemTitle.d.ts.map +1 -1
- package/dist/layouts/ItemTitle.js +12 -8
- package/dist/layouts/ItemTitle.js.map +1 -1
- package/dist/layouts/TableLayout.css +56 -0
- package/dist/layouts/TableLayout.d.ts +5 -4
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +171 -101
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/TableLayout.module.js +8 -4
- package/dist/layouts/TableLayout.module.js.map +1 -1
- package/dist/layouts/builtIn.d.ts +2 -2
- package/dist/layouts/builtIn.d.ts.map +1 -1
- package/dist/layouts/builtIn.js +6 -2
- package/dist/layouts/builtIn.js.map +1 -1
- package/dist/layouts/calendarDays.d.ts +14 -0
- package/dist/layouts/calendarDays.d.ts.map +1 -0
- package/dist/layouts/calendarDays.js +44 -0
- package/dist/layouts/calendarDays.js.map +1 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/query.d.ts +4 -3
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +15 -4
- package/dist/query.js.map +1 -1
- package/dist/selection.d.ts +1 -1
- package/dist/selection.js.map +1 -1
- package/dist/toolbar/ColumnMenu.d.ts +17 -0
- package/dist/toolbar/ColumnMenu.d.ts.map +1 -0
- package/dist/toolbar/ColumnMenu.js +193 -0
- package/dist/toolbar/ColumnMenu.js.map +1 -0
- package/dist/toolbar/LayoutSwitch.d.ts.map +1 -1
- package/dist/toolbar/LayoutSwitch.js +73 -55
- package/dist/toolbar/LayoutSwitch.js.map +1 -1
- package/dist/toolbar/Pagination.d.ts +33 -0
- package/dist/toolbar/Pagination.d.ts.map +1 -1
- package/dist/toolbar/Pagination.js +282 -42
- package/dist/toolbar/Pagination.js.map +1 -1
- package/dist/toolbar/SearchField.js.map +1 -1
- package/dist/toolbar/SortSelect.d.ts +1 -1
- package/dist/toolbar/SortSelect.js.map +1 -1
- package/dist/toolbar/Toolbar.css +36 -0
- package/dist/toolbar/Toolbar.module.js +12 -2
- package/dist/toolbar/Toolbar.module.js.map +1 -1
- package/dist/types.d.ts +69 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useDraft.js.map +1 -1
- package/dist/useListState.js.map +1 -1
- package/dist/useRenderValue.d.ts +10 -0
- package/dist/useRenderValue.d.ts.map +1 -0
- package/dist/useRenderValue.js +84 -0
- package/dist/useRenderValue.js.map +1 -0
- package/dist/values.d.ts +4 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +6 -2
- package/dist/values.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,109 +1,110 @@
|
|
|
1
1
|
import { messages } from "../messages.js";
|
|
2
|
-
import CardsLayout_module_default from "./CardsLayout.module.js";
|
|
3
2
|
import { ItemTitle } from "./ItemTitle.js";
|
|
3
|
+
import { RowActionsFit, fitContent, useRowActionsFit } from "../actions/fit.js";
|
|
4
|
+
import CardsLayout_module_default from "./CardsLayout.module.js";
|
|
4
5
|
import { c } from "react/compiler-runtime";
|
|
5
6
|
import { Checkbox, usePanneauIntl } from "@panneau/ui";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
//#region src/layouts/CardsLayout.tsx
|
|
8
9
|
/** Items as cards: the first column is the title, the others are listed under it. */
|
|
9
10
|
function CardsLayout(t0) {
|
|
10
|
-
const $ = c(
|
|
11
|
-
const { items, columns, renderValue, getItemLabel, getItemHref, selectable, isSelected, onToggle, renderActions, label, pageSelection } = t0;
|
|
11
|
+
const $ = c(18);
|
|
12
|
+
const { items, columns, renderValue, getItemLabel, getItemHref, isCurrent, selectable, isSelected, onToggle, renderActions, label, pageSelection } = t0;
|
|
12
13
|
const intl = usePanneauIntl();
|
|
14
|
+
const [title, ...others] = columns;
|
|
13
15
|
let t1;
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
});
|
|
16
|
+
if ($[0] !== columns || $[1] !== items) {
|
|
17
|
+
t1 = fitContent(items, columns);
|
|
65
18
|
$[0] = columns;
|
|
66
|
-
$[1] =
|
|
67
|
-
$[2] =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
19
|
+
$[1] = items;
|
|
20
|
+
$[2] = t1;
|
|
21
|
+
} else t1 = $[2];
|
|
22
|
+
const [fitLevel, measureList] = useRowActionsFit(t1);
|
|
23
|
+
const T0 = RowActionsFit;
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[3] !== pageSelection || $[4] !== selectable) {
|
|
26
|
+
t2 = selectable ? /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: CardsLayout_module_default.pageSelection,
|
|
28
|
+
children: pageSelection
|
|
29
|
+
}) : null;
|
|
30
|
+
$[3] = pageSelection;
|
|
31
|
+
$[4] = selectable;
|
|
32
|
+
$[5] = t2;
|
|
33
|
+
} else t2 = $[5];
|
|
34
|
+
const t3 = CardsLayout_module_default;
|
|
35
|
+
const t4 = items.map((item) => {
|
|
36
|
+
const selected = selectable && isSelected(item);
|
|
37
|
+
const actions = renderActions(item);
|
|
38
|
+
const current = isCurrent?.(item) ?? false;
|
|
39
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
40
|
+
className: CardsLayout_module_default.card,
|
|
41
|
+
"data-selected": selected || void 0,
|
|
42
|
+
"data-current": current || void 0,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: CardsLayout_module_default.header,
|
|
46
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
47
|
+
className: CardsLayout_module_default.title,
|
|
48
|
+
children: /* @__PURE__ */ jsx(ItemTitle, {
|
|
49
|
+
href: getItemHref?.(item) ?? null,
|
|
50
|
+
current,
|
|
51
|
+
children: title !== void 0 ? renderValue(item, title) : getItemLabel(item)
|
|
52
|
+
})
|
|
53
|
+
}), selectable ? /* @__PURE__ */ jsx(Checkbox, {
|
|
54
|
+
"aria-label": intl.formatMessage(messages.selectItem, { item: getItemLabel(item) }),
|
|
55
|
+
isSelected: selected,
|
|
56
|
+
onChange: () => onToggle(item)
|
|
57
|
+
}) : null]
|
|
58
|
+
}),
|
|
59
|
+
others.length > 0 ? /* @__PURE__ */ jsx("dl", {
|
|
60
|
+
className: CardsLayout_module_default.values,
|
|
61
|
+
children: others.map((column) => /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: CardsLayout_module_default.value,
|
|
63
|
+
children: [/* @__PURE__ */ jsx("dt", { children: column.label ?? column.id }), /* @__PURE__ */ jsx("dd", { children: renderValue(item, column) })]
|
|
64
|
+
}, column.id))
|
|
65
|
+
}) : null,
|
|
66
|
+
actions !== null ? /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: CardsLayout_module_default.actions,
|
|
68
|
+
children: actions
|
|
69
|
+
}) : null
|
|
70
|
+
]
|
|
71
|
+
}, item.id);
|
|
72
|
+
});
|
|
87
73
|
let t5;
|
|
88
|
-
if ($[
|
|
74
|
+
if ($[6] !== label || $[7] !== t3.cards || $[8] !== t4) {
|
|
89
75
|
t5 = /* @__PURE__ */ jsx("ul", {
|
|
90
|
-
className:
|
|
91
|
-
"aria-label":
|
|
92
|
-
children:
|
|
76
|
+
className: t3.cards,
|
|
77
|
+
"aria-label": label,
|
|
78
|
+
children: t4
|
|
93
79
|
});
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
} else t5 = $[
|
|
80
|
+
$[6] = label;
|
|
81
|
+
$[7] = t3.cards;
|
|
82
|
+
$[8] = t4;
|
|
83
|
+
$[9] = t5;
|
|
84
|
+
} else t5 = $[9];
|
|
99
85
|
let t6;
|
|
100
|
-
if ($[
|
|
101
|
-
t6 = /* @__PURE__ */ jsxs("div", {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
if ($[10] !== measureList || $[11] !== t2 || $[12] !== t5) {
|
|
87
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
88
|
+
ref: measureList,
|
|
89
|
+
children: [t2, t5]
|
|
90
|
+
});
|
|
91
|
+
$[10] = measureList;
|
|
92
|
+
$[11] = t2;
|
|
93
|
+
$[12] = t5;
|
|
94
|
+
$[13] = t6;
|
|
95
|
+
} else t6 = $[13];
|
|
96
|
+
let t7;
|
|
97
|
+
if ($[14] !== T0 || $[15] !== fitLevel || $[16] !== t6) {
|
|
98
|
+
t7 = /* @__PURE__ */ jsx(T0, {
|
|
99
|
+
value: fitLevel,
|
|
100
|
+
children: t6
|
|
101
|
+
});
|
|
102
|
+
$[14] = T0;
|
|
103
|
+
$[15] = fitLevel;
|
|
104
|
+
$[16] = t6;
|
|
105
|
+
$[17] = t7;
|
|
106
|
+
} else t7 = $[17];
|
|
107
|
+
return t7;
|
|
107
108
|
}
|
|
108
109
|
//#endregion
|
|
109
110
|
export { CardsLayout };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardsLayout.js","names":["
|
|
1
|
+
{"version":3,"file":"CardsLayout.js","names":["Checkbox","usePanneauIntl","RowActionsFit","fitContent","useRowActionsFit","messages","ListLayoutProps","styles","ItemTitle","CardsLayout","t0","$","_c","items","columns","renderValue","getItemLabel","getItemHref","isCurrent","selectable","isSelected","onToggle","renderActions","label","pageSelection","intl","title","others","t1","fitLevel","measureList","T0","t2","t4","map","item","selected","actions","current","id","card","undefined","header","formatMessage","selectItem","length","values","column","value","t5","t3","cards","t6","t7","_c","styles"],"sources":["../../src/layouts/CardsLayout.tsx"],"sourcesContent":["import { Checkbox, usePanneauIntl } from '@panneau/ui';\n\nimport { RowActionsFit, fitContent, useRowActionsFit } from '../actions/fit';\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 isCurrent,\n selectable,\n isSelected,\n onToggle,\n renderActions,\n label,\n pageSelection,\n}: ListLayoutProps) {\n const intl = usePanneauIntl();\n const [title, ...others] = columns;\n const [fitLevel, measureList] = useRowActionsFit(fitContent(items, columns));\n return (\n <RowActionsFit value={fitLevel}>\n <div ref={measureList}>\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 const current = isCurrent?.(item) ?? false;\n return (\n <li\n key={item.id}\n className={styles.card}\n data-selected={selected || undefined}\n data-current={current || undefined}\n >\n <div className={styles.header}>\n <div className={styles.title}>\n <ItemTitle\n href={getItemHref?.(item) ?? null}\n current={current}\n >\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 </RowActionsFit>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAOS,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAqB,MAAA,EAAAC,OAAAC,SAAAC,aAAAC,cAAAC,aAAAC,WAAAC,YAAAC,YAAAC,UAAAC,eAAAC,OAAAC,kBAAAd;CAcxB,MAAAe,OAAaxB,eAAe;CAC5B,MAAA,CAAAyB,OAAA,GAAAC,UAA2Bb;CAAQ,IAAAc;CAAA,IAAAjB,EAAA,OAAAG,WAAAH,EAAA,OAAAE,OAAA;EACce,KAAAzB,WAAWU,OAAOC,OAAO;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAiB;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A,KAAA1C,EAAA;CAAA,OAtDhB0C;AAsDgB"}
|
|
@@ -1 +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.values dt,\n.values dd {\n margin: 0;\n font-weight: inherit;\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":""}
|
|
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-current] {\n border-color: var(--panneau-color-accent);\n box-shadow: inset 0 0 0 1px var(--panneau-color-accent);\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.values dt,\n.values dd {\n margin: 0;\n font-weight: inherit;\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,87 @@
|
|
|
1
|
+
.panneau-gallery-layout-gallery {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr));
|
|
4
|
+
gap: var(--panneau-space-3);
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
list-style: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.panneau-gallery-layout-tile {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
background-color: var(--panneau-color-surface);
|
|
15
|
+
border: var(--panneau-border-width) solid var(--panneau-color-border);
|
|
16
|
+
border-radius: var(--panneau-radius-lg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.panneau-gallery-layout-tile[data-current] {
|
|
20
|
+
border-color: var(--panneau-color-accent);
|
|
21
|
+
box-shadow: inset 0 0 0 1px var(--panneau-color-accent);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.panneau-gallery-layout-tile[data-selected] {
|
|
25
|
+
background-color: var(--panneau-color-accent-subtle);
|
|
26
|
+
border-color: var(--panneau-color-border-control);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.panneau-gallery-layout-media {
|
|
30
|
+
position: relative;
|
|
31
|
+
aspect-ratio: 4 / 3;
|
|
32
|
+
background-color: var(--panneau-color-surface-sunken);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.panneau-gallery-layout-media img {
|
|
36
|
+
display: block;
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
object-fit: cover;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.panneau-gallery-layout-placeholder {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
height: 100%;
|
|
47
|
+
color: var(--panneau-color-text-muted);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.panneau-gallery-layout-check {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: var(--panneau-space-2);
|
|
53
|
+
left: var(--panneau-space-2);
|
|
54
|
+
padding: 2px;
|
|
55
|
+
background-color: var(--panneau-color-surface);
|
|
56
|
+
border-radius: var(--panneau-radius-sm);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.panneau-gallery-layout-caption {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
gap: var(--panneau-space-2);
|
|
63
|
+
padding: var(--panneau-space-2) var(--panneau-space-3);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.panneau-gallery-layout-title {
|
|
67
|
+
flex: 1;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
overflow-wrap: anywhere;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.panneau-gallery-layout-actions {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
gap: var(--panneau-space-1);
|
|
76
|
+
max-width: 100%;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* On one line: the list measures what doesn't fit, and moves it to the menu (decision 0060). */
|
|
81
|
+
.panneau-gallery-layout-actions > * {
|
|
82
|
+
flex-wrap: nowrap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.panneau-gallery-layout-page-selection {
|
|
86
|
+
margin-bottom: var(--panneau-space-2);
|
|
87
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ListLayoutProps } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Items as a grid of images (decision 0044): the image of each item (`itemImage` of the
|
|
4
|
+
* resource), its title under it, its checkbox and its actions. An item without an image shows a
|
|
5
|
+
* placeholder.
|
|
6
|
+
*/
|
|
7
|
+
export declare function GalleryLayout({ items, columns, renderValue, getItemLabel, getItemHref, getItemImage, isCurrent, selectable, isSelected, onToggle, renderActions, label, pageSelection, }: ListLayoutProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=GalleryLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/GalleryLayout.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,aAAa,EACb,KAAK,EACL,aAAa,GAChB,EAAE,eAAe,+BAkEjB"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { messages } from "../messages.js";
|
|
2
|
+
import { ItemTitle } from "./ItemTitle.js";
|
|
3
|
+
import { RowActionsFit, fitContent, useRowActionsFit } from "../actions/fit.js";
|
|
4
|
+
import GalleryLayout_module_default from "./GalleryLayout.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 { ImageOff } from "lucide-react";
|
|
9
|
+
//#region src/layouts/GalleryLayout.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Items as a grid of images (decision 0044): the image of each item (`itemImage` of the
|
|
12
|
+
* resource), its title under it, its checkbox and its actions. An item without an image shows a
|
|
13
|
+
* placeholder.
|
|
14
|
+
*/
|
|
15
|
+
function GalleryLayout(t0) {
|
|
16
|
+
const $ = c(41);
|
|
17
|
+
const { items, columns, renderValue, getItemLabel, getItemHref, getItemImage, isCurrent, selectable, isSelected, onToggle, renderActions, label, pageSelection } = t0;
|
|
18
|
+
const intl = usePanneauIntl();
|
|
19
|
+
const [title] = columns;
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== columns || $[1] !== items) {
|
|
22
|
+
t1 = fitContent(items, columns);
|
|
23
|
+
$[0] = columns;
|
|
24
|
+
$[1] = items;
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else t1 = $[2];
|
|
27
|
+
const [fitLevel, measureList] = useRowActionsFit(t1);
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[3] !== pageSelection || $[4] !== selectable) {
|
|
30
|
+
t2 = selectable ? /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: GalleryLayout_module_default.pageSelection,
|
|
32
|
+
children: pageSelection
|
|
33
|
+
}) : null;
|
|
34
|
+
$[3] = pageSelection;
|
|
35
|
+
$[4] = selectable;
|
|
36
|
+
$[5] = t2;
|
|
37
|
+
} else t2 = $[5];
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[6] !== getItemHref || $[7] !== getItemImage || $[8] !== getItemLabel || $[9] !== intl || $[10] !== isCurrent || $[11] !== isSelected || $[12] !== items || $[13] !== onToggle || $[14] !== renderActions || $[15] !== renderValue || $[16] !== selectable || $[17] !== title) {
|
|
40
|
+
let t4;
|
|
41
|
+
if ($[19] !== getItemHref || $[20] !== getItemImage || $[21] !== getItemLabel || $[22] !== intl || $[23] !== isCurrent || $[24] !== isSelected || $[25] !== onToggle || $[26] !== renderActions || $[27] !== renderValue || $[28] !== selectable || $[29] !== title) {
|
|
42
|
+
t4 = (item) => {
|
|
43
|
+
const selected = selectable && isSelected(item);
|
|
44
|
+
const actions = renderActions(item);
|
|
45
|
+
const current = isCurrent?.(item) ?? false;
|
|
46
|
+
const image = getItemImage?.(item) ?? null;
|
|
47
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
48
|
+
className: GalleryLayout_module_default.tile,
|
|
49
|
+
"data-selected": selected || void 0,
|
|
50
|
+
"data-current": current || void 0,
|
|
51
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
52
|
+
className: GalleryLayout_module_default.media,
|
|
53
|
+
children: [image !== null ? /* @__PURE__ */ jsx("img", {
|
|
54
|
+
src: image,
|
|
55
|
+
alt: "",
|
|
56
|
+
loading: "lazy"
|
|
57
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
58
|
+
className: GalleryLayout_module_default.placeholder,
|
|
59
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
60
|
+
icon: ImageOff,
|
|
61
|
+
size: "lg"
|
|
62
|
+
})
|
|
63
|
+
}), selectable ? /* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: GalleryLayout_module_default.check,
|
|
65
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
66
|
+
"aria-label": intl.formatMessage(messages.selectItem, { item: getItemLabel(item) }),
|
|
67
|
+
isSelected: selected,
|
|
68
|
+
onChange: () => onToggle(item)
|
|
69
|
+
})
|
|
70
|
+
}) : null]
|
|
71
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: GalleryLayout_module_default.caption,
|
|
73
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
74
|
+
className: GalleryLayout_module_default.title,
|
|
75
|
+
children: /* @__PURE__ */ jsx(ItemTitle, {
|
|
76
|
+
href: getItemHref?.(item) ?? null,
|
|
77
|
+
current,
|
|
78
|
+
children: title !== void 0 ? renderValue(item, title) : getItemLabel(item)
|
|
79
|
+
})
|
|
80
|
+
}), actions !== null ? /* @__PURE__ */ jsx("div", {
|
|
81
|
+
className: GalleryLayout_module_default.actions,
|
|
82
|
+
children: actions
|
|
83
|
+
}) : null]
|
|
84
|
+
})]
|
|
85
|
+
}, item.id);
|
|
86
|
+
};
|
|
87
|
+
$[19] = getItemHref;
|
|
88
|
+
$[20] = getItemImage;
|
|
89
|
+
$[21] = getItemLabel;
|
|
90
|
+
$[22] = intl;
|
|
91
|
+
$[23] = isCurrent;
|
|
92
|
+
$[24] = isSelected;
|
|
93
|
+
$[25] = onToggle;
|
|
94
|
+
$[26] = renderActions;
|
|
95
|
+
$[27] = renderValue;
|
|
96
|
+
$[28] = selectable;
|
|
97
|
+
$[29] = title;
|
|
98
|
+
$[30] = t4;
|
|
99
|
+
} else t4 = $[30];
|
|
100
|
+
t3 = items.map(t4);
|
|
101
|
+
$[6] = getItemHref;
|
|
102
|
+
$[7] = getItemImage;
|
|
103
|
+
$[8] = getItemLabel;
|
|
104
|
+
$[9] = intl;
|
|
105
|
+
$[10] = isCurrent;
|
|
106
|
+
$[11] = isSelected;
|
|
107
|
+
$[12] = items;
|
|
108
|
+
$[13] = onToggle;
|
|
109
|
+
$[14] = renderActions;
|
|
110
|
+
$[15] = renderValue;
|
|
111
|
+
$[16] = selectable;
|
|
112
|
+
$[17] = title;
|
|
113
|
+
$[18] = t3;
|
|
114
|
+
} else t3 = $[18];
|
|
115
|
+
let t4;
|
|
116
|
+
if ($[31] !== label || $[32] !== t3) {
|
|
117
|
+
t4 = /* @__PURE__ */ jsx("ul", {
|
|
118
|
+
className: GalleryLayout_module_default.gallery,
|
|
119
|
+
"aria-label": label,
|
|
120
|
+
children: t3
|
|
121
|
+
});
|
|
122
|
+
$[31] = label;
|
|
123
|
+
$[32] = t3;
|
|
124
|
+
$[33] = t4;
|
|
125
|
+
} else t4 = $[33];
|
|
126
|
+
let t5;
|
|
127
|
+
if ($[34] !== measureList || $[35] !== t2 || $[36] !== t4) {
|
|
128
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
129
|
+
ref: measureList,
|
|
130
|
+
children: [t2, t4]
|
|
131
|
+
});
|
|
132
|
+
$[34] = measureList;
|
|
133
|
+
$[35] = t2;
|
|
134
|
+
$[36] = t4;
|
|
135
|
+
$[37] = t5;
|
|
136
|
+
} else t5 = $[37];
|
|
137
|
+
let t6;
|
|
138
|
+
if ($[38] !== fitLevel || $[39] !== t5) {
|
|
139
|
+
t6 = /* @__PURE__ */ jsx(RowActionsFit, {
|
|
140
|
+
value: fitLevel,
|
|
141
|
+
children: t5
|
|
142
|
+
});
|
|
143
|
+
$[38] = fitLevel;
|
|
144
|
+
$[39] = t5;
|
|
145
|
+
$[40] = t6;
|
|
146
|
+
} else t6 = $[40];
|
|
147
|
+
return t6;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { GalleryLayout };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=GalleryLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryLayout.js","names":["ImageOff","Checkbox","Icon","usePanneauIntl","RowActionsFit","fitContent","useRowActionsFit","messages","ListLayoutProps","styles","ItemTitle","GalleryLayout","t0","$","_c","items","columns","renderValue","getItemLabel","getItemHref","getItemImage","isCurrent","selectable","isSelected","onToggle","renderActions","label","pageSelection","intl","title","t1","fitLevel","measureList","t2","t3","t4","item","selected","actions","current","image","id","tile","undefined","media","placeholder","check","formatMessage","selectItem","caption","map","gallery","t5","t6","_c","styles"],"sources":["../../src/layouts/GalleryLayout.tsx"],"sourcesContent":["import { ImageOff } from 'lucide-react';\n\nimport { Checkbox, Icon, usePanneauIntl } from '@panneau/ui';\n\nimport { RowActionsFit, fitContent, useRowActionsFit } from '../actions/fit';\nimport { messages } from '../messages';\nimport type { ListLayoutProps } from '../types';\nimport styles from './GalleryLayout.module.css';\nimport { ItemTitle } from './ItemTitle';\n\n/**\n * Items as a grid of images (decision 0044): the image of each item (`itemImage` of the\n * resource), its title under it, its checkbox and its actions. An item without an image shows a\n * placeholder.\n */\nexport function GalleryLayout({\n items,\n columns,\n renderValue,\n getItemLabel,\n getItemHref,\n getItemImage,\n isCurrent,\n selectable,\n isSelected,\n onToggle,\n renderActions,\n label,\n pageSelection,\n}: ListLayoutProps) {\n const intl = usePanneauIntl();\n const [title] = columns;\n const [fitLevel, measureList] = useRowActionsFit(fitContent(items, columns));\n return (\n <RowActionsFit value={fitLevel}>\n <div ref={measureList}>\n {selectable ? <div className={styles.pageSelection}>{pageSelection}</div> : null}\n <ul className={styles.gallery} aria-label={label}>\n {items.map((item) => {\n const selected = selectable && isSelected(item);\n const actions = renderActions(item);\n const current = isCurrent?.(item) ?? false;\n const image = getItemImage?.(item) ?? null;\n return (\n <li\n key={item.id}\n className={styles.tile}\n data-selected={selected || undefined}\n data-current={current || undefined}\n >\n <div className={styles.media}>\n {image !== null ? (\n <img src={image} alt=\"\" loading=\"lazy\" />\n ) : (\n <span className={styles.placeholder}>\n <Icon icon={ImageOff} size=\"lg\" />\n </span>\n )}\n {selectable ? (\n <span className={styles.check}>\n <Checkbox\n aria-label={intl.formatMessage(\n messages.selectItem,\n {\n item: getItemLabel(item),\n },\n )}\n isSelected={selected}\n onChange={() => onToggle(item)}\n />\n </span>\n ) : null}\n </div>\n <div className={styles.caption}>\n <div className={styles.title}>\n <ItemTitle\n href={getItemHref?.(item) ?? null}\n current={current}\n >\n {title !== undefined\n ? renderValue(item, title)\n : getItemLabel(item)}\n </ItemTitle>\n </div>\n {actions !== null ? (\n <div className={styles.actions}>{actions}</div>\n ) : null}\n </div>\n </li>\n );\n })}\n </ul>\n </div>\n </RowActionsFit>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,SAAOW,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAuB,MAAA,EAAAC,OAAAC,SAAAC,aAAAC,cAAAC,aAAAC,cAAAC,WAAAC,YAAAC,YAAAC,UAAAC,eAAAC,OAAAC,kBAAAf;CAe1B,MAAAgB,OAAazB,eAAe;CAC5B,MAAA,CAAA0B,SAAgBb;CAAQ,IAAAc;CAAA,IAAAjB,EAAA,OAAAG,WAAAH,EAAA,OAAAE,OAAA;EACyBe,KAAAzB,WAAWU,OAAOC,OAAO;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAA3E,MAAA,CAAAkB,UAAAC,eAAgC1B,iBAAiBwB,EAA0B;CAAE,IAAAG;CAAA,IAAApB,EAAA,OAAAc,iBAAAd,EAAA,OAAAS,YAAA;EAIhEW,KAAAX,aAAa,oBAAA,OAAA;GAAgB,WAAAb,6BAAMkB;GAAiBA,UAAAA;EAAoB,CAAA,IAAxE;EAA+Ed,EAAA,KAAAc;EAAAd,EAAA,KAAAS;EAAAT,EAAA,KAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAAA,IAAAqB;CAAA,IAAArB,EAAA,OAAAM,eAAAN,EAAA,OAAAO,gBAAAP,EAAA,OAAAK,gBAAAL,EAAA,OAAAe,QAAAf,EAAA,QAAAQ,aAAAR,EAAA,QAAAU,cAAAV,EAAA,QAAAE,SAAAF,EAAA,QAAAW,YAAAX,EAAA,QAAAY,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AvC,EAAA,QAAAmB,eAAAnB,EAAA,QAAAoB,MAAApB,EAAA,QAAAsB,IAAA;EAxDTiB,KAAA,qBAAA,OAAA;GAAUpB,KAAAA;GAAV,UAAA,CACKC,IACDE,EAuDE;;EAAAtB,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;EAAApB,EAAA,MAAAsB;EAAAtB,EAAA,MAAAuC;CAAA,OAAAA,KAAAvC,EAAA;CAAA,IAAAwC;CAAA,IAAAxC,EAAA,QAAAkB,YAAAlB,EAAA,QAAAuC,IAAA;EA1DVC,KAAA,oBAAC,eAAD;GAAsBtB,OAAAA;GAClBqB,UAAAA;EADU,CAAA;EA2DEvC,EAAA,MAAAkB;EAAAlB,EAAA,MAAAuC;EAAAvC,EAAA,MAAAwC;CAAA,OAAAA,KAAAxC,EAAA;CAAA,OA3DhBwC;AA2DgB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "./GalleryLayout.css";
|
|
2
|
+
//#region src/layouts/GalleryLayout.module.css
|
|
3
|
+
var gallery = "panneau-gallery-layout-gallery";
|
|
4
|
+
var tile = "panneau-gallery-layout-tile";
|
|
5
|
+
var media = "panneau-gallery-layout-media";
|
|
6
|
+
var placeholder = "panneau-gallery-layout-placeholder";
|
|
7
|
+
var check = "panneau-gallery-layout-check";
|
|
8
|
+
var caption = "panneau-gallery-layout-caption";
|
|
9
|
+
var title = "panneau-gallery-layout-title";
|
|
10
|
+
var actions = "panneau-gallery-layout-actions";
|
|
11
|
+
var pageSelection = "panneau-gallery-layout-page-selection";
|
|
12
|
+
var GalleryLayout_module_default = {
|
|
13
|
+
gallery,
|
|
14
|
+
tile,
|
|
15
|
+
media,
|
|
16
|
+
placeholder,
|
|
17
|
+
check,
|
|
18
|
+
caption,
|
|
19
|
+
title,
|
|
20
|
+
actions,
|
|
21
|
+
pageSelection
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { actions, caption, check, GalleryLayout_module_default as default, gallery, media, pageSelection, placeholder, tile, title };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=GalleryLayout.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryLayout.module.js","names":[],"sources":["../../src/layouts/GalleryLayout.module.css"],"sourcesContent":[".gallery {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr));\n gap: var(--panneau-space-3);\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.tile {\n display: flex;\n flex-direction: column;\n overflow: hidden;\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.tile[data-current] {\n border-color: var(--panneau-color-accent);\n box-shadow: inset 0 0 0 1px var(--panneau-color-accent);\n}\n\n.tile[data-selected] {\n background-color: var(--panneau-color-accent-subtle);\n border-color: var(--panneau-color-border-control);\n}\n\n.media {\n position: relative;\n aspect-ratio: 4 / 3;\n background-color: var(--panneau-color-surface-sunken);\n}\n\n.media img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--panneau-color-text-muted);\n}\n\n.check {\n position: absolute;\n top: var(--panneau-space-2);\n left: var(--panneau-space-2);\n padding: 2px;\n background-color: var(--panneau-color-surface);\n border-radius: var(--panneau-radius-sm);\n}\n\n.caption {\n display: flex;\n align-items: flex-start;\n gap: var(--panneau-space-2);\n padding: var(--panneau-space-2) var(--panneau-space-3);\n}\n\n.title {\n flex: 1;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n\n.actions {\n display: flex;\n flex-shrink: 0;\n gap: var(--panneau-space-1);\n max-width: 100%;\n overflow: hidden;\n}\n\n/* On one line: the list measures what doesn't fit, and moves it to the menu (decision 0060). */\n.actions > * {\n flex-wrap: nowrap;\n}\n\n.pageSelection {\n margin-bottom: var(--panneau-space-2);\n}\n"],"mappings":""}
|
|
@@ -3,8 +3,10 @@ import type { ReactNode } from 'react';
|
|
|
3
3
|
* The title of an item, as a link to it when the list has one. Links go through React Aria, so an
|
|
4
4
|
* app's `RouterProvider` handles them with its router.
|
|
5
5
|
*/
|
|
6
|
-
export declare function ItemTitle({ href, children }: {
|
|
6
|
+
export declare function ItemTitle({ href, current, children, }: {
|
|
7
7
|
href: string | null;
|
|
8
|
+
/** The item is the one shown next to the list: its link is the current page. */
|
|
9
|
+
current?: boolean;
|
|
8
10
|
children: ReactNode;
|
|
9
11
|
}): 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
12
|
//# sourceMappingURL=ItemTitle.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACtB,IAAI,EACJ,OAAe,EACf,QAAQ,GACX,EAAE;IACC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACvB,+TASA"}
|
|
@@ -8,21 +8,25 @@ import { Link } from "react-aria-components";
|
|
|
8
8
|
* app's `RouterProvider` handles them with its router.
|
|
9
9
|
*/
|
|
10
10
|
function ItemTitle(t0) {
|
|
11
|
-
const $ = c(
|
|
12
|
-
const { href, children } = t0;
|
|
11
|
+
const $ = c(4);
|
|
12
|
+
const { href, current: t1, children } = t0;
|
|
13
|
+
const current = t1 === void 0 ? false : t1;
|
|
13
14
|
if (href === null) return children;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const t2 = current ? "page" : void 0;
|
|
16
|
+
let t3;
|
|
17
|
+
if ($[0] !== children || $[1] !== href || $[2] !== t2) {
|
|
18
|
+
t3 = /* @__PURE__ */ jsx(Link, {
|
|
17
19
|
className: link_module_default.link,
|
|
18
20
|
href,
|
|
21
|
+
"aria-current": t2,
|
|
19
22
|
children
|
|
20
23
|
});
|
|
21
24
|
$[0] = children;
|
|
22
25
|
$[1] = href;
|
|
23
|
-
$[2] =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
$[2] = t2;
|
|
27
|
+
$[3] = t3;
|
|
28
|
+
} else t3 = $[3];
|
|
29
|
+
return t3;
|
|
26
30
|
}
|
|
27
31
|
//#endregion
|
|
28
32
|
export { ItemTitle };
|
|
@@ -1 +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({
|
|
1
|
+
{"version":3,"file":"ItemTitle.js","names":["ReactNode","Link","styles","ItemTitle","t0","$","_c","href","current","t1","children","undefined","t2","t3","link","_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({\n href,\n current = false,\n children,\n}: {\n href: string | null;\n /** The item is the one shown next to the list: its link is the current page. */\n current?: boolean;\n children: ReactNode;\n}) {\n if (href === null) {\n return children;\n }\n return (\n <Link className={styles.link} href={href} aria-current={current ? 'page' : undefined}>\n {children}\n </Link>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAOG,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAmB,MAAA,EAAAC,MAAAC,SAAAC,IAAAC,aAAAN;CAEtB,MAAAI,UAAAC,OAAAE,KAAAA,IAAA,QAAAF;CAQA,IAAIF,SAAS,MAAI,OACNG;CAGiD,MAAAE,KAAAJ,UAAA,SAAAG,KAAAA;CAA4B,IAAAE;CAAA,IAAAR,EAAA,OAAAK,YAAAL,EAAA,OAAAE,QAAAF,EAAA,OAAAO,IAAA;EAApFC,KAAA,oBAAC,MAAD;GAAiB,WAAAX,oBAAMY;GAAaP;GAAoB,gBAAAK;GACnDF;EADA,CAAA;EAEEL,EAAA,KAAAK;EAAAL,EAAA,KAAAE;EAAAF,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAFPQ;AAEO"}
|