@expcat/tigercat-vue 1.2.37 → 1.2.39

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.
Files changed (47) hide show
  1. package/dist/{chunk-WT3LV7OQ.mjs → chunk-3KIIMXJC.mjs} +1 -1
  2. package/dist/{chunk-PC2FNA4J.mjs → chunk-5BGVVVVD.mjs} +1 -1
  3. package/dist/{chunk-RRI3F52B.js → chunk-5BILS3SG.js} +268 -92
  4. package/dist/{chunk-W54LFA7A.mjs → chunk-5Z2OCSVJ.mjs} +268 -92
  5. package/dist/{chunk-U2PPTMQX.mjs → chunk-G7O3G2LI.mjs} +1 -1
  6. package/dist/{chunk-UJZPEXF5.mjs → chunk-JPZJZFC4.mjs} +17 -3
  7. package/dist/{chunk-3EVCDIZE.js → chunk-JT2ANXUR.js} +2 -2
  8. package/dist/{chunk-S3KTGULC.js → chunk-NNFDOVVA.js} +20 -6
  9. package/dist/{chunk-2HT6YGRY.js → chunk-O23S65U3.js} +60 -8
  10. package/dist/{chunk-ILTIUESE.mjs → chunk-OKBZKBFP.mjs} +60 -8
  11. package/dist/{chunk-6DYGPOYH.js → chunk-SSMSRTEQ.js} +2 -2
  12. package/dist/{chunk-HSMN5FWL.js → chunk-YCYS6LAQ.js} +2 -2
  13. package/dist/components/Alert.d.mts +1 -1
  14. package/dist/components/Alert.d.ts +1 -1
  15. package/dist/components/ChatWindow.js +3 -3
  16. package/dist/components/ChatWindow.mjs +2 -2
  17. package/dist/components/DataTableWithToolbar.d.mts +23 -3
  18. package/dist/components/DataTableWithToolbar.d.ts +23 -3
  19. package/dist/components/DataTableWithToolbar.js +8 -3
  20. package/dist/components/DataTableWithToolbar.mjs +7 -2
  21. package/dist/components/Empty.d.mts +1 -1
  22. package/dist/components/Empty.d.ts +1 -1
  23. package/dist/components/FormWizard.d.mts +1 -1
  24. package/dist/components/FormWizard.d.ts +1 -1
  25. package/dist/components/Menu.d.mts +1 -1
  26. package/dist/components/Menu.d.ts +1 -1
  27. package/dist/components/Pagination.d.mts +1 -1
  28. package/dist/components/Pagination.d.ts +1 -1
  29. package/dist/components/Popconfirm.d.mts +1 -1
  30. package/dist/components/Popconfirm.d.ts +1 -1
  31. package/dist/components/Popconfirm.js +3 -3
  32. package/dist/components/Popconfirm.mjs +2 -2
  33. package/dist/components/Popover.js +3 -3
  34. package/dist/components/Popover.mjs +2 -2
  35. package/dist/components/Steps.d.mts +1 -1
  36. package/dist/components/Steps.d.ts +1 -1
  37. package/dist/components/Table.d.mts +31 -3
  38. package/dist/components/Table.d.ts +31 -3
  39. package/dist/components/Table.js +8 -2
  40. package/dist/components/Table.mjs +7 -1
  41. package/dist/components/Tooltip.js +3 -3
  42. package/dist/components/Tooltip.mjs +2 -2
  43. package/dist/index.js +16 -16
  44. package/dist/index.mjs +16 -16
  45. package/package.json +2 -2
  46. package/dist/{chunk-S45NWVQS.mjs → chunk-6GPX4ONB.mjs} +3 -3
  47. package/dist/{chunk-VES3OJOP.js → chunk-YS6FW775.js} +2 -2
@@ -1,6 +1,18 @@
1
+ import {
2
+ Select
3
+ } from "./chunk-PYT5DTQQ.mjs";
4
+ import {
5
+ Radio
6
+ } from "./chunk-YZP4K6KI.mjs";
1
7
  import {
2
8
  useTigerConfig
3
9
  } from "./chunk-VG6E4NX6.mjs";
10
+ import {
11
+ Empty
12
+ } from "./chunk-WFISP42H.mjs";
13
+ import {
14
+ Checkbox
15
+ } from "./chunk-2BNQGU7E.mjs";
4
16
 
5
17
  // src/components/Table.ts
6
18
  import {
@@ -15,8 +27,11 @@ import {
15
27
  import {
16
28
  classNames as classNames3,
17
29
  createTableResizeObserverController,
30
+ formatTableSelectRowAriaLabel,
31
+ formatTableSortByText,
18
32
  getCardColumns,
19
33
  getImmediateTigerLocale,
34
+ getTableLabels,
20
35
  getTableWrapperClasses,
21
36
  getTableResponsiveCardListClasses,
22
37
  getTableResponsiveTableClasses,
@@ -85,9 +100,15 @@ var tableProps = {
85
100
  type: Boolean,
86
101
  default: false
87
102
  },
103
+ locale: {
104
+ type: [Object, Function]
105
+ },
106
+ labels: {
107
+ type: Object
108
+ },
88
109
  emptyText: {
89
110
  type: String,
90
- default: "No data"
111
+ default: void 0
91
112
  },
92
113
  pagination: {
93
114
  type: [Object, Boolean],
@@ -132,6 +153,12 @@ var tableProps = {
132
153
  type: String,
133
154
  default: "sm"
134
155
  },
156
+ cardClassName: {
157
+ type: [String, Function]
158
+ },
159
+ renderCard: {
160
+ type: Function
161
+ },
135
162
  // --- v0.6.0 props ---
136
163
  virtual: { type: Boolean, default: false },
137
164
  autoVirtual: { type: Boolean, default: true },
@@ -333,6 +360,20 @@ function useTableState(props, emit, measuredColumnWidths) {
333
360
  const total = paginationConfig.value?.total !== void 0 && paginationConfig.value.total > 0 ? paginationConfig.value.total : processedData.value.length;
334
361
  return calculatePagination(total, currentPage.value, currentPageSize.value);
335
362
  });
363
+ function handleSetSort(nextSortState) {
364
+ if (!isSortControlled.value) {
365
+ uncontrolledSortState.value = nextSortState;
366
+ }
367
+ emit("sort-change", nextSortState);
368
+ emit("change", {
369
+ sort: nextSortState,
370
+ filters: filterState.value,
371
+ pagination: props.pagination !== false ? {
372
+ current: currentPage.value,
373
+ pageSize: currentPageSize.value
374
+ } : null
375
+ });
376
+ }
336
377
  function handleSort(columnKey) {
337
378
  const column = displayColumns.value.find((col) => col.key === columnKey);
338
379
  if (!column || !column.sortable) {
@@ -346,21 +387,9 @@ function useTableState(props, emit, measuredColumnWidths) {
346
387
  newDirection = null;
347
388
  }
348
389
  }
349
- const nextSortState = {
390
+ handleSetSort({
350
391
  key: newDirection ? columnKey : null,
351
392
  direction: newDirection
352
- };
353
- if (!isSortControlled.value) {
354
- uncontrolledSortState.value = nextSortState;
355
- }
356
- emit("sort-change", nextSortState);
357
- emit("change", {
358
- sort: nextSortState,
359
- filters: filterState.value,
360
- pagination: props.pagination !== false ? {
361
- current: currentPage.value,
362
- pageSize: currentPageSize.value
363
- } : null
364
393
  });
365
394
  }
366
395
  function handleFilter(columnKey, value) {
@@ -556,6 +585,7 @@ function useTableState(props, emit, measuredColumnWidths) {
556
585
  editingValue,
557
586
  virtualScrollTop,
558
587
  toggleColumnLock,
588
+ handleSetSort,
559
589
  handleSort,
560
590
  handleFilter,
561
591
  handlePageChange,
@@ -1191,11 +1221,14 @@ var Table = defineComponent({
1191
1221
  const measuredRowHeights = ref2([]);
1192
1222
  const ctx = useTableState(props, emit, measuredColumnWidths);
1193
1223
  const resolvedPaginationLocale = ref2();
1224
+ const resolvedTableLocale = ref2();
1194
1225
  let paginationLocaleResolveId = 0;
1226
+ let tableLocaleResolveId = 0;
1195
1227
  const paginationLocaleInput = computed2(
1196
1228
  () => props.pagination !== false && typeof props.pagination === "object" ? props.pagination.locale : void 0
1197
1229
  );
1198
1230
  const isPaginationI18nDisabled = computed2(() => paginationLocaleInput.value === false);
1231
+ const tableLocaleInput = computed2(() => props.locale);
1199
1232
  watch2(
1200
1233
  paginationLocaleInput,
1201
1234
  (locale) => {
@@ -1222,6 +1255,36 @@ var Table = defineComponent({
1222
1255
  const paginationLocale = computed2(
1223
1256
  () => isPaginationI18nDisabled.value ? void 0 : mergeTigerLocale(config.value.locale, resolvedPaginationLocale.value)
1224
1257
  );
1258
+ watch2(
1259
+ tableLocaleInput,
1260
+ (locale) => {
1261
+ const resolveId = ++tableLocaleResolveId;
1262
+ if (!locale) {
1263
+ resolvedTableLocale.value = void 0;
1264
+ return;
1265
+ }
1266
+ const immediateLocale = getImmediateTigerLocale(locale);
1267
+ resolvedTableLocale.value = immediateLocale;
1268
+ if (!isLazyTigerLocale(locale)) return;
1269
+ resolveTigerLocale(locale).then((nextLocale) => {
1270
+ if (resolveId === tableLocaleResolveId) {
1271
+ resolvedTableLocale.value = nextLocale;
1272
+ }
1273
+ }).catch(() => {
1274
+ if (resolveId === tableLocaleResolveId) {
1275
+ resolvedTableLocale.value = immediateLocale;
1276
+ }
1277
+ });
1278
+ },
1279
+ { immediate: true }
1280
+ );
1281
+ const tableLocale = computed2(
1282
+ () => mergeTigerLocale(config.value.locale, resolvedTableLocale.value)
1283
+ );
1284
+ const tableLabels = computed2(() => {
1285
+ const overrides = props.emptyText === void 0 ? props.labels : { ...props.labels, emptyText: props.emptyText };
1286
+ return getTableLabels(tableLocale.value, overrides);
1287
+ });
1225
1288
  const resizeController = createTableResizeObserverController({
1226
1289
  onResize: (snapshot) => {
1227
1290
  if (!areNumberRecordsEqual(measuredColumnWidths.value, snapshot.columnWidths)) {
@@ -1251,10 +1314,14 @@ var Table = defineComponent({
1251
1314
  const wrapperStyle = resolvedProps.maxHeight ? {
1252
1315
  maxHeight: typeof resolvedProps.maxHeight === "number" ? `${resolvedProps.maxHeight}px` : resolvedProps.maxHeight
1253
1316
  } : void 0;
1317
+ const renderProps = {
1318
+ ...resolvedProps,
1319
+ emptyText: tableLabels.value.emptyText
1320
+ };
1254
1321
  const tableChildren = [
1255
- renderTableHeader(ctx, resolvedProps, slots),
1256
- renderTableBody(ctx, resolvedProps, slots),
1257
- renderSummaryRow(ctx, resolvedProps)
1322
+ renderTableHeader(ctx, renderProps, slots),
1323
+ renderTableBody(ctx, renderProps, slots),
1324
+ renderSummaryRow(ctx, renderProps)
1258
1325
  ];
1259
1326
  const tableInner = h6(
1260
1327
  "table",
@@ -1282,83 +1349,192 @@ var Table = defineComponent({
1282
1349
  },
1283
1350
  [tableInner]
1284
1351
  ) : tableInner;
1285
- const cardContent = resolvedProps.responsiveMode === "card" ? h6(
1286
- "div",
1287
- {
1288
- class: getTableResponsiveCardListClasses(resolvedProps.cardBreakpoint),
1289
- "data-tiger-table-mobile": "card"
1290
- },
1291
- ctx.paginatedData.value.length === 0 ? [h6("div", { class: tableResponsiveCardClasses }, resolvedProps.emptyText)] : ctx.paginatedData.value.map((record, index) => {
1292
- const key = ctx.paginatedRowKeys.value[index];
1293
- const isExpanded = ctx.expandedRowKeySet.value.has(key);
1294
- const isRowExpandable = resolvedProps.expandable ? resolvedProps.expandable.rowExpandable ? resolvedProps.expandable.rowExpandable(record) : true : false;
1295
- const { titleColumn, bodyColumns } = getCardColumns(ctx.displayColumns.value);
1296
- const renderCardCellContent = (column) => {
1297
- const dataKey = column.dataKey || column.key;
1298
- return slots[`cell-${column.key}`]?.({ record, index }) ?? (column.render ? column.render(record, index) : record[dataKey]);
1299
- };
1300
- const titleNode = titleColumn ? h6("div", { class: tableResponsiveCardTitleClasses }, [
1301
- renderCardCellContent(titleColumn)
1302
- ]) : null;
1303
- const rows = bodyColumns.map(
1304
- (column) => h6("div", { key: column.key, class: tableResponsiveCardRowClasses }, [
1305
- h6("div", { class: tableResponsiveCardLabelClasses }, column.title),
1306
- h6("div", { class: tableResponsiveCardValueClasses }, [
1307
- renderCardCellContent(column)
1308
- ])
1309
- ])
1352
+ const cardContent = (() => {
1353
+ if (resolvedProps.responsiveMode !== "card") return null;
1354
+ const cardChildren = [];
1355
+ const sortableColumns = ctx.displayColumns.value.filter((column) => column.sortable);
1356
+ if (resolvedProps.rowSelection && resolvedProps.rowSelection.type !== "radio" && resolvedProps.rowSelection.showCheckbox !== false && ctx.paginatedData.value.length > 0) {
1357
+ cardChildren.push(
1358
+ h6(
1359
+ "div",
1360
+ {
1361
+ class: "flex items-center justify-between rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2"
1362
+ },
1363
+ [
1364
+ h6(
1365
+ Checkbox,
1366
+ {
1367
+ size: "sm",
1368
+ modelValue: ctx.allSelected.value,
1369
+ indeterminate: ctx.someSelected.value,
1370
+ onChange: (checked) => ctx.handleSelectAll(checked)
1371
+ },
1372
+ { default: () => tableLabels.value.selectAllText }
1373
+ )
1374
+ ]
1375
+ )
1310
1376
  );
1311
- const controls = [];
1312
- if (resolvedProps.rowSelection && resolvedProps.rowSelection.showCheckbox !== false) {
1313
- const checkboxProps = resolvedProps.rowSelection.getCheckboxProps?.(record) || {};
1314
- controls.push(
1315
- h6("input", {
1316
- type: resolvedProps.rowSelection.type === "radio" ? "radio" : "checkbox",
1317
- checked: ctx.selectedRowKeySet.value.has(key),
1318
- disabled: checkboxProps.disabled,
1319
- onClick: (event) => event.stopPropagation(),
1320
- onChange: (event) => ctx.handleSelectRow(key, event.target.checked)
1377
+ }
1378
+ if (sortableColumns.length > 0) {
1379
+ cardChildren.push(
1380
+ h6("div", {
1381
+ class: "rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2"
1382
+ }, [
1383
+ h6(Select, {
1384
+ size: "sm",
1385
+ modelValue: ctx.sortState.value.key && ctx.sortState.value.direction ? `${ctx.sortState.value.key}:${ctx.sortState.value.direction}` : "",
1386
+ options: [
1387
+ { label: tableLabels.value.clearSortText, value: "" },
1388
+ ...sortableColumns.flatMap((column) => [
1389
+ {
1390
+ label: `${formatTableSortByText(tableLabels.value.sortByText, column.title)} \u2191`,
1391
+ value: `${column.key}:asc`
1392
+ },
1393
+ {
1394
+ label: `${formatTableSortByText(tableLabels.value.sortByText, column.title)} \u2193`,
1395
+ value: `${column.key}:desc`
1396
+ }
1397
+ ])
1398
+ ],
1399
+ clearable: false,
1400
+ "onUpdate:modelValue": (value) => {
1401
+ const nextValue = String(value ?? "");
1402
+ if (!nextValue) {
1403
+ ctx.handleSetSort({ key: null, direction: null });
1404
+ return;
1405
+ }
1406
+ const separatorIndex = nextValue.lastIndexOf(":");
1407
+ const key = nextValue.slice(0, separatorIndex);
1408
+ const direction = nextValue.slice(separatorIndex + 1);
1409
+ ctx.handleSetSort({ key, direction });
1410
+ }
1321
1411
  })
1322
- );
1323
- }
1324
- if (resolvedProps.expandable && isRowExpandable) {
1325
- controls.push(
1326
- h6(
1327
- "button",
1412
+ ])
1413
+ );
1414
+ }
1415
+ if (ctx.paginatedData.value.length === 0) {
1416
+ cardChildren.push(
1417
+ h6("div", { class: tableResponsiveCardClasses }, [
1418
+ h6(Empty, { showImage: false, description: tableLabels.value.emptyText })
1419
+ ])
1420
+ );
1421
+ } else {
1422
+ cardChildren.push(
1423
+ ...ctx.paginatedData.value.map((record, index) => {
1424
+ const key = ctx.paginatedRowKeys.value[index];
1425
+ const isExpanded = ctx.expandedRowKeySet.value.has(key);
1426
+ const isSelected = ctx.selectedRowKeySet.value.has(key);
1427
+ const isRowExpandable = resolvedProps.expandable ? resolvedProps.expandable.rowExpandable ? resolvedProps.expandable.rowExpandable(record) : true : false;
1428
+ const { titleColumn, bodyColumns } = getCardColumns(ctx.displayColumns.value);
1429
+ const renderCardCellContent = (column) => {
1430
+ const dataKey = column.dataKey || column.key;
1431
+ return slots[`cell-${column.key}`]?.({ record, index }) ?? (column.render ? column.render(record, index) : record[dataKey]);
1432
+ };
1433
+ const titleNode = titleColumn ? h6("div", { class: tableResponsiveCardTitleClasses }, [
1434
+ renderCardCellContent(titleColumn)
1435
+ ]) : null;
1436
+ const rows = bodyColumns.map(
1437
+ (column) => h6("div", { key: column.key, class: tableResponsiveCardRowClasses }, [
1438
+ h6("div", { class: tableResponsiveCardLabelClasses }, column.title),
1439
+ h6("div", { class: tableResponsiveCardValueClasses }, [
1440
+ renderCardCellContent(column)
1441
+ ])
1442
+ ])
1443
+ );
1444
+ const controls = [];
1445
+ if (resolvedProps.rowSelection && resolvedProps.rowSelection.showCheckbox !== false) {
1446
+ const checkboxProps = resolvedProps.rowSelection.getCheckboxProps?.(record) || {};
1447
+ controls.push(
1448
+ h6(
1449
+ "span",
1450
+ { onClick: (event) => event.stopPropagation() },
1451
+ [
1452
+ resolvedProps.rowSelection.type === "radio" ? h6(Radio, {
1453
+ value: key,
1454
+ checked: isSelected,
1455
+ disabled: checkboxProps.disabled,
1456
+ "aria-label": formatTableSelectRowAriaLabel(
1457
+ tableLabels.value.selectRowAriaLabel,
1458
+ index + 1,
1459
+ tableLocale.value?.locale
1460
+ ),
1461
+ onChange: () => ctx.handleSelectRow(key, true)
1462
+ }) : h6(Checkbox, {
1463
+ size: "sm",
1464
+ modelValue: isSelected,
1465
+ disabled: checkboxProps.disabled,
1466
+ "aria-label": formatTableSelectRowAriaLabel(
1467
+ tableLabels.value.selectRowAriaLabel,
1468
+ index + 1,
1469
+ tableLocale.value?.locale
1470
+ ),
1471
+ onChange: (checked) => ctx.handleSelectRow(key, checked)
1472
+ })
1473
+ ]
1474
+ )
1475
+ );
1476
+ }
1477
+ if (resolvedProps.expandable && isRowExpandable) {
1478
+ controls.push(
1479
+ h6(
1480
+ "button",
1481
+ {
1482
+ type: "button",
1483
+ class: "text-sm text-[var(--tiger-primary,#2563eb)]",
1484
+ "aria-expanded": isExpanded,
1485
+ onClick: (event) => {
1486
+ event.stopPropagation();
1487
+ ctx.handleToggleExpand(key, record);
1488
+ }
1489
+ },
1490
+ isExpanded ? tableLabels.value.collapseText : tableLabels.value.expandText
1491
+ )
1492
+ );
1493
+ }
1494
+ const expandedContent = resolvedProps.expandable && isExpanded && isRowExpandable ? slots["expanded-row"]?.({ record, index }) ?? resolvedProps.expandable.expandedRowRender?.(record, index) : null;
1495
+ const cardContext = {
1496
+ record,
1497
+ index,
1498
+ columns: ctx.displayColumns.value,
1499
+ selected: isSelected,
1500
+ expanded: isExpanded,
1501
+ toggleExpand: () => ctx.handleToggleExpand(key, record),
1502
+ selectRow: (checked) => ctx.handleSelectRow(key, checked)
1503
+ };
1504
+ const customCard = slots.card?.(cardContext) ?? resolvedProps.renderCard?.(cardContext);
1505
+ const resolvedCardClassName = typeof resolvedProps.cardClassName === "function" ? resolvedProps.cardClassName(record, index) : resolvedProps.cardClassName;
1506
+ return h6(
1507
+ "div",
1328
1508
  {
1329
- type: "button",
1330
- class: "text-sm text-[var(--tiger-primary,#2563eb)]",
1331
- "aria-expanded": isExpanded,
1332
- onClick: (event) => {
1333
- event.stopPropagation();
1334
- ctx.handleToggleExpand(key, record);
1335
- }
1509
+ key,
1510
+ class: classNames3(tableResponsiveCardClasses, resolvedCardClassName),
1511
+ onClick: () => ctx.handleRowClick(record, index, key)
1336
1512
  },
1337
- isExpanded ? "Collapse" : "Expand"
1338
- )
1339
- );
1340
- }
1341
- const expandedContent = resolvedProps.expandable && isExpanded && isRowExpandable ? slots["expanded-row"]?.({ record, index }) ?? resolvedProps.expandable.expandedRowRender?.(record, index) : null;
1342
- return h6(
1343
- "div",
1344
- {
1345
- key,
1346
- class: tableResponsiveCardClasses,
1347
- onClick: () => ctx.handleRowClick(record, index, key)
1348
- },
1349
- [
1350
- controls.length ? h6("div", { class: "mb-2 flex items-center gap-3" }, controls) : null,
1351
- titleNode,
1352
- ...rows,
1353
- expandedContent ? h6(
1354
- "div",
1355
- { class: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3" },
1356
- [expandedContent]
1357
- ) : null
1358
- ]
1513
+ customCard !== void 0 && customCard !== null ? [customCard] : [
1514
+ controls.length ? h6("div", { class: "mb-2 flex items-center gap-3" }, controls) : null,
1515
+ titleNode,
1516
+ ...rows,
1517
+ expandedContent ? h6(
1518
+ "div",
1519
+ {
1520
+ class: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3"
1521
+ },
1522
+ [expandedContent]
1523
+ ) : null
1524
+ ]
1525
+ );
1526
+ })
1359
1527
  );
1360
- })
1361
- ) : null;
1528
+ }
1529
+ return h6(
1530
+ "div",
1531
+ {
1532
+ class: getTableResponsiveCardListClasses(resolvedProps.cardBreakpoint),
1533
+ "data-tiger-table-mobile": "card"
1534
+ },
1535
+ cardChildren
1536
+ );
1537
+ })();
1362
1538
  return h6(
1363
1539
  "div",
1364
1540
  {
@@ -1393,11 +1569,11 @@ var Table = defineComponent({
1393
1569
  class: tableLoadingOverlayClasses,
1394
1570
  role: "status",
1395
1571
  "aria-live": "polite",
1396
- "aria-label": "Loading"
1572
+ "aria-label": tableLabels.value.loadingText
1397
1573
  },
1398
- [LoadingSpinner(), h6("span", { class: "sr-only" }, "Loading")]
1574
+ [LoadingSpinner(), h6("span", { class: "sr-only" }, tableLabels.value.loadingText)]
1399
1575
  ),
1400
- renderPagination(ctx, resolvedProps, {
1576
+ renderPagination(ctx, renderProps, {
1401
1577
  locale: paginationLocale.value,
1402
1578
  disableI18n: isPaginationI18nDisabled.value
1403
1579
  })
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFloatingPopup
3
- } from "./chunk-UJZPEXF5.mjs";
3
+ } from "./chunk-JPZJZFC4.mjs";
4
4
  import {
5
5
  renderVueBodyTeleport
6
6
  } from "./chunk-BDTPFPSB.mjs";
@@ -8,7 +8,8 @@ import {
8
8
  import { computed, ref, watch, onBeforeUnmount } from "vue";
9
9
  import {
10
10
  getTransformOrigin,
11
- buildTriggerHandlerMap
11
+ buildTriggerHandlerMap,
12
+ restoreFocus
12
13
  } from "@expcat/tigercat-core";
13
14
  function useFloatingPopup(options) {
14
15
  const { props, emit, multiTrigger = true } = options;
@@ -32,6 +33,19 @@ function useFloatingPopup(options) {
32
33
  const containerRef = ref(null);
33
34
  const triggerRef = ref(null);
34
35
  const floatingRef = ref(null);
36
+ const restoreTriggerFocus = () => {
37
+ const trigger = triggerRef.value;
38
+ const target = trigger?.querySelector(
39
+ 'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'
40
+ ) ?? trigger;
41
+ window.setTimeout(() => {
42
+ restoreFocus(target, { preventScroll: true });
43
+ }, 0);
44
+ };
45
+ const closeAndRestoreFocus = () => {
46
+ setVisible(false);
47
+ restoreTriggerFocus();
48
+ };
35
49
  const {
36
50
  x,
37
51
  y,
@@ -59,14 +73,14 @@ function useFloatingPopup(options) {
59
73
  outsideClickCleanup = useVueClickOutside({
60
74
  enabled: currentVisible,
61
75
  refs: [containerRef, floatingRef],
62
- onOutsideClick: () => setVisible(false),
76
+ onOutsideClick: closeAndRestoreFocus,
63
77
  defer: true
64
78
  });
65
79
  }
66
80
  if (visible && trigger !== "manual") {
67
81
  escapeKeyCleanup = useVueEscapeKey({
68
82
  enabled: currentVisible,
69
- onEscape: () => setVisible(false)
83
+ onEscape: closeAndRestoreFocus
70
84
  });
71
85
  }
72
86
  },
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkS3KTGULCjs = require('./chunk-S3KTGULC.js');
3
+ var _chunkNNFDOVVAjs = require('./chunk-NNFDOVVA.js');
4
4
 
5
5
 
6
6
  var _chunkEQW6IUHGjs = require('./chunk-EQW6IUHG.js');
@@ -48,7 +48,7 @@ var Tooltip = _vue.defineComponent.call(void 0, {
48
48
  floatingRef,
49
49
  floatingStyles,
50
50
  triggerHandlers
51
- } = _chunkS3KTGULCjs.useFloatingPopup.call(void 0, { props, emit });
51
+ } = _chunkNNFDOVVAjs.useFloatingPopup.call(void 0, { props, emit });
52
52
  const tooltipId = createTooltipId();
53
53
  const containerClasses = _vue.computed.call(void 0,
54
54
  () => _tigercatcore.classNames.call(void 0, _tigercatcore.getTooltipContainerClasses.call(void 0, ), props.className, _tigercatcore.coerceClassValue.call(void 0, attrsRecord.class))
@@ -9,6 +9,7 @@ var _vue = require('vue');
9
9
 
10
10
 
11
11
 
12
+
12
13
  var _tigercatcore = require('@expcat/tigercat-core');
13
14
  function useFloatingPopup(options) {
14
15
  const { props, emit, multiTrigger = true } = options;
@@ -32,6 +33,19 @@ function useFloatingPopup(options) {
32
33
  const containerRef = _vue.ref.call(void 0, null);
33
34
  const triggerRef = _vue.ref.call(void 0, null);
34
35
  const floatingRef = _vue.ref.call(void 0, null);
36
+ const restoreTriggerFocus = () => {
37
+ const trigger = triggerRef.value;
38
+ const target = _nullishCoalesce(_optionalChain([trigger, 'optionalAccess', _ => _.querySelector, 'call', _2 => _2(
39
+ 'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'
40
+ )]), () => ( trigger));
41
+ window.setTimeout(() => {
42
+ _tigercatcore.restoreFocus.call(void 0, target, { preventScroll: true });
43
+ }, 0);
44
+ };
45
+ const closeAndRestoreFocus = () => {
46
+ setVisible(false);
47
+ restoreTriggerFocus();
48
+ };
35
49
  const {
36
50
  x,
37
51
  y,
@@ -51,30 +65,30 @@ function useFloatingPopup(options) {
51
65
  _vue.watch.call(void 0,
52
66
  [currentVisible, effectiveTrigger],
53
67
  ([visible, trigger]) => {
54
- _optionalChain([outsideClickCleanup, 'optionalCall', _ => _()]);
55
- _optionalChain([escapeKeyCleanup, 'optionalCall', _2 => _2()]);
68
+ _optionalChain([outsideClickCleanup, 'optionalCall', _3 => _3()]);
69
+ _optionalChain([escapeKeyCleanup, 'optionalCall', _4 => _4()]);
56
70
  outsideClickCleanup = void 0;
57
71
  escapeKeyCleanup = void 0;
58
72
  if (visible && trigger === "click") {
59
73
  outsideClickCleanup = _chunkEQW6IUHGjs.useVueClickOutside.call(void 0, {
60
74
  enabled: currentVisible,
61
75
  refs: [containerRef, floatingRef],
62
- onOutsideClick: () => setVisible(false),
76
+ onOutsideClick: closeAndRestoreFocus,
63
77
  defer: true
64
78
  });
65
79
  }
66
80
  if (visible && trigger !== "manual") {
67
81
  escapeKeyCleanup = _chunkEQW6IUHGjs.useVueEscapeKey.call(void 0, {
68
82
  enabled: currentVisible,
69
- onEscape: () => setVisible(false)
83
+ onEscape: closeAndRestoreFocus
70
84
  });
71
85
  }
72
86
  },
73
87
  { immediate: true }
74
88
  );
75
89
  _vue.onBeforeUnmount.call(void 0, () => {
76
- _optionalChain([outsideClickCleanup, 'optionalCall', _3 => _3()]);
77
- _optionalChain([escapeKeyCleanup, 'optionalCall', _4 => _4()]);
90
+ _optionalChain([outsideClickCleanup, 'optionalCall', _5 => _5()]);
91
+ _optionalChain([escapeKeyCleanup, 'optionalCall', _6 => _6()]);
78
92
  });
79
93
  const floatingStyles = _vue.computed.call(void 0, () => ({
80
94
  position: "absolute",