@rio-cloud/rio-uikit 2.3.0-beta.3 → 2.3.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 (83) hide show
  1. package/Table.js +10 -9
  2. package/TableNext.js +10 -9
  3. package/TableRowActionsDropdown.d.ts +2 -0
  4. package/TableRowActionsDropdown.js +5 -0
  5. package/TableRowActionsDropdown.js.map +1 -0
  6. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  7. package/components/dropdown/ButtonDropdown.js +82 -80
  8. package/components/dropdown/ButtonDropdown.js.map +1 -1
  9. package/components/map/components/Map.js +199 -180
  10. package/components/map/components/Map.js.map +1 -1
  11. package/components/map/components/MapContext.d.ts +2 -0
  12. package/components/map/components/MapContext.js +6 -4
  13. package/components/map/components/MapContext.js.map +1 -1
  14. package/components/map/components/features/MapZoom.js +19 -19
  15. package/components/map/components/features/MapZoom.js.map +1 -1
  16. package/components/map/utils/mapTypes.d.ts +6 -0
  17. package/components/map/utils/mapTypes.js.map +1 -1
  18. package/components/map/utils/mapUtils.d.ts +2 -0
  19. package/components/map/utils/mapUtils.js +4 -0
  20. package/components/map/utils/mapUtils.js.map +1 -1
  21. package/components/table/Table.d.ts +3 -1
  22. package/components/table/Table.js +225 -205
  23. package/components/table/Table.js.map +1 -1
  24. package/components/table/Table.types.d.ts +49 -0
  25. package/components/table/TableExpandedRow.d.ts +4 -0
  26. package/components/table/TableExpandedRow.js +69 -66
  27. package/components/table/TableExpandedRow.js.map +1 -1
  28. package/components/table/TableGroupRow.d.ts +3 -1
  29. package/components/table/TableGroupRow.js +15 -14
  30. package/components/table/TableGroupRow.js.map +1 -1
  31. package/components/table/TableHeader.d.ts +1 -9
  32. package/components/table/TableHeader.js +83 -67
  33. package/components/table/TableHeader.js.map +1 -1
  34. package/components/table/TableRow.d.ts +7 -1
  35. package/components/table/TableRow.js +75 -72
  36. package/components/table/TableRow.js.map +1 -1
  37. package/components/table/TableRowActionsDropdown.d.ts +11 -0
  38. package/components/table/TableRowActionsDropdown.js +22 -0
  39. package/components/table/TableRowActionsDropdown.js.map +1 -0
  40. package/components/table/TableStickyRowButton.d.ts +25 -0
  41. package/components/table/TableStickyRowButton.js +32 -0
  42. package/components/table/TableStickyRowButton.js.map +1 -0
  43. package/components/table/TableToolbar.d.ts +24 -3
  44. package/components/table/TableToolbar.js +78 -37
  45. package/components/table/TableToolbar.js.map +1 -1
  46. package/components/table/TableViewToggles.js +5 -5
  47. package/components/table/TableViewToggles.js.map +1 -1
  48. package/components/table/context/TableInteractionContext.d.ts +3 -0
  49. package/components/table/context/TableInteractionContext.js.map +1 -1
  50. package/components/table/context/TableRenderContext.d.ts +1 -0
  51. package/components/table/context/TableRenderContext.js.map +1 -1
  52. package/components/table/layout/useMeasuredColumnMaxWidths.js +52 -54
  53. package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
  54. package/components/table/layout/useTableLayout.d.ts +4 -1
  55. package/components/table/layout/useTableLayout.js +54 -48
  56. package/components/table/layout/useTableLayout.js.map +1 -1
  57. package/components/table/layout/useTableVirtualization.js +51 -56
  58. package/components/table/layout/useTableVirtualization.js.map +1 -1
  59. package/components/table/model/resolveResponsiveViewType.d.ts +2 -0
  60. package/components/table/model/resolveResponsiveViewType.js +27 -0
  61. package/components/table/model/resolveResponsiveViewType.js.map +1 -0
  62. package/components/table/render/header/TableHeaderSelectionCell.d.ts +1 -0
  63. package/components/table/render/header/TableHeaderSelectionCell.js +13 -12
  64. package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
  65. package/components/table/runtime/useResponsiveResolvedViewType.d.ts +23 -0
  66. package/components/table/runtime/useResponsiveResolvedViewType.js +22 -0
  67. package/components/table/runtime/useResponsiveResolvedViewType.js.map +1 -0
  68. package/components/table/selection/useInternalTableSelectionState.d.ts +2 -0
  69. package/components/table/selection/useInternalTableSelectionState.js +27 -17
  70. package/components/table/selection/useInternalTableSelectionState.js.map +1 -1
  71. package/components/table/selection/useTableSelection.d.ts +5 -1
  72. package/components/table/selection/useTableSelection.js +37 -26
  73. package/components/table/selection/useTableSelection.js.map +1 -1
  74. package/components/table/shared/parsePixelSize.d.ts +2 -0
  75. package/components/table/shared/parsePixelSize.js +13 -0
  76. package/components/table/shared/parsePixelSize.js.map +1 -0
  77. package/hooks/useResizeObserver.d.ts +25 -6
  78. package/hooks/useResizeObserver.js +20 -18
  79. package/hooks/useResizeObserver.js.map +1 -1
  80. package/package.json +10 -10
  81. package/version.d.ts +1 -1
  82. package/version.js +2 -2
  83. package/version.js.map +1 -1
@@ -8,8 +8,10 @@ type UseInternalTableSelectionStateOptions<RowType extends TableRowData> = {
8
8
  type UseInternalTableSelectionStateReturn = {
9
9
  currentSelectedRowIds: TableRowId[];
10
10
  selectedRowIdSet: Set<TableRowId>;
11
+ selectableRowIdSet: Set<TableRowId>;
11
12
  isAllRowsSelected: boolean;
12
13
  isSomeRowsSelected: boolean;
14
+ hasSelectableRows: boolean;
13
15
  handleToggleAllSelection: () => void;
14
16
  handleToggleRowSelection: (rowId: TableRowId) => void;
15
17
  };
@@ -1,28 +1,38 @@
1
- import { useMemo as o } from "react";
2
- const f = (r) => {
3
- const { bodyRows: c, selectedRowIds: w, onSelectionChange: n } = r, l = o(
4
- () => c.filter((e) => e.kind === "data" && !e.disabled).map((e) => e.rowId),
5
- [c]
6
- ), d = o(() => new Set(l), [l]), t = w ?? [], a = o(() => new Set(t), [t]), S = o(
7
- () => t.filter((e) => d.has(e)),
8
- [t, d]
9
- ), i = o(() => new Set(S), [S]), s = l.length > 0 && l.every((e) => i.has(e)), R = i.size > 0 && !s;
1
+ import { useMemo as s } from "react";
2
+ const k = (b) => {
3
+ const { bodyRows: n, selectedRowIds: w, onSelectionChange: o } = b, d = s(
4
+ () => n.filter(
5
+ (e) => (e.kind === "data" || e.kind === "expanded") && !e.disabled && e.selectable !== !1
6
+ ).map((e) => e.rowId),
7
+ [n]
8
+ ), a = s(() => new Set(d), [d]), t = s(
9
+ () => n.filter((e) => e.kind === "data" && !e.disabled && e.selectable !== !1).map((e) => e.rowId),
10
+ [n]
11
+ ), l = w ?? [], S = s(() => new Set(l), [l]), i = s(
12
+ () => l.filter((e) => t.includes(e)),
13
+ [l, t]
14
+ ), R = s(
15
+ () => new Set(i),
16
+ [i]
17
+ ), c = t.length > 0 && t.every((e) => R.has(e)), g = R.size > 0 && !c, h = t.length > 0;
10
18
  return {
11
- currentSelectedRowIds: t,
12
- selectedRowIdSet: a,
13
- isAllRowsSelected: s,
14
- isSomeRowsSelected: R,
19
+ currentSelectedRowIds: l,
20
+ selectedRowIdSet: S,
21
+ selectableRowIdSet: a,
22
+ isAllRowsSelected: c,
23
+ isSomeRowsSelected: g,
24
+ hasSelectableRows: h,
15
25
  handleToggleAllSelection: () => {
16
- n?.(s ? [] : l);
26
+ o?.(c ? [] : t);
17
27
  },
18
28
  handleToggleRowSelection: (e) => {
19
- n && n(
20
- a.has(e) ? t.filter((g) => g !== e) : [...t, e]
29
+ !o || !a.has(e) || o(
30
+ S.has(e) ? l.filter((r) => r !== e) : [...l, e]
21
31
  );
22
32
  }
23
33
  };
24
34
  };
25
35
  export {
26
- f as default
36
+ k as default
27
37
  };
28
38
  //# sourceMappingURL=useInternalTableSelectionState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInternalTableSelectionState.js","sources":["../../../../src/components/table/selection/useInternalTableSelectionState.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderBodyRow } from '../context/TableRenderContext';\nimport type { TableRowData, TableRowId } from '../Table.types';\n\ntype UseInternalTableSelectionStateOptions<RowType extends TableRowData> = {\n bodyRows: RenderBodyRow<RowType>[];\n selectedRowIds?: TableRowId[];\n onSelectionChange?: (rowIds: TableRowId[]) => void;\n};\n\ntype UseInternalTableSelectionStateReturn = {\n currentSelectedRowIds: TableRowId[];\n selectedRowIdSet: Set<TableRowId>;\n isAllRowsSelected: boolean;\n isSomeRowsSelected: boolean;\n handleToggleAllSelection: () => void;\n handleToggleRowSelection: (rowId: TableRowId) => void;\n};\n\nconst useInternalTableSelectionState = <RowType extends TableRowData>(\n props: UseInternalTableSelectionStateOptions<RowType>\n): UseInternalTableSelectionStateReturn => {\n const { bodyRows, selectedRowIds, onSelectionChange } = props;\n\n const selectableRowIds = useMemo(\n () => bodyRows.filter(row => row.kind === 'data' && !row.disabled).map(row => row.rowId),\n [bodyRows]\n );\n const selectableRowIdSet = useMemo(() => new Set(selectableRowIds), [selectableRowIds]);\n const currentSelectedRowIds = selectedRowIds ?? [];\n const selectedRowIdSet = useMemo(() => new Set(currentSelectedRowIds), [currentSelectedRowIds]);\n const normalizedSelectedRowIds = useMemo(\n () => currentSelectedRowIds.filter(rowId => selectableRowIdSet.has(rowId)),\n [currentSelectedRowIds, selectableRowIdSet]\n );\n const normalizedSelectedRowIdSet = useMemo(() => new Set(normalizedSelectedRowIds), [normalizedSelectedRowIds]);\n\n const isAllRowsSelected =\n selectableRowIds.length > 0 && selectableRowIds.every(rowId => normalizedSelectedRowIdSet.has(rowId));\n const isSomeRowsSelected = normalizedSelectedRowIdSet.size > 0 && !isAllRowsSelected;\n\n const handleToggleAllSelection = () => {\n onSelectionChange?.(isAllRowsSelected ? [] : selectableRowIds);\n };\n\n const handleToggleRowSelection = (rowId: TableRowId) => {\n if (!onSelectionChange) {\n return;\n }\n\n onSelectionChange(\n selectedRowIdSet.has(rowId)\n ? currentSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...currentSelectedRowIds, rowId]\n );\n };\n\n return {\n currentSelectedRowIds,\n selectedRowIdSet,\n isAllRowsSelected,\n isSomeRowsSelected,\n handleToggleAllSelection,\n handleToggleRowSelection,\n };\n};\n\nexport default useInternalTableSelectionState;\n"],"names":["useInternalTableSelectionState","props","bodyRows","selectedRowIds","onSelectionChange","selectableRowIds","useMemo","row","selectableRowIdSet","currentSelectedRowIds","selectedRowIdSet","normalizedSelectedRowIds","rowId","normalizedSelectedRowIdSet","isAllRowsSelected","isSomeRowsSelected","selectedRowId"],"mappings":";AAoBA,MAAMA,IAAiC,CACnCC,MACuC;AACvC,QAAM,EAAE,UAAAC,GAAU,gBAAAC,GAAgB,mBAAAC,EAAA,IAAsBH,GAElDI,IAAmBC;AAAA,IACrB,MAAMJ,EAAS,OAAO,CAAAK,MAAOA,EAAI,SAAS,UAAU,CAACA,EAAI,QAAQ,EAAE,IAAI,CAAAA,MAAOA,EAAI,KAAK;AAAA,IACvF,CAACL,CAAQ;AAAA,EAAA,GAEPM,IAAqBF,EAAQ,MAAM,IAAI,IAAID,CAAgB,GAAG,CAACA,CAAgB,CAAC,GAChFI,IAAwBN,KAAkB,CAAA,GAC1CO,IAAmBJ,EAAQ,MAAM,IAAI,IAAIG,CAAqB,GAAG,CAACA,CAAqB,CAAC,GACxFE,IAA2BL;AAAA,IAC7B,MAAMG,EAAsB,OAAO,OAASD,EAAmB,IAAII,CAAK,CAAC;AAAA,IACzE,CAACH,GAAuBD,CAAkB;AAAA,EAAA,GAExCK,IAA6BP,EAAQ,MAAM,IAAI,IAAIK,CAAwB,GAAG,CAACA,CAAwB,CAAC,GAExGG,IACFT,EAAiB,SAAS,KAAKA,EAAiB,MAAM,CAAAO,MAASC,EAA2B,IAAID,CAAK,CAAC,GAClGG,IAAqBF,EAA2B,OAAO,KAAK,CAACC;AAkBnE,SAAO;AAAA,IACH,uBAAAL;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAI;AAAA,IACA,oBAAAC;AAAA,IACA,0BArB6B,MAAM;AACnC,MAAAX,IAAoBU,IAAoB,CAAA,IAAKT,CAAgB;AAAA,IACjE;AAAA,IAoBI,0BAlB6B,CAACO,MAAsB;AACpD,MAAKR,KAILA;AAAA,QACIM,EAAiB,IAAIE,CAAK,IACpBH,EAAsB,OAAO,CAAAO,MAAiBA,MAAkBJ,CAAK,IACrE,CAAC,GAAGH,GAAuBG,CAAK;AAAA,MAAA;AAAA,IAE9C;AAAA,EAQI;AAER;"}
1
+ {"version":3,"file":"useInternalTableSelectionState.js","sources":["../../../../src/components/table/selection/useInternalTableSelectionState.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderBodyRow } from '../context/TableRenderContext';\nimport type { TableRowData, TableRowId } from '../Table.types';\n\ntype UseInternalTableSelectionStateOptions<RowType extends TableRowData> = {\n bodyRows: RenderBodyRow<RowType>[];\n selectedRowIds?: TableRowId[];\n onSelectionChange?: (rowIds: TableRowId[]) => void;\n};\n\ntype UseInternalTableSelectionStateReturn = {\n currentSelectedRowIds: TableRowId[];\n selectedRowIdSet: Set<TableRowId>;\n selectableRowIdSet: Set<TableRowId>;\n isAllRowsSelected: boolean;\n isSomeRowsSelected: boolean;\n hasSelectableRows: boolean;\n handleToggleAllSelection: () => void;\n handleToggleRowSelection: (rowId: TableRowId) => void;\n};\n\nconst useInternalTableSelectionState = <RowType extends TableRowData>(\n props: UseInternalTableSelectionStateOptions<RowType>\n): UseInternalTableSelectionStateReturn => {\n const { bodyRows, selectedRowIds, onSelectionChange } = props;\n\n const selectableRowIds = useMemo(\n () =>\n bodyRows\n .filter(\n row => (row.kind === 'data' || row.kind === 'expanded') && !row.disabled && row.selectable !== false\n )\n .map(row => row.rowId),\n [bodyRows]\n );\n const selectableRowIdSet = useMemo(() => new Set(selectableRowIds), [selectableRowIds]);\n const bulkSelectableRowIds = useMemo(\n () =>\n bodyRows\n .filter(row => row.kind === 'data' && !row.disabled && row.selectable !== false)\n .map(row => row.rowId),\n [bodyRows]\n );\n const currentSelectedRowIds = selectedRowIds ?? [];\n const currentSelectedRowIdSet = useMemo(() => new Set(currentSelectedRowIds), [currentSelectedRowIds]);\n const selectedBulkSelectableRowIds = useMemo(\n () => currentSelectedRowIds.filter(rowId => bulkSelectableRowIds.includes(rowId)),\n [currentSelectedRowIds, bulkSelectableRowIds]\n );\n const selectedBulkSelectableRowIdSet = useMemo(\n () => new Set(selectedBulkSelectableRowIds),\n [selectedBulkSelectableRowIds]\n );\n\n const isAllRowsSelected =\n bulkSelectableRowIds.length > 0 &&\n bulkSelectableRowIds.every(rowId => selectedBulkSelectableRowIdSet.has(rowId));\n const isSomeRowsSelected = selectedBulkSelectableRowIdSet.size > 0 && !isAllRowsSelected;\n const hasSelectableRows = bulkSelectableRowIds.length > 0;\n\n const handleToggleAllSelection = () => {\n onSelectionChange?.(isAllRowsSelected ? [] : bulkSelectableRowIds);\n };\n\n const handleToggleRowSelection = (rowId: TableRowId) => {\n if (!onSelectionChange || !selectableRowIdSet.has(rowId)) {\n return;\n }\n\n onSelectionChange(\n currentSelectedRowIdSet.has(rowId)\n ? currentSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...currentSelectedRowIds, rowId]\n );\n };\n\n return {\n currentSelectedRowIds,\n selectedRowIdSet: currentSelectedRowIdSet,\n selectableRowIdSet,\n isAllRowsSelected,\n isSomeRowsSelected,\n hasSelectableRows,\n handleToggleAllSelection,\n handleToggleRowSelection,\n };\n};\n\nexport default useInternalTableSelectionState;\n"],"names":["useInternalTableSelectionState","props","bodyRows","selectedRowIds","onSelectionChange","selectableRowIds","useMemo","row","selectableRowIdSet","bulkSelectableRowIds","currentSelectedRowIds","currentSelectedRowIdSet","selectedBulkSelectableRowIds","rowId","selectedBulkSelectableRowIdSet","isAllRowsSelected","isSomeRowsSelected","hasSelectableRows","selectedRowId"],"mappings":";AAsBA,MAAMA,IAAiC,CACnCC,MACuC;AACvC,QAAM,EAAE,UAAAC,GAAU,gBAAAC,GAAgB,mBAAAC,EAAA,IAAsBH,GAElDI,IAAmBC;AAAA,IACrB,MACIJ,EACK;AAAA,MACG,CAAAK,OAAQA,EAAI,SAAS,UAAUA,EAAI,SAAS,eAAe,CAACA,EAAI,YAAYA,EAAI,eAAe;AAAA,IAAA,EAElG,IAAI,CAAAA,MAAOA,EAAI,KAAK;AAAA,IAC7B,CAACL,CAAQ;AAAA,EAAA,GAEPM,IAAqBF,EAAQ,MAAM,IAAI,IAAID,CAAgB,GAAG,CAACA,CAAgB,CAAC,GAChFI,IAAuBH;AAAA,IACzB,MACIJ,EACK,OAAO,CAAAK,MAAOA,EAAI,SAAS,UAAU,CAACA,EAAI,YAAYA,EAAI,eAAe,EAAK,EAC9E,IAAI,CAAAA,MAAOA,EAAI,KAAK;AAAA,IAC7B,CAACL,CAAQ;AAAA,EAAA,GAEPQ,IAAwBP,KAAkB,CAAA,GAC1CQ,IAA0BL,EAAQ,MAAM,IAAI,IAAII,CAAqB,GAAG,CAACA,CAAqB,CAAC,GAC/FE,IAA+BN;AAAA,IACjC,MAAMI,EAAsB,OAAO,OAASD,EAAqB,SAASI,CAAK,CAAC;AAAA,IAChF,CAACH,GAAuBD,CAAoB;AAAA,EAAA,GAE1CK,IAAiCR;AAAA,IACnC,MAAM,IAAI,IAAIM,CAA4B;AAAA,IAC1C,CAACA,CAA4B;AAAA,EAAA,GAG3BG,IACFN,EAAqB,SAAS,KAC9BA,EAAqB,MAAM,CAAAI,MAASC,EAA+B,IAAID,CAAK,CAAC,GAC3EG,IAAqBF,EAA+B,OAAO,KAAK,CAACC,GACjEE,IAAoBR,EAAqB,SAAS;AAkBxD,SAAO;AAAA,IACH,uBAAAC;AAAA,IACA,kBAAkBC;AAAA,IAClB,oBAAAH;AAAA,IACA,mBAAAO;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAvB6B,MAAM;AACnC,MAAAb,IAAoBW,IAAoB,CAAA,IAAKN,CAAoB;AAAA,IACrE;AAAA,IAsBI,0BApB6B,CAACI,MAAsB;AACpD,MAAI,CAACT,KAAqB,CAACI,EAAmB,IAAIK,CAAK,KAIvDT;AAAA,QACIO,EAAwB,IAAIE,CAAK,IAC3BH,EAAsB,OAAO,CAAAQ,MAAiBA,MAAkBL,CAAK,IACrE,CAAC,GAAGH,GAAuBG,CAAK;AAAA,MAAA;AAAA,IAE9C;AAAA,EAUI;AAER;"}
@@ -1,4 +1,4 @@
1
- import { TableRowData, TableRowId } from '../Table.types';
1
+ import { TableRowData, TableRowId, TableRowSelectable } from '../Table.types';
2
2
  /**
3
3
  * Configuration for `useTableSelection`.
4
4
  */
@@ -17,6 +17,10 @@ export type UseTableSelectionOptions<RowType extends TableRowData> = {
17
17
  * Optional initially active row id.
18
18
  */
19
19
  initialActiveRowId?: TableRowId;
20
+ /**
21
+ * Optional predicate to exclude rows from selection.
22
+ */
23
+ isRowSelectable?: TableRowSelectable<RowType>;
20
24
  /**
21
25
  * Optional initially selected row ids.
22
26
  */
@@ -1,35 +1,46 @@
1
- import { useMemo as d, useState as r, useEffect as y } from "react";
2
- import { resolveRowKey as v } from "../model/resolveRowMeta.js";
3
- const K = (S) => {
4
- const { rows: n, rowKey: i, initialActiveRowId: w, initialSelectedRowIds: f = [] } = S, l = d(() => n.map((e, t) => v(e, t, i)), [n, i]), c = d(() => new Set(l), [l]), [g, a] = r(w), [o, s] = r(f);
5
- y(() => {
6
- s((e) => e.filter((t) => c.has(t))), a(
7
- (e) => e !== void 0 && c.has(e) ? e : void 0
1
+ import { useMemo as r, useState as d, useEffect as x } from "react";
2
+ import { resolveRowKey as m } from "../model/resolveRowMeta.js";
3
+ const j = (u) => {
4
+ const { rows: o, rowKey: a, initialActiveRowId: w, initialSelectedRowIds: R = [], isRowSelectable: f } = u, h = r(() => o.map((e, t) => m(e, t, a)), [o, a]), S = r(() => new Set(h), [h]), n = r(
5
+ () => o.flatMap((e, t) => {
6
+ const l = m(e, t, a);
7
+ return f?.(e, t) === !1 ? [] : [l];
8
+ }),
9
+ [f, a, o]
10
+ ), i = r(() => new Set(n), [n]), [y, g] = d(w), [s, c] = d(R);
11
+ x(() => {
12
+ c((e) => {
13
+ const t = e.filter(
14
+ (l) => S.has(l) && i.has(l)
15
+ );
16
+ return t.length === e.length && t.every((l, M) => l === e[M]) ? e : t;
17
+ }), g(
18
+ (e) => e !== void 0 && S.has(e) ? e : void 0
8
19
  );
9
- }, [c]);
10
- const m = (e) => {
11
- s(
12
- (t) => t.includes(e) ? t.filter((R) => R !== e) : [...t, e]
20
+ }, [S, i]);
21
+ const b = (e) => {
22
+ i.has(e) && c(
23
+ (t) => t.includes(e) ? t.filter((l) => l !== e) : [...t, e]
13
24
  );
14
- }, u = (e = !l.every((t) => o.includes(t))) => {
15
- s(e ? l : []);
16
- }, h = () => {
17
- s([]);
25
+ }, A = (e = !n.every((t) => s.includes(t))) => {
26
+ c(e ? n : []);
27
+ }, K = () => {
28
+ c([]);
18
29
  };
19
30
  return {
20
- activeRowId: g,
21
- selectedRowIds: o,
22
- hasSelection: o.length > 0,
23
- isAllSelected: l.length > 0 && l.every((e) => o.includes(e)),
24
- isRowSelected: (e) => o.includes(e),
25
- setActiveRowId: a,
26
- setSelectedRowIds: s,
27
- toggleRowSelection: m,
28
- toggleAllSelection: u,
29
- clearSelection: h
31
+ activeRowId: y,
32
+ selectedRowIds: s,
33
+ hasSelection: s.length > 0,
34
+ isAllSelected: n.length > 0 && n.every((e) => s.includes(e)),
35
+ isRowSelected: (e) => i.has(e) && s.includes(e),
36
+ setActiveRowId: g,
37
+ setSelectedRowIds: c,
38
+ toggleRowSelection: b,
39
+ toggleAllSelection: A,
40
+ clearSelection: K
30
41
  };
31
42
  };
32
43
  export {
33
- K as default
44
+ j as default
34
45
  };
35
46
  //# sourceMappingURL=useTableSelection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSelection.js","sources":["../../../../src/components/table/selection/useTableSelection.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { resolveRowKey } from '../model/resolveRowMeta';\nimport type { TableRowData, TableRowId } from '../Table.types';\n\n/**\n * Configuration for `useTableSelection`.\n */\nexport type UseTableSelectionOptions<RowType extends TableRowData> = {\n /**\n * Data rows that participate in active-row and selection state.\n */\n rows: RowType[];\n\n /**\n * Optional key accessor used to derive stable row ids.\n *\n * If omitted, the row index is used as a fallback.\n */\n rowKey?: keyof RowType | ((row: RowType, rowIndex: number) => TableRowId);\n\n /**\n * Optional initially active row id.\n */\n initialActiveRowId?: TableRowId;\n\n /**\n * Optional initially selected row ids.\n */\n initialSelectedRowIds?: TableRowId[];\n};\n\n/**\n * Selection and active-row state returned by `useTableSelection`.\n */\nexport type UseTableSelectionReturn = {\n /**\n * Currently active row id.\n */\n activeRowId?: TableRowId;\n\n /**\n * Currently selected row ids.\n */\n selectedRowIds: TableRowId[];\n\n /**\n * Whether at least one row is currently selected.\n */\n hasSelection: boolean;\n\n /**\n * Whether all current rows are selected.\n */\n isAllSelected: boolean;\n\n /**\n * Checks whether a given row id is currently selected.\n */\n isRowSelected: (rowId: TableRowId) => boolean;\n\n /**\n * Sets the current active row id.\n */\n setActiveRowId: (rowId: TableRowId | undefined) => void;\n\n /**\n * Replaces the current selection with the provided row ids.\n */\n setSelectedRowIds: (rowIds: TableRowId[]) => void;\n\n /**\n * Toggles selection state for a single row id.\n */\n toggleRowSelection: (rowId: TableRowId) => void;\n\n /**\n * Selects or deselects all current rows.\n *\n * If `shouldSelect` is omitted, the hook toggles based on the current\n * all-selected state.\n */\n toggleAllSelection: (shouldSelect?: boolean) => void;\n\n /**\n * Clears the current selection.\n */\n clearSelection: () => void;\n};\n\n/**\n * Small helper hook for controlled table demos and simple table integrations\n * that need active-row state plus checkbox selection state.\n *\n * The hook derives stable row ids from `rows` and `rowKey`, keeps the active\n * row and selection in sync when rows change, and provides convenience helpers\n * for single-row and all-row toggling.\n */\nconst useTableSelection = <RowType extends TableRowData>(\n props: UseTableSelectionOptions<RowType>\n): UseTableSelectionReturn => {\n const { rows, rowKey, initialActiveRowId, initialSelectedRowIds = [] } = props;\n\n const rowIds = useMemo(() => rows.map((row, rowIndex) => resolveRowKey(row, rowIndex, rowKey)), [rows, rowKey]);\n const rowIdSet = useMemo(() => new Set(rowIds), [rowIds]);\n\n const [activeRowId, setActiveRowId] = useState<TableRowId | undefined>(initialActiveRowId);\n const [selectedRowIds, setSelectedRowIds] = useState<TableRowId[]>(initialSelectedRowIds);\n\n useEffect(() => {\n setSelectedRowIds(previousSelectedRowIds => previousSelectedRowIds.filter(rowId => rowIdSet.has(rowId)));\n setActiveRowId(previousActiveRowId =>\n previousActiveRowId !== undefined && rowIdSet.has(previousActiveRowId) ? previousActiveRowId : undefined\n );\n }, [rowIdSet]);\n\n const toggleRowSelection = (rowId: TableRowId) => {\n setSelectedRowIds(previousSelectedRowIds =>\n previousSelectedRowIds.includes(rowId)\n ? previousSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...previousSelectedRowIds, rowId]\n );\n };\n\n const toggleAllSelection = (shouldSelect = !rowIds.every(rowId => selectedRowIds.includes(rowId))) => {\n setSelectedRowIds(shouldSelect ? rowIds : []);\n };\n\n const clearSelection = () => {\n setSelectedRowIds([]);\n };\n\n return {\n activeRowId,\n selectedRowIds,\n hasSelection: selectedRowIds.length > 0,\n isAllSelected: rowIds.length > 0 && rowIds.every(rowId => selectedRowIds.includes(rowId)),\n isRowSelected: rowId => selectedRowIds.includes(rowId),\n setActiveRowId,\n setSelectedRowIds,\n toggleRowSelection,\n toggleAllSelection,\n clearSelection,\n };\n};\n\nexport default useTableSelection;\n"],"names":["useTableSelection","props","rows","rowKey","initialActiveRowId","initialSelectedRowIds","rowIds","useMemo","row","rowIndex","resolveRowKey","rowIdSet","activeRowId","setActiveRowId","useState","selectedRowIds","setSelectedRowIds","useEffect","previousSelectedRowIds","rowId","previousActiveRowId","toggleRowSelection","selectedRowId","toggleAllSelection","shouldSelect","clearSelection"],"mappings":";;AAkGA,MAAMA,IAAoB,CACtBC,MAC0B;AAC1B,QAAM,EAAE,MAAAC,GAAM,QAAAC,GAAQ,oBAAAC,GAAoB,uBAAAC,IAAwB,CAAA,MAAOJ,GAEnEK,IAASC,EAAQ,MAAML,EAAK,IAAI,CAACM,GAAKC,MAAaC,EAAcF,GAAKC,GAAUN,CAAM,CAAC,GAAG,CAACD,GAAMC,CAAM,CAAC,GACxGQ,IAAWJ,EAAQ,MAAM,IAAI,IAAID,CAAM,GAAG,CAACA,CAAM,CAAC,GAElD,CAACM,GAAaC,CAAc,IAAIC,EAAiCV,CAAkB,GACnF,CAACW,GAAgBC,CAAiB,IAAIF,EAAuBT,CAAqB;AAExF,EAAAY,EAAU,MAAM;AACZ,IAAAD,EAAkB,CAAAE,MAA0BA,EAAuB,OAAO,CAAAC,MAASR,EAAS,IAAIQ,CAAK,CAAC,CAAC,GACvGN;AAAA,MAAe,OACXO,MAAwB,UAAaT,EAAS,IAAIS,CAAmB,IAAIA,IAAsB;AAAA,IAAA;AAAA,EAEvG,GAAG,CAACT,CAAQ,CAAC;AAEb,QAAMU,IAAqB,CAACF,MAAsB;AAC9C,IAAAH;AAAA,MAAkB,CAAAE,MACdA,EAAuB,SAASC,CAAK,IAC/BD,EAAuB,OAAO,CAAAI,MAAiBA,MAAkBH,CAAK,IACtE,CAAC,GAAGD,GAAwBC,CAAK;AAAA,IAAA;AAAA,EAE/C,GAEMI,IAAqB,CAACC,IAAe,CAAClB,EAAO,MAAM,CAAAa,MAASJ,EAAe,SAASI,CAAK,CAAC,MAAM;AAClG,IAAAH,EAAkBQ,IAAelB,IAAS,EAAE;AAAA,EAChD,GAEMmB,IAAiB,MAAM;AACzB,IAAAT,EAAkB,CAAA,CAAE;AAAA,EACxB;AAEA,SAAO;AAAA,IACH,aAAAJ;AAAA,IACA,gBAAAG;AAAA,IACA,cAAcA,EAAe,SAAS;AAAA,IACtC,eAAeT,EAAO,SAAS,KAAKA,EAAO,MAAM,CAAAa,MAASJ,EAAe,SAASI,CAAK,CAAC;AAAA,IACxF,eAAe,CAAAA,MAASJ,EAAe,SAASI,CAAK;AAAA,IACrD,gBAAAN;AAAA,IACA,mBAAAG;AAAA,IACA,oBAAAK;AAAA,IACA,oBAAAE;AAAA,IACA,gBAAAE;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"useTableSelection.js","sources":["../../../../src/components/table/selection/useTableSelection.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { resolveRowKey } from '../model/resolveRowMeta';\nimport type { TableRowData, TableRowId, TableRowSelectable } from '../Table.types';\n\n/**\n * Configuration for `useTableSelection`.\n */\nexport type UseTableSelectionOptions<RowType extends TableRowData> = {\n /**\n * Data rows that participate in active-row and selection state.\n */\n rows: RowType[];\n\n /**\n * Optional key accessor used to derive stable row ids.\n *\n * If omitted, the row index is used as a fallback.\n */\n rowKey?: keyof RowType | ((row: RowType, rowIndex: number) => TableRowId);\n\n /**\n * Optional initially active row id.\n */\n initialActiveRowId?: TableRowId;\n\n /**\n * Optional predicate to exclude rows from selection.\n */\n isRowSelectable?: TableRowSelectable<RowType>;\n\n /**\n * Optional initially selected row ids.\n */\n initialSelectedRowIds?: TableRowId[];\n};\n\n/**\n * Selection and active-row state returned by `useTableSelection`.\n */\nexport type UseTableSelectionReturn = {\n /**\n * Currently active row id.\n */\n activeRowId?: TableRowId;\n\n /**\n * Currently selected row ids.\n */\n selectedRowIds: TableRowId[];\n\n /**\n * Whether at least one row is currently selected.\n */\n hasSelection: boolean;\n\n /**\n * Whether all current rows are selected.\n */\n isAllSelected: boolean;\n\n /**\n * Checks whether a given row id is currently selected.\n */\n isRowSelected: (rowId: TableRowId) => boolean;\n\n /**\n * Sets the current active row id.\n */\n setActiveRowId: (rowId: TableRowId | undefined) => void;\n\n /**\n * Replaces the current selection with the provided row ids.\n */\n setSelectedRowIds: (rowIds: TableRowId[]) => void;\n\n /**\n * Toggles selection state for a single row id.\n */\n toggleRowSelection: (rowId: TableRowId) => void;\n\n /**\n * Selects or deselects all current rows.\n *\n * If `shouldSelect` is omitted, the hook toggles based on the current\n * all-selected state.\n */\n toggleAllSelection: (shouldSelect?: boolean) => void;\n\n /**\n * Clears the current selection.\n */\n clearSelection: () => void;\n};\n\n/**\n * Small helper hook for controlled table demos and simple table integrations\n * that need active-row state plus checkbox selection state.\n *\n * The hook derives stable row ids from `rows` and `rowKey`, keeps the active\n * row and selection in sync when rows change, and provides convenience helpers\n * for single-row and all-row toggling.\n */\nconst useTableSelection = <RowType extends TableRowData>(\n props: UseTableSelectionOptions<RowType>\n): UseTableSelectionReturn => {\n const { rows, rowKey, initialActiveRowId, initialSelectedRowIds = [], isRowSelectable } = props;\n\n const rowIds = useMemo(() => rows.map((row, rowIndex) => resolveRowKey(row, rowIndex, rowKey)), [rows, rowKey]);\n const rowIdSet = useMemo(() => new Set(rowIds), [rowIds]);\n const selectableRowIds = useMemo(\n () =>\n rows.flatMap((row, rowIndex) => {\n const rowId = resolveRowKey(row, rowIndex, rowKey);\n return isRowSelectable?.(row, rowIndex) === false ? [] : [rowId];\n }),\n [isRowSelectable, rowKey, rows]\n );\n const selectableRowIdSet = useMemo(() => new Set(selectableRowIds), [selectableRowIds]);\n\n const [activeRowId, setActiveRowId] = useState<TableRowId | undefined>(initialActiveRowId);\n const [selectedRowIds, setSelectedRowIds] = useState<TableRowId[]>(initialSelectedRowIds);\n\n useEffect(() => {\n setSelectedRowIds(previousSelectedRowIds => {\n const nextSelectedRowIds = previousSelectedRowIds.filter(\n rowId => rowIdSet.has(rowId) && selectableRowIdSet.has(rowId)\n );\n\n return nextSelectedRowIds.length === previousSelectedRowIds.length &&\n nextSelectedRowIds.every((rowId, index) => rowId === previousSelectedRowIds[index])\n ? previousSelectedRowIds\n : nextSelectedRowIds;\n });\n setActiveRowId(previousActiveRowId =>\n previousActiveRowId !== undefined && rowIdSet.has(previousActiveRowId) ? previousActiveRowId : undefined\n );\n }, [rowIdSet, selectableRowIdSet]);\n\n const toggleRowSelection = (rowId: TableRowId) => {\n if (!selectableRowIdSet.has(rowId)) {\n return;\n }\n\n setSelectedRowIds(previousSelectedRowIds =>\n previousSelectedRowIds.includes(rowId)\n ? previousSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...previousSelectedRowIds, rowId]\n );\n };\n\n const toggleAllSelection = (shouldSelect = !selectableRowIds.every(rowId => selectedRowIds.includes(rowId))) => {\n setSelectedRowIds(shouldSelect ? selectableRowIds : []);\n };\n\n const clearSelection = () => {\n setSelectedRowIds([]);\n };\n\n return {\n activeRowId,\n selectedRowIds,\n hasSelection: selectedRowIds.length > 0,\n isAllSelected: selectableRowIds.length > 0 && selectableRowIds.every(rowId => selectedRowIds.includes(rowId)),\n isRowSelected: rowId => selectableRowIdSet.has(rowId) && selectedRowIds.includes(rowId),\n setActiveRowId,\n setSelectedRowIds,\n toggleRowSelection,\n toggleAllSelection,\n clearSelection,\n };\n};\n\nexport default useTableSelection;\n"],"names":["useTableSelection","props","rows","rowKey","initialActiveRowId","initialSelectedRowIds","isRowSelectable","rowIds","useMemo","row","rowIndex","resolveRowKey","rowIdSet","selectableRowIds","rowId","selectableRowIdSet","activeRowId","setActiveRowId","useState","selectedRowIds","setSelectedRowIds","useEffect","previousSelectedRowIds","nextSelectedRowIds","index","previousActiveRowId","toggleRowSelection","selectedRowId","toggleAllSelection","shouldSelect","clearSelection"],"mappings":";;AAuGA,MAAMA,IAAoB,CACtBC,MAC0B;AAC1B,QAAM,EAAE,MAAAC,GAAM,QAAAC,GAAQ,oBAAAC,GAAoB,uBAAAC,IAAwB,CAAA,GAAI,iBAAAC,MAAoBL,GAEpFM,IAASC,EAAQ,MAAMN,EAAK,IAAI,CAACO,GAAKC,MAAaC,EAAcF,GAAKC,GAAUP,CAAM,CAAC,GAAG,CAACD,GAAMC,CAAM,CAAC,GACxGS,IAAWJ,EAAQ,MAAM,IAAI,IAAID,CAAM,GAAG,CAACA,CAAM,CAAC,GAClDM,IAAmBL;AAAA,IACrB,MACIN,EAAK,QAAQ,CAACO,GAAKC,MAAa;AAC5B,YAAMI,IAAQH,EAAcF,GAAKC,GAAUP,CAAM;AACjD,aAAOG,IAAkBG,GAAKC,CAAQ,MAAM,KAAQ,CAAA,IAAK,CAACI,CAAK;AAAA,IACnE,CAAC;AAAA,IACL,CAACR,GAAiBH,GAAQD,CAAI;AAAA,EAAA,GAE5Ba,IAAqBP,EAAQ,MAAM,IAAI,IAAIK,CAAgB,GAAG,CAACA,CAAgB,CAAC,GAEhF,CAACG,GAAaC,CAAc,IAAIC,EAAiCd,CAAkB,GACnF,CAACe,GAAgBC,CAAiB,IAAIF,EAAuBb,CAAqB;AAExF,EAAAgB,EAAU,MAAM;AACZ,IAAAD,EAAkB,CAAAE,MAA0B;AACxC,YAAMC,IAAqBD,EAAuB;AAAA,QAC9C,OAASV,EAAS,IAAIE,CAAK,KAAKC,EAAmB,IAAID,CAAK;AAAA,MAAA;AAGhE,aAAOS,EAAmB,WAAWD,EAAuB,UACxDC,EAAmB,MAAM,CAACT,GAAOU,MAAUV,MAAUQ,EAAuBE,CAAK,CAAC,IAChFF,IACAC;AAAA,IACV,CAAC,GACDN;AAAA,MAAe,OACXQ,MAAwB,UAAab,EAAS,IAAIa,CAAmB,IAAIA,IAAsB;AAAA,IAAA;AAAA,EAEvG,GAAG,CAACb,GAAUG,CAAkB,CAAC;AAEjC,QAAMW,IAAqB,CAACZ,MAAsB;AAC9C,IAAKC,EAAmB,IAAID,CAAK,KAIjCM;AAAA,MAAkB,CAAAE,MACdA,EAAuB,SAASR,CAAK,IAC/BQ,EAAuB,OAAO,CAAAK,MAAiBA,MAAkBb,CAAK,IACtE,CAAC,GAAGQ,GAAwBR,CAAK;AAAA,IAAA;AAAA,EAE/C,GAEMc,IAAqB,CAACC,IAAe,CAAChB,EAAiB,MAAM,CAAAC,MAASK,EAAe,SAASL,CAAK,CAAC,MAAM;AAC5G,IAAAM,EAAkBS,IAAehB,IAAmB,EAAE;AAAA,EAC1D,GAEMiB,IAAiB,MAAM;AACzB,IAAAV,EAAkB,CAAA,CAAE;AAAA,EACxB;AAEA,SAAO;AAAA,IACH,aAAAJ;AAAA,IACA,gBAAAG;AAAA,IACA,cAAcA,EAAe,SAAS;AAAA,IACtC,eAAeN,EAAiB,SAAS,KAAKA,EAAiB,MAAM,CAAAC,MAASK,EAAe,SAASL,CAAK,CAAC;AAAA,IAC5G,eAAe,OAASC,EAAmB,IAAID,CAAK,KAAKK,EAAe,SAASL,CAAK;AAAA,IACtF,gBAAAG;AAAA,IACA,mBAAAG;AAAA,IACA,oBAAAM;AAAA,IACA,oBAAAE;AAAA,IACA,gBAAAE;AAAA,EAAA;AAER;"}
@@ -0,0 +1,2 @@
1
+ declare const parsePixelSize: (value?: string | number) => number | undefined;
2
+ export default parsePixelSize;
@@ -0,0 +1,13 @@
1
+ const e = (r) => {
2
+ if (typeof r == "number")
3
+ return Number.isFinite(r) ? r : void 0;
4
+ if (!r)
5
+ return;
6
+ const t = r.trim().match(/^(-?\d+(?:\.\d+)?)px$/);
7
+ if (t)
8
+ return Number(t[1]);
9
+ };
10
+ export {
11
+ e as default
12
+ };
13
+ //# sourceMappingURL=parsePixelSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsePixelSize.js","sources":["../../../../src/components/table/shared/parsePixelSize.ts"],"sourcesContent":["const parsePixelSize = (value?: string | number): number | undefined => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : undefined;\n }\n\n if (!value) {\n return;\n }\n\n const match = value.trim().match(/^(-?\\d+(?:\\.\\d+)?)px$/);\n\n if (!match) {\n return;\n }\n\n return Number(match[1]);\n};\n\nexport default parsePixelSize;\n"],"names":["parsePixelSize","value","match"],"mappings":"AAAA,MAAMA,IAAiB,CAACC,MAAgD;AACpE,MAAI,OAAOA,KAAU;AACjB,WAAO,OAAO,SAASA,CAAK,IAAIA,IAAQ;AAG5C,MAAI,CAACA;AACD;AAGJ,QAAMC,IAAQD,EAAM,KAAA,EAAO,MAAM,uBAAuB;AAExD,MAAKC;AAIL,WAAO,OAAOA,EAAM,CAAC,CAAC;AAC1B;"}
@@ -1,10 +1,29 @@
1
1
  import { MutableRefObject } from 'react';
2
- /**
3
- * Custom hook for observing element resize.
4
- * @returns
5
- */
6
- declare const useResizeObserver: <T extends HTMLElement = HTMLDivElement>() => [MutableRefObject<T | null>, ResizeObserverEntry | null, {
2
+ export type UseResizeObserverSize = {
7
3
  blockSize: number | undefined;
8
4
  inlineSize: number | undefined;
9
- }];
5
+ };
6
+ export type UseResizeObserverReturn<T extends HTMLElement = HTMLDivElement> = [
7
+ MutableRefObject<T | null>,
8
+ ResizeObserverEntry | null,
9
+ UseResizeObserverSize
10
+ ];
11
+ /**
12
+ * Observes size changes of an element with `ResizeObserver`.
13
+ *
14
+ * Use the returned `ref` for the common case where the hook owns the observed element.
15
+ * Alternatively, pass an existing element via `observedElement` to observe it directly.
16
+ *
17
+ * The third tuple item exposes `inlineSize` and `blockSize` with a `borderBoxSize` first
18
+ * strategy and falls back to `contentRect` when needed.
19
+ *
20
+ * @template T The observed element type. Defaults to `HTMLDivElement`.
21
+ * @param observedElement Optional existing DOM element to observe instead of the returned ref target.
22
+ * @returns `[ref, observerEntry, size]`
23
+ *
24
+ * `ref` is the ref object for the observed element when the hook owns that element.
25
+ * `observerEntry` is `null` until the first resize notification arrives.
26
+ * `size` contains `inlineSize` and `blockSize`, preferring `borderBoxSize` and falling back to `contentRect`.
27
+ */
28
+ declare const useResizeObserver: <T extends HTMLElement = HTMLDivElement>(observedElement?: T | null) => UseResizeObserverReturn<T>;
10
29
  export default useResizeObserver;
@@ -1,26 +1,28 @@
1
- import { useState as d, useRef as u, useCallback as a, useLayoutEffect as f } from "react";
1
+ import { useState as k, useRef as a, useCallback as d, useLayoutEffect as v } from "react";
2
2
  const c = (e) => {
3
- const n = e?.borderBoxSize?.at(0);
3
+ const t = e?.borderBoxSize?.at(0);
4
4
  return {
5
- blockSize: n?.blockSize ?? e?.contentRect.height,
6
- inlineSize: n?.inlineSize ?? e?.contentRect.width
5
+ blockSize: t?.blockSize ?? e?.contentRect.height,
6
+ inlineSize: t?.inlineSize ?? e?.contentRect.width
7
7
  };
8
- }, v = () => {
9
- const [e, n] = d(null), t = u(null), o = u(null), s = a(() => o.current?.disconnect(), []), l = a(() => {
10
- o.current = new ResizeObserver(([i]) => {
11
- n((r) => {
12
- if (!r)
13
- return i;
14
- const S = c(r), b = c(i);
15
- return r.target === i.target && S.blockSize === b.blockSize && S.inlineSize === b.inlineSize ? r : i;
8
+ }, g = (e) => {
9
+ const [t, f] = k(null), s = a(null), o = a(null), r = d(() => o.current?.disconnect(), []), l = d(() => {
10
+ o.current = new ResizeObserver(([n]) => {
11
+ f((i) => {
12
+ if (!i)
13
+ return n;
14
+ const b = c(i), u = c(n);
15
+ return i.target === n.target && b.blockSize === u.blockSize && b.inlineSize === u.inlineSize ? i : n;
16
16
  });
17
- }), t.current && o.current.observe(t.current);
18
- }, [t]);
19
- f(() => (l(), () => s()), [s, l]);
20
- const z = c(e);
17
+ });
18
+ const S = e ?? s.current;
19
+ S && o.current.observe(S);
20
+ }, [e]);
21
+ v(() => (r(), l(), () => r()), [r, l]);
22
+ const z = c(t);
21
23
  return [
24
+ s,
22
25
  t,
23
- e,
24
26
  {
25
27
  blockSize: z.blockSize,
26
28
  inlineSize: z.inlineSize
@@ -28,6 +30,6 @@ const c = (e) => {
28
30
  ];
29
31
  };
30
32
  export {
31
- v as default
33
+ g as default
32
34
  };
33
35
  //# sourceMappingURL=useResizeObserver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResizeObserver.js","sources":["../../src/hooks/useResizeObserver.ts"],"sourcesContent":["// inspired from https://tobbelindstrom.com/blog/resize-observer-hook/\n\nimport { useRef, useLayoutEffect, useState, useCallback, type MutableRefObject } from 'react';\n\nconst getObservedSize = (entry: ResizeObserverEntry | null) => {\n const borderBoxSize = entry?.borderBoxSize?.at(0);\n\n return {\n blockSize: borderBoxSize?.blockSize ?? entry?.contentRect.height,\n inlineSize: borderBoxSize?.inlineSize ?? entry?.contentRect.width,\n };\n};\n\n/**\n * Custom hook for observing element resize.\n * @returns\n */\nconst useResizeObserver = <T extends HTMLElement = HTMLDivElement>(): [\n MutableRefObject<T | null>,\n ResizeObserverEntry | null,\n { blockSize: number | undefined; inlineSize: number | undefined },\n] => {\n const [observerEntry, setObserverEntry] = useState<ResizeObserverEntry | null>(null);\n\n const nodeRef = useRef<T | null>(null);\n\n const observer = useRef<ResizeObserver | null>(null);\n\n const disconnect = useCallback(() => observer.current?.disconnect(), []);\n\n const observe = useCallback(() => {\n observer.current = new ResizeObserver(([entry]) => {\n setObserverEntry(previousEntry => {\n if (!previousEntry) {\n return entry;\n }\n\n const previousSize = getObservedSize(previousEntry);\n const nextSize = getObservedSize(entry);\n\n return previousEntry.target === entry.target &&\n previousSize.blockSize === nextSize.blockSize &&\n previousSize.inlineSize === nextSize.inlineSize\n ? previousEntry\n : entry;\n });\n });\n if (nodeRef.current) {\n observer.current.observe(nodeRef.current);\n }\n }, [nodeRef]);\n\n useLayoutEffect(() => {\n observe();\n return () => disconnect();\n }, [disconnect, observe]);\n\n const observedSize = getObservedSize(observerEntry);\n\n return [\n nodeRef,\n observerEntry,\n {\n blockSize: observedSize.blockSize,\n inlineSize: observedSize.inlineSize,\n },\n ];\n};\nexport default useResizeObserver;\n"],"names":["getObservedSize","entry","borderBoxSize","useResizeObserver","observerEntry","setObserverEntry","useState","nodeRef","useRef","observer","disconnect","useCallback","observe","previousEntry","previousSize","nextSize","useLayoutEffect","observedSize"],"mappings":";AAIA,MAAMA,IAAkB,CAACC,MAAsC;AAC3D,QAAMC,IAAgBD,GAAO,eAAe,GAAG,CAAC;AAEhD,SAAO;AAAA,IACH,WAAWC,GAAe,aAAaD,GAAO,YAAY;AAAA,IAC1D,YAAYC,GAAe,cAAcD,GAAO,YAAY;AAAA,EAAA;AAEpE,GAMME,IAAoB,MAIrB;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAqC,IAAI,GAE7EC,IAAUC,EAAiB,IAAI,GAE/BC,IAAWD,EAA8B,IAAI,GAE7CE,IAAaC,EAAY,MAAMF,EAAS,SAAS,WAAA,GAAc,EAAE,GAEjEG,IAAUD,EAAY,MAAM;AAC9B,IAAAF,EAAS,UAAU,IAAI,eAAe,CAAC,CAACR,CAAK,MAAM;AAC/C,MAAAI,EAAiB,CAAAQ,MAAiB;AAC9B,YAAI,CAACA;AACD,iBAAOZ;AAGX,cAAMa,IAAed,EAAgBa,CAAa,GAC5CE,IAAWf,EAAgBC,CAAK;AAEtC,eAAOY,EAAc,WAAWZ,EAAM,UAClCa,EAAa,cAAcC,EAAS,aACpCD,EAAa,eAAeC,EAAS,aACnCF,IACAZ;AAAA,MACV,CAAC;AAAA,IACL,CAAC,GACGM,EAAQ,WACRE,EAAS,QAAQ,QAAQF,EAAQ,OAAO;AAAA,EAEhD,GAAG,CAACA,CAAO,CAAC;AAEZ,EAAAS,EAAgB,OACZJ,EAAA,GACO,MAAMF,EAAA,IACd,CAACA,GAAYE,CAAO,CAAC;AAExB,QAAMK,IAAejB,EAAgBI,CAAa;AAElD,SAAO;AAAA,IACHG;AAAA,IACAH;AAAA,IACA;AAAA,MACI,WAAWa,EAAa;AAAA,MACxB,YAAYA,EAAa;AAAA,IAAA;AAAA,EAC7B;AAER;"}
1
+ {"version":3,"file":"useResizeObserver.js","sources":["../../src/hooks/useResizeObserver.ts"],"sourcesContent":["// inspired from https://tobbelindstrom.com/blog/resize-observer-hook/\n\nimport { useRef, useLayoutEffect, useState, useCallback, type MutableRefObject } from 'react';\n\nconst getObservedSize = (entry: ResizeObserverEntry | null) => {\n const borderBoxSize = entry?.borderBoxSize?.at(0);\n\n return {\n blockSize: borderBoxSize?.blockSize ?? entry?.contentRect.height,\n inlineSize: borderBoxSize?.inlineSize ?? entry?.contentRect.width,\n };\n};\n\nexport type UseResizeObserverSize = {\n blockSize: number | undefined;\n inlineSize: number | undefined;\n};\n\nexport type UseResizeObserverReturn<T extends HTMLElement = HTMLDivElement> = [\n MutableRefObject<T | null>,\n ResizeObserverEntry | null,\n UseResizeObserverSize,\n];\n\n/**\n * Observes size changes of an element with `ResizeObserver`.\n *\n * Use the returned `ref` for the common case where the hook owns the observed element.\n * Alternatively, pass an existing element via `observedElement` to observe it directly.\n *\n * The third tuple item exposes `inlineSize` and `blockSize` with a `borderBoxSize` first\n * strategy and falls back to `contentRect` when needed.\n *\n * @template T The observed element type. Defaults to `HTMLDivElement`.\n * @param observedElement Optional existing DOM element to observe instead of the returned ref target.\n * @returns `[ref, observerEntry, size]`\n *\n * `ref` is the ref object for the observed element when the hook owns that element.\n * `observerEntry` is `null` until the first resize notification arrives.\n * `size` contains `inlineSize` and `blockSize`, preferring `borderBoxSize` and falling back to `contentRect`.\n */\nconst useResizeObserver = <T extends HTMLElement = HTMLDivElement>(\n observedElement?: T | null\n): UseResizeObserverReturn<T> => {\n const [observerEntry, setObserverEntry] = useState<ResizeObserverEntry | null>(null);\n\n const nodeRef = useRef<T | null>(null);\n\n const observer = useRef<ResizeObserver | null>(null);\n\n const disconnect = useCallback(() => observer.current?.disconnect(), []);\n\n const observe = useCallback(() => {\n observer.current = new ResizeObserver(([entry]) => {\n setObserverEntry(previousEntry => {\n if (!previousEntry) {\n return entry;\n }\n\n const previousSize = getObservedSize(previousEntry);\n const nextSize = getObservedSize(entry);\n\n return previousEntry.target === entry.target &&\n previousSize.blockSize === nextSize.blockSize &&\n previousSize.inlineSize === nextSize.inlineSize\n ? previousEntry\n : entry;\n });\n });\n const targetElement = observedElement ?? nodeRef.current;\n\n if (targetElement) {\n observer.current.observe(targetElement);\n }\n }, [observedElement]);\n\n useLayoutEffect(() => {\n disconnect();\n observe();\n return () => disconnect();\n }, [disconnect, observe]);\n\n const observedSize = getObservedSize(observerEntry);\n\n return [\n nodeRef,\n observerEntry,\n {\n blockSize: observedSize.blockSize,\n inlineSize: observedSize.inlineSize,\n },\n ];\n};\nexport default useResizeObserver;\n"],"names":["getObservedSize","entry","borderBoxSize","useResizeObserver","observedElement","observerEntry","setObserverEntry","useState","nodeRef","useRef","observer","disconnect","useCallback","observe","previousEntry","previousSize","nextSize","targetElement","useLayoutEffect","observedSize"],"mappings":";AAIA,MAAMA,IAAkB,CAACC,MAAsC;AAC3D,QAAMC,IAAgBD,GAAO,eAAe,GAAG,CAAC;AAEhD,SAAO;AAAA,IACH,WAAWC,GAAe,aAAaD,GAAO,YAAY;AAAA,IAC1D,YAAYC,GAAe,cAAcD,GAAO,YAAY;AAAA,EAAA;AAEpE,GA8BME,IAAoB,CACtBC,MAC6B;AAC7B,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAqC,IAAI,GAE7EC,IAAUC,EAAiB,IAAI,GAE/BC,IAAWD,EAA8B,IAAI,GAE7CE,IAAaC,EAAY,MAAMF,EAAS,SAAS,WAAA,GAAc,EAAE,GAEjEG,IAAUD,EAAY,MAAM;AAC9B,IAAAF,EAAS,UAAU,IAAI,eAAe,CAAC,CAACT,CAAK,MAAM;AAC/C,MAAAK,EAAiB,CAAAQ,MAAiB;AAC9B,YAAI,CAACA;AACD,iBAAOb;AAGX,cAAMc,IAAef,EAAgBc,CAAa,GAC5CE,IAAWhB,EAAgBC,CAAK;AAEtC,eAAOa,EAAc,WAAWb,EAAM,UAClCc,EAAa,cAAcC,EAAS,aACpCD,EAAa,eAAeC,EAAS,aACnCF,IACAb;AAAA,MACV,CAAC;AAAA,IACL,CAAC;AACD,UAAMgB,IAAgBb,KAAmBI,EAAQ;AAEjD,IAAIS,KACAP,EAAS,QAAQ,QAAQO,CAAa;AAAA,EAE9C,GAAG,CAACb,CAAe,CAAC;AAEpB,EAAAc,EAAgB,OACZP,EAAA,GACAE,EAAA,GACO,MAAMF,EAAA,IACd,CAACA,GAAYE,CAAO,CAAC;AAExB,QAAMM,IAAenB,EAAgBK,CAAa;AAElD,SAAO;AAAA,IACHG;AAAA,IACAH;AAAA,IACA;AAAA,MACI,WAAWc,EAAa;AAAA,MACxB,YAAYA,EAAa;AAAA,IAAA;AAAA,EAC7B;AAER;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio-cloud/rio-uikit",
3
- "version": "2.3.0-beta.3",
3
+ "version": "2.3.0",
4
4
  "description": "The RIO UIKIT component library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "devDependencies": {
49
- "@biomejs/biome": "2.4.8",
49
+ "@biomejs/biome": "2.4.12",
50
50
  "@rio-cloud/biome-config": "1.2.0",
51
51
  "@rio-cloud/vite-plugin-frontend-license-check": "3.0.0",
52
52
  "@testing-library/dom": "10.4.1",
@@ -60,15 +60,15 @@
60
60
  "@types/react-redux": "7.1.34",
61
61
  "@types/resize-observer-browser": "0.1.11",
62
62
  "@vitejs/plugin-react": "5.1.4",
63
- "@vitest/coverage-v8": "^4.1.1",
64
- "autoprefixer": "10.4.27",
63
+ "@vitest/coverage-v8": "^4.1.4",
64
+ "autoprefixer": "10.5.0",
65
65
  "backstopjs": "6.3.25",
66
- "dotenv": "17.3.1",
66
+ "dotenv": "17.4.2",
67
67
  "glob": "13.0.6",
68
- "happy-dom": "20.8.7",
68
+ "happy-dom": "20.9.0",
69
69
  "jsdom": "27.4.0",
70
70
  "jsdom-global": "3.0.2",
71
- "postcss": "8.5.8",
71
+ "postcss": "8.5.10",
72
72
  "postcss-preset-env": "8.5.1",
73
73
  "postcss-short": "5.0.0",
74
74
  "pre-commit": "1.2.2",
@@ -76,7 +76,7 @@
76
76
  "react-dom": "18.0.0",
77
77
  "react-intl": "7.1.14",
78
78
  "rollup-plugin-copy": "3.5.0",
79
- "sass": "1.98.0",
79
+ "sass": "1.99.0",
80
80
  "strip-ansi": "7.2.0",
81
81
  "svgo": "4.0.1",
82
82
  "typescript": "5.9.3",
@@ -97,7 +97,7 @@
97
97
  "@dnd-kit/utilities": "3.2.2",
98
98
  "@formkit/auto-animate": "0.9.0",
99
99
  "@popperjs/core": "2.11.8",
100
- "@tanstack/react-virtual": "3.13.23",
100
+ "@tanstack/react-virtual": "3.13.24",
101
101
  "date-fns": "4.1.0",
102
102
  "driver.js": "1.4.0",
103
103
  "es-toolkit": "1.45.1",
@@ -119,7 +119,7 @@
119
119
  "react-onclickoutside": "6.13.2",
120
120
  "react-popper": "2.3.0",
121
121
  "react-toastify": "11.0.5",
122
- "recharts": "3.8.0",
122
+ "recharts": "3.8.1",
123
123
  "tiny-invariant": "1.3.3",
124
124
  "tslib": "2.8.1"
125
125
  },
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export const version: "2.3.0-beta.3";
1
+ export const version: "2.3.0";
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
- const e = "2.3.0-beta.3";
1
+ const o = "2.3.0";
2
2
  export {
3
- e as version
3
+ o as version
4
4
  };
5
5
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../src/version.js"],"sourcesContent":["export const version = '2.3.0-beta.3';\n"],"names":["version"],"mappings":"AAAY,MAACA,IAAU;"}
1
+ {"version":3,"file":"version.js","sources":["../src/version.js"],"sourcesContent":["export const version = '2.3.0';\n"],"names":["version"],"mappings":"AAAY,MAACA,IAAU;"}