@astral/ui 4.85.0 → 4.87.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 (263) hide show
  1. package/components/NotificationList/ListItem/useLogic/useLogic.js +1 -1
  2. package/components/PageHeader/HeaderContent/HeaderContent.d.ts +2 -2
  3. package/components/PageHeader/HeaderContent/HeaderContent.js +3 -3
  4. package/components/PageHeader/HeaderContent/styles.d.ts +4 -0
  5. package/components/PageHeader/HeaderContent/styles.js +11 -1
  6. package/components/PageHeader/PageHeader.js +2 -2
  7. package/components/PageHeader/styles.js +2 -2
  8. package/components/PageHeader/types.d.ts +10 -0
  9. package/components/createGlobalState/createGlobalState.d.ts +6 -0
  10. package/components/createGlobalState/createGlobalState.js +25 -0
  11. package/components/createGlobalState/index.d.ts +1 -0
  12. package/components/createGlobalState/index.js +1 -0
  13. package/components/createGlobalState/public.d.ts +1 -0
  14. package/components/createGlobalState/public.js +1 -0
  15. package/components/createGlobalState/utils/index.d.ts +1 -0
  16. package/components/createGlobalState/utils/index.js +1 -0
  17. package/components/createGlobalState/utils/resolveHookState/index.d.ts +1 -0
  18. package/components/createGlobalState/utils/resolveHookState/index.js +1 -0
  19. package/components/createGlobalState/utils/resolveHookState/resolveHookState.d.ts +4 -0
  20. package/components/createGlobalState/utils/resolveHookState/resolveHookState.js +8 -0
  21. package/components/createGlobalState/utils/types.d.ts +5 -0
  22. package/components/createGlobalState/utils/types.js +1 -0
  23. package/components/useDebounce/hooks/useTimeoutFn/index.d.ts +1 -0
  24. package/components/useDebounce/hooks/useTimeoutFn/index.js +1 -0
  25. package/components/useDebounce/hooks/useTimeoutFn/useTimeoutFn.d.ts +2 -0
  26. package/components/useDebounce/hooks/useTimeoutFn/useTimeoutFn.js +29 -0
  27. package/components/useDebounce/index.d.ts +1 -0
  28. package/components/useDebounce/index.js +1 -0
  29. package/components/useDebounce/public.d.ts +1 -0
  30. package/components/useDebounce/public.js +1 -0
  31. package/components/useDebounce/useDebounce.d.ts +6 -0
  32. package/components/useDebounce/useDebounce.js +10 -0
  33. package/components/useFirstMountState/index.d.ts +1 -1
  34. package/components/useFirstMountState/index.js +1 -1
  35. package/components/useFirstMountState/public.d.ts +1 -1
  36. package/components/useFirstMountState/public.js +1 -1
  37. package/components/useFirstMountState/useFirstMountState.d.ts +4 -1
  38. package/components/useFirstMountState/useFirstMountState.js +12 -1
  39. package/components/useIntersection/index.d.ts +1 -0
  40. package/components/useIntersection/index.js +1 -0
  41. package/components/useIntersection/public.d.ts +1 -0
  42. package/components/useIntersection/public.js +1 -0
  43. package/components/useIntersection/useIntersection.d.ts +5 -0
  44. package/components/useIntersection/useIntersection.js +22 -0
  45. package/components/useInterval/index.d.ts +1 -1
  46. package/components/useInterval/index.js +1 -1
  47. package/components/useInterval/public.d.ts +1 -1
  48. package/components/useInterval/public.js +1 -1
  49. package/components/useInterval/useInterval.d.ts +6 -1
  50. package/components/useInterval/useInterval.js +19 -1
  51. package/components/useIsomorphicLayoutEffect/index.d.ts +1 -0
  52. package/components/useIsomorphicLayoutEffect/index.js +1 -0
  53. package/components/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +2 -0
  54. package/components/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
  55. package/components/useLocalStorage/index.d.ts +1 -1
  56. package/components/useLocalStorage/index.js +1 -1
  57. package/components/useLocalStorage/public.d.ts +1 -1
  58. package/components/useLocalStorage/public.js +1 -1
  59. package/components/useLocalStorage/useLocalStorage.d.ts +15 -1
  60. package/components/useLocalStorage/useLocalStorage.js +96 -1
  61. package/components/useMeasure/index.d.ts +1 -0
  62. package/components/useMeasure/index.js +1 -0
  63. package/components/useMeasure/public.d.ts +1 -0
  64. package/components/useMeasure/public.js +1 -0
  65. package/components/useMeasure/useMeasure.d.ts +13 -0
  66. package/components/useMeasure/useMeasure.js +42 -0
  67. package/components/useNewToggle/index.d.ts +1 -0
  68. package/components/useNewToggle/index.js +1 -0
  69. package/components/useNewToggle/public.d.ts +1 -0
  70. package/components/useNewToggle/public.js +1 -0
  71. package/components/useNewToggle/useNewToggle.d.ts +4 -0
  72. package/components/useNewToggle/useNewToggle.js +8 -0
  73. package/components/useRafState/hooks/useUnmount/index.d.ts +1 -0
  74. package/components/useRafState/hooks/useUnmount/index.js +1 -0
  75. package/components/useRafState/hooks/useUnmount/useUnmount.d.ts +1 -0
  76. package/components/useRafState/hooks/useUnmount/useUnmount.js +7 -0
  77. package/components/useRafState/index.d.ts +1 -0
  78. package/components/useRafState/index.js +1 -0
  79. package/components/useRafState/useRafState.d.ts +2 -0
  80. package/components/useRafState/useRafState.js +16 -0
  81. package/components/useScroll/index.d.ts +1 -0
  82. package/components/useScroll/index.js +1 -0
  83. package/components/useScroll/public.d.ts +1 -0
  84. package/components/useScroll/public.js +1 -0
  85. package/components/useScroll/useScroll.d.ts +9 -0
  86. package/components/useScroll/useScroll.js +39 -0
  87. package/components/useSet/index.d.ts +1 -1
  88. package/components/useSet/index.js +1 -1
  89. package/components/useSet/public.d.ts +1 -1
  90. package/components/useSet/public.js +1 -1
  91. package/components/useSet/useSet.d.ts +14 -1
  92. package/components/useSet/useSet.js +26 -1
  93. package/components/useSize/index.d.ts +1 -0
  94. package/components/useSize/index.js +1 -0
  95. package/components/useSize/public.d.ts +1 -0
  96. package/components/useSize/public.js +1 -0
  97. package/components/useSize/useSize.d.ts +17 -0
  98. package/components/useSize/useSize.js +79 -0
  99. package/components/useToggle/useToggle.d.ts +1 -0
  100. package/components/useToggle/useToggle.js +1 -0
  101. package/components/useUpdateEffect/index.d.ts +1 -1
  102. package/components/useUpdateEffect/index.js +1 -1
  103. package/components/useUpdateEffect/public.d.ts +1 -1
  104. package/components/useUpdateEffect/public.js +1 -1
  105. package/components/useUpdateEffect/useUpdateEffect.d.ts +5 -1
  106. package/components/useUpdateEffect/useUpdateEffect.js +13 -1
  107. package/components/useWindowScroll/index.d.ts +1 -0
  108. package/components/useWindowScroll/index.js +1 -0
  109. package/components/useWindowScroll/public.d.ts +1 -0
  110. package/components/useWindowScroll/public.js +1 -0
  111. package/components/useWindowScroll/useWindowScroll.d.ts +8 -0
  112. package/components/useWindowScroll/useWindowScroll.js +40 -0
  113. package/components/utils/addEventListenerSafe/addEventListenerSafe.d.ts +1 -0
  114. package/components/utils/addEventListenerSafe/addEventListenerSafe.js +5 -0
  115. package/components/utils/addEventListenerSafe/index.d.ts +1 -0
  116. package/components/utils/addEventListenerSafe/index.js +1 -0
  117. package/components/utils/isBrowser/index.d.ts +1 -0
  118. package/components/utils/isBrowser/index.js +1 -0
  119. package/components/utils/isBrowser/isBrowser.d.ts +1 -0
  120. package/components/utils/isBrowser/isBrowser.js +1 -0
  121. package/components/utils/removeEventListenerSafe/index.d.ts +1 -0
  122. package/components/utils/removeEventListenerSafe/index.js +1 -0
  123. package/components/utils/removeEventListenerSafe/removeEventListenerSafe.d.ts +1 -0
  124. package/components/utils/removeEventListenerSafe/removeEventListenerSafe.js +5 -0
  125. package/components/utils/replaceRaf/constants.d.ts +1 -0
  126. package/components/utils/replaceRaf/constants.js +1 -0
  127. package/components/utils/replaceRaf/index.d.ts +1 -0
  128. package/components/utils/replaceRaf/index.js +1 -0
  129. package/components/utils/replaceRaf/replaceRaf.d.ts +18 -0
  130. package/components/utils/replaceRaf/replaceRaf.js +81 -0
  131. package/hook-form/FormPageLayoutBase/useLogic/useLogic.d.ts +1 -0
  132. package/node/components/NotificationList/ListItem/useLogic/useLogic.js +2 -2
  133. package/node/components/PageHeader/HeaderContent/HeaderContent.d.ts +2 -2
  134. package/node/components/PageHeader/HeaderContent/HeaderContent.js +2 -2
  135. package/node/components/PageHeader/HeaderContent/styles.d.ts +4 -0
  136. package/node/components/PageHeader/HeaderContent/styles.js +12 -2
  137. package/node/components/PageHeader/PageHeader.js +2 -2
  138. package/node/components/PageHeader/styles.js +2 -2
  139. package/node/components/PageHeader/types.d.ts +10 -0
  140. package/node/components/createGlobalState/createGlobalState.d.ts +6 -0
  141. package/node/components/createGlobalState/createGlobalState.js +29 -0
  142. package/node/components/createGlobalState/index.d.ts +1 -0
  143. package/node/components/createGlobalState/index.js +17 -0
  144. package/node/components/createGlobalState/public.d.ts +1 -0
  145. package/node/components/createGlobalState/public.js +17 -0
  146. package/node/components/createGlobalState/utils/index.d.ts +1 -0
  147. package/node/components/createGlobalState/utils/index.js +17 -0
  148. package/node/components/createGlobalState/utils/resolveHookState/index.d.ts +1 -0
  149. package/node/components/createGlobalState/utils/resolveHookState/index.js +17 -0
  150. package/node/components/createGlobalState/utils/resolveHookState/resolveHookState.d.ts +4 -0
  151. package/node/components/createGlobalState/utils/resolveHookState/resolveHookState.js +12 -0
  152. package/node/components/createGlobalState/utils/types.d.ts +5 -0
  153. package/node/components/createGlobalState/utils/types.js +2 -0
  154. package/node/components/useDebounce/hooks/useTimeoutFn/index.d.ts +1 -0
  155. package/node/components/useDebounce/hooks/useTimeoutFn/index.js +17 -0
  156. package/node/components/useDebounce/hooks/useTimeoutFn/useTimeoutFn.d.ts +2 -0
  157. package/node/components/useDebounce/hooks/useTimeoutFn/useTimeoutFn.js +33 -0
  158. package/node/components/useDebounce/index.d.ts +1 -0
  159. package/node/components/useDebounce/index.js +17 -0
  160. package/node/components/useDebounce/public.d.ts +1 -0
  161. package/node/components/useDebounce/public.js +17 -0
  162. package/node/components/useDebounce/useDebounce.d.ts +6 -0
  163. package/node/components/useDebounce/useDebounce.js +14 -0
  164. package/node/components/useFirstMountState/index.d.ts +1 -1
  165. package/node/components/useFirstMountState/index.js +15 -3
  166. package/node/components/useFirstMountState/public.d.ts +1 -1
  167. package/node/components/useFirstMountState/public.js +15 -3
  168. package/node/components/useFirstMountState/useFirstMountState.d.ts +4 -1
  169. package/node/components/useFirstMountState/useFirstMountState.js +13 -2
  170. package/node/components/useIntersection/index.d.ts +1 -0
  171. package/node/components/useIntersection/index.js +17 -0
  172. package/node/components/useIntersection/public.d.ts +1 -0
  173. package/node/components/useIntersection/public.js +17 -0
  174. package/node/components/useIntersection/useIntersection.d.ts +5 -0
  175. package/node/components/useIntersection/useIntersection.js +26 -0
  176. package/node/components/useInterval/index.d.ts +1 -1
  177. package/node/components/useInterval/index.js +15 -3
  178. package/node/components/useInterval/public.d.ts +1 -1
  179. package/node/components/useInterval/public.js +15 -3
  180. package/node/components/useInterval/useInterval.d.ts +6 -1
  181. package/node/components/useInterval/useInterval.js +20 -2
  182. package/node/components/useIsomorphicLayoutEffect/index.d.ts +1 -0
  183. package/node/components/useIsomorphicLayoutEffect/index.js +17 -0
  184. package/node/components/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +2 -0
  185. package/node/components/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +8 -0
  186. package/node/components/useLocalStorage/index.d.ts +1 -1
  187. package/node/components/useLocalStorage/index.js +5 -14
  188. package/node/components/useLocalStorage/public.d.ts +1 -1
  189. package/node/components/useLocalStorage/public.js +5 -14
  190. package/node/components/useLocalStorage/useLocalStorage.d.ts +15 -1
  191. package/node/components/useLocalStorage/useLocalStorage.js +97 -2
  192. package/node/components/useMeasure/index.d.ts +1 -0
  193. package/node/components/useMeasure/index.js +8 -0
  194. package/node/components/useMeasure/public.d.ts +1 -0
  195. package/node/components/useMeasure/public.js +8 -0
  196. package/node/components/useMeasure/useMeasure.d.ts +13 -0
  197. package/node/components/useMeasure/useMeasure.js +44 -0
  198. package/node/components/useNewToggle/index.d.ts +1 -0
  199. package/node/components/useNewToggle/index.js +17 -0
  200. package/node/components/useNewToggle/public.d.ts +1 -0
  201. package/node/components/useNewToggle/public.js +17 -0
  202. package/node/components/useNewToggle/useNewToggle.d.ts +4 -0
  203. package/node/components/useNewToggle/useNewToggle.js +12 -0
  204. package/node/components/useRafState/hooks/useUnmount/index.d.ts +1 -0
  205. package/node/components/useRafState/hooks/useUnmount/index.js +17 -0
  206. package/node/components/useRafState/hooks/useUnmount/useUnmount.d.ts +1 -0
  207. package/node/components/useRafState/hooks/useUnmount/useUnmount.js +11 -0
  208. package/node/components/useRafState/index.d.ts +1 -0
  209. package/node/components/useRafState/index.js +17 -0
  210. package/node/components/useRafState/useRafState.d.ts +2 -0
  211. package/node/components/useRafState/useRafState.js +20 -0
  212. package/node/components/useScroll/index.d.ts +1 -0
  213. package/node/components/useScroll/index.js +17 -0
  214. package/node/components/useScroll/public.d.ts +1 -0
  215. package/node/components/useScroll/public.js +17 -0
  216. package/node/components/useScroll/useScroll.d.ts +9 -0
  217. package/node/components/useScroll/useScroll.js +43 -0
  218. package/node/components/useSet/index.d.ts +1 -1
  219. package/node/components/useSet/index.js +15 -3
  220. package/node/components/useSet/public.d.ts +1 -1
  221. package/node/components/useSet/public.js +15 -3
  222. package/node/components/useSet/useSet.d.ts +14 -1
  223. package/node/components/useSet/useSet.js +27 -2
  224. package/node/components/useSize/index.d.ts +1 -0
  225. package/node/components/useSize/index.js +8 -0
  226. package/node/components/useSize/public.d.ts +1 -0
  227. package/node/components/useSize/public.js +8 -0
  228. package/node/components/useSize/useSize.d.ts +17 -0
  229. package/node/components/useSize/useSize.js +106 -0
  230. package/node/components/useToggle/useToggle.d.ts +1 -0
  231. package/node/components/useToggle/useToggle.js +1 -0
  232. package/node/components/useUpdateEffect/index.d.ts +1 -1
  233. package/node/components/useUpdateEffect/index.js +15 -3
  234. package/node/components/useUpdateEffect/public.d.ts +1 -1
  235. package/node/components/useUpdateEffect/public.js +15 -3
  236. package/node/components/useUpdateEffect/useUpdateEffect.d.ts +5 -1
  237. package/node/components/useUpdateEffect/useUpdateEffect.js +14 -2
  238. package/node/components/useWindowScroll/index.d.ts +1 -0
  239. package/node/components/useWindowScroll/index.js +17 -0
  240. package/node/components/useWindowScroll/public.d.ts +1 -0
  241. package/node/components/useWindowScroll/public.js +17 -0
  242. package/node/components/useWindowScroll/useWindowScroll.d.ts +8 -0
  243. package/node/components/useWindowScroll/useWindowScroll.js +44 -0
  244. package/node/components/utils/addEventListenerSafe/addEventListenerSafe.d.ts +1 -0
  245. package/node/components/utils/addEventListenerSafe/addEventListenerSafe.js +9 -0
  246. package/node/components/utils/addEventListenerSafe/index.d.ts +1 -0
  247. package/node/components/utils/addEventListenerSafe/index.js +17 -0
  248. package/node/components/utils/isBrowser/index.d.ts +1 -0
  249. package/node/components/utils/isBrowser/index.js +17 -0
  250. package/node/components/utils/isBrowser/isBrowser.d.ts +1 -0
  251. package/node/components/utils/isBrowser/isBrowser.js +4 -0
  252. package/node/components/utils/removeEventListenerSafe/index.d.ts +1 -0
  253. package/node/components/utils/removeEventListenerSafe/index.js +17 -0
  254. package/node/components/utils/removeEventListenerSafe/removeEventListenerSafe.d.ts +1 -0
  255. package/node/components/utils/removeEventListenerSafe/removeEventListenerSafe.js +9 -0
  256. package/node/components/utils/replaceRaf/constants.d.ts +1 -0
  257. package/node/components/utils/replaceRaf/constants.js +4 -0
  258. package/node/components/utils/replaceRaf/index.d.ts +1 -0
  259. package/node/components/utils/replaceRaf/index.js +17 -0
  260. package/node/components/utils/replaceRaf/replaceRaf.d.ts +18 -0
  261. package/node/components/utils/replaceRaf/replaceRaf.js +86 -0
  262. package/node/hook-form/FormPageLayoutBase/useLogic/useLogic.d.ts +1 -0
  263. package/package.json +1 -2
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef } from 'react';
2
- import { useIntersection } from 'react-use';
2
+ import { useIntersection } from '../../../useIntersection';
3
3
  export const useLogic = ({ id, onDelete, onViewNotification, isUnread, }) => {
4
4
  const ref = useRef(null);
5
5
  const entry = useIntersection(ref, {
@@ -1,5 +1,5 @@
1
1
  import { type ElementType } from 'react';
2
2
  import type { PageHeaderProps } from '../types';
3
- type HeaderContentProps<TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType> = Pick<PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>, 'breadcrumbs' | 'backButton' | 'description' | 'actions' | 'subheader' | 'filters' | 'title' | 'isLoading'>;
4
- export declare const HeaderContent: <TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType>({ backButton, description, subheader, breadcrumbs, actions, title, filters, isLoading, }: HeaderContentProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => import("react/jsx-runtime").JSX.Element;
3
+ type HeaderContentProps<TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType> = Pick<PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>, 'breadcrumbs' | 'backButton' | 'description' | 'actions' | 'subheader' | 'tabs' | 'filters' | 'title' | 'isLoading'>;
4
+ export declare const HeaderContent: <TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType>({ backButton, description, subheader, breadcrumbs, tabs, actions, title, filters, isLoading, }: HeaderContentProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -6,13 +6,13 @@ import { PageActions } from '../PageActions';
6
6
  import { Title } from '../Title';
7
7
  import { Description } from './Description';
8
8
  import { FormFiltersProvider } from './FormFiltersProvider';
9
- import { BreadcrumbsWrapper, DesktopTitleWrapper, PageSubheader, } from './styles';
10
- export const HeaderContent = ({ backButton, description, subheader, breadcrumbs, actions, title, filters, isLoading, }) => {
9
+ import { BreadcrumbsWrapper, DesktopTitleWrapper, PageSubheader, TabsWrapper, } from './styles';
10
+ export const HeaderContent = ({ backButton, description, subheader, breadcrumbs, tabs, actions, title, filters, isLoading, }) => {
11
11
  const renderBreadcrumbs = () => {
12
12
  if (!breadcrumbs) {
13
13
  return null;
14
14
  }
15
15
  return (_jsx(BreadcrumbsWrapper, { children: Array.isArray(breadcrumbs) ? (_jsx(Breadcrumbs, { children: breadcrumbs })) : (breadcrumbs) }));
16
16
  };
17
- return (_jsxs(_Fragment, { children: [renderBreadcrumbs(), _jsx(DesktopTitleWrapper, { children: _jsx(Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), _jsx(Description, { description: description, isLoading: isLoading }), actions && (_jsx(PageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && (_jsx(FormFiltersProvider, { filtersClassName: pageHeaderClassnames.filters, quickFiltersClassName: pageHeaderClassnames.quickFilters, children: filters })), subheader && (_jsx(PageSubheader, { className: pageHeaderClassnames.subheader, children: subheader }))] }));
17
+ return (_jsxs(_Fragment, { children: [renderBreadcrumbs(), _jsx(DesktopTitleWrapper, { children: _jsx(Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), _jsx(Description, { description: description, isLoading: isLoading }), actions && (_jsx(PageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && (_jsx(FormFiltersProvider, { filtersClassName: pageHeaderClassnames.filters, quickFiltersClassName: pageHeaderClassnames.quickFilters, children: filters })), tabs && _jsx(TabsWrapper, { children: tabs }), subheader && (_jsx(PageSubheader, { className: pageHeaderClassnames.subheader, children: subheader }))] }));
18
18
  };
@@ -3,6 +3,10 @@ export declare const BreadcrumbsWrapper: import("../../styled").StyledComponent<
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const TabsWrapper: import("../../styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
10
  export declare const PageSubheader: import("../../styled").StyledComponent<{
7
11
  theme?: import("@emotion/react").Theme | undefined;
8
12
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
@@ -9,9 +9,19 @@ export const BreadcrumbsWrapper = styled.div `
9
9
  display: none;
10
10
  }
11
11
  `;
12
+ export const TabsWrapper = styled.div `
13
+ grid-column: 1 / -1;
14
+ grid-row: 4;
15
+
16
+ padding-top: ${({ theme }) => theme.spacing(3)};
17
+
18
+ ${({ theme }) => theme.breakpoints.down('sm')} {
19
+ padding: ${({ theme }) => theme.spacing(0, 3, 3, 3)};
20
+ }
21
+ `;
12
22
  export const PageSubheader = styled.div `
13
23
  grid-column: 1 / -1;
14
- grid-row: 6;
24
+ grid-row: 5;
15
25
 
16
26
  padding-top: ${({ theme }) => theme.spacing(4)};
17
27
 
@@ -31,7 +31,7 @@ const rootCva = cva(pageHeaderClassnames.root, {
31
31
  },
32
32
  });
33
33
  export const PageHeader = (props) => {
34
- const { title, description, subheader, breadcrumbs, actions, backButton, className, filters, } = props;
34
+ const { title, description, subheader, breadcrumbs, tabs, actions, backButton, className, filters, } = props;
35
35
  const { isLoading, mobileTitleActions, isShowMobileActions } = useLogic(props);
36
36
  return (_jsxs(_Fragment, { children: [_jsxs(MobileTitleWrapper, { className: mobilePageHeaderCva({
37
37
  hasTitle: Boolean(title) || isLoading,
@@ -40,5 +40,5 @@ export const PageHeader = (props) => {
40
40
  hasActions: Boolean(actions),
41
41
  hasSubheader: Boolean(subheader),
42
42
  hasFilters: Boolean(filters),
43
- }), className), children: _jsx(HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && (_jsx(MobilePageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
43
+ }), className), children: _jsx(HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, tabs: tabs, filters: filters, isLoading: isLoading }) }), isShowMobileActions && (_jsx(MobilePageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
44
44
  };
@@ -38,7 +38,7 @@ export const Wrapper = styled.header `
38
38
 
39
39
  .${pageHeaderClassnames.filters} {
40
40
  grid-column: 1 / -1;
41
- grid-row: 4;
41
+ grid-row: 6;
42
42
 
43
43
  ${({ theme }) => theme.breakpoints.down('laptop')} {
44
44
  grid-column: 3;
@@ -48,7 +48,7 @@ export const Wrapper = styled.header `
48
48
 
49
49
  .${pageHeaderClassnames.quickFilters} {
50
50
  grid-column: 1 / -1;
51
- grid-row: 5;
51
+ grid-row: 7;
52
52
 
53
53
  margin-top: ${({ theme }) => theme.spacing(4)};
54
54
 
@@ -34,6 +34,16 @@ export type PageHeaderProps<TMainActionComponent extends ElementType = ElementTy
34
34
  * } />
35
35
  */
36
36
  breadcrumbs?: ReactNode;
37
+ /**
38
+ * Слот для tabs
39
+ * @example <PageHeader tabs={
40
+ * <Tabs value={tabValue} onChange={handleChange}>
41
+ * <Tab label="Вкладка 1" />
42
+ * <Tab label="Вкладка 2" />
43
+ * </Tabs>
44
+ * } />
45
+ */
46
+ tabs?: ReactNode;
37
47
  /**
38
48
  * Набор кнопок, видимые конфигурируются через объект main, скрытые в меню -
39
49
  * через secondary
@@ -0,0 +1,6 @@
1
+ import { type IHookStateInitAction, type IHookStateSetAction } from './utils/types';
2
+ export declare function createGlobalState<TState>(initialState: IHookStateInitAction<TState>): () => [TState, (state: IHookStateSetAction<TState>) => void];
3
+ export declare function createGlobalState<TState = undefined>(): () => [
4
+ TState,
5
+ (state: IHookStateSetAction<TState>) => void
6
+ ];
@@ -0,0 +1,25 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';
3
+ import { resolveHookState } from './utils/resolveHookState';
4
+ export function createGlobalState(initialState) {
5
+ const store = {
6
+ state: initialState instanceof Function ? initialState() : initialState,
7
+ setState(nextState) {
8
+ store.state = resolveHookState(nextState, store.state);
9
+ store.setters.forEach((setter) => setter(store.state));
10
+ },
11
+ setters: [],
12
+ };
13
+ return () => {
14
+ const [globalState, stateSetter] = useState(store.state);
15
+ useEffect(() => () => {
16
+ store.setters = store.setters.filter((setter) => setter !== stateSetter);
17
+ }, []);
18
+ useIsomorphicLayoutEffect(() => {
19
+ if (!store.setters.includes(stateSetter)) {
20
+ store.setters.push(stateSetter);
21
+ }
22
+ });
23
+ return [globalState, store.setState];
24
+ };
25
+ }
@@ -0,0 +1 @@
1
+ export * from './createGlobalState';
@@ -0,0 +1 @@
1
+ export * from './createGlobalState';
@@ -0,0 +1 @@
1
+ export * from './createGlobalState';
@@ -0,0 +1 @@
1
+ export * from './createGlobalState';
@@ -0,0 +1 @@
1
+ export * from './resolveHookState';
@@ -0,0 +1 @@
1
+ export * from './resolveHookState';
@@ -0,0 +1 @@
1
+ export * from './resolveHookState';
@@ -0,0 +1 @@
1
+ export * from './resolveHookState';
@@ -0,0 +1,4 @@
1
+ import { type IHookStateInitAction, type IHookStateResolvable, type IHookStateSetAction } from '../types';
2
+ export declare function resolveHookState<TState>(nextState: IHookStateInitAction<TState>): TState;
3
+ export declare function resolveHookState<TState, TCurrentState extends TState>(nextState: IHookStateSetAction<TState>, currentState?: TCurrentState): TState;
4
+ export declare function resolveHookState<TState, TCurrentState extends TState>(nextState: IHookStateResolvable<TState>, currentState?: TCurrentState): TState;
@@ -0,0 +1,8 @@
1
+ export function resolveHookState(nextState, currentState) {
2
+ if (typeof nextState === 'function') {
3
+ return nextState.length
4
+ ? nextState(currentState)
5
+ : nextState();
6
+ }
7
+ return nextState;
8
+ }
@@ -0,0 +1,5 @@
1
+ export type IHookStateInitialSetter<TState> = () => TState;
2
+ export type IHookStateInitAction<TState> = TState | IHookStateInitialSetter<TState>;
3
+ export type IHookStateSetter<TState> = ((prevState: TState) => TState) | (() => TState);
4
+ export type IHookStateSetAction<TState> = TState | IHookStateSetter<TState>;
5
+ export type IHookStateResolvable<TState> = TState | IHookStateInitialSetter<TState> | IHookStateSetter<TState>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './useTimeoutFn';
@@ -0,0 +1 @@
1
+ export * from './useTimeoutFn';
@@ -0,0 +1,2 @@
1
+ export type UseTimeoutFnReturn = [() => boolean | null, () => void, () => void];
2
+ export declare function useTimeoutFn(fn: Function, ms?: number): UseTimeoutFnReturn;
@@ -0,0 +1,29 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ export function useTimeoutFn(fn, ms = 0) {
3
+ const ready = useRef(false);
4
+ const timeout = useRef(null);
5
+ const callback = useRef(fn);
6
+ const isReady = useCallback(() => ready.current, []);
7
+ const set = useCallback(() => {
8
+ ready.current = false;
9
+ timeout.current && clearTimeout(timeout.current);
10
+ timeout.current = setTimeout(() => {
11
+ ready.current = true;
12
+ callback.current();
13
+ }, ms);
14
+ }, [ms]);
15
+ const clear = useCallback(() => {
16
+ ready.current = null;
17
+ timeout.current && clearTimeout(timeout.current);
18
+ }, []);
19
+ // update ref when function changes
20
+ useEffect(() => {
21
+ callback.current = fn;
22
+ }, [fn]);
23
+ // set on mount, clear on unmount
24
+ useEffect(() => {
25
+ set();
26
+ return clear;
27
+ }, [ms]);
28
+ return [isReady, clear, set];
29
+ }
@@ -0,0 +1 @@
1
+ export * from './useDebounce';
@@ -0,0 +1 @@
1
+ export * from './useDebounce';
@@ -0,0 +1 @@
1
+ export * from './useDebounce';
@@ -0,0 +1 @@
1
+ export * from './useDebounce';
@@ -0,0 +1,6 @@
1
+ import { type DependencyList } from 'react';
2
+ export type UseDebounceReturn = [() => boolean | null, () => void];
3
+ /**
4
+ * Хук откладывает вызов функции, пока не пройдет переданное число миллисекунд после последнего вызова debounce-функции.
5
+ */
6
+ export declare function useDebounce(fn: Function, ms?: number, deps?: DependencyList): UseDebounceReturn;
@@ -0,0 +1,10 @@
1
+ import { useEffect } from 'react';
2
+ import { useTimeoutFn } from './hooks/useTimeoutFn';
3
+ /**
4
+ * Хук откладывает вызов функции, пока не пройдет переданное число миллисекунд после последнего вызова debounce-функции.
5
+ */
6
+ export function useDebounce(fn, ms = 0, deps = []) {
7
+ const [isReady, cancel, reset] = useTimeoutFn(fn, ms);
8
+ useEffect(reset, deps);
9
+ return [isReady, cancel];
10
+ }
@@ -1 +1 @@
1
- export { useFirstMountState } from './useFirstMountState';
1
+ export * from './useFirstMountState';
@@ -1 +1 @@
1
- export { useFirstMountState } from './useFirstMountState';
1
+ export * from './useFirstMountState';
@@ -1 +1 @@
1
- export { useFirstMountState } from './useFirstMountState';
1
+ export * from './useFirstMountState';
@@ -1 +1 @@
1
- export { useFirstMountState } from './useFirstMountState';
1
+ export * from './useFirstMountState';
@@ -1 +1,4 @@
1
- export { useFirstMountState } from 'react-use';
1
+ /**
2
+ * Хук возвращает true если компонент только монтировался (при первом рендере) и false в другом случае.
3
+ */
4
+ export declare function useFirstMountState(): boolean;
@@ -1 +1,12 @@
1
- export { useFirstMountState } from 'react-use';
1
+ import { useRef } from 'react';
2
+ /**
3
+ * Хук возвращает true если компонент только монтировался (при первом рендере) и false в другом случае.
4
+ */
5
+ export function useFirstMountState() {
6
+ const isFirst = useRef(true);
7
+ if (isFirst.current) {
8
+ isFirst.current = false;
9
+ return true;
10
+ }
11
+ return isFirst.current;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './useIntersection';
@@ -0,0 +1 @@
1
+ export * from './useIntersection';
@@ -0,0 +1 @@
1
+ export * from './useIntersection';
@@ -0,0 +1 @@
1
+ export * from './useIntersection';
@@ -0,0 +1,5 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Хук отслеживает изменения в пересечении целевого элемента с родительским элементом или с верхним уровнем области просмотра документа.
4
+ */
5
+ export declare const useIntersection: (ref: RefObject<HTMLElement | null>, options: IntersectionObserverInit) => IntersectionObserverEntry | null;
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from 'react';
2
+ /**
3
+ * Хук отслеживает изменения в пересечении целевого элемента с родительским элементом или с верхним уровнем области просмотра документа.
4
+ */
5
+ export const useIntersection = (ref, options) => {
6
+ const [intersectionObserverEntry, setIntersectionObserverEntry] = useState(null);
7
+ useEffect(() => {
8
+ if (ref.current && typeof IntersectionObserver === 'function') {
9
+ const handler = (entries) => {
10
+ setIntersectionObserverEntry(entries[0]);
11
+ };
12
+ const observer = new IntersectionObserver(handler, options);
13
+ observer.observe(ref.current);
14
+ return () => {
15
+ setIntersectionObserverEntry(null);
16
+ observer.disconnect();
17
+ };
18
+ }
19
+ return () => { };
20
+ }, [ref.current, options.threshold, options.root, options.rootMargin]);
21
+ return intersectionObserverEntry;
22
+ };
@@ -1 +1 @@
1
- export { useInterval } from './useInterval';
1
+ export * from './useInterval';
@@ -1 +1 @@
1
- export { useInterval } from './useInterval';
1
+ export * from './useInterval';
@@ -1 +1 @@
1
- export { useInterval } from './useInterval';
1
+ export * from './useInterval';
@@ -1 +1 @@
1
- export { useInterval } from './useInterval';
1
+ export * from './useInterval';
@@ -1 +1,6 @@
1
- export { useInterval } from 'react-use';
1
+ /**
2
+ * Хук для запуска функции с заданным интервалом.
3
+ * Если передать null, интервал не будет запущен (или будет остановлен).
4
+ * Если значение не указано (undefined), используется задержка 0 мс.
5
+ */
6
+ export declare const useInterval: (callback: Function, delay?: number | null) => void;
@@ -1 +1,19 @@
1
- export { useInterval } from 'react-use';
1
+ import { useEffect, useRef } from 'react';
2
+ /**
3
+ * Хук для запуска функции с заданным интервалом.
4
+ * Если передать null, интервал не будет запущен (или будет остановлен).
5
+ * Если значение не указано (undefined), используется задержка 0 мс.
6
+ */
7
+ export const useInterval = (callback, delay) => {
8
+ const savedCallback = useRef(() => { });
9
+ useEffect(() => {
10
+ savedCallback.current = callback;
11
+ });
12
+ useEffect(() => {
13
+ if (delay !== null) {
14
+ const interval = setInterval(() => savedCallback.current(), delay || 0);
15
+ return () => clearInterval(interval);
16
+ }
17
+ return undefined;
18
+ }, [delay]);
19
+ };
@@ -0,0 +1 @@
1
+ export * from './useIsomorphicLayoutEffect';
@@ -0,0 +1 @@
1
+ export * from './useIsomorphicLayoutEffect';
@@ -0,0 +1,2 @@
1
+ import { useEffect } from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
@@ -0,0 +1,5 @@
1
+ import { useEffect, useLayoutEffect } from 'react';
2
+ import { isBrowser } from '../utils/isBrowser';
3
+ export const useIsomorphicLayoutEffect = isBrowser
4
+ ? useLayoutEffect
5
+ : useEffect;
@@ -1 +1 @@
1
- export * from './useLocalStorage';
1
+ export { default as useLocalStorage } from './useLocalStorage';
@@ -1 +1 @@
1
- export * from './useLocalStorage';
1
+ export { default as useLocalStorage } from './useLocalStorage';
@@ -1 +1 @@
1
- export * from './useLocalStorage';
1
+ export { default as useLocalStorage } from './useLocalStorage';
@@ -1 +1 @@
1
- export * from './useLocalStorage';
1
+ export { default as useLocalStorage } from './useLocalStorage';
@@ -1 +1,15 @@
1
- export { useLocalStorage } from 'react-use';
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
+ type ParserOptions<T> = {
3
+ raw: true;
4
+ } | {
5
+ raw: false;
6
+ serializer: (value: T) => string;
7
+ deserializer: (value: string) => T;
8
+ };
9
+ /**
10
+ * Хук управляет состоянием, которое синхронизируется с localStorage браузера.
11
+ * Возвращает текущее значение, функцию для его обновления и функцию для удаления значения из localStorage.
12
+ */
13
+ export declare const useLocalStorage: <T>(key: string, initialValue?: T | undefined, options?: ParserOptions<T> | undefined) => [T | undefined, Dispatch<SetStateAction<T | undefined>>, () => void];
14
+ declare const useLocalStorageExport: <T>(key: string, initialValue?: T | undefined, options?: ParserOptions<T> | undefined) => [T | undefined, Dispatch<SetStateAction<T | undefined>>, () => void];
15
+ export default useLocalStorageExport;
@@ -1 +1,96 @@
1
- export { useLocalStorage } from 'react-use';
1
+ import { useCallback, useLayoutEffect, useRef, useState, } from 'react';
2
+ import { isBrowser } from '../utils/isBrowser';
3
+ const noop = () => { };
4
+ /**
5
+ * Хук управляет состоянием, которое синхронизируется с localStorage браузера.
6
+ * Возвращает текущее значение, функцию для его обновления и функцию для удаления значения из localStorage.
7
+ */
8
+ export const useLocalStorage = (key, initialValue, options) => {
9
+ if (!key) {
10
+ throw new Error('useLocalStorage key may not be falsy');
11
+ }
12
+ const deserializer = (() => {
13
+ if (!options) {
14
+ return JSON.parse;
15
+ }
16
+ if (options.raw) {
17
+ return (value) => value;
18
+ }
19
+ return options.deserializer;
20
+ })();
21
+ const serializer = (() => {
22
+ if (!options) {
23
+ return JSON.stringify;
24
+ }
25
+ if (options.raw) {
26
+ return String;
27
+ }
28
+ return options.serializer;
29
+ })();
30
+ const initializer = useRef((newKey) => {
31
+ try {
32
+ const localStorageValue = localStorage.getItem(newKey);
33
+ if (localStorageValue !== null) {
34
+ return deserializer(localStorageValue);
35
+ }
36
+ if (initialValue) {
37
+ localStorage.setItem(newKey, serializer(initialValue));
38
+ }
39
+ return initialValue;
40
+ }
41
+ catch {
42
+ // If user is in private mode or has storage restriction
43
+ // localStorage can throw. JSON.parse and JSON.stringify
44
+ // can throw, too.
45
+ return initialValue;
46
+ }
47
+ });
48
+ const [state, setState] = useState(() => initializer.current(key));
49
+ useLayoutEffect(() => setState(initializer.current(key)), [key]);
50
+ const serializeValue = (value, parserOptions) => {
51
+ if (!parserOptions) {
52
+ return JSON.stringify(value);
53
+ }
54
+ if (parserOptions.raw) {
55
+ return typeof value === 'string' ? value : JSON.stringify(value);
56
+ }
57
+ return parserOptions.serializer(value);
58
+ };
59
+ const set = useCallback((valOrFunc) => {
60
+ try {
61
+ const newState = typeof valOrFunc === 'function'
62
+ ? valOrFunc(state)
63
+ : valOrFunc;
64
+ if (typeof newState === 'undefined') {
65
+ return;
66
+ }
67
+ const value = serializeValue(newState, options);
68
+ localStorage.setItem(key, value);
69
+ setState(deserializer(value));
70
+ }
71
+ catch {
72
+ // If user is in private mode or has storage restriction
73
+ // localStorage can throw. Also JSON.stringify can throw.
74
+ }
75
+ }, [key, setState]);
76
+ const remove = useCallback(() => {
77
+ try {
78
+ localStorage.removeItem(key);
79
+ setState(undefined);
80
+ }
81
+ catch {
82
+ // If user is in private mode or has storage restriction
83
+ // localStorage can throw.
84
+ }
85
+ }, [key, setState]);
86
+ return [state, set, remove];
87
+ };
88
+ const useLocalStorageFallback = ((initialValue) => [
89
+ initialValue,
90
+ noop,
91
+ noop,
92
+ ]);
93
+ const useLocalStorageExport = isBrowser
94
+ ? useLocalStorage
95
+ : useLocalStorageFallback;
96
+ export default useLocalStorageExport;
@@ -0,0 +1 @@
1
+ export { default as useMeasure } from './useMeasure';
@@ -0,0 +1 @@
1
+ export { default as useMeasure } from './useMeasure';
@@ -0,0 +1 @@
1
+ export { default as useMeasure } from './useMeasure';
@@ -0,0 +1 @@
1
+ export { default as useMeasure } from './useMeasure';
@@ -0,0 +1,13 @@
1
+ export type UseMeasureRect = Pick<DOMRectReadOnly, 'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'>;
2
+ export type UseMeasureRef<TElement extends Element = Element> = (element: TElement) => void;
3
+ export type UseMeasureResult<TElement extends Element = Element> = [
4
+ UseMeasureRef<TElement>,
5
+ UseMeasureRect
6
+ ];
7
+ /**
8
+ * Хук отслеживает размеры HTML-элемента с помощью Resize Observer API.
9
+ * Принимает ref на HTML-элемент и возвращает объект с размерами элемента.
10
+ */
11
+ declare function useMeasure<TElement extends Element = Element>(): UseMeasureResult<TElement>;
12
+ declare const useMeasureExport: typeof useMeasure;
13
+ export default useMeasureExport;