@dss-kit/ui-kit 1.0.1 → 1.0.3

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 (93) hide show
  1. package/README.md +29 -29
  2. package/dist/components/builders/Dialog/Dialog.const.d.ts +9 -0
  3. package/dist/components/builders/Dialog/Dialog.const.js +4 -0
  4. package/dist/components/builders/Dialog/Dialog.context.d.ts +12 -0
  5. package/dist/components/builders/{Modal/context.js → Dialog/Dialog.context.js} +5 -5
  6. package/dist/components/builders/Dialog/Dialog.parts.d.ts +11 -0
  7. package/dist/components/builders/Dialog/Dialog.parts.js +11 -0
  8. package/dist/components/builders/Dialog/Dialog.types.d.ts +44 -0
  9. package/dist/components/builders/Dialog/DialogCloseButton/DialogCloseButton.d.ts +10 -0
  10. package/dist/components/builders/Dialog/DialogCloseButton/DialogCloseButton.js +34 -0
  11. package/dist/components/builders/Dialog/DialogCloseButton/index.d.ts +2 -0
  12. package/dist/components/builders/{Modal/ModalFooter/ModalFooter.d.ts → Dialog/DialogFooter/DialogFooter.d.ts} +13 -22
  13. package/dist/components/builders/Dialog/DialogFooter/DialogFooter.js +48 -0
  14. package/dist/components/builders/Dialog/DialogFooter/index.d.ts +2 -0
  15. package/dist/components/builders/{Modal/ModalHeader/ModalHeader.d.ts → Dialog/DialogHeader/DialogHeader.d.ts} +10 -6
  16. package/dist/components/builders/Dialog/DialogHeader/DialogHeader.js +97 -0
  17. package/dist/components/builders/Dialog/DialogHeader/index.d.ts +2 -0
  18. package/dist/components/builders/{Modal/ModalMain/ModalMain.d.ts → Dialog/DialogMain/DialogMain.d.ts} +18 -17
  19. package/dist/components/builders/{Modal/ModalMain/ModalMain.js → Dialog/DialogMain/DialogMain.js} +39 -29
  20. package/dist/components/builders/Dialog/DialogMain/index.d.ts +2 -0
  21. package/dist/components/builders/Dialog/DialogMain/styles.d.ts +6 -0
  22. package/dist/components/builders/{Modal/ModalMain → Dialog/DialogMain}/styles.js +16 -0
  23. package/dist/components/builders/Dialog/hooks/index.d.ts +3 -0
  24. package/dist/components/builders/Dialog/hooks/useBackdropClose.d.ts +10 -0
  25. package/dist/components/builders/Dialog/hooks/useBackdropClose.js +15 -0
  26. package/dist/components/builders/Dialog/hooks/useBodyScrollLock.d.ts +6 -0
  27. package/dist/components/builders/Dialog/hooks/useBodyScrollLock.js +13 -0
  28. package/dist/components/builders/Dialog/hooks/useCloseOnEsc.d.ts +6 -0
  29. package/dist/components/builders/Dialog/hooks/useCloseOnEsc.js +21 -0
  30. package/dist/components/builders/Dialog/index.d.ts +10 -0
  31. package/dist/components/builders/Modal/Modal.d.ts +8 -28
  32. package/dist/components/builders/Modal/Modal.js +50 -78
  33. package/dist/components/builders/Modal/index.d.ts +6 -11
  34. package/dist/components/builders/Modal/index.js +7 -9
  35. package/dist/components/builders/Modal/styles.js +6 -7
  36. package/dist/components/builders/Sheet/Sheet.const.d.ts +50 -0
  37. package/dist/components/builders/Sheet/Sheet.const.js +38 -0
  38. package/dist/components/builders/Sheet/Sheet.d.ts +12 -0
  39. package/dist/components/builders/Sheet/Sheet.js +55 -0
  40. package/dist/components/builders/Sheet/Sheet.types.d.ts +82 -0
  41. package/dist/components/builders/Sheet/Sheet.utils.d.ts +34 -0
  42. package/dist/components/builders/Sheet/Sheet.utils.js +50 -0
  43. package/dist/components/builders/Sheet/SheetLayer.d.ts +22 -0
  44. package/dist/components/builders/Sheet/SheetLayer.js +115 -0
  45. package/dist/components/builders/Sheet/hooks/index.d.ts +2 -0
  46. package/dist/components/builders/Sheet/hooks/useSheetGesture.d.ts +24 -0
  47. package/dist/components/builders/Sheet/hooks/useSheetGesture.js +67 -0
  48. package/dist/components/builders/Sheet/hooks/useSheetMotion.d.ts +31 -0
  49. package/dist/components/builders/Sheet/hooks/useSheetMotion.js +74 -0
  50. package/dist/components/builders/Sheet/hooks/useSheetPointer.d.ts +31 -0
  51. package/dist/components/builders/Sheet/hooks/useSheetPointer.js +81 -0
  52. package/dist/components/builders/Sheet/index.d.ts +15 -0
  53. package/dist/components/builders/Sheet/index.js +9 -0
  54. package/dist/components/builders/Sheet/styles.d.ts +17 -0
  55. package/dist/components/builders/Sheet/styles.js +135 -0
  56. package/dist/components/builders/Table/Table.js +169 -165
  57. package/dist/components/builders/Table/Table.types.d.ts +5 -1
  58. package/dist/components/builders/Table/TableBodyRow/TableBodyRow.d.ts +5 -0
  59. package/dist/components/builders/Table/TableBodyRow/TableBodyRow.js +23 -9
  60. package/dist/components/builders/Table/TablePagination/TablePagination.js +1 -1
  61. package/dist/components/builders/Table/TablePlaceholder/TablePlaceholder.js +22 -22
  62. package/dist/components/builders/Text/Text.d.ts +1 -1
  63. package/dist/components/builders/index.d.ts +1 -0
  64. package/dist/components/controls/Checkbox/Checkbox.js +6 -6
  65. package/dist/components/controls/MarkdownTextEditor/MarkdownTextEditor.js +6 -6
  66. package/dist/components/controls/Select/Select.js +6 -6
  67. package/dist/components/shared/MarkdownText/MarkdownText.js +10 -10
  68. package/dist/index.js +93 -91
  69. package/dist/styles/utils/breakpoints/base.scss +11 -11
  70. package/dist/styles/utils/breakpoints/index.scss +3 -3
  71. package/dist/styles/utils/breakpoints/screen.scss +61 -61
  72. package/dist/styles/utils/breakpoints/semantic.scss +31 -31
  73. package/dist/styles/utils/fonts/font-family.scss +3 -3
  74. package/dist/styles/utils/fonts/index.scss +1 -1
  75. package/dist/styles/utils/index.scss +5 -5
  76. package/dist/styles/utils/size/index.scss +1 -1
  77. package/dist/styles/utils/size/modifiers.scss +40 -40
  78. package/dist/styles/utils/style/index.scss +1 -1
  79. package/dist/styles/utils/style/variants.scss +34 -34
  80. package/dist/styles/utils/typography/_font-weight.scss +33 -33
  81. package/dist/styles/utils/typography/_variants.scss +85 -85
  82. package/dist/styles/utils/typography/index.scss +2 -2
  83. package/dist/ui-kit.cjs +8 -8
  84. package/dist/utils/hooks/useLatestRef.d.ts +6 -0
  85. package/dist/utils/hooks/useLatestRef.js +10 -0
  86. package/package.json +94 -94
  87. package/dist/components/builders/Modal/ModalFooter/ModalFooter.js +0 -35
  88. package/dist/components/builders/Modal/ModalFooter/index.d.ts +0 -2
  89. package/dist/components/builders/Modal/ModalHeader/ModalHeader.js +0 -86
  90. package/dist/components/builders/Modal/ModalHeader/index.d.ts +0 -2
  91. package/dist/components/builders/Modal/ModalMain/index.d.ts +0 -2
  92. package/dist/components/builders/Modal/ModalMain/styles.d.ts +0 -3
  93. package/dist/components/builders/Modal/context.d.ts +0 -8
@@ -0,0 +1,15 @@
1
+ import { ReactNode, RefAttributes } from 'react';
2
+ import { DialogParts } from '../Dialog';
3
+ import { SheetProps } from './Sheet.types';
4
+ /**
5
+ * Тип составного компонента `Sheet` — по аналогии с `Modal`: без служебных
6
+ * полей `ForwardRefExoticComponent` в автодополнении `<Sheet.`.
7
+ *
8
+ * `Header` / `Main` / `Footer` — те же компоненты, что `Modal.Header` /
9
+ * `Modal.Main` / `Modal.Footer` (общие части диалогов, см. `../Dialog`).
10
+ */
11
+ type SheetComponent = ((props: SheetProps & RefAttributes<HTMLDivElement>) => ReactNode) & DialogParts;
12
+ declare const SheetWithSubComponents: SheetComponent;
13
+ export { SheetWithSubComponents as Sheet };
14
+ export type { DialogFooterProps as SheetFooterProps, DialogHeaderProps as SheetHeaderProps, DialogMainProps as SheetMainProps, } from '../Dialog';
15
+ export type { SheetPosition, SheetProps, SheetSizeMode } from './Sheet.types';
@@ -0,0 +1,9 @@
1
+ import { Sheet as t } from "./Sheet.js";
2
+ import { dialogParts as e } from "../Dialog/Dialog.parts.js";
3
+ const s = Object.assign(
4
+ t,
5
+ e
6
+ );
7
+ export {
8
+ s as Sheet
9
+ };
@@ -0,0 +1,17 @@
1
+ import { SheetPosition, SheetSizing } from './Sheet.types';
2
+ /** Стили, зависящие от позиции: прижатие к краю, скругления, ручка, размеры */
3
+ export declare const positionStyles: Record<SheetPosition, {
4
+ panel: string;
5
+ handle: string;
6
+ handleBar: string;
7
+ sizing: Record<SheetSizing, string>;
8
+ }>;
9
+ export declare const styles: {
10
+ root: string;
11
+ rootClosing: string;
12
+ backdrop: string;
13
+ panel: string;
14
+ content: string;
15
+ handle: string;
16
+ handleBar: string;
17
+ };
@@ -0,0 +1,135 @@
1
+ import { css as o } from "@emotion/css";
2
+ import { SHEET_HANDLE_HEIGHT as n, SHEET_OVERDRAG_LIMIT as a, SHEET_SNAP_POINT_VAR as i } from "./Sheet.const.js";
3
+ import { getDialogPartSelector as r } from "../Dialog/Dialog.const.js";
4
+ import { theme as t } from "../../../utils/theme/index.js";
5
+ const e = "env(safe-area-inset-top, 0px)", l = "env(safe-area-inset-bottom, 0px)", c = {
6
+ content: o({
7
+ maxHeight: [
8
+ `calc(100vh - ${e})`,
9
+ `calc(100dvh - ${e})`
10
+ ]
11
+ }),
12
+ full: o({
13
+ height: ["100vh", "100dvh"],
14
+ paddingTop: e,
15
+ borderRadius: 0
16
+ }),
17
+ // Значение с var() браузер не отбросит при разборе даже без поддержки dvh,
18
+ // поэтому фолбэк через @supports, а не повтором свойства
19
+ snap: o({
20
+ height: `calc(var(${i}) * (100vh - ${e}))`,
21
+ "@supports (height: 100dvh)": {
22
+ height: `calc(var(${i}) * (100dvh - ${e}))`
23
+ }
24
+ })
25
+ }, f = {
26
+ bottom: {
27
+ panel: o({
28
+ right: 0,
29
+ bottom: 0,
30
+ left: 0,
31
+ flexDirection: "column",
32
+ paddingBottom: l,
33
+ borderTopLeftRadius: t.cornerRadius.md,
34
+ borderTopRightRadius: t.cornerRadius.md,
35
+ boxShadow: `0 -4px 20px 0 ${t.color.effect.shadow_s}`,
36
+ // Продолжение фона за нижним краем: при перетягивании вверх за открытое
37
+ // положение («резинка») у края экрана не появляется просвет. Нахлёст
38
+ // в 1px убирает шов на дробных смещениях
39
+ "&::after": {
40
+ content: '""',
41
+ position: "absolute",
42
+ top: "calc(100% - 1px)",
43
+ right: 0,
44
+ left: 0,
45
+ height: a + 1,
46
+ backgroundColor: "inherit"
47
+ }
48
+ }),
49
+ handle: o({
50
+ alignItems: "flex-start",
51
+ paddingTop: t.spacing.sm
52
+ }),
53
+ handleBar: o({
54
+ width: 36,
55
+ height: 4
56
+ }),
57
+ sizing: c
58
+ }
59
+ }, u = {
60
+ root: o({
61
+ position: "fixed",
62
+ top: 0,
63
+ right: 0,
64
+ bottom: 0,
65
+ left: 0,
66
+ zIndex: 1
67
+ }),
68
+ // Пока Sheet уезжает, страница под ним уже доступна для кликов
69
+ rootClosing: o({
70
+ pointerEvents: "none"
71
+ }),
72
+ backdrop: o({
73
+ position: "absolute",
74
+ top: 0,
75
+ right: 0,
76
+ bottom: 0,
77
+ left: 0,
78
+ backgroundColor: t.color.fill.bg_overlay_primary,
79
+ backdropFilter: "blur(5px)"
80
+ }),
81
+ panel: o({
82
+ position: "absolute",
83
+ display: "flex",
84
+ outline: "none",
85
+ // Шапка — зона перетаскивания: жест не прокручивает страницу и не выделяет текст
86
+ [`& ${r("header")}`]: {
87
+ touchAction: "none",
88
+ userSelect: "none"
89
+ },
90
+ // Main занимает свободное место (в режимах full и snap футер прижат к низу)
91
+ // и не передаёт прокрутку странице, когда доходит до края
92
+ [`& ${r("main")}`]: {
93
+ flex: "1 1 auto",
94
+ overscrollBehavior: "contain"
95
+ },
96
+ // У футера `flex: 1` (Box): у Modal высота по контенту и это незаметно,
97
+ // у Sheet высота бывает фиксированной — футер не растягиваем
98
+ [`& ${r("footer")}`]: {
99
+ flex: "0 0 auto"
100
+ }
101
+ }),
102
+ // Первым сжимается Main. Если шапка и футер всё равно не помещаются
103
+ // (мелкая точка фиксации, низкий экран в landscape), прокручивается всё
104
+ // содержимое — футер остаётся достижимым
105
+ content: o({
106
+ display: "flex",
107
+ flex: "1 1 auto",
108
+ flexDirection: "column",
109
+ minWidth: 0,
110
+ minHeight: 0,
111
+ overflowX: "hidden",
112
+ overflowY: "auto",
113
+ overscrollBehavior: "contain"
114
+ }),
115
+ handle: o({
116
+ display: "flex",
117
+ flexShrink: 0,
118
+ justifyContent: "center",
119
+ height: n,
120
+ cursor: "grab",
121
+ touchAction: "none",
122
+ userSelect: "none",
123
+ "&:active": {
124
+ cursor: "grabbing"
125
+ }
126
+ }),
127
+ handleBar: o({
128
+ borderRadius: t.cornerRadius.fullRound,
129
+ backgroundColor: t.color.icon.tertiary
130
+ })
131
+ };
132
+ export {
133
+ f as positionStyles,
134
+ u as styles
135
+ };
@@ -1,25 +1,25 @@
1
- import { jsx as o, jsxs as H } from "react/jsx-runtime";
2
- import { cx as p, css as b } from "@emotion/css";
3
- import { useReactTable as Pe, getPaginationRowModel as Me, getSortedRowModel as Ne, getCoreRowModel as _e, flexRender as P, createColumnHelper as ke } from "@tanstack/react-table";
4
- import { useMemo as ze, useImperativeHandle as Ie } from "react";
5
- import Ve from "../../../assets/svg/table/search.svg.js";
1
+ import { jsx as o, jsxs as N } from "react/jsx-runtime";
2
+ import { cx as h, css as u } from "@emotion/css";
3
+ import { useReactTable as ve, getPaginationRowModel as Pe, getSortedRowModel as Me, getCoreRowModel as Ee, flexRender as v, createColumnHelper as Ie } from "@tanstack/react-table";
4
+ import { useMemo as ke, useImperativeHandle as ze } from "react";
5
+ import De from "../../../assets/svg/table/search.svg.js";
6
6
  import { typography as Le } from "../../../styles/utils/typography.js";
7
- import { useControllableState as m } from "./Table.hooks.js";
8
- import { getColumnPinningStyles as f } from "./Table.utils.js";
9
- import { TablePlaceholder as We } from "./TablePlaceholder/TablePlaceholder.js";
10
- import { TableWrapper as Ee } from "./TableWrapper/TableWrapper.js";
11
- import { TableHeadRow as Fe } from "./TableHeadRow/TableHeadRow.js";
12
- import { TablePagination as je } from "./TablePagination/TablePagination.js";
13
- import { TableHeadCell as Be } from "./TableHeadCell/TableHeadCell.js";
14
- import { TableBodyCell as De } from "./TableBodyCell/TableBodyCell.js";
7
+ import { useControllableState as r } from "./Table.hooks.js";
8
+ import { getColumnPinningStyles as b } from "./Table.utils.js";
9
+ import { TablePlaceholder as Ve } from "./TablePlaceholder/TablePlaceholder.js";
10
+ import { TableWrapper as We } from "./TableWrapper/TableWrapper.js";
11
+ import { TableHeadRow as Be } from "./TableHeadRow/TableHeadRow.js";
12
+ import { TablePagination as Fe } from "./TablePagination/TablePagination.js";
13
+ import { TableHeadCell as $e } from "./TableHeadCell/TableHeadCell.js";
14
+ import { TableBodyCell as je } from "./TableBodyCell/TableBodyCell.js";
15
15
  import { TableBodyRow as Ae } from "./TableBodyRow/TableBodyRow.js";
16
- import { TableBodyCellContent as _ } from "./TableBodyCellContent/TableBodyCellContent.js";
16
+ import { TableBodyCellContent as E } from "./TableBodyCellContent/TableBodyCellContent.js";
17
17
  import { Skeleton as Ke } from "../../shared/Skeleton/Skeleton.js";
18
18
  import { TableHeadCellContent as Oe } from "./TableHeadCellContent/TableHeadCellContent.js";
19
- import { TableHeadCellContentSortable as $e } from "./TableHeadCellContentSortable/TableHeadCellContentSortable.js";
20
- import { theme as qe } from "../../../utils/theme/index.js";
21
- import { Box as Ge } from "../Box/Box.js";
22
- const { spacing: M, color: l } = qe, Je = b({
19
+ import { TableHeadCellContentSortable as Ge } from "./TableHeadCellContentSortable/TableHeadCellContentSortable.js";
20
+ import { theme as Ue } from "../../../utils/theme/index.js";
21
+ import { Box as qe } from "../Box/Box.js";
22
+ const { spacing: P, color: n } = Ue, Je = u({
23
23
  ...Le.body2,
24
24
  fontWeight: 500,
25
25
  width: "100%",
@@ -27,36 +27,36 @@ const { spacing: M, color: l } = qe, Je = b({
27
27
  minWidth: "max-content",
28
28
  borderCollapse: "collapse",
29
29
  borderSpacing: 0,
30
- backgroundColor: l.fill.bg_primary
31
- }), Qe = b({
32
- backgroundColor: l.fill.bg_secondary,
33
- color: l.text.tertiary
34
- }), Ue = b({
30
+ backgroundColor: n.fill.bg_primary
31
+ }), Qe = u({
32
+ backgroundColor: n.fill.bg_secondary,
33
+ color: n.text.tertiary
34
+ }), Xe = u({
35
35
  pointerEvents: "none",
36
36
  userSelect: "none"
37
- }), N = ["70%", "55%", "80%", "60%"], c = ({
38
- ref: k,
39
- data: h,
40
- columns: u,
41
- showBorders: g = !0,
42
- enableSorting: z = !1,
43
- enablePagination: S = !1,
44
- enableRowSelection: I = !1,
45
- enableMultiRowSelection: V = !1,
46
- enableColumnPinning: d = !1,
37
+ }), M = ["70%", "55%", "80%", "60%"], Ye = `linear-gradient(${n.fill.accent_tint_low}, ${n.fill.accent_tint_low}), ${n.fill.bg_primary}`, m = ({
38
+ ref: I,
39
+ data: C,
40
+ columns: S,
41
+ showBorders: c = !0,
42
+ enableSorting: k = !1,
43
+ enablePagination: y = !1,
44
+ enableRowSelection: z = !1,
45
+ enableMultiRowSelection: D = !1,
46
+ enableColumnPinning: g = !1,
47
47
  columnPinning: L,
48
- onColumnPinningChange: W,
49
- sorting: E,
50
- onSortingChange: F,
51
- manualSorting: j,
52
- columnFilters: B,
53
- onColumnFiltersChange: D,
48
+ onColumnPinningChange: V,
49
+ sorting: W,
50
+ onSortingChange: B,
51
+ manualSorting: F,
52
+ columnFilters: $,
53
+ onColumnFiltersChange: j,
54
54
  columnVisibility: A,
55
55
  onColumnVisibilityChange: K,
56
56
  pagination: O,
57
- onPaginationChange: $,
58
- rowSelection: q,
59
- onRowSelectionChange: G,
57
+ onPaginationChange: G,
58
+ rowSelection: U,
59
+ onRowSelectionChange: q,
60
60
  totalCount: s,
61
61
  loading: i = !1,
62
62
  loadingRowCount: J = 10,
@@ -65,199 +65,203 @@ const { spacing: M, color: l } = qe, Je = b({
65
65
  description: "Try adjusting your search or filters",
66
66
  action: "Reset"
67
67
  },
68
- className: U,
69
- containerClassName: y,
70
- theadClassName: X,
71
- tbodyClassName: Y,
72
- emptyStateClassName: Z,
73
- emptyStateTitleClassName: ee,
74
- emptyStateDescriptionClassName: oe,
68
+ className: X,
69
+ containerClassName: w,
70
+ theadClassName: Y,
71
+ tbodyClassName: Z,
72
+ emptyStateClassName: ee,
73
+ emptyStateTitleClassName: oe,
74
+ emptyStateDescriptionClassName: te,
75
75
  paginationClassName: ne,
76
- tableOptions: te = {},
77
- onRowClick: w,
78
- getRowId: le,
79
- headCellComponent: ie = Be,
80
- bodyCellComponent: x = De,
81
- headRowComponent: ae = Fe,
82
- bodyRowComponent: R = Ae,
83
- onReset: re,
76
+ tableOptions: le = {},
77
+ onRowClick: R,
78
+ getRowId: ie,
79
+ headCellComponent: ae = $e,
80
+ bodyCellComponent: T = je,
81
+ headRowComponent: re = Be,
82
+ bodyRowComponent: x = Ae,
83
+ onReset: se,
84
84
  paginationVariant: me,
85
- paginationLabels: se,
86
- renderPageSizeSelectorDropdownItem: ce,
87
- renderPageSizeSelectorInputItem: ge
85
+ paginationLabels: ce,
86
+ renderPageSizeSelectorDropdownItem: ge,
87
+ renderPageSizeSelectorInputItem: de
88
88
  }) => {
89
- const [de, pe] = m(
90
- E,
91
- F,
92
- []
93
- ), [he, Ce] = m(
89
+ const [pe, he] = r(
90
+ W,
94
91
  B,
95
- D,
96
92
  []
97
- ), [fe, be] = m(
93
+ ), [Ce, fe] = r(
94
+ $,
95
+ j,
96
+ []
97
+ ), [be, ue] = r(
98
98
  A,
99
99
  K,
100
100
  {}
101
- ), [a, C] = m(
101
+ ), [a, f] = r(
102
102
  O,
103
- $,
103
+ G,
104
104
  { pageIndex: 0, pageSize: 10 }
105
- ), [ue, Se] = m(q, G, {}), [ye, we] = m(
105
+ ), [Se, ye] = r(U, q, {}), [we, Re] = r(
106
106
  L,
107
- W,
107
+ V,
108
108
  { left: [], right: [] }
109
- ), T = j ?? !!s, xe = ze(
110
- () => u.map((e) => ({
109
+ ), _ = F ?? !!s, Te = ke(
110
+ () => S.map((e) => ({
111
111
  enableSorting: !1,
112
112
  ...e
113
113
  })),
114
- [u]
115
- ), t = Pe({
116
- data: h,
117
- columns: xe,
114
+ [S]
115
+ ), l = ve({
116
+ data: C,
117
+ columns: Te,
118
118
  state: {
119
- sorting: de,
120
- columnFilters: he,
121
- columnVisibility: fe,
119
+ sorting: pe,
120
+ columnFilters: Ce,
121
+ columnVisibility: be,
122
122
  pagination: a,
123
- rowSelection: ue,
124
- columnPinning: ye
123
+ rowSelection: Se,
124
+ columnPinning: we
125
125
  },
126
- onSortingChange: pe,
127
- onColumnFiltersChange: Ce,
128
- onColumnVisibilityChange: be,
129
- onPaginationChange: C,
130
- onRowSelectionChange: Se,
131
- onColumnPinningChange: we,
132
- getCoreRowModel: _e(),
133
- getSortedRowModel: z && !T ? Ne() : void 0,
134
- getPaginationRowModel: S ? Me() : void 0,
135
- enableRowSelection: I,
136
- enableMultiRowSelection: V,
137
- enableColumnPinning: d,
138
- getRowId: le,
139
- manualSorting: T,
126
+ onSortingChange: he,
127
+ onColumnFiltersChange: fe,
128
+ onColumnVisibilityChange: ue,
129
+ onPaginationChange: f,
130
+ onRowSelectionChange: ye,
131
+ onColumnPinningChange: Re,
132
+ getCoreRowModel: Ee(),
133
+ getSortedRowModel: k && !_ ? Me() : void 0,
134
+ getPaginationRowModel: y ? Pe() : void 0,
135
+ enableRowSelection: z,
136
+ enableMultiRowSelection: D,
137
+ enableColumnPinning: g,
138
+ getRowId: ie,
139
+ manualSorting: _,
140
140
  manualPagination: !!s,
141
141
  pageCount: s ? Math.ceil(s / a.pageSize) : void 0,
142
- ...te
142
+ ...le
143
143
  });
144
- Ie(k, () => t);
145
- const { rows: v } = t.getRowModel(), Re = (e, n) => {
146
- w && w(e.original, n);
147
- }, Te = (e) => /* @__PURE__ */ o(
148
- ie,
144
+ ze(I, () => l);
145
+ const { rows: H } = l.getRowModel(), xe = (e, t) => {
146
+ R && R(e.original, t);
147
+ }, _e = (e) => /* @__PURE__ */ o(
148
+ ae,
149
149
  {
150
150
  style: {
151
151
  width: e.getSize(),
152
- ...d && f(
153
- t,
152
+ ...g && b(
153
+ l,
154
154
  e.column,
155
- l.fill.bg_secondary
155
+ n.fill.bg_secondary
156
156
  )
157
157
  },
158
158
  onClick: i ? void 0 : e.column.getToggleSortingHandler(),
159
- children: e.isPlaceholder ? null : P(e.column.columnDef.header, e.getContext())
160
- },
161
- e.id
162
- ), ve = (e, n) => /* @__PURE__ */ o(
163
- R,
164
- {
165
- showBorders: g,
166
- onClick: () => Re(e, n),
167
- children: e.getVisibleCells().map((r) => /* @__PURE__ */ o(
168
- x,
169
- {
170
- style: d ? f(
171
- t,
172
- r.column,
173
- l.fill.bg_primary
174
- ) : void 0,
175
- children: P(r.column.columnDef.cell, r.getContext())
176
- },
177
- r.id
178
- ))
159
+ children: e.isPlaceholder ? null : v(e.column.columnDef.header, e.getContext())
179
160
  },
180
161
  e.id
181
- ), He = (e) => /* @__PURE__ */ o(
182
- R,
162
+ ), He = (e, t) => {
163
+ const d = e.getIsSelected();
164
+ return /* @__PURE__ */ o(
165
+ x,
166
+ {
167
+ showBorders: c,
168
+ selected: d,
169
+ onClick: () => xe(e, t),
170
+ children: e.getVisibleCells().map((p) => /* @__PURE__ */ o(
171
+ T,
172
+ {
173
+ style: g ? b(
174
+ l,
175
+ p.column,
176
+ d ? Ye : n.fill.bg_primary
177
+ ) : void 0,
178
+ children: v(p.column.columnDef.cell, p.getContext())
179
+ },
180
+ p.id
181
+ ))
182
+ },
183
+ e.id
184
+ );
185
+ }, Ne = (e) => /* @__PURE__ */ o(
186
+ x,
183
187
  {
184
- showBorders: g,
185
- children: t.getVisibleLeafColumns().map((n, r) => /* @__PURE__ */ o(
186
- x,
188
+ showBorders: c,
189
+ children: l.getVisibleLeafColumns().map((t, d) => /* @__PURE__ */ o(
190
+ T,
187
191
  {
188
- style: d ? f(t, n, l.fill.bg_primary) : void 0,
189
- children: /* @__PURE__ */ o(_, { children: /* @__PURE__ */ o(
192
+ style: g ? b(l, t, n.fill.bg_primary) : void 0,
193
+ children: /* @__PURE__ */ o(E, { children: /* @__PURE__ */ o(
190
194
  Ke,
191
195
  {
192
196
  variant: "text",
193
197
  height: 16,
194
- width: N[r % N.length]
198
+ width: M[d % M.length]
195
199
  }
196
200
  ) })
197
201
  },
198
- n.id
202
+ t.id
199
203
  ))
200
204
  },
201
205
  `skeleton-row-${e}`
202
206
  );
203
- return !i && !v.length ? /* @__PURE__ */ o(
204
- We,
207
+ return !i && !H.length ? /* @__PURE__ */ o(
208
+ Ve,
205
209
  {
206
210
  icon: /* @__PURE__ */ o(
207
- Ve,
211
+ De,
208
212
  {
209
213
  width: 24,
210
214
  height: 24,
211
- style: { color: l.icon.tertiary, marginBottom: M.sm }
215
+ style: { color: n.icon.tertiary, marginBottom: P.sm }
212
216
  }
213
217
  ),
214
218
  labels: Q,
215
- onReset: re,
216
- className: p(y, Z),
217
- titleClassName: ee,
218
- descriptionClassName: oe
219
+ onReset: se,
220
+ className: h(w, ee),
221
+ titleClassName: oe,
222
+ descriptionClassName: te
219
223
  }
220
- ) : /* @__PURE__ */ H(Ge, { w: "full", gap: M.xl, className: p(y), children: [
221
- /* @__PURE__ */ o(Ee, { data: h, showBorders: g, children: /* @__PURE__ */ H("table", { className: p(Je, U), children: [
224
+ ) : /* @__PURE__ */ N(qe, { w: "full", gap: P.xl, className: h(w), children: [
225
+ /* @__PURE__ */ o(We, { data: C, showBorders: c, children: /* @__PURE__ */ N("table", { className: h(Je, X), children: [
222
226
  /* @__PURE__ */ o(
223
227
  "thead",
224
228
  {
225
- className: p(
229
+ className: h(
226
230
  Qe,
227
- { [Ue]: i },
228
- X
231
+ { [Xe]: i },
232
+ Y
229
233
  ),
230
234
  "aria-busy": i,
231
- children: t.getHeaderGroups().map((e) => /* @__PURE__ */ o(ae, { showBorders: g, children: e.headers.map(Te) }, e.id))
235
+ children: l.getHeaderGroups().map((e) => /* @__PURE__ */ o(re, { showBorders: c, children: e.headers.map(_e) }, e.id))
232
236
  }
233
237
  ),
234
- /* @__PURE__ */ o("tbody", { className: Y, children: i ? Array.from(
238
+ /* @__PURE__ */ o("tbody", { className: Z, children: i ? Array.from(
235
239
  { length: J },
236
- (e, n) => He(n)
237
- ) : v.map((e, n) => ve(e, n)) })
240
+ (e, t) => Ne(t)
241
+ ) : H.map((e, t) => He(e, t)) })
238
242
  ] }) }),
239
- S && !i && /* @__PURE__ */ o(
240
- je,
243
+ y && !i && /* @__PURE__ */ o(
244
+ Fe,
241
245
  {
242
246
  pageIndex: a.pageIndex,
243
247
  pageSize: a.pageSize,
244
- totalCount: s || h.length,
248
+ totalCount: s || C.length,
245
249
  variant: me,
246
- labels: se,
247
- renderPageSizeSelectorDropdownItem: ce,
248
- renderPageSizeSelectorInputItem: ge,
249
- onPageChange: (e) => C({ ...a, pageIndex: e }),
250
- onPageSizeChange: (e) => C({ ...a, pageSize: e, pageIndex: 0 }),
250
+ labels: ce,
251
+ renderPageSizeSelectorDropdownItem: ge,
252
+ renderPageSizeSelectorInputItem: de,
253
+ onPageChange: (e) => f({ ...a, pageIndex: e }),
254
+ onPageSizeChange: (e) => f({ ...a, pageSize: e, pageIndex: 0 }),
251
255
  className: ne
252
256
  }
253
257
  )
254
258
  ] });
255
259
  };
256
- c.displayName = "Table";
257
- c.HeadCellContent = Oe;
258
- c.BodyCellContent = _;
259
- c.HeadCellContentSortable = $e;
260
- c.createColumnHelper = ke;
260
+ m.displayName = "Table";
261
+ m.HeadCellContent = Oe;
262
+ m.BodyCellContent = E;
263
+ m.HeadCellContentSortable = Ge;
264
+ m.createColumnHelper = Ie;
261
265
  export {
262
- c as Table
266
+ m as Table
263
267
  };
@@ -128,7 +128,11 @@ export interface TableProps<TData> {
128
128
  bodyCellComponent?: ComponentType<TableBodyCellProps>;
129
129
  /** Компонент для строки заголовка */
130
130
  headRowComponent?: ComponentType<TableHeadRowProps>;
131
- /** Компонент для строки тела */
131
+ /**
132
+ * Компонент для строки тела. Выбранные строки (`row.getIsSelected()`)
133
+ * подсвечиваются автоматически; в кастомный компонент признак выбранной
134
+ * строки приходит пропсом `selected`.
135
+ */
132
136
  bodyRowComponent?: ComponentType<TableBodyRowProps>;
133
137
  /** Callback при сбросе фильтров */
134
138
  onReset?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -4,5 +4,10 @@ export interface TableBodyRowProps extends React.HTMLAttributes<HTMLTableRowElem
4
4
  * @default false
5
5
  */
6
6
  showBorders?: boolean;
7
+ /**
8
+ * Подсвечивать ли строку как выбранную
9
+ * @default false
10
+ */
11
+ selected?: boolean;
7
12
  }
8
13
  export declare const TableBodyRow: import('react').ForwardRefExoticComponent<TableBodyRowProps & import('react').RefAttributes<HTMLTableRowElement>>;