autocasting-ui-library-padimasso 1.3.6 → 1.3.8
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/components/Layout/DataGrid/DataGrid.js +189 -0
- package/dist/components/Navigation/Indicators/Chevron/ChevronLeft.js +3 -3
- package/dist/components/Navigation/Indicators/Chevron/ChevronRight.js +3 -3
- package/dist/components/Overlays/Dialogs/Modal/Modal.js +3 -9
- package/dist/index.d.ts +105 -31
- package/dist/index.js +1 -0
- package/dist/styles.css +2 -2
- package/package.json +4 -2
- package/src/components/Layout/DataGrid/DataGrid.stories.tsx +153 -0
- package/src/components/Layout/DataGrid/DataGrid.tsx +525 -0
- package/src/components/Layout/DataGrid/index.ts +3 -0
- package/src/components/Layout/index.ts +3 -1
- package/src/components/Navigation/Indicators/Chevron/Chevron.stories.tsx +9 -0
- package/src/components/Navigation/Indicators/Chevron/ChevronLeft.tsx +23 -3
- package/src/components/Navigation/Indicators/Chevron/ChevronRight.tsx +23 -3
- package/src/components/Overlays/Dialogs/Modal/Modal.stories.tsx +8 -5
- package/src/components/Overlays/Dialogs/Modal/Modal.tsx +9 -14
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
3
|
+
import OverflowMenu from '../../Actions/Menus/OverflowMenu/OverflowMenu.js';
|
|
4
|
+
import ChevronLeft from '../../Navigation/Indicators/Chevron/ChevronLeft.js';
|
|
5
|
+
import ChevronRight from '../../Navigation/Indicators/Chevron/ChevronRight.js';
|
|
6
|
+
|
|
7
|
+
function resolveCell(column, row) {
|
|
8
|
+
if (column.render)
|
|
9
|
+
return column.render(row);
|
|
10
|
+
if (column.name) {
|
|
11
|
+
const value = row[column.name];
|
|
12
|
+
return value == null ? null : String(value);
|
|
13
|
+
}
|
|
14
|
+
if (typeof column.accessor === 'function') {
|
|
15
|
+
const value = column.accessor(row);
|
|
16
|
+
return value == null ? null : String(value);
|
|
17
|
+
}
|
|
18
|
+
if (column.accessor) {
|
|
19
|
+
const value = row[column.accessor];
|
|
20
|
+
return value == null ? null : String(value);
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function resolveAlignClass(align = 'left') {
|
|
25
|
+
if (align === 'center')
|
|
26
|
+
return 'text-center';
|
|
27
|
+
if (align === 'right')
|
|
28
|
+
return 'text-right';
|
|
29
|
+
return 'text-left';
|
|
30
|
+
}
|
|
31
|
+
function resolveJustifyClass(align = 'left') {
|
|
32
|
+
if (align === 'center')
|
|
33
|
+
return 'justify-center';
|
|
34
|
+
if (align === 'right')
|
|
35
|
+
return 'justify-end';
|
|
36
|
+
return 'justify-start';
|
|
37
|
+
}
|
|
38
|
+
function resolveColumnKey(column, index) {
|
|
39
|
+
if (column.id)
|
|
40
|
+
return column.id;
|
|
41
|
+
if (column.stringCode)
|
|
42
|
+
return column.stringCode;
|
|
43
|
+
if (column.name)
|
|
44
|
+
return String(column.name);
|
|
45
|
+
return `column-${index}`;
|
|
46
|
+
}
|
|
47
|
+
function resolveHeaderAlign(column) {
|
|
48
|
+
return column.headerAlignment ?? 'left';
|
|
49
|
+
}
|
|
50
|
+
function resolveContentAlign(column) {
|
|
51
|
+
return column.contentAlignment ?? 'left';
|
|
52
|
+
}
|
|
53
|
+
function resolveSizeValue(value) {
|
|
54
|
+
if (value == null)
|
|
55
|
+
return undefined;
|
|
56
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
57
|
+
}
|
|
58
|
+
function resolveColumnStyle(column, totalFlex) {
|
|
59
|
+
const width = resolveSizeValue(column.width);
|
|
60
|
+
if (width) {
|
|
61
|
+
return { width, minWidth: width };
|
|
62
|
+
}
|
|
63
|
+
const columnFlex = column.flex ?? 1;
|
|
64
|
+
if (columnFlex > 0 && totalFlex > 0) {
|
|
65
|
+
return {
|
|
66
|
+
width: `${(columnFlex / totalFlex) * 100}%`,
|
|
67
|
+
minWidth: 'max-content',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { minWidth: 'max-content' };
|
|
71
|
+
}
|
|
72
|
+
function resolveFixedWidthStyle(width) {
|
|
73
|
+
const resolvedWidth = resolveSizeValue(width);
|
|
74
|
+
if (!resolvedWidth)
|
|
75
|
+
return undefined;
|
|
76
|
+
return { width: resolvedWidth, minWidth: resolvedWidth };
|
|
77
|
+
}
|
|
78
|
+
function resolveActionsColumnStyle(width) {
|
|
79
|
+
if (width != null)
|
|
80
|
+
return resolveFixedWidthStyle(width) ?? { width: '1%', minWidth: 'max-content' };
|
|
81
|
+
return { width: '1%', minWidth: 'max-content' };
|
|
82
|
+
}
|
|
83
|
+
const DataGrid = ({ columns, data, rowKey, actions, selection, className, tableClassName, emptyMessage = 'No data', pagination, }) => {
|
|
84
|
+
const selectionColumnClassName = 'w-[72px]';
|
|
85
|
+
const headerCheckboxRef = useRef(null);
|
|
86
|
+
const resolvedRowKeys = useMemo(() => data.map((row, index) => {
|
|
87
|
+
if (typeof rowKey === 'function')
|
|
88
|
+
return rowKey(row, index);
|
|
89
|
+
const value = row[rowKey];
|
|
90
|
+
return value == null ? `${index}` : String(value);
|
|
91
|
+
}), [data, rowKey]);
|
|
92
|
+
const selectedKeySet = useMemo(() => new Set(selection?.selectedRowKeys ?? []), [selection?.selectedRowKeys]);
|
|
93
|
+
const selectableRowKeys = useMemo(() => (selection ? resolvedRowKeys.filter((key) => !selection.isRowDisabled?.(key)) : resolvedRowKeys), [resolvedRowKeys, selection]);
|
|
94
|
+
const allVisibleSelected = selectableRowKeys.length > 0 && selectableRowKeys.every((key) => selectedKeySet.has(key));
|
|
95
|
+
const someVisibleSelected = selectableRowKeys.some((key) => selectedKeySet.has(key));
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (!headerCheckboxRef.current)
|
|
98
|
+
return;
|
|
99
|
+
headerCheckboxRef.current.indeterminate = !allVisibleSelected && someVisibleSelected;
|
|
100
|
+
}, [allVisibleSelected, someVisibleSelected]);
|
|
101
|
+
const colCount = columns.length + (actions ? 1 : 0) + (selection ? 1 : 0);
|
|
102
|
+
const totalFlex = useMemo(() => columns.reduce((acc, column) => acc + (column.width == null ? (column.flex ?? 1) : 0), 0), [columns]);
|
|
103
|
+
const handleToggleAll = () => {
|
|
104
|
+
if (!selection)
|
|
105
|
+
return;
|
|
106
|
+
if (selectableRowKeys.length === 0)
|
|
107
|
+
return;
|
|
108
|
+
if (allVisibleSelected) {
|
|
109
|
+
const next = selection.selectedRowKeys.filter((key) => !selectableRowKeys.includes(key));
|
|
110
|
+
selection.onSelectedRowKeysChange(next);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const next = Array.from(new Set([...selection.selectedRowKeys, ...selectableRowKeys]));
|
|
114
|
+
selection.onSelectedRowKeysChange(next);
|
|
115
|
+
};
|
|
116
|
+
const handleToggleRow = (key, isDisabled) => {
|
|
117
|
+
if (!selection)
|
|
118
|
+
return;
|
|
119
|
+
if (isDisabled)
|
|
120
|
+
return;
|
|
121
|
+
if (selectedKeySet.has(key)) {
|
|
122
|
+
selection.onSelectedRowKeysChange(selection.selectedRowKeys.filter((it) => it !== key));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
selection.onSelectedRowKeysChange([...selection.selectedRowKeys, key]);
|
|
126
|
+
};
|
|
127
|
+
return (jsxs("div", { className: [
|
|
128
|
+
'w-full overflow-hidden rounded-2xl border border-[var(--color-secondary-outline)] bg-[var(--color-primary-white)]',
|
|
129
|
+
className,
|
|
130
|
+
]
|
|
131
|
+
.filter(Boolean)
|
|
132
|
+
.join(' '), children: [jsx("div", { className: "w-full overflow-x-auto", children: jsxs("table", { className: ['w-full table-auto border-collapse', tableClassName].filter(Boolean).join(' '), children: [jsx("thead", { children: jsxs("tr", { className: "border-b border-[var(--color-secondary-outline)]", children: [selection ? (jsx("th", { className: [selectionColumnClassName, 'p-0 text-center align-middle'].join(' '), children: selection.showSelectAll === false ? null : (jsx("div", { className: "flex h-14 items-center justify-center px-4", children: jsxs("span", { className: "relative inline-flex items-center justify-center h-6 w-6", children: [jsx("input", { ref: headerCheckboxRef, type: "checkbox", checked: allVisibleSelected, onChange: handleToggleAll, disabled: selectableRowKeys.length === 0, "aria-label": selection.headerAriaLabel ?? 'Select all rows', className: "\n peer\n h-6 w-6\n rounded-lg\n border\n border-[var(--color-secondary-outline)]\n appearance-none\n cursor-pointer\n checked:border-[var(--color-primary-purple)]\n checked:bg-[var(--color-primary-white)]\n transition-colors\n disabled:opacity-50\n disabled:cursor-not-allowed\n " }), jsx("svg", { viewBox: "0 0 16 16", className: "\n pointer-events-none\n absolute\n h-3 w-3\n opacity-0\n peer-checked:opacity-100\n ", children: jsx("path", { d: "M3 8.5L6.5 12L13 4", fill: "none", stroke: "var(--color-primary-purple)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })] }) })) })) : null, columns.map((column, columnIndex) => {
|
|
133
|
+
const columnKey = resolveColumnKey(column, columnIndex);
|
|
134
|
+
const headerAlign = resolveHeaderAlign(column);
|
|
135
|
+
const alignClass = resolveAlignClass(headerAlign);
|
|
136
|
+
const isSortable = Boolean(column.sortable && column.onSort);
|
|
137
|
+
const sortIndicator = column.sortDirection === 'asc' ? ' ↑' : column.sortDirection === 'desc' ? ' ↓' : '';
|
|
138
|
+
return (jsx("th", { style: resolveColumnStyle(column, totalFlex), className: [
|
|
139
|
+
'p-0 text-sm font-semibold text-[var(--color-primary-black)] align-middle',
|
|
140
|
+
alignClass,
|
|
141
|
+
column.headerCellClassName,
|
|
142
|
+
]
|
|
143
|
+
.filter(Boolean)
|
|
144
|
+
.join(' '), children: jsx("div", { className: [
|
|
145
|
+
'flex h-14 items-center px-2',
|
|
146
|
+
resolveJustifyClass(headerAlign),
|
|
147
|
+
column.headerContentClassName,
|
|
148
|
+
]
|
|
149
|
+
.filter(Boolean)
|
|
150
|
+
.join(' '), children: isSortable ? (jsxs("button", { type: "button", onClick: column.onSort, className: "inline-flex items-center gap-1 hover:text-[var(--color-primary-purple)]", children: [jsx("span", { children: column.header }), jsx("span", { children: sortIndicator })] })) : (column.header) }) }, columnKey));
|
|
151
|
+
}), actions ? (jsx("th", { style: resolveActionsColumnStyle(actions.columnWidth), className: [
|
|
152
|
+
'whitespace-nowrap p-0 text-center text-sm font-semibold text-[var(--color-primary-black)] align-middle',
|
|
153
|
+
actions.headerCellClassName,
|
|
154
|
+
]
|
|
155
|
+
.filter(Boolean)
|
|
156
|
+
.join(' '), children: jsx("div", { className: ['flex h-14 items-center justify-center px-4', actions.headerContentClassName]
|
|
157
|
+
.filter(Boolean)
|
|
158
|
+
.join(' '), children: actions.header ?? 'Actions' }) })) : null] }) }), jsx("tbody", { children: data.length > 0 ? (data.map((row, index) => {
|
|
159
|
+
const key = resolvedRowKeys[index];
|
|
160
|
+
return (jsxs("tr", { className: "h-14 border-b border-[var(--color-secondary-outline)] last:border-b-0", children: [selection ? (jsx("td", { className: [selectionColumnClassName, 'p-0 text-center align-middle'].join(' '), children: jsxs("span", { className: "relative inline-flex h-14 w-full items-center justify-center px-4", children: [jsx("input", { type: "checkbox", checked: selectedKeySet.has(key), onChange: () => handleToggleRow(key, Boolean(selection.isRowDisabled?.(key))), disabled: Boolean(selection.isRowDisabled?.(key)), "aria-label": selection.rowAriaLabel?.(key) ?? `Select row ${key}`, className: "\n peer\n h-6 w-6\n rounded-lg\n border\n border-[var(--color-secondary-outline)]\n appearance-none\n cursor-pointer\n checked:border-[var(--color-primary-purple)]\n checked:bg-[var(--color-primary-white)]\n transition-colors\n disabled:opacity-50\n disabled:cursor-not-allowed\n " }), jsx("svg", { viewBox: "0 0 16 16", className: "\n pointer-events-none\n absolute\n h-3 w-3\n opacity-0\n peer-checked:opacity-100\n ", children: jsx("path", { d: "M3 8.5L6.5 12L13 4", fill: "none", stroke: "var(--color-primary-purple)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })] }) })) : null, columns.map((column, columnIndex) => {
|
|
161
|
+
const columnKey = resolveColumnKey(column, columnIndex);
|
|
162
|
+
const contentAlign = resolveContentAlign(column);
|
|
163
|
+
const alignClass = resolveAlignClass(contentAlign);
|
|
164
|
+
return (jsx("td", { style: resolveColumnStyle(column, totalFlex), className: [
|
|
165
|
+
'p-0 text-sm text-[var(--color-primary-black)] align-middle',
|
|
166
|
+
alignClass,
|
|
167
|
+
column.cellClassName,
|
|
168
|
+
]
|
|
169
|
+
.filter(Boolean)
|
|
170
|
+
.join(' '), children: jsx("div", { className: [
|
|
171
|
+
'flex h-14 items-center px-2',
|
|
172
|
+
resolveJustifyClass(contentAlign),
|
|
173
|
+
column.cellContentClassName,
|
|
174
|
+
]
|
|
175
|
+
.filter(Boolean)
|
|
176
|
+
.join(' '), children: resolveCell(column, row) }) }, `${key}-${columnKey}`));
|
|
177
|
+
}), actions ? (jsx("td", { style: resolveActionsColumnStyle(actions.columnWidth), className: ['whitespace-nowrap p-0 text-center align-middle', actions.cellClassName]
|
|
178
|
+
.filter(Boolean)
|
|
179
|
+
.join(' '), children: jsx(OverflowMenu, { items: actions.items(row), align: actions.align ?? 'end', side: actions.side ?? 'bottom', triggerClassName: [
|
|
180
|
+
'inline-flex h-14 w-full items-center justify-center px-4',
|
|
181
|
+
actions.triggerClassName,
|
|
182
|
+
]
|
|
183
|
+
.filter(Boolean)
|
|
184
|
+
.join(' '), menuClassName: actions.menuClassName }) })) : null] }, key));
|
|
185
|
+
})) : (jsx("tr", { children: jsx("td", { colSpan: colCount, className: "px-6 py-10 text-center text-sm text-[var(--color-secondary-grey-fonts)]", children: emptyMessage }) })) })] }) }), pagination ? (jsxs("footer", { className: "flex items-center justify-end gap-4 border-t border-[var(--color-secondary-outline)] px-6 py-4", children: [jsx("span", { className: "text-sm text-[var(--color-primary-black)]", children: pagination.pageLabel?.({ page: pagination.page, hasNext: pagination.hasNext }) ??
|
|
186
|
+
`Page ${pagination.page + 1}` }), jsxs("div", { className: "flex items-center gap-1 text-[var(--color-primary-black)]", children: [jsx("button", { type: "button", onClick: () => pagination.onPageChange(0), disabled: pagination.page <= 0, "aria-label": "First page", className: "inline-flex h-8 w-8 items-center justify-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", children: jsx(ChevronLeft, { double: true, sizePx: 18 }) }), jsx("button", { type: "button", onClick: () => pagination.onPageChange(Math.max(0, pagination.page - 1)), disabled: pagination.page <= 0, "aria-label": "Previous page", className: "inline-flex h-8 w-8 items-center justify-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", children: jsx(ChevronLeft, { sizePx: 18 }) }), jsx("button", { type: "button", onClick: () => pagination.onPageChange(pagination.page + 1), disabled: !pagination.hasNext, "aria-label": "Next page", className: "inline-flex h-8 w-8 items-center justify-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", children: jsx(ChevronRight, { sizePx: 18 }) }), jsx("button", { type: "button", onClick: () => pagination.onPageChange(pagination.page + 1), disabled: !pagination.hasNext, "aria-label": "Last page", className: "inline-flex h-8 w-8 items-center justify-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", children: jsx(ChevronRight, { double: true, sizePx: 18 }) })] })] })) : null] }));
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { DataGrid as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
const ChevronLeft = () => {
|
|
4
|
-
return (jsx("svg", { width:
|
|
3
|
+
const ChevronLeft = ({ sizePx = 30, className, double = false }) => {
|
|
4
|
+
return (jsx("svg", { width: sizePx, height: sizePx, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: ['cursor-pointer', className ?? ''].filter(Boolean).join(' '), children: double ? (jsxs(Fragment, { children: [jsx("path", { d: "M17 6l-6 6 6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }), jsx("path", { d: "M12 6l-6 6 6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] })) : (jsx("path", { d: "M15 6l-6 6 6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })) }));
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { ChevronLeft as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
const ChevronRight = () => {
|
|
4
|
-
return (jsx("svg", { width:
|
|
3
|
+
const ChevronRight = ({ sizePx = 30, className, double = false }) => {
|
|
4
|
+
return (jsx("svg", { width: sizePx, height: sizePx, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: ['cursor-pointer', className ?? ''].filter(Boolean).join(' '), children: double ? (jsxs(Fragment, { children: [jsx("path", { d: "M7 6l6 6-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }), jsx("path", { d: "M12 6l6 6-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] })) : (jsx("path", { d: "M9 6l6 6-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })) }));
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { ChevronRight as default };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
function Modal({ isOpen, onClose, title, children, size = 'md' }) {
|
|
5
|
-
// Hooks siempre arriba
|
|
6
|
-
const [scrolled, setScrolled] = useState(false);
|
|
7
5
|
// Bloquea el scroll del body solo si está abierto
|
|
8
6
|
useEffect(() => {
|
|
9
7
|
if (!isOpen)
|
|
@@ -29,14 +27,10 @@ function Modal({ isOpen, onClose, title, children, size = 'md' }) {
|
|
|
29
27
|
relative bg-(--color-primary-white) rounded-2xl shadow-2xl
|
|
30
28
|
${sizeClasses[size]}
|
|
31
29
|
overflow-hidden
|
|
32
|
-
`, children: jsxs("div", { className: "overflow-y-auto modal-scroll", style: {
|
|
30
|
+
`, children: jsxs("div", { className: "\n overflow-y-auto overflow-x-hidden modal-scroll\n max-sm:[&_.modal-actions]:flex-col\n max-sm:[&_.modal-actions]:items-stretch\n max-sm:[&_.modal-actions_.modal-action]:w-full\n ", style: {
|
|
33
31
|
// Alto máx. usando viewport visible + safe areas + margen exterior (2rem)
|
|
34
32
|
maxHeight: 'calc(100dvh - max(env(safe-area-inset-top),0px) - max(env(safe-area-inset-bottom),0px) - 2rem)',
|
|
35
|
-
},
|
|
36
|
-
sticky top-0 z-10 bg-(--color-primary-white)/95 backdrop-blur
|
|
37
|
-
transition-shadow
|
|
38
|
-
${scrolled ? 'shadow-md' : 'shadow-none'}
|
|
39
|
-
`, children: [jsx("button", { type: "button", onClick: onClose, className: "cursor-pointer absolute right-5 top-4 text-xl leading-none", "aria-label": "Close", children: "\u2715" }), title && jsx("h2", { className: "text-2xl font-bold px-6 pt-5 pb-3 pr-12", children: title })] })), jsx("div", { className: `p-6 pt-4 ${title ? 'mt-0' : 'mt-10'}`, children: children })] }) }) }));
|
|
33
|
+
}, children: [(title || true) && (jsxs("div", { className: "relative bg-(--color-primary-white)", children: [jsx("button", { type: "button", onClick: onClose, className: "cursor-pointer absolute right-5 top-4 text-xl leading-none", "aria-label": "Close", children: "\u2715" }), title && jsx("h2", { className: "text-2xl font-bold px-6 pt-5 pb-3 pr-12", children: title })] })), jsx("div", { className: `p-6 pt-4 ${title ? 'mt-0' : 'mt-10'}`, children: children })] }) }) }));
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
export { Modal as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,18 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, {
|
|
2
|
+
import React__default, { ImgHTMLAttributes, ReactNode, ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
declare function useDebouncedValue<T>(value: T, delay?: number): T;
|
|
6
6
|
|
|
7
7
|
declare function useViewportVhVar(freeze?: boolean): void;
|
|
8
8
|
|
|
9
|
-
type Props$
|
|
9
|
+
type Props$8 = {
|
|
10
10
|
zIndex?: number;
|
|
11
11
|
lockBodyScroll?: boolean;
|
|
12
12
|
className?: string;
|
|
13
13
|
children: React.ReactNode;
|
|
14
14
|
};
|
|
15
|
-
declare function FullscreenCenter({ zIndex, lockBodyScroll, className, children }: Props$
|
|
16
|
-
|
|
17
|
-
declare const Separator: ({ className }: {
|
|
18
|
-
className: string;
|
|
19
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
20
|
-
|
|
21
|
-
declare const Button: React$1.ForwardRefExoticComponent<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
22
|
-
variant?: "primary" | "danger" | "primaryOutline" | "outline" | "disabled";
|
|
23
|
-
asChild?: boolean;
|
|
24
|
-
className?: string;
|
|
25
|
-
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
26
|
-
|
|
27
|
-
type ButtonRowProps = {
|
|
28
|
-
items: React__default.ReactNode[];
|
|
29
|
-
className?: string;
|
|
30
|
-
innerClassName?: string;
|
|
31
|
-
};
|
|
32
|
-
declare function ButtonRow({ items, className, innerClassName }: ButtonRowProps): react_jsx_runtime.JSX.Element | null;
|
|
33
|
-
|
|
34
|
-
type GoogleButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
35
|
-
declare const GoogleButton: ({ className, children, ...props }: GoogleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
15
|
+
declare function FullscreenCenter({ zIndex, lockBodyScroll, className, children }: Props$8): React$1.ReactPortal;
|
|
36
16
|
|
|
37
17
|
type IconName = 'ogIcon' | 'switcher' | 'tick' | 'view' | 'viewHide' | 'open' | 'burger' | 'burgerClose' | 'arrowLongLeft' | 'catalog' | 'copyLink' | 'clapper' | 'clapperManage' | 'clock' | 'file' | 'filter' | 'profile' | 'settings' | 'cross' | 'edit' | 'mail' | 'location' | 'calendar' | 'behance' | 'imdb' | 'plus' | 'whatsapp' | 'vimeo' | 'instagram' | 'x' | 'tikTok' | 'linkedin' | 'delete' | 'save' | 'publish' | 'overflowmenu' | 'applicants' | 'search' | 'info' | 'play' | 'web' | 'warning' | 'logout';
|
|
38
18
|
type IconVariant = 'default' | 'primary' | 'white' | 'success' | 'danger' | 'disabled';
|
|
@@ -43,12 +23,12 @@ type IconProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'src'> & {
|
|
|
43
23
|
};
|
|
44
24
|
declare function Icon({ name, variant, size, className, alt, style, ...rest }: IconProps): react_jsx_runtime.JSX.Element;
|
|
45
25
|
|
|
46
|
-
type Props$
|
|
26
|
+
type Props$7 = React__default.SVGProps<SVGSVGElement> & {
|
|
47
27
|
width?: number | string;
|
|
48
28
|
height?: number | string;
|
|
49
29
|
color?: string;
|
|
50
30
|
};
|
|
51
|
-
declare function HilighterSvg({ width, height, color, ...rest }: Props$
|
|
31
|
+
declare function HilighterSvg({ width, height, color, ...rest }: Props$7): react_jsx_runtime.JSX.Element;
|
|
52
32
|
|
|
53
33
|
type OverflowMenuActionItem = {
|
|
54
34
|
type?: 'item';
|
|
@@ -76,7 +56,7 @@ type OverflowMenuItem = OverflowMenuActionItem | OverflowMenuSeparatorItem | Ove
|
|
|
76
56
|
type OverflowMenuAlign = 'start' | 'end';
|
|
77
57
|
type OverflowMenuSide = 'top' | 'bottom';
|
|
78
58
|
|
|
79
|
-
type Props$
|
|
59
|
+
type Props$6 = {
|
|
80
60
|
items: OverflowMenuItem[];
|
|
81
61
|
align?: OverflowMenuAlign;
|
|
82
62
|
side?: OverflowMenuSide;
|
|
@@ -90,7 +70,91 @@ type Props$5 = {
|
|
|
90
70
|
disabled: boolean;
|
|
91
71
|
}) => React.ReactNode;
|
|
92
72
|
};
|
|
93
|
-
declare const OverflowMenu: ({ items, align, side, offset, triggerClassName, menuClassName, itemClassName, disabled, trigger, }: Props$
|
|
73
|
+
declare const OverflowMenu: ({ items, align, side, offset, triggerClassName, menuClassName, itemClassName, disabled, trigger, }: Props$6) => react_jsx_runtime.JSX.Element;
|
|
74
|
+
|
|
75
|
+
type DataGridAlign = 'left' | 'center' | 'right';
|
|
76
|
+
type DataGridColumn<T> = {
|
|
77
|
+
id?: string;
|
|
78
|
+
name?: keyof T;
|
|
79
|
+
stringCode?: string;
|
|
80
|
+
header: ReactNode;
|
|
81
|
+
accessor?: keyof T | ((row: T) => unknown);
|
|
82
|
+
render?: (row: T) => ReactNode;
|
|
83
|
+
width?: number | string;
|
|
84
|
+
flex?: number;
|
|
85
|
+
headerAlignment?: DataGridAlign;
|
|
86
|
+
contentAlignment?: DataGridAlign;
|
|
87
|
+
cellClassName?: string;
|
|
88
|
+
headerCellClassName?: string;
|
|
89
|
+
cellContentClassName?: string;
|
|
90
|
+
headerContentClassName?: string;
|
|
91
|
+
sortable?: boolean;
|
|
92
|
+
sortDirection?: 'asc' | 'desc';
|
|
93
|
+
onSort?: () => void;
|
|
94
|
+
};
|
|
95
|
+
type DataGridActions<T> = {
|
|
96
|
+
header?: ReactNode;
|
|
97
|
+
items: (row: T) => OverflowMenuItem[];
|
|
98
|
+
columnWidth?: number | string;
|
|
99
|
+
align?: OverflowMenuAlign;
|
|
100
|
+
side?: OverflowMenuSide;
|
|
101
|
+
headerCellClassName?: string;
|
|
102
|
+
cellClassName?: string;
|
|
103
|
+
headerContentClassName?: string;
|
|
104
|
+
triggerClassName?: string;
|
|
105
|
+
menuClassName?: string;
|
|
106
|
+
};
|
|
107
|
+
type DataGridPagination = {
|
|
108
|
+
page: number;
|
|
109
|
+
hasNext: boolean;
|
|
110
|
+
onPageChange: (nextPage: number) => void;
|
|
111
|
+
pageLabel?: (ctx: {
|
|
112
|
+
page: number;
|
|
113
|
+
hasNext: boolean;
|
|
114
|
+
}) => ReactNode;
|
|
115
|
+
previousLabel?: ReactNode;
|
|
116
|
+
nextLabel?: ReactNode;
|
|
117
|
+
};
|
|
118
|
+
type DataGridSelection = {
|
|
119
|
+
selectedRowKeys: string[];
|
|
120
|
+
onSelectedRowKeysChange: (next: string[]) => void;
|
|
121
|
+
showSelectAll?: boolean;
|
|
122
|
+
rowAriaLabel?: (rowKey: string) => string;
|
|
123
|
+
headerAriaLabel?: string;
|
|
124
|
+
isRowDisabled?: (rowKey: string) => boolean;
|
|
125
|
+
};
|
|
126
|
+
type Props$5<T> = {
|
|
127
|
+
columns: DataGridColumn<T>[];
|
|
128
|
+
data: T[];
|
|
129
|
+
rowKey: keyof T | ((row: T, index: number) => string);
|
|
130
|
+
actions?: DataGridActions<T>;
|
|
131
|
+
selection?: DataGridSelection;
|
|
132
|
+
className?: string;
|
|
133
|
+
tableClassName?: string;
|
|
134
|
+
emptyMessage?: ReactNode;
|
|
135
|
+
pagination?: DataGridPagination;
|
|
136
|
+
};
|
|
137
|
+
declare const DataGrid: <T>({ columns, data, rowKey, actions, selection, className, tableClassName, emptyMessage, pagination, }: Props$5<T>) => react_jsx_runtime.JSX.Element;
|
|
138
|
+
|
|
139
|
+
declare const Separator: ({ className }: {
|
|
140
|
+
className: string;
|
|
141
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
142
|
+
|
|
143
|
+
declare const Button: React$1.ForwardRefExoticComponent<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
144
|
+
variant?: "primary" | "danger" | "primaryOutline" | "outline" | "disabled";
|
|
145
|
+
asChild?: boolean;
|
|
146
|
+
className?: string;
|
|
147
|
+
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
148
|
+
|
|
149
|
+
type ButtonRowProps = {
|
|
150
|
+
items: React__default.ReactNode[];
|
|
151
|
+
className?: string;
|
|
152
|
+
innerClassName?: string;
|
|
153
|
+
};
|
|
154
|
+
declare function ButtonRow({ items, className, innerClassName }: ButtonRowProps): react_jsx_runtime.JSX.Element | null;
|
|
155
|
+
|
|
156
|
+
type GoogleButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
157
|
+
declare const GoogleButton: ({ className, children, ...props }: GoogleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
94
158
|
|
|
95
159
|
declare const TextDropdownTrigger: ({ label, open }: {
|
|
96
160
|
label: string;
|
|
@@ -356,9 +420,19 @@ type UniversalVideoPlayerProps = {
|
|
|
356
420
|
|
|
357
421
|
declare function UniversalVideoPlayer({ url, title, autoplay, controls, muted, loop, start, className, unsupportedMessage, openLinkLabel, }: UniversalVideoPlayerProps): react_jsx_runtime.JSX.Element;
|
|
358
422
|
|
|
359
|
-
|
|
423
|
+
type ChevronLeftProps = {
|
|
424
|
+
sizePx?: number;
|
|
425
|
+
className?: string;
|
|
426
|
+
double?: boolean;
|
|
427
|
+
};
|
|
428
|
+
declare const ChevronLeft: ({ sizePx, className, double }: ChevronLeftProps) => react_jsx_runtime.JSX.Element;
|
|
360
429
|
|
|
361
|
-
|
|
430
|
+
type ChevronRightProps = {
|
|
431
|
+
sizePx?: number;
|
|
432
|
+
className?: string;
|
|
433
|
+
double?: boolean;
|
|
434
|
+
};
|
|
435
|
+
declare const ChevronRight: ({ sizePx, className, double }: ChevronRightProps) => react_jsx_runtime.JSX.Element;
|
|
362
436
|
|
|
363
437
|
type ChevronUpDownProps = {
|
|
364
438
|
open: boolean;
|
|
@@ -427,5 +501,5 @@ type WizardProps = {
|
|
|
427
501
|
};
|
|
428
502
|
declare function Wizard({ children }: WizardProps): ReactElement<WizardStepProps, string | React$1.JSXElementConstructor<any>>;
|
|
429
503
|
|
|
430
|
-
export { Button, ButtonRow, ChevronLeft, ChevronRight, ChevronUpDown, Chip, CurrencyInput, DetailsView, FormCurrencyField, FormInputField, FormPasswordField, FormSelectField, FullscreenCenter, GoogleButton, HilighterSvg, Icon, ImageCarousel, Input, Label, Logo, Modal, OverflowMenu, PasswordInput, PhotoZoomOverlay, Pills, SearchInput, SearchWithSuggestions, Select, Separator, Spinner, StatusChip, TextDropdownTrigger, Toast, ToastProvider, Tooltip, UniversalVideoPlayer, UploadTile, VideoPreviewCard, Wizard, WizardStep, clearToasts, dismissToast, showToast, useDebouncedValue, useToast, useViewportVhVar };
|
|
431
|
-
export type { IconName, IconVariant, OverflowMenuAlign, OverflowMenuItem, OverflowMenuSide, PillItem, ShowToastOptions, ToastContent, ToastContextValue, ToastPosition, ToastProps, ToastRecord, ToastType, TooltipPosition, TooltipProps, UniversalVideoPlayerProps, VideoProvider, WizardStepProps };
|
|
504
|
+
export { Button, ButtonRow, ChevronLeft, ChevronRight, ChevronUpDown, Chip, CurrencyInput, DataGrid, DetailsView, FormCurrencyField, FormInputField, FormPasswordField, FormSelectField, FullscreenCenter, GoogleButton, HilighterSvg, Icon, ImageCarousel, Input, Label, Logo, Modal, OverflowMenu, PasswordInput, PhotoZoomOverlay, Pills, SearchInput, SearchWithSuggestions, Select, Separator, Spinner, StatusChip, TextDropdownTrigger, Toast, ToastProvider, Tooltip, UniversalVideoPlayer, UploadTile, VideoPreviewCard, Wizard, WizardStep, clearToasts, dismissToast, showToast, useDebouncedValue, useToast, useViewportVhVar };
|
|
505
|
+
export type { DataGridActions, DataGridColumn, DataGridPagination, DataGridSelection, IconName, IconVariant, OverflowMenuAlign, OverflowMenuItem, OverflowMenuSide, PillItem, ShowToastOptions, ToastContent, ToastContextValue, ToastPosition, ToastProps, ToastRecord, ToastType, TooltipPosition, TooltipProps, UniversalVideoPlayerProps, VideoProvider, WizardStepProps };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { useDebouncedValue } from './hooks/useDebounceValue.js';
|
|
2
2
|
export { useViewportVhVar } from './hooks/useViewportVhVar.js';
|
|
3
3
|
export { default as FullscreenCenter } from './components/Layout/FullscreenCenter.js';
|
|
4
|
+
export { default as DataGrid } from './components/Layout/DataGrid/DataGrid.js';
|
|
4
5
|
export { default as Separator } from './components/Layout/Separator/Separator.js';
|
|
5
6
|
export { default as Button } from './components/Actions/Buttons/Button/Button.js';
|
|
6
7
|
export { default as ButtonRow } from './components/Actions/Buttons/Button/ButtonRow.js';
|