@eml-payments/ui-kit 1.8.17 → 1.8.18
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/assets/index.d.ts +2 -0
- package/dist/src/assets/index.js +3 -0
- package/dist/src/assets/index.ts +3 -0
- package/dist/src/components/Button/Button.d.ts +1 -2
- package/dist/src/components/Button/Button.js +8 -8
- package/dist/src/components/Button/Button.stories.d.ts +3 -18
- package/dist/src/components/Button/Button.stories.js +51 -76
- package/dist/src/components/Button/Button.types.d.ts +4 -4
- package/dist/src/components/Button/ButtonVariants.d.ts +3 -0
- package/dist/src/components/Button/ButtonVariants.js +10 -1
- package/dist/src/components/Button/index.d.ts +1 -1
- package/dist/src/components/Button/index.js +1 -1
- package/dist/src/components/Combobox/Combobox.js +1 -1
- package/dist/src/components/Input/Input.stories.js +1 -1
- package/dist/src/components/Popover/Popover.stories.js +1 -1
- package/package.json +5 -1
- package/dist/index.d.cts +0 -488
- package/dist/index.d.ts +0 -488
- package/dist/src/components/Table/BaseTable/index.d.ts +0 -1
- package/dist/src/components/Table/BaseTable/index.js +0 -1
- package/dist/src/components/Table/Pagination/PaginationControls.d.ts +0 -3
- package/dist/src/components/Table/Pagination/PaginationControls.js +0 -22
- package/dist/src/components/Table/Pagination/PaginationControls.types.d.ts +0 -24
- package/dist/src/components/Table/Pagination/PaginationControls.types.js +0 -1
- package/dist/src/components/Table/Table.d.ts +0 -4
- package/dist/src/components/Table/Table.js +0 -93
- package/dist/src/components/Table/Table.stories.d.ts +0 -31
- package/dist/src/components/Table/Table.stories.js +0 -479
- package/dist/src/components/Table/hooks/useInfiniteScrolling.d.ts +0 -29
- package/dist/src/components/Table/hooks/useInfiniteScrolling.js +0 -96
- package/dist/src/components/Table/hooks/usePaginationController.d.ts +0 -16
- package/dist/src/components/Table/hooks/usePaginationController.js +0 -30
- package/dist/src/components/Table/hooks/useTableController.d.ts +0 -26
- package/dist/src/components/Table/hooks/useTableController.js +0 -146
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import type { ButtonProps } from './Button.types';
|
|
3
|
-
export declare const Button:
|
|
2
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
5
3
|
import { LuLoaderCircle } from 'react-icons/lu';
|
|
6
|
-
import { buttonVariants } from './ButtonVariants';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { buttonVariants, iconButtonPositionVariants } from './ButtonVariants';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
export const Button = forwardRef(({ variant, size, loading = false, className, icon, iconPosition = 'left', loadingText, children, disabled, ...props }, ref) => {
|
|
7
|
+
const isLoading = loading || disabled;
|
|
8
|
+
return (_jsx("button", { type: "button", className: cn(buttonVariants({ variant, size }), {
|
|
9
|
+
'bg-(--uikit-actionDisabledBackground) text-(--uikit-actionDisabled) border-(--uikit-actionDisabled)': isLoading,
|
|
10
|
+
}, className), ref: ref, disabled: isLoading, ...props, children: loading ? (_jsxs(_Fragment, { children: [_jsx(LuLoaderCircle, { className: "animate-spin" }), loadingText] })) : (_jsxs("div", { className: iconButtonPositionVariants({ iconPosition }), children: [icon, children] })) }));
|
|
11
11
|
});
|
|
12
12
|
Button.displayName = 'Button';
|
|
@@ -3,22 +3,7 @@ import { Button } from './Button';
|
|
|
3
3
|
declare const meta: Meta<typeof Button>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const PrimaryFilled: Story;
|
|
8
|
-
export declare const PrimaryOutlined: Story;
|
|
9
|
-
export declare const PrimaryText: Story;
|
|
10
|
-
export declare const Secondary: Story;
|
|
11
|
-
export declare const SecondaryFilled: Story;
|
|
12
|
-
export declare const SecondaryOutlined: Story;
|
|
13
|
-
export declare const SecondaryText: Story;
|
|
14
|
-
export declare const Outlined: Story;
|
|
15
|
-
export declare const Ghost: Story;
|
|
16
|
-
export declare const Destructive: Story;
|
|
17
|
-
export declare const Loading: Story;
|
|
18
|
-
export declare const WithLoadingText: Story;
|
|
19
|
-
export declare const WithIconLeft: Story;
|
|
20
|
-
export declare const WithIconRight: Story;
|
|
21
|
-
export declare const WithIconTop: Story;
|
|
22
|
-
export declare const WithIconBottom: Story;
|
|
23
|
-
export declare const DisabledVariants: Story;
|
|
6
|
+
export declare const Default: Story;
|
|
24
7
|
export declare const AllSizes: Story;
|
|
8
|
+
export declare const AllVariants: Story;
|
|
9
|
+
export declare const AllIconPositions: Story;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LuSearch, LuPlus, LuTrash2 } from 'react-icons/lu';
|
|
2
3
|
import { Button } from './Button';
|
|
4
|
+
const ICON_OPTIONS = ['none', 'search', 'plus', 'trash'];
|
|
5
|
+
const ICON_MAP = {
|
|
6
|
+
none: undefined,
|
|
7
|
+
search: _jsx(LuSearch, {}),
|
|
8
|
+
plus: _jsx(LuPlus, {}),
|
|
9
|
+
trash: _jsx(LuTrash2, {}),
|
|
10
|
+
};
|
|
3
11
|
const meta = {
|
|
4
12
|
title: 'UIKit/Button',
|
|
5
13
|
component: Button,
|
|
@@ -9,87 +17,54 @@ const meta = {
|
|
|
9
17
|
},
|
|
10
18
|
};
|
|
11
19
|
export default meta;
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
variant:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
export const Default = {
|
|
21
|
+
argTypes: {
|
|
22
|
+
variant: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
options: [
|
|
25
|
+
'primary',
|
|
26
|
+
'primaryFilled',
|
|
27
|
+
'primaryOutlined',
|
|
28
|
+
'primaryText',
|
|
29
|
+
'secondary',
|
|
30
|
+
'secondaryFilled',
|
|
31
|
+
'secondaryOutlined',
|
|
32
|
+
'secondaryText',
|
|
33
|
+
'outlined',
|
|
34
|
+
'ghost',
|
|
35
|
+
'destructive',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
control: 'select',
|
|
40
|
+
options: ['xs', 'sm', 'default', 'lg', 'icon'],
|
|
41
|
+
},
|
|
42
|
+
icon: { table: { disable: true } },
|
|
43
|
+
// @ts-expect-error custom non-component arg for icon selection
|
|
44
|
+
iconName: {
|
|
45
|
+
control: 'radio',
|
|
46
|
+
options: ICON_OPTIONS,
|
|
47
|
+
name: 'Icon',
|
|
48
|
+
},
|
|
35
49
|
},
|
|
36
|
-
};
|
|
37
|
-
export const SecondaryFilled = {
|
|
38
|
-
args: {
|
|
39
|
-
variant: 'secondaryFilled',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
export const SecondaryOutlined = {
|
|
43
|
-
args: {
|
|
44
|
-
variant: 'secondaryOutlined',
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
export const SecondaryText = {
|
|
48
50
|
args: {
|
|
49
|
-
variant: '
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
variant: 'outlined',
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
export const Ghost = {
|
|
58
|
-
args: {
|
|
59
|
-
variant: 'ghost',
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
export const Destructive = {
|
|
63
|
-
args: {
|
|
64
|
-
variant: 'destructive',
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
export const Loading = {
|
|
68
|
-
args: {
|
|
69
|
-
loading: true,
|
|
51
|
+
variant: 'primary',
|
|
52
|
+
size: 'default',
|
|
53
|
+
children: 'Click me',
|
|
54
|
+
// @ts-expect-error custom arg
|
|
55
|
+
iconName: 'none',
|
|
70
56
|
},
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
loading: true,
|
|
75
|
-
loadingText: 'Saving',
|
|
57
|
+
render: ({ ...args }) => {
|
|
58
|
+
const { iconName, ...buttonArgs } = args;
|
|
59
|
+
return _jsx(Button, { ...buttonArgs, icon: ICON_MAP[iconName] });
|
|
76
60
|
},
|
|
77
61
|
};
|
|
78
|
-
export const
|
|
79
|
-
render: () => (_jsx(Button, {
|
|
80
|
-
};
|
|
81
|
-
export const WithIconRight = {
|
|
82
|
-
render: () => (_jsx(Button, { icon: "\u26A1", iconPosition: "right", children: "Click me" })),
|
|
83
|
-
};
|
|
84
|
-
export const WithIconTop = {
|
|
85
|
-
render: () => (_jsx(Button, { icon: "\u26A1", iconPosition: "top", children: "Click me" })),
|
|
86
|
-
};
|
|
87
|
-
export const WithIconBottom = {
|
|
88
|
-
render: () => (_jsx(Button, { icon: "\u26A1", iconPosition: "bottom", children: "Click me" })),
|
|
62
|
+
export const AllSizes = {
|
|
63
|
+
render: () => (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px', flexWrap: 'wrap' }, children: [_jsx(Button, { size: "xs", children: "XSmall" }), _jsx(Button, { size: "sm", children: "Small" }), _jsx(Button, { size: "default", children: "Default" }), _jsx(Button, { size: "lg", children: "Large" }), _jsx(Button, { size: "icon", "aria-label": "Icon", children: "\u26A1" })] })),
|
|
89
64
|
};
|
|
90
|
-
export const
|
|
91
|
-
render: () => (_jsxs("div", { style: { display: 'flex', gap: '12px', flexWrap: 'wrap' }, children: [_jsx(Button, { variant: "primary",
|
|
65
|
+
export const AllVariants = {
|
|
66
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '12px', flexWrap: 'wrap' }, children: [_jsx("span", { style: { fontWeight: 'bold', marginBottom: '4px' }, children: "Primary Variants" }), _jsxs("div", { style: { display: 'flex', width: '100%', gap: '12px', flexWrap: 'wrap' }, children: [_jsx(Button, { variant: "primary", children: "Primary" }), _jsx(Button, { variant: "primaryFilled", children: "Primary Filled" }), _jsx(Button, { variant: "primaryOutlined", children: "Primary Outlined" }), _jsx(Button, { variant: "primaryText", children: "Primary Text" })] }), _jsx("span", { style: { fontWeight: 'bold', marginBottom: '4px' }, children: "Secondary Variants" }), _jsxs("div", { style: { display: 'flex', width: '100%', gap: '12px', flexWrap: 'wrap' }, children: [_jsx(Button, { variant: "secondary", children: "Secondary" }), _jsx(Button, { variant: "secondaryFilled", children: "Secondary Filled" }), _jsx(Button, { variant: "secondaryOutlined", children: "Secondary Outlined" }), _jsx(Button, { variant: "secondaryText", children: "Secondary Text" })] }), _jsx("span", { style: { fontWeight: 'bold', marginBottom: '4px' }, children: "Other Variants" }), _jsxs("div", { style: { display: 'flex', width: '100%', gap: '12px', flexWrap: 'wrap' }, children: [_jsx(Button, { variant: "outlined", children: "Outlined" }), _jsx(Button, { variant: "ghost", children: "Ghost" }), _jsx(Button, { variant: "destructive", children: "Destructive" })] })] })),
|
|
92
67
|
};
|
|
93
|
-
export const
|
|
94
|
-
render: () => (_jsxs("div", { style: { display: 'flex', alignItems: '
|
|
68
|
+
export const AllIconPositions = {
|
|
69
|
+
render: () => (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px', flexWrap: 'wrap' }, children: [_jsx(Button, { icon: _jsx(LuPlus, {}), iconPosition: "left", children: "Icon Left" }), _jsx(Button, { icon: _jsx(LuPlus, {}), iconPosition: "right", children: "Icon Right" }), _jsx(Button, { icon: _jsx(LuPlus, {}), iconPosition: "top", children: "Icon Top" }), _jsx(Button, { icon: _jsx(LuPlus, {}), iconPosition: "bottom", children: "Icon Bottom" })] })),
|
|
95
70
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
1
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
3
|
import { type buttonVariants } from './ButtonVariants';
|
|
3
|
-
export interface ButtonProps extends
|
|
4
|
-
children?:
|
|
5
|
-
asChild?: boolean;
|
|
4
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
5
|
+
children?: ReactNode;
|
|
6
6
|
loading?: boolean;
|
|
7
7
|
loadingText?: string;
|
|
8
|
-
icon?:
|
|
8
|
+
icon?: ReactNode;
|
|
9
9
|
iconPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
10
10
|
}
|
|
@@ -2,3 +2,6 @@ export declare const buttonVariants: (props?: ({
|
|
|
2
2
|
variant?: "primary" | "secondary" | "primaryFilled" | "primaryOutlined" | "primaryText" | "secondaryFilled" | "secondaryOutlined" | "secondaryText" | "outlined" | "ghost" | "destructive" | null | undefined;
|
|
3
3
|
size?: "default" | "sm" | "xs" | "lg" | "icon" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const iconButtonPositionVariants: (props?: ({
|
|
6
|
+
iconPosition?: "left" | "right" | "top" | "bottom" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -33,7 +33,6 @@ export const buttonVariants = cva('inline-flex cursor-pointer items-center justi
|
|
|
33
33
|
'focus:border-(--uikit-secondary)',
|
|
34
34
|
ghost: 'bg-transparent border border-transparent text-(--uikit-textPrimary) ' +
|
|
35
35
|
'hover:bg-transparent hover:border hover:border-(--uikit-primary) ',
|
|
36
|
-
// 'focus:text-(--uikit-secondary) focus:border-(--uikit-secondary)', // to be discussed
|
|
37
36
|
destructive: 'bg-(--uikit-error) text-white ' + 'hover:bg-(--uikit-error)/90 ' + 'focus:bg-(--uikit-error)',
|
|
38
37
|
},
|
|
39
38
|
size: {
|
|
@@ -49,3 +48,13 @@ export const buttonVariants = cva('inline-flex cursor-pointer items-center justi
|
|
|
49
48
|
size: 'default',
|
|
50
49
|
},
|
|
51
50
|
});
|
|
51
|
+
export const iconButtonPositionVariants = cva('flex items-center gap-2', {
|
|
52
|
+
variants: {
|
|
53
|
+
iconPosition: {
|
|
54
|
+
left: 'flex-row',
|
|
55
|
+
right: 'flex-row-reverse',
|
|
56
|
+
top: 'flex-col',
|
|
57
|
+
bottom: 'flex-col-reverse',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Button } from './Button';
|
|
2
|
-
export { buttonVariants } from './ButtonVariants';
|
|
2
|
+
export { buttonVariants, iconButtonPositionVariants } from './ButtonVariants';
|
|
@@ -40,7 +40,7 @@ function ComboboxCollection({ ...props }) {
|
|
|
40
40
|
return _jsx(ComboboxPrimitive.Collection, { "data-slot": "combobox-collection", ...props });
|
|
41
41
|
}
|
|
42
42
|
function ComboboxEmpty({ className, showAddButton, onAddItem, addButtonText, children, ...props }) {
|
|
43
|
-
return (_jsxs(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", className: cn('flex flex-col items-center gap-2 text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex', className), ...props, children: [children, showAddButton && onAddItem && (_jsx("button", { className: "text-sm text-(--uikit-secondary-light) underline cursor-pointer hover:text-(--uikit-secondary-dark)", onClick: onAddItem, children: addButtonText || 'Add item to the list' }))] }));
|
|
43
|
+
return (_jsxs(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", className: cn('flex flex-col items-center gap-2 text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex', className), ...props, children: [children, showAddButton && onAddItem && (_jsx("button", { type: "button", className: "text-sm text-(--uikit-secondary-light) underline cursor-pointer hover:text-(--uikit-secondary-dark)", onClick: onAddItem, children: addButtonText || 'Add item to the list' }))] }));
|
|
44
44
|
}
|
|
45
45
|
function ComboboxSeparator({ className, ...props }) {
|
|
46
46
|
return (_jsx(ComboboxPrimitive.Separator, { "data-slot": "combobox-separator", className: cn('bg-border -mx-1 my-1 h-px', className), ...props }));
|
|
@@ -70,6 +70,6 @@ export const VariantSearch = {
|
|
|
70
70
|
export const WithEndAdornment = {
|
|
71
71
|
args: {
|
|
72
72
|
placeholder: 'Enter date...',
|
|
73
|
-
endAdornment: (_jsx("button", { className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors", children: _jsx(CalendarIcon, { size: 16, className: "text-gray-500" }) })),
|
|
73
|
+
endAdornment: (_jsx("button", { type: "button", className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors", children: _jsx(CalendarIcon, { size: 16, className: "text-gray-500" }) })),
|
|
74
74
|
},
|
|
75
75
|
};
|
|
@@ -41,7 +41,7 @@ export const WithForm = {
|
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
export const WithActions = {
|
|
44
|
-
render: (args) => (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "primary", children: "More Actions" }) }), _jsx(PopoverContent, { ...args, children: _jsxs("div", { className: "space-y-1", children: [_jsx("button", { className: "w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100 rounded", children: "Edit" }), _jsx("button", { className: "w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100 rounded", children: "Duplicate" }), _jsx("button", { className: "w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100 rounded", children: "Archive" }), _jsx("hr", { className: "my-1" }), _jsx("button", { className: "w-full text-left px-2 py-1.5 text-sm hover:bg-red-50 text-red-600 rounded", children: "Delete" })] }) })] })),
|
|
44
|
+
render: (args) => (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "primary", children: "More Actions" }) }), _jsx(PopoverContent, { ...args, children: _jsxs("div", { className: "space-y-1", children: [_jsx("button", { type: "button", className: "w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100 rounded", children: "Edit" }), _jsx("button", { type: "button", className: "w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100 rounded", children: "Duplicate" }), _jsx("button", { type: "button", className: "w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100 rounded", children: "Archive" }), _jsx("hr", { className: "my-1" }), _jsx("button", { type: "button", className: "w-full text-left px-2 py-1.5 text-sm hover:bg-red-50 text-red-600 rounded", children: "Delete" })] }) })] })),
|
|
45
45
|
args: {
|
|
46
46
|
align: 'end',
|
|
47
47
|
sideOffset: 4,
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eml-payments/ui-kit",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.18",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ARLO UIKit",
|
|
6
6
|
"homepage": "https://github.com/EML-Payments/arlo.npm.uikit#readme",
|
|
7
7
|
"bugs": {
|
|
8
8
|
"url": "https://github.com/EML-Payments/arlo.npm.uikit/issues"
|
|
9
9
|
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/EML-Payments/arlo.npm.uikit.git"
|
|
13
|
+
},
|
|
10
14
|
"license": "MIT",
|
|
11
15
|
"author": "EML Payments",
|
|
12
16
|
"type": "commonjs",
|