@orfium/ictinus 5.43.3 → 5.43.5

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,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { ElementType, ComponentPropsWithoutRef, ComponentProps, Ref, ReactNode } from 'react';
3
+ import { RowData, Row } from '@tanstack/react-table';
3
4
  import { Table as Table$1 } from '@tanstack/table-core';
4
5
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
5
6
  import * as react_aria_components from 'react-aria-components';
@@ -1280,6 +1281,17 @@ declare const DataTable: react.ForwardRefExoticComponent<{
1280
1281
  asChild?: boolean;
1281
1282
  className?: string;
1282
1283
  }>, never> & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "className"> & react.RefAttributes<HTMLDivElement>>;
1284
+ declare module '@tanstack/react-table' {
1285
+ interface ColumnMeta<TData extends RowData, TValue> {
1286
+ align?: 'flex-start' | 'center' | 'flex-end';
1287
+ label?: string;
1288
+ tooltip?: string;
1289
+ contentAlign?: 'left' | 'center' | 'right';
1290
+ }
1291
+ interface TableMeta<TData extends RowData> {
1292
+ getCellProps?: (row: Row<TData>) => Omit<BoxProps<'td'>, 'size'>;
1293
+ }
1294
+ }
1283
1295
 
1284
1296
  type DataTableBodyProps = BoxProps<'div', {
1285
1297
  estimatedRowHeight?: number;
@@ -1,3 +1,3 @@
1
- var version = "5.43.3";
1
+ var version = "5.43.5";
2
2
 
3
3
  export { version };
@@ -4,27 +4,36 @@ import ButtonBase from '../ButtonBase/ButtonBase.js';
4
4
  import { BUTTON_ICON_COLOR } from '../ButtonBase/constants.js';
5
5
  import { Icon } from '../../icon/Icon.js';
6
6
 
7
- const IconButton = React__default.forwardRef((props, ref) => {
8
- const { iconName, size = "normal", type = "primary", shape = "circle", dataTestPrefixId } = props;
9
- return /* @__PURE__ */ jsx(
7
+ const IconButton = React__default.forwardRef(
8
+ ({
9
+ size = "normal",
10
+ type = "primary",
11
+ shape = "circle",
12
+ iconName,
13
+ iconColor,
14
+ dataTestPrefixId,
15
+ ...props
16
+ }, ref) => /* @__PURE__ */ jsx(
10
17
  ButtonBase,
11
18
  {
12
19
  ...props,
13
20
  ref,
14
21
  isIconButton: true,
15
22
  shape,
23
+ size,
24
+ type,
16
25
  dataTestPrefixId: dataTestPrefixId ? `${dataTestPrefixId}-icon-` : "icon-",
17
26
  children: /* @__PURE__ */ jsx(
18
27
  Icon,
19
28
  {
20
29
  size: size === "compact" ? "sm" : "md",
21
30
  name: iconName,
22
- color: BUTTON_ICON_COLOR[type]
31
+ color: iconColor ?? BUTTON_ICON_COLOR[type]
23
32
  }
24
33
  )
25
34
  }
26
- );
27
- });
35
+ )
36
+ );
28
37
  IconButton.displayName = "IconButton";
29
38
 
30
39
  export { IconButton as default };
@@ -19,8 +19,8 @@ import { DataTableHeaderCell } from './DataTableHeaderCell.js';
19
19
  import { DataTableRow } from './DataTableRow.js';
20
20
  import { cell, cellSizeVar, cellOffsetVar, root, totalSizeVar, rightTotalSizeVar, leftTotalSizeVar } from './DataTableBody-css.js';
21
21
 
22
- const COL_VIRTUALIZATION_THRESHOLD = 20;
23
- const ROW_VIRTUALIZATION_THRESHOLD = 20;
22
+ const COL_VIRTUALIZATION_THRESHOLD = 25;
23
+ const ROW_VIRTUALIZATION_THRESHOLD = 25;
24
24
  const DataTableBody = forwardRef(
25
25
  ({
26
26
  className,
@@ -134,93 +134,105 @@ const DataTableBody = forwardRef(
134
134
  })) : virtualRows.map((virtualRow) => ({
135
135
  row: rows[virtualRow.index],
136
136
  virtualRow
137
- })) : rows.map((row) => ({ row, virtualRow: void 0 }))).map(({ row, virtualRow }, index) => /* @__PURE__ */ jsxs(
138
- DataTableRow,
139
- {
140
- "data-index": virtualRow?.index,
141
- display: "flex",
142
- index: virtualRow?.index ?? index,
143
- row,
144
- ref: virtualRow ? rowVirtualizer.measureElement : void 0,
145
- style: virtualRow ? {
146
- position: "absolute",
147
- transform: `translateY(${virtualRow.start}px)`
148
- } : void 0,
149
- children: [
150
- row.getLeftVisibleCells().map((cell$1) => /* @__PURE__ */ jsx(
151
- TableCell,
152
- {
153
- bordered,
154
- size,
155
- justifyContent: cell$1.column.columnDef.meta?.align,
156
- pinned: true,
157
- style: {
158
- ...assignInlineVars({
159
- [cellOffsetVar]: `${cell$1.column.getStart("left")}px`,
160
- [cellSizeVar]: `${cell$1.column.getSize()}`
161
- })
137
+ })) : rows.map((row) => ({ row, virtualRow: void 0 }))).map(({ row, virtualRow }, index) => {
138
+ const cellProps = table.options.meta?.getCellProps?.(row);
139
+ return /* @__PURE__ */ jsxs(
140
+ DataTableRow,
141
+ {
142
+ "data-index": virtualRow?.index,
143
+ display: "flex",
144
+ index: virtualRow?.index ?? index,
145
+ row,
146
+ ref: virtualRow ? rowVirtualizer.measureElement : void 0,
147
+ style: virtualRow ? {
148
+ position: "absolute",
149
+ transform: `translateY(${virtualRow.start}px)`
150
+ } : void 0,
151
+ children: [
152
+ row.getLeftVisibleCells().map((cell$1) => /* @__PURE__ */ jsx(
153
+ TableCell,
154
+ {
155
+ bordered,
156
+ size,
157
+ justifyContent: cell$1.column.columnDef.meta?.align,
158
+ pinned: true,
159
+ ...cellProps,
160
+ style: {
161
+ ...assignInlineVars({
162
+ [cellOffsetVar]: `${cell$1.column.getStart("left")}px`,
163
+ [cellSizeVar]: `${cell$1.column.getSize()}`
164
+ }),
165
+ ...cellProps?.style
166
+ },
167
+ className: cn(
168
+ cell({
169
+ pinned: "left",
170
+ resizable: cell$1.column.getCanResize()
171
+ }),
172
+ cellProps?.className
173
+ ),
174
+ children: flexRender(cell$1.column.columnDef.cell, cell$1.getContext())
162
175
  },
163
- className: cn(
164
- cell({
165
- pinned: "left",
166
- resizable: cell$1.column.getCanResize()
167
- })
168
- ),
169
- children: flexRender(cell$1.column.columnDef.cell, cell$1.getContext())
170
- },
171
- cell$1.id
172
- )),
173
- columnVirtualizer.options.enabled && virtualColumnsOffset > 0 && /* @__PURE__ */ jsx(TableCell, { style: { width: virtualColumnsOffset } }),
174
- (columnVirtualizer.options.enabled ? virtualColumns.map((virtualCell) => {
175
- const cells = row.getCenterVisibleCells();
176
- return cells[virtualCell.index];
177
- }) : row.getCenterVisibleCells()).map((cell$1) => /* @__PURE__ */ jsx(
178
- TableCell,
179
- {
180
- size,
181
- bordered,
182
- justifyContent: cell$1.column.columnDef.meta?.align,
183
- style: {
184
- ...assignInlineVars({
185
- [cellSizeVar]: `${cell$1.column.getSize()}`
186
- })
176
+ cell$1.id
177
+ )),
178
+ columnVirtualizer.options.enabled && virtualColumnsOffset > 0 && /* @__PURE__ */ jsx(TableCell, { style: { width: virtualColumnsOffset } }),
179
+ (columnVirtualizer.options.enabled ? virtualColumns.map((virtualCell) => {
180
+ const cells = row.getCenterVisibleCells();
181
+ return cells[virtualCell.index];
182
+ }) : row.getCenterVisibleCells()).map((cell$1) => /* @__PURE__ */ jsx(
183
+ TableCell,
184
+ {
185
+ size,
186
+ bordered,
187
+ justifyContent: cell$1.column.columnDef.meta?.align,
188
+ ...cellProps,
189
+ style: {
190
+ ...assignInlineVars({
191
+ [cellSizeVar]: `${cell$1.column.getSize()}`
192
+ }),
193
+ ...cellProps?.style
194
+ },
195
+ className: cn(
196
+ cell({
197
+ resizable: cell$1.column.getCanResize()
198
+ }),
199
+ cellProps?.className
200
+ ),
201
+ children: flexRender(cell$1.column.columnDef.cell, cell$1.getContext())
187
202
  },
188
- className: cn(
189
- cell({
190
- resizable: cell$1.column.getCanResize()
191
- })
192
- ),
193
- children: flexRender(cell$1.column.columnDef.cell, cell$1.getContext())
194
- },
195
- cell$1.id
196
- )),
197
- row.getRightVisibleCells().map((cell$1) => /* @__PURE__ */ jsx(
198
- TableCell,
199
- {
200
- size,
201
- bordered,
202
- justifyContent: cell$1.column.columnDef.meta?.align,
203
- pinned: true,
204
- style: {
205
- ...assignInlineVars({
206
- [cellOffsetVar]: `${cell$1.column.getStart("right")}px`,
207
- [cellSizeVar]: `${cell$1.column.getSize()}`
208
- })
203
+ cell$1.id
204
+ )),
205
+ row.getRightVisibleCells().map((cell$1) => /* @__PURE__ */ jsx(
206
+ TableCell,
207
+ {
208
+ size,
209
+ bordered,
210
+ justifyContent: cell$1.column.columnDef.meta?.align,
211
+ pinned: true,
212
+ ...cellProps,
213
+ style: {
214
+ ...assignInlineVars({
215
+ [cellOffsetVar]: `${cell$1.column.getStart("right")}px`,
216
+ [cellSizeVar]: `${cell$1.column.getSize()}`
217
+ }),
218
+ ...cellProps?.style
219
+ },
220
+ className: cn(
221
+ cell({
222
+ pinned: "right",
223
+ resizable: cell$1.column.getCanResize()
224
+ }),
225
+ cellProps?.className
226
+ ),
227
+ children: flexRender(cell$1.column.columnDef.cell, cell$1.getContext())
209
228
  },
210
- className: cn(
211
- cell({
212
- pinned: "right",
213
- resizable: cell$1.column.getCanResize()
214
- })
215
- ),
216
- children: flexRender(cell$1.column.columnDef.cell, cell$1.getContext())
217
- },
218
- cell$1.id
219
- ))
220
- ]
221
- },
222
- row.id
223
- ))
229
+ cell$1.id
230
+ ))
231
+ ]
232
+ },
233
+ row.id
234
+ );
235
+ })
224
236
  }
225
237
  )
226
238
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orfium/ictinus",
3
- "version": "5.43.3",
3
+ "version": "5.43.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",
@@ -24,6 +24,11 @@ export type IconProps = {
24
24
  } & DivProps &
25
25
  TestProps;
26
26
 
27
+ /**
28
+ *
29
+ * @deprecated {@link Icon} has been deprecated; use vanilla Icon instead.
30
+ *
31
+ */
27
32
  const Icon = React.forwardRef<HTMLDivElement, IconProps>((props, ref) => {
28
33
  props = useSlotProps(props, 'icon');
29
34
  const {
@@ -5,6 +5,7 @@ import type { ButtonBaseProps } from 'components/ButtonBase/ButtonBase';
5
5
  import ButtonBase from 'components/ButtonBase/ButtonBase';
6
6
  import { BUTTON_ICON_COLOR } from 'components/ButtonBase/constants';
7
7
  import { Icon, type IconProps } from '../../icon';
8
+ import { type BoxProps } from '../../vanilla/Box';
8
9
 
9
10
  export type IconButtonShape = 'circle' | 'square';
10
11
 
@@ -14,31 +15,44 @@ export type IconButtonProps = Omit<
14
15
  > & {
15
16
  /** This property defines the type of the IconButton */
16
17
  type?: PrimitiveButtonTypes;
17
- /** This property defines witch icon to use */
18
- iconName: IconProps['name'];
19
18
  /** This property defines the shape of the IconButton */
20
19
  shape?: IconButtonShape;
20
+ /** This property defines witch icon to use */
21
+ iconName: IconProps['name'];
22
+ /** Custom icon color */
23
+ iconColor?: BoxProps['color'];
21
24
  };
22
25
 
23
- const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {
24
- const { iconName, size = 'normal', type = 'primary', shape = 'circle', dataTestPrefixId } = props;
25
-
26
- return (
26
+ const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
27
+ (
28
+ {
29
+ size = 'normal',
30
+ type = 'primary',
31
+ shape = 'circle',
32
+ iconName,
33
+ iconColor,
34
+ dataTestPrefixId,
35
+ ...props
36
+ },
37
+ ref
38
+ ) => (
27
39
  <ButtonBase
28
40
  {...props}
29
41
  ref={ref}
30
42
  isIconButton
31
43
  shape={shape}
44
+ size={size}
45
+ type={type}
32
46
  dataTestPrefixId={dataTestPrefixId ? `${dataTestPrefixId}-icon-` : 'icon-'}
33
47
  >
34
48
  <Icon
35
49
  size={size === 'compact' ? 'sm' : 'md'}
36
50
  name={iconName}
37
- color={BUTTON_ICON_COLOR[type]}
51
+ color={iconColor ?? BUTTON_ICON_COLOR[type]}
38
52
  />
39
53
  </ButtonBase>
40
- );
41
- });
54
+ )
55
+ );
42
56
 
43
57
  IconButton.displayName = 'IconButton';
44
58
 
@@ -30,6 +30,11 @@ export type MenuProps = {
30
30
  sx?: { listProps?: { maxHeight?: number; width?: number } };
31
31
  } & TestProps;
32
32
 
33
+ /**
34
+ *
35
+ * @deprecated {@link Menu} has been deprecated; use vanilla Menu instead.
36
+ *
37
+ */
33
38
  const Menu: React.FC<MenuProps> = ({
34
39
  selectionMode = 'single',
35
40
  rowSize = 'normal',
@@ -1,4 +1,3 @@
1
- import { vars } from '@orfium/tokens';
2
1
  import Card from 'components/Card';
3
2
  import IconButton from 'components/IconButton';
4
3
  import useEscape from 'hooks/useEscape';
@@ -72,7 +71,7 @@ const Modal: React.FCC<ModalProps> = ({
72
71
  type="tertiary"
73
72
  iconName="close"
74
73
  onClick={onClose}
75
- color={vars.color.text.default.secondary}
74
+ iconColor="secondary"
76
75
  dataTestId="modal-close"
77
76
  />
78
77
  </div>
@@ -1,4 +1,3 @@
1
- import { vars } from '@orfium/tokens';
2
1
  import IconButton from 'components/IconButton';
3
2
  import Select from 'components/Select';
4
3
  import type { TableProps } from 'components/Table/types';
@@ -64,7 +63,6 @@ const TPagination: React.FC<TPaginationProps> = ({ pagination, isSticky, dataTes
64
63
  <div css={buttonsContainer()}>
65
64
  {isEnhancedPaginationVisible && (
66
65
  <IconButton
67
- color={vars.color.text.default.secondary}
68
66
  iconName="pageFirst"
69
67
  size="compact"
70
68
  type="tertiary"
@@ -74,7 +72,6 @@ const TPagination: React.FC<TPaginationProps> = ({ pagination, isSticky, dataTes
74
72
  />
75
73
  )}
76
74
  <IconButton
77
- color={vars.color.text.default.secondary}
78
75
  iconName="chevronLeft"
79
76
  size="compact"
80
77
  type="tertiary"
@@ -83,7 +80,6 @@ const TPagination: React.FC<TPaginationProps> = ({ pagination, isSticky, dataTes
83
80
  dataTestPrefixId={`${dataTestPrefixId}_table_go_to_prev_page`}
84
81
  />
85
82
  <IconButton
86
- color={vars.color.text.default.secondary}
87
83
  iconName="chevronRight"
88
84
  size="compact"
89
85
  type="tertiary"
@@ -93,7 +89,6 @@ const TPagination: React.FC<TPaginationProps> = ({ pagination, isSticky, dataTes
93
89
  />
94
90
  {isEnhancedPaginationVisible && (
95
91
  <IconButton
96
- color={vars.color.text.default.secondary}
97
92
  iconName="pageLast"
98
93
  size="compact"
99
94
  type="tertiary"
@@ -1,3 +1,4 @@
1
+ import type { Row, RowData } from '@tanstack/react-table';
1
2
  import type { Table } from '@tanstack/table-core';
2
3
 
3
4
  import { forwardRef, useState } from 'react';
@@ -34,3 +35,18 @@ export const DataTable = forwardRef<HTMLDivElement, DataTableProps>(
34
35
  );
35
36
 
36
37
  DataTable.displayName = 'DataTable';
38
+
39
+ declare module '@tanstack/react-table' {
40
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
41
+ interface ColumnMeta<TData extends RowData, TValue> {
42
+ align?: 'flex-start' | 'center' | 'flex-end';
43
+ label?: string;
44
+ tooltip?: string;
45
+ // backward compatibility with old v5 table
46
+ contentAlign?: 'left' | 'center' | 'right';
47
+ }
48
+
49
+ interface TableMeta<TData extends RowData> {
50
+ getCellProps?: (row: Row<TData>) => Omit<BoxProps<'td'>, 'size'>;
51
+ }
52
+ }