@max-ts/kit 1.5.2 → 1.6.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/lib/components/ContentState/ContentState.d.ts +3 -34
  2. package/lib/components/ContentState/ContentState.d.ts.map +1 -1
  3. package/lib/components/ContentState/styles.css.d.ts +2 -1
  4. package/lib/components/ContentState/styles.css.d.ts.map +1 -1
  5. package/lib/components/ContentState/types.d.ts +14 -23
  6. package/lib/components/ContentState/types.d.ts.map +1 -1
  7. package/lib/components/DataGrid/Body/Body.d.ts +1 -1
  8. package/lib/components/DataGrid/Body/Body.d.ts.map +1 -1
  9. package/lib/components/DataGrid/DataGrid.d.ts +9 -6
  10. package/lib/components/DataGrid/DataGrid.d.ts.map +1 -1
  11. package/lib/components/DataGrid/Header/Header.d.ts +4 -2
  12. package/lib/components/DataGrid/Header/Header.d.ts.map +1 -1
  13. package/lib/components/DataGrid/HeaderCell/HeaderCell.d.ts +4 -2
  14. package/lib/components/DataGrid/HeaderCell/HeaderCell.d.ts.map +1 -1
  15. package/lib/components/DataGrid/State/State.d.ts +5 -5
  16. package/lib/components/DataGrid/State/State.d.ts.map +1 -1
  17. package/lib/components/DataGrid/State/styles.css.d.ts +2 -1
  18. package/lib/components/DataGrid/State/styles.css.d.ts.map +1 -1
  19. package/lib/components/DataGrid/types.d.ts +13 -6
  20. package/lib/components/DataGrid/types.d.ts.map +1 -1
  21. package/lib/components/DataGridSortHeader/DataGridSortHeader.d.ts +3 -2
  22. package/lib/components/DataGridSortHeader/DataGridSortHeader.d.ts.map +1 -1
  23. package/lib/components/DataGridSortHeader/types.d.ts +1 -4
  24. package/lib/components/DataGridSortHeader/types.d.ts.map +1 -1
  25. package/lib/components/DataList/DataList.d.ts +3 -3
  26. package/lib/components/DataList/DataList.d.ts.map +1 -1
  27. package/lib/components/Select/styles.css.d.ts.map +1 -1
  28. package/lib/components/Spinner/Spinner.d.ts +6 -0
  29. package/lib/components/Spinner/Spinner.d.ts.map +1 -0
  30. package/lib/components/Spinner/index.d.ts +2 -0
  31. package/lib/components/Spinner/index.d.ts.map +1 -0
  32. package/lib/components/Spinner/styles.css.d.ts +2 -0
  33. package/lib/components/Spinner/styles.css.d.ts.map +1 -0
  34. package/lib/components/index.d.ts +1 -0
  35. package/lib/components/index.d.ts.map +1 -1
  36. package/lib/index.mjs +364 -256
  37. package/lib/stories/ContentState.stories.d.ts +14 -0
  38. package/lib/stories/ContentState.stories.d.ts.map +1 -0
  39. package/lib/stories/DataGrid.stories.d.ts.map +1 -1
  40. package/lib/stories/DataList.stories.d.ts +1 -1
  41. package/lib/stories/Spinner.stories.d.ts +13 -0
  42. package/lib/stories/Spinner.stories.d.ts.map +1 -0
  43. package/lib/styles.css +208 -177
  44. package/package.json +1 -1
package/lib/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Accordion, Checkbox } from "@base-ui/react";
3
3
  import clsx_0, { clsx } from "clsx";
4
- import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, ArrowLeft, ArrowRight, Calendar1, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, CircleCheck, CircleIcon, Copy, Ellipsis as external_lucide_react_Ellipsis, EllipsisVertical, Info, MoreHorizontalIcon, OctagonAlert, PanelLeftIcon, TriangleAlert, XIcon } from "lucide-react";
4
+ import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, ArrowLeft, ArrowRight, Calendar1, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, CircleCheck, CircleIcon, Copy, Ellipsis as external_lucide_react_Ellipsis, EllipsisVertical, Info, Loader, MoreHorizontalIcon, OctagonAlert, PanelLeftIcon, TriangleAlert, XIcon } from "lucide-react";
5
5
  import { AlertDialog } from "@base-ui/react/alert-dialog";
6
6
  import { Button } from "@base-ui/react/button";
7
- import react, { createContext, createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
7
+ import react, { Component as external_react_Component, createContext, createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
8
8
  import { Combobox } from "@base-ui/react/combobox";
9
9
  import { Avatar } from "@base-ui/react/avatar";
10
10
  import { mergeProps } from "@base-ui/react/merge-props";
@@ -1752,124 +1752,153 @@ const ConfirmAction = (props)=>{
1752
1752
  ]
1753
1753
  });
1754
1754
  };
1755
- var sizes = {
1756
- small: 'small__1o97kvm1',
1757
- medium: 'medium__1o97kvm2',
1758
- large: 'large__1o97kvm3'
1755
+ var Empty_styles_css_content = 'style__e4li7y7';
1756
+ var Empty_styles_css_description = 'style__e4li7y6';
1757
+ var Empty_styles_css_header = 'style__e4li7y1';
1758
+ var styles_css_media = 'style__e4li7y2';
1759
+ var mediaVariants = {
1760
+ default: 'default__e4li7y3',
1761
+ icon: 'icon__e4li7y4'
1759
1762
  };
1760
- var styles_css_wrapper = 'style__1o97kvm0';
1761
- const Image_Image = (props)=>/*#__PURE__*/ jsx("img", {
1762
- alt: props.alt,
1763
- src: props.src,
1764
- className: clsx_0(styles_css_wrapper, sizes[props.size || 'medium'], props.className),
1765
- width: props.width,
1766
- height: props.height
1763
+ var Empty_styles_css_root = 'style__e4li7y0';
1764
+ var Empty_styles_css_title = 'style__e4li7y5';
1765
+ function Empty_Empty({ className, ...props }) {
1766
+ return /*#__PURE__*/ jsx("div", {
1767
+ "data-slot": "empty",
1768
+ className: clsx(Empty_styles_css_root, className),
1769
+ ...props
1767
1770
  });
1768
- const SIZE = {
1769
- small: 'small',
1770
- medium: 'medium',
1771
- large: 'large'
1772
- };
1773
- const IMAGE_WIDTH = {
1774
- [SIZE.small]: '239px',
1775
- [SIZE.medium]: '323px',
1776
- [SIZE.large]: '458px'
1777
- };
1778
- const IMAGE_HEIGHT = {
1779
- [SIZE.small]: '119px',
1780
- [SIZE.medium]: '161px',
1781
- [SIZE.large]: '229px'
1782
- };
1783
- const MAX_INNER_WIDTH = {
1784
- [SIZE.small]: '384px',
1785
- [SIZE.medium]: '400px',
1786
- [SIZE.large]: '460px'
1787
- };
1788
- const TITLE_HEADER_LEVEL = {
1789
- [SIZE.small]: 'subtitle1',
1790
- [SIZE.medium]: 'h6',
1791
- [SIZE.large]: 'h5'
1792
- };
1793
- var descriptionClass = 'style__1nenzg05';
1794
- var footerClass = 'style__1nenzg06';
1795
- var innerContainer = 'style__1nenzg04';
1796
- var styles_css_sizes = {
1797
- small: 'small__1nenzg01',
1798
- medium: 'medium__1nenzg02',
1799
- large: 'large__1nenzg03'
1800
- };
1801
- var Placeholder_styles_css_wrapper = 'style__1nenzg00';
1802
- const Placeholder = ({ className, title, imgSrc, imgAlt, description, actions, size = 'small', renderImage })=>{
1803
- const RenderImage = useMemo(()=>renderImage || Image_Image, [
1804
- renderImage
1805
- ]);
1806
- return /*#__PURE__*/ jsxs("div", {
1807
- className: clsx_0(Placeholder_styles_css_wrapper, styles_css_sizes[size], className),
1808
- children: [
1809
- /*#__PURE__*/ jsxs("div", {
1810
- className: innerContainer,
1811
- style: {
1812
- maxWidth: MAX_INNER_WIDTH[size]
1813
- },
1814
- children: [
1815
- imgSrc && /*#__PURE__*/ jsx(RenderImage, {
1816
- src: imgSrc,
1817
- alt: imgAlt,
1818
- width: IMAGE_WIDTH[size],
1819
- height: IMAGE_HEIGHT[size],
1820
- size: size
1821
- }),
1822
- /*#__PURE__*/ jsx(Typography, {
1823
- align: "center",
1824
- color: "secondary",
1825
- variant: TITLE_HEADER_LEVEL[size],
1826
- children: title
1827
- }),
1828
- description && /*#__PURE__*/ jsx(Typography, {
1829
- className: descriptionClass,
1830
- component: "div",
1831
- variant: "body1",
1832
- children: description
1833
- })
1834
- ]
1835
- }),
1836
- actions && /*#__PURE__*/ jsx("footer", {
1837
- className: footerClass,
1838
- children: actions
1839
- })
1840
- ]
1771
+ }
1772
+ function Empty_Header({ className, ...props }) {
1773
+ return /*#__PURE__*/ jsx("div", {
1774
+ "data-slot": "empty-header",
1775
+ className: clsx(Empty_styles_css_header, className),
1776
+ ...props
1777
+ });
1778
+ }
1779
+ function Empty_Media({ className, variant = 'default', ...props }) {
1780
+ return /*#__PURE__*/ jsx("div", {
1781
+ "data-slot": "empty-media",
1782
+ "data-variant": variant,
1783
+ className: clsx(styles_css_media, mediaVariants[variant], className),
1784
+ ...props
1785
+ });
1786
+ }
1787
+ function Empty_Title({ className, ...props }) {
1788
+ return /*#__PURE__*/ jsx("div", {
1789
+ "data-slot": "empty-title",
1790
+ className: clsx(Empty_styles_css_title, className),
1791
+ ...props
1792
+ });
1793
+ }
1794
+ function Empty_Description({ className, ...props }) {
1795
+ return /*#__PURE__*/ jsx("div", {
1796
+ "data-slot": "empty-description",
1797
+ className: clsx(Empty_styles_css_description, className),
1798
+ ...props
1841
1799
  });
1800
+ }
1801
+ function Empty_Content({ className, ...props }) {
1802
+ return /*#__PURE__*/ jsx("div", {
1803
+ "data-slot": "empty-content",
1804
+ className: clsx(Empty_styles_css_content, className),
1805
+ ...props
1806
+ });
1807
+ }
1808
+ Empty_Empty.Header = Empty_Header;
1809
+ Empty_Empty.Media = Empty_Media;
1810
+ Empty_Empty.Title = Empty_Title;
1811
+ Empty_Empty.Description = Empty_Description;
1812
+ Empty_Empty.Content = Empty_Content;
1813
+ var Spinner_styles_css_root = 'style__1dbefg91';
1814
+ function Spinner({ className, role = 'status', 'aria-label': ariaLabel = 'Loading', ...props }) {
1815
+ return /*#__PURE__*/ jsx(Loader, {
1816
+ role: role,
1817
+ "aria-label": ariaLabel,
1818
+ className: clsx(Spinner_styles_css_root, className),
1819
+ ...props
1820
+ });
1821
+ }
1822
+ var errorImage = 'style__nan0ao1';
1823
+ var styles_css_state = 'style__nan0ao0';
1824
+ const DEFAULT_ERROR_STATE = {
1825
+ title: 'Произошла ошибка',
1826
+ message: 'Не удалось загрузить данные.'
1842
1827
  };
1843
- var loadingContainer = 'style__nan0ao0';
1844
- const ContentState = ({ isLoading, isError, isCustom, errorState, customState, children, loadingContent: LoadingContent = /*#__PURE__*/ jsx(CircularProgress, {
1845
- color: "primary"
1846
- }) })=>{
1847
- if (isLoading) return /*#__PURE__*/ jsx("div", {
1848
- className: loadingContainer,
1849
- children: LoadingContent
1850
- });
1851
- if (isCustom && customState) return /*#__PURE__*/ jsx(Placeholder, {
1852
- ...customState
1853
- });
1854
- if (isError && errorState) {
1855
- const { title = 'Произошла ошибка', imgAlt, imgSrc, errorList, onRetry, actions = /*#__PURE__*/ jsx(Button_Button, {
1856
- onClick: onRetry,
1857
- children: "Попробовать снова"
1858
- }) } = errorState;
1859
- const description = errorList.map((errorMessage)=>/*#__PURE__*/ jsx(Typography, {
1860
- component: "p",
1861
- children: errorMessage
1862
- }, errorMessage));
1863
- return /*#__PURE__*/ jsx(Placeholder, {
1864
- title: title,
1865
- description: description,
1866
- imgAlt: imgAlt,
1867
- imgSrc: imgSrc,
1868
- actions: actions
1828
+ class ErrorBoundary extends external_react_Component {
1829
+ state = {
1830
+ hasError: false
1831
+ };
1832
+ static getDerivedStateFromError() {
1833
+ return {
1834
+ hasError: true
1835
+ };
1836
+ }
1837
+ reset = ()=>{
1838
+ this.setState({
1839
+ hasError: false
1869
1840
  });
1841
+ };
1842
+ render() {
1843
+ if (this.state.hasError) return this.props.fallback(this.reset);
1844
+ return this.props.children;
1870
1845
  }
1871
- return children;
1872
- };
1846
+ }
1847
+ function ErrorView({ errorState, onReset }) {
1848
+ const { title = DEFAULT_ERROR_STATE.title, message, imgSrc, onRetry } = errorState ?? DEFAULT_ERROR_STATE;
1849
+ const handleRetry = ()=>{
1850
+ onReset?.();
1851
+ onRetry?.();
1852
+ };
1853
+ return /*#__PURE__*/ jsx("div", {
1854
+ "data-slot": "content-state-error",
1855
+ className: styles_css_state,
1856
+ children: /*#__PURE__*/ jsxs(Empty_Empty, {
1857
+ children: [
1858
+ /*#__PURE__*/ jsxs(Empty_Empty.Header, {
1859
+ children: [
1860
+ imgSrc && /*#__PURE__*/ jsx(Empty_Empty.Media, {
1861
+ children: /*#__PURE__*/ jsx("img", {
1862
+ className: errorImage,
1863
+ src: imgSrc,
1864
+ alt: ""
1865
+ })
1866
+ }),
1867
+ /*#__PURE__*/ jsx(Empty_Empty.Title, {
1868
+ children: title
1869
+ }),
1870
+ /*#__PURE__*/ jsx(Empty_Empty.Description, {
1871
+ children: message
1872
+ })
1873
+ ]
1874
+ }),
1875
+ onRetry && /*#__PURE__*/ jsx(Empty_Empty.Content, {
1876
+ children: /*#__PURE__*/ jsx(Button_Button, {
1877
+ onClick: handleRetry,
1878
+ children: "Попробовать снова"
1879
+ })
1880
+ })
1881
+ ]
1882
+ })
1883
+ });
1884
+ }
1885
+ function ContentState({ isLoading, isError, errorState, children }) {
1886
+ if (isLoading) return /*#__PURE__*/ jsx("div", {
1887
+ "data-slot": "content-state-loading",
1888
+ className: styles_css_state,
1889
+ children: /*#__PURE__*/ jsx(Spinner, {})
1890
+ });
1891
+ if (isError) return /*#__PURE__*/ jsx(ErrorView, {
1892
+ errorState: errorState
1893
+ });
1894
+ return /*#__PURE__*/ jsx(ErrorBoundary, {
1895
+ fallback: (reset)=>/*#__PURE__*/ jsx(ErrorView, {
1896
+ errorState: errorState,
1897
+ onReset: reset
1898
+ }),
1899
+ children: children
1900
+ });
1901
+ }
1873
1902
  var arrowClass = 'style__izacrl5';
1874
1903
  var contentClass = 'style__izacrl3';
1875
1904
  var positionerClass = 'style__izacrl2';
@@ -1912,7 +1941,7 @@ const Tooltip_Tooltip = ({ text, content, children, side = 'top', sideOffset = 1
1912
1941
  })
1913
1942
  });
1914
1943
  var copyIconClass = 'style__1wpx85c1';
1915
- var CopyTypography_styles_css_wrapper = 'style__1wpx85c0';
1944
+ var styles_css_wrapper = 'style__1wpx85c0';
1916
1945
  const useLogic_useLogic_useLogic = ({ children, copyText, isShowCopyText, copyPosition })=>{
1917
1946
  const [status, setStatus] = useState("Скопировать");
1918
1947
  const [tooltipOpen, setTooltipOpen] = useState(false);
@@ -1957,7 +1986,7 @@ const CopyTypography = (props)=>{
1957
1986
  onClick: handleClick,
1958
1987
  component: "div",
1959
1988
  color: color,
1960
- className: clsx(CopyTypography_styles_css_wrapper, className),
1989
+ className: clsx(styles_css_wrapper, className),
1961
1990
  ...restProps,
1962
1991
  children: [
1963
1992
  isIconOnLeft && renderIcon(),
@@ -1991,7 +2020,7 @@ const Main = ({ children, className })=>/*#__PURE__*/ jsx("main", {
1991
2020
  children: children
1992
2021
  });
1993
2022
  var styles_css_contentClass = 'SidebarContent__1low90p6';
1994
- var styles_css_footerClass = 'SidebarFooter__1low90p5';
2023
+ var footerClass = 'SidebarFooter__1low90p5';
1995
2024
  var headerClass = 'SidebarHeader__1low90p4';
1996
2025
  var Sidebar_styles_css_rootClass = 'SidebarContainer__1low90p2';
1997
2026
  var triggerClass = 'SidebarTrigger__1low90p1';
@@ -2025,7 +2054,7 @@ const Sidebar = ({ width = "16rem", header, footer, content, className })=>{
2025
2054
  children: content
2026
2055
  }),
2027
2056
  footer && /*#__PURE__*/ jsx("footer", {
2028
- className: styles_css_footerClass,
2057
+ className: footerClass,
2029
2058
  children: footer
2030
2059
  })
2031
2060
  ]
@@ -2098,52 +2127,61 @@ function Row({ row, rowHeight, onRowClick, columns, rowIndex, rowId }) {
2098
2127
  })
2099
2128
  });
2100
2129
  }
2130
+ var cell = 'style__15m2ib82';
2101
2131
  var styles_css_container = 'style__15m2ib80';
2102
- var loader = 'style__15m2ib81';
2132
+ var stateImage = 'style__15m2ib81';
2103
2133
  function State({ isLoading, isEmpty, columnsLength, emptyState = {
2104
2134
  text: 'Нет данных'
2105
2135
  }, errorState = {
2106
- text: 'Произошла ошибка'
2107
- }, isError, onRetry }) {
2136
+ message: 'Произошла ошибка'
2137
+ }, isError }) {
2108
2138
  const Container = ({ children })=>/*#__PURE__*/ jsx("tr", {
2109
2139
  className: styles_css_container,
2110
2140
  children: /*#__PURE__*/ jsx("td", {
2141
+ className: cell,
2111
2142
  colSpan: columnsLength,
2112
- align: "center",
2113
2143
  children: children
2114
2144
  })
2115
2145
  });
2116
2146
  if (isLoading) return /*#__PURE__*/ jsx(Container, {
2117
- children: /*#__PURE__*/ jsx("span", {
2118
- className: loader,
2119
- children: /*#__PURE__*/ jsx(CircularProgress, {})
2147
+ children: /*#__PURE__*/ jsx(ContentState, {
2148
+ isLoading: true,
2149
+ children: null
2120
2150
  })
2121
2151
  });
2122
2152
  if (isEmpty) {
2123
- const { imgSrc, imgAlt, text } = emptyState;
2153
+ const { imgSrc, imgAlt, text, actions } = emptyState;
2124
2154
  return /*#__PURE__*/ jsx(Container, {
2125
- children: /*#__PURE__*/ jsx(Placeholder, {
2126
- title: text,
2127
- imgSrc: imgSrc,
2128
- imgAlt: imgAlt
2129
- })
2130
- });
2131
- }
2132
- if (isError) {
2133
- const { imgSrc, imgAlt, text } = errorState;
2134
- return /*#__PURE__*/ jsx(Container, {
2135
- children: /*#__PURE__*/ jsx(Placeholder, {
2136
- title: text,
2137
- imgSrc: imgSrc,
2138
- imgAlt: imgAlt,
2139
- actions: onRetry ? /*#__PURE__*/ jsx(Button_Button, {
2140
- variant: "outline",
2141
- onClick: onRetry,
2142
- children: "Попробовать снова"
2143
- }) : void 0
2155
+ children: /*#__PURE__*/ jsxs(Empty_Empty, {
2156
+ children: [
2157
+ /*#__PURE__*/ jsxs(Empty_Empty.Header, {
2158
+ children: [
2159
+ imgSrc && /*#__PURE__*/ jsx(Empty_Empty.Media, {
2160
+ children: /*#__PURE__*/ jsx("img", {
2161
+ className: stateImage,
2162
+ src: imgSrc,
2163
+ alt: imgAlt ?? ''
2164
+ })
2165
+ }),
2166
+ /*#__PURE__*/ jsx(Empty_Empty.Title, {
2167
+ children: text
2168
+ })
2169
+ ]
2170
+ }),
2171
+ actions && /*#__PURE__*/ jsx(Empty_Empty.Content, {
2172
+ children: actions
2173
+ })
2174
+ ]
2144
2175
  })
2145
2176
  });
2146
2177
  }
2178
+ if (isError) return /*#__PURE__*/ jsx(Container, {
2179
+ children: /*#__PURE__*/ jsx(ContentState, {
2180
+ isError: true,
2181
+ errorState: errorState,
2182
+ children: null
2183
+ })
2184
+ });
2147
2185
  return null;
2148
2186
  }
2149
2187
  var Body_styles_css_container = 'style__82af400';
@@ -2175,15 +2213,60 @@ function Body({ isError, isLoading, emptyState, errorState, columns, rows, rowHe
2175
2213
  })
2176
2214
  });
2177
2215
  }
2178
- var Footer_styles_css_footerClass = 'style__2s55b60';
2216
+ var styles_css_footerClass = 'style__2s55b60';
2179
2217
  function Footer_Footer({ children, className }) {
2180
2218
  return /*#__PURE__*/ jsx("footer", {
2181
- className: clsx(Footer_styles_css_footerClass, className),
2219
+ className: clsx(styles_css_footerClass, className),
2182
2220
  children: children
2183
2221
  });
2184
2222
  }
2223
+ var styles_css_alignments = {
2224
+ left: 'left__o752f01',
2225
+ center: 'center__o752f02',
2226
+ right: 'right__o752f03',
2227
+ justify: 'justify__o752f04'
2228
+ };
2229
+ var DataGridSortHeader_styles_css_wrapper = 'style__o752f00';
2230
+ function DataGridSortHeader({ sorting, onSortingChange, setSorting, column: { label, field, align = 'left' }, className }) {
2231
+ if (!field) return null;
2232
+ const handleSortingChange = onSortingChange ?? setSorting;
2233
+ const activeOrder = sorting?.key === field ? sorting.order : void 0;
2234
+ const isActive = Boolean(activeOrder);
2235
+ const handleClick = ()=>{
2236
+ if (!handleSortingChange) return;
2237
+ if ('asc' === activeOrder) handleSortingChange({
2238
+ key: field,
2239
+ order: 'desc'
2240
+ });
2241
+ else isActive ? handleSortingChange(null) : handleSortingChange({
2242
+ key: field,
2243
+ order: 'asc'
2244
+ });
2245
+ };
2246
+ return /*#__PURE__*/ jsxs("button", {
2247
+ type: "button",
2248
+ className: clsx(DataGridSortHeader_styles_css_wrapper, styles_css_alignments[align], className),
2249
+ onClick: handleClick,
2250
+ disabled: !handleSortingChange,
2251
+ children: [
2252
+ label,
2253
+ isActive ? 'asc' === activeOrder ? /*#__PURE__*/ jsx(ArrowDownNarrowWide, {
2254
+ size: 16
2255
+ }) : /*#__PURE__*/ jsx(ArrowDownWideNarrow, {
2256
+ size: 16
2257
+ }) : /*#__PURE__*/ jsx(ArrowDownUp, {
2258
+ size: 16
2259
+ })
2260
+ ]
2261
+ });
2262
+ }
2185
2263
  var headerCellClass = 'style__uma6hu0';
2186
- function HeaderCell({ column, height, width }) {
2264
+ function HeaderCell({ column, height, width, sorting, onSortingChange }) {
2265
+ const content = column.renderHeaderCell?.(column) || (column.sortable ? /*#__PURE__*/ jsx(DataGridSortHeader, {
2266
+ column: column,
2267
+ sorting: sorting ?? null,
2268
+ onSortingChange: onSortingChange
2269
+ }) : column.label);
2187
2270
  return /*#__PURE__*/ jsx("th", {
2188
2271
  style: {
2189
2272
  color: column.color,
@@ -2191,21 +2274,23 @@ function HeaderCell({ column, height, width }) {
2191
2274
  width
2192
2275
  },
2193
2276
  align: column.align ?? 'left',
2194
- title: column.title,
2277
+ title: column.label,
2195
2278
  className: headerCellClass,
2196
- children: column.renderHeaderCell?.(column) || column.title
2279
+ children: content
2197
2280
  });
2198
2281
  }
2199
2282
  var headerRow = 'style__fkgoub0';
2200
- function Header_Header({ columns, height }) {
2283
+ function Header_Header({ columns, height, sorting, onSortingChange }) {
2201
2284
  return /*#__PURE__*/ jsx("thead", {
2202
2285
  children: /*#__PURE__*/ jsx("tr", {
2203
2286
  className: clsx(headerRow),
2204
2287
  children: columns.map((col)=>/*#__PURE__*/ jsx(HeaderCell, {
2205
2288
  column: col,
2206
2289
  height: height,
2207
- width: col.width
2208
- }, col.title))
2290
+ width: col.width,
2291
+ sorting: sorting,
2292
+ onSortingChange: onSortingChange
2293
+ }, col.label))
2209
2294
  })
2210
2295
  });
2211
2296
  }
@@ -2215,7 +2300,24 @@ var fullHeight = 'style__1gqvluf2';
2215
2300
  var DataGrid_styles_css_loading = 'style__1gqvluf4';
2216
2301
  var table = 'style__1gqvluf1';
2217
2302
  var titleClass = 'style__1gqvluf5';
2218
- function DataGrid({ rows, columns, height = '100%', className, rowHeight = 40, headerHeight = 40, keyId, onRowClick, isLoading, isDisabled, isError, emptyState, errorState, footer, title, onRetry }) {
2303
+ function DataGrid({ rows, columns, height = '100%', className, rowHeight = 40, headerHeight = 40, keyId, onRowClick, isLoading, isDisabled, isError, emptyState, errorState, sorting, onSortingChange, sortMode = 'client', footer, title }) {
2304
+ const sortedRows = useMemo(()=>{
2305
+ if (!sorting || 'manual' === sortMode) return rows;
2306
+ const column = columns.find(({ field })=>field === sorting.key);
2307
+ const sortDirection = 'asc' === sorting.order ? 1 : -1;
2308
+ return rows.map((row, index)=>({
2309
+ row,
2310
+ index
2311
+ })).sort((a, b)=>{
2312
+ const result = column?.sortComparator?.(a.row, b.row) ?? compareValues(column?.sortAccessor ? column.sortAccessor(a.row) : a.row[sorting.key], column?.sortAccessor ? column.sortAccessor(b.row) : b.row[sorting.key]);
2313
+ return 0 === result ? a.index - b.index : result * sortDirection;
2314
+ }).map(({ row })=>row);
2315
+ }, [
2316
+ columns,
2317
+ rows,
2318
+ sortMode,
2319
+ sorting
2320
+ ]);
2219
2321
  const isFullHeight = isLoading || isError || 0 === rows.length;
2220
2322
  return /*#__PURE__*/ jsxs("div", {
2221
2323
  "data-slot": "data-grid",
@@ -2237,10 +2339,12 @@ function DataGrid({ rows, columns, height = '100%', className, rowHeight = 40, h
2237
2339
  }),
2238
2340
  /*#__PURE__*/ jsx(Header_Header, {
2239
2341
  columns: columns,
2240
- height: headerHeight
2342
+ height: headerHeight,
2343
+ sorting: sorting,
2344
+ onSortingChange: onSortingChange
2241
2345
  }),
2242
2346
  /*#__PURE__*/ jsx(Body, {
2243
- rows: rows,
2347
+ rows: sortedRows,
2244
2348
  columns: columns,
2245
2349
  rowHeight: rowHeight,
2246
2350
  keyId: keyId,
@@ -2248,8 +2352,7 @@ function DataGrid({ rows, columns, height = '100%', className, rowHeight = 40, h
2248
2352
  isLoading: isLoading,
2249
2353
  emptyState: emptyState,
2250
2354
  errorState: errorState,
2251
- isError: isError,
2252
- onRetry: onRetry
2355
+ isError: isError
2253
2356
  })
2254
2357
  ]
2255
2358
  }),
@@ -2259,6 +2362,17 @@ function DataGrid({ rows, columns, height = '100%', className, rowHeight = 40, h
2259
2362
  ]
2260
2363
  });
2261
2364
  }
2365
+ function compareValues(a, b) {
2366
+ if (null == a && null == b) return 0;
2367
+ if (null == a) return -1;
2368
+ if (null == b) return 1;
2369
+ if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
2370
+ if ('number' == typeof a && 'number' == typeof b) return a - b;
2371
+ return String(a).localeCompare(String(b), void 0, {
2372
+ numeric: true,
2373
+ sensitivity: 'base'
2374
+ });
2375
+ }
2262
2376
  var checkboxItem = 'style__1ib8wktd style__1ib8wkta';
2263
2377
  var DropdownMenu_styles_css_content = 'style__1ib8wkt7';
2264
2378
  var styles_css_icon = 'style__1ib8wkth';
@@ -2603,40 +2717,6 @@ const DataGridActionCell = (props)=>{
2603
2717
  ]
2604
2718
  });
2605
2719
  };
2606
- var styles_css_alignments = {
2607
- left: 'left__o752f01',
2608
- center: 'center__o752f02',
2609
- right: 'right__o752f03',
2610
- justify: 'justify__o752f04'
2611
- };
2612
- var DataGridSortHeader_styles_css_wrapper = 'style__o752f00';
2613
- function DataGridSortHeader({ sorting, setSorting, column: { title, field, align = 'left' }, className }) {
2614
- if (!field) return null;
2615
- const handleClick = ()=>{
2616
- sorting.key === field ? setSorting({
2617
- key: field,
2618
- order: 'asc' === sorting.order ? 'desc' : 'asc'
2619
- }) : setSorting({
2620
- key: field,
2621
- order: 'asc'
2622
- });
2623
- };
2624
- return /*#__PURE__*/ jsxs("button", {
2625
- type: "button",
2626
- className: clsx(DataGridSortHeader_styles_css_wrapper, styles_css_alignments[align], className),
2627
- onClick: handleClick,
2628
- children: [
2629
- title,
2630
- sorting.key === field ? 'asc' === sorting.order ? /*#__PURE__*/ jsx(ArrowDownNarrowWide, {
2631
- size: 16
2632
- }) : /*#__PURE__*/ jsx(ArrowDownWideNarrow, {
2633
- size: 16
2634
- }) : /*#__PURE__*/ jsx(ArrowDownUp, {
2635
- size: 16
2636
- })
2637
- ]
2638
- });
2639
- }
2640
2720
  const ITEM_CLASSNAME = 'datalist_item';
2641
2721
  const END_OF_SCROLL_MESSAGE = 'Вы достигли конца списка';
2642
2722
  var EndData_styles_css_item = 'style__1syvw5e0';
@@ -2663,12 +2743,100 @@ const ErrorState = ({ onRetry })=>/*#__PURE__*/ jsxs("li", {
2663
2743
  ]
2664
2744
  });
2665
2745
  var Loader_styles_css_item = 'style__111czea0';
2666
- const Loader = ()=>/*#__PURE__*/ jsx("li", {
2746
+ const Loader_Loader = ()=>/*#__PURE__*/ jsx("li", {
2667
2747
  className: Loader_styles_css_item,
2668
2748
  children: /*#__PURE__*/ jsx(CircularProgress, {
2669
2749
  color: "primary"
2670
2750
  })
2671
2751
  });
2752
+ var sizes = {
2753
+ small: 'small__1o97kvm1',
2754
+ medium: 'medium__1o97kvm2',
2755
+ large: 'large__1o97kvm3'
2756
+ };
2757
+ var Image_styles_css_wrapper = 'style__1o97kvm0';
2758
+ const Image_Image = (props)=>/*#__PURE__*/ jsx("img", {
2759
+ alt: props.alt,
2760
+ src: props.src,
2761
+ className: clsx_0(Image_styles_css_wrapper, sizes[props.size || 'medium'], props.className),
2762
+ width: props.width,
2763
+ height: props.height
2764
+ });
2765
+ const SIZE = {
2766
+ small: 'small',
2767
+ medium: 'medium',
2768
+ large: 'large'
2769
+ };
2770
+ const IMAGE_WIDTH = {
2771
+ [SIZE.small]: '239px',
2772
+ [SIZE.medium]: '323px',
2773
+ [SIZE.large]: '458px'
2774
+ };
2775
+ const IMAGE_HEIGHT = {
2776
+ [SIZE.small]: '119px',
2777
+ [SIZE.medium]: '161px',
2778
+ [SIZE.large]: '229px'
2779
+ };
2780
+ const MAX_INNER_WIDTH = {
2781
+ [SIZE.small]: '384px',
2782
+ [SIZE.medium]: '400px',
2783
+ [SIZE.large]: '460px'
2784
+ };
2785
+ const TITLE_HEADER_LEVEL = {
2786
+ [SIZE.small]: 'subtitle1',
2787
+ [SIZE.medium]: 'h6',
2788
+ [SIZE.large]: 'h5'
2789
+ };
2790
+ var descriptionClass = 'style__1nenzg05';
2791
+ var Placeholder_styles_css_footerClass = 'style__1nenzg06';
2792
+ var innerContainer = 'style__1nenzg04';
2793
+ var styles_css_sizes = {
2794
+ small: 'small__1nenzg01',
2795
+ medium: 'medium__1nenzg02',
2796
+ large: 'large__1nenzg03'
2797
+ };
2798
+ var Placeholder_styles_css_wrapper = 'style__1nenzg00';
2799
+ const Placeholder = ({ className, title, imgSrc, imgAlt, description, actions, size = 'small', renderImage })=>{
2800
+ const RenderImage = useMemo(()=>renderImage || Image_Image, [
2801
+ renderImage
2802
+ ]);
2803
+ return /*#__PURE__*/ jsxs("div", {
2804
+ className: clsx_0(Placeholder_styles_css_wrapper, styles_css_sizes[size], className),
2805
+ children: [
2806
+ /*#__PURE__*/ jsxs("div", {
2807
+ className: innerContainer,
2808
+ style: {
2809
+ maxWidth: MAX_INNER_WIDTH[size]
2810
+ },
2811
+ children: [
2812
+ imgSrc && /*#__PURE__*/ jsx(RenderImage, {
2813
+ src: imgSrc,
2814
+ alt: imgAlt,
2815
+ width: IMAGE_WIDTH[size],
2816
+ height: IMAGE_HEIGHT[size],
2817
+ size: size
2818
+ }),
2819
+ /*#__PURE__*/ jsx(Typography, {
2820
+ align: "center",
2821
+ color: "secondary",
2822
+ variant: TITLE_HEADER_LEVEL[size],
2823
+ children: title
2824
+ }),
2825
+ description && /*#__PURE__*/ jsx(Typography, {
2826
+ className: descriptionClass,
2827
+ component: "div",
2828
+ variant: "body1",
2829
+ children: description
2830
+ })
2831
+ ]
2832
+ }),
2833
+ actions && /*#__PURE__*/ jsx("footer", {
2834
+ className: Placeholder_styles_css_footerClass,
2835
+ children: actions
2836
+ })
2837
+ ]
2838
+ });
2839
+ };
2672
2840
  const NO_DATA_TEXT = 'Нет данных';
2673
2841
  const NoData = ({ noDataImgSrc })=>/*#__PURE__*/ jsx(Placeholder, {
2674
2842
  title: NO_DATA_TEXT,
@@ -2708,9 +2876,7 @@ const DataList = ({ data, keyId, className, itemContent, noDataPlaceholder, endO
2708
2876
  onEndReached
2709
2877
  ]);
2710
2878
  const isDataExist = Boolean(data?.length);
2711
- if (!isDataExist && !isLoading && !isError) return noDataPlaceholder ? /*#__PURE__*/ jsx(Fragment, {
2712
- children: noDataPlaceholder
2713
- }) : /*#__PURE__*/ jsx(NoData, {});
2879
+ if (!isDataExist && !isLoading && !isError) return noDataPlaceholder ? noDataPlaceholder : /*#__PURE__*/ jsx(NoData, {});
2714
2880
  return /*#__PURE__*/ jsxs(ContentState, {
2715
2881
  isLoading: isLoading && !isDataExist,
2716
2882
  isError: isError && !isDataExist,
@@ -2735,7 +2901,7 @@ const DataList = ({ data, keyId, className, itemContent, noDataPlaceholder, endO
2735
2901
  components: {
2736
2902
  Footer: ()=>/*#__PURE__*/ jsxs(Fragment, {
2737
2903
  children: [
2738
- isLoading && /*#__PURE__*/ jsx(Loader, {}),
2904
+ isLoading && /*#__PURE__*/ jsx(Loader_Loader, {}),
2739
2905
  isError && /*#__PURE__*/ jsx(ErrorState, {
2740
2906
  onRetry: onRetry
2741
2907
  }),
@@ -3254,64 +3420,6 @@ const Drawer_Drawer = ({ children, trigger, className, title, description = '',
3254
3420
  })
3255
3421
  ]
3256
3422
  });
3257
- var Empty_styles_css_content = 'style__e4li7y7';
3258
- var Empty_styles_css_description = 'style__e4li7y6';
3259
- var Empty_styles_css_header = 'style__e4li7y1';
3260
- var styles_css_media = 'style__e4li7y2';
3261
- var mediaVariants = {
3262
- default: 'default__e4li7y3',
3263
- icon: 'icon__e4li7y4'
3264
- };
3265
- var Empty_styles_css_root = 'style__e4li7y0';
3266
- var Empty_styles_css_title = 'style__e4li7y5';
3267
- function Empty_Empty({ className, ...props }) {
3268
- return /*#__PURE__*/ jsx("div", {
3269
- "data-slot": "empty",
3270
- className: clsx(Empty_styles_css_root, className),
3271
- ...props
3272
- });
3273
- }
3274
- function Empty_Header({ className, ...props }) {
3275
- return /*#__PURE__*/ jsx("div", {
3276
- "data-slot": "empty-header",
3277
- className: clsx(Empty_styles_css_header, className),
3278
- ...props
3279
- });
3280
- }
3281
- function Empty_Media({ className, variant = 'default', ...props }) {
3282
- return /*#__PURE__*/ jsx("div", {
3283
- "data-slot": "empty-media",
3284
- "data-variant": variant,
3285
- className: clsx(styles_css_media, mediaVariants[variant], className),
3286
- ...props
3287
- });
3288
- }
3289
- function Empty_Title({ className, ...props }) {
3290
- return /*#__PURE__*/ jsx("div", {
3291
- "data-slot": "empty-title",
3292
- className: clsx(Empty_styles_css_title, className),
3293
- ...props
3294
- });
3295
- }
3296
- function Empty_Description({ className, ...props }) {
3297
- return /*#__PURE__*/ jsx("div", {
3298
- "data-slot": "empty-description",
3299
- className: clsx(Empty_styles_css_description, className),
3300
- ...props
3301
- });
3302
- }
3303
- function Empty_Content({ className, ...props }) {
3304
- return /*#__PURE__*/ jsx("div", {
3305
- "data-slot": "empty-content",
3306
- className: clsx(Empty_styles_css_content, className),
3307
- ...props
3308
- });
3309
- }
3310
- Empty_Empty.Header = Empty_Header;
3311
- Empty_Empty.Media = Empty_Media;
3312
- Empty_Empty.Title = Empty_Title;
3313
- Empty_Empty.Description = Empty_Description;
3314
- Empty_Empty.Content = Empty_Content;
3315
3423
  var styles_css_arrow = 'style__a5l83v4';
3316
3424
  var arrowLeft = 'style__a5l83v5';
3317
3425
  var arrowRight = 'style__a5l83v6';
@@ -5296,4 +5404,4 @@ const ToggleGroup = ({ value, onChange, options, size, className, label, multipl
5296
5404
  ]
5297
5405
  });
5298
5406
  };
5299
- export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Autocomplete, Avatar_Avatar as Avatar, Badge_Badge as Badge, Breadcrumb, ButtonGroup, Button_Button as Button, Button_buttonSizes as buttonSizes, Button_buttonVariants as buttonVariants, Calendar, Card, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, Collapsible_Collapsible as Collapsible, Combobox_Combobox as Combobox, ConfirmAction, ContentState, CopyTypography, DEFAULT_SEPARATOR, DEFAULT_SYMBOL, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog_Dialog as Dialog, Drawer_Drawer as Drawer, DropdownMenu, Empty_Empty as Empty, ImageCarousel, Image_Image as Image, InputGroup, InputOTP, Input_Input as Input, Label, MaskField, NOTIFICATION_POSITIONS, NOTIFY_CLASSNAME, Notification, NotificationContainer, OverflowTypography, PageLayout, Pagination, PeriodPicker, Placeholder, Popover_Popover as Popover, RadioGroupItem, RadioGroup_RadioGroup as RadioGroup, RangeInput, ScrollTopButton, Select_Select as Select, Sheet, Sidebar_Sidebar as Sidebar, Slider_Slider as Slider, Tabs_Tabs as Tabs, TextField, Textarea_Textarea as Textarea, ToggleGroup, Tooltip_Tooltip as Tooltip, Typography, alignments, badgeVariants, calculateSize, constants_NotificationVariantTypes as NotificationVariantTypes, createHandle, displays, negativeSpacing, notification, spacing, styles_css_colors as colors, styles_css_variants as variants, theme, transforms, useComboboxAnchor, useDashboard, useIsMobile, useOverflowed, useSidebar, weights };
5407
+ export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Autocomplete, Avatar_Avatar as Avatar, Badge_Badge as Badge, Breadcrumb, ButtonGroup, Button_Button as Button, Button_buttonSizes as buttonSizes, Button_buttonVariants as buttonVariants, Calendar, Card, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, Collapsible_Collapsible as Collapsible, Combobox_Combobox as Combobox, ConfirmAction, ContentState, CopyTypography, DEFAULT_SEPARATOR, DEFAULT_SYMBOL, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog_Dialog as Dialog, Drawer_Drawer as Drawer, DropdownMenu, Empty_Empty as Empty, ImageCarousel, Image_Image as Image, InputGroup, InputOTP, Input_Input as Input, Label, MaskField, NOTIFICATION_POSITIONS, NOTIFY_CLASSNAME, Notification, NotificationContainer, OverflowTypography, PageLayout, Pagination, PeriodPicker, Placeholder, Popover_Popover as Popover, RadioGroupItem, RadioGroup_RadioGroup as RadioGroup, RangeInput, ScrollTopButton, Select_Select as Select, Sheet, Sidebar_Sidebar as Sidebar, Slider_Slider as Slider, Spinner, Tabs_Tabs as Tabs, TextField, Textarea_Textarea as Textarea, ToggleGroup, Tooltip_Tooltip as Tooltip, Typography, alignments, badgeVariants, calculateSize, constants_NotificationVariantTypes as NotificationVariantTypes, createHandle, displays, negativeSpacing, notification, spacing, styles_css_colors as colors, styles_css_variants as variants, theme, transforms, useComboboxAnchor, useDashboard, useIsMobile, useOverflowed, useSidebar, weights };