qaema-ui 0.0.24 → 0.0.26

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.
@@ -0,0 +1,285 @@
1
+ import r, { css as n } from "styled-components";
2
+ import { Scrollbar as s } from "../../../styles/Scrollbar.styles.js";
3
+ r.button`
4
+ background: none;
5
+ border: none;
6
+ cursor: pointer;
7
+ margin: 0 ${({ theme: o }) => o.spacing.xxs};
8
+ color: ${({ theme: o }) => o.colors.primary.purple.n500};
9
+
10
+ &:hover {
11
+ color: ${({ theme: o }) => o.colors.primary.purple.n400};
12
+ }
13
+ `;
14
+ const a = r.div`
15
+ position: relative;
16
+ display: inline-block;
17
+ `, c = r.button`
18
+ background: none;
19
+ border: none;
20
+ cursor: pointer;
21
+ color: ${({ theme: o }) => o.colors.primary.purple.n500};
22
+ padding: ${({ theme: o }) => o.spacing.xs};
23
+ border-radius: ${({ theme: o }) => o.borderRadius.sm};
24
+
25
+ &:hover {
26
+ background-color: ${({ theme: o }) => o.colors.primary.purple.n100};
27
+ }
28
+ `, d = r.div`
29
+ position: absolute;
30
+ /* right: 0; */
31
+ right: ${({ theme: o }) => o.dir === "rtl" ? "unset" : "1.7rem"};
32
+ left: ${({ theme: o }) => o.dir === "rtl" ? "1.7rem" : "unset"};
33
+ top: ${({ theme: o }) => o.dir === "rtl" ? "-165%" : "-200%"};
34
+ width: 9.375rem;
35
+ background-color: ${({ theme: o }) => o.colors.grey.n50};
36
+ border-radius: ${({ theme: o }) => o.borderRadius.md};
37
+ box-shadow: ${({ theme: o }) => o.boxShadow.s3};
38
+ z-index: 100;
39
+ display: ${({ $isOpen: o }) => o ? "block" : "none"};
40
+ overflow: hidden;
41
+ `, p = r.button`
42
+ display: flex;
43
+ align-items: center;
44
+ width: 100%;
45
+ padding: ${({ theme: o }) => o.spacing.xs} ${({ theme: o }) => o.spacing.sm};
46
+ column-gap: ${({ theme: o }) => o.spacing.xs};
47
+ background: none;
48
+ border: none;
49
+ text-align: left;
50
+ cursor: ${({ $disabled: o }) => o ? "not-allowed" : "pointer"};
51
+ opacity: ${({ $disabled: o }) => o ? 0.5 : 1};
52
+ color: ${({ theme: o }) => o.colors.grey.n600};
53
+
54
+ &:hover {
55
+ background-color: ${({ theme: o, $disabled: e }) => e ? "transparent" : o.colors.primary.purple.n100};
56
+ }
57
+
58
+ svg {
59
+ color: ${({ theme: o }) => o.colors.primary.purple.n500};
60
+ }
61
+ `, g = r.div`
62
+ width: 100%;
63
+ position: relative;
64
+ border-radius: ${({ theme: o }) => o.borderRadius.md};
65
+ box-shadow: ${({ theme: o }) => o.boxShadow.s2};
66
+ background-color: ${({ theme: o }) => o.colors.grey.n50};
67
+ overflow-x: hidden;
68
+ overflow-y: auto;
69
+ `, t = r.table`
70
+ width: 100%;
71
+ border-collapse: separate;
72
+ border-spacing: 0;
73
+ font-family: ${({ theme: o }) => o.fonts.english};
74
+ overflow-x: auto;
75
+ `;
76
+ r(s)`
77
+ width: 100%;
78
+ overflow-x: auto;
79
+ -webkit-overflow-scrolling: touch;
80
+ `;
81
+ const u = r.thead`
82
+ ${({ $sticky: o }) => o && n`
83
+ top: 0;
84
+ `}
85
+ `, $ = r.tr`
86
+ background-color: ${({ theme: o }) => o.colors.grey.n100};
87
+ `, b = r.th`
88
+ padding: ${({ theme: o }) => o.spacing.s} ${({ theme: o }) => o.spacing.sm};
89
+ text-align: ${({ $align: o }) => o ?? "left"};
90
+ font-weight: ${({ theme: o }) => o.typography.weights.semiBold};
91
+ color: ${({ theme: o }) => o.colors.grey.n600};
92
+ /* border-bottom: 1px solid ${({ theme: o }) => o.colors.grey.n150}; */
93
+ white-space: nowrap;
94
+ transition: background-color 0.2s;
95
+ width: ${({ $width: o }) => o ?? "auto"};
96
+ min-width: ${({ $minWidth: o }) => o ?? "unset"};
97
+ max-width: ${({ $maxWidth: o }) => o ?? "none"};
98
+ background-color: ${({ theme: o }) => o.colors.primary.purple.n100};
99
+ height: 3.5rem;
100
+
101
+ /* Apply sticky positioning for first and last columns */
102
+ ${({ $isFirstColumn: o }) => o && n`
103
+ left: 0;
104
+ /* z-index: 2; */
105
+ `}
106
+
107
+ ${({ $isLastColumn: o }) => o && n`
108
+ right: 0;
109
+ /* z-index: 2; */
110
+ text-align: end;
111
+ `}
112
+ ${({ $isActionCell: o }) => o && n`
113
+ padding: ${({ theme: e }) => e.spacing.sm} 0;
114
+ text-align: center;
115
+ `}
116
+
117
+ &:hover {
118
+ ${({ $sortable: o }) => o && n`
119
+ background-color: ${({ theme: e }) => e.colors.grey.n150};
120
+ `}
121
+ }
122
+ `, y = r.tbody``, x = r.tr`
123
+ background-color: ${({ theme: o, $selected: e }) => e ? o.colors.primary.purple.n100 : o.colors.grey.n50};
124
+ height: 3.5rem;
125
+ ${({ $disabled: o }) => o && n`
126
+ opacity: 0.6;
127
+ pointer-events: none;
128
+ `}
129
+
130
+ ${({ $clickable: o }) => o && n`
131
+ cursor: pointer;
132
+ `}
133
+ `, h = r.td`
134
+ padding: ${({ theme: o }) => o.spacing.s} ${({ theme: o }) => o.spacing.sm};
135
+ text-align: ${({ $align: o }) => o ?? "left"};
136
+ /* border-bottom: 1px solid ${({ theme: o }) => o.colors.grey.n150}; */
137
+ color: ${({ theme: o }) => o.colors.grey.n700};
138
+ /* min-height: 3.5rem;
139
+ max-height: 3.5rem; */
140
+ background-color: ${({ theme: o }) => o.colors.grey.n50};
141
+ /* height: 3.5rem; */
142
+ /* Apply sticky positioning for first and last columns */
143
+ ${({ $isFirstColumn: o }) => o && n`
144
+ z-index: 1;
145
+ left: 0;
146
+ `}
147
+
148
+ ${({ $isLastColumn: o }) => o && n`
149
+ right: 0;
150
+ width: 0px;
151
+ z-index: 1;
152
+ background-color: transparent;
153
+ `}
154
+
155
+ ${({ $isActionCell: o }) => o && n`
156
+ padding: 0 ${({ theme: e }) => e.spacing.sm};
157
+ `}
158
+ `;
159
+ r.span`
160
+ display: inline-flex;
161
+ align-items: center;
162
+ margin-left: ${({ theme: o }) => o.spacing.xxs};
163
+ `;
164
+ const m = r.div`
165
+ display: flex;
166
+ justify-content: center;
167
+ align-items: center;
168
+ padding: ${({ theme: o }) => o.spacing.sm};
169
+ `, w = r.div`
170
+ display: flex;
171
+ justify-content: center;
172
+ align-items: center;
173
+ padding: ${({ theme: o }) => o.spacing.xl};
174
+ color: ${({ theme: o }) => o.colors.grey.n400};
175
+ `, f = r.div`
176
+ position: absolute;
177
+ top: 0;
178
+ left: 0;
179
+ right: 0;
180
+ bottom: 0;
181
+ background-color: rgba(255, 255, 255, 0.7);
182
+ display: flex;
183
+ justify-content: center;
184
+ align-items: center;
185
+ z-index: 20;
186
+ `;
187
+ r.span`
188
+ display: inline-flex;
189
+ align-items: center;
190
+ padding: ${({ theme: o }) => `${o.spacing.xxs} ${o.spacing.xs}`};
191
+ border-radius: ${({ theme: o }) => o.borderRadius.md};
192
+ font-size: ${({ theme: o }) => o.typography.sizes.s2};
193
+ font-weight: ${({ theme: o }) => o.typography.weights.semiBold};
194
+
195
+ ${({ theme: o, $variant: e }) => {
196
+ switch (e) {
197
+ case "primary":
198
+ return n`
199
+ background-color: ${o.colors.primary.purple.n100};
200
+ color: ${o.colors.primary.purple.n500};
201
+ `;
202
+ case "success":
203
+ return n`
204
+ background-color: ${o.colors.state.success.n100};
205
+ color: ${o.colors.state.success.n500};
206
+ `;
207
+ case "warning":
208
+ return n`
209
+ background-color: ${o.colors.secondary.yellow.n200};
210
+ color: ${o.colors.secondary.yellow.n600};
211
+ `;
212
+ case "error":
213
+ return n`
214
+ background-color: ${o.colors.state.error.n100};
215
+ color: ${o.colors.state.error.n500};
216
+ `;
217
+ default:
218
+ return n`
219
+ background-color: ${o.colors.grey.n200};
220
+ color: ${o.colors.grey.n600};
221
+ `;
222
+ }
223
+ }}
224
+ `;
225
+ r.span`
226
+ display: inline-block;
227
+ width: 0.5rem;
228
+ height: 0.5rem;
229
+ border-radius: 50%;
230
+ margin-right: ${({ theme: o }) => o.spacing.xxs};
231
+ background-color: ${({ theme: o, $status: e }) => {
232
+ switch (e) {
233
+ case "success":
234
+ return o.colors.state.success.n500;
235
+ case "warning":
236
+ return o.colors.secondary.yellow.n500;
237
+ case "error":
238
+ return o.colors.state.error.n500;
239
+ default:
240
+ return o.colors.grey.n400;
241
+ }
242
+ }};
243
+ `;
244
+ const k = r.div`
245
+ display: flex;
246
+ position: relative;
247
+ width: 100%;
248
+ `, v = r(s)`
249
+ flex: 1 1 auto;
250
+ overflow-x: auto;
251
+ min-width: 0;
252
+ &::-webkit-scrollbar {
253
+ height: ${({ theme: o }) => o.spacing.s};
254
+ }
255
+ &::-webkit-scrollbar-thumb {
256
+ height: ${({ theme: o }) => o.spacing.s};
257
+ }
258
+ `, T = r(t)`
259
+ /* position: sticky;
260
+ right: 0; */
261
+ flex: 0 0 auto;
262
+ width: 4.5rem; /* adjust to your icon width */
263
+ table-layout: fixed;
264
+ background-color: ${({ theme: o }) => o.colors.grey.n50};
265
+ `;
266
+ export {
267
+ T as ActionsTable,
268
+ v as DataScrollBox,
269
+ c as DropdownButton,
270
+ a as DropdownContainer,
271
+ p as DropdownItem,
272
+ d as DropdownMenu,
273
+ w as EmptyState,
274
+ f as LoadingOverlay,
275
+ t as StyledTable,
276
+ u as StyledTableHead,
277
+ y as TableBody,
278
+ h as TableCellContainer,
279
+ g as TableContainer,
280
+ m as TableFooter,
281
+ b as TableHeaderCell,
282
+ $ as TableHeaderRow,
283
+ x as TableRow,
284
+ k as TablesWrapper
285
+ };
@@ -0,0 +1,73 @@
1
+ export type ColumnAlignment = 'left' | 'center' | 'right';
2
+ export type CellAlignment = 'left' | 'center' | 'right';
3
+ export type TableColumn<T> = {
4
+ id: string;
5
+ header: string | React.ReactNode;
6
+ accessor: keyof T | ((row: T) => React.ReactNode);
7
+ width?: string;
8
+ minWidth?: string;
9
+ maxWidth?: string;
10
+ align?: ColumnAlignment;
11
+ cellType?: CellType;
12
+ renderCell?: (value: unknown, row: T, index: number) => React.ReactNode;
13
+ renderHeader?: (column: TableColumn<T>) => React.ReactNode;
14
+ hidden?: boolean | ((breakpoint: string) => boolean);
15
+ };
16
+ export type RowAction<T> = {
17
+ label: string;
18
+ icon?: React.ReactNode;
19
+ onClick: (row: T) => void;
20
+ onConfirm?: (id: number) => void;
21
+ row?: T;
22
+ action: string;
23
+ disabled?: boolean | ((row: T) => boolean);
24
+ hidden?: boolean | ((row: T) => boolean);
25
+ };
26
+ export type TableProps<T> = {
27
+ columns: TableColumn<T>[];
28
+ data: T[];
29
+ keyField: string;
30
+ selectable?: boolean;
31
+ onRowSelect?: (selectedRows: T[]) => void;
32
+ rowActions?: RowAction<T>[];
33
+ renderActions?: (row: T) => React.ReactNode;
34
+ stickyHeader?: boolean;
35
+ loading?: boolean;
36
+ emptyStateMessage?: string;
37
+ pagination?: {
38
+ enabled: boolean;
39
+ pageSize: number;
40
+ currentPage: number;
41
+ totalPages: number;
42
+ onPageChange: (page: number) => void;
43
+ hidePrevButton?: boolean;
44
+ hideNextButton?: boolean;
45
+ siblingCount?: number;
46
+ boundaryCount?: number;
47
+ totalItems?: number;
48
+ itemsPerPageOptions?: number[];
49
+ onItemsPerPageChange?: (itemsPerPage: number) => void;
50
+ };
51
+ onRowClick?: (row: T) => void;
52
+ rowClassName?: (row: T, index: number) => string;
53
+ isRowDisabled?: (row: T) => boolean;
54
+ breakpoint?: string;
55
+ alignHeader?: ColumnAlignment;
56
+ isTableHeadVisible?: boolean;
57
+ isRowSelected?: (row: T) => boolean;
58
+ };
59
+ export type CurrencyCode = 'SAR';
60
+ export type CellType = 'user' | 'product' | 'flag' | 'text' | 'amount' | 'badge' | 'progress' | 'icon' | 'header' | 'checkbox' | 'radioButton' | 'custom' | 'transaction';
61
+ export type CellData = {
62
+ imageSrc?: string;
63
+ name?: string;
64
+ description?: string;
65
+ };
66
+ export type AmountCellData = {
67
+ value?: string;
68
+ currencyCode?: string;
69
+ };
70
+ export type TransactionCellData = {
71
+ value: string | number;
72
+ transactionType?: 'up' | 'down' | 'default';
73
+ };
@@ -0,0 +1,116 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { BadgeProps } from '../../../Badge';
3
+ import { CheckboxProps } from '../../../Checkbox';
4
+ import { RadioButtonProps } from '../../../Radio';
5
+ import { AmountCellData, CellAlignment, CellData, CellType, RowAction, TableColumn, TransactionCellData } from '../Table.types';
6
+ export interface BaseCellProps {
7
+ align?: CellAlignment;
8
+ isDisabled?: boolean;
9
+ isSelected?: boolean;
10
+ className?: string;
11
+ }
12
+ export interface UserCellProps extends BaseCellProps {
13
+ data: CellData;
14
+ type: CellType;
15
+ width?: string;
16
+ maxWidth?: string;
17
+ minWidth?: string;
18
+ }
19
+ export interface FlagCellProps extends BaseCellProps {
20
+ data: CellData;
21
+ type: CellType;
22
+ width?: string;
23
+ maxWidth?: string;
24
+ minWidth?: string;
25
+ }
26
+ export interface ProductCellProps extends BaseCellProps {
27
+ data: CellData;
28
+ type: CellType;
29
+ width?: string;
30
+ maxWidth?: string;
31
+ minWidth?: string;
32
+ }
33
+ export interface TextCellProps extends BaseCellProps {
34
+ data: CellData;
35
+ type: CellType;
36
+ width?: string;
37
+ maxWidth?: string;
38
+ minWidth?: string;
39
+ }
40
+ export interface AmountCellProps extends BaseCellProps {
41
+ data: AmountCellData;
42
+ type: CellType;
43
+ width?: string;
44
+ maxWidth?: string;
45
+ minWidth?: string;
46
+ }
47
+ export interface TransactionCellProps extends BaseCellProps {
48
+ data: TransactionCellData;
49
+ type: CellType;
50
+ width?: string;
51
+ maxWidth?: string;
52
+ minWidth?: string;
53
+ }
54
+ export interface CheckboxCellProps extends BaseCellProps {
55
+ checkBoxOptions?: CheckboxProps;
56
+ width?: string;
57
+ maxWidth?: string;
58
+ minWidth?: string;
59
+ onClick?: () => void;
60
+ }
61
+ export interface RadioButtonCellProps extends BaseCellProps {
62
+ radioButtonOptions?: RadioButtonProps;
63
+ width?: string;
64
+ maxWidth?: string;
65
+ minWidth?: string;
66
+ onClick?: () => void;
67
+ }
68
+ export interface BadgeCellProps extends BaseCellProps {
69
+ badgeOptions?: BadgeProps;
70
+ width?: string;
71
+ maxWidth?: string;
72
+ minWidth?: string;
73
+ }
74
+ export interface CustomCellProps<T = unknown> {
75
+ column: TableColumn<T>;
76
+ row: T;
77
+ rowIndex: number;
78
+ width?: string;
79
+ maxWidth?: string;
80
+ minWidth?: string;
81
+ }
82
+ export interface IconCellProps<T = unknown> {
83
+ row?: T;
84
+ keyField: string;
85
+ rowActions?: RowAction<T>[];
86
+ activeDropdown: number | null;
87
+ setActiveDropdown: Dispatch<SetStateAction<number | null>>;
88
+ setConfirmationPopupOpen?: Dispatch<SetStateAction<boolean>>;
89
+ }
90
+ export declare const ProductCell: React.FC<ProductCellProps>;
91
+ export declare const UserCell: React.FC<UserCellProps>;
92
+ export declare const FlagCell: React.FC<FlagCellProps>;
93
+ export declare const TextCell: React.FC<TextCellProps>;
94
+ export declare const AmountCell: React.FC<AmountCellProps>;
95
+ export declare const TransactionCell: React.FC<TransactionCellProps>;
96
+ export declare const CheckboxCell: React.FC<CheckboxCellProps>;
97
+ export declare const RadioButtonCell: React.FC<RadioButtonCellProps>;
98
+ export declare const BadgeCell: React.FC<BadgeCellProps>;
99
+ export declare const CustomCell: <T>({ column, row, rowIndex }: CustomCellProps<T>) => string | number | boolean | Iterable<import('react').ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
100
+ export declare const IconCell: <T>({ row, keyField, rowActions, activeDropdown, setActiveDropdown, setConfirmationPopupOpen, }: IconCellProps<T>) => import("react/jsx-runtime").JSX.Element;
101
+ export interface CellFactoryProps<T = unknown> {
102
+ column?: TableColumn<T>;
103
+ row: unknown;
104
+ type: CellType;
105
+ render?: () => React.ReactNode;
106
+ align?: CellAlignment;
107
+ isDisabled?: boolean;
108
+ className?: string;
109
+ children?: React.ReactNode;
110
+ iconOptions?: IconCellProps<T>;
111
+ width?: string;
112
+ minWidth?: string;
113
+ maxWidth?: string;
114
+ }
115
+ declare const TableCellFactory: <T>(props: CellFactoryProps<T>) => import("react/jsx-runtime").JSX.Element;
116
+ export default TableCellFactory;
@@ -0,0 +1,118 @@
1
+ import { j as r } from "../../../../_virtual/jsx-runtime.js";
2
+ import { FaEllipsisH as p, FaEdit as f } from "../../../../node_modules/react-icons/fa/index.js";
3
+ import { FaPrint as u, FaCopy as j, FaTrash as C, FaEye as h } from "../../../../node_modules/react-icons/fa6/index.js";
4
+ import g from "styled-components";
5
+ import b from "../../../AmountItem.js";
6
+ import y from "../../../Badge.js";
7
+ import F from "../../../Checkbox.js";
8
+ import d from "../../../InfoItem.js";
9
+ import I from "../../../Radio.js";
10
+ import $ from "../../../StatIndicator.js";
11
+ import { DropdownContainer as v, DropdownButton as k, DropdownMenu as T, DropdownItem as B } from "../Table.styles.js";
12
+ const i = g.div`
13
+ display: flex;
14
+ align-items: center;
15
+ direction: inherit;
16
+ gap: 8px;
17
+ width: ${({ width: e }) => e};
18
+ max-width: ${({ maxWidth: e }) => e};
19
+ min-width: ${({ minWidth: e }) => e};
20
+ `, E = {
21
+ view: /* @__PURE__ */ r.jsx(h, {}),
22
+ edit: /* @__PURE__ */ r.jsx(f, {}),
23
+ delete: /* @__PURE__ */ r.jsx(C, {}),
24
+ copy: /* @__PURE__ */ r.jsx(j, {}),
25
+ duplicate: /* @__PURE__ */ r.jsx(j, {}),
26
+ approve: /* @__PURE__ */ r.jsx(u, {}),
27
+ print: /* @__PURE__ */ r.jsx(u, {})
28
+ }, R = (e) => E[e.toLowerCase()] ?? null, D = ({ data: e, type: t, width: s, maxWidth: n, minWidth: o }) => /* @__PURE__ */ r.jsx(i, { width: s, maxWidth: n, minWidth: o, children: e && /* @__PURE__ */ r.jsx(d, { data: e, type: t, width: s }) }), L = ({ data: e, type: t, width: s, maxWidth: n, minWidth: o }) => /* @__PURE__ */ r.jsx(i, { width: s, maxWidth: n, minWidth: o, children: e && /* @__PURE__ */ r.jsx(d, { data: e, type: t, width: s }) }), M = ({ data: e, type: t, width: s, maxWidth: n, minWidth: o }) => /* @__PURE__ */ r.jsx(i, { width: s, maxWidth: n, minWidth: o, children: e && /* @__PURE__ */ r.jsx(d, { data: e, type: t, width: s }) }), S = ({ data: e, type: t, width: s, maxWidth: n, minWidth: o }) => /* @__PURE__ */ r.jsx(i, { width: s, maxWidth: n, minWidth: o, children: e && /* @__PURE__ */ r.jsx(d, { data: e, type: t, width: s }) }), V = ({ data: e, type: t, width: s, maxWidth: n, minWidth: o }) => /* @__PURE__ */ r.jsx(i, { width: s, maxWidth: n, minWidth: o, children: e && /* @__PURE__ */ r.jsx(b, { data: e, type: t, width: s }) }), H = ({ data: e, width: t, maxWidth: s, minWidth: n }) => /* @__PURE__ */ r.jsx(i, { width: t, maxWidth: s, minWidth: n, children: /* @__PURE__ */ r.jsx($, { value: e.value, direction: e.transactionType }) }), K = ({ checkBoxOptions: e, width: t, maxWidth: s, minWidth: n }) => {
29
+ const o = e ? { ...e, name: e.name ?? "" } : void 0;
30
+ return /* @__PURE__ */ r.jsx(i, { width: t, maxWidth: s, minWidth: n, children: /* @__PURE__ */ r.jsx(F, { ...o }) });
31
+ }, P = ({ radioButtonOptions: e, width: t, maxWidth: s, minWidth: n }) => {
32
+ const o = e ? { ...e, name: e.name ?? "" } : void 0;
33
+ return /* @__PURE__ */ r.jsx(i, { width: t, maxWidth: s, minWidth: n, children: /* @__PURE__ */ r.jsx(I, { ...o }) });
34
+ }, U = ({ badgeOptions: e, width: t, maxWidth: s, minWidth: n }) => /* @__PURE__ */ r.jsx(i, { width: t, maxWidth: s, minWidth: n, children: /* @__PURE__ */ r.jsx(y, { ...e }) }), q = ({ column: e, row: t, rowIndex: s }) => {
35
+ if (e.renderCell) {
36
+ const n = typeof e.accessor == "function" ? e.accessor(t) : t[e.accessor];
37
+ return e.renderCell(n, t, s);
38
+ }
39
+ return /* @__PURE__ */ r.jsx(r.Fragment, {});
40
+ }, z = ({
41
+ row: e,
42
+ keyField: t,
43
+ rowActions: s,
44
+ activeDropdown: n,
45
+ setActiveDropdown: o,
46
+ setConfirmationPopupOpen: c
47
+ }) => {
48
+ const a = e ? e[t] : void 0;
49
+ return /* @__PURE__ */ r.jsxs(v, { onClick: (l) => l.stopPropagation(), children: [
50
+ /* @__PURE__ */ r.jsx(
51
+ k,
52
+ {
53
+ onClick: (l) => {
54
+ l.stopPropagation(), o(n === a ? null : a);
55
+ },
56
+ children: /* @__PURE__ */ r.jsx(p, {})
57
+ }
58
+ ),
59
+ /* @__PURE__ */ r.jsx(T, { $isOpen: n === a, children: s == null ? void 0 : s.filter((l) => typeof l.hidden == "function" ? !l.hidden(e) : !l.hidden).map((l) => {
60
+ if (!l) return null;
61
+ const x = typeof l.disabled == "function" ? l.disabled(e) : l.disabled;
62
+ return /* @__PURE__ */ r.jsxs(
63
+ B,
64
+ {
65
+ $disabled: x,
66
+ onClick: (m) => {
67
+ m.stopPropagation(), o(null), x || l.onClick(e), (l.action.toLowerCase() === "delete" || l.action.includes("delet")) && (c == null || c(!0));
68
+ },
69
+ children: [
70
+ R(l.action) ?? l.icon,
71
+ l.label
72
+ ]
73
+ },
74
+ `action-${String(e[t])}-${l.action}`
75
+ );
76
+ }) })
77
+ ] });
78
+ }, w = (e) => {
79
+ const { type: t, column: s, row: n, iconOptions: o, ...c } = e, a = s ? n[s.accessor] : {};
80
+ switch (t) {
81
+ case "user":
82
+ return /* @__PURE__ */ r.jsx(L, { ...c, data: a, type: t });
83
+ case "flag":
84
+ return /* @__PURE__ */ r.jsx(M, { ...c, data: a, type: t });
85
+ case "product":
86
+ return /* @__PURE__ */ r.jsx(D, { ...c, data: a, type: t });
87
+ case "amount":
88
+ return /* @__PURE__ */ r.jsx(V, { ...c, data: a });
89
+ case "transaction":
90
+ return /* @__PURE__ */ r.jsx(H, { ...c, data: a });
91
+ case "checkbox":
92
+ return /* @__PURE__ */ r.jsx(K, { ...c });
93
+ case "radioButton":
94
+ return /* @__PURE__ */ r.jsx(P, { ...c });
95
+ case "badge":
96
+ return /* @__PURE__ */ r.jsx(U, { badgeOptions: a });
97
+ case "icon":
98
+ return /* @__PURE__ */ r.jsx(z, { row: n, ...o, ...c });
99
+ case "custom":
100
+ return /* @__PURE__ */ r.jsx(q, { column: s, row: n, ...c });
101
+ default:
102
+ return /* @__PURE__ */ r.jsx(S, { ...c, data: a });
103
+ }
104
+ };
105
+ export {
106
+ V as AmountCell,
107
+ U as BadgeCell,
108
+ K as CheckboxCell,
109
+ q as CustomCell,
110
+ M as FlagCell,
111
+ z as IconCell,
112
+ D as ProductCell,
113
+ P as RadioButtonCell,
114
+ S as TextCell,
115
+ H as TransactionCell,
116
+ L as UserCell,
117
+ w as default
118
+ };
@@ -0,0 +1,14 @@
1
+ import { ColumnAlignment, RowAction } from '../Table.types';
2
+ export interface TableHeadProps {
3
+ data: any[];
4
+ handleSelectAll: () => void;
5
+ selectedRows: any[];
6
+ visibleColumns: any[];
7
+ alignHeader?: ColumnAlignment;
8
+ rowActions?: RowAction<any>[];
9
+ stickyHeader?: boolean;
10
+ selectable?: boolean;
11
+ loading?: boolean;
12
+ }
13
+ declare const TableHead: React.FC<TableHeadProps>;
14
+ export default TableHead;
@@ -0,0 +1,58 @@
1
+ import { j as t } from "../../../../_virtual/jsx-runtime.js";
2
+ import { useTranslation as g } from "react-i18next";
3
+ import n from "../../../Typography.js";
4
+ import { StyledTableHead as j, TableHeaderRow as c, TableHeaderCell as r } from "../Table.styles.js";
5
+ import { CheckboxCell as f } from "./CellComponents.js";
6
+ const k = ({
7
+ data: a,
8
+ handleSelectAll: d,
9
+ selectedRows: l,
10
+ visibleColumns: h,
11
+ alignHeader: i,
12
+ rowActions: s,
13
+ stickyHeader: x,
14
+ selectable: m,
15
+ loading: o
16
+ }) => {
17
+ const { t: $ } = g(), p = (e) => e.align === "right" ? "flex-end" : "flex-start";
18
+ return /* @__PURE__ */ t.jsx(j, { $sticky: x, children: /* @__PURE__ */ t.jsxs(c, { children: [
19
+ m && /* @__PURE__ */ t.jsx(r, { $align: i, $minWidth: "3.125rem", $maxWidth: "3.125rem", children: /* @__PURE__ */ t.jsx(
20
+ f,
21
+ {
22
+ checkBoxOptions: {
23
+ checked: l.length === a.length,
24
+ $variant: "primary",
25
+ $disabled: o,
26
+ $size: "sm",
27
+ onChange: d
28
+ }
29
+ }
30
+ ) }),
31
+ h.map((e) => /* @__PURE__ */ t.jsx(
32
+ r,
33
+ {
34
+ $align: i,
35
+ $width: e.width,
36
+ $minWidth: e.minWidth,
37
+ $maxWidth: e.maxWidth,
38
+ $isFirstColumn: !0,
39
+ children: /* @__PURE__ */ t.jsx(
40
+ "div",
41
+ {
42
+ style: {
43
+ display: "flex",
44
+ alignItems: "center",
45
+ justifyContent: e.align === "center" ? "center" : p(e)
46
+ },
47
+ children: e.renderHeader ? e.renderHeader(e) : /* @__PURE__ */ t.jsx(n, { variant: "smText", weight: "semiBold", children: e.header })
48
+ }
49
+ )
50
+ },
51
+ e.id
52
+ )),
53
+ s && s.length > 0 ? /* @__PURE__ */ t.jsx(r, { $align: i, $minWidth: "60px", $isLastColumn: !0, $isActionCell: !0, children: /* @__PURE__ */ t.jsx(n, { variant: "smText", weight: "semiBold", style: { textAlign: "center" }, children: $("ACTIONS") }) }) : null
54
+ ] }) });
55
+ };
56
+ export {
57
+ k as default
58
+ };
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ export type NextActionItem = {
3
+ id: string;
4
+ label: string;
5
+ icon: ReactNode;
6
+ onClick?: () => void;
7
+ disabled?: boolean;
8
+ };
9
+ export type NextActionBoxProps = {
10
+ title: string;
11
+ items: NextActionItem[];
12
+ };
13
+ export default function NextActionBox({ title, items }: NextActionBoxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ export type TotalsSummaryItem = {
2
+ title: string;
3
+ amount: string;
4
+ decimal?: string;
5
+ color?: string;
6
+ };
7
+ export type TotalsSummaryProps = {
8
+ title: string;
9
+ items: TotalsSummaryItem[];
10
+ showCurrencyIcon?: boolean;
11
+ currencyIconWidth?: string;
12
+ };
13
+ export default function TotalsSummary({ title, items, showCurrencyIcon, currencyIconWidth, }: TotalsSummaryProps): import("react/jsx-runtime").JSX.Element;