@eml-payments/ui-kit 0.1.23 → 0.1.25

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.
@@ -1,9 +1,9 @@
1
1
  import type { ComponentProps } from 'react';
2
- declare function Card({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
3
- declare function CardHeader({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
4
- declare function CardTitle({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
5
- declare function CardDescription({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
6
- declare function CardAction({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
7
- declare function CardContent({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
8
- declare function CardFooter({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
2
+ declare const Card: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
3
+ declare const CardHeader: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
4
+ declare const CardTitle: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
5
+ declare const CardDescription: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
6
+ declare const CardAction: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
7
+ declare const CardContent: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
8
+ declare const CardFooter: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
9
9
  export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
@@ -1,24 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from '../../lib/utils';
3
- function Card({ className, ...props }) {
4
- return (_jsx("div", { "data-slot": "card", className: cn('bg-card text-card-foreground flex flex-col gap-6 rounded-[var(--uikit-radius)] border py-6 shadow-sm', className), ...props }));
5
- }
6
- function CardHeader({ className, ...props }) {
7
- return (_jsx("div", { "data-slot": "card-header", className: cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', className), ...props }));
8
- }
9
- function CardTitle({ className, ...props }) {
10
- return _jsx("div", { "data-slot": "card-title", className: cn('leading-none font-semibold', className), ...props });
11
- }
12
- function CardDescription({ className, ...props }) {
13
- return _jsx("div", { "data-slot": "card-description", className: cn('text-muted-foreground text-sm', className), ...props });
14
- }
15
- function CardAction({ className, ...props }) {
16
- return (_jsx("div", { "data-slot": "card-action", className: cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className), ...props }));
17
- }
18
- function CardContent({ className, ...props }) {
19
- return _jsx("div", { "data-slot": "card-content", className: cn('px-6', className), ...props });
20
- }
21
- function CardFooter({ className, ...props }) {
22
- return (_jsx("div", { "data-slot": "card-footer", className: cn('flex items-center px-6 [.border-t]:pt-6', className), ...props }));
23
- }
3
+ const Card = ({ className, ...props }) => (_jsx("div", { "data-slot": "card", className: cn('bg-card text-card-foreground flex flex-col gap-6 rounded-[var(--uikit-radius)] border py-6 shadow-sm', className), ...props }));
4
+ const CardHeader = ({ className, ...props }) => (_jsx("div", { "data-slot": "card-header", className: cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', className), ...props }));
5
+ const CardTitle = ({ className, ...props }) => (_jsx("div", { "data-slot": "card-title", className: cn('leading-none font-semibold', className), ...props }));
6
+ const CardDescription = ({ className, ...props }) => (_jsx("div", { "data-slot": "card-description", className: cn('text-muted-foreground text-sm', className), ...props }));
7
+ const CardAction = ({ className, ...props }) => (_jsx("div", { "data-slot": "card-action", className: cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className), ...props }));
8
+ const CardContent = ({ className, ...props }) => (_jsx("div", { "data-slot": "card-content", className: cn('px-6', className), ...props }));
9
+ const CardFooter = ({ className, ...props }) => (_jsx("div", { "data-slot": "card-footer", className: cn('flex items-center px-6 [.border-t]:pt-6', className), ...props }));
24
10
  export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
@@ -1,7 +1,7 @@
1
- import { Card } from './Card';
1
+ import React from 'react';
2
2
  declare const _default: {
3
3
  title: string;
4
- component: typeof Card;
4
+ component: ({ className, ...props }: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
5
5
  };
6
6
  export default _default;
7
7
  export declare const Basic: () => import("react/jsx-runtime").JSX.Element;
@@ -5,5 +5,5 @@ interface CardContainerProps {
5
5
  children: ReactNode;
6
6
  className?: string;
7
7
  }
8
- export declare function CardContainer({ title, icon, children, className }: CardContainerProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare const CardContainer: ({ title, icon, children, className }: CardContainerProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card, CardHeader, CardTitle, CardContent } from './Card';
3
- export function CardContainer({ title, icon, children, className }) {
3
+ export const CardContainer = ({ title, icon, children, className }) => {
4
4
  return (_jsxs(Card, { className: className, children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [icon, _jsx("span", { children: title })] }) }), _jsx(CardContent, { children: children })] }));
5
- }
5
+ };
@@ -0,0 +1,2 @@
1
+ export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './Card';
2
+ export { CardContainer } from './CardContainer';
@@ -0,0 +1,2 @@
1
+ export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './Card';
2
+ export { CardContainer } from './CardContainer';
@@ -9,7 +9,7 @@ import { FiMoreHorizontal } from 'react-icons/fi';
9
9
  import { Button } from '../Button';
10
10
  export function Table(props) {
11
11
  var _a;
12
- const { table, setPageSize, ...pagination } = useTableController(props);
12
+ const { table, setPageSize, showHeader, ...pagination } = useTableController(props);
13
13
  let tableContent;
14
14
  if (props.isLoading && props.showSkeletonRows) {
15
15
  tableContent = Array.from({ length: 3 }).map((_c) => (_jsx("tr", { className: "border-t animate-pulse", children: table.getVisibleFlatColumns().map((__c) => (_jsx("td", { className: "px-4 py-2", children: _jsx("div", { className: "h-4 w-3/4 bg-[var(--uikit-tertiary)] rounded" }) }, `skeleton-cell-${__c.id}`))) }, `skeleton-row`)));
@@ -26,8 +26,10 @@ export function Table(props) {
26
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')]));
27
27
  });
28
28
  }
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: [_jsx("thead", { className: "bg-[var(--uikit-tertiary)]", children: table.getHeaderGroups().map((headerGroup) => (_jsxs("tr", { children: [headerGroup.headers.map((header) => {
30
- return (_jsx("th", { style: { width: header.getSize() }, className: classNames('select-none text-[16px]', header.id === 'select' ? 'p-0' : 'px-4 py-2 text-left cursor-pointer'), onClick: header.column.getCanSort()
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) => {
30
+ return (_jsx("th", { style: { width: header.getSize() }, className: classNames('select-none text-[16px]', header.id === 'select'
31
+ ? 'p-0'
32
+ : 'px-4 py-2 text-left cursor-pointer'), onClick: header.column.getCanSort()
31
33
  ? header.column.getToggleSortingHandler()
32
34
  : undefined, children: _jsxs("div", { className: classNames('w-full h-full', header.id === 'select'
33
35
  ? 'flex justify-center items-center'
@@ -35,5 +37,5 @@ export function Table(props) {
35
37
  asc: _jsx(FaChevronUp, {}),
36
38
  desc: _jsx(FaChevronDown, {}),
37
39
  }[header.column.getIsSorted()] || null }))] }) }, header.id));
38
- }), props.tableActionsDropdown && _jsx("th", { className: "w-[40px] px-2 py-2 text-right" })] }, headerGroup.id))) }), _jsx("tbody", { children: tableContent })] }) }), _jsx(PaginationFooter, { tableId: props.id, table: table, paginationMode: props.paginationMode, totalServerRows: props.totalServerRows, onPageSizeChange: setPageSize, ...pagination })] }));
40
+ }), props.tableActionsDropdown && _jsx("th", { className: "w-[40px] px-2 py-2 text-right" })] }, headerGroup.id))) })), _jsx("tbody", { children: tableContent })] }) }), _jsx(PaginationFooter, { tableId: props.id, table: table, paginationMode: props.paginationMode, totalServerRows: props.totalServerRows, onPageSizeChange: setPageSize, ...pagination })] }));
39
41
  }
@@ -16,3 +16,4 @@ export declare const FlexColumnWidths: Story;
16
16
  export declare const WithControlledSorting: Story;
17
17
  export declare const WithRowActionsDropdown: Story;
18
18
  export declare const WithRowClickHandler: Story;
19
+ export declare const WithHiddenHeader: Story;
@@ -136,9 +136,12 @@ export const WithRowActionsDropdown = {
136
136
  };
137
137
  export const WithRowClickHandler = {
138
138
  render: () => {
139
- return (_jsx(Table, { id: "clickable-rows-table", data: data, columns: columns, onRowClick: row => {
139
+ return (_jsx(Table, { id: "clickable-rows-table", data: data, columns: columns, onRowClick: (row) => {
140
140
  console.log('Row clicked:', row);
141
141
  alert(`Clicked on ${row.name}`);
142
142
  } }));
143
143
  },
144
144
  };
145
+ export const WithHiddenHeader = {
146
+ render: () => _jsx(Table, { id: "header-hidden-table", data: data, columns: columns, showHeader: false }),
147
+ };
@@ -33,4 +33,5 @@ export interface TableProps<T> {
33
33
  renderCustomTrigger?: (row: T) => React.ReactNode;
34
34
  };
35
35
  onRowClick?: (row: T) => void;
36
+ showHeader?: boolean;
36
37
  }
@@ -2,7 +2,7 @@ import { type SortingState } from '@tanstack/react-table';
2
2
  import type { TableProps } from '../Table.types';
3
3
  export declare function useTableController<T extends {
4
4
  id: string;
5
- }>({ data, columns, checkboxSelection, checkboxPosition, paginationMode, sorting, onSortingChange, onSelectionChange, enableRowSelection, rowsPerPage, isMultiRowSelection, selectedRowIds, rowIdKey, totalServerRows, onRefetch, }: TableProps<T>): {
5
+ }>({ data, columns, checkboxSelection, checkboxPosition, paginationMode, sorting, onSortingChange, onSelectionChange, enableRowSelection, rowsPerPage, isMultiRowSelection, selectedRowIds, rowIdKey, totalServerRows, onRefetch, showHeader, }: TableProps<T>): {
6
6
  pageIndex: number;
7
7
  pageSize: number;
8
8
  canNextPage: boolean;
@@ -13,4 +13,5 @@ export declare function useTableController<T extends {
13
13
  setPageSize: import("react").Dispatch<import("react").SetStateAction<number>>;
14
14
  setPageIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
15
15
  sorting: SortingState;
16
+ showHeader: boolean;
16
17
  };
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
2
2
  import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowModel, } from '@tanstack/react-table';
3
3
  import { applyFlexSizes, getCheckboxSelectionColumn } from '../table.helpers';
4
4
  import { usePaginationController } from './usePaginationController';
5
- export function useTableController({ data, columns, checkboxSelection, checkboxPosition = 'start', paginationMode = 'client', sorting, onSortingChange, onSelectionChange, enableRowSelection, rowsPerPage = 10, isMultiRowSelection = true, selectedRowIds, rowIdKey = 'id', totalServerRows, onRefetch, }) {
5
+ export function useTableController({ data, columns, checkboxSelection, checkboxPosition = 'start', paginationMode = 'client', sorting, onSortingChange, onSelectionChange, enableRowSelection, rowsPerPage = 10, isMultiRowSelection = true, selectedRowIds, rowIdKey = 'id', totalServerRows, onRefetch, showHeader = true, }) {
6
6
  const safeData = Array.isArray(data) ? data : [];
7
7
  const [tableColumns, setTableColumns] = useState(() => applyFlexSizes(columns !== null && columns !== void 0 ? columns : []));
8
8
  const [internalSorting, setInternalSorting] = useState(sorting !== null && sorting !== void 0 ? sorting : []);
@@ -82,6 +82,7 @@ export function useTableController({ data, columns, checkboxSelection, checkboxP
82
82
  setPageSize,
83
83
  setPageIndex,
84
84
  sorting: sorting !== null && sorting !== void 0 ? sorting : internalSorting,
85
+ showHeader,
85
86
  ...pagination,
86
87
  };
87
88
  }
@@ -12,7 +12,7 @@ export const Default = {
12
12
  render: () => (_jsx(TooltipStoryWrapper, { content: "Simple tooltip", children: _jsx(Button, { children: "Hover me" }) })),
13
13
  };
14
14
  export const LongTextResponsive = {
15
- render: () => (_jsx(TooltipStoryWrapper, { content: "This tooltip contains a longer message that wraps gracefully across multiple lines. On smaller\r\n\t\tscreens, it narrows and stacks vertically so it's easier to read\u2014especially useful for\r\n\t\taccessibility, mobile devices, or multi-language support.", side: "top", children: _jsx(Button, { children: "Hover me" }) })),
15
+ render: () => (_jsx(TooltipStoryWrapper, { content: "This tooltip contains a longer message that wraps gracefully across multiple lines. On smaller\n\t\tscreens, it narrows and stacks vertically so it's easier to read\u2014especially useful for\n\t\taccessibility, mobile devices, or multi-language support.", side: "top", children: _jsx(Button, { children: "Hover me" }) })),
16
16
  };
17
17
  export const OnDifferentSides = {
18
18
  render: () => (_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx(TooltipStoryWrapper, { content: "Top tooltip", side: "top", children: _jsx(Button, { children: "Top" }) }), _jsx(TooltipStoryWrapper, { content: "Bottom tooltip", side: "bottom", children: _jsx(Button, { children: "Bottom" }) }), _jsx(TooltipStoryWrapper, { content: "Left tooltip", side: "left", children: _jsx(Button, { children: "Left" }) }), _jsx(TooltipStoryWrapper, { content: "Right tooltip", side: "right", children: _jsx(Button, { children: "Right" }) })] })),
@@ -10,3 +10,4 @@ export * from './Switch/Switch';
10
10
  export * from './Label/Label';
11
11
  export * from './DropdownWrapper/DropdownWrapper';
12
12
  export * from './Dropdown/Dropdown';
13
+ export * from './Card';
@@ -10,3 +10,4 @@ export * from './Switch/Switch';
10
10
  export * from './Label/Label';
11
11
  export * from './DropdownWrapper/DropdownWrapper';
12
12
  export * from './Dropdown/Dropdown';
13
+ export * from './Card';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eml-payments/ui-kit",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "private": false,
5
5
  "description": "ARLO UIKit",
6
6
  "homepage": "https://github.com/EML-Payments/arlo.npm.uikit#readme",