@ostack.tech/ui 0.11.2 → 0.12.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.
Files changed (44) hide show
  1. package/dist/ostack-ui.css +40 -32
  2. package/dist/ostack-ui.js +570 -322
  3. package/dist/ostack-ui.js.map +1 -1
  4. package/dist/types/components/DataTable/DataTableColumn.d.ts +12 -1
  5. package/dist/types/components/DataTable/DataTableContext.d.ts +2 -0
  6. package/dist/types/components/DataTable/DataTableFoot.d.ts +2 -1
  7. package/dist/types/components/DataTable/columnUtils.d.ts +5 -0
  8. package/dist/types/components/DataTable/sanitizeProps.d.ts +8 -0
  9. package/dist/types/components/Layer/Layer.d.ts +32 -0
  10. package/dist/types/components/Layer/LayerContext.d.ts +6 -0
  11. package/dist/types/components/Layer/index.d.ts +2 -0
  12. package/dist/types/components/Overlay/Overlay.d.ts +1 -1
  13. package/dist/types/components/Root/Root.d.ts +9 -4
  14. package/dist/types/components/Table/Table.d.ts +4 -4
  15. package/dist/types/components/Table/TableCell.d.ts +15 -0
  16. package/dist/types/components/Table/TableColumn.d.ts +1 -1
  17. package/dist/types/components/Table/TableContext.d.ts +9 -9
  18. package/dist/types/components/Table/TableHead.d.ts +2 -2
  19. package/dist/types/components/Table/columnUtils.d.ts +35 -0
  20. package/dist/types/components/Toast/ToastProvider.d.ts +2 -1
  21. package/dist/types/components/Toast/ToastViewport.d.ts +8 -0
  22. package/dist/types/index.d.ts +1 -0
  23. package/package.json +5 -5
  24. package/scss/components/CommandMenu/_CommandMenu-variables.scss +0 -1
  25. package/scss/components/CommandMenu/_CommandMenu.scss +0 -2
  26. package/scss/components/DataTable/_DataTable.scss +4 -3
  27. package/scss/components/Dialog/_Dialog-variables.scss +0 -1
  28. package/scss/components/Dialog/_Dialog.scss +0 -1
  29. package/scss/components/DropdownMenu/_DropdownMenu-variables.scss +0 -2
  30. package/scss/components/DropdownMenu/_DropdownMenu.scss +0 -1
  31. package/scss/components/Overlay/_Overlay-variables.scss +0 -1
  32. package/scss/components/Overlay/_Overlay.scss +0 -1
  33. package/scss/components/Table/_Table-variables.scss +2 -4
  34. package/scss/components/Table/_Table.scss +10 -8
  35. package/scss/components/Tabs/_Tabs-variables.scss +3 -3
  36. package/scss/components/Toast/_Toast.scss +26 -14
  37. package/scss/components/Tooltip/_Tooltip-variables.scss +0 -1
  38. package/scss/components/Tooltip/_Tooltip.scss +0 -2
  39. package/scss/scss/_base-variables.scss +0 -2
  40. package/scss/scss/placeholders/button/_button-variables.scss +1 -1
  41. package/scss/scss/placeholders/button/_button.scss +5 -2
  42. package/scss/scss/placeholders/control/_control-variables.scss +3 -5
  43. package/scss/scss/placeholders/popover/_popover-variables.scss +0 -1
  44. package/scss/scss/placeholders/popover/_popover.scss +0 -2
package/dist/ostack-ui.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
- import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, useState, memo, Fragment as Fragment$1, isValidElement, cloneElement, Children, useImperativeHandle, startTransition, useLayoutEffect as useLayoutEffect$2, useSyncExternalStore, useDeferredValue } from "react";
2
+ import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, Children, isValidElement, useState, memo, Fragment as Fragment$1, cloneElement, useImperativeHandle, startTransition, useLayoutEffect as useLayoutEffect$2, useSyncExternalStore, useDeferredValue } from "react";
3
3
  import { parseKeybinding, tinykeys } from "tinykeys";
4
4
  import fromExponential from "from-exponential";
5
- import { isValid, isDate, addMonths, isAfter, isBefore, startOfMonth, setMonth, getYear, setYear, startOfYear, format, isSameYear, getMonth, max, min, endOfMonth, isWithinInterval, lastDayOfMonth, isSameDay, isEqual, parseISO, parse } from "date-fns";
5
+ import { isValid, isDate, addMonths, isBefore, startOfMonth, isAfter, setMonth, setYear, startOfYear, format, max, min, endOfMonth, isWithinInterval, lastDayOfMonth, isSameDay, isEqual, parseISO, parse } from "date-fns";
6
6
  import { createStore, useStore as useStore$1, create } from "zustand";
7
7
  import { shallow } from "zustand/shallow";
8
8
  import { numericFormatter, removeNumericFormat, NumericFormat } from "react-number-format";
