@eml-payments/ui-kit 0.1.27 → 0.1.28
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/package.json +2 -2
|
@@ -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.28",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ARLO UIKit",
|
|
6
6
|
"homepage": "https://github.com/EML-Payments/arlo.npm.uikit#readme",
|
|
@@ -109,4 +109,4 @@
|
|
|
109
109
|
"lint-staged": {
|
|
110
110
|
"*.{js,ts,tsx}": "eslint --fix"
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
}
|