@eml-payments/ui-kit 0.1.27 → 0.1.29
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/src/components/DropdownWrapper/DropdownWrapper.d.ts +2 -1
- package/dist/src/components/DropdownWrapper/DropdownWrapper.js +2 -2
- package/dist/src/components/Table/Table.js +1 -1
- package/dist/src/components/Table/Table.stories.js +1 -0
- package/dist/src/components/Table/Table.types.d.ts +1 -0
- package/dist/src/components/index.d.ts +3 -0
- package/dist/src/components/index.js +3 -0
- package/package.json +4 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DropdownOption, DropdownStructure } from './DropdownWrapper.types';
|
|
3
|
-
declare const DropdownWrapper: ({ triggerElement, options, className, structure, selectedValue, onValueChange, }: {
|
|
3
|
+
declare const DropdownWrapper: ({ triggerElement, options, className, structure, selectedValue, onValueChange, menuAlignment, }: {
|
|
4
4
|
triggerElement: React.ReactNode;
|
|
5
5
|
options: DropdownOption[];
|
|
6
6
|
className?: string;
|
|
7
7
|
structure?: DropdownStructure;
|
|
8
8
|
selectedValue?: string;
|
|
9
9
|
onValueChange?: (value: string) => void;
|
|
10
|
+
menuAlignment?: "start" | "end" | "center" | undefined;
|
|
10
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export { DropdownWrapper };
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, } from '../Dropdown';
|
|
4
4
|
const getKey = (opt) => { var _a, _b; return (_a = opt.value) !== null && _a !== void 0 ? _a : `${(_b = opt.groupLabel) !== null && _b !== void 0 ? _b : 'group'}-${opt.label}`; };
|
|
5
|
-
const DropdownWrapper = ({ triggerElement, options, className, structure = 'default', selectedValue, onValueChange, }) => {
|
|
5
|
+
const DropdownWrapper = ({ triggerElement, options, className, structure = 'default', selectedValue, onValueChange, menuAlignment = 'start', }) => {
|
|
6
6
|
const renderContent = () => {
|
|
7
7
|
switch (structure) {
|
|
8
8
|
case 'radio':
|
|
@@ -26,6 +26,6 @@ const DropdownWrapper = ({ triggerElement, options, className, structure = 'defa
|
|
|
26
26
|
return options.map((opt) => (_jsx(DropdownMenuItem, { onSelect: opt.onSelect, disabled: opt.disabled, children: opt.label }, opt.label)));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: triggerElement }), _jsx(DropdownMenuContent, { className: className !== null && className !== void 0 ? className : 'w-56', children: renderContent() })] }));
|
|
29
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: triggerElement }), _jsx(DropdownMenuContent, { className: className !== null && className !== void 0 ? className : 'w-56', align: menuAlignment !== null && menuAlignment !== void 0 ? menuAlignment : 'start', children: renderContent() })] }));
|
|
30
30
|
};
|
|
31
31
|
export { DropdownWrapper };
|
|
@@ -23,7 +23,7 @@ export function Table(props) {
|
|
|
23
23
|
return (_jsxs("tr", { className: classNames('border-t hover:bg-[var(--uikit-primary-10)]', props.onRowClick && 'cursor-pointer', row.getIsSelected() && 'bg-[var(--uikit-primary-10)]'), onClick: () => { var _a; return (_a = props.onRowClick) === null || _a === void 0 ? void 0 : _a.call(props, row.original); }, children: [row.getVisibleCells().map((cell) => {
|
|
24
24
|
const width = cell.column.getSize();
|
|
25
25
|
return (_jsx("td", { style: { width }, className: cell.column.id === 'select' ? 'p-1' : 'px-4 py-2', children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
26
|
-
}), props.tableActionsDropdown && (_jsx("td", { className: "w-[40px] px-2 py-2 text-right", children: _jsx(DropdownWrapper, { structure: (_a = props.tableActionsDropdown.structure) !== null && _a !== void 0 ? _a : 'default', options: props.tableActionsDropdown.getOptions(row.original), triggerElement: (_e = (_d = (_b = props.tableActionsDropdown).renderCustomTrigger) === null || _d === void 0 ? void 0 : _d.call(_b, row.original)) !== null && _e !== void 0 ? _e : (_jsx(Button, { size: "icon", variant: "ghost", className: "p-1 focus-visible:outline-none focus-visible:ring-0", children: _jsx(FiMoreHorizontal, { size: 16 }) })) }) }))] }, row.original[((_f = props.rowIdKey) !== null && _f !== void 0 ? _f : 'id')]));
|
|
26
|
+
}), props.tableActionsDropdown && (_jsx("td", { className: "w-[40px] px-2 py-2 text-right", children: _jsx(DropdownWrapper, { structure: (_a = props.tableActionsDropdown.structure) !== null && _a !== void 0 ? _a : 'default', options: props.tableActionsDropdown.getOptions(row.original), menuAlignment: props.tableActionsDropdown.menuAlignment, triggerElement: (_e = (_d = (_b = props.tableActionsDropdown).renderCustomTrigger) === null || _d === void 0 ? void 0 : _d.call(_b, row.original)) !== null && _e !== void 0 ? _e : (_jsx(Button, { size: "icon", variant: "ghost", className: "p-1 focus-visible:outline-none focus-visible:ring-0", children: _jsx(FiMoreHorizontal, { size: 16 }) })) }) }))] }, row.original[((_f = props.rowIdKey) !== null && _f !== void 0 ? _f : 'id')]));
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
return (_jsxs("div", { className: "relative w-full overflow-auto", children: [props.isLoading && _jsx("div", { className: "mui-loader" }), _jsx("div", { className: "rounded-[var(--uikit-radius)] overflow-hidden border", children: _jsxs("table", { className: classNames('min-w-full text-sm table-fixed', props.className), role: "table", id: props.id, children: [showHeader && (_jsx("thead", { className: "bg-[var(--uikit-tertiary)]", children: table.getHeaderGroups().map((headerGroup) => (_jsxs("tr", { children: [headerGroup.headers.map((header) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eml-payments/ui-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ARLO UIKit",
|
|
6
6
|
"homepage": "https://github.com/EML-Payments/arlo.npm.uikit#readme",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@tanstack/react-table": "^8.12.0",
|
|
62
62
|
"class-variance-authority": "^0.7.1",
|
|
63
63
|
"clsx": "^2.1.1",
|
|
64
|
-
"lucide-react": "^0.
|
|
64
|
+
"lucide-react": "^0.536.0",
|
|
65
65
|
"prettier": "^3.6.2",
|
|
66
66
|
"react": ">=18.0.0",
|
|
67
67
|
"react-dom": ">=18.0.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
91
91
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
92
92
|
"eslint-plugin-storybook": "^9.0.15",
|
|
93
|
-
"husky": "^
|
|
93
|
+
"husky": "^9.1.7",
|
|
94
94
|
"lint-staged": "^16.1.2",
|
|
95
95
|
"postcss": "^8.4.21",
|
|
96
96
|
"storybook": "^9.0.15",
|
|
@@ -109,4 +109,4 @@
|
|
|
109
109
|
"lint-staged": {
|
|
110
110
|
"*.{js,ts,tsx}": "eslint --fix"
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
}
|