@j2-health/design-system 0.3.2 → 0.5.0
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 +84 -31
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/src/components/alert/Alert.cjs +12 -2
- package/dist/src/components/alert/Alert.cjs.map +1 -1
- package/dist/src/components/alert/Alert.d.ts +1 -1
- package/dist/src/components/alert/Alert.js +12 -2
- package/dist/src/components/alert/Alert.js.map +1 -1
- package/dist/src/components/alert/Alert.module.css.cjs +1 -1
- package/dist/src/components/alert/Alert.module.css.js +1 -1
- package/dist/src/components/barchart/BarChart.cjs +2 -2
- package/dist/src/components/barchart/BarChart.cjs.map +1 -1
- package/dist/src/components/barchart/BarChart.js +2 -2
- package/dist/src/components/barchart/BarChart.js.map +1 -1
- package/dist/src/components/card/Card.cjs +1 -1
- package/dist/src/components/card/Card.cjs.map +1 -1
- package/dist/src/components/card/Card.js +1 -1
- package/dist/src/components/card/Card.js.map +1 -1
- package/dist/src/components/collapse/Collapse.module.css.cjs +3 -3
- package/dist/src/components/collapse/Collapse.module.css.js +3 -3
- package/dist/src/components/drawer/Drawer.cjs +3 -1
- package/dist/src/components/drawer/Drawer.cjs.map +1 -1
- package/dist/src/components/drawer/Drawer.js +3 -1
- package/dist/src/components/drawer/Drawer.js.map +1 -1
- package/dist/src/components/form/Form.cjs +21 -4
- package/dist/src/components/form/Form.cjs.map +1 -1
- package/dist/src/components/form/Form.d.ts +10 -3
- package/dist/src/components/form/Form.js +20 -3
- package/dist/src/components/form/Form.js.map +1 -1
- package/dist/src/components/form/FormItem.cjs +42 -0
- package/dist/src/components/form/FormItem.cjs.map +1 -0
- package/dist/src/components/form/FormItem.d.ts +10 -0
- package/dist/src/components/form/FormItem.js +42 -0
- package/dist/src/components/form/FormItem.js.map +1 -0
- package/dist/src/components/form/FormItemFieldContext.cjs +8 -0
- package/dist/src/components/form/FormItemFieldContext.cjs.map +1 -0
- package/dist/src/components/form/FormItemFieldContext.d.ts +2 -0
- package/dist/src/components/form/FormItemFieldContext.js +8 -0
- package/dist/src/components/form/FormItemFieldContext.js.map +1 -0
- package/dist/src/components/form/FormikField.cjs +20 -0
- package/dist/src/components/form/FormikField.cjs.map +1 -0
- package/dist/src/components/form/FormikField.d.ts +8 -0
- package/dist/src/components/form/FormikField.js +20 -0
- package/dist/src/components/form/FormikField.js.map +1 -0
- package/dist/src/components/input/AntdInput.d.ts +77 -31
- package/dist/src/components/input/AntdSearchInput.d.ts +82 -30
- package/dist/src/components/input/Input.cjs +29 -3
- package/dist/src/components/input/Input.cjs.map +1 -1
- package/dist/src/components/input/Input.d.ts +4 -3
- package/dist/src/components/input/Input.js +29 -3
- package/dist/src/components/input/Input.js.map +1 -1
- package/dist/src/components/inputnumber/InputNumber.cjs +20 -5
- package/dist/src/components/inputnumber/InputNumber.cjs.map +1 -1
- package/dist/src/components/inputnumber/InputNumber.d.ts +4 -3
- package/dist/src/components/inputnumber/InputNumber.js +19 -4
- package/dist/src/components/inputnumber/InputNumber.js.map +1 -1
- package/dist/src/components/inputnumber/InputNumber.module.css.cjs +1 -1
- package/dist/src/components/inputnumber/InputNumber.module.css.js +1 -1
- package/dist/src/components/manageColumns/ManageColumnsItem.cjs +76 -0
- package/dist/src/components/manageColumns/ManageColumnsItem.cjs.map +1 -0
- package/dist/src/components/manageColumns/ManageColumnsItem.d.ts +7 -0
- package/dist/src/components/manageColumns/ManageColumnsItem.js +76 -0
- package/dist/src/components/manageColumns/ManageColumnsItem.js.map +1 -0
- package/dist/src/components/manageColumns/ManageColumnsPanel.cjs +79 -0
- package/dist/src/components/manageColumns/ManageColumnsPanel.cjs.map +1 -0
- package/dist/src/components/manageColumns/ManageColumnsPanel.d.ts +18 -0
- package/dist/src/components/manageColumns/ManageColumnsPanel.js +79 -0
- package/dist/src/components/manageColumns/ManageColumnsPanel.js.map +1 -0
- package/dist/src/components/manageColumns/SelectAll.cjs +27 -0
- package/dist/src/components/manageColumns/SelectAll.cjs.map +1 -0
- package/dist/src/components/manageColumns/SelectAll.d.ts +15 -0
- package/dist/src/components/manageColumns/SelectAll.js +27 -0
- package/dist/src/components/manageColumns/SelectAll.js.map +1 -0
- package/dist/src/components/manageColumns/index.d.ts +4 -0
- package/dist/src/components/modal/Modal.cjs +0 -1
- package/dist/src/components/modal/Modal.cjs.map +1 -1
- package/dist/src/components/modal/Modal.js +0 -1
- package/dist/src/components/modal/Modal.js.map +1 -1
- package/dist/src/components/notification/Notification.module.css.cjs +1 -1
- package/dist/src/components/notification/Notification.module.css.js +1 -1
- package/dist/src/components/notification/useNotification.cjs +5 -2
- package/dist/src/components/notification/useNotification.cjs.map +1 -1
- package/dist/src/components/notification/useNotification.js +5 -2
- package/dist/src/components/notification/useNotification.js.map +1 -1
- package/dist/src/components/pagination/Pagination.cjs +2 -0
- package/dist/src/components/pagination/Pagination.cjs.map +1 -1
- package/dist/src/components/pagination/Pagination.js +2 -0
- package/dist/src/components/pagination/Pagination.js.map +1 -1
- package/dist/src/components/popover/Popover.cjs +3 -1
- package/dist/src/components/popover/Popover.cjs.map +1 -1
- package/dist/src/components/popover/Popover.d.ts +1 -1
- package/dist/src/components/popover/Popover.js +3 -1
- package/dist/src/components/popover/Popover.js.map +1 -1
- package/dist/src/components/popover/Popover.module.css.cjs +9 -9
- package/dist/src/components/popover/Popover.module.css.js +9 -9
- package/dist/src/components/select/Select.cjs +29 -13
- package/dist/src/components/select/Select.cjs.map +1 -1
- package/dist/src/components/select/Select.js +29 -13
- package/dist/src/components/select/Select.js.map +1 -1
- package/dist/src/components/select/SummarizedSelect.cjs.map +1 -1
- package/dist/src/components/select/SummarizedSelect.js.map +1 -1
- package/dist/src/components/select/SummarizedSelect.module.css.cjs +8 -8
- package/dist/src/components/select/SummarizedSelect.module.css.js +8 -8
- package/dist/src/components/steps/Steps.cjs +14 -4
- package/dist/src/components/steps/Steps.cjs.map +1 -1
- package/dist/src/components/steps/Steps.d.ts +3 -3
- package/dist/src/components/steps/Steps.js +14 -4
- package/dist/src/components/steps/Steps.js.map +1 -1
- package/dist/src/components/table/Table.cjs +1 -1
- package/dist/src/components/table/Table.cjs.map +1 -1
- package/dist/src/components/table/Table.d.ts +4 -1
- package/dist/src/components/table/Table.js +1 -1
- package/dist/src/components/table/Table.js.map +1 -1
- package/dist/src/components/tag/Tag.cjs +4 -0
- package/dist/src/components/tag/Tag.cjs.map +1 -1
- package/dist/src/components/tag/Tag.d.ts +1 -1
- package/dist/src/components/tag/Tag.js +4 -0
- package/dist/src/components/tag/Tag.js.map +1 -1
- package/dist/src/components/vennDiagram/VennDiagram.cjs +1 -1
- package/dist/src/components/vennDiagram/VennDiagram.cjs.map +1 -1
- package/dist/src/components/vennDiagram/VennDiagram.js +1 -1
- package/dist/src/components/vennDiagram/VennDiagram.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/style.css +92 -78
- package/dist/tailwind.cjs +4 -0
- package/dist/tailwind.cjs.map +1 -1
- package/dist/tailwind.config.d.ts +6 -0
- package/dist/tailwind.js +4 -0
- package/dist/tailwind.js.map +1 -1
- package/package.json +38 -26
- package/src/stylesheets/base.css +322 -0
- package/src/stylesheets/fonts.css +1 -0
- package/src/stylesheets/index.css +3 -327
- package/src/stylesheets/tailwind-v3.css +3 -0
- package/src/stylesheets/tailwind.css +4 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from "react";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import { DotsSixIcon } from "@phosphor-icons/react";
|
|
5
|
+
import { useSortable } from "@dnd-kit/sortable";
|
|
6
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
7
|
+
import { Checkbox } from "../checkbox/Checkbox.js";
|
|
8
|
+
const ManageColumnsItem = memo(function ManageColumnsItem2({
|
|
9
|
+
id,
|
|
10
|
+
label,
|
|
11
|
+
visible,
|
|
12
|
+
pinned,
|
|
13
|
+
onToggle
|
|
14
|
+
}) {
|
|
15
|
+
const handleToggle = useCallback(() => onToggle(id), [onToggle, id]);
|
|
16
|
+
const {
|
|
17
|
+
attributes,
|
|
18
|
+
listeners,
|
|
19
|
+
setNodeRef,
|
|
20
|
+
transform,
|
|
21
|
+
transition,
|
|
22
|
+
isDragging
|
|
23
|
+
} = useSortable({
|
|
24
|
+
id,
|
|
25
|
+
// Boolean shorthand only disables dragging, not dropping onto a pinned row.
|
|
26
|
+
disabled: { draggable: pinned, droppable: pinned }
|
|
27
|
+
});
|
|
28
|
+
const style = {
|
|
29
|
+
transform: CSS.Transform.toString(transform),
|
|
30
|
+
transition
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
ref: setNodeRef,
|
|
36
|
+
style,
|
|
37
|
+
className: cx(
|
|
38
|
+
"flex items-center justify-between gap-2 py-1.5 pl-2 -ml-2 bg-white rounded",
|
|
39
|
+
"has-[button:hover]:bg-j2-gray-2",
|
|
40
|
+
isDragging && "shadow-md z-10 relative",
|
|
41
|
+
pinned && "opacity-50"
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Checkbox,
|
|
46
|
+
{
|
|
47
|
+
checked: visible,
|
|
48
|
+
disabled: pinned,
|
|
49
|
+
onChange: pinned ? void 0 : handleToggle,
|
|
50
|
+
className: cx(
|
|
51
|
+
// No gap: antd's own .ant-checkbox-label already pads before children.
|
|
52
|
+
"flex items-center flex-1 min-w-0",
|
|
53
|
+
pinned ? "cursor-not-allowed" : "cursor-pointer"
|
|
54
|
+
),
|
|
55
|
+
children: /* @__PURE__ */ jsx("span", { className: "truncate text-j2-lg text-j2-text", title: label, children: label })
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
!pinned && /* @__PURE__ */ jsx(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
...attributes,
|
|
63
|
+
...listeners,
|
|
64
|
+
"aria-label": `Drag to reorder ${label}`,
|
|
65
|
+
className: "p-1 text-j2-text cursor-grab active:cursor-grabbing",
|
|
66
|
+
children: /* @__PURE__ */ jsx(DotsSixIcon, { size: 16, weight: "bold", className: "rotate-90" })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
export {
|
|
74
|
+
ManageColumnsItem
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=ManageColumnsItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManageColumnsItem.js","sources":["../../../../src/components/manageColumns/ManageColumnsItem.tsx"],"sourcesContent":["import { memo, useCallback } from 'react'\nimport cx from 'classnames'\nimport { DotsSixIcon } from '@phosphor-icons/react'\nimport { useSortable } from '@dnd-kit/sortable'\nimport { CSS } from '@dnd-kit/utilities'\n\nimport { Checkbox } from '../checkbox'\n\nexport const ManageColumnsItem = memo(function ManageColumnsItem({\n id,\n label,\n visible,\n pinned,\n onToggle,\n}: {\n id: string\n label: string\n visible: boolean\n pinned: boolean\n onToggle: (id: string) => void\n}) {\n const handleToggle = useCallback(() => onToggle(id), [onToggle, id])\n\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n // Boolean shorthand only disables dragging, not dropping onto a pinned row.\n disabled: { draggable: pinned, droppable: pinned },\n })\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n }\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cx(\n 'flex items-center justify-between gap-2 py-1.5 pl-2 -ml-2 bg-white rounded',\n 'has-[button:hover]:bg-j2-gray-2',\n isDragging && 'shadow-md z-10 relative',\n pinned && 'opacity-50'\n )}\n >\n <Checkbox\n checked={visible}\n disabled={pinned}\n onChange={pinned ? undefined : handleToggle}\n className={cx(\n // No gap: antd's own .ant-checkbox-label already pads before children.\n 'flex items-center flex-1 min-w-0',\n pinned ? 'cursor-not-allowed' : 'cursor-pointer'\n )}\n >\n <span className=\"truncate text-j2-lg text-j2-text\" title={label}>\n {label}\n </span>\n </Checkbox>\n {!pinned && (\n <button\n type=\"button\"\n {...attributes}\n {...listeners}\n aria-label={`Drag to reorder ${label}`}\n className=\"p-1 text-j2-text cursor-grab active:cursor-grabbing\"\n >\n <DotsSixIcon size={16} weight=\"bold\" className=\"rotate-90\" />\n </button>\n )}\n </div>\n )\n})\n"],"names":["ManageColumnsItem"],"mappings":";;;;;;;AAQO,MAAM,oBAAoB,KAAK,SAASA,mBAAkB;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,eAAe,YAAY,MAAM,SAAS,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;AAEnE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,YAAY;AAAA,IACd;AAAA;AAAA,IAEA,UAAU,EAAE,WAAW,QAAQ,WAAW,OAAA;AAAA,EAAO,CAClD;AAED,QAAM,QAAQ;AAAA,IACZ,WAAW,IAAI,UAAU,SAAS,SAAS;AAAA,IAC3C;AAAA,EAAA;AAGF,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,cAAc;AAAA,QACd,UAAU;AAAA,MAAA;AAAA,MAGZ,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,UAAU;AAAA,YACV,UAAU,SAAS,SAAY;AAAA,YAC/B,WAAW;AAAA;AAAA,cAET;AAAA,cACA,SAAS,uBAAuB;AAAA,YAAA;AAAA,YAGlC,8BAAC,QAAA,EAAK,WAAU,oCAAmC,OAAO,OACvD,UAAA,MAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,QAED,CAAC,UACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACJ,GAAG;AAAA,YACH,GAAG;AAAA,YACJ,cAAY,mBAAmB,KAAK;AAAA,YACpC,WAAU;AAAA,YAEV,8BAAC,aAAA,EAAY,MAAM,IAAI,QAAO,QAAO,WAAU,YAAA,CAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MAC7D;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const core = require("@dnd-kit/core");
|
|
6
|
+
const sortable = require("@dnd-kit/sortable");
|
|
7
|
+
const ManageColumnsItem = require("./ManageColumnsItem.cjs");
|
|
8
|
+
const SelectAll = require("./SelectAll.cjs");
|
|
9
|
+
const noop = () => {
|
|
10
|
+
};
|
|
11
|
+
function ManageColumnsPanel({
|
|
12
|
+
columns,
|
|
13
|
+
onToggle,
|
|
14
|
+
onToggleAll,
|
|
15
|
+
onReorder,
|
|
16
|
+
description
|
|
17
|
+
}) {
|
|
18
|
+
const toggleable = React.useMemo(() => columns.filter((c) => !c.pinned), [columns]);
|
|
19
|
+
const visibleCount = toggleable.filter((c) => c.visible).length;
|
|
20
|
+
const sensors = core.useSensors(
|
|
21
|
+
core.useSensor(core.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
22
|
+
core.useSensor(core.KeyboardSensor, {
|
|
23
|
+
coordinateGetter: sortable.sortableKeyboardCoordinates
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
const pinnedIds = React.useMemo(
|
|
27
|
+
() => columns.filter((c) => c.pinned).map((c) => c.id),
|
|
28
|
+
[columns]
|
|
29
|
+
);
|
|
30
|
+
const itemIds = React.useMemo(() => toggleable.map((c) => c.id), [toggleable]);
|
|
31
|
+
const handleDragEnd = (event) => {
|
|
32
|
+
const { active, over } = event;
|
|
33
|
+
if (!over || active.id === over.id) return;
|
|
34
|
+
const from = itemIds.indexOf(active.id);
|
|
35
|
+
const to = itemIds.indexOf(over.id);
|
|
36
|
+
if (from === -1 || to === -1) return;
|
|
37
|
+
onReorder == null ? void 0 : onReorder([...pinnedIds, ...sortable.arrayMove(itemIds, from, to)]);
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
40
|
+
toggleable.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky -top-4 z-10 -mt-4 -mx-4 pt-3 px-4 pb-2 mb-3 bg-white border-b border-j2-border-secondary flex items-baseline justify-between", children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-semibold text-sm text-j2-text", children: [
|
|
42
|
+
visibleCount,
|
|
43
|
+
"/",
|
|
44
|
+
toggleable.length,
|
|
45
|
+
" Columns Shown"
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
SelectAll.SelectAll,
|
|
49
|
+
{
|
|
50
|
+
columns,
|
|
51
|
+
onToggle,
|
|
52
|
+
onToggleAll
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }),
|
|
56
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-j2-text mb-4", children: description }),
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
core.DndContext,
|
|
59
|
+
{
|
|
60
|
+
sensors,
|
|
61
|
+
collisionDetection: core.closestCenter,
|
|
62
|
+
onDragEnd: handleDragEnd,
|
|
63
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy: sortable.verticalListSortingStrategy, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
ManageColumnsItem.ManageColumnsItem,
|
|
65
|
+
{
|
|
66
|
+
id: column.id,
|
|
67
|
+
label: column.label,
|
|
68
|
+
visible: column.pinned ? true : column.visible,
|
|
69
|
+
pinned: Boolean(column.pinned),
|
|
70
|
+
onToggle: onToggle ?? noop
|
|
71
|
+
},
|
|
72
|
+
column.id
|
|
73
|
+
)) }) })
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
exports.ManageColumnsPanel = ManageColumnsPanel;
|
|
79
|
+
//# sourceMappingURL=ManageColumnsPanel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManageColumnsPanel.cjs","sources":["../../../../src/components/manageColumns/ManageColumnsPanel.tsx"],"sourcesContent":["import { useMemo, type ReactNode } from 'react'\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n} from '@dnd-kit/core'\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable'\n\nimport { ManageColumnsItem } from './ManageColumnsItem'\nimport { SelectAll } from './SelectAll'\n\nconst noop = () => {}\n\nexport type ManageColumnsColumn = {\n id: string\n label: string\n visible: boolean\n /** Always visible, not draggable. Put pinned columns first in `columns`. */\n pinned?: boolean\n}\n\nexport type ManageColumnsPanelProps = {\n /** Columns in display order. Put any `pinned` columns first. */\n columns: ManageColumnsColumn[]\n onToggle?: (id: string) => void\n /** Batched select-all/clear-all handler — prefer this over the `onToggle` loop fallback, which can drop updates under a closure-captured state snapshot. */\n onToggleAll?: (ids: string[], visible: boolean) => void\n onReorder?: (orderedIds: string[]) => void\n description?: ReactNode\n}\n\nexport function ManageColumnsPanel({\n columns,\n onToggle,\n onToggleAll,\n onReorder,\n description,\n}: ManageColumnsPanelProps) {\n const toggleable = useMemo(() => columns.filter((c) => !c.pinned), [columns])\n const visibleCount = toggleable.filter((c) => c.visible).length\n\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n const pinnedIds = useMemo(\n () => columns.filter((c) => c.pinned).map((c) => c.id),\n [columns]\n )\n const itemIds = useMemo(() => toggleable.map((c) => c.id), [toggleable])\n\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event\n if (!over || active.id === over.id) return\n const from = itemIds.indexOf(active.id as string)\n const to = itemIds.indexOf(over.id as string)\n if (from === -1 || to === -1) return\n onReorder?.([...pinnedIds, ...arrayMove(itemIds, from, to)])\n }\n\n return (\n <>\n {toggleable.length > 0 && (\n <div className=\"sticky -top-4 z-10 -mt-4 -mx-4 pt-3 px-4 pb-2 mb-3 bg-white border-b border-j2-border-secondary flex items-baseline justify-between\">\n <span className=\"font-semibold text-sm text-j2-text\">\n {visibleCount}/{toggleable.length} Columns Shown\n </span>\n <SelectAll\n columns={columns}\n onToggle={onToggle}\n onToggleAll={onToggleAll}\n />\n </div>\n )}\n {description && (\n <p className=\"text-sm text-j2-text mb-4\">{description}</p>\n )}\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={handleDragEnd}\n >\n <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>\n <div className=\"flex flex-col\">\n {columns.map((column) => (\n <ManageColumnsItem\n key={column.id}\n id={column.id}\n label={column.label}\n visible={column.pinned ? true : column.visible}\n pinned={Boolean(column.pinned)}\n onToggle={onToggle ?? noop}\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n </>\n )\n}\n"],"names":["useMemo","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","arrayMove","jsxs","Fragment","jsx","SelectAll","DndCont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BAAAA,KAAC,OAAA,EAAI,WAAU,uIACb,UAAA;AAAA,MAAAA,2BAAAA,KAAC,QAAA,EAAK,WAAU,sCACb,UAAA;AAAA,QAAA;AAAA,QAAa;AAAA,QAAE,WAAW;AAAA,QAAO;AAAA,MAAA,GACpC;AAAA,MACAE,2BAAAA;AAAAA,QAACC,UAAAA;AAAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GACF;AAAA,IAED,eACCD,2BAAAA,IAAC,KAAA,EAAE,WAAU,6BAA6B,UAAA,aAAY;AAAA,IAExDA,2BAAAA;AAAAA,MAACE,KAAAA;AAAAA,MAAA;AAAA,QACC;AAAA,QACA,oBAAoBC,KAAAA;AAAAA,QACpB,WAAW;AAAA,QAEX,UAAAH,2BAAAA,IAACI,0BAAA,EAAgB,OAAO,SAAS,UAAUC,SAAAA,6BACzC,UAAAL,2BAAAA,IAAC,OAAA,EAAI,WAAU,iBACZ,UAAA,QAAQ,IAAI,CAAC,WACZA,2BAAAA;AAAAA,UAACM,kBAAAA;AAAAA,UAAA;AAAA,YAEC,IAAI,OAAO;AAAA,YACX,OAAO,OAAO;AAAA,YACd,SAAS,OAAO,SAAS,OAAO,OAAO;AAAA,YACvC,QAAQ,QAAQ,OAAO,MAAM;AAAA,YAC7B,UAAU,YAAY;AAAA,UAAA;AAAA,UALjB,OAAO;AAAA,QAAA,CAOf,GACH,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ManageColumnsColumn = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
visible: boolean;
|
|
6
|
+
/** Always visible, not draggable. Put pinned columns first in `columns`. */
|
|
7
|
+
pinned?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ManageColumnsPanelProps = {
|
|
10
|
+
/** Columns in display order. Put any `pinned` columns first. */
|
|
11
|
+
columns: ManageColumnsColumn[];
|
|
12
|
+
onToggle?: (id: string) => void;
|
|
13
|
+
/** Batched select-all/clear-all handler — prefer this over the `onToggle` loop fallback, which can drop updates under a closure-captured state snapshot. */
|
|
14
|
+
onToggleAll?: (ids: string[], visible: boolean) => void;
|
|
15
|
+
onReorder?: (orderedIds: string[]) => void;
|
|
16
|
+
description?: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
export declare function ManageColumnsPanel({ columns, onToggle, onToggleAll, onReorder, description, }: ManageColumnsPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
|
|
4
|
+
import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, arrayMove } from "@dnd-kit/sortable";
|
|
5
|
+
import { ManageColumnsItem } from "./ManageColumnsItem.js";
|
|
6
|
+
import { SelectAll } from "./SelectAll.js";
|
|
7
|
+
const noop = () => {
|
|
8
|
+
};
|
|
9
|
+
function ManageColumnsPanel({
|
|
10
|
+
columns,
|
|
11
|
+
onToggle,
|
|
12
|
+
onToggleAll,
|
|
13
|
+
onReorder,
|
|
14
|
+
description
|
|
15
|
+
}) {
|
|
16
|
+
const toggleable = useMemo(() => columns.filter((c) => !c.pinned), [columns]);
|
|
17
|
+
const visibleCount = toggleable.filter((c) => c.visible).length;
|
|
18
|
+
const sensors = useSensors(
|
|
19
|
+
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
20
|
+
useSensor(KeyboardSensor, {
|
|
21
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
const pinnedIds = useMemo(
|
|
25
|
+
() => columns.filter((c) => c.pinned).map((c) => c.id),
|
|
26
|
+
[columns]
|
|
27
|
+
);
|
|
28
|
+
const itemIds = useMemo(() => toggleable.map((c) => c.id), [toggleable]);
|
|
29
|
+
const handleDragEnd = (event) => {
|
|
30
|
+
const { active, over } = event;
|
|
31
|
+
if (!over || active.id === over.id) return;
|
|
32
|
+
const from = itemIds.indexOf(active.id);
|
|
33
|
+
const to = itemIds.indexOf(over.id);
|
|
34
|
+
if (from === -1 || to === -1) return;
|
|
35
|
+
onReorder == null ? void 0 : onReorder([...pinnedIds, ...arrayMove(itemIds, from, to)]);
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
toggleable.length > 0 && /* @__PURE__ */ jsxs("div", { className: "sticky -top-4 z-10 -mt-4 -mx-4 pt-3 px-4 pb-2 mb-3 bg-white border-b border-j2-border-secondary flex items-baseline justify-between", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-sm text-j2-text", children: [
|
|
40
|
+
visibleCount,
|
|
41
|
+
"/",
|
|
42
|
+
toggleable.length,
|
|
43
|
+
" Columns Shown"
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
SelectAll,
|
|
47
|
+
{
|
|
48
|
+
columns,
|
|
49
|
+
onToggle,
|
|
50
|
+
onToggleAll
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }),
|
|
54
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-j2-text mb-4", children: description }),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
DndContext,
|
|
57
|
+
{
|
|
58
|
+
sensors,
|
|
59
|
+
collisionDetection: closestCenter,
|
|
60
|
+
onDragEnd: handleDragEnd,
|
|
61
|
+
children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
62
|
+
ManageColumnsItem,
|
|
63
|
+
{
|
|
64
|
+
id: column.id,
|
|
65
|
+
label: column.label,
|
|
66
|
+
visible: column.pinned ? true : column.visible,
|
|
67
|
+
pinned: Boolean(column.pinned),
|
|
68
|
+
onToggle: onToggle ?? noop
|
|
69
|
+
},
|
|
70
|
+
column.id
|
|
71
|
+
)) }) })
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
ManageColumnsPanel
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=ManageColumnsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManageColumnsPanel.js","sources":["../../../../src/components/manageColumns/ManageColumnsPanel.tsx"],"sourcesContent":["import { useMemo, type ReactNode } from 'react'\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n} from '@dnd-kit/core'\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable'\n\nimport { ManageColumnsItem } from './ManageColumnsItem'\nimport { SelectAll } from './SelectAll'\n\nconst noop = () => {}\n\nexport type ManageColumnsColumn = {\n id: string\n label: string\n visible: boolean\n /** Always visible, not draggable. Put pinned columns first in `columns`. */\n pinned?: boolean\n}\n\nexport type ManageColumnsPanelProps = {\n /** Columns in display order. Put any `pinned` columns first. */\n columns: ManageColumnsColumn[]\n onToggle?: (id: string) => void\n /** Batched select-all/clear-all handler — prefer this over the `onToggle` loop fallback, which can drop updates under a closure-captured state snapshot. */\n onToggleAll?: (ids: string[], visible: boolean) => void\n onReorder?: (orderedIds: string[]) => void\n description?: ReactNode\n}\n\nexport function ManageColumnsPanel({\n columns,\n onToggle,\n onToggleAll,\n onReorder,\n description,\n}: ManageColumnsPanelProps) {\n const toggleable = useMemo(() => columns.filter((c) => !c.pinned), [columns])\n const visibleCount = toggleable.filter((c) => c.visible).length\n\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n const pinnedIds = useMemo(\n () => columns.filter((c) => c.pinned).map((c) => c.id),\n [columns]\n )\n const itemIds = useMemo(() => toggleable.map((c) => c.id), [toggleable])\n\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event\n if (!over || active.id === over.id) return\n const from = itemIds.indexOf(active.id as string)\n const to = itemIds.indexOf(over.id as string)\n if (from === -1 || to === -1) return\n onReorder?.([...pinnedIds, ...arrayMove(itemIds, from, to)])\n }\n\n return (\n <>\n {toggleable.length > 0 && (\n <div className=\"sticky -top-4 z-10 -mt-4 -mx-4 pt-3 px-4 pb-2 mb-3 bg-white border-b border-j2-border-secondary flex items-baseline justify-between\">\n <span className=\"font-semibold text-sm text-j2-text\">\n {visibleCount}/{toggleable.length} Columns Shown\n </span>\n <SelectAll\n columns={columns}\n onToggle={onToggle}\n onToggleAll={onToggleAll}\n />\n </div>\n )}\n {description && (\n <p className=\"text-sm text-j2-text mb-4\">{description}</p>\n )}\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={handleDragEnd}\n >\n <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>\n <div className=\"flex flex-col\">\n {columns.map((column) => (\n <ManageColumnsItem\n key={column.id}\n id={column.id}\n label={column.label}\n visible={column.pinned ? true : column.visible}\n pinned={Boolean(column.pinned)}\n onToggle={onToggle ?? noop}\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n </>\n )\n}\n"],"names":[],"mappings":";;;;;;AAoBA,MAAM,OAAO,MAAM;AAAC;AAoBb,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA4B;AAC1B,QAAM,aAAa,QAAQ,MAAM,QAAQ,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAA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A,QACA,oBAAoB;AAAA,QACpB,WAAW;AAAA,QAEX,UAAA,oBAAC,iBAAA,EAAgB,OAAO,SAAS,UAAU,6BACzC,UAAA,oBAAC,OAAA,EAAI,WAAU,iBACZ,UAAA,QAAQ,IAAI,CAAC,WACZ;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,IAAI,OAAO;AAAA,YACX,OAAO,OAAO;AAAA,YACd,SAAS,OAAO,SAAS,OAAO,OAAO;AAAA,YACvC,QAAQ,QAAQ,OAAO,MAAM;AAAA,YAC7B,UAAU,YAAY;AAAA,UAAA;AAAA,UALjB,OAAO;AAAA,QAAA,CAOf,GACH,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const Button = require("../button/Button.cjs");
|
|
6
|
+
function SelectAll({ columns, onToggle, onToggleAll }) {
|
|
7
|
+
const toggleable = React.useMemo(() => columns.filter((c) => !c.pinned), [columns]);
|
|
8
|
+
const allVisible = toggleable.length > 0 && toggleable.every((c) => c.visible);
|
|
9
|
+
const label = allVisible ? "Clear all" : "Select all";
|
|
10
|
+
if (toggleable.length === 0) return null;
|
|
11
|
+
const handleSelectAllToggle = () => {
|
|
12
|
+
const affected = toggleable.filter((c) => c.visible === allVisible);
|
|
13
|
+
if (onToggleAll) {
|
|
14
|
+
onToggleAll(
|
|
15
|
+
affected.map((c) => c.id),
|
|
16
|
+
!allVisible
|
|
17
|
+
);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const column of affected) {
|
|
21
|
+
onToggle == null ? void 0 : onToggle(column.id);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { type: "text", size: "small", onClick: handleSelectAllToggle, children: label });
|
|
25
|
+
}
|
|
26
|
+
exports.SelectAll = SelectAll;
|
|
27
|
+
//# sourceMappingURL=SelectAll.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAll.cjs","sources":["../../../../src/components/manageColumns/SelectAll.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { Button } from '../button'\nimport type { ManageColumnsColumn } from './ManageColumnsPanel'\n\nexport type SelectAllProps = {\n /** Same `columns` passed to the paired `ManageColumnsPanel`. */\n columns: ManageColumnsColumn[]\n onToggle?: (id: string) => void\n /** Batched select-all/clear-all handler — prefer this over the `onToggle` loop fallback, which can drop updates under a closure-captured state snapshot. */\n onToggleAll?: (ids: string[], visible: boolean) => void\n}\n\n/**\n * Select-all/clear-all control, composed by `ManageColumnsPanel` itself\n * above its description. Kept as its own component (not inlined) so its\n * label/toggle logic is testable independent of the panel's drag-reorder\n * machinery.\n */\nexport function SelectAll({ columns, onToggle, onToggleAll }: SelectAllProps) {\n const toggleable = useMemo(() => columns.filter((c) => !c.pinned), [columns])\n const allVisible = toggleable.length > 0 && toggleable.every((c) => c.visible)\n const label = allVisible ? 'Clear all' : 'Select all'\n\n if (toggleable.length === 0) return null\n\n const handleSelectAllToggle = () => {\n const affected = toggleable.filter((c) => c.visible === allVisible)\n if (onToggleAll) {\n onToggleAll(\n affected.map((c) => c.id),\n !allVisible\n )\n return\n }\n for (const column of affected) {\n onToggle?.(column.id)\n }\n }\n\n return (\n <Button type=\"text\" size=\"small\" onClick={handleSelectAllToggle}>\n {label}\n </Button>\n )\n}\n"],"names":["useMemo","jsx","Button"],"mappings":";;;;;AAmBO,SAAS,UAAU,EAAE,SAAS,UAAU,eAA+B;AAC5E,QAAM,aAAaA,MAAAA,QAAQ,MAAM,QAAQ,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;AAC5E,QAAM,aAAa,WAAW,SAAS,KAAK,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO;AAC7E,QAAM,QAAQ,aAAa,cAAc;AAEzC,MAAI,WAAW,WAAW,EAAG,QAAO;AAEpC,QAAM,wBAAwB,MAAM;AAClC,UAAM,WAAW,WAAW,OAAO,CAAC,MAAM,EAAE,YAAY,UAAU;AAClE,QAAI,aAAa;AACf;AAAA,QACE,SAAS,IAAI,CAAC,MAAM,EAAE,EAAE;AAAA,QACxB,CAAC;AAAA,MAAA;AAEH;AAAA,IACF;AACA,eAAW,UAAU,UAAU;AAC7B,2CAAW,OAAO;AAAA,IACpB;AAAA,EACF;AAEA,SACEC,+BAACC,OAAAA,UAAO,MAAK,QAAO,MAAK,SAAQ,SAAS,uBACvC,UAAA,MAAA,CACH;AAEJ;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ManageColumnsColumn } from './ManageColumnsPanel.js';
|
|
2
|
+
export type SelectAllProps = {
|
|
3
|
+
/** Same `columns` passed to the paired `ManageColumnsPanel`. */
|
|
4
|
+
columns: ManageColumnsColumn[];
|
|
5
|
+
onToggle?: (id: string) => void;
|
|
6
|
+
/** Batched select-all/clear-all handler — prefer this over the `onToggle` loop fallback, which can drop updates under a closure-captured state snapshot. */
|
|
7
|
+
onToggleAll?: (ids: string[], visible: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Select-all/clear-all control, composed by `ManageColumnsPanel` itself
|
|
11
|
+
* above its description. Kept as its own component (not inlined) so its
|
|
12
|
+
* label/toggle logic is testable independent of the panel's drag-reorder
|
|
13
|
+
* machinery.
|
|
14
|
+
*/
|
|
15
|
+
export declare function SelectAll({ columns, onToggle, onToggleAll }: SelectAllProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Button } from "../button/Button.js";
|
|
4
|
+
function SelectAll({ columns, onToggle, onToggleAll }) {
|
|
5
|
+
const toggleable = useMemo(() => columns.filter((c) => !c.pinned), [columns]);
|
|
6
|
+
const allVisible = toggleable.length > 0 && toggleable.every((c) => c.visible);
|
|
7
|
+
const label = allVisible ? "Clear all" : "Select all";
|
|
8
|
+
if (toggleable.length === 0) return null;
|
|
9
|
+
const handleSelectAllToggle = () => {
|
|
10
|
+
const affected = toggleable.filter((c) => c.visible === allVisible);
|
|
11
|
+
if (onToggleAll) {
|
|
12
|
+
onToggleAll(
|
|
13
|
+
affected.map((c) => c.id),
|
|
14
|
+
!allVisible
|
|
15
|
+
);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
for (const column of affected) {
|
|
19
|
+
onToggle == null ? void 0 : onToggle(column.id);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ jsx(Button, { type: "text", size: "small", onClick: handleSelectAllToggle, children: label });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
SelectAll
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=SelectAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAll.js","sources":["../../../../src/components/manageColumns/SelectAll.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { Button } from '../button'\nimport type { ManageColumnsColumn } from './ManageColumnsPanel'\n\nexport type SelectAllProps = {\n /** Same `columns` passed to the paired `ManageColumnsPanel`. */\n columns: ManageColumnsColumn[]\n onToggle?: (id: string) => void\n /** Batched select-all/clear-all handler — prefer this over the `onToggle` loop fallback, which can drop updates under a closure-captured state snapshot. */\n onToggleAll?: (ids: string[], visible: boolean) => void\n}\n\n/**\n * Select-all/clear-all control, composed by `ManageColumnsPanel` itself\n * above its description. Kept as its own component (not inlined) so its\n * label/toggle logic is testable independent of the panel's drag-reorder\n * machinery.\n */\nexport function SelectAll({ columns, onToggle, onToggleAll }: SelectAllProps) {\n const toggleable = useMemo(() => columns.filter((c) => !c.pinned), [columns])\n const allVisible = toggleable.length > 0 && toggleable.every((c) => c.visible)\n const label = allVisible ? 'Clear all' : 'Select all'\n\n if (toggleable.length === 0) return null\n\n const handleSelectAllToggle = () => {\n const affected = toggleable.filter((c) => c.visible === allVisible)\n if (onToggleAll) {\n onToggleAll(\n affected.map((c) => c.id),\n !allVisible\n )\n return\n }\n for (const column of affected) {\n onToggle?.(column.id)\n }\n }\n\n return (\n <Button type=\"text\" size=\"small\" onClick={handleSelectAllToggle}>\n {label}\n </Button>\n )\n}\n"],"names":[],"mappings":";;;AAmBO,SAAS,UAAU,EAAE,SAAS,UAAU,eAA+B;AAC5E,QAAM,aAAa,QAAQ,MAAM,QAAQ,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;AAC5E,QAAM,aAAa,WAAW,SAAS,KAAK,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO;AAC7E,QAAM,QAAQ,aAAa,cAAc;AAEzC,MAAI,WAAW,WAAW,EAAG,QAAO;AAEpC,QAAM,wBAAwB,MAAM;AAClC,UAAM,WAAW,WAAW,OAAO,CAAC,MAAM,EAAE,YAAY,UAAU;AAClE,QAAI,aAAa;AACf;AAAA,QACE,SAAS,IAAI,CAAC,MAAM,EAAE,EAAE;AAAA,QACxB,CAAC;AAAA,MAAA;AAEH;AAAA,IACF;AACA,eAAW,UAAU,UAAU;AAC7B,2CAAW,OAAO;AAAA,IACpB;AAAA,EACF;AAEA,SACE,oBAAC,UAAO,MAAK,QAAO,MAAK,SAAQ,SAAS,uBACvC,UAAA,MAAA,CACH;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.cjs","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import { Modal as AntdModal, ModalProps } from 'antd'\nimport { XIcon } from '@phosphor-icons/react'\nimport './Modal.css'\nimport cx from 'classnames'\n\nexport type Props = {\n withContentPadding?: boolean\n} & Expand<ModalProps>\n\nconst Modal = ({\n open,\n title,\n children,\n onCancel,\n withContentPadding: withPadding = true,\n ...props\n}: Props) => {\n return (\n <AntdModal\n title={title}\n className={cx('j2-modal')}\n
|
|
1
|
+
{"version":3,"file":"Modal.cjs","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import { Modal as AntdModal, ModalProps } from 'antd'\nimport { XIcon } from '@phosphor-icons/react'\nimport './Modal.css'\nimport cx from 'classnames'\n\nexport type Props = {\n withContentPadding?: boolean\n} & Expand<ModalProps>\n\nconst Modal = ({\n open,\n title,\n children,\n onCancel,\n withContentPadding: withPadding = true,\n ...props\n}: Props) => {\n return (\n <AntdModal\n title={title}\n className={cx('j2-modal')}\n centered\n closeIcon={<XIcon size={22} weight=\"regular\" />}\n onCancel={onCancel}\n open={open}\n {...props}\n >\n <div className={cx(withPadding ? 'px-6 py-3' : 'px-0 py-0')}>\n {children}\n </div>\n </AntdModal>\n )\n}\n\nexport { Modal }\n"],"names":["jsx","AntdModal","XIcon"],"mappings":";;;;;;;AASA,MAAM,QAAQ,CAAC;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB,cAAc;AAAA,EAClC,GAAG;AACL,MAAa;AACX,SACEA,2BAAAA;AAAAA,IAACC,KAAAA;AAAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,UAAU;AAAA,MACxB,UAAQ;AAAA,MACR,WAAWD,2BAAAA,IAACE,aAAA,EAAM,MAAM,IAAI,QAAO,WAAU;AAAA,MAC7C;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEJ,UAAAF,2BAAAA,IAAC,SAAI,WAAW,GAAG,cAAc,cAAc,WAAW,GACvD,SAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import { Modal as AntdModal, ModalProps } from 'antd'\nimport { XIcon } from '@phosphor-icons/react'\nimport './Modal.css'\nimport cx from 'classnames'\n\nexport type Props = {\n withContentPadding?: boolean\n} & Expand<ModalProps>\n\nconst Modal = ({\n open,\n title,\n children,\n onCancel,\n withContentPadding: withPadding = true,\n ...props\n}: Props) => {\n return (\n <AntdModal\n title={title}\n className={cx('j2-modal')}\n
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import { Modal as AntdModal, ModalProps } from 'antd'\nimport { XIcon } from '@phosphor-icons/react'\nimport './Modal.css'\nimport cx from 'classnames'\n\nexport type Props = {\n withContentPadding?: boolean\n} & Expand<ModalProps>\n\nconst Modal = ({\n open,\n title,\n children,\n onCancel,\n withContentPadding: withPadding = true,\n ...props\n}: Props) => {\n return (\n <AntdModal\n title={title}\n className={cx('j2-modal')}\n centered\n closeIcon={<XIcon size={22} weight=\"regular\" />}\n onCancel={onCancel}\n open={open}\n {...props}\n >\n <div className={cx(withPadding ? 'px-6 py-3' : 'px-0 py-0')}>\n {children}\n </div>\n </AntdModal>\n )\n}\n\nexport { Modal }\n"],"names":["AntdModal"],"mappings":";;;;;AASA,MAAM,QAAQ,CAAC;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB,cAAc;AAAA,EAClC,GAAG;AACL,MAAa;AACX,SACE;AAAA,IAACA;AAAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,UAAU;AAAA,MACxB,UAAQ;AAAA,MACR,WAAW,oBAAC,OAAA,EAAM,MAAM,IAAI,QAAO,WAAU;AAAA,MAC7C;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEJ,UAAA,oBAAC,SAAI,WAAW,GAAG,cAAc,cAAc,WAAW,GACvD,SAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -34,12 +34,15 @@ const getIcon = (type) => {
|
|
|
34
34
|
const useNotification = () => {
|
|
35
35
|
const [api, contextHolder] = antd.notification.useNotification();
|
|
36
36
|
const openNotification = (type, config) => {
|
|
37
|
+
const { message, title, btn, actions, ...restConfig } = config;
|
|
37
38
|
api[type]({
|
|
38
39
|
icon: getIcon(type),
|
|
39
|
-
...
|
|
40
|
+
...restConfig,
|
|
41
|
+
title: title ?? message,
|
|
42
|
+
actions: actions ?? btn,
|
|
40
43
|
closeIcon: /* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { color: "var(--j2-color-icon)", size: 22, weight: "regular" }),
|
|
41
44
|
className: cx({
|
|
42
|
-
[Notification_module.default.messageOnly]:
|
|
45
|
+
[Notification_module.default.messageOnly]: (title ?? message) && !config.description
|
|
43
46
|
})
|
|
44
47
|
});
|
|
45
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotification.cjs","sources":["../../../../src/components/notification/useNotification.tsx"],"sourcesContent":["import { notification } from 'antd'\nimport type { NotificationArgsProps } from 'antd'\nimport s from './Notification.module.css'\nimport {\n CheckCircleIcon,\n InfoIcon,\n WarningCircleIcon,\n XIcon,\n XCircleIcon,\n} from '@phosphor-icons/react'\nimport cx from 'classnames'\nimport React from 'react'\n\ntype NotificationType = 'success' | 'info' | 'warning' | 'error'\n\nexport type OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n) => void\n\nconst getIcon = (type: NotificationType) => {\n switch (type) {\n case 'error':\n return (\n <XCircleIcon color=\"var(--j2-color-error)\" weight=\"duotone\" size={24} />\n )\n case 'success':\n return (\n <CheckCircleIcon\n color=\"var(--j2-color-success)\"\n weight=\"duotone\"\n size={24}\n />\n )\n case 'info':\n return (\n <InfoIcon color=\"var(--j2-color-info)\" weight=\"duotone\" size={24} />\n )\n case 'warning':\n return (\n <WarningCircleIcon\n color=\"var(--j2-color-warning)\"\n weight=\"duotone\"\n size={24}\n />\n )\n }\n}\n\nexport const useNotification = () => {\n const [api, contextHolder] = notification.useNotification()\n\n const openNotification: OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n ) => {\n api[type]({\n icon: getIcon(type),\n ...
|
|
1
|
+
{"version":3,"file":"useNotification.cjs","sources":["../../../../src/components/notification/useNotification.tsx"],"sourcesContent":["import { notification } from 'antd'\nimport type { NotificationArgsProps } from 'antd'\nimport s from './Notification.module.css'\nimport {\n CheckCircleIcon,\n InfoIcon,\n WarningCircleIcon,\n XIcon,\n XCircleIcon,\n} from '@phosphor-icons/react'\nimport cx from 'classnames'\nimport React from 'react'\n\ntype NotificationType = 'success' | 'info' | 'warning' | 'error'\n\nexport type OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n) => void\n\nconst getIcon = (type: NotificationType) => {\n switch (type) {\n case 'error':\n return (\n <XCircleIcon color=\"var(--j2-color-error)\" weight=\"duotone\" size={24} />\n )\n case 'success':\n return (\n <CheckCircleIcon\n color=\"var(--j2-color-success)\"\n weight=\"duotone\"\n size={24}\n />\n )\n case 'info':\n return (\n <InfoIcon color=\"var(--j2-color-info)\" weight=\"duotone\" size={24} />\n )\n case 'warning':\n return (\n <WarningCircleIcon\n color=\"var(--j2-color-warning)\"\n weight=\"duotone\"\n size={24}\n />\n )\n }\n}\n\nexport const useNotification = () => {\n const [api, contextHolder] = notification.useNotification()\n\n const openNotification: OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n ) => {\n const { message, title, btn, actions, ...restConfig } = config\n api[type]({\n icon: getIcon(type),\n ...restConfig,\n title: title ?? message,\n actions: actions ?? btn,\n closeIcon: (\n <XIcon color=\"var(--j2-color-icon)\" size={22} weight=\"regular\" />\n ),\n className: cx({\n [s.messageOnly]: (title ?? message) && !config.description,\n }),\n })\n }\n\n const closeNotification = (key?: React.Key) => {\n api.destroy(key)\n }\n\n return { openNotification, closeNotification, contextHolder }\n}\n"],"names":["XCircleIcon","jsx","CheckCircleIcon","InfoIcon","WarningCircleIcon","notification","XIcon","s"],"mappings":";;;;;;;AAoBA,MAAM,UAAU,CAAC,SAA2B;AAC1C,UAAQ,MAAA;AAAA,IACN,KAAK;AACH,4CACGA,mBAAA,EAAY,OAAM,yBAAwB,QAAO,WAAU,MAAM,IAAI;AAAA,IAE1E,KAAK;AACH,aACEC,2BAAAA;AAAAA,QAACC,MAAAA;AAAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,QAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAGZ,KAAK;AACH,4CACGC,gBAAA,EAAS,OAAM,wBAAuB,QAAO,WAAU,MAAM,IAAI;AAAA,IAEtE,KAAK;AACH,aACEF,2BAAAA;AAAAA,QAACG,MAAAA;AAAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,QAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,EACR;AAGR;AAEO,MAAM,kBAAkB,MAAM;AACnC,QAAM,CAAC,KAAK,aAAa,IAAIC,KAAAA,aAAa,gBAAA;AAE1C,QAAM,mBAAyC,CAC7C,MACA,WACG;AACH,UAAM,EAAE,SAAS,OAAO,KAAK,SAAS,GAAG,eAAe;AACxD,QAAI,IAAI,EAAE;AAAA,MACR,MAAM,QAAQ,IAAI;AAAA,MAClB,GAAG;AAAA,MACH,OAAO,SAAS;AAAA,MAChB,SAAS,WAAW;AAAA,MACpB,0CACGC,MAAAA,OAAA,EAAM,OAAM,wBAAuB,MAAM,IAAI,QAAO,WAAU;AAAA,MAEjE,WAAW,GAAG;AAAA,QACZ,CAACC,oBAAAA,QAAE,WAAW,IAAI,SAAS,YAAY,CAAC,OAAO;AAAA,MAAA,CAChD;AAAA,IAAA,CACF;AAAA,EACH;AAEA,QAAM,oBAAoB,CAAC,QAAoB;AAC7C,QAAI,QAAQ,GAAG;AAAA,EACjB;AAEA,SAAO,EAAE,kBAAkB,mBAAmB,cAAA;AAChD;;"}
|
|
@@ -32,12 +32,15 @@ const getIcon = (type) => {
|
|
|
32
32
|
const useNotification = () => {
|
|
33
33
|
const [api, contextHolder] = notification.useNotification();
|
|
34
34
|
const openNotification = (type, config) => {
|
|
35
|
+
const { message, title, btn, actions, ...restConfig } = config;
|
|
35
36
|
api[type]({
|
|
36
37
|
icon: getIcon(type),
|
|
37
|
-
...
|
|
38
|
+
...restConfig,
|
|
39
|
+
title: title ?? message,
|
|
40
|
+
actions: actions ?? btn,
|
|
38
41
|
closeIcon: /* @__PURE__ */ jsx(XIcon, { color: "var(--j2-color-icon)", size: 22, weight: "regular" }),
|
|
39
42
|
className: cx({
|
|
40
|
-
[s.messageOnly]:
|
|
43
|
+
[s.messageOnly]: (title ?? message) && !config.description
|
|
41
44
|
})
|
|
42
45
|
});
|
|
43
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotification.js","sources":["../../../../src/components/notification/useNotification.tsx"],"sourcesContent":["import { notification } from 'antd'\nimport type { NotificationArgsProps } from 'antd'\nimport s from './Notification.module.css'\nimport {\n CheckCircleIcon,\n InfoIcon,\n WarningCircleIcon,\n XIcon,\n XCircleIcon,\n} from '@phosphor-icons/react'\nimport cx from 'classnames'\nimport React from 'react'\n\ntype NotificationType = 'success' | 'info' | 'warning' | 'error'\n\nexport type OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n) => void\n\nconst getIcon = (type: NotificationType) => {\n switch (type) {\n case 'error':\n return (\n <XCircleIcon color=\"var(--j2-color-error)\" weight=\"duotone\" size={24} />\n )\n case 'success':\n return (\n <CheckCircleIcon\n color=\"var(--j2-color-success)\"\n weight=\"duotone\"\n size={24}\n />\n )\n case 'info':\n return (\n <InfoIcon color=\"var(--j2-color-info)\" weight=\"duotone\" size={24} />\n )\n case 'warning':\n return (\n <WarningCircleIcon\n color=\"var(--j2-color-warning)\"\n weight=\"duotone\"\n size={24}\n />\n )\n }\n}\n\nexport const useNotification = () => {\n const [api, contextHolder] = notification.useNotification()\n\n const openNotification: OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n ) => {\n api[type]({\n icon: getIcon(type),\n ...
|
|
1
|
+
{"version":3,"file":"useNotification.js","sources":["../../../../src/components/notification/useNotification.tsx"],"sourcesContent":["import { notification } from 'antd'\nimport type { NotificationArgsProps } from 'antd'\nimport s from './Notification.module.css'\nimport {\n CheckCircleIcon,\n InfoIcon,\n WarningCircleIcon,\n XIcon,\n XCircleIcon,\n} from '@phosphor-icons/react'\nimport cx from 'classnames'\nimport React from 'react'\n\ntype NotificationType = 'success' | 'info' | 'warning' | 'error'\n\nexport type OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n) => void\n\nconst getIcon = (type: NotificationType) => {\n switch (type) {\n case 'error':\n return (\n <XCircleIcon color=\"var(--j2-color-error)\" weight=\"duotone\" size={24} />\n )\n case 'success':\n return (\n <CheckCircleIcon\n color=\"var(--j2-color-success)\"\n weight=\"duotone\"\n size={24}\n />\n )\n case 'info':\n return (\n <InfoIcon color=\"var(--j2-color-info)\" weight=\"duotone\" size={24} />\n )\n case 'warning':\n return (\n <WarningCircleIcon\n color=\"var(--j2-color-warning)\"\n weight=\"duotone\"\n size={24}\n />\n )\n }\n}\n\nexport const useNotification = () => {\n const [api, contextHolder] = notification.useNotification()\n\n const openNotification: OpenNotificationFunc = (\n type: Expand<NotificationType>,\n config: Expand<NotificationArgsProps>\n ) => {\n const { message, title, btn, actions, ...restConfig } = config\n api[type]({\n icon: getIcon(type),\n ...restConfig,\n title: title ?? message,\n actions: actions ?? btn,\n closeIcon: (\n <XIcon color=\"var(--j2-color-icon)\" size={22} weight=\"regular\" />\n ),\n className: cx({\n [s.messageOnly]: (title ?? message) && !config.description,\n }),\n })\n }\n\n const closeNotification = (key?: React.Key) => {\n api.destroy(key)\n }\n\n return { openNotification, closeNotification, contextHolder }\n}\n"],"names":[],"mappings":";;;;;AAoBA,MAAM,UAAU,CAAC,SAA2B;AAC1C,UAAQ,MAAA;AAAA,IACN,KAAK;AACH,iCACG,aAAA,EAAY,OAAM,yBAAwB,QAAO,WAAU,MAAM,IAAI;AAAA,IAE1E,KAAK;AACH,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,QAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAGZ,KAAK;AACH,iCACG,UAAA,EAAS,OAAM,wBAAuB,QAAO,WAAU,MAAM,IAAI;AAAA,IAEtE,KAAK;AACH,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,QAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,EACR;AAGR;AAEO,MAAM,kBAAkB,MAAM;AACnC,QAAM,CAAC,KAAK,aAAa,IAAI,aAAa,gBAAA;AAE1C,QAAM,mBAAyC,CAC7C,MACA,WACG;AACH,UAAM,EAAE,SAAS,OAAO,KAAK,SAAS,GAAG,eAAe;AACxD,QAAI,IAAI,EAAE;AAAA,MACR,MAAM,QAAQ,IAAI;AAAA,MAClB,GAAG;AAAA,MACH,OAAO,SAAS;AAAA,MAChB,SAAS,WAAW;AAAA,MACpB,+BACG,OAAA,EAAM,OAAM,wBAAuB,MAAM,IAAI,QAAO,WAAU;AAAA,MAEjE,WAAW,GAAG;AAAA,QACZ,CAAC,EAAE,WAAW,IAAI,SAAS,YAAY,CAAC,OAAO;AAAA,MAAA,CAChD;AAAA,IAAA,CACF;AAAA,EACH;AAEA,QAAM,oBAAoB,CAAC,QAAoB;AAC7C,QAAI,QAAQ,GAAG;AAAA,EACjB;AAEA,SAAO,EAAE,kBAAkB,mBAAmB,cAAA;AAChD;"}
|
|
@@ -47,6 +47,8 @@ const withDesignSystemPaginationOverrides = (pagination, { paginationTextLabels
|
|
|
47
47
|
return {
|
|
48
48
|
...pagination,
|
|
49
49
|
locale: { ...getPaginationLocale(small), ...pagination.locale },
|
|
50
|
+
// Keep antd in charge of visibility (including Table's filtered total).
|
|
51
|
+
// showSizeChanger's SelectProps alternative would force it visible.
|
|
50
52
|
selectComponentClass: paginationSelectComponentClass,
|
|
51
53
|
itemRender: buildItemRender({
|
|
52
54
|
paginationTextLabels,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.cjs","sources":["../../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import {\n Pagination as AntdPagination,\n PaginationProps,\n
|
|
1
|
+
{"version":3,"file":"Pagination.cjs","sources":["../../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import {\n Pagination as AntdPagination,\n PaginationProps,\n Button,\n Select,\n SelectProps,\n} from 'antd'\nimport cx from 'classnames'\nimport {\n CaretLeftIcon,\n CaretRightIcon,\n CaretDownIcon,\n DotsThreeIcon,\n CaretDoubleLeftIcon,\n CaretDoubleRightIcon,\n} from '@phosphor-icons/react'\n\nimport s from './Pagination.module.css'\n\ntype Overrides = {\n paginationTextLabels?: boolean\n /** Forces small-size rendering independent of the config's own `size`. */\n isSmall?: boolean\n}\n\ntype Props = Expand<PaginationProps & { paginationTextLabels?: boolean }>\n\nconst renderIconButton = (\n icon: React.ReactNode,\n isSmall: boolean,\n customClassName?: string\n) => (\n <Button\n type=\"link\"\n size={isSmall ? 'small' : 'middle'}\n className={cx(customClassName, isSmall ? '!w-6' : '!w-8')}\n >\n {icon}\n </Button>\n)\n\nconst renderJumpItem = (\n icon: React.ReactNode,\n doubleIcon: React.ReactNode,\n isSmall: boolean\n) => (\n <a className=\"ant-pagination-item-link\">\n <div className=\"ant-pagination-item-container\">\n <span className=\"ant-pagination-item-ellipsis\">\n {renderIconButton(icon, isSmall, s['jump-button'])}\n </span>\n <span className=\"ant-pagination-item-link-icon\">\n {renderIconButton(doubleIcon, isSmall, s['jump-button'])}\n </span>\n </div>\n </a>\n)\n\nconst buildItemRender =\n ({ paginationTextLabels, isSmall }: Required<Overrides>) =>\n (\n _page: number,\n type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next',\n element: React.ReactNode\n ) => {\n if (type === 'prev') {\n return (\n <a>\n {paginationTextLabels\n ? 'Previous'\n : renderIconButton(<CaretLeftIcon />, isSmall)}\n </a>\n )\n }\n if (type === 'next') {\n return (\n <a>\n {paginationTextLabels\n ? 'Next'\n : renderIconButton(<CaretRightIcon />, isSmall)}\n </a>\n )\n }\n if (type === 'jump-prev') {\n return renderJumpItem(<DotsThreeIcon />, <CaretDoubleLeftIcon />, isSmall)\n }\n if (type === 'jump-next') {\n return renderJumpItem(\n <DotsThreeIcon />,\n <CaretDoubleRightIcon />,\n isSmall\n )\n }\n return element\n }\n\nconst paginationSelectComponentClass = (selectProps: SelectProps) => (\n <Select {...selectProps} suffixIcon={<CaretDownIcon />} />\n)\n\nconst getPaginationLocale = (isSmall: boolean) => ({\n jump_to: `Go to\\u00A0${isSmall ? ':\\u00A0\\u00A0\\u00A0' : ''}`,\n page: isSmall ? '' : 'page',\n})\n\n/**\n * Applies design-system overrides (Phosphor icons, locale, custom select\n * chrome) to an antd Pagination config. Used by the standalone\n * {@link Pagination} component, and by `<Table>`'s `pagination` prop so\n * both share identical visuals.\n */\nexport const withDesignSystemPaginationOverrides = (\n pagination: PaginationProps,\n { paginationTextLabels = false, isSmall }: Overrides = {}\n): PaginationProps => {\n const small = isSmall ?? pagination.size === 'small'\n return {\n ...pagination,\n locale: { ...getPaginationLocale(small), ...pagination.locale },\n // Keep antd in charge of visibility (including Table's filtered total).\n // showSizeChanger's SelectProps alternative would force it visible.\n selectComponentClass: paginationSelectComponentClass,\n itemRender: buildItemRender({\n paginationTextLabels,\n isSmall: small,\n }),\n }\n}\n\nconst Pagination = ({ paginationTextLabels = false, ...props }: Props) => {\n const enriched = withDesignSystemPaginationOverrides(props, {\n paginationTextLabels,\n })\n return <AntdPagination {...enriched} />\n}\n\nexport { Pagination }\n"],"names":["jsx","Button","jsxs","s","CaretLeftIcon","CaretRightIcon","DotsThreeIcon","CaretDoubleLeftIcon","CaretDoubleRightIcon","Select","CaretDownIcon","AntdPagination"],"mappings":";;;;;;;AA2BA,MAAM,mBAAmB,CACvB,MACA,SACA,oBAEA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AO;AACT;AAEF,MAAM,iCAAiC,CAAC,gBACtCR,2BAAAA,IAACS,KAAAA,QAAA,EAAQ,GAAG,aAAa,YAAYT,2BAAAA,IAACU,qBAAA,CAAA,CAAc,EAAA,CAAI;AAG1D,MAAM,sBAAsB,CAAC,aAAsB;AAAA,EACjD,SAAS,SAAc,UAAU,SAAwB,EAAE;AAAA,EAC3D,MAAM,UAAU,KAAK;AACvB;AAQO,MAAM,sCAAsC,CACjD,YACA,EAAE,uBAAuB,OAAO,QAAA,IAAuB,OACnC;AACpB,QAAM,QAAQ,WAAW,WAAW,SAAS;AAC7C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,EAAE,GAAG,oBAAoB,KAAK,GAAG,GAAG,WAAW,OAAA;AAAA;AAAA;AAAA,IAGvD,sBAAsB;AAAA,IACtB,YAAY,gBAAgB;AAAA,MAC1B;AAAA,MACA,SAAS;AAAA,IAAA,CACV;AAAA,EAAA;AAEL;AAEA,MAAM,aAAa,CAAC,EAAE,uBAAuB,OAAO,GAAG,YAAmB;AACxE,QAAM,WAAW,oCAAoC,OAAO;AAAA,IAC1D;AAAA,EAAA,CACD;AACD,SAAOV,+BAACW,KAAAA,YAAA,EAAgB,GAAG,SAAA,CAAU;AACvC;;;"}
|
|
@@ -45,6 +45,8 @@ const withDesignSystemPaginationOverrides = (pagination, { paginationTextLabels
|
|
|
45
45
|
return {
|
|
46
46
|
...pagination,
|
|
47
47
|
locale: { ...getPaginationLocale(small), ...pagination.locale },
|
|
48
|
+
// Keep antd in charge of visibility (including Table's filtered total).
|
|
49
|
+
// showSizeChanger's SelectProps alternative would force it visible.
|
|
48
50
|
selectComponentClass: paginationSelectComponentClass,
|
|
49
51
|
itemRender: buildItemRender({
|
|
50
52
|
paginationTextLabels,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":["../../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import {\n Pagination as AntdPagination,\n PaginationProps,\n
|
|
1
|
+
{"version":3,"file":"Pagination.js","sources":["../../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import {\n Pagination as AntdPagination,\n PaginationProps,\n Button,\n Select,\n SelectProps,\n} from 'antd'\nimport cx from 'classnames'\nimport {\n CaretLeftIcon,\n CaretRightIcon,\n CaretDownIcon,\n DotsThreeIcon,\n CaretDoubleLeftIcon,\n CaretDoubleRightIcon,\n} from '@phosphor-icons/react'\n\nimport s from './Pagination.module.css'\n\ntype Overrides = {\n paginationTextLabels?: boolean\n /** Forces small-size rendering independent of the config's own `size`. */\n isSmall?: boolean\n}\n\ntype Props = Expand<PaginationProps & { paginationTextLabels?: boolean }>\n\nconst renderIconButton = (\n icon: React.ReactNode,\n isSmall: boolean,\n customClassName?: string\n) => (\n <Button\n type=\"link\"\n size={isSmall ? 'small' : 'middle'}\n className={cx(customClassName, isSmall ? '!w-6' : '!w-8')}\n >\n {icon}\n </Button>\n)\n\nconst renderJumpItem = (\n icon: React.ReactNode,\n doubleIcon: React.ReactNode,\n isSmall: boolean\n) => (\n <a className=\"ant-pagination-item-link\">\n <div className=\"ant-pagination-item-container\">\n <span className=\"ant-pagination-item-ellipsis\">\n {renderIconButton(icon, isSmall, s['jump-button'])}\n </span>\n <span className=\"ant-pagination-item-link-icon\">\n {renderIconButton(doubleIcon, isSmall, s['jump-button'])}\n </span>\n </div>\n </a>\n)\n\nconst buildItemRender =\n ({ paginationTextLabels, isSmall }: Required<Overrides>) =>\n (\n _page: number,\n type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next',\n element: React.ReactNode\n ) => {\n if (type === 'prev') {\n return (\n <a>\n {paginationTextLabels\n ? 'Previous'\n : renderIconButton(<CaretLeftIcon />, isSmall)}\n </a>\n )\n }\n if (type === 'next') {\n return (\n <a>\n {paginationTextLabels\n ? 'Next'\n : renderIconButton(<CaretRightIcon />, isSmall)}\n </a>\n )\n }\n if (type === 'jump-prev') {\n return renderJumpItem(<DotsThreeIcon />, <CaretDoubleLeftIcon />, isSmall)\n }\n if (type === 'jump-next') {\n return renderJumpItem(\n <DotsThreeIcon />,\n <CaretDoubleRightIcon />,\n isSmall\n )\n }\n return element\n }\n\nconst paginationSelectComponentClass = (selectProps: SelectProps) => (\n <Select {...selectProps} suffixIcon={<CaretDownIcon />} />\n)\n\nconst getPaginationLocale = (isSmall: boolean) => ({\n jump_to: `Go to\\u00A0${isSmall ? ':\\u00A0\\u00A0\\u00A0' : ''}`,\n page: isSmall ? '' : 'page',\n})\n\n/**\n * Applies design-system overrides (Phosphor icons, locale, custom select\n * chrome) to an antd Pagination config. Used by the standalone\n * {@link Pagination} component, and by `<Table>`'s `pagination` prop so\n * both share identical visuals.\n */\nexport const withDesignSystemPaginationOverrides = (\n pagination: PaginationProps,\n { paginationTextLabels = false, isSmall }: Overrides = {}\n): PaginationProps => {\n const small = isSmall ?? pagination.size === 'small'\n return {\n ...pagination,\n locale: { ...getPaginationLocale(small), ...pagination.locale },\n // Keep antd in charge of visibility (including Table's filtered total).\n // showSizeChanger's SelectProps alternative would force it visible.\n selectComponentClass: paginationSelectComponentClass,\n itemRender: buildItemRender({\n paginationTextLabels,\n isSmall: small,\n }),\n }\n}\n\nconst Pagination = ({ paginationTextLabels = false, ...props }: Props) => {\n const enriched = withDesignSystemPaginationOverrides(props, {\n paginationTextLabels,\n })\n return <AntdPagination {...enriched} />\n}\n\nexport { Pagination }\n"],"names":["AntdPagination"],"mappings":";;;;;AA2BA,MAAM,mBAAmB,CACvB,MACA,SACA,oBAEA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,MAAM,UAAU,UAAU;AAAA,IAC1B,WAAW,GAAG,iBAAiB,UAAU,SAAS,MAAM;AAAA,IAEvD,UAAA;AAAA,EAAA;AACH;AAGF,MAAM,iBAAiB,CACrB,MACA,YACA,YAEA,oBAAC,KAAA,EAAE,WAAU,4BACX,UAAA,qBAAC,OAAA,EAAI,WAAU,iCACb,UAAA;AAAA,EAAA,oBAAC,QAAA,EAA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AA;AAAA,IAGvD,sBAAsB;AAAA,IACtB,YAAY,gBAAgB;AAAA,MAC1B;AAAA,MACA,SAAS;AAAA,IAAA,CACV;AAAA,EAAA;AAEL;AAEA,MAAM,aAAa,CAAC,EAAE,uBAAuB,OAAO,GAAG,YAAmB;AACxE,QAAM,WAAW,oCAAoC,OAAO;AAAA,IAC1D;AAAA,EAAA,CACD;AACD,SAAO,oBAACA,cAAA,EAAgB,GAAG,SAAA,CAAU;AACvC;"}
|
|
@@ -13,12 +13,14 @@ const Popover = ({
|
|
|
13
13
|
smallPadding = false,
|
|
14
14
|
paddingSize,
|
|
15
15
|
arrow = false,
|
|
16
|
+
rootClassName,
|
|
16
17
|
...props
|
|
17
18
|
}) => {
|
|
18
19
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19
20
|
antd.Popover,
|
|
20
21
|
{
|
|
21
|
-
|
|
22
|
+
rootClassName: cx(
|
|
23
|
+
rootClassName,
|
|
22
24
|
Popover_module.default.j2Popover,
|
|
23
25
|
scrollable && Popover_module.default.scrollable,
|
|
24
26
|
smallPadding && Popover_module.default.smallPadding,
|