@@ -453,6 +453,12 @@ function useCreateDataTableContext({
453
453
  subscribeWithSelector((set, get) => ({
454
454
  columns,
455
455
  leafColumns: leafColumns2,
456
+ hasFooterCells: computed(
457
+ () => [get().leafColumns],
458
+ (leafColumns22) => Object.values(leafColumns22).some(
459
+ (column) => typeof column.footer !== "boolean" && column.footer != null
460
+ )
461
+ ),
456
462
  headCount,
457
463
  _offset: offset ?? defaultOffset,
458
464
  offset: computed(
@@ -536,6 +542,10 @@ function useCreateDataTableContext({
536
542
  () => [get().totalCount(), get().loading, get().loadingCount],
537
543
  (totalCount, loading2, loadingCount2) => loading2 ? loadingCount2 : totalCount ?? loadingCount2
538
544
  ),
545
+ footCount: computed(
546
+ () => [get().hasFooterCells()],
547
+ (hasFooterCells) => hasFooterCells ? 1 : 0
548
+ ),
539
549
  scrolledRangeStart: 1,
540
550
  scrolledRangeEnd: 1,
541
551
  tableHeadHeight: void 0,
@@ -969,7 +979,7 @@ function useOnFieldLabelChange(cb, { fireImmediately = true } = {}) {
969
979
  }
970
980
  let prevCleanup;
971
981
  const unsubscribe = store.subscribe(
972
- (state) => state.label,
982
+ ({ label }) => label,
973
983
  (label) => {
974
984
  prevCleanup = cb(label);
975
985
  },
@@ -1020,37 +1030,153 @@ const LinkContext = createContext(LINK_CONTEXT_DEFAULT_VALUE);
1020
1030
  function useLinkContext() {
1021
1031
  return useContext(LinkContext);
1022
1032
  }
1033
+ const TableColumn = forwardRef(function TableColumn2() {
1034
+ return null;
1035
+ });
1036
+ function columnsFromChildren(children) {
1037
+ return Children.toArray(children).filter(
1038
+ (child) => isValidElement(child) && child.type === TableColumn
1039
+ ).map((child) => ({
1040
+ ...child.props,
1041
+ subColumns: columnsFromChildren(child.props.children ?? null)
1042
+ }));
1043
+ }
1044
+ function numberOfRows$1(columns) {
1045
+ return columns.reduce(
1046
+ (n, column) => Math.max(n, numberOfRows$1(column.subColumns) + 1),
1047
+ 0
1048
+ );
1049
+ }
1050
+ function numberOfColumns(columns) {
1051
+ return columns.reduce(
1052
+ (n, column) => n + (column.subColumns.length === 0 ? 1 : numberOfColumns(column.subColumns)),
1053
+ 0
1054
+ );
1055
+ }
1056
+ function columnsOfRow(columns, index) {
1057
+ return index === 0 ? columns : columns.reduce((rowColumns, column) => {
1058
+ rowColumns.push(...columnsOfRow(column.subColumns, index - 1));
1059
+ return rowColumns;
1060
+ }, []);
1061
+ }
1062
+ function leafColumns$1(columns) {
1063
+ return columns.reduce((leaves, column) => {
1064
+ leaves.push(
1065
+ ...column.subColumns.length === 0 ? [column] : leafColumns$1(column.subColumns)
1066
+ );
1067
+ return leaves;
1068
+ }, []);
1069
+ }
1070
+ function tableMinWidth(leaves, defaultColumnWidth) {
1071
+ return leaves.reduce(
1072
+ (sum, column) => sum + columnWidth(column, defaultColumnWidth),
1073
+ 0
1074
+ ) + "px";
1075
+ }
1076
+ function tableMaxWidth(leaves, defaultColumnWidth) {
1077
+ return leaves.every((column) => column.fixed) ? tableMinWidth(leaves, defaultColumnWidth) : void 0;
1078
+ }
1079
+ function columnWidths(leaves, defaultColumnWidth) {
1080
+ const dynamicWidthsSum = leaves.reduce(
1081
+ (sum, column) => sum + (column.fixed ? 0 : columnWidth(column, defaultColumnWidth)),
1082
+ 0
1083
+ );
1084
+ return leaves.reduce((widths, column) => {
1085
+ const colSpan = column.colSpan ?? 1;
1086
+ const colWidths = Array.isArray(column.width) ? column.width : (
1087
+ // Distribute the width amongst the columns being spanned
1088
+ new Array(colSpan).fill(
1089
+ columnWidth(column, defaultColumnWidth) / colSpan
1090
+ )
1091
+ );
1092
+ for (let i = 0; i < colSpan; ++i) {
1093
+ const colWidth = colWidths[i] ?? 0;
1094
+ widths.push(
1095
+ column.fixed ? `${colWidth}px` : `${colWidth / dynamicWidthsSum * 100}%`
1096
+ );
1097
+ }
1098
+ return widths;
1099
+ }, []);
1100
+ }
1101
+ function columnWidth(column, defaultColumnsMinWidth) {
1102
+ return Array.isArray(column.width) ? column.width.reduce((sum, width) => sum + width, 0) : column.width ?? defaultColumnsMinWidth * (column.colSpan ?? 1);
1103
+ }
1104
+ function leftMostColumns(columns) {
1105
+ if (columns.length === 0) {
1106
+ return [];
1107
+ }
1108
+ const firstColumn = columns[0];
1109
+ return [firstColumn, ...leftMostColumns(firstColumn.subColumns)];
1110
+ }
1111
+ function rightMostColumns(columns) {
1112
+ if (columns.length === 0) {
1113
+ return [];
1114
+ }
1115
+ const lastColumn = columns[columns.length - 1];
1116
+ return [lastColumn, ...rightMostColumns(lastColumn.subColumns)];
1117
+ }
1118
+ function leftMostLeafColumn(column) {
1119
+ if (column.subColumns.length === 0) {
1120
+ return column;
1121
+ }
1122
+ return leftMostLeafColumn(column.subColumns[0]);
1123
+ }
1124
+ function rightMostLeafColumn(column) {
1125
+ const subcolumnsLength = column.subColumns.length;
1126
+ if (subcolumnsLength === 0) {
1127
+ return column;
1128
+ }
1129
+ return rightMostLeafColumn(column.subColumns[subcolumnsLength - 1]);
1130
+ }
1131
+ function stickyColumnOffsets(leaves, defaultColumnWidth) {
1132
+ const offsets = new Array(leaves.length);
1133
+ let leftSum = 0;
1134
+ let rightSum = 0;
1135
+ for (let i = 0; i < leaves.length; ++i) {
1136
+ const colStart = leaves[i];
1137
+ const colEnd = leaves[leaves.length - 1 - i];
1138
+ if (colStart.sticky === "left") {
1139
+ offsets[i] = leftSum;
1140
+ leftSum += columnWidth(colStart, defaultColumnWidth);
1141
+ }
1142
+ if (colEnd.sticky === "right") {
1143
+ offsets[leaves.length - 1 - i] = rightSum;
1144
+ rightSum += columnWidth(colEnd, defaultColumnWidth);
1145
+ }
1146
+ }
1147
+ return offsets;
1148
+ }
1023
1149
  const TableContext = createContext(null);
1024
- function useCreateTableContext(editable, status, layout, defaultColumnWidth, onTableMinWidthChange, onTableMaxWidthChange) {
1150
+ function useCreateTableContext({
1151
+ editable,
1152
+ status,
1153
+ layout,
1154
+ defaultColumnWidth
1155
+ }) {
1025
1156
  const store = useConstant(
1026
1157
  () => createStore()(
1027
- subscribeWithSelector((_set) => ({
1158
+ subscribeWithSelector((_set, get) => ({
1028
1159
  scrollPosition: void 0,
1029
- numberOfColumns: void 0,
1030
- columnWidths: void 0
1160
+ leafColumns: void 0,
1161
+ defaultColumnWidth,
1162
+ stickyColumnOffsets: computed(
1163
+ () => [get().leafColumns, get().defaultColumnWidth],
1164
+ (leaves, defaultColumnWidth2) => leaves && stickyColumnOffsets(leaves, defaultColumnWidth2)
1165
+ )
1031
1166
  }))
1032
1167
  )
1033
1168
  );
1034
- return useMemo(
1035
- () => ({
1169
+ useEffect(() => {
1170
+ store.setState({ defaultColumnWidth });
1171
+ }, [defaultColumnWidth, store]);
1172
+ return useMemo(() => {
1173
+ return {
1036
1174
  editable,
1037
1175
  status,
1038
1176
  layout,
1039
- defaultColumnWidth,
1040
- onTableMinWidthChange,
1041
- onTableMaxWidthChange,
1042
1177
  store
1043
- }),
1044
- [
1045
- defaultColumnWidth,
1046
- editable,
1047
- layout,
1048
- onTableMaxWidthChange,
1049
- onTableMinWidthChange,
1050
- status,
1051
- store
1052
- ]
1053
- );
1178
+ };
1179
+ }, [editable, layout, status, store]);
1054
1180
  }
1055
1181
  function useTableContext() {
1056
1182
  const tableContext = useContext(TableContext);
@@ -1061,7 +1187,7 @@ function useTableContext() {
1061
1187
  }
1062
1188
  function useTableNumberOfColumns() {
1063
1189
  const { store } = useTableContext();
1064
- return useStore$1(store, (state) => state.numberOfColumns);
1190
+ return useStore$1(store, (state) => state.leafColumns?.length);
1065
1191
  }
1066
1192
  const TableHeadContext = createContext(false);
1067
1193
  function useIsInTableHead() {
@@ -1094,6 +1220,87 @@ function ClearContexts({
1094
1220
  }
1095
1221
  return result;
1096
1222
  }
1223
+ function useCssVars(options) {
1224
+ const contextPrefix = usePrefix();
1225
+ const prefix = options?.prefix ?? contextPrefix;
1226
+ const cssVarName = useCallback(
1227
+ (name) => `--${prefix(name)}`,
1228
+ [prefix]
1229
+ );
1230
+ const cssVar = useCallback(
1231
+ (name, fallback) => `var(${cssVarName(name)}${// eslint-disable-next-line @typescript-eslint/no-base-to-string
1232
+ fallback != null ? `, ${String(fallback)}` : ""})`,
1233
+ [cssVarName]
1234
+ );
1235
+ const cssVarStyle = useCallback(
1236
+ (name, value) => value != null ? (
1237
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
1238
+ { [cssVarName(name)]: String(value) }
1239
+ ) : void 0,
1240
+ [cssVarName]
1241
+ );
1242
+ const cssToggler = useCallback(
1243
+ (value) => cssVar(`toggler-${value}`, null),
1244
+ [cssVar]
1245
+ );
1246
+ return useMemo(
1247
+ () => ({ cssVarName, cssVar, cssVarStyle, cssToggler }),
1248
+ [cssToggler, cssVar, cssVarName, cssVarStyle]
1249
+ );
1250
+ }
1251
+ const LayerContext = createContext([]);
1252
+ function useLayerZIndex() {
1253
+ return computeLayerZIndex(useContext(LayerContext));
1254
+ }
1255
+ function computeLayerZIndex(zIndices) {
1256
+ let zIndexSum;
1257
+ let zIndexStrings;
1258
+ for (const zIndex of zIndices) {
1259
+ if (typeof zIndex === "number") {
1260
+ zIndexSum = (zIndexSum ?? 0) + zIndex;
1261
+ } else {
1262
+ (zIndexStrings ??= []).push(zIndex);
1263
+ }
1264
+ }
1265
+ if (zIndexStrings === void 0) {
1266
+ return zIndexSum === void 0 ? "auto" : zIndexSum.toString();
1267
+ }
1268
+ if (zIndexSum === void 0) {
1269
+ return zIndexStrings.length === 1 ? zIndexStrings[0] : `calc(${zIndexStrings.join(" + ")})`;
1270
+ }
1271
+ return `calc(${zIndexStrings.join(" + ")}${zIndexSum === 0 ? "" : zIndexSum > 0 ? ` + ${zIndexSum}` : ` - ${-zIndexSum}`})`;
1272
+ }
1273
+ function Layer({ zIndex, reset, style, ...otherProps }) {
1274
+ const { cssVar, cssVarStyle } = useCssVars();
1275
+ const parentZIndices = useContext(LayerContext);
1276
+ const normalizeZIndex = useCallback(
1277
+ (zIndex2) => typeof zIndex2 === "string" ? cssVar(`z-index-${zIndex2}`) : zIndex2,
1278
+ [cssVar]
1279
+ );
1280
+ const normalizedZIndex = useMemo(
1281
+ () => (Array.isArray(zIndex) ? zIndex.map(normalizeZIndex) : [normalizeZIndex(zIndex)]).filter((v) => v != null),
1282
+ [normalizeZIndex, zIndex]
1283
+ );
1284
+ const zIndices = useMemo(
1285
+ () => normalizedZIndex == null ? reset ? [] : parentZIndices : reset ? normalizedZIndex : [...parentZIndices, ...normalizedZIndex],
1286
+ [normalizedZIndex, parentZIndices, reset]
1287
+ );
1288
+ const layerZIndex = useMemo(
1289
+ () => zIndices.length === 0 && !reset ? void 0 : computeLayerZIndex(zIndices),
1290
+ [reset, zIndices]
1291
+ );
1292
+ return zIndices.length === 0 && !reset ? /* @__PURE__ */ jsx(Slot, { style, ...otherProps }) : /* @__PURE__ */ jsx(LayerContext.Provider, { value: zIndices, children: /* @__PURE__ */ jsx(
1293
+ Slot,
1294
+ {
1295
+ style: {
1296
+ ...cssVarStyle("layer-z-index", layerZIndex),
1297
+ zIndex: cssVar("layer-z-index"),
1298
+ ...style
1299
+ },
1300
+ ...otherProps
1301
+ }
1302
+ ) });
1303
+ }
1097
1304
  const Overlay = forwardRef(
1098
1305
  function Overlay2({ className, ...otherProps }, forwardedRef) {
1099
1306
  const prefix = usePrefix();
@@ -1151,11 +1358,14 @@ const DialogContent = forwardRef(function DialogContent2({
1151
1358
  container: portalContext?.container,
1152
1359
  ...portalProps,
1153
1360
  forceMount,
1154
- children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
1361
+ children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dialog", reset: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
1155
1362
  Overlay,
1156
1363
  {
1157
1364
  ...overlayProps,
1158
- className: cx(prefix("dialog__overlay"), overlayProps?.className),
1365
+ className: cx(
1366
+ prefix("dialog__overlay"),
1367
+ overlayProps?.className
1368
+ ),
1159
1369
  children: /* @__PURE__ */ jsx(
1160
1370
  Dialog$1.Content,
1161
1371
  {
@@ -1185,7 +1395,7 @@ const DialogContent = forwardRef(function DialogContent2({
1185
1395
  }
1186
1396
  )
1187
1397
  }
1188
- ) }) })
1398
+ ) }) }) })
1189
1399
  }
1190
1400
  ) });
1191
1401
  });
@@ -1704,7 +1914,7 @@ const Tooltip = forwardRef(function Tooltip2({
1704
1914
  container: portalContext?.container,
1705
1915
  ...portalProps,
1706
1916
  forceMount,
1707
- children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsxs(
1917
+ children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "tooltip", children: /* @__PURE__ */ jsxs(
1708
1918
  Tooltip$1.Content,
1709
1919
  {
1710
1920
  sideOffset,
@@ -1728,7 +1938,7 @@ const Tooltip = forwardRef(function Tooltip2({
1728
1938
  )
1729
1939
  ]
1730
1940
  }
1731
- ) })
1941
+ ) }) })
1732
1942
  }
1733
1943
  ) })
1734
1944
  ]
@@ -1961,11 +2171,14 @@ const AlertDialogContent = forwardRef(function AlertDialogContent2({
1961
2171
  container: portalContext?.container,
1962
2172
  ...portalProps,
1963
2173
  forceMount,
1964
- children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(AlertDialog$1.Overlay, { asChild: true, children: /* @__PURE__ */ jsx(
2174
+ children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dialog", reset: true, children: /* @__PURE__ */ jsx(AlertDialog$1.Overlay, { asChild: true, children: /* @__PURE__ */ jsx(
1965
2175
  Overlay,
1966
2176
  {
1967
2177
  ...overlayProps,
1968
- className: cx(prefix("dialog__overlay"), overlayProps?.className),
2178
+ className: cx(
2179
+ prefix("dialog__overlay"),
2180
+ overlayProps?.className
2181
+ ),
1969
2182
  children: /* @__PURE__ */ jsx(
1970
2183
  AlertDialog$1.Content,
1971
2184
  {
@@ -1990,7 +2203,7 @@ const AlertDialogContent = forwardRef(function AlertDialogContent2({
1990
2203
  }
1991
2204
  )
1992
2205
  }
1993
- ) }) })
2206
+ ) }) }) })
1994
2207
  }
1995
2208
  ) });
1996
2209
  });
@@ -2163,7 +2376,7 @@ function AlertDialogProvider({ children }) {
2163
2376
  const [content, setContent] = useState(null);
2164
2377
  const resolveRef = useRef(null);
2165
2378
  const prompt = useCallback(
2166
- // eslint-disable-next-line
2379
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
2167
2380
  (renderContent) => new Promise((res) => {
2168
2381
  const resolve = resolveRef.current = (value) => {
2169
2382
  res(value);
@@ -2676,19 +2889,20 @@ const ToastTitle = forwardRef(function ToastTitle2({ className, ...otherProps },
2676
2889
  }
2677
2890
  );
2678
2891
  });
2679
- const ToastViewport = forwardRef(function ToastViewport2({ label, className, ...otherProps }, forwardedRef) {
2892
+ const ToastViewport = forwardRef(function ToastViewport2({ position = "right", label, className, ...otherProps }, forwardedRef) {
2680
2893
  const prefix = usePrefix();
2681
2894
  const [locale7] = useLocale();
2682
2895
  label ??= locale7.ToastViewport.label;
2683
- return /* @__PURE__ */ jsx(
2896
+ return /* @__PURE__ */ jsx(Layer, { zIndex: "toast", reset: true, children: /* @__PURE__ */ jsx(
2684
2897
  Toast$1.Viewport,
2685
2898
  {
2686
2899
  label,
2687
2900
  className: cx(prefix("toast__viewport"), className),
2901
+ "data-position": position,
2688
2902
  ...otherProps,
2689
2903
  ref: forwardedRef
2690
2904
  }
2691
- );
2905
+ ) });
2692
2906
  });
2693
2907
  function ToastManagerProvider({ children }) {
2694
2908
  const toastId = useRef(0);
@@ -3151,8 +3365,9 @@ const Root = forwardRef(function Root2({
3151
3365
  disableTooltipsHoverableContent,
3152
3366
  toastsLabel,
3153
3367
  toastsDuration,
3154
- toastsSwipeDirection,
3155
3368
  toastsSwipeThreshold,
3369
+ toastViewportPosition,
3370
+ toastsSwipeDirection = toastViewportPosition === "left" ? "left" : void 0,
3156
3371
  toastViewportHotkey,
3157
3372
  toastViewportLabel,
3158
3373
  toastViewportProps,
@@ -3179,6 +3394,7 @@ const Root = forwardRef(function Root2({
3179
3394
  toastsDuration,
3180
3395
  toastsSwipeDirection,
3181
3396
  toastsSwipeThreshold,
3397
+ toastViewportPosition,
3182
3398
  toastViewportHotkey,
3183
3399
  toastViewportLabel,
3184
3400
  toastViewportProps,
@@ -3245,6 +3461,7 @@ const Root = forwardRef(function Root2({
3245
3461
  /* @__PURE__ */ jsx(Portal, { container: portalsContainer, asChild: true, children: /* @__PURE__ */ jsx(
3246
3462
  ToastViewport,
3247
3463
  {
3464
+ position: toastViewportPosition,
3248
3465
  hotkey: toastViewportHotkey,
3249
3466
  label: toastViewportLabel,
3250
3467
  ...toastViewportProps
@@ -3381,34 +3598,6 @@ function setNativeProperty(element, prop, value) {
3381
3598
  function camelToKebabCase(str) {
3382
3599
  return str.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`);
3383
3600
  }
3384
- function useCssVars(options) {
3385
- const contextPrefix = usePrefix();
3386
- const prefix = options?.prefix ?? contextPrefix;
3387
- const cssVarName = useCallback(
3388
- (name) => `--${prefix(name)}`,
3389
- [prefix]
3390
- );
3391
- const cssVar = useCallback(
3392
- (name, fallback) => `var(${cssVarName(name)}${// eslint-disable-next-line @typescript-eslint/no-base-to-string
3393
- fallback != null ? `, ${String(fallback)}` : ""})`,
3394
- [cssVarName]
3395
- );
3396
- const cssVarStyle = useCallback(
3397
- (name, value) => value != null ? (
3398
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
3399
- { [cssVarName(name)]: String(value) }
3400
- ) : void 0,
3401
- [cssVarName]
3402
- );
3403
- const cssToggler = useCallback(
3404
- (value) => cssVar(`toggler-${value}`, null),
3405
- [cssVar]
3406
- );
3407
- return useMemo(
3408
- () => ({ cssVarName, cssVar, cssVarStyle, cssToggler }),
3409
- [cssToggler, cssVar, cssVarName, cssVarStyle]
3410
- );
3411
- }
3412
3601
  function useResponsiveValues(options) {
3413
3602
  const { cssVarName } = useCssVars(options);
3414
3603
  const responsiveValueToCssVarsAndDataAttrs = useCallback(
@@ -3536,7 +3725,9 @@ function Printer({
3536
3725
  const triggerRef = useRef(null);
3537
3726
  const contentRef = useRef(null);
3538
3727
  const [printInProgress, setPrintInProgress] = useState(false);
3539
- const [printOptions, setPrintOptions] = useState(void 0);
3728
+ const [printOptions, setPrintOptions] = useState(
3729
+ void 0
3730
+ );
3540
3731
  const resolvePrintRef = useRef(null);
3541
3732
  const rejectPrintRef = useRef(null);
3542
3733
  const pendingPromiseRef = useRef(null);
@@ -3556,9 +3747,13 @@ function Printer({
3556
3747
  setTimeout(() => triggerRef.current?.focus(), 100);
3557
3748
  }
3558
3749
  };
3750
+ const relevantDocumentTitle = printOptions?.documentTitle ?? documentTitle;
3559
3751
  const reactToPrintFn = useReactToPrint({
3560
3752
  bodyClass: preview || printInForeground ? prefix("root") : void 0,
3561
- documentTitle: printOptions?.documentTitle ?? document.title,
3753
+ documentTitle: (
3754
+ // Allow the function to return `undefined`
3755
+ typeof relevantDocumentTitle === "function" ? () => relevantDocumentTitle() ?? document.title : relevantDocumentTitle ?? document.title
3756
+ ),
3562
3757
  pageStyle: printPageStyle({
3563
3758
  pageSize: printOptions?.pageSize ?? pageSize,
3564
3759
  pageMargin: printOptions?.pageMargin ?? pageMargin,
@@ -3587,7 +3782,6 @@ function Printer({
3587
3782
  const latest = useLatestValues({
3588
3783
  printInProgress,
3589
3784
  reactToPrintFn,
3590
- documentTitle,
3591
3785
  onBeforePrint
3592
3786
  });
3593
3787
  const handlePrint = useCallback(
@@ -3597,11 +3791,7 @@ function Printer({
3597
3791
  }
3598
3792
  flushSync(() => {
3599
3793
  setPrintInProgress(true);
3600
- const documentTitleToUse = options?.documentTitle ?? latest.documentTitle;
3601
- setPrintOptions({
3602
- ...options,
3603
- documentTitle: typeof documentTitleToUse === "function" ? documentTitleToUse() : documentTitleToUse
3604
- });
3794
+ setPrintOptions(options);
3605
3795
  });
3606
3796
  await pendingPromiseRef.current;
3607
3797
  if (latest.onBeforePrint) {
@@ -3768,7 +3958,7 @@ const Field = forwardRef(function Field2({ asChild, className, ...otherProps },
3768
3958
  const fieldRef = useRef(null);
3769
3959
  useEffect(
3770
3960
  () => store.subscribe(
3771
- (state) => state.controlHasCode,
3961
+ ({ controlHasCode }) => controlHasCode,
3772
3962
  (hasCode) => setBoolDataAttr(fieldRef.current, "hasCode", hasCode),
3773
3963
  { fireImmediately: true }
3774
3964
  ),
@@ -3832,30 +4022,42 @@ const Table = forwardRef(
3832
4022
  const [scrollableEl, setScrollableEl] = useState(
3833
4023
  null
3834
4024
  );
3835
- const handleMinWidthChange = useCallback((minWidth) => {
3836
- if (tableRef.current) {
3837
- tableRef.current.style.minWidth = minWidth ?? "";
3838
- }
3839
- }, []);
3840
- const handleMaxWidthChange = useCallback(
3841
- (maxWidth) => {
3842
- if (tableRef.current) {
3843
- tableRef.current.style.maxWidth = maxWidth ?? "";
3844
- }
3845
- if (scrollableEl) {
3846
- scrollableEl.style.maxWidth = maxWidth ? `min(100%, ${maxWidth})` : "";
3847
- }
3848
- },
3849
- [scrollableEl]
3850
- );
3851
- const tableContextValue = useCreateTableContext(
4025
+ const tableContextValue = useCreateTableContext({
3852
4026
  editable,
3853
4027
  status,
3854
4028
  layout,
3855
- defaultColumnWidth,
3856
- handleMinWidthChange,
3857
- handleMaxWidthChange
3858
- );
4029
+ defaultColumnWidth
4030
+ });
4031
+ const { store } = tableContextValue;
4032
+ useEffect(() => {
4033
+ if (layout === "fixed") {
4034
+ return store.subscribe(
4035
+ ({ leafColumns: leafColumns2 }) => leafColumns2 && tableMinWidth(leafColumns2, defaultColumnWidth),
4036
+ (minWidth) => {
4037
+ if (tableRef.current) {
4038
+ tableRef.current.style.minWidth = minWidth ?? "";
4039
+ }
4040
+ },
4041
+ { fireImmediately: true }
4042
+ );
4043
+ }
4044
+ }, [defaultColumnWidth, layout, store]);
4045
+ useEffect(() => {
4046
+ if (layout === "fixed") {
4047
+ return store.subscribe(
4048
+ ({ leafColumns: leafColumns2 }) => leafColumns2 && tableMaxWidth(leafColumns2, defaultColumnWidth),
4049
+ (maxWidth) => {
4050
+ if (tableRef.current) {
4051
+ tableRef.current.style.maxWidth = maxWidth ?? "";
4052
+ }
4053
+ if (scrollableEl) {
4054
+ scrollableEl.style.maxWidth = maxWidth ? `min(100%, ${maxWidth})` : "";
4055
+ }
4056
+ },
4057
+ { fireImmediately: true }
4058
+ );
4059
+ }
4060
+ }, [defaultColumnWidth, layout, scrollableEl, store]);
3859
4061
  useScrollPosition(
3860
4062
  scrollableEl,
3861
4063
  useCallback(
@@ -3940,7 +4142,7 @@ const Table = forwardRef(
3940
4142
  children: visuallyHiddenCaption
3941
4143
  }
3942
4144
  ) }),
3943
- /* @__PURE__ */ jsx(ColumnWidths, {}),
4145
+ /* @__PURE__ */ jsx(ColumnWidths, { defaultColumnWidth }),
3944
4146
  children
3945
4147
  ]
3946
4148
  }
@@ -3953,10 +4155,15 @@ const Table = forwardRef(
3953
4155
  ) }) });
3954
4156
  }
3955
4157
  );
3956
- function ColumnWidths() {
4158
+ function ColumnWidths({ defaultColumnWidth }) {
3957
4159
  const { store } = useTableContext();
3958
- const columnWidths2 = useStore$1(store, (state) => state.columnWidths);
3959
- return columnWidths2 && /* @__PURE__ */ jsx("colgroup", { children: columnWidths2.map((width, i) => /* @__PURE__ */ jsx("col", { style: width != null ? { width } : void 0 }, i)) });
4160
+ const widths = useStore$1(
4161
+ store,
4162
+ useShallow(
4163
+ (state) => state.leafColumns && columnWidths(state.leafColumns, defaultColumnWidth)
4164
+ )
4165
+ );
4166
+ return widths && /* @__PURE__ */ jsx("colgroup", { children: widths.map((width, i) => /* @__PURE__ */ jsx("col", { style: width != null ? { width } : void 0 }, i)) });
3960
4167
  }
3961
4168
  const TableBody = forwardRef(
3962
4169
  function TableBody2({ className, ...otherProps }, forwardedRef) {
@@ -3972,42 +4179,89 @@ const TableBody = forwardRef(
3972
4179
  }
3973
4180
  );
3974
4181
  const TableCell = forwardRef(
3975
- function TableCell2({
3976
- header,
3977
- align,
3978
- variant,
3979
- status,
3980
- framed,
3981
- paddingless,
3982
- sticky,
3983
- className,
3984
- style,
3985
- ...otherProps
3986
- }, forwardedRef) {
4182
+ function TableCell2({ columnIndex, _stickyColumnIndex, ...otherProps }, forwardedRef) {
3987
4183
  const prefix = usePrefix();
3988
- const { cssVarStyle } = useCssVars();
4184
+ const { cssVarName, cssVarStyle } = useCssVars();
3989
4185
  const {
3990
4186
  status: tableStatus,
3991
4187
  editable: isTableEditable,
3992
4188
  store
3993
4189
  } = useTableContext();
3994
4190
  const isInTableHead = useIsInTableHead();
3995
- header ??= isInTableHead;
3996
- variant ??= header ? "header" : "data";
3997
- if (status === void 0) {
3998
- status = header ? tableStatus : void 0;
4191
+ const column = useStore$1(
4192
+ store,
4193
+ useShallow(
4194
+ (state) => columnIndex != null && state.leafColumns?.[columnIndex] || {}
4195
+ )
4196
+ );
4197
+ const {
4198
+ header = isInTableHead,
4199
+ align,
4200
+ variant = header ? "header" : "data",
4201
+ // Setting the status to `null` overrides the automatic inheritance of the
4202
+ // table status for header cells
4203
+ status = header ? tableStatus : void 0,
4204
+ framed = isTableEditable,
4205
+ paddingless = !header && isTableEditable,
4206
+ sticky,
4207
+ className,
4208
+ style,
4209
+ // `TableColumnObject` properties irrelevant to a `TableCell`
4210
+ subColumns: _subColumns,
4211
+ label: _label,
4212
+ labelText: _labelText,
4213
+ helperText: _helperText,
4214
+ helperButtonLabel: _helperButtonLabel,
4215
+ width: _width,
4216
+ fixed: _fixed,
4217
+ sortable: _sortable,
4218
+ defaultSortDirection: _defaultSortDirection,
4219
+ sorted: _sorted,
4220
+ onSort: _onSort,
4221
+ containerProps: _containerProps,
4222
+ labelProps: _labelProps,
4223
+ sortButtonProps: _sortButtonProps,
4224
+ sortIconContainerProps: _sortIconContainerProps,
4225
+ sortAscIconProps: _sortAscIconProps,
4226
+ sortDescIconProps: _sortDescIconProps,
4227
+ helperButtonProps: _helperButtonProps,
4228
+ helperPopoverProps: _helperPopoverProps,
4229
+ helperPopoverContentProps: _helperPopoverContentProps,
4230
+ ...otherMergedProps
4231
+ } = { ...column, ...otherProps };
4232
+ const { colSpan = 1 } = otherProps;
4233
+ if (columnIndex != null && _stickyColumnIndex == null && sticky) {
4234
+ _stickyColumnIndex = columnIndex + (sticky === "left" ? 0 : colSpan - 1);
3999
4235
  }
4000
- framed ??= isTableEditable;
4001
- paddingless ??= !header && isTableEditable;
4002
4236
  const cellRef = useRef(null);
4003
- useEffect(
4004
- () => store.subscribe(
4005
- ({ scrollPosition }) => sticky != null && scrollPosition != null && (sticky === "left" ? scrollPosition.left > 0 : scrollPosition.right > 0),
4006
- (isStuck) => setBoolDataAttr(cellRef.current, "stuck", isStuck),
4007
- { fireImmediately: true }
4008
- ),
4009
- [sticky, store]
4010
- );
4237
+ useEffect(() => {
4238
+ if (sticky) {
4239
+ return store.subscribe(
4240
+ ({ scrollPosition, stickyColumnOffsets: stickyColumnOffsets2 }) => {
4241
+ const isBorderSticky = _stickyColumnIndex != null && stickyColumnOffsets2()?.[_stickyColumnIndex + (sticky === "left" ? colSpan : -colSpan)] === void 0;
4242
+ return isBorderSticky && scrollPosition != null && (sticky === "left" ? scrollPosition.left > 0 : scrollPosition.right > 0);
4243
+ },
4244
+ (isStuck) => setBoolDataAttr(cellRef.current, "stuck", isStuck),
4245
+ { fireImmediately: true }
4246
+ );
4247
+ }
4248
+ }, [_stickyColumnIndex, colSpan, otherProps.colSpan, sticky, store]);
4249
+ useEffect(() => {
4250
+ if (_stickyColumnIndex != null && sticky) {
4251
+ return store.subscribe(
4252
+ ({ stickyColumnOffsets: stickyColumnOffsets2 }) => stickyColumnOffsets2()?.[_stickyColumnIndex],
4253
+ (offset) => {
4254
+ if (offset && cellRef.current) {
4255
+ cellRef.current.style.setProperty(
4256
+ cssVarName("table-cell-sticky-offset"),
4257
+ `${offset}px`
4258
+ );
4259
+ }
4260
+ },
4261
+ { fireImmediately: true }
4262
+ );
4263
+ }
4264
+ }, [_stickyColumnIndex, cssVarName, sticky, store]);
4011
4265
  const As = header ? "th" : "td";
4012
4266
  const combinedCellRef = useCombinedRef(cellRef, forwardedRef);
4013
4267
  return /* @__PURE__ */ jsx(TableCellContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
@@ -4023,15 +4277,12 @@ const TableCell = forwardRef(
4023
4277
  "data-paddingless": boolDataAttr(paddingless),
4024
4278
  "data-variant": variant,
4025
4279
  "data-sticky": sticky,
4026
- ...otherProps,
4280
+ ...otherMergedProps,
4027
4281
  ref: combinedCellRef
4028
4282
  }
4029
4283
  ) });
4030
4284
  }
4031
4285
  );
4032
- const TableColumn = forwardRef(function TableColumn2() {
4033
- return null;
4034
- });
4035
4286
  const TableFoot = forwardRef(
4036
4287
  function TableFoot2({ sticky = true, className, ...otherProps }, forwardedRef) {
4037
4288
  const prefix = usePrefix();
@@ -4087,7 +4338,7 @@ const PopoverContent = forwardRef(function PopoverContent2({
4087
4338
  container: portalContext?.container,
4088
4339
  ...portalProps,
4089
4340
  forceMount,
4090
- children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsxs(
4341
+ children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "popover", children: /* @__PURE__ */ jsxs(
4091
4342
  Popover$1.Content,
4092
4343
  {
4093
4344
  className: cx(prefix("popover"), className),
@@ -4104,12 +4355,15 @@ const PopoverContent = forwardRef(function PopoverContent2({
4104
4355
  width: 12,
4105
4356
  height: 6,
4106
4357
  ...arrowProps,
4107
- className: cx(prefix("popover__arrow"), arrowProps?.className)
4358
+ className: cx(
4359
+ prefix("popover__arrow"),
4360
+ arrowProps?.className
4361
+ )
4108
4362
  }
4109
4363
  )
4110
4364
  ]
4111
4365
  }
4112
- ) })
4366
+ ) }) })
4113
4367
  }
4114
4368
  ) });
4115
4369
  });
@@ -4187,8 +4441,26 @@ const Stack = forwardRef(function Stack2({
4187
4441
  });
4188
4442
  const DEFAULT_TABLE_ROW_HEIGHT = 41;
4189
4443
  const TableRow = forwardRef(
4190
- function TableRow2({ className, selected, ...otherProps }, forwardedRef) {
4444
+ function TableRow2({ className, selected, children, ...otherProps }, forwardedRef) {
4191
4445
  const prefix = usePrefix();
4446
+ let nextIdx = 0;
4447
+ const indexedChildren = Children.toArray(children).map((child) => {
4448
+ if (!isValidElement(child) || child.type !== TableCell) {
4449
+ return child;
4450
+ }
4451
+ const tableCellProps = child.props;
4452
+ const { columnIndex, colSpan, ...otherTableCellProps } = tableCellProps;
4453
+ if (columnIndex !== void 0) {
4454
+ nextIdx = (columnIndex ?? nextIdx) + (colSpan ?? 1);
4455
+ return child;
4456
+ }
4457
+ const cellIdx = nextIdx;
4458
+ nextIdx += colSpan ?? 1;
4459
+ return cloneElement(
4460
+ child,
4461
+ { columnIndex: cellIdx, colSpan, ...otherTableCellProps }
4462
+ );
4463
+ });
4192
4464
  return /* @__PURE__ */ jsx(
4193
4465
  "tr",
4194
4466
  {
@@ -4196,7 +4468,8 @@ const TableRow = forwardRef(
4196
4468
  "data-selected": boolDataAttr(selected),
4197
4469
  "aria-selected": selected || void 0,
4198
4470
  ...otherProps,
4199
- ref: forwardedRef
4471
+ ref: forwardedRef,
4472
+ children: indexedChildren
4200
4473
  }
4201
4474
  );
4202
4475
  }
@@ -4213,14 +4486,7 @@ const TableHead = forwardRef(
4213
4486
  const prefix = usePrefix();
4214
4487
  const [locale7] = useLocale();
4215
4488
  sortByColumnDescription ??= locale7.TableHead.sortByColumnDescription;
4216
- const {
4217
- status: tableStatus,
4218
- layout,
4219
- defaultColumnWidth,
4220
- onTableMinWidthChange,
4221
- onTableMaxWidthChange,
4222
- store
4223
- } = useTableContext();
4489
+ const { status: tableStatus, layout, store } = useTableContext();
4224
4490
  const columns = useMemo(() => columnsFromChildren(children), [children]);
4225
4491
  const nRows = useMemo(() => numberOfRows$1(columns), [columns]);
4226
4492
  const rows = useMemo(
@@ -4229,6 +4495,12 @@ const TableHead = forwardRef(
4229
4495
  );
4230
4496
  const { printHidden } = usePrintClassNames();
4231
4497
  const generatedId = useId();
4498
+ const { leaves, leafIndices } = useMemo(() => {
4499
+ const leaves2 = leafColumns$1(columns);
4500
+ const leafIndices2 = new Map(leaves2.map((l, i) => [l, i]));
4501
+ return { leaves: leaves2, leafIndices: leafIndices2 };
4502
+ }, [columns]);
4503
+ useEffect(() => store.setState({ leafColumns: leaves }), [leaves, store]);
4232
4504
  const tableHeadRef = useRef(null);
4233
4505
  useEffect(
4234
4506
  () => store.subscribe(
@@ -4238,25 +4510,6 @@ const TableHead = forwardRef(
4238
4510
  ),
4239
4511
  [sticky, store]
4240
4512
  );
4241
- useEffect(() => {
4242
- const leaves = leafColumns$1(columns);
4243
- store.setState({ numberOfColumns: leaves.length });
4244
- if (layout === "fixed") {
4245
- store.setState({
4246
- columnWidths: columnWidths(leaves, defaultColumnWidth)
4247
- });
4248
- onTableMinWidthChange(tableMinWidth(leaves, defaultColumnWidth));
4249
- onTableMaxWidthChange(tableMaxWidth(leaves, defaultColumnWidth));
4250
- return () => store.setState({ columnWidths: void 0 });
4251
- }
4252
- }, [
4253
- columns,
4254
- defaultColumnWidth,
4255
- layout,
4256
- onTableMaxWidthChange,
4257
- onTableMinWidthChange,
4258
- store
4259
- ]);
4260
4513
  const leftMost = useMemo(() => leftMostColumns(columns), [columns]);
4261
4514
  const rightMost = useMemo(() => rightMostColumns(columns), [columns]);
4262
4515
  const combinedTableHeadRef = useCombinedRef(tableHeadRef, forwardedRef);
@@ -4274,14 +4527,16 @@ const TableHead = forwardRef(
4274
4527
  ...typeof rowProps === "function" ? rowProps(i) : rowProps,
4275
4528
  children: row.map((column, j) => {
4276
4529
  const {
4530
+ subColumns,
4277
4531
  label,
4278
4532
  labelText = typeof label === "string" ? label : "",
4279
4533
  helperText,
4280
4534
  helperButtonLabel = locale7.TableColumn.helperButtonLabel,
4281
4535
  width,
4282
4536
  fixed: _fixed,
4283
- header = true,
4537
+ header: _header,
4284
4538
  align,
4539
+ sticky: sticky2,
4285
4540
  sortable,
4286
4541
  defaultSortDirection = "asc",
4287
4542
  sorted,
@@ -4298,8 +4553,17 @@ const TableHead = forwardRef(
4298
4553
  style,
4299
4554
  ...otherColumnProps
4300
4555
  } = column;
4556
+ const rowSpan = numberOfRows$1([column]) > 1 ? 1 : nRows - i;
4557
+ const colSpan = numberOfColumns([column]);
4558
+ const isLeaf = subColumns.length === 0;
4559
+ const leafIndex = isLeaf ? leafIndices.get(column) : -1;
4560
+ const stickyColumnIndex = sticky2 ? isLeaf ? leafIndex : leafIndices.get(
4561
+ sticky2 === "left" ? leftMostLeafColumn(column) : rightMostLeafColumn(column)
4562
+ ) : -1;
4301
4563
  const newSortDirection = !sorted ? defaultSortDirection : sorted === defaultSortDirection ? sorted === "asc" ? "desc" : "asc" : null;
4302
- const sortDescriptionId = sortable ? prefix(`table-column-${j}-sort-description-${generatedId}`) : void 0;
4564
+ const sortDescriptionId = isLeaf && sortable ? prefix(
4565
+ `table-column-${leafIndex}-sort-description-${generatedId}`
4566
+ ) : void 0;
4303
4567
  const helperTextEl = helperText && /* @__PURE__ */ jsxs(Popover, { modal: false, ...helperPopoverProps, children: [
4304
4568
  /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
4305
4569
  IconButton,
@@ -4330,14 +4594,15 @@ const TableHead = forwardRef(
4330
4594
  }
4331
4595
  )
4332
4596
  ] });
4333
- const rowSpan = numberOfRows$1([column]) > 1 ? 1 : nRows - i;
4334
- const colSpan = numberOfColumns([column]);
4335
4597
  return /* @__PURE__ */ jsx(
4336
4598
  TableCell,
4337
4599
  {
4338
- header,
4339
- scope: header ? column.children.length > 0 ? "colgroup" : "col" : void 0,
4600
+ columnIndex: null,
4601
+ _stickyColumnIndex: stickyColumnIndex === -1 ? null : stickyColumnIndex,
4602
+ header: true,
4603
+ scope: isLeaf ? "col" : "colgroup",
4340
4604
  align,
4605
+ sticky: sticky2,
4341
4606
  rowSpan: rowSpan === 1 ? void 0 : rowSpan,
4342
4607
  colSpan: colSpan === 1 ? void 0 : colSpan,
4343
4608
  style: {
@@ -4361,7 +4626,7 @@ const TableHead = forwardRef(
4361
4626
  gap: 1.5,
4362
4627
  ...containerProps,
4363
4628
  children: [
4364
- !sortable && label && /* @__PURE__ */ jsx(
4629
+ (!isLeaf || !sortable) && label && /* @__PURE__ */ jsx(
4365
4630
  "div",
4366
4631
  {
4367
4632
  "data-align": align,
@@ -4373,7 +4638,7 @@ const TableHead = forwardRef(
4373
4638
  children: label
4374
4639
  }
4375
4640
  ),
4376
- sortable && /* @__PURE__ */ jsxs(
4641
+ isLeaf && sortable && /* @__PURE__ */ jsxs(
4377
4642
  Button,
4378
4643
  {
4379
4644
  variant: "ghost",
@@ -4467,87 +4732,36 @@ const TableHead = forwardRef(
4467
4732
  ) });
4468
4733
  }
4469
4734
  );
4470
- function columnsFromChildren(children) {
4471
- return Children.toArray(children).filter(
4472
- (child) => isValidElement(child) && child.type === TableColumn
4473
- ).map((child) => ({
4474
- ...child.props,
4475
- children: columnsFromChildren(child.props.children ?? null)
4476
- }));
4477
- }
4478
- function numberOfRows$1(columns) {
4479
- return columns.reduce(
4480
- (n, column) => Math.max(n, numberOfRows$1(column.children) + 1),
4481
- 0
4482
- );
4483
- }
4484
- function numberOfColumns(columns) {
4485
- return columns.reduce(
4486
- (n, column) => n + (column.children.length === 0 ? 1 : numberOfColumns(column.children)),
4487
- 0
4735
+ function leafColumns(columns) {
4736
+ return Object.entries(columns).reduce(
4737
+ (leaves, [columnName, column]) => {
4738
+ if (column.subColumns) {
4739
+ Object.assign(leaves, leafColumns(column.subColumns));
4740
+ } else {
4741
+ leaves[columnName] = column;
4742
+ }
4743
+ return leaves;
4744
+ },
4745
+ {}
4488
4746
  );
4489
4747
  }
4490
- function columnsOfRow(columns, index) {
4491
- return index === 0 ? columns : columns.reduce((rowColumns, column) => {
4492
- rowColumns.push(...columnsOfRow(column.children, index - 1));
4493
- return rowColumns;
4494
- }, []);
4495
- }
4496
- function leafColumns$1(columns) {
4497
- return columns.reduce((leaves, column) => {
4498
- leaves.push(
4499
- ...column.children.length === 0 ? [column] : leafColumns$1(column.children)
4500
- );
4501
- return leaves;
4502
- }, []);
4503
- }
4504
- function tableMinWidth(leaves, defaultColumnWidth) {
4505
- return leaves.reduce(
4506
- (sum, column) => sum + columnWidth(column, defaultColumnWidth),
4507
- 0
4508
- ) + "px";
4509
- }
4510
- function tableMaxWidth(leaves, defaultColumnWidth) {
4511
- return leaves.every((column) => column.fixed) ? tableMinWidth(leaves, defaultColumnWidth) : void 0;
4512
- }
4513
- function columnWidths(leaves, defaultColumnWidth) {
4514
- const dynamicWidthsSum = leaves.reduce(
4515
- (sum, column) => sum + (column.fixed ? 0 : columnWidth(column, defaultColumnWidth)),
4748
+ function numberOfRows(columns) {
4749
+ return Object.values(columns).reduce(
4750
+ (n, column) => Math.max(n, numberOfRows(column.subColumns ?? {}) + 1),
4516
4751
  0
4517
4752
  );
4518
- return leaves.reduce((widths, column) => {
4519
- const colSpan = column.colSpan ?? 1;
4520
- const colWidths = Array.isArray(column.width) ? column.width : (
4521
- // Distribute the width amongst the columns being spanned
4522
- [...Array(colSpan)].map(
4523
- () => columnWidth(column, defaultColumnWidth) / colSpan
4524
- )
4525
- );
4526
- for (let i = 0; i < colSpan; ++i) {
4527
- const colWidth = colWidths[i] ?? 0;
4528
- widths.push(
4529
- column.fixed ? `${colWidth}px` : `${colWidth / dynamicWidthsSum * 100}%`
4530
- );
4531
- }
4532
- return widths;
4533
- }, []);
4534
4753
  }
4535
- function columnWidth(column, defaultColumnsMinWidth) {
4536
- return Array.isArray(column.width) ? column.width.reduce((sum, width) => sum + width, 0) : column.width ?? defaultColumnsMinWidth * (column.colSpan ?? 1);
4537
- }
4538
- function leftMostColumns(columns) {
4539
- if (columns.length === 0) {
4540
- return [];
4754
+ function sanitizeInt(value) {
4755
+ if (typeof value === "string") {
4756
+ value = +value;
4541
4757
  }
4542
- const firstColumn = columns[0];
4543
- return [firstColumn, ...leftMostColumns(firstColumn.children)];
4758
+ return value === void 0 || Number.isNaN(value) ? void 0 : Math.trunc(value);
4544
4759
  }
4545
- function rightMostColumns(columns) {
4546
- if (columns.length === 0) {
4547
- return [];
4548
- }
4549
- const lastColumn = columns[columns.length - 1];
4550
- return [lastColumn, ...rightMostColumns(lastColumn.children)];
4760
+ function sanitizeSortBy(sortBy, leaves) {
4761
+ return sortBy == null || sortBy in leaves ? sortBy : null;
4762
+ }
4763
+ function sanitizeSortDirection(sortDirection) {
4764
+ return sortDirection === void 0 || sortDirection === "asc" || sortDirection === "desc" ? sortDirection : void 0;
4551
4765
  }
4552
4766
  const DEFAULT_OFFSET = 0;
4553
4767
  const DEFAULT_LIMIT = 10;
@@ -4596,10 +4810,10 @@ const DataTable = forwardRef(
4596
4810
  const printing = usePrinting();
4597
4811
  const leaves = useMemo(() => leafColumns(columns), [columns]);
4598
4812
  const headCount = useMemo(() => numberOfRows(columns), [columns]);
4599
- defaultOffset = sanitizeNumeric(defaultOffset) ?? DEFAULT_OFFSET;
4600
- offset = sanitizeNumeric(offset);
4601
- defaultLimit = sanitizeNumeric(defaultLimit) ?? DEFAULT_LIMIT;
4602
- limit = sanitizeNumeric(limit);
4813
+ defaultOffset = sanitizeInt(defaultOffset) ?? DEFAULT_OFFSET;
4814
+ offset = sanitizeInt(offset);
4815
+ defaultLimit = sanitizeInt(defaultLimit) ?? DEFAULT_LIMIT;
4816
+ limit = sanitizeInt(limit);
4603
4817
  defaultSortBy = sanitizeSortBy(defaultSortBy, leaves) ?? null;
4604
4818
  sortBy = sanitizeSortBy(sortBy, leaves);
4605
4819
  defaultSortDirection = sanitizeSortDirection(defaultSortDirection);
@@ -4654,37 +4868,6 @@ const DataTable = forwardRef(
4654
4868
  ) });
4655
4869
  }
4656
4870
  );
4657
- function leafColumns(columns) {
4658
- return Object.entries(columns).reduce(
4659
- (leaves, [columnName, column]) => {
4660
- if (column.subColumns) {
4661
- Object.assign(leaves, leafColumns(column.subColumns));
4662
- } else {
4663
- leaves[columnName] = column;
4664
- }
4665
- return leaves;
4666
- },
4667
- {}
4668
- );
4669
- }
4670
- function numberOfRows(columns) {
4671
- return Object.values(columns).reduce(
4672
- (n, column) => Math.max(n, numberOfRows(column.subColumns ?? {}) + 1),
4673
- 0
4674
- );
4675
- }
4676
- function sanitizeNumeric(value) {
4677
- if (typeof value === "string") {
4678
- value = +value;
4679
- }
4680
- return value === void 0 || Number.isNaN(value) ? void 0 : Math.trunc(value);
4681
- }
4682
- function sanitizeSortBy(sortBy, leaves) {
4683
- return sortBy == null || sortBy in leaves ? sortBy : null;
4684
- }
4685
- function sanitizeSortDirection(sortDirection) {
4686
- return sortDirection === void 0 || sortDirection === "asc" || sortDirection === "desc" ? sortDirection : void 0;
4687
- }
4688
4871
  function useDataTableApiRef() {
4689
4872
  return useRef(null);
4690
4873
  }
@@ -5408,6 +5591,7 @@ const DataTableRow = memo(
5408
5591
  format: format2,
5409
5592
  render,
5410
5593
  compare: _compare,
5594
+ footer: _footer,
5411
5595
  label,
5412
5596
  labelText: _labelText,
5413
5597
  helperText: _helperText,
@@ -5418,6 +5602,7 @@ const DataTableRow = memo(
5418
5602
  defaultSortDirection: _defaultSortDirection,
5419
5603
  containerProps: _containerProps,
5420
5604
  labelProps,
5605
+ footerProps: _footerProps,
5421
5606
  sortButtonProps: _sortButtonProps,
5422
5607
  sortIconContainerProps: _sortIconContainerProps,
5423
5608
  sortAscIconProps: _sortAscIconProps,
@@ -5427,7 +5612,7 @@ const DataTableRow = memo(
5427
5612
  helperPopoverContentProps: _helperPopoverContentProps,
5428
5613
  ...otherProps2
5429
5614
  }
5430
- ]) => {
5615
+ ], i) => {
5431
5616
  const loadingRow = row === void 0;
5432
5617
  const value = !loadingRow && (getValue ? getValue({ row, index }) : row?.[columnName] ?? null);
5433
5618
  const formattedValue = !loadingRow && (format2 ? format2({ value, row, index }) : value?.toString() ?? "");
@@ -5459,7 +5644,7 @@ const DataTableRow = memo(
5459
5644
  index
5460
5645
  }) : markedValue
5461
5646
  };
5462
- return renderCell ? /* @__PURE__ */ jsx(Fragment$1, { children: renderCell(props) }, columnName) : /* @__PURE__ */ jsx(DataTableCell, { ...props }, columnName);
5647
+ return renderCell ? /* @__PURE__ */ jsx(Fragment$1, { children: renderCell({ columnIndex: i, ...props }) }, columnName) : /* @__PURE__ */ jsx(DataTableCell, { columnIndex: i, ...props }, columnName);
5463
5648
  }
5464
5649
  )
5465
5650
  }
@@ -5539,7 +5724,7 @@ function PagedDataTableRows() {
5539
5724
  ]);
5540
5725
  useEffect(
5541
5726
  () => store.subscribe(
5542
- (state) => state.updateCounter,
5727
+ ({ updateCounter }) => updateCounter,
5543
5728
  () => {
5544
5729
  const { pageOffset: pageOffset2, pageLimit, limit, actions } = store.getState();
5545
5730
  actions.updateWindow(pageOffset2(), pageLimit() ?? limit());
@@ -5622,7 +5807,7 @@ function ScrolledDataTableRows({
5622
5807
  );
5623
5808
  useEffect(
5624
5809
  () => store.subscribe(
5625
- (state) => state.updateCounter,
5810
+ ({ updateCounter }) => updateCounter,
5626
5811
  () => update(virtualizer.getVirtualItems())
5627
5812
  ),
5628
5813
  [store, update, virtualizer]
@@ -5679,7 +5864,7 @@ function ScrolledDataTableRows({
5679
5864
  );
5680
5865
  useEffect(
5681
5866
  () => store.subscribe(
5682
- (state) => state.offset(),
5867
+ ({ offset }) => offset(),
5683
5868
  (offset) => !virtualizer.isScrolling && goTo(offset)
5684
5869
  ),
5685
5870
  [goTo, store, virtualizer]
@@ -5767,7 +5952,7 @@ function useMeasure(element, setMeasurement) {
5767
5952
  };
5768
5953
  }, [element, setMeasurement]);
5769
5954
  }
5770
- const DataTableFoot = forwardRef(function DataTableFoot2({ showWhenEmpty, ...otherProps }, forwardedRef) {
5955
+ const DataTableFoot = forwardRef(function DataTableFoot2({ footContent, showWhenEmpty, ...otherProps }, forwardedRef) {
5771
5956
  const { store } = useDataTableContext();
5772
5957
  const shouldShow = useStore$1(
5773
5958
  store,
@@ -5781,8 +5966,63 @@ const DataTableFoot = forwardRef(function DataTableFoot2({ showWhenEmpty, ...oth
5781
5966
  [store]
5782
5967
  )
5783
5968
  );
5969
+ const selectionColumn = useDataTableSelectionColumn();
5970
+ const dataTableSelectionColumnId = useDataTableSelectionColumnId();
5971
+ const leafColumns2 = useStore$1(
5972
+ store,
5973
+ useShallow(
5974
+ ({ leafColumns: leafColumns22 }) => selectionColumn ? { [dataTableSelectionColumnId]: selectionColumn, ...leafColumns22 } : leafColumns22
5975
+ )
5976
+ );
5977
+ const hasFooterCells = useStore$1(
5978
+ store,
5979
+ ({ hasFooterCells: hasFooterCells2 }) => hasFooterCells2()
5980
+ );
5981
+ const footRowIndex = useStore$1(
5982
+ store,
5983
+ ({ headCount, bodyCount }) => hasFooterCells ? headCount + bodyCount() + 1 : void 0
5984
+ );
5985
+ const rows = useStore$1(
5986
+ store,
5987
+ ({ transformedRows }) => transformedRows()
5988
+ );
5784
5989
  const combinedTableFootRef = useCombinedRef(setTableFootEl, forwardedRef);
5785
- return shouldShow && /* @__PURE__ */ jsx(TableFoot, { ...otherProps, ref: combinedTableFootRef });
5990
+ return shouldShow && (hasFooterCells || footContent) && /* @__PURE__ */ jsxs(TableFoot, { ...otherProps, ref: combinedTableFootRef, children: [
5991
+ hasFooterCells && /* @__PURE__ */ jsx(TableRow, { "aria-rowindex": footRowIndex, children: Object.entries(leafColumns2).map(
5992
+ ([
5993
+ columnName,
5994
+ {
5995
+ filterable: _filterable,
5996
+ locale: _locale,
5997
+ subColumns: _subColumns,
5998
+ getValue: _getValue,
5999
+ format: _format,
6000
+ render: _render,
6001
+ compare: _compare,
6002
+ footer,
6003
+ label: _label,
6004
+ labelText: _labelText,
6005
+ helperText: _helperText,
6006
+ helperButtonLabel: _helperButtonLabel,
6007
+ width: _width,
6008
+ fixed: _fixed,
6009
+ sortable: _sortable,
6010
+ defaultSortDirection: _defaultSortDirection,
6011
+ containerProps: _containerProps,
6012
+ labelProps: _labelProps,
6013
+ sortButtonProps: _sortButtonProps,
6014
+ sortIconContainerProps: _sortIconContainerProps,
6015
+ sortAscIconProps: _sortAscIconProps,
6016
+ sortDescIconProps: _sortDescIconProps,
6017
+ helperButtonProps: _helperButtonProps,
6018
+ helperPopoverProps: _helperPopoverProps,
6019
+ helperPopoverContentProps: _helperPopoverContentProps,
6020
+ ...otherProps2
6021
+ }
6022
+ ]) => /* @__PURE__ */ jsx(TableCell, { ...otherProps2, children: typeof footer === "function" ? footer({ rows }) : footer }, columnName)
6023
+ ) }),
6024
+ footContent
6025
+ ] });
5786
6026
  });
5787
6027
  const DataTableHead = forwardRef(function DataTableHead2({ rowProps, ...otherProps }, forwardedRef) {
5788
6028
  const { generatedId, store } = useDataTableContext();
@@ -5846,6 +6086,8 @@ function renderDataTableColumns(columns, generatedId, sortingProps) {
5846
6086
  format: _format,
5847
6087
  render: _render,
5848
6088
  compare: _compare,
6089
+ footer: _footer,
6090
+ footerProps: _footerProps,
5849
6091
  labelProps,
5850
6092
  ...column
5851
6093
  }
@@ -5874,8 +6116,8 @@ const DataTableContent = forwardRef(function DataTable2({
5874
6116
  scrollableProps,
5875
6117
  tableHeadProps,
5876
6118
  tableBodyProps,
5877
- emptyMessageProps,
5878
6119
  tableFootProps,
6120
+ emptyMessageProps,
5879
6121
  className,
5880
6122
  ...otherProps
5881
6123
  }, forwardedRef) {
@@ -5895,7 +6137,7 @@ const DataTableContent = forwardRef(function DataTable2({
5895
6137
  const stickyHeadFoot = maxHeight !== void 0;
5896
6138
  useEffect(
5897
6139
  () => store.subscribe(
5898
- (state) => state.headCount + state.bodyCount(),
6140
+ (state) => state.headCount + state.bodyCount() + state.footCount(),
5899
6141
  (totalCount) => {
5900
6142
  tableRef.current.ariaRowCount = totalCount.toString();
5901
6143
  },
@@ -5936,13 +6178,13 @@ const DataTableContent = forwardRef(function DataTable2({
5936
6178
  ...tableBodyProps
5937
6179
  }
5938
6180
  ),
5939
- tableFootContent && /* @__PURE__ */ jsx(
6181
+ /* @__PURE__ */ jsx(
5940
6182
  DataTableFoot,
5941
6183
  {
5942
6184
  sticky: stickyHeadFoot,
5943
6185
  showWhenEmpty: showTableFootWhenEmpty,
5944
- ...tableFootProps,
5945
- children: tableFootContent
6186
+ footContent: tableFootContent,
6187
+ ...tableFootProps
5946
6188
  }
5947
6189
  )
5948
6190
  ]
@@ -7802,7 +8044,7 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
7802
8044
  container: portalContext?.container,
7803
8045
  ...portalProps,
7804
8046
  forceMount,
7805
- children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
8047
+ children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dialog", reset: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
7806
8048
  Overlay,
7807
8049
  {
7808
8050
  ...overlayProps,
@@ -7830,7 +8072,7 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
7830
8072
  }
7831
8073
  )
7832
8074
  }
7833
- ) }) })
8075
+ ) }) }) })
7834
8076
  }
7835
8077
  ) })
7836
8078
  }
@@ -8761,12 +9003,12 @@ const CalendarHeader = memo(function CalendarHeader2({
8761
9003
  months[0].date,
8762
9004
  pagedNavigation ? -months.length : -1
8763
9005
  );
8764
- const allowsPrevMonth = minAllowedDate == null || isAfter(prevMonth, minAllowedDate);
9006
+ const allowsPrevMonth = minAllowedDate == null || !isBefore(prevMonth, startOfMonth(minAllowedDate));
8765
9007
  const nextMonth = addMonths(
8766
9008
  months[0].date,
8767
9009
  pagedNavigation ? months.length : 1
8768
9010
  );
8769
- const allowsNextMonth = maxAllowedDate == null || isBefore(nextMonth, maxAllowedDate);
9011
+ const allowsNextMonth = maxAllowedDate == null || !isAfter(nextMonth, startOfMonth(maxAllowedDate));
8770
9012
  const handlePrevClick = useCallback(() => {
8771
9013
  if (allowsPrevMonth) {
8772
9014
  goToMonth(prevMonth);
@@ -8787,11 +9029,11 @@ const CalendarHeader = memo(function CalendarHeader2({
8787
9029
  }
8788
9030
  return months2;
8789
9031
  }, []);
8790
- const displayYear = getYear(displayDate);
8791
- const curYear = getYear(/* @__PURE__ */ new Date());
9032
+ const displayYear = displayDate.getFullYear();
9033
+ const curYear = (/* @__PURE__ */ new Date()).getFullYear();
8792
9034
  const nearestCentury = curYear + 50 - (curYear + 50) % 100;
8793
- const minYear = minAllowedDate ? getYear(minAllowedDate) : Math.min(displayYear, nearestCentury - 100);
8794
- const maxYear = maxAllowedDate ? getYear(maxAllowedDate) : Math.max(displayYear, nearestCentury + 99);
9035
+ const minYear = minAllowedDate ? minAllowedDate.getFullYear() : Math.min(displayYear, nearestCentury - 100);
9036
+ const maxYear = maxAllowedDate ? maxAllowedDate.getFullYear() : Math.max(displayYear, nearestCentury + 99);
8795
9037
  const yearDates = useMemo(() => {
8796
9038
  const years = [];
8797
9039
  if (displayYear < minYear) {
@@ -8873,23 +9115,25 @@ const CalendarHeader = memo(function CalendarHeader2({
8873
9115
  })
8874
9116
  }
8875
9117
  );
8876
- const monthOptions = useMemo(
8877
- () => monthDates.map((monthDate) => {
9118
+ const monthOptions = useMemo(() => {
9119
+ const minMonth = minAllowedDate?.getMonth();
9120
+ const maxMonth = maxAllowedDate?.getMonth();
9121
+ return monthDates.map((monthDate) => {
9122
+ const month = monthDate.getMonth();
8878
9123
  return /* @__PURE__ */ jsx(
8879
9124
  Option,
8880
9125
  {
8881
- value: getMonth(monthDate),
8882
- disabled: minAllowedDate && maxAllowedDate && isSameYear(minAllowedDate, maxAllowedDate) && (getMonth(monthDate) < getMonth(minAllowedDate) || getMonth(monthDate) > getMonth(maxAllowedDate)),
9126
+ value: month,
9127
+ disabled: minAllowedDate && minAllowedDate.getFullYear() === maxAllowedDate?.getFullYear() && (month < minMonth || month > maxMonth),
8883
9128
  children: format(monthDate, MONTH_FORMAT, { locale: locale7 })
8884
9129
  },
8885
- getMonth(monthDate)
9130
+ month
8886
9131
  );
8887
- }),
8888
- [locale7, maxAllowedDate, minAllowedDate, monthDates]
8889
- );
9132
+ });
9133
+ }, [locale7, maxAllowedDate, minAllowedDate, monthDates]);
8890
9134
  const yearOptions = useMemo(
8891
9135
  () => yearDates.map((yearDate) => {
8892
- const year = getYear(yearDate);
9136
+ const year = yearDate.getFullYear();
8893
9137
  return /* @__PURE__ */ jsx(
8894
9138
  Option,
8895
9139
  {
@@ -8927,7 +9171,7 @@ const CalendarHeader = memo(function CalendarHeader2({
8927
9171
  monthSelectProps?.onValueChange,
8928
9172
  handleMonthChange
8929
9173
  ),
8930
- value: getMonth(displayDate),
9174
+ value: displayDate.getMonth(),
8931
9175
  children: monthOptions
8932
9176
  }
8933
9177
  ),
@@ -8945,7 +9189,7 @@ const CalendarHeader = memo(function CalendarHeader2({
8945
9189
  yearSelectProps?.onValueChange,
8946
9190
  handleYearChange
8947
9191
  ),
8948
- value: getYear(displayDate),
9192
+ value: displayDate.getFullYear(),
8949
9193
  children: yearOptions
8950
9194
  }
8951
9195
  )
@@ -11052,15 +11296,15 @@ const DropdownMenuContent = forwardRef(function DropdownMenuContent2({
11052
11296
  container: portalContext?.container,
11053
11297
  ...portalProps,
11054
11298
  forceMount,
11055
- children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(
11299
+ children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dropdown", children: /* @__PURE__ */ jsx(
11056
11300
  DropdownMenu$1.Content,
11057
11301
  {
11058
11302
  className: cx(prefix("dropdown-menu"), className),
11059
11303
  sideOffset,
11060
11304
  collisionPadding,
11061
11305
  forceMount,
11062
- ref: forwardedRef,
11063
11306
  ...otherProps,
11307
+ ref: forwardedRef,
11064
11308
  children: /* @__PURE__ */ jsx(
11065
11309
  MenuList,
11066
11310
  {
@@ -11086,7 +11330,7 @@ const DropdownMenuContent = forwardRef(function DropdownMenuContent2({
11086
11330
  }
11087
11331
  )
11088
11332
  }
11089
- ) })
11333
+ ) }) })
11090
11334
  }
11091
11335
  ) });
11092
11336
  });
@@ -12848,17 +13092,18 @@ const StepList = forwardRef(
12848
13092
  const prefix = usePrefix();
12849
13093
  const { showAllStepsWhilePrinting } = useStepperContext();
12850
13094
  const { printHidden } = usePrintClassNames();
12851
- let currentIndex = 0;
13095
+ let nextIdx = 0;
12852
13096
  const indexedChildren = Children.toArray(children).map((child) => {
12853
13097
  if (!isValidElement(child) || child.type !== Step) {
12854
13098
  return child;
12855
13099
  }
12856
13100
  const { index, ...otherStepProps } = child.props;
12857
- if (index) {
12858
- currentIndex = index;
13101
+ if (index != null) {
13102
+ nextIdx = index + 1;
13103
+ return child;
12859
13104
  }
12860
13105
  return cloneElement(child, {
12861
- index: currentIndex++,
13106
+ index: nextIdx++,
12862
13107
  ...otherStepProps
12863
13108
  });
12864
13109
  });
@@ -12910,17 +13155,18 @@ const Stepper = forwardRef(
12910
13155
  )
12911
13156
  );
12912
13157
  useImperativeHandle(apiRef, () => api, [api]);
12913
- let currentIndex = 0;
13158
+ let nextIdx = 0;
12914
13159
  const indexedChildren = Children.toArray(children).map((child) => {
12915
13160
  if (!isValidElement(child) || child.type !== StepContent) {
12916
13161
  return child;
12917
13162
  }
12918
13163
  const { index, ...otherStepContentProps } = child.props;
12919
- if (index) {
12920
- currentIndex = index;
13164
+ if (index != null) {
13165
+ nextIdx = index + 1;
13166
+ return child;
12921
13167
  }
12922
13168
  return cloneElement(child, {
12923
- index: currentIndex++,
13169
+ index: nextIdx++,
12924
13170
  ...otherStepContentProps
12925
13171
  });
12926
13172
  });
@@ -13314,7 +13560,7 @@ const TabList = forwardRef(function TabList2({
13314
13560
  );
13315
13561
  useEffect(
13316
13562
  () => store.subscribe(
13317
- (state) => state.width,
13563
+ ({ width }) => width,
13318
13564
  (width) => {
13319
13565
  store.setState({
13320
13566
  showScrollButtons: (containerEl?.scrollWidth ?? 0) > Math.ceil(width)
@@ -13752,6 +13998,7 @@ export {
13752
13998
  Keybinds,
13753
13999
  Keyboard,
13754
14000
  Label,
14001
+ Layer,
13755
14002
  Link,
13756
14003
  LocalizationContext,
13757
14004
  LocalizationProvider,
@@ -13878,6 +14125,7 @@ export {
13878
14125
  useIsInTableCell,
13879
14126
  useKeyboardShortcut,
13880
14127
  useLatestValues,
14128
+ useLayerZIndex,
13881
14129
  useLayoutEffect$1 as useLayoutEffect,
13882
14130
  useLocale,
13883
14131
  useLocation,