@economic/taco 3.0.1 → 3.0.2-row-active-search.1
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/taco.cjs +34 -20
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.js +34 -20
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
|
@@ -23945,7 +23945,7 @@ const Card = React__namespace.forwardRef(function Card2(props, ref) {
|
|
|
23945
23945
|
const { title, menu, children, className, ...otherProps } = props;
|
|
23946
23946
|
const localization = useLocalization();
|
|
23947
23947
|
const cardClassName = clsx(
|
|
23948
|
-
"bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300
|
|
23948
|
+
"bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300",
|
|
23949
23949
|
className
|
|
23950
23950
|
);
|
|
23951
23951
|
return /* @__PURE__ */ React__namespace.createElement("div", { ...otherProps, className: cardClassName, "data-taco": "card", ref }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex justify-between px-4 pb-2 pt-4" }, title && /* @__PURE__ */ React__namespace.createElement(Truncate, { tooltip: title }, /* @__PURE__ */ React__namespace.createElement("h4", { className: "mb-0 flex-grow truncate text-left" }, title)), menu ? /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -43906,6 +43906,23 @@ const useIsHoverStatePaused = () => {
|
|
|
43906
43906
|
}, [shouldPauseHoverState]);
|
|
43907
43907
|
return [shouldPauseHoverState, setShouldPauseHoverState];
|
|
43908
43908
|
};
|
|
43909
|
+
function focusActiveRow(tableRef) {
|
|
43910
|
+
var _a;
|
|
43911
|
+
const activeRow = ((_a = (tableRef == null ? void 0 : tableRef.current) ?? document) == null ? void 0 : _a.querySelector('tbody tr[data-row-active="true"]')) ?? null;
|
|
43912
|
+
if (activeRow) {
|
|
43913
|
+
if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isElementInteractive(document.activeElement)) {
|
|
43914
|
+
activeRow.focus({ preventScroll: true });
|
|
43915
|
+
}
|
|
43916
|
+
}
|
|
43917
|
+
}
|
|
43918
|
+
function useTableRowActiveListener$1(table, tableRef) {
|
|
43919
|
+
const tableMeta = table.options.meta;
|
|
43920
|
+
React.useEffect(() => {
|
|
43921
|
+
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
|
43922
|
+
focusActiveRow(tableRef);
|
|
43923
|
+
}
|
|
43924
|
+
}, [tableMeta.rowActive.rowActiveIndex, tableRef]);
|
|
43925
|
+
}
|
|
43909
43926
|
function useTableRowActive$1(isEnabled = false, initialRowActiveIndex) {
|
|
43910
43927
|
const [rowActiveIndex, setRowActiveIndex] = React.useState(initialRowActiveIndex);
|
|
43911
43928
|
const [rowHoverIndex, setRowHoverIndex] = React.useState(void 0);
|
|
@@ -43913,7 +43930,11 @@ function useTableRowActive$1(isEnabled = false, initialRowActiveIndex) {
|
|
|
43913
43930
|
const move = (direction, length, scrollToIndex) => {
|
|
43914
43931
|
const nextIndex = rowActiveIndex === void 0 ? 0 : getNextIndex(direction, rowActiveIndex, length);
|
|
43915
43932
|
scrollToIndex(nextIndex);
|
|
43916
|
-
|
|
43933
|
+
if (nextIndex === rowActiveIndex) {
|
|
43934
|
+
setTimeout(() => focusActiveRow(), 0);
|
|
43935
|
+
} else {
|
|
43936
|
+
setTimeout(() => setRowActiveIndex(nextIndex), 50);
|
|
43937
|
+
}
|
|
43917
43938
|
};
|
|
43918
43939
|
const onKeyDown = React.useCallback(
|
|
43919
43940
|
(event, length, scrollToIndex) => {
|
|
@@ -44630,7 +44651,7 @@ function useTableRowDrop(isEnabled = false, onRowDrop) {
|
|
|
44630
44651
|
handleDrop: isEnabled ? onRowDrop : void 0
|
|
44631
44652
|
};
|
|
44632
44653
|
}
|
|
44633
|
-
function useTableRowActiveListener
|
|
44654
|
+
function useTableRowActiveListener(table, onRowActive) {
|
|
44634
44655
|
var _a;
|
|
44635
44656
|
const meta = table.options.meta;
|
|
44636
44657
|
const rows = table.getRowModel().flatRows;
|
|
@@ -44742,7 +44763,7 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
|
44742
44763
|
useTableDataListener(instance, length);
|
|
44743
44764
|
useTableFilterListener(instance, props.onChangeFilter);
|
|
44744
44765
|
useTableFontSizeListener(instance);
|
|
44745
|
-
useTableRowActiveListener
|
|
44766
|
+
useTableRowActiveListener(instance, props.onRowActive);
|
|
44746
44767
|
useTableRowHeightListener(instance);
|
|
44747
44768
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
|
44748
44769
|
useTableSearchListener(instance);
|
|
@@ -44944,6 +44965,11 @@ function getCellWidthPadding(fontSize) {
|
|
|
44944
44965
|
return "16px";
|
|
44945
44966
|
}
|
|
44946
44967
|
}
|
|
44968
|
+
function getReachableRowCount(table) {
|
|
44969
|
+
const tableMeta = table.options.meta;
|
|
44970
|
+
const isFilteringActive = table.options.enableGlobalFilter && table.getState().globalFilter;
|
|
44971
|
+
return isFilteringActive ? table.getRowModel().rows.length + table.getBottomRows().length : tableMeta.length + table.getBottomRows().length;
|
|
44972
|
+
}
|
|
44947
44973
|
function useTableGlobalShortcuts(table, tableRef, scrollToIndex, localShortcuts = false) {
|
|
44948
44974
|
const tableMeta = table.options.meta;
|
|
44949
44975
|
const rows = table.getRowModel().rows;
|
|
@@ -44956,7 +44982,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex, localShortcuts
|
|
|
44956
44982
|
if (isElementInsideExternalRelatedOverlay(trigger, tableRef)) {
|
|
44957
44983
|
return;
|
|
44958
44984
|
}
|
|
44959
|
-
const reachableRows =
|
|
44985
|
+
const reachableRows = getReachableRowCount(table);
|
|
44960
44986
|
tableMeta.rowActive.handleKeyDown(event, reachableRows, scrollToIndex);
|
|
44961
44987
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
|
44962
44988
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
|
@@ -45922,18 +45948,6 @@ function useRowGroupVirtualisation(table) {
|
|
|
45922
45948
|
);
|
|
45923
45949
|
return isTableGrouped ? rangeExtractor : void 0;
|
|
45924
45950
|
}
|
|
45925
|
-
function useTableRowActiveListener(table, tableRef) {
|
|
45926
|
-
const tableMeta = table.options.meta;
|
|
45927
|
-
React.useEffect(() => {
|
|
45928
|
-
var _a, _b;
|
|
45929
|
-
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
|
45930
|
-
const activeRow = ((_a = tableRef.current) == null ? void 0 : _a.querySelector('tbody tr[data-row-active="true"]')) ?? null;
|
|
45931
|
-
if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isElementInteractive(document.activeElement)) {
|
|
45932
|
-
(_b = activeRow == null ? void 0 : activeRow.focus) == null ? void 0 : _b.call(activeRow, { preventScroll: true });
|
|
45933
|
-
}
|
|
45934
|
-
}
|
|
45935
|
-
}, [tableMeta.rowActive.rowActiveIndex]);
|
|
45936
|
-
}
|
|
45937
45951
|
function Actions(props) {
|
|
45938
45952
|
var _a, _b;
|
|
45939
45953
|
const { actions, actionsLength, data, isActiveRow, rowId, table } = props;
|
|
@@ -46268,7 +46282,7 @@ function useTable$1(props, externalRef, renderers, meta) {
|
|
|
46268
46282
|
const { style, stylesheet } = useTableStyle(manager.id, manager.instance);
|
|
46269
46283
|
useTableGlobalShortcuts(manager.instance, ref, renderer2.scrollToIndex, props.enableLocalKeyboardShortcuts);
|
|
46270
46284
|
useTableRef(manager.instance, ref);
|
|
46271
|
-
useTableRowActiveListener(manager.instance, ref);
|
|
46285
|
+
useTableRowActiveListener$1(manager.instance, ref);
|
|
46272
46286
|
return {
|
|
46273
46287
|
...manager,
|
|
46274
46288
|
props: {
|
|
@@ -47151,7 +47165,7 @@ function Body(props) {
|
|
|
47151
47165
|
}
|
|
47152
47166
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
|
47153
47167
|
const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
|
|
47154
|
-
const reachableRows =
|
|
47168
|
+
const reachableRows = getReachableRowCount(table);
|
|
47155
47169
|
const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
|
|
47156
47170
|
if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
|
|
47157
47171
|
if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
|
|
@@ -96740,7 +96754,7 @@ const getLinkClasses = (icon = void 0) => clsx(
|
|
|
96740
96754
|
"flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ",
|
|
96741
96755
|
"focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark",
|
|
96742
96756
|
"bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]",
|
|
96743
|
-
"text-white hover:text-white focus:text-white",
|
|
96757
|
+
"!text-white hover:text-white focus:text-white",
|
|
96744
96758
|
{
|
|
96745
96759
|
"!rounded-full !h-9 !w-9": icon,
|
|
96746
96760
|
"whitespace-nowrap px-3 rounded text-sm hidden lg:flex": !icon
|