@payloadcms/ui 4.0.0-internal.add4c47 → 4.0.0-internal.b6f3b9a
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/dist/css/app.css +121 -0
- package/dist/css/forms.css +0 -6
- package/dist/css/spacing.css +10 -3
- package/dist/css/z-index.css +1 -0
- package/dist/elements/AddNewRelation/index.css +0 -1
- package/dist/elements/AppHeader/index.css +0 -3
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +5 -1
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js +2 -2
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/CodeEditor/index.css +0 -5
- package/dist/elements/CommandPalette/index.css +0 -7
- package/dist/elements/CreateDocumentButton/index.d.ts.map +1 -1
- package/dist/elements/CreateDocumentButton/index.js +4 -1
- package/dist/elements/CreateDocumentButton/index.js.map +1 -1
- package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/elements/DatePicker/DatePicker.js +1 -0
- package/dist/elements/DatePicker/DatePicker.js.map +1 -1
- package/dist/elements/DatePicker/index.css +1 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +16 -1
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/EditMany/DrawerContent.js +2 -2
- package/dist/elements/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/FieldSelect/reduceFieldOptions.d.ts.map +1 -1
- package/dist/elements/FieldSelect/reduceFieldOptions.js +3 -1
- package/dist/elements/FieldSelect/reduceFieldOptions.js.map +1 -1
- package/dist/elements/FieldSelect/reduceFieldOptions.spec.js +143 -0
- package/dist/elements/FieldSelect/reduceFieldOptions.spec.js.map +1 -0
- package/dist/elements/FileDetails/StaticFileDetails/index.css +8 -9
- package/dist/elements/FileManager/index.js +1 -0
- package/dist/elements/FileManager/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +0 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +109 -89
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +2 -0
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.css +0 -1
- package/dist/elements/InputStepper/index.css +0 -1
- package/dist/elements/Locked/index.css +0 -8
- package/dist/elements/Locked/index.d.ts.map +1 -1
- package/dist/elements/Locked/index.js +70 -64
- package/dist/elements/Locked/index.js.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.client.js +12 -5
- package/dist/elements/Nav/SidebarTabs/index.client.js.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.css +0 -5
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts +1 -0
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts.map +1 -1
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +2 -1
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +1 -1
- package/dist/elements/NavGroup/index.css +0 -1
- package/dist/elements/PreviewButton/index.d.ts +1 -2
- package/dist/elements/PreviewButton/index.d.ts.map +1 -1
- package/dist/elements/PreviewButton/index.js +11 -5
- package/dist/elements/PreviewButton/index.js.map +1 -1
- package/dist/elements/PreviewSizes/index.css +8 -9
- package/dist/elements/ReactSelect/ClearIndicator/index.css +0 -1
- package/dist/elements/ReactSelect/MultiValue/index.css +0 -1
- package/dist/elements/ReactSelect/index.css +0 -3
- package/dist/elements/RelationshipTable/Pagination.d.ts +0 -1
- package/dist/elements/RelationshipTable/Pagination.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/Pagination.js +27 -77
- package/dist/elements/RelationshipTable/Pagination.js.map +1 -1
- package/dist/elements/RelationshipTable/index.d.ts +1 -0
- package/dist/elements/RelationshipTable/index.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/index.js +36 -3
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/RenderTitle/index.css +4 -0
- package/dist/elements/RenderTitle/index.d.ts.map +1 -1
- package/dist/elements/RenderTitle/index.js +18 -13
- package/dist/elements/RenderTitle/index.js.map +1 -1
- package/dist/elements/SelectRow/index.d.ts +4 -3
- package/dist/elements/SelectRow/index.d.ts.map +1 -1
- package/dist/elements/SelectRow/index.js +10 -7
- package/dist/elements/SelectRow/index.js.map +1 -1
- package/dist/elements/SidebarToggle/index.css +0 -17
- package/dist/elements/SortColumn/index.d.ts.map +1 -1
- package/dist/elements/SortColumn/index.js +42 -38
- package/dist/elements/SortColumn/index.js.map +1 -1
- package/dist/elements/Table/OrderableRow.d.ts +3 -1
- package/dist/elements/Table/OrderableRow.d.ts.map +1 -1
- package/dist/elements/Table/OrderableRow.js +17 -1
- package/dist/elements/Table/OrderableRow.js.map +1 -1
- package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
- package/dist/elements/Table/OrderableTable.js +19 -2
- package/dist/elements/Table/OrderableTable.js.map +1 -1
- package/dist/elements/TableSection/index.css +0 -1
- package/dist/elements/Tooltip/index.css +15 -34
- package/dist/elements/Tooltip/index.d.ts +11 -3
- package/dist/elements/Tooltip/index.d.ts.map +1 -1
- package/dist/elements/Tooltip/index.js +151 -85
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/Upload/index.css +0 -5
- package/dist/exports/client/index.d.ts +3 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +1 -1
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Blocks/index.js +3 -3
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts +2 -0
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js +32 -26
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/index.css +37 -73
- package/dist/fields/FieldError/index.css +0 -9
- package/dist/fields/FieldError/index.d.ts.map +1 -1
- package/dist/fields/FieldError/index.js +19 -9
- package/dist/fields/FieldError/index.js.map +1 -1
- package/dist/fields/Join/index.css +9 -0
- package/dist/fields/Join/index.d.ts.map +1 -1
- package/dist/fields/Join/index.js +13 -9
- package/dist/fields/Join/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.css +0 -7
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +32 -14
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/fields/Slug/index.css +0 -1
- package/dist/fields/Slug/index.d.ts.map +1 -1
- package/dist/fields/Slug/index.js +80 -125
- package/dist/fields/Slug/index.js.map +1 -1
- package/dist/forms/Form/fieldReducer.d.ts.map +1 -1
- package/dist/forms/Form/fieldReducer.js +3 -1
- package/dist/forms/Form/fieldReducer.js.map +1 -1
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +6 -1
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/Form/types.d.ts +1 -1
- package/dist/forms/Form/types.d.ts.map +1 -1
- package/dist/forms/Form/types.js.map +1 -1
- package/dist/forms/WatchChildErrors/index.d.ts.map +1 -1
- package/dist/forms/WatchChildErrors/index.js +2 -2
- package/dist/forms/WatchChildErrors/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.js +1 -3
- package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
- package/dist/layouts/Root/index.d.ts +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +8 -2
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/providers/DocumentTitle/index.d.ts +1 -0
- package/dist/providers/DocumentTitle/index.d.ts.map +1 -1
- package/dist/providers/DocumentTitle/index.js +2 -0
- package/dist/providers/DocumentTitle/index.js.map +1 -1
- package/dist/providers/Embed/index.d.ts +24 -0
- package/dist/providers/Embed/index.d.ts.map +1 -0
- package/dist/providers/Embed/index.js +105 -0
- package/dist/providers/Embed/index.js.map +1 -0
- package/dist/providers/FormErrorHandler/index.d.ts +20 -0
- package/dist/providers/FormErrorHandler/index.d.ts.map +1 -0
- package/dist/providers/FormErrorHandler/index.js +6 -0
- package/dist/providers/FormErrorHandler/index.js.map +1 -0
- package/dist/providers/Root/index.d.ts +1 -0
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js +37 -31
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/providers/RouteTransition/index.d.ts +2 -0
- package/dist/providers/RouteTransition/index.d.ts.map +1 -1
- package/dist/providers/RouteTransition/index.js +42 -14
- package/dist/providers/RouteTransition/index.js.map +1 -1
- package/dist/providers/SidebarTabs/index.d.ts +3 -2
- package/dist/providers/SidebarTabs/index.d.ts.map +1 -1
- package/dist/providers/SidebarTabs/index.js.map +1 -1
- package/dist/providers/Theme/index.d.ts +3 -0
- package/dist/providers/Theme/index.d.ts.map +1 -1
- package/dist/providers/Theme/index.js +107 -95
- package/dist/providers/Theme/index.js.map +1 -1
- package/dist/styles.css +12 -10
- package/dist/utilities/combineFieldLabel.d.ts.map +1 -1
- package/dist/utilities/combineFieldLabel.js +5 -1
- package/dist/utilities/combineFieldLabel.js.map +1 -1
- package/dist/utilities/generateFieldID.d.ts +1 -1
- package/dist/utilities/generateFieldID.d.ts.map +1 -1
- package/dist/utilities/generateFieldID.js +2 -2
- package/dist/utilities/generateFieldID.js.map +1 -1
- package/dist/utilities/getRequestEmbed.d.ts +14 -0
- package/dist/utilities/getRequestEmbed.d.ts.map +1 -0
- package/dist/utilities/getRequestEmbed.js +10 -0
- package/dist/utilities/getRequestEmbed.js.map +1 -0
- package/dist/utilities/renderTable.d.ts.map +1 -1
- package/dist/utilities/renderTable.js +18 -2
- package/dist/utilities/renderTable.js.map +1 -1
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/slugify.js +49 -6
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.css +0 -8
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +4 -4
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +10 -10
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
- package/dist/views/HierarchyList/index.css +1 -1
- package/dist/views/List/index.css +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +4 -0
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Logout/index.d.ts.map +1 -1
- package/dist/views/Logout/index.js +11 -0
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Root/index.d.ts +12 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +10 -3
- package/dist/views/Root/index.js.map +1 -1
- package/package.json +5 -10
- package/dist/elements/RelationshipTable/Pagination.css +0 -39
- package/dist/scss/app.scss +0 -183
- package/dist/scss/colors.scss +0 -191
- package/dist/scss/custom.css +0 -1
- package/dist/scss/queries.scss +0 -27
- package/dist/scss/styles.scss +0 -9
- package/dist/scss/svg.scss +0 -10
- package/dist/scss/toastify.scss +0 -61
- package/dist/scss/vars.scss +0 -192
- package/dist/scss/z-index.scss +0 -9
|
@@ -10,7 +10,7 @@ import { useTranslation } from '../../providers/Translation/index.js';
|
|
|
10
10
|
import './index.css';
|
|
11
11
|
const baseClass = 'sort-column';
|
|
12
12
|
export const SortColumn = props => {
|
|
13
|
-
const $ = _c(
|
|
13
|
+
const $ = _c(21);
|
|
14
14
|
const {
|
|
15
15
|
name,
|
|
16
16
|
appearance,
|
|
@@ -56,22 +56,29 @@ export const SortColumn = props => {
|
|
|
56
56
|
descClasses = $[5];
|
|
57
57
|
}
|
|
58
58
|
const isSorted = sort === asc || sort === desc;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
let t1;
|
|
60
|
+
if ($[6] !== Label || $[7] !== appearance || $[8] !== asc || $[9] !== ascClasses || $[10] !== desc || $[11] !== descClasses || $[12] !== disable || $[13] !== handleSortChange || $[14] !== isSorted || $[15] !== label || $[16] !== t) {
|
|
61
|
+
const descLabel = t("general:sortByLabelDirection", {
|
|
62
|
+
direction: t("general:descending"),
|
|
63
|
+
label
|
|
64
|
+
});
|
|
65
|
+
const ascLabel = t("general:sortByLabelDirection", {
|
|
66
|
+
direction: t("general:ascending"),
|
|
67
|
+
label
|
|
68
|
+
});
|
|
69
|
+
const t2 = appearance && `${baseClass}--appearance-${appearance}`;
|
|
70
|
+
const t3 = isSorted && `${baseClass}--sorted`;
|
|
71
|
+
let t4;
|
|
72
|
+
if ($[18] !== t2 || $[19] !== t3) {
|
|
73
|
+
t4 = [baseClass, t2, t3].filter(Boolean);
|
|
74
|
+
$[18] = t2;
|
|
75
|
+
$[19] = t3;
|
|
76
|
+
$[20] = t4;
|
|
77
|
+
} else {
|
|
78
|
+
t4 = $[20];
|
|
79
|
+
}
|
|
80
|
+
t1 = _jsxs("div", {
|
|
81
|
+
className: t4.join(" "),
|
|
75
82
|
children: [_jsx("span", {
|
|
76
83
|
className: `${baseClass}__label`,
|
|
77
84
|
children: Label ?? _jsx(FieldLabel, {
|
|
@@ -82,23 +89,19 @@ export const SortColumn = props => {
|
|
|
82
89
|
}), !disable && _jsxs("div", {
|
|
83
90
|
className: `${baseClass}__buttons`,
|
|
84
91
|
children: [_jsx("button", {
|
|
85
|
-
"aria-label":
|
|
86
|
-
direction: t("general:descending"),
|
|
87
|
-
label
|
|
88
|
-
}),
|
|
92
|
+
"aria-label": descLabel,
|
|
89
93
|
className: [...descClasses, `${baseClass}__button`].filter(Boolean).join(" "),
|
|
90
94
|
onClick: () => void handleSortChange(desc),
|
|
95
|
+
title: descLabel,
|
|
91
96
|
type: "button",
|
|
92
97
|
children: _jsx(ChevronIcon, {
|
|
93
98
|
size: 16
|
|
94
99
|
})
|
|
95
100
|
}), _jsx("button", {
|
|
96
|
-
"aria-label":
|
|
97
|
-
direction: t("general:ascending"),
|
|
98
|
-
label
|
|
99
|
-
}),
|
|
101
|
+
"aria-label": ascLabel,
|
|
100
102
|
className: [...ascClasses, `${baseClass}__button`].filter(Boolean).join(" "),
|
|
101
103
|
onClick: () => void handleSortChange(asc),
|
|
104
|
+
title: ascLabel,
|
|
102
105
|
type: "button",
|
|
103
106
|
children: _jsx(ChevronIcon, {
|
|
104
107
|
direction: "up",
|
|
@@ -107,20 +110,21 @@ export const SortColumn = props => {
|
|
|
107
110
|
})]
|
|
108
111
|
})]
|
|
109
112
|
});
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
113
|
+
$[6] = Label;
|
|
114
|
+
$[7] = appearance;
|
|
115
|
+
$[8] = asc;
|
|
116
|
+
$[9] = ascClasses;
|
|
117
|
+
$[10] = desc;
|
|
118
|
+
$[11] = descClasses;
|
|
119
|
+
$[12] = disable;
|
|
120
|
+
$[13] = handleSortChange;
|
|
121
|
+
$[14] = isSorted;
|
|
122
|
+
$[15] = label;
|
|
123
|
+
$[16] = t;
|
|
124
|
+
$[17] = t1;
|
|
121
125
|
} else {
|
|
122
|
-
|
|
126
|
+
t1 = $[17];
|
|
123
127
|
}
|
|
124
|
-
return
|
|
128
|
+
return t1;
|
|
125
129
|
};
|
|
126
130
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","FieldLabel","ChevronIcon","useListQuery","useTranslation","baseClass","SortColumn","props","$","name","appearance","disable","t0","Label","label","undefined","handleSortChange","query","t","sort","desc","asc","ascClasses","push","descClasses","isSorted","t1","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","FieldLabel","ChevronIcon","useListQuery","useTranslation","baseClass","SortColumn","props","$","name","appearance","disable","t0","Label","label","undefined","handleSortChange","query","t","sort","desc","asc","ascClasses","push","descClasses","isSorted","t1","descLabel","direction","ascLabel","t2","t3","t4","filter","Boolean","_jsxs","className","join","children","_jsx","hideLocale","unstyled","onClick","title","type","size"],"sources":["../../../src/elements/SortColumn/index.tsx"],"sourcesContent":["'use client'\nimport type { StaticLabel } from 'payload'\n\nimport React from 'react'\n\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { ChevronIcon } from '../../icons/Chevron/index.js'\nimport { useListQuery } from '../../providers/ListQuery/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport './index.css'\n\nexport type SortColumnProps = {\n readonly appearance?: 'condensed' | 'default'\n readonly disable?: boolean\n readonly Label: React.ReactNode\n readonly label?: StaticLabel\n readonly name: string\n}\n\nconst baseClass = 'sort-column'\n\nexport const SortColumn: React.FC<SortColumnProps> = (props) => {\n const { name, appearance, disable = false, Label, label } = props\n const { handleSortChange, query } = useListQuery()\n const { t } = useTranslation()\n\n const { sort } = query\n\n const desc = `-${name}`\n const asc = name\n\n const ascClasses = [`${baseClass}__asc`]\n if (sort === asc) {\n ascClasses.push(`${baseClass}--active`)\n }\n\n const descClasses = [`${baseClass}__desc`]\n if (sort === desc) {\n descClasses.push(`${baseClass}--active`)\n }\n\n const isSorted = sort === asc || sort === desc\n\n const descLabel = t('general:sortByLabelDirection', {\n direction: t('general:descending'),\n label,\n })\n const ascLabel = t('general:sortByLabelDirection', {\n direction: t('general:ascending'),\n label,\n })\n\n return (\n <div\n className={[\n baseClass,\n appearance && `${baseClass}--appearance-${appearance}`,\n isSorted && `${baseClass}--sorted`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <span className={`${baseClass}__label`}>\n {Label ?? <FieldLabel hideLocale label={label} unstyled />}\n </span>\n {!disable && (\n <div className={`${baseClass}__buttons`}>\n <button\n aria-label={descLabel}\n className={[...descClasses, `${baseClass}__button`].filter(Boolean).join(' ')}\n onClick={() => void handleSortChange(desc)}\n title={descLabel}\n type=\"button\"\n >\n <ChevronIcon size={16} />\n </button>\n <button\n aria-label={ascLabel}\n className={[...ascClasses, `${baseClass}__button`].filter(Boolean).join(' ')}\n onClick={() => void handleSortChange(asc)}\n title={ascLabel}\n type=\"button\"\n >\n <ChevronIcon direction=\"up\" size={16} />\n </button>\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,WAAW,QAAQ;AAC5B,SAASC,YAAY,QAAQ;AAC7B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAUP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,UAAA,GAAwCC,KAAA;EAAA,MAAAC,CAAA,GAAAT,EAAA;EACnD;IAAAU,IAAA;IAAAC,UAAA;IAAAC,OAAA,EAAAC,EAAA;IAAAC,KAAA;IAAAC;EAAA,IAA4DP,KAAA;EAAlC,MAAAI,OAAA,GAAAC,EAAe,KAAAG,SAAA,WAAfH,EAA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UAAAiB,IAAA,EACF;UAAAN,QAAA,EAELC,IAAA,CAAArC,WAAA;YAAA2C,IAAA;UAAA,C;YAEFN,IAAA,CAAC;UAAA,cACaV,QAAA;UAAAO,SAAA,EACD,IAAId,UAAA,EAAY,GAAAjB,SAAA,UAAsB,EAAA4B,MAAA,CAAAC,OAAS,EAAAG,IAAA,CAAc;UAAAK,OAAA,EAAAA,CAAA,UACpD1B,gBAAA,CAAiBK,GAAA;UAAAsB,KAAA,EAC9Bd,QAAA;UAAAe,IAAA,EACF;UAAAN,QAAA,EAELC,IAAA,CAAArC,WAAA;YAAA0B,SAAA,EAAuB;YAAAiB,IAAA;UAAA,C;;;;;;;;;;;;;;;;;;;SA9B/BnB,E;CAoCJ","ignoreList":[]}
|
|
@@ -6,8 +6,10 @@ export type Props = {
|
|
|
6
6
|
readonly columns: Column[];
|
|
7
7
|
readonly dragAttributes?: HTMLAttributes<unknown>;
|
|
8
8
|
readonly dragListeners?: DraggableSyntheticListeners;
|
|
9
|
+
readonly isOrderable?: boolean;
|
|
10
|
+
readonly onDisabledDragAttempt?: () => void;
|
|
9
11
|
readonly ref?: Ref<HTMLTableRowElement>;
|
|
10
12
|
readonly rowId: number | string;
|
|
11
13
|
} & HTMLAttributes<HTMLTableRowElement>;
|
|
12
|
-
export declare const OrderableRow: ({ cellMap, columns, dragAttributes, dragListeners, rowId, ...rest }: Props) => import("react").JSX.Element;
|
|
14
|
+
export declare const OrderableRow: ({ cellMap, columns, dragAttributes, dragListeners, isOrderable, onDisabledDragAttempt, rowId, ...rest }: Props) => import("react").JSX.Element;
|
|
13
15
|
//# sourceMappingURL=OrderableRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderableRow.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/OrderableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"OrderableRow.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/OrderableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAA;AAE/D,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAA;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;IACjD,QAAQ,CAAC,aAAa,CAAC,EAAE,2BAA2B,CAAA;IACpD,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAChC,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAA;AAEvC,eAAO,MAAM,YAAY,4GAStB,KAAK,gCA+CP,CAAA"}
|
|
@@ -4,6 +4,8 @@ export const OrderableRow = ({
|
|
|
4
4
|
columns,
|
|
5
5
|
dragAttributes = {},
|
|
6
6
|
dragListeners = {},
|
|
7
|
+
isOrderable = true,
|
|
8
|
+
onDisabledDragAttempt,
|
|
7
9
|
rowId,
|
|
8
10
|
...rest
|
|
9
11
|
}) => /*#__PURE__*/_jsx("tr", {
|
|
@@ -16,11 +18,25 @@ export const OrderableRow = ({
|
|
|
16
18
|
const cell = col.renderedCells[cellMap[rowId]];
|
|
17
19
|
// For drag handles, wrap in div with drag attributes
|
|
18
20
|
if (accessor === '_dragHandle') {
|
|
21
|
+
// When not orderable, dnd-kit's own drag listeners are disabled, so pressing the keys
|
|
22
|
+
// it would normally use to start a drag does nothing silently. Intercept them here to
|
|
23
|
+
// tell the user why instead.
|
|
24
|
+
const dragHandleListeners = {
|
|
25
|
+
...dragListeners,
|
|
26
|
+
onKeyDown: event => {
|
|
27
|
+
if (!isOrderable && (event.code === 'Space' || event.code === 'Enter')) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
onDisabledDragAttempt?.();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
dragListeners?.onKeyDown?.(event);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
19
35
|
return /*#__PURE__*/_jsx("td", {
|
|
20
36
|
className: `cell-${accessor}`,
|
|
21
37
|
children: /*#__PURE__*/_jsx("div", {
|
|
22
38
|
...dragAttributes,
|
|
23
|
-
...
|
|
39
|
+
...dragHandleListeners,
|
|
24
40
|
children: cell
|
|
25
41
|
})
|
|
26
42
|
}, colIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderableRow.js","names":["OrderableRow","cellMap","columns","dragAttributes","dragListeners","rowId","rest","_jsx","map","col","colIndex","accessor","cell","renderedCells","className","isLinkedColumn","filter","Boolean","join"],"sources":["../../../src/elements/Table/OrderableRow.tsx"],"sourcesContent":["import type { DraggableSyntheticListeners } from '@dnd-kit/core'\nimport type { Column } from 'payload'\nimport type { HTMLAttributes, Ref } from 'react'\n\nexport type Props = {\n readonly cellMap: Record<string, number>\n readonly columns: Column[]\n readonly dragAttributes?: HTMLAttributes<unknown>\n readonly dragListeners?: DraggableSyntheticListeners\n readonly ref?: Ref<HTMLTableRowElement>\n readonly rowId: number | string\n} & HTMLAttributes<HTMLTableRowElement>\n\nexport const OrderableRow = ({\n cellMap,\n columns,\n dragAttributes = {},\n dragListeners = {},\n rowId,\n ...rest\n}: Props) => (\n <tr {...rest}>\n {columns.map((col, colIndex) => {\n const { accessor } = col\n\n // Use the cellMap to find which index in the renderedCells to use\n const cell = col.renderedCells[cellMap[rowId]]\n\n // For drag handles, wrap in div with drag attributes\n if (accessor === '_dragHandle') {\n return (\n <td className={`cell-${accessor}`} key={colIndex}>\n <div {...dragAttributes} {...
|
|
1
|
+
{"version":3,"file":"OrderableRow.js","names":["OrderableRow","cellMap","columns","dragAttributes","dragListeners","isOrderable","onDisabledDragAttempt","rowId","rest","_jsx","map","col","colIndex","accessor","cell","renderedCells","dragHandleListeners","onKeyDown","event","code","preventDefault","className","isLinkedColumn","filter","Boolean","join"],"sources":["../../../src/elements/Table/OrderableRow.tsx"],"sourcesContent":["import type { DraggableSyntheticListeners } from '@dnd-kit/core'\nimport type { Column } from 'payload'\nimport type { HTMLAttributes, KeyboardEvent, Ref } from 'react'\n\nexport type Props = {\n readonly cellMap: Record<string, number>\n readonly columns: Column[]\n readonly dragAttributes?: HTMLAttributes<unknown>\n readonly dragListeners?: DraggableSyntheticListeners\n readonly isOrderable?: boolean\n readonly onDisabledDragAttempt?: () => void\n readonly ref?: Ref<HTMLTableRowElement>\n readonly rowId: number | string\n} & HTMLAttributes<HTMLTableRowElement>\n\nexport const OrderableRow = ({\n cellMap,\n columns,\n dragAttributes = {},\n dragListeners = {},\n isOrderable = true,\n onDisabledDragAttempt,\n rowId,\n ...rest\n}: Props) => (\n <tr {...rest}>\n {columns.map((col, colIndex) => {\n const { accessor } = col\n\n // Use the cellMap to find which index in the renderedCells to use\n const cell = col.renderedCells[cellMap[rowId]]\n\n // For drag handles, wrap in div with drag attributes\n if (accessor === '_dragHandle') {\n // When not orderable, dnd-kit's own drag listeners are disabled, so pressing the keys\n // it would normally use to start a drag does nothing silently. Intercept them here to\n // tell the user why instead.\n const dragHandleListeners = {\n ...dragListeners,\n onKeyDown: (event: KeyboardEvent) => {\n if (!isOrderable && (event.code === 'Space' || event.code === 'Enter')) {\n event.preventDefault()\n onDisabledDragAttempt?.()\n return\n }\n\n dragListeners?.onKeyDown?.(event)\n },\n }\n\n return (\n <td className={`cell-${accessor}`} key={colIndex}>\n <div {...dragAttributes} {...dragHandleListeners}>\n {cell}\n </div>\n </td>\n )\n }\n\n return (\n <td\n className={[`cell-${accessor}`, col.isLinkedColumn && 'cell--linked']\n .filter(Boolean)\n .join(' ')}\n key={colIndex}\n >\n {cell}\n </td>\n )\n })}\n </tr>\n)\n"],"mappings":";AAeA,OAAO,MAAMA,YAAA,GAAeA,CAAC;EAC3BC,OAAO;EACPC,OAAO;EACPC,cAAA,GAAiB,CAAC,CAAC;EACnBC,aAAA,GAAgB,CAAC,CAAC;EAClBC,WAAA,GAAc,IAAI;EAClBC,qBAAqB;EACrBC,KAAK;EACL,GAAGC;AAAA,CACG,kBACNC,IAAA,CAAC;EAAI,GAAGD,IAAI;YACTN,OAAA,CAAQQ,GAAG,CAAC,CAACC,GAAA,EAAKC,QAAA;IACjB,MAAM;MAAEC;IAAQ,CAAE,GAAGF,GAAA;IAErB;IACA,MAAMG,IAAA,GAAOH,GAAA,CAAII,aAAa,CAACd,OAAO,CAACM,KAAA,CAAM,CAAC;IAE9C;IACA,IAAIM,QAAA,KAAa,eAAe;MAC9B;MACA;MACA;MACA,MAAMG,mBAAA,GAAsB;QAC1B,GAAGZ,aAAa;QAChBa,SAAA,EAAYC,KAAA;UACV,IAAI,CAACb,WAAA,KAAgBa,KAAA,CAAMC,IAAI,KAAK,WAAWD,KAAA,CAAMC,IAAI,KAAK,OAAM,GAAI;YACtED,KAAA,CAAME,cAAc;YACpBd,qBAAA;YACA;UACF;UAEAF,aAAA,EAAea,SAAA,GAAYC,KAAA;QAC7B;MACF;MAEA,oBACET,IAAA,CAAC;QAAGY,SAAA,EAAW,QAAQR,QAAA,EAAU;kBAC/B,aAAAJ,IAAA,CAAC;UAAK,GAAGN,cAAc;UAAG,GAAGa,mBAAmB;oBAC7CF;;SAFmCF,QAAA;IAM5C;IAEA,oBACEH,IAAA,CAAC;MACCY,SAAA,EAAW,CAAC,QAAQR,QAAA,EAAU,EAAEF,GAAA,CAAIW,cAAc,IAAI,eAAe,CAClEC,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;gBAGPX;OAFIF,QAAA;EAKX","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderableTable.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/OrderableTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAyB,MAAM,SAAS,CAAA;AAEpF,OAAO,aAAa,CAAA;AAIpB,OAAO,KAA8B,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"OrderableTable.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/OrderableTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAyB,MAAM,SAAS,CAAA;AAEpF,OAAO,aAAa,CAAA;AAIpB,OAAO,KAA8B,MAAM,OAAO,CAAA;AAiBlD,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtC,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAA;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAgN1C,CAAA"}
|
|
@@ -9,11 +9,14 @@ import { toast } from 'sonner';
|
|
|
9
9
|
import { useConfig } from '../../providers/Config/index.js';
|
|
10
10
|
import { useListQuery } from '../../providers/ListQuery/index.js';
|
|
11
11
|
import { useLocale } from '../../providers/Locale/index.js';
|
|
12
|
+
import { useTranslation } from '../../providers/Translation/index.js';
|
|
12
13
|
import { DraggableSortableItem } from '../DraggableSortable/DraggableSortableItem/index.js';
|
|
13
14
|
import { DraggableSortable } from '../DraggableSortable/index.js';
|
|
14
15
|
import { OrderableRow } from './OrderableRow.js';
|
|
15
16
|
import { OrderableRowDragPreview } from './OrderableRowDragPreview.js';
|
|
16
17
|
const baseClass = 'table';
|
|
18
|
+
// A stable id so repeated attempts (e.g. holding Space) update the same toast instead of stacking new ones
|
|
19
|
+
const mustSortByOrderToastId = 'orderable-table-must-sort-by-order';
|
|
17
20
|
export const OrderableTable = ({
|
|
18
21
|
appearance = 'default',
|
|
19
22
|
BeforeTable,
|
|
@@ -32,8 +35,12 @@ export const OrderableTable = ({
|
|
|
32
35
|
const {
|
|
33
36
|
code: localeCode
|
|
34
37
|
} = useLocale();
|
|
38
|
+
const {
|
|
39
|
+
t
|
|
40
|
+
} = useTranslation();
|
|
35
41
|
// Use the data from ListQueryProvider if available, otherwise use the props
|
|
36
42
|
const serverData = listQueryData?.docs || initialData;
|
|
43
|
+
const isOrderable = query.sort === orderableFieldName || query.sort === `-${orderableFieldName}`;
|
|
37
44
|
// Local state to track the current order of rows
|
|
38
45
|
const [localData, setLocalData] = useState(serverData);
|
|
39
46
|
// id -> index for each column
|
|
@@ -54,8 +61,10 @@ export const OrderableTable = ({
|
|
|
54
61
|
moveFromIndex,
|
|
55
62
|
moveToIndex
|
|
56
63
|
}) => {
|
|
57
|
-
if (
|
|
58
|
-
toast.warning('
|
|
64
|
+
if (!isOrderable) {
|
|
65
|
+
toast.warning(t('general:sortByOrderToReorder'), {
|
|
66
|
+
id: mustSortByOrderToastId
|
|
67
|
+
});
|
|
59
68
|
setDragActiveRowId(undefined);
|
|
60
69
|
return;
|
|
61
70
|
}
|
|
@@ -127,6 +136,11 @@ export const OrderableTable = ({
|
|
|
127
136
|
}) => {
|
|
128
137
|
setDragActiveRowId(id);
|
|
129
138
|
};
|
|
139
|
+
const handleDisabledDragAttempt = () => {
|
|
140
|
+
toast.warning(t('general:sortByOrderToReorder'), {
|
|
141
|
+
id: mustSortByOrderToastId
|
|
142
|
+
});
|
|
143
|
+
};
|
|
130
144
|
const rowIds = localData.map(row => row.id ?? row._id);
|
|
131
145
|
return /*#__PURE__*/_jsxs("div", {
|
|
132
146
|
className: [baseClass, appearance && `${baseClass}--appearance-${appearance}`].filter(Boolean).join(' '),
|
|
@@ -146,6 +160,7 @@ export const OrderableTable = ({
|
|
|
146
160
|
})
|
|
147
161
|
}), /*#__PURE__*/_jsx("tbody", {
|
|
148
162
|
children: localData.map((row_0, rowIndex) => /*#__PURE__*/_jsx(DraggableSortableItem, {
|
|
163
|
+
disabled: !isOrderable,
|
|
149
164
|
id: rowIds[rowIndex],
|
|
150
165
|
children: ({
|
|
151
166
|
attributes,
|
|
@@ -160,6 +175,8 @@ export const OrderableTable = ({
|
|
|
160
175
|
columns: activeColumns,
|
|
161
176
|
dragAttributes: attributes,
|
|
162
177
|
dragListeners: listeners,
|
|
178
|
+
isOrderable: isOrderable,
|
|
179
|
+
onDisabledDragAttempt: handleDisabledDragAttempt,
|
|
163
180
|
ref: setNodeRef,
|
|
164
181
|
rowId: row_0.id ?? row_0._id,
|
|
165
182
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderableTable.js","names":["DragOverlay","formatAdminURL","React","useEffect","useState","toast","useConfig","useListQuery","useLocale","DraggableSortableItem","DraggableSortable","OrderableRow","OrderableRowDragPreview","baseClass","OrderableTable","appearance","BeforeTable","collection","columns","data","initialData","config","listQueryData","orderableFieldName","query","code","localeCode","serverData","docs","localData","setLocalData","cellMap","setCellMap","dragActiveRowId","setDragActiveRowId","Object","fromEntries","map","item","index","String","id","_id","activeColumns","filter","col","active","includes","accessor","length","_jsx","handleDragEnd","moveFromIndex","moveToIndex","sort","warning","undefined","movedId","newBeforeRow","newAfterRow","previousData","currentData","newData","splice","target","key","newKeyWillBe","jsonBody","collectionSlug","slug","docsToMove","response","fetch","apiRoute","routes","api","path","body","JSON","stringify","credentials","headers","method","status","Error","ok","json","err","error","message","handleDragStart","rowIds","row","_jsxs","className","Boolean","join","ids","onDragEnd","onDragStart","cellPadding","cellSpacing","i","Heading","rowIndex","children","attributes","isDragging","listeners","setNodeRef","transform","transition","dragAttributes","dragListeners","ref","rowId","style","opacity"],"sources":["../../../src/elements/Table/OrderableTable.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig, Column, OrderableEndpointBody } from 'payload'\n\nimport './index.css'\n\nimport { DragOverlay } from '@dnd-kit/core'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useListQuery } from '../../providers/ListQuery/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { DraggableSortableItem } from '../DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../DraggableSortable/index.js'\nimport { OrderableRow } from './OrderableRow.js'\nimport { OrderableRowDragPreview } from './OrderableRowDragPreview.js'\n\nconst baseClass = 'table'\n\nexport type Props = {\n readonly appearance?: 'condensed' | 'default'\n readonly BeforeTable?: React.ReactNode\n readonly collection: ClientCollectionConfig\n readonly columns?: Column[]\n readonly data: Record<string, unknown>[]\n readonly heading?: React.ReactNode\n}\n\nexport const OrderableTable: React.FC<Props> = ({\n appearance = 'default',\n BeforeTable,\n collection,\n columns,\n data: initialData,\n}) => {\n const { config } = useConfig()\n const { data: listQueryData, orderableFieldName, query } = useListQuery()\n const { code: localeCode } = useLocale()\n // Use the data from ListQueryProvider if available, otherwise use the props\n const serverData = listQueryData?.docs || initialData\n\n // Local state to track the current order of rows\n const [localData, setLocalData] = useState(serverData)\n\n // id -> index for each column\n const [cellMap, setCellMap] = useState<Record<string, number>>({})\n\n const [dragActiveRowId, setDragActiveRowId] = useState<number | string | undefined>()\n\n // Update local data when server data changes\n useEffect(() => {\n setLocalData(serverData)\n setCellMap(\n Object.fromEntries(serverData.map((item, index) => [String(item.id ?? item._id), index])),\n )\n }, [serverData])\n\n const activeColumns = columns?.filter((col) => col?.active)\n\n if (\n !activeColumns ||\n activeColumns.filter((col) => !['_dragHandle', '_select'].includes(col.accessor)).length === 0\n ) {\n return <div>No columns selected</div>\n }\n\n const handleDragEnd = async ({ moveFromIndex, moveToIndex }) => {\n if (query.sort !== orderableFieldName && query.sort !== `-${orderableFieldName}`) {\n toast.warning('To reorder the rows you must first sort them by the \"Order\" column')\n setDragActiveRowId(undefined)\n return\n }\n\n if (moveFromIndex === moveToIndex) {\n setDragActiveRowId(undefined)\n return\n }\n\n const movedId = localData[moveFromIndex].id ?? localData[moveFromIndex]._id\n const newBeforeRow =\n moveToIndex > moveFromIndex ? localData[moveToIndex] : localData[moveToIndex - 1]\n const newAfterRow =\n moveToIndex > moveFromIndex ? localData[moveToIndex + 1] : localData[moveToIndex]\n\n // Store the original data for rollback\n const previousData = [...localData]\n\n // Optimisitc update of local state to reorder the rows\n setLocalData((currentData) => {\n const newData = [...currentData]\n // Update the rendered cell for the moved row to show \"pending\"\n newData[moveFromIndex][orderableFieldName] = `pending`\n // Move the item in the array\n newData.splice(moveToIndex, 0, newData.splice(moveFromIndex, 1)[0])\n return newData\n })\n\n try {\n const target: OrderableEndpointBody['target'] = newBeforeRow\n ? {\n id: newBeforeRow.id ?? newBeforeRow._id,\n key: newBeforeRow[orderableFieldName],\n }\n : {\n id: newAfterRow.id ?? newAfterRow._id,\n key: newAfterRow[orderableFieldName],\n }\n\n const newKeyWillBe =\n (newBeforeRow && query.sort === orderableFieldName) ||\n (!newBeforeRow && query.sort === `-${orderableFieldName}`)\n ? 'greater'\n : 'less'\n\n const jsonBody: OrderableEndpointBody = {\n collectionSlug: collection.slug,\n docsToMove: [movedId],\n newKeyWillBe,\n orderableFieldName,\n target,\n }\n\n const response = await fetch(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/reorder?locale=${localeCode}`,\n }),\n {\n body: JSON.stringify(jsonBody),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n },\n )\n\n if (response.status === 403) {\n throw new Error('You do not have permission to reorder these rows')\n }\n\n if (!response.ok) {\n throw new Error(\n 'Failed to reorder. This can happen if you reorder several rows too quickly. Please try again.',\n )\n }\n\n if (response.status === 200 && (await response.json())['message'] === 'initial migration') {\n throw new Error(\n 'You have enabled \"orderable\" on a collection with existing documents' +\n 'and this is the first time you have sorted documents. We have run an automatic migration ' +\n 'to add an initial order to the documents. Please refresh the page and try again.',\n )\n }\n } catch (err) {\n const error = err instanceof Error ? err.message : String(err)\n // Rollback to previous state if the request fails\n setLocalData(previousData)\n toast.error(error)\n } finally {\n setDragActiveRowId(undefined)\n }\n }\n\n const handleDragStart = ({ id }) => {\n setDragActiveRowId(id)\n }\n\n const rowIds = localData.map((row) => row.id ?? row._id)\n\n return (\n <div\n className={[baseClass, appearance && `${baseClass}--appearance-${appearance}`]\n .filter(Boolean)\n .join(' ')}\n >\n {BeforeTable}\n <DraggableSortable ids={rowIds} onDragEnd={handleDragEnd} onDragStart={handleDragStart}>\n <table cellPadding=\"0\" cellSpacing=\"0\">\n <thead>\n <tr>\n {activeColumns.map((col, i) => (\n <th id={`heading-${col.accessor}`} key={i}>\n {col.Heading}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {localData.map((row, rowIndex) => (\n <DraggableSortableItem id={rowIds[rowIndex]} key={rowIds[rowIndex]}>\n {({ attributes, isDragging, listeners, setNodeRef, transform, transition }) => (\n <OrderableRow\n cellMap={cellMap}\n className={`row-${rowIndex + 1}`}\n columns={activeColumns}\n dragAttributes={attributes}\n dragListeners={listeners}\n ref={setNodeRef}\n rowId={row.id ?? row._id}\n style={{\n opacity: isDragging ? 0 : 1,\n transform,\n transition,\n }}\n />\n )}\n </DraggableSortableItem>\n ))}\n </tbody>\n </table>\n\n <DragOverlay>\n <OrderableRowDragPreview\n className={[baseClass, `${baseClass}--drag-preview`].join(' ')}\n rowId={dragActiveRowId}\n >\n <OrderableRow cellMap={cellMap} columns={activeColumns} rowId={dragActiveRowId} />\n </OrderableRowDragPreview>\n </DragOverlay>\n </DraggableSortable>\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAIA,OAAO;AAEP,SAASA,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,SAAS,EAAEC,QAAQ,QAAQ;AAC3C,SAASC,KAAK,QAAQ;AAEtB,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,YAAY,QAAQ;AAC7B,SAASC,uBAAuB,QAAQ;AAExC,MAAMC,SAAA,GAAY;AAWlB,OAAO,MAAMC,cAAA,GAAkCA,CAAC;EAC9CC,UAAA,GAAa,SAAS;EACtBC,WAAW;EACXC,UAAU;EACVC,OAAO;EACPC,IAAA,EAAMC;AAAW,CAClB;EACC,MAAM;IAAEC;EAAM,CAAE,GAAGf,SAAA;EACnB,MAAM;IAAEa,IAAA,EAAMG,aAAa;IAAEC,kBAAkB;IAAEC;EAAK,CAAE,GAAGjB,YAAA;EAC3D,MAAM;IAAEkB,IAAA,EAAMC;EAAU,CAAE,GAAGlB,SAAA;EAC7B;EACA,MAAMmB,UAAA,GAAaL,aAAA,EAAeM,IAAA,IAAQR,WAAA;EAE1C;EACA,MAAM,CAACS,SAAA,EAAWC,YAAA,CAAa,GAAG1B,QAAA,CAASuB,UAAA;EAE3C;EACA,MAAM,CAACI,OAAA,EAASC,UAAA,CAAW,GAAG5B,QAAA,CAAiC,CAAC;EAEhE,MAAM,CAAC6B,eAAA,EAAiBC,kBAAA,CAAmB,GAAG9B,QAAA;EAE9C;EACAD,SAAA,CAAU;IACR2B,YAAA,C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yD,CAAA,kBACvBpD,IAAA,CAAC;cAAGT,EAAA,EAAI,WAAWI,KAAA,CAAIG,QAAQ,EAAE;wBAC9BH,KAAA,CAAI0D;eADiCD,CAAA;;yBAM9CpD,IAAA,CAAC;oBACErB,SAAA,CAAUQ,GAAG,CAAC,CAACuD,KAAA,EAAKY,QAAA,kBACnBtD,IAAA,CAACzC,qBAAA;YAAsBgC,EAAA,EAAIkD,MAAM,CAACa,QAAA,CAAS;sBACxCC,CAAC;cAAEC,UAAU;cAAEC,UAAU;cAAEC,SAAS;cAAEC,UAAU;cAAEC,SAAS;cAAEC;YAAU,CAAE,kBACxE7D,IAAA,CAACvC,YAAA;cACCoB,OAAA,EAASA,OAAA;cACT+D,SAAA,EAAW,OAAOU,QAAA,GAAW,GAAG;cAChCtF,OAAA,EAASyB,aAAA;cACTqE,cAAA,EAAgBN,UAAA;cAChBO,aAAA,EAAeL,SAAA;cACfM,GAAA,EAAKL,UAAA;cACLM,KAAA,EAAOvB,KAAA,CAAInD,EAAE,IAAImD,KAAA,CAAIlD,GAAG;cACxB0E,KAAA,EAAO;gBACLC,OAAA,EAASV,UAAA,GAAa,IAAI;gBAC1BG,SAAA;gBACAC;cACF;;aAd4CpB,MAAM,CAACa,QAAA,CAAS;;uBAsBxEtD,IAAA,CAAClD,WAAA;kBACC,aAAAkD,IAAA,CAACtC,uBAAA;UACCkF,SAAA,EAAW,CAACjF,SAAA,EAAW,GAAGA,SAAA,gBAAyB,CAAC,CAACmF,IAAI,CAAC;UAC1DmB,KAAA,EAAOlF,eAAA;oBAEP,aAAAiB,IAAA,CAACvC,YAAA;YAAaoB,OAAA,EAASA,OAAA;YAASb,OAAA,EAASyB,aAAA;YAAewE,KAAA,EAAOlF;;;;;;AAM3E","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"OrderableTable.js","names":["DragOverlay","formatAdminURL","React","useEffect","useState","toast","useConfig","useListQuery","useLocale","useTranslation","DraggableSortableItem","DraggableSortable","OrderableRow","OrderableRowDragPreview","baseClass","mustSortByOrderToastId","OrderableTable","appearance","BeforeTable","collection","columns","data","initialData","config","listQueryData","orderableFieldName","query","code","localeCode","t","serverData","docs","isOrderable","sort","localData","setLocalData","cellMap","setCellMap","dragActiveRowId","setDragActiveRowId","Object","fromEntries","map","item","index","String","id","_id","activeColumns","filter","col","active","includes","accessor","length","_jsx","handleDragEnd","moveFromIndex","moveToIndex","warning","undefined","movedId","newBeforeRow","newAfterRow","previousData","currentData","newData","splice","target","key","newKeyWillBe","jsonBody","collectionSlug","slug","docsToMove","response","fetch","apiRoute","routes","api","path","body","JSON","stringify","credentials","headers","method","status","Error","ok","json","err","error","message","handleDragStart","handleDisabledDragAttempt","rowIds","row","_jsxs","className","Boolean","join","ids","onDragEnd","onDragStart","cellPadding","cellSpacing","i","Heading","rowIndex","disabled","children","attributes","isDragging","listeners","setNodeRef","transform","transition","dragAttributes","dragListeners","onDisabledDragAttempt","ref","rowId","style","opacity"],"sources":["../../../src/elements/Table/OrderableTable.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig, Column, OrderableEndpointBody } from 'payload'\n\nimport './index.css'\n\nimport { DragOverlay } from '@dnd-kit/core'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useListQuery } from '../../providers/ListQuery/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { DraggableSortableItem } from '../DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../DraggableSortable/index.js'\nimport { OrderableRow } from './OrderableRow.js'\nimport { OrderableRowDragPreview } from './OrderableRowDragPreview.js'\n\nconst baseClass = 'table'\n\n// A stable id so repeated attempts (e.g. holding Space) update the same toast instead of stacking new ones\nconst mustSortByOrderToastId = 'orderable-table-must-sort-by-order'\n\nexport type Props = {\n readonly appearance?: 'condensed' | 'default'\n readonly BeforeTable?: React.ReactNode\n readonly collection: ClientCollectionConfig\n readonly columns?: Column[]\n readonly data: Record<string, unknown>[]\n readonly heading?: React.ReactNode\n}\n\nexport const OrderableTable: React.FC<Props> = ({\n appearance = 'default',\n BeforeTable,\n collection,\n columns,\n data: initialData,\n}) => {\n const { config } = useConfig()\n const { data: listQueryData, orderableFieldName, query } = useListQuery()\n const { code: localeCode } = useLocale()\n const { t } = useTranslation()\n // Use the data from ListQueryProvider if available, otherwise use the props\n const serverData = listQueryData?.docs || initialData\n\n const isOrderable = query.sort === orderableFieldName || query.sort === `-${orderableFieldName}`\n\n // Local state to track the current order of rows\n const [localData, setLocalData] = useState(serverData)\n\n // id -> index for each column\n const [cellMap, setCellMap] = useState<Record<string, number>>({})\n\n const [dragActiveRowId, setDragActiveRowId] = useState<number | string | undefined>()\n\n // Update local data when server data changes\n useEffect(() => {\n setLocalData(serverData)\n setCellMap(\n Object.fromEntries(serverData.map((item, index) => [String(item.id ?? item._id), index])),\n )\n }, [serverData])\n\n const activeColumns = columns?.filter((col) => col?.active)\n\n if (\n !activeColumns ||\n activeColumns.filter((col) => !['_dragHandle', '_select'].includes(col.accessor)).length === 0\n ) {\n return <div>No columns selected</div>\n }\n\n const handleDragEnd = async ({ moveFromIndex, moveToIndex }) => {\n if (!isOrderable) {\n toast.warning(t('general:sortByOrderToReorder'), { id: mustSortByOrderToastId })\n setDragActiveRowId(undefined)\n return\n }\n\n if (moveFromIndex === moveToIndex) {\n setDragActiveRowId(undefined)\n return\n }\n\n const movedId = localData[moveFromIndex].id ?? localData[moveFromIndex]._id\n const newBeforeRow =\n moveToIndex > moveFromIndex ? localData[moveToIndex] : localData[moveToIndex - 1]\n const newAfterRow =\n moveToIndex > moveFromIndex ? localData[moveToIndex + 1] : localData[moveToIndex]\n\n // Store the original data for rollback\n const previousData = [...localData]\n\n // Optimisitc update of local state to reorder the rows\n setLocalData((currentData) => {\n const newData = [...currentData]\n // Update the rendered cell for the moved row to show \"pending\"\n newData[moveFromIndex][orderableFieldName] = `pending`\n // Move the item in the array\n newData.splice(moveToIndex, 0, newData.splice(moveFromIndex, 1)[0])\n return newData\n })\n\n try {\n const target: OrderableEndpointBody['target'] = newBeforeRow\n ? {\n id: newBeforeRow.id ?? newBeforeRow._id,\n key: newBeforeRow[orderableFieldName],\n }\n : {\n id: newAfterRow.id ?? newAfterRow._id,\n key: newAfterRow[orderableFieldName],\n }\n\n const newKeyWillBe =\n (newBeforeRow && query.sort === orderableFieldName) ||\n (!newBeforeRow && query.sort === `-${orderableFieldName}`)\n ? 'greater'\n : 'less'\n\n const jsonBody: OrderableEndpointBody = {\n collectionSlug: collection.slug,\n docsToMove: [movedId],\n newKeyWillBe,\n orderableFieldName,\n target,\n }\n\n const response = await fetch(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/reorder?locale=${localeCode}`,\n }),\n {\n body: JSON.stringify(jsonBody),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n },\n )\n\n if (response.status === 403) {\n throw new Error('You do not have permission to reorder these rows')\n }\n\n if (!response.ok) {\n throw new Error(\n 'Failed to reorder. This can happen if you reorder several rows too quickly. Please try again.',\n )\n }\n\n if (response.status === 200 && (await response.json())['message'] === 'initial migration') {\n throw new Error(\n 'You have enabled \"orderable\" on a collection with existing documents' +\n 'and this is the first time you have sorted documents. We have run an automatic migration ' +\n 'to add an initial order to the documents. Please refresh the page and try again.',\n )\n }\n } catch (err) {\n const error = err instanceof Error ? err.message : String(err)\n // Rollback to previous state if the request fails\n setLocalData(previousData)\n toast.error(error)\n } finally {\n setDragActiveRowId(undefined)\n }\n }\n\n const handleDragStart = ({ id }) => {\n setDragActiveRowId(id)\n }\n\n const handleDisabledDragAttempt = () => {\n toast.warning(t('general:sortByOrderToReorder'), { id: mustSortByOrderToastId })\n }\n\n const rowIds = localData.map((row) => row.id ?? row._id)\n\n return (\n <div\n className={[baseClass, appearance && `${baseClass}--appearance-${appearance}`]\n .filter(Boolean)\n .join(' ')}\n >\n {BeforeTable}\n <DraggableSortable ids={rowIds} onDragEnd={handleDragEnd} onDragStart={handleDragStart}>\n <table cellPadding=\"0\" cellSpacing=\"0\">\n <thead>\n <tr>\n {activeColumns.map((col, i) => (\n <th id={`heading-${col.accessor}`} key={i}>\n {col.Heading}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {localData.map((row, rowIndex) => (\n <DraggableSortableItem\n disabled={!isOrderable}\n id={rowIds[rowIndex]}\n key={rowIds[rowIndex]}\n >\n {({ attributes, isDragging, listeners, setNodeRef, transform, transition }) => (\n <OrderableRow\n cellMap={cellMap}\n className={`row-${rowIndex + 1}`}\n columns={activeColumns}\n dragAttributes={attributes}\n dragListeners={listeners}\n isOrderable={isOrderable}\n onDisabledDragAttempt={handleDisabledDragAttempt}\n ref={setNodeRef}\n rowId={row.id ?? row._id}\n style={{\n opacity: isDragging ? 0 : 1,\n transform,\n transition,\n }}\n />\n )}\n </DraggableSortableItem>\n ))}\n </tbody>\n </table>\n\n <DragOverlay>\n <OrderableRowDragPreview\n className={[baseClass, `${baseClass}--drag-preview`].join(' ')}\n rowId={dragActiveRowId}\n >\n <OrderableRow cellMap={cellMap} columns={activeColumns} rowId={dragActiveRowId} />\n </OrderableRowDragPreview>\n </DragOverlay>\n </DraggableSortable>\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAIA,OAAO;AAEP,SAASA,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,SAAS,EAAEC,QAAQ,QAAQ;AAC3C,SAASC,KAAK,QAAQ;AAEtB,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,YAAY,QAAQ;AAC7B,SAASC,uBAAuB,QAAQ;AAExC,MAAMC,SAAA,GAAY;AAElB;AACA,MAAMC,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AA,CAAS;sBAGnBE,CAAC;cAAEC,UAAU;cAAEC,UAAU;cAAEC,SAAS;cAAEC,UAAU;cAAEC,SAAS;cAAEC;YAAU,CAAE,kBACxE9D,IAAA,CAAC3C,YAAA;cACCwB,OAAA,EAASA,OAAA;cACT+D,SAAA,EAAW,OAAOU,QAAA,GAAW,GAAG;cAChCzF,OAAA,EAAS4B,aAAA;cACTsE,cAAA,EAAgBN,UAAA;cAChBO,aAAA,EAAeL,SAAA;cACflF,WAAA,EAAaA,WAAA;cACbwF,qBAAA,EAAuBzB,yBAAA;cACvB0B,GAAA,EAAKN,UAAA;cACLO,KAAA,EAAOzB,KAAA,CAAInD,EAAE,IAAImD,KAAA,CAAIlD,GAAG;cACxB4E,KAAA,EAAO;gBACLC,OAAA,EAASX,UAAA,GAAa,IAAI;gBAC1BG,SAAA;gBACAC;cACF;;aAjBCrB,MAAM,CAACa,QAAA,CAAS;;uBAyB7BtD,IAAA,CAACvD,WAAA;kBACC,aAAAuD,IAAA,CAAC1C,uBAAA;UACCsF,SAAA,EAAW,CAACrF,SAAA,EAAW,GAAGA,SAAA,gBAAyB,CAAC,CAACuF,IAAI,CAAC;UAC1DqB,KAAA,EAAOpF,eAAA;oBAEP,aAAAiB,IAAA,CAAC3C,YAAA;YAAawB,OAAA,EAASA,OAAA;YAAShB,OAAA,EAAS4B,aAAA;YAAe0E,KAAA,EAAOpF;;;;;;AAM3E","ignoreList":[]}
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
--caret-height: 7px;
|
|
5
5
|
--caret-offset: 4px;
|
|
6
6
|
--caret-border-color: var(--color-border);
|
|
7
|
-
--tooltip-x: -50%;
|
|
8
7
|
--tooltip-caret-x: 0px;
|
|
8
|
+
--tooltip-caret-y: 0px;
|
|
9
9
|
--tooltip-max-width: none;
|
|
10
10
|
|
|
11
|
+
position: fixed;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
z-index: var(--z-portal-element);
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
|
|
11
17
|
opacity: 0;
|
|
12
18
|
background-color: var(--color-bg-tooltip);
|
|
13
|
-
position: absolute;
|
|
14
|
-
z-index: 3;
|
|
15
|
-
left: 50%;
|
|
16
19
|
max-width: var(--tooltip-max-width);
|
|
17
20
|
padding: var(--spacer-1);
|
|
18
21
|
color: var(--color-text-ontooltip);
|
|
@@ -26,6 +29,11 @@
|
|
|
26
29
|
box-shadow: var(--elevation-300-tooltip);
|
|
27
30
|
visibility: hidden;
|
|
28
31
|
|
|
32
|
+
&[data-wrap] {
|
|
33
|
+
white-space: normal;
|
|
34
|
+
overflow-wrap: break-word;
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
&.field-error {
|
|
30
38
|
background-color: var(--color-bg-danger);
|
|
31
39
|
color: var(--color-text-ondanger);
|
|
@@ -51,11 +59,6 @@
|
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
.tooltip--wrap {
|
|
55
|
-
white-space: normal;
|
|
56
|
-
overflow-wrap: break-word;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
62
|
.tooltip__caret {
|
|
60
63
|
position: absolute;
|
|
61
64
|
pointer-events: none;
|
|
@@ -76,7 +79,6 @@
|
|
|
76
79
|
.tooltip--show {
|
|
77
80
|
visibility: visible;
|
|
78
81
|
opacity: 1;
|
|
79
|
-
transition: opacity 0.2s ease-in-out;
|
|
80
82
|
cursor: default;
|
|
81
83
|
}
|
|
82
84
|
|
|
@@ -94,13 +96,6 @@
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
.tooltip--position-top {
|
|
97
|
-
top: 0;
|
|
98
|
-
transform: translate3d(
|
|
99
|
-
var(--tooltip-x),
|
|
100
|
-
calc(-100% - var(--caret-height) - var(--caret-offset) + 1px),
|
|
101
|
-
0
|
|
102
|
-
);
|
|
103
|
-
|
|
104
99
|
.tooltip__caret {
|
|
105
100
|
--color-border: var(--ramp-grey-700);
|
|
106
101
|
top: calc(100% - 0.5px);
|
|
@@ -112,13 +107,6 @@
|
|
|
112
107
|
}
|
|
113
108
|
|
|
114
109
|
.tooltip--position-bottom {
|
|
115
|
-
top: 100%;
|
|
116
|
-
transform: translate3d(
|
|
117
|
-
var(--tooltip-x),
|
|
118
|
-
calc(var(--caret-height) + var(--caret-offset) - 1px),
|
|
119
|
-
0
|
|
120
|
-
);
|
|
121
|
-
|
|
122
110
|
.tooltip__caret {
|
|
123
111
|
bottom: calc(100% - 0.5px);
|
|
124
112
|
transform: rotate(180deg);
|
|
@@ -134,28 +122,21 @@
|
|
|
134
122
|
}
|
|
135
123
|
|
|
136
124
|
.tooltip--position-left {
|
|
137
|
-
top: 50%;
|
|
138
|
-
left: 0;
|
|
139
|
-
transform: translate3d(calc(-100% - var(--caret-height) - var(--caret-offset)), -50%, 0);
|
|
140
|
-
|
|
141
125
|
.tooltip__caret {
|
|
142
126
|
top: calc(50% + 0.5px);
|
|
143
127
|
left: calc(100% - 0.5px);
|
|
144
|
-
transform: translateY(calc(1 * var(--caret-width) / 2
|
|
128
|
+
transform: translateY(calc(1 * var(--caret-width) / 2 + var(--tooltip-caret-y)))
|
|
129
|
+
rotate(-90deg);
|
|
145
130
|
transform-origin: top left;
|
|
146
131
|
}
|
|
147
132
|
}
|
|
148
133
|
|
|
149
134
|
.tooltip--position-right {
|
|
150
|
-
top: 50%;
|
|
151
|
-
left: 100%;
|
|
152
|
-
transform: translate3d(calc(var(--caret-height) + var(--caret-offset)), -50%, 0);
|
|
153
|
-
|
|
154
135
|
.tooltip__caret {
|
|
155
136
|
top: calc(50% + 0.5px);
|
|
156
137
|
left: unset;
|
|
157
138
|
right: calc(100% - 0.5px);
|
|
158
|
-
transform: translateY(calc(1 * var(--caret-width) / 2)) rotate(90deg);
|
|
139
|
+
transform: translateY(calc(1 * var(--caret-width) / 2 + var(--tooltip-caret-y))) rotate(90deg);
|
|
159
140
|
transform-origin: top right;
|
|
160
141
|
}
|
|
161
142
|
}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.css';
|
|
3
|
+
type Side = 'bottom' | 'left' | 'right' | 'top';
|
|
3
4
|
export type Props = {
|
|
4
5
|
alignCaret?: 'center' | 'left' | 'right';
|
|
5
|
-
boundingRef?: React.RefObject<HTMLElement | null>;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
delay?: number;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Applied to the portaled tooltip element, so it can be located independent of its
|
|
11
|
+
* position in the DOM (e.g. by tests).
|
|
12
|
+
*/
|
|
13
|
+
id?: string;
|
|
14
|
+
position?: Side;
|
|
10
15
|
show?: boolean;
|
|
11
16
|
/**
|
|
12
|
-
*
|
|
17
|
+
* Disables adaptive placement: the tooltip always renders on `position` (or its
|
|
18
|
+
* default) instead of flipping to whichever side has room. It does not affect
|
|
19
|
+
* portaling - every tooltip is portaled to `document.body` regardless. @default false
|
|
13
20
|
*/
|
|
14
21
|
staticPositioning?: boolean;
|
|
15
22
|
};
|
|
16
23
|
export declare const Tooltip: React.FC<Props>;
|
|
24
|
+
export {};
|
|
17
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Tooltip/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoE,MAAM,OAAO,CAAA;AAGxF,OAAO,aAAa,CAAA;AAOpB,KAAK,IAAI,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;AAE/C,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAwCD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyOnC,CAAA"}
|