@economic/taco 2.22.2 → 2.23.0
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/components/OverflowGroup/OverflowGroup.d.ts +1 -1
- package/dist/components/Report/Report.d.ts +2 -0
- package/dist/components/Report/components/Body/EmptyStateBody.d.ts +7 -0
- package/dist/components/Report/components/Cell/util.d.ts +1 -1
- package/dist/components/Report/types.d.ts +2 -0
- package/dist/components/Report/useReport.d.ts +1 -0
- package/dist/components/Select2/components/Trigger.d.ts +1 -0
- package/dist/components/Truncate/Truncate.d.ts +2 -2
- package/dist/esm/index.css +73 -75
- package/dist/esm/packages/taco/src/components/Card/Card.js +6 -3
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +4 -15
- package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +13 -6
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +9 -6
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js +18 -0
- package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +6 -2
- package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +3 -2
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -0
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +9 -4
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js +4 -3
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +34 -0
- package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +1 -0
- package/dist/esm/packages/taco/src/index.js +1 -0
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +48 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +4 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +5 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +14 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +127 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +4 -4
- package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -1
- package/dist/index.css +73 -75
- package/dist/index.d.ts +1 -0
- package/dist/primitives/Table/types.d.ts +13 -1
- package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +2 -2
- package/dist/primitives/Table/useTable/useTable.d.ts +1 -0
- package/dist/taco.cjs.development.js +306 -71
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/hooks/useTruncated.d.ts +1 -1
- package/package.json +2 -2
- package/types.json +8672 -8382
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ButtonProps } from '../Button/Button';
|
3
3
|
export declare const OverflowGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
4
|
-
moreButton?:
|
4
|
+
moreButton?: ((moreButtonText: string) => React.ReactElement<ButtonProps>) | undefined;
|
5
5
|
} & React.RefAttributes<HTMLDivElement>>;
|
@@ -6,11 +6,13 @@ declare function Column<TType = unknown>(_: ReportColumnProps<TType>): null;
|
|
6
6
|
declare function Group(_: ReportGroupProps): null;
|
7
7
|
export declare const Report: (<TType = unknown>(props: (import("../../primitives/Table/types").useTableClientProps<TType> & {
|
8
8
|
customSettings?: import("./types").ReportCustomSettingsRenderer | undefined;
|
9
|
+
emptyState?: import("./types").ReportEmptyStateRenderer | undefined;
|
9
10
|
toolbarLeft?: JSX.Element | undefined;
|
10
11
|
toolbarRight?: JSX.Element | undefined;
|
11
12
|
toolbarPanel?: JSX.Element | undefined;
|
12
13
|
} & React.RefAttributes<TableRef>) | (import("../../primitives/Table/types").useTableServerProps<TType> & {
|
13
14
|
customSettings?: import("./types").ReportCustomSettingsRenderer | undefined;
|
15
|
+
emptyState?: import("./types").ReportEmptyStateRenderer | undefined;
|
14
16
|
toolbarLeft?: JSX.Element | undefined;
|
15
17
|
toolbarRight?: JSX.Element | undefined;
|
16
18
|
toolbarPanel?: JSX.Element | undefined;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ReportEmptyStateRenderer } from '../../types';
|
3
|
+
declare type EmptyStateProps = React.HTMLAttributes<HTMLTableSectionElement> & {
|
4
|
+
emptyState?: ReportEmptyStateRenderer;
|
5
|
+
};
|
6
|
+
export declare function EmptyStateBody(props: EmptyStateProps): JSX.Element;
|
7
|
+
export {};
|
@@ -13,6 +13,6 @@ export declare function getCellAttributes<TType = unknown>(cell: ReactTableCell<
|
|
13
13
|
className: string | undefined;
|
14
14
|
style: {};
|
15
15
|
};
|
16
|
-
export declare function useSearchHighlighting<TType = unknown>(cell: ReactTableCell<TType, unknown>,
|
16
|
+
export declare function useSearchHighlighting<TType = unknown>(cell: ReactTableCell<TType, unknown>, cellIndex: number, ref: React.RefObject<HTMLTableCellElement>): true | "current" | undefined;
|
17
17
|
export declare function getCurrentRowCellElement(index: number, tableEl: HTMLElement): Element | null;
|
18
18
|
export declare function scrollColumnIntoView(columnIndex: number, frozenColumnIndex: number, column: HTMLElement, tableEl: HTMLElement): void;
|
@@ -2,8 +2,10 @@
|
|
2
2
|
import { TableColumnProps, TableGroupProps, TableSettings, useTableProps } from '../../primitives/Table/types';
|
3
3
|
import { MenuItemProps } from '../Menu/components/Item';
|
4
4
|
export type { TableFilterComparator, TableFilterValue, TableFilter, TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnFilter, TableColumnMenu, TableColumnRenderer, TableColumnRendererAggregate, TableColumnRendererControl, TableColumnRendererControlProps, TableColumnRendererHeader, TableColumnRendererFooter, TableColumnSort, TableColumnSortDirection, TableColumnSortFn, TableColumnWidth, TableRowActionRenderer, TableRowActionGroupRenderer, TableRowClickHandler, TableRowGotoHandler, TableRowHeight, TableRowSelectHandler, TableShortcutHandlerFn, TableShortcutHandlerObject, TableFilterHandler, TableFontSize, TablePreset, TableRowExpansionRenderer, TableScrollToIndexHandler, TableServerLoadPageHandler, TableServerLoadAllHandler, TableServerLoadAllState, TableSettingsHandler, TableShortcuts, TableSortHandler, TableSettings, TableFeatureProps, } from '../../primitives/Table/types';
|
5
|
+
export declare type ReportEmptyStateRenderer = () => JSX.Element | null;
|
5
6
|
export declare type ReportProps<TType = unknown> = useTableProps<TType> & {
|
6
7
|
customSettings?: ReportCustomSettingsRenderer;
|
8
|
+
emptyState?: ReportEmptyStateRenderer;
|
7
9
|
toolbarLeft?: JSX.Element;
|
8
10
|
toolbarRight?: JSX.Element;
|
9
11
|
toolbarPanel?: JSX.Element;
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { ReportProps } from './types';
|
3
3
|
import { TableRef } from '../../primitives/Table/types';
|
4
4
|
export declare function useReport<TType>(props: ReportProps<TType>, ref: React.RefObject<TableRef>): {
|
5
|
+
id: string;
|
5
6
|
instance: import("@tanstack/table-core").Table<TType>;
|
6
7
|
length: number;
|
7
8
|
meta: import("@tanstack/table-core").TableMeta<TType>;
|
@@ -4,4 +4,5 @@ export declare const Trigger: React.ForwardRefExoticComponent<Pick<React.HTMLAtt
|
|
4
4
|
emptyValue?: string | number | boolean | null | undefined;
|
5
5
|
placeholder?: string | undefined;
|
6
6
|
children: React.ReactElement<Select2OptionProps>[];
|
7
|
+
fontSize?: "small" | "medium" | "large" | undefined;
|
7
8
|
} & React.RefAttributes<HTMLButtonElement>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
export declare type TruncateProps = {
|
3
|
-
tooltip: string;
|
4
3
|
children: React.ReactElement;
|
4
|
+
tooltip: string;
|
5
5
|
};
|
6
|
-
export declare const Truncate: ({
|
6
|
+
export declare const Truncate: ({ children, tooltip }: TruncateProps) => JSX.Element;
|
package/dist/esm/index.css
CHANGED
@@ -903,88 +903,80 @@ table[data-taco='report'][data-table-font-size='large']
|
|
903
903
|
}
|
904
904
|
|
905
905
|
/* row/cell backgrounds -- we have to be specific so that nested tables don't inherit */
|
906
|
-
|
907
906
|
/* normal rows */
|
908
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected
|
909
|
-
|
910
|
-
|
907
|
+
table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td {
|
908
|
+
@apply bg-white;
|
909
|
+
}
|
910
|
+
table[data-taco='report'] > tbody > tr:not([data-row-selected]):hover > td,
|
911
|
+
table[data-taco='report'] > tbody > tr:not([data-row-selected])[data-row-active] > td,
|
912
|
+
table[data-taco='report'] > tbody > tr:not([data-row-selected])[data-row-group] > td {
|
913
|
+
--table-row-actions-shadow: theme(colors.grey.100);
|
914
|
+
@apply bg-grey-100;
|
915
|
+
}
|
911
916
|
/* search highlighting */
|
912
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected
|
913
|
-
|
917
|
+
table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td[data-cell-highlighted='true'] {
|
918
|
+
--table-row-actions-shadow: #e9f2ff;
|
919
|
+
@apply !bg-[#e9f2ff];
|
914
920
|
}
|
915
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected
|
916
|
-
|
921
|
+
table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td[data-cell-highlighted='current'] {
|
922
|
+
--table-row-actions-shadow: #bdd7fc;
|
923
|
+
@apply !bg-[#bdd7fc];
|
924
|
+
}
|
925
|
+
/* selected rows */
|
926
|
+
table[data-taco='report'] > tbody > tr[data-row-selected] > td {
|
927
|
+
@apply bg-blue-100;
|
928
|
+
}
|
929
|
+
table[data-taco='report'] > tbody > tr[data-row-selected]:hover > td,
|
930
|
+
table[data-taco='report'] > tbody > tr[data-row-selected][data-row-active] > td,
|
931
|
+
table[data-taco='report'] > tbody > tr[data-row-selected][data-row-group] > td {
|
932
|
+
--table-row-actions-shadow: #d6e3f6;
|
933
|
+
@apply bg-[#d6e3f6];
|
917
934
|
}
|
918
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-group] > td {
|
919
|
-
@apply bg-grey-100;
|
920
|
-
}
|
921
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected='true']):hover > td,
|
922
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true'] > td,
|
923
|
-
table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true']:hover > td {
|
924
|
-
--table-row-actions-shadow: theme(colors.grey.100);
|
925
|
-
@apply bg-grey-100;
|
926
|
-
}
|
927
935
|
/* search highlighting */
|
928
|
-
table[data-taco='report'] > tbody > tr
|
929
|
-
|
936
|
+
table[data-taco='report'] > tbody > tr[data-row-selected] > td[data-cell-highlighted] {
|
937
|
+
--table-row-actions-shadow: #b4d2fd;
|
938
|
+
@apply !bg-[#b4d2fd];
|
930
939
|
}
|
931
|
-
/* normal rows when focus is inside the table */
|
932
|
-
table[data-taco='report']:focus-within > tbody > tr[data-row-active='true']:not([data-row-selected='true']) > td {
|
933
|
-
--table-row-actions-shadow: theme(colors.grey.200);
|
934
|
-
@apply !bg-grey-200;
|
935
|
-
}
|
936
940
|
|
937
|
-
/* normal rows
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
--table-row-actions-shadow: theme(colors.grey.200);
|
944
|
-
@apply !bg-grey-200;
|
945
|
-
}
|
941
|
+
/* normal rows */
|
942
|
+
|
943
|
+
table[data-taco='report']:focus-within > tbody > tr:not([data-row-selected])[data-row-active] > td {
|
944
|
+
--table-row-actions-shadow: theme(colors.grey.200);
|
945
|
+
@apply bg-grey-200;
|
946
|
+
}
|
946
947
|
|
947
948
|
/* selected rows */
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
949
|
+
|
950
|
+
table[data-taco='report']:focus-within > tbody > tr[data-row-selected][data-row-active] > td {
|
951
|
+
--table-row-actions-shadow: #ccd8eb;
|
952
|
+
@apply bg-[#ccd8eb];
|
953
|
+
}
|
954
|
+
|
955
|
+
/* normal rows */
|
956
|
+
|
957
|
+
table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover:not([data-row-selected]):not([data-row-active]) > td {
|
958
|
+
--table-row-actions-shadow: theme(colors.white);
|
959
|
+
@apply bg-white;
|
954
960
|
}
|
955
|
-
|
956
|
-
|
961
|
+
|
962
|
+
table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover:not([data-row-selected])[data-row-active] > td {
|
963
|
+
--table-row-actions-shadow: theme(colors.grey.200);
|
964
|
+
@apply bg-grey-200;
|
957
965
|
}
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
/* search highlighting */
|
965
|
-
table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td[data-cell-highlighted='true'] {
|
966
|
-
@apply bg-[#cadef9];
|
966
|
+
|
967
|
+
/* selected rows */
|
968
|
+
|
969
|
+
table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover[data-row-selected]:not([data-row-active]) > td {
|
970
|
+
--table-row-actions-shadow: theme(colors.blue.100);
|
971
|
+
@apply bg-blue-100;
|
967
972
|
}
|
968
|
-
|
969
|
-
|
973
|
+
|
974
|
+
table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover[data-row-selected][data-row-active] > td {
|
975
|
+
--table-row-actions-shadow: #ccd8eb;
|
976
|
+
@apply bg-[#CCD8EB];
|
970
977
|
}
|
971
|
-
/* selected rows when focus is inside the table */
|
972
|
-
table[data-taco='report']:focus-within > tbody > tr[data-row-active='true'][data-row-selected='true'] > td {
|
973
|
-
--table-row-actions-shadow: #ccd8eb;
|
974
|
-
@apply bg-[#CCD8EB];
|
975
|
-
}
|
976
|
-
/* selected rows when hover is paused */
|
977
|
-
table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr[data-row-selected='true']:hover:not([data-row-active='true']) > td {
|
978
|
-
--table-row-actions-shadow: theme(colors.blue.100);
|
979
|
-
@apply !bg-blue-100;
|
980
|
-
}
|
981
|
-
table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr[data-row-selected='true']:hover[data-row-active='true'] > td {
|
982
|
-
--table-row-actions-shadow: #ccd8eb;
|
983
|
-
@apply !bg-[#CCD8EB];
|
984
|
-
}
|
985
978
|
|
986
979
|
/* row metadata */
|
987
|
-
|
988
980
|
table[data-taco='report'] tbody tr[data-row-meta-layout='heading']:not([data-row-group='true']) td {
|
989
981
|
@apply !border-b-0 border-t font-bold;
|
990
982
|
}
|
@@ -1335,7 +1327,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1335
1327
|
}
|
1336
1328
|
|
1337
1329
|
[data-font-size='small'] [role='cell'] [data-taco='tag'] {
|
1338
|
-
@apply
|
1330
|
+
@apply h-4 min-h-[theme(spacing.4)];
|
1339
1331
|
}
|
1340
1332
|
|
1341
1333
|
[data-font-size='small'] [role='cell'] [data-taco='Select2'],
|
@@ -1391,7 +1383,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1391
1383
|
}
|
1392
1384
|
|
1393
1385
|
/* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
|
1394
|
-
|
1386
|
+
because it should take all the available space in the cell */
|
1395
1387
|
|
1396
1388
|
[data-font-size='small'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
1397
1389
|
@apply px-[calc(var(--table3-cell-padding-x)_-_6px_-_1px)];
|
@@ -1414,8 +1406,8 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1414
1406
|
@apply !-my-0.5;
|
1415
1407
|
}
|
1416
1408
|
|
1417
|
-
[data-font-size='medium'] [role='cell'] [data-taco='
|
1418
|
-
@apply
|
1409
|
+
[data-font-size='medium'] [role='cell'] [data-taco='Select2'] {
|
1410
|
+
@apply !px-2;
|
1419
1411
|
}
|
1420
1412
|
|
1421
1413
|
[data-font-size='medium'] [role='cell'] [data-taco='Select2'],
|
@@ -1430,7 +1422,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1430
1422
|
}
|
1431
1423
|
|
1432
1424
|
/* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
|
1433
|
-
|
1425
|
+
because it should take all the available space in the cell */
|
1434
1426
|
|
1435
1427
|
[data-font-size='medium'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
1436
1428
|
@apply px-[calc(var(--table3-cell-padding-x)_-_8px_-_1px)];
|
@@ -1460,8 +1452,8 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1460
1452
|
@apply !-my-0.5;
|
1461
1453
|
}
|
1462
1454
|
|
1463
|
-
[data-font-size='large'] [role='cell'] [data-taco='
|
1464
|
-
@apply
|
1455
|
+
[data-font-size='large'] [role='cell'] [data-taco='Select2'] {
|
1456
|
+
@apply !px-2.5;
|
1465
1457
|
}
|
1466
1458
|
|
1467
1459
|
[data-font-size='large'] [role='cell'] [data-taco='Select2'],
|
@@ -1502,7 +1494,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1502
1494
|
}
|
1503
1495
|
|
1504
1496
|
/* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
|
1505
|
-
|
1497
|
+
because it should take all the available space in the cell */
|
1506
1498
|
|
1507
1499
|
[data-font-size='large'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
1508
1500
|
@apply px-[calc(var(--table3-cell-padding-x)_-_10px_-_1px)];
|
@@ -1520,3 +1512,9 @@ table[data-taco='report'] [data-cell-id^='__'] {
|
|
1520
1512
|
[data-font-size='large'] [role='columnheader'] button {
|
1521
1513
|
@apply !text-sm;
|
1522
1514
|
}
|
1515
|
+
|
1516
|
+
/* When spinner is rendered in the last cell of the table, it slightly pushes the edge of the table(while rotating),
|
1517
|
+
and making horisontal scroll bar jump */
|
1518
|
+
[data-editing='true'] [role='cell']:last-child [data-taco='spinner'] {
|
1519
|
+
overflow: hidden;
|
1520
|
+
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
2
|
import cn from 'clsx';
|
3
3
|
import { IconButton } from '../IconButton/IconButton.js';
|
4
|
+
import { Truncate } from '../Truncate/Truncate.js';
|
4
5
|
|
5
6
|
const Content = /*#__PURE__*/forwardRef(function CardContent(externalProps, ref) {
|
6
7
|
const {
|
@@ -28,9 +29,11 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
28
29
|
ref: ref
|
29
30
|
}, /*#__PURE__*/createElement("div", {
|
30
31
|
className: "mx-4 mb-2 mt-4 flex"
|
31
|
-
}, title && /*#__PURE__*/createElement(
|
32
|
-
|
33
|
-
},
|
32
|
+
}, title && ( /*#__PURE__*/createElement(Truncate, {
|
33
|
+
tooltip: title
|
34
|
+
}, /*#__PURE__*/createElement("h4", {
|
35
|
+
className: "mb-0 flex-grow truncate text-left"
|
36
|
+
}, title))), menu ? /*#__PURE__*/createElement(IconButton, {
|
34
37
|
icon: "ellipsis-horizontal",
|
35
38
|
appearance: "discrete",
|
36
39
|
menu: menu,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\n\nimport { MenuProps } from '../Menu/Menu';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n noPadding?: boolean;\n};\n\nconst Content = React.forwardRef<HTMLDivElement, CardContentProps>(function CardContent(externalProps, ref) {\n const { noPadding, ...props } = externalProps;\n const className = cn(\n 'flex-grow overflow-auto',\n {\n 'mx-4 mb-4': !noPadding,\n },\n props.className\n );\n return <div {...props} className={className} ref={ref} />;\n});\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Title of the Card */\n title: string | React.ReactElement;\n /** Menu component associated with the Card */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n};\n\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(props, ref) {\n const { title, menu, children } = props;\n const className = cn(\n 'bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500 [&_[data-taco=\"table2\"]]:!border-0',\n props.className\n );\n\n return (\n <div className={className} data-taco=\"card\" ref={ref}>\n <div className=\"mx-4 mb-2 mt-4 flex\">\n {title && <h4 className=\"mb-0 flex-grow text-left\">{title}</h4
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\n\nimport { MenuProps } from '../Menu/Menu';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n noPadding?: boolean;\n};\n\nconst Content = React.forwardRef<HTMLDivElement, CardContentProps>(function CardContent(externalProps, ref) {\n const { noPadding, ...props } = externalProps;\n const className = cn(\n 'flex-grow overflow-auto',\n {\n 'mx-4 mb-4': !noPadding,\n },\n props.className\n );\n return <div {...props} className={className} ref={ref} />;\n});\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Title of the Card */\n title: string | React.ReactElement;\n /** Menu component associated with the Card */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n};\n\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(props, ref) {\n const { title, menu, children } = props;\n const className = cn(\n 'bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500 [&_[data-taco=\"table2\"]]:!border-0',\n props.className\n );\n\n return (\n <div className={className} data-taco=\"card\" ref={ref}>\n <div className=\"mx-4 mb-2 mt-4 flex\">\n {title && (\n <Truncate tooltip={title}>\n <h4 className=\"mb-0 flex-grow truncate text-left\">{title}</h4>\n </Truncate>\n )}\n {menu ? <IconButton icon=\"ellipsis-horizontal\" appearance=\"discrete\" menu={menu} className=\"-mt-[4px]\" /> : null}\n </div>\n {children}\n </div>\n );\n}) as React.ForwardRefExoticComponent<CardProps> & {\n Content: React.ForwardRefExoticComponent<CardContentProps>;\n};\nCard.Content = Content;\n"],"names":["Content","React","CardContent","externalProps","ref","noPadding","props","className","cn","Card","title","menu","children","Truncate","tooltip","IconButton","icon","appearance"],"mappings":";;;;;AAWA,MAAMA,OAAO,gBAAGC,UAAgB,CAAmC,SAASC,WAAWA,CAACC,aAAa,EAAEC,GAAG;EACtG,MAAM;IAAEC,SAAS;IAAE,GAAGC;GAAO,GAAGH,aAAa;EAC7C,MAAMI,SAAS,GAAGC,EAAE,CAChB,yBAAyB,EACzB;IACI,WAAW,EAAE,CAACH;GACjB,EACDC,KAAK,CAACC,SAAS,CAClB;EACD,oBAAON,uCAASK,KAAK;IAAEC,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;KAAO;AAC7D,CAAC,CAAC;MASWK,IAAI,gBAAGR,UAAgB,CAA4B,SAASQ,IAAIA,CAACH,KAAK,EAAEF,GAAG;EACpF,MAAM;IAAEM,KAAK;IAAEC,IAAI;IAAEC;GAAU,GAAGN,KAAK;EACvC,MAAMC,SAAS,GAAGC,EAAE,CAChB,qJAAqJ,EACrJF,KAAK,CAACC,SAAS,CAClB;EAED,oBACIN;IAAKM,SAAS,EAAEA,SAAS;iBAAY,MAAM;IAACH,GAAG,EAAEA;kBAC7CH;IAAKM,SAAS,EAAC;KACVG,KAAK,mBACFT,cAACY,QAAQ;IAACC,OAAO,EAAEJ;kBACfT;IAAIM,SAAS,EAAC;KAAqCG,KAAK,CAAM,CACvD,CACd,EACAC,IAAI,gBAAGV,cAACc,UAAU;IAACC,IAAI,EAAC,qBAAqB;IAACC,UAAU,EAAC,UAAU;IAACN,IAAI,EAAEA,IAAI;IAAEJ,SAAS,EAAC;IAAc,GAAG,IAAI,CAC9G,EACLK,QAAQ,CACP;AAEd,CAAC;AAGDH,IAAI,CAACT,OAAO,GAAGA,OAAO;;;;"}
|
@@ -1,16 +1,9 @@
|
|
1
|
-
import { forwardRef,
|
1
|
+
import { forwardRef, useRef, createElement } from 'react';
|
2
2
|
import cn from 'clsx';
|
3
|
-
import {
|
4
|
-
import { useTruncated } from '../../utils/hooks/useTruncated.js';
|
3
|
+
import { Truncate } from '../Truncate/Truncate.js';
|
5
4
|
|
6
5
|
const Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
|
7
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
8
6
|
const messageRef = useRef(null);
|
9
|
-
useEffect(() => {
|
10
|
-
// refs are null on the first render so setting showTooltip state forces the rerender to see if message is
|
11
|
-
// truncated or not
|
12
|
-
setShowTooltip(true);
|
13
|
-
}, []);
|
14
7
|
const {
|
15
8
|
disabled,
|
16
9
|
children,
|
@@ -28,16 +21,12 @@ const Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
|
|
28
21
|
'text-yellow-700': warning && !invalid,
|
29
22
|
'opacity-50': disabled
|
30
23
|
});
|
31
|
-
const {
|
32
|
-
truncated: isMessageTrucated
|
33
|
-
} = useTruncated(messageRef.current, [message, showTooltip]);
|
34
24
|
return /*#__PURE__*/createElement("label", Object.assign({}, otherProps, {
|
35
25
|
className: className,
|
36
26
|
"data-taco": "label",
|
37
27
|
ref: ref
|
38
|
-
}), children, message && ( /*#__PURE__*/createElement(
|
39
|
-
|
40
|
-
hide: !isMessageTrucated
|
28
|
+
}), children, message && ( /*#__PURE__*/createElement(Truncate, {
|
29
|
+
tooltip: message
|
41
30
|
}, /*#__PURE__*/createElement("span", {
|
42
31
|
className: messageClassName,
|
43
32
|
ref: messageRef,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\n\nimport './Field.css';\nimport {
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\n\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-grey-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-grey-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-700': warning && !invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span className={messageClassName} ref={messageRef} role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["Field","React","props","ref","messageRef","disabled","children","invalid","warning","message","otherProps","className","cn","messageClassName","Truncate","tooltip","role","undefined"],"mappings":";;;;MAsBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAKA,CAACE,KAAiB,EAAEC,GAAgC;EACpG,MAAMC,UAAU,GAAGH,MAAY,CAAkB,IAAI,CAAC;EAEtD,MAAM;IAAEI,QAAQ;IAAEC,QAAQ;IAAEC,OAAO,GAAG,KAAK;IAAEC,OAAO,GAAG,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAC9F,MAAMS,SAAS,GAAGC,EAAE,CAChB,8EAA8E,EAC9E;IACI,eAAe,EAAEP;GACpB,EACDH,KAAK,CAACS,SAAS,CAClB;EACD,MAAME,gBAAgB,GAAGD,EAAE,CAAC,iEAAiE,EAAE;IAC3F,eAAe,EAAE,CAACL,OAAO,IAAI,CAACC,OAAO;IACrC,cAAc,EAAED,OAAO;IACvB,iBAAiB,EAAEC,OAAO,IAAI,CAACD,OAAO;IACtC,YAAY,EAAEF;GACjB,CAAC;EAEF,oBACIJ,yCAAWS,UAAU;IAAEC,SAAS,EAAEA,SAAS;iBAAY,OAAO;IAACR,GAAG,EAAEA;MAC/DG,QAAQ,EACRG,OAAO,mBACJR,cAACa,QAAQ;IAACC,OAAO,EAAEN;kBACfR;IAAMU,SAAS,EAAEE,gBAAgB;IAAEV,GAAG,EAAEC,UAAU;IAAEY,IAAI,EAAET,OAAO,GAAG,OAAO,GAAGU;KACzER,OAAO,CACL,CACA,CACd,CACG;AAEhB,CAAC;;;;"}
|
@@ -12,9 +12,9 @@ const PrimaryNavigation = /*#__PURE__*/React__default.forwardRef(function Primar
|
|
12
12
|
} = useLocalization();
|
13
13
|
const internalRef = useMergedRef(ref);
|
14
14
|
const className = cn('flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative', props.className);
|
15
|
-
const moreButton = /*#__PURE__*/React__default.createElement(Button, {
|
15
|
+
const moreButton = () => ( /*#__PURE__*/React__default.createElement(Button, {
|
16
16
|
className: cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]')
|
17
|
-
}, texts.header.more);
|
17
|
+
}, texts.header.more));
|
18
18
|
return /*#__PURE__*/React__default.createElement("nav", Object.assign({}, props, {
|
19
19
|
className: className,
|
20
20
|
ref: internalRef
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PrimaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/PrimaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getLinkClasses } from './Link';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Button } from '../../Button/Button';\nimport { OverflowGroup } from '../../OverflowGroup/OverflowGroup';\n\nexport type PrimaryNavigationProps = React.HTMLAttributes<HTMLElement>;\n\nexport const PrimaryNavigation = React.forwardRef<HTMLElement, PrimaryNavigationProps>(function PrimaryNavigation(props, ref) {\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n\n const className = cn(\n 'flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative',\n props.className\n );\n\n const moreButton = (\n <Button className={cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]')}>{texts.header.more}</Button>\n );\n return (\n <nav {...props} className={className} ref={internalRef}>\n <OverflowGroup className=\"h-full flex-grow items-center gap-1 px-1\" moreButton={moreButton}>\n {props.children}\n </OverflowGroup>\n </nav>\n );\n});\n"],"names":["PrimaryNavigation","React","forwardRef","props","ref","texts","useLocalization","internalRef","useMergedRef","className","cn","moreButton","Button","getLinkClasses","header","more","OverflowGroup","children"],"mappings":";;;;;;;;MAUaA,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAsC,SAASF,iBAAiBA,CAACG,KAAK,EAAEC,GAAG;EACxH,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,WAAW,GAAGC,YAAY,CAAiBJ,GAAG,CAAC;EAErD,MAAMK,SAAS,GAAGC,EAAE,CAChB,wFAAwF,EACxFP,KAAK,CAACM,SAAS,CAClB;EAED,MAAME,UAAU,
|
1
|
+
{"version":3,"file":"PrimaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/PrimaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getLinkClasses } from './Link';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Button } from '../../Button/Button';\nimport { OverflowGroup } from '../../OverflowGroup/OverflowGroup';\n\nexport type PrimaryNavigationProps = React.HTMLAttributes<HTMLElement>;\n\nexport const PrimaryNavigation = React.forwardRef<HTMLElement, PrimaryNavigationProps>(function PrimaryNavigation(props, ref) {\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n\n const className = cn(\n 'flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative',\n props.className\n );\n\n const moreButton = () => (\n <Button className={cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]')}>{texts.header.more}</Button>\n );\n return (\n <nav {...props} className={className} ref={internalRef}>\n <OverflowGroup className=\"h-full flex-grow items-center gap-1 px-1\" moreButton={moreButton}>\n {props.children}\n </OverflowGroup>\n </nav>\n );\n});\n"],"names":["PrimaryNavigation","React","forwardRef","props","ref","texts","useLocalization","internalRef","useMergedRef","className","cn","moreButton","Button","getLinkClasses","header","more","OverflowGroup","children"],"mappings":";;;;;;;;MAUaA,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAsC,SAASF,iBAAiBA,CAACG,KAAK,EAAEC,GAAG;EACxH,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,WAAW,GAAGC,YAAY,CAAiBJ,GAAG,CAAC;EAErD,MAAMK,SAAS,GAAGC,EAAE,CAChB,wFAAwF,EACxFP,KAAK,CAACM,SAAS,CAClB;EAED,MAAME,UAAU,GAAGA,qBACfV,6BAACW,MAAM;IAACH,SAAS,EAAEC,EAAE,CAACG,cAAc,EAAE,EAAE,+CAA+C;KAAIR,KAAK,CAACS,MAAM,CAACC,IAAI,CAAU,CACzH;EACD,oBACId,sDAASE,KAAK;IAAEM,SAAS,EAAEA,SAAS;IAAEL,GAAG,EAAEG;mBACvCN,6BAACe,aAAa;IAACP,SAAS,EAAC,0CAA0C;IAACE,UAAU,EAAEA;KAC3ER,KAAK,CAACc,QAAQ,CACH,CACd;AAEd,CAAC;;;;"}
|
@@ -2,6 +2,7 @@ import React__default from 'react';
|
|
2
2
|
import cn from 'clsx';
|
3
3
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
5
|
+
import { useLocalization } from '../Provider/Localization.js';
|
5
6
|
import { Menu } from '../Menu/Menu.js';
|
6
7
|
import { useIntersectionObserver } from '../../hooks/useIntersectionObserver.js';
|
7
8
|
|
@@ -36,8 +37,9 @@ const sanitizeButtonPropsForMenuItem = (button, index) => {
|
|
36
37
|
};
|
37
38
|
const DEFAULT_OFFSET = 32 + 8;
|
38
39
|
const OverflowGroup = /*#__PURE__*/React__default.forwardRef(function OverflowGroup(props, ref) {
|
40
|
+
var _moreButton;
|
39
41
|
const {
|
40
|
-
moreButton
|
42
|
+
moreButton,
|
41
43
|
...attributes
|
42
44
|
} = props;
|
43
45
|
const internalRef = useMergedRef(ref);
|
@@ -47,12 +49,17 @@ const OverflowGroup = /*#__PURE__*/React__default.forwardRef(function OverflowGr
|
|
47
49
|
var _el$getBoundingClient;
|
48
50
|
return setButtonWidth(el === null || el === void 0 ? void 0 : (_el$getBoundingClient = el.getBoundingClientRect()) === null || _el$getBoundingClient === void 0 ? void 0 : _el$getBoundingClient.width);
|
49
51
|
}, []);
|
50
|
-
const
|
51
|
-
|
52
|
-
});
|
52
|
+
const {
|
53
|
+
texts
|
54
|
+
} = useLocalization();
|
53
55
|
const intersectedChildIndex = useIntersectionObserver(internalRef, buttonWidth);
|
54
56
|
const children = React__default.Children.toArray(props.children);
|
55
57
|
const hiddenChildren = intersectedChildIndex !== undefined ? children.slice(intersectedChildIndex) : [];
|
58
|
+
const hiddenChildrenCount = hiddenChildren.length;
|
59
|
+
const moreButtonText = hiddenChildrenCount ? `${hiddenChildrenCount} ${texts.header.more}` : '';
|
60
|
+
const MoreButton = (_moreButton = moreButton === null || moreButton === void 0 ? void 0 : moreButton(moreButtonText)) !== null && _moreButton !== void 0 ? _moreButton : /*#__PURE__*/React__default.createElement(IconButton, {
|
61
|
+
icon: "more"
|
62
|
+
});
|
56
63
|
const className = cn('flex overflow-hidden', props.className);
|
57
64
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
58
65
|
className: className,
|
@@ -63,8 +70,8 @@ const OverflowGroup = /*#__PURE__*/React__default.forwardRef(function OverflowGr
|
|
63
70
|
visible: intersectedChildIndex === undefined || index < intersectedChildIndex,
|
64
71
|
'invisible order-[100] pointer-events-none': intersectedChildIndex !== undefined && index >= intersectedChildIndex
|
65
72
|
})
|
66
|
-
})), hiddenChildren.length ? /*#__PURE__*/React__default.cloneElement(
|
67
|
-
className: cn('sticky right-0 order-[99]',
|
73
|
+
})), hiddenChildren.length ? /*#__PURE__*/React__default.cloneElement(MoreButton, {
|
74
|
+
className: cn('sticky right-0 order-[99]', MoreButton.props.className),
|
68
75
|
'data-observer-ignore': true,
|
69
76
|
menu: menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, hiddenChildren.map(sanitizeButtonPropsForMenuItem)))),
|
70
77
|
ref: buttonRefCallback
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OverflowGroup.js","sources":["../../../../../../../src/components/OverflowGroup/OverflowGroup.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { ButtonProps } from '../Button/Button';\nimport { Menu } from '../Menu/Menu';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { IconButton } from '../IconButton/IconButton';\n\nconst sanitizeButtonPropsForMenuItem = (button: any, index) => {\n const href: string | undefined = button.props.to || button.props.href;\n const Tag = href ? Menu.Link : Menu.Item;\n\n // Removing className prop so that custom styling cannot be applied on Menu.Link\n const {\n as,\n className: _,\n appearance: _1,\n drawer: _2,\n fluid: _3,\n hanger: _4,\n menu: _5,\n popover: _6,\n tooltip: _7,\n ...attributes\n } = button.props;\n\n const props = {\n ...attributes,\n key: index,\n target: href ? (href.startsWith('http') ? '_blank' : '_self') : undefined,\n };\n\n if (as) {\n return React.cloneElement(button, { as: Tag, ...props });\n }\n\n return <Tag {...props} />;\n};\n\ntype OverflowGroupProps = React.HTMLAttributes<HTMLElement> & {\n moreButton?: React.ReactElement<ButtonProps>;\n};\n\nconst DEFAULT_OFFSET = 32 + 8;\n\nexport const OverflowGroup = React.forwardRef(function OverflowGroup(props: OverflowGroupProps, ref: React.Ref<HTMLDivElement>) {\n const { moreButton
|
1
|
+
{"version":3,"file":"OverflowGroup.js","sources":["../../../../../../../src/components/OverflowGroup/OverflowGroup.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { ButtonProps } from '../Button/Button';\nimport { Menu } from '../Menu/Menu';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Localization';\n\nconst sanitizeButtonPropsForMenuItem = (button: any, index) => {\n const href: string | undefined = button.props.to || button.props.href;\n const Tag = href ? Menu.Link : Menu.Item;\n\n // Removing className prop so that custom styling cannot be applied on Menu.Link\n const {\n as,\n className: _,\n appearance: _1,\n drawer: _2,\n fluid: _3,\n hanger: _4,\n menu: _5,\n popover: _6,\n tooltip: _7,\n ...attributes\n } = button.props;\n\n const props = {\n ...attributes,\n key: index,\n target: href ? (href.startsWith('http') ? '_blank' : '_self') : undefined,\n };\n\n if (as) {\n return React.cloneElement(button, { as: Tag, ...props });\n }\n\n return <Tag {...props} />;\n};\n\ntype OverflowGroupProps = React.HTMLAttributes<HTMLElement> & {\n moreButton?: (moreButtonText: string) => React.ReactElement<ButtonProps>;\n};\n\nconst DEFAULT_OFFSET = 32 + 8;\n\nexport const OverflowGroup = React.forwardRef(function OverflowGroup(props: OverflowGroupProps, ref: React.Ref<HTMLDivElement>) {\n const { moreButton, ...attributes } = props;\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n // determine width of more button, to add intersection observer margin\n const [buttonWidth, setButtonWidth] = React.useState(DEFAULT_OFFSET);\n const buttonRefCallback = React.useCallback((el: HTMLElement) => setButtonWidth(el?.getBoundingClientRect()?.width), []);\n const { texts } = useLocalization();\n\n const intersectedChildIndex = useIntersectionObserver(internalRef, buttonWidth);\n const children = React.Children.toArray(props.children) as React.ReactElement<ButtonProps>[];\n const hiddenChildren = intersectedChildIndex !== undefined ? children.slice(intersectedChildIndex) : [];\n const hiddenChildrenCount = hiddenChildren.length;\n const moreButtonText = hiddenChildrenCount ? `${hiddenChildrenCount} ${texts.header.more}` : '';\n\n const MoreButton = moreButton?.(moreButtonText) ?? <IconButton icon=\"more\" />;\n\n const className = cn('flex overflow-hidden', props.className);\n\n return (\n <div {...attributes} className={className} data-taco=\"overflow-group\" ref={internalRef}>\n {children.map((child, index) =>\n React.cloneElement(child, {\n className: cn(child.props.className, {\n visible: intersectedChildIndex === undefined || index < intersectedChildIndex,\n 'invisible order-[100] pointer-events-none':\n intersectedChildIndex !== undefined && index >= intersectedChildIndex,\n }),\n })\n )}\n {hiddenChildren.length\n ? React.cloneElement(MoreButton, {\n className: cn('sticky right-0 order-[99]', MoreButton.props.className),\n 'data-observer-ignore': true,\n menu: menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>{hiddenChildren.map(sanitizeButtonPropsForMenuItem)}</Menu.Content>\n </Menu>\n ),\n ref: buttonRefCallback,\n })\n : null}\n </div>\n );\n});\n"],"names":["sanitizeButtonPropsForMenuItem","button","index","href","props","to","Tag","Menu","Link","Item","as","className","_","appearance","_1","drawer","_2","fluid","_3","hanger","_4","menu","_5","popover","_6","tooltip","_7","attributes","key","target","startsWith","undefined","React","cloneElement","DEFAULT_OFFSET","OverflowGroup","forwardRef","ref","moreButton","internalRef","useMergedRef","buttonWidth","setButtonWidth","useState","buttonRefCallback","useCallback","el","_el$getBoundingClient","getBoundingClientRect","width","texts","useLocalization","intersectedChildIndex","useIntersectionObserver","children","Children","toArray","hiddenChildren","slice","hiddenChildrenCount","length","moreButtonText","header","more","MoreButton","_moreButton","IconButton","icon","cn","map","child","visible","menuProps","Content"],"mappings":"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"}
|
@@ -11,6 +11,7 @@ import { Toolbar } from './components/Toolbar/Toolbar.js';
|
|
11
11
|
import { useStylesheet } from './styles/useStylesheet.js';
|
12
12
|
import { useTableRenderer } from './util/useTableRenderer.js';
|
13
13
|
import { useTableGlobalShortcuts } from './util/useTableGlobalShortcuts.js';
|
14
|
+
import { EmptyStateBody } from './components/Body/EmptyStateBody.js';
|
14
15
|
|
15
16
|
function Column(_) {
|
16
17
|
return null;
|
@@ -19,11 +20,11 @@ function Group(_) {
|
|
19
20
|
return null;
|
20
21
|
}
|
21
22
|
const Report = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
22
|
-
var _report$state$groupin;
|
23
|
+
var _report$state$groupin, _renderer$rows;
|
23
24
|
const tableRef = useMergedRef(ref);
|
24
25
|
const report = useReport(props, tableRef);
|
25
26
|
const renderer = useTableRenderer(report.instance, tableRef, props.defaultRowActiveIndex);
|
26
|
-
const stylesheet = useStylesheet(
|
27
|
+
const stylesheet = useStylesheet(report.id, report.instance);
|
27
28
|
useTableGlobalShortcuts(report.instance, tableRef, renderer.scrollToIndex);
|
28
29
|
const handleFocus = report.meta.rowActive.rowActiveIndex === undefined ? event => {
|
29
30
|
report.meta.rowActive.handleFocus(event, report.length, renderer.scrollToIndex);
|
@@ -35,12 +36,12 @@ const Report = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
|
35
36
|
right: props.toolbarRight,
|
36
37
|
scrollToIndex: renderer.scrollToIndex,
|
37
38
|
table: report.instance,
|
38
|
-
tableId:
|
39
|
+
tableId: report.id,
|
39
40
|
tableRef: tableRef
|
40
41
|
}), props.toolbarPanel ? /*#__PURE__*/React__default.createElement("div", {
|
41
42
|
className: "mb-4"
|
42
43
|
}, props.toolbarPanel) : undefined, /*#__PURE__*/React__default.createElement(FocusScope, null, /*#__PURE__*/React__default.createElement("table", {
|
43
|
-
id:
|
44
|
+
id: report.id,
|
44
45
|
"data-taco": "report",
|
45
46
|
"data-table-font-size": report.meta.fontSize.size,
|
46
47
|
"data-table-horizontally-scrolled": report.meta.columnFreezing.isHorizontallyScrolled ? true : undefined,
|
@@ -54,11 +55,13 @@ const Report = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
|
54
55
|
tabIndex: -1
|
55
56
|
}, /*#__PURE__*/React__default.createElement("thead", null, report.instance.getHeaderGroups().map(headerGroup => ( /*#__PURE__*/React__default.createElement("tr", {
|
56
57
|
key: headerGroup.id
|
57
|
-
}, headerGroup.headers.map(Header))))), /*#__PURE__*/React__default.createElement(Body, {
|
58
|
+
}, headerGroup.headers.map(Header))))), (_renderer$rows = renderer.rows) !== null && _renderer$rows !== void 0 && _renderer$rows.length ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
|
58
59
|
length: report.length,
|
59
60
|
table: report.instance,
|
60
61
|
style: renderer.style
|
61
|
-
}, renderer.rows), report.meta.footer.isEnabled ? ( /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, report.instance.getFooterGroups()[0].headers.map(Footer)))) : null)
|
62
|
+
}, renderer.rows), report.meta.footer.isEnabled ? ( /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, report.instance.getFooterGroups()[0].headers.map(Footer)))) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
63
|
+
emptyState: props.emptyState
|
64
|
+
}))), report.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Summary, {
|
62
65
|
length: report.length,
|
63
66
|
table: report.instance
|
64
67
|
}) : null));
|