rc-lib-ui 1.2.26 → 1.3.1

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.
@@ -1,27 +1,3 @@
1
- import { SxProps, Theme } from '@mui/material';
2
- import { default as React, ReactNode } from 'react';
3
- import { ListMenuProps } from './components/ListMemu/ListMenu';
4
- import { MuiHeaderProps } from './components/MuiHeader';
5
- import { MuiMenuProps } from './components/MuiMenu';
6
- export type DashboardControlProps = Record<'handleMenuOpen' | 'handleMenuClose' | 'handleMenuToggle', () => void> & {
7
- isOpen: boolean;
8
- listRef: React.RefObject<HTMLUListElement>;
9
- };
10
- type Statuses_OR = 'isDefaultOpen' | 'isHeader' | 'isMenu' | 'isMenuHeader' | 'isHeaderResize' | 'isButtonCenterMenu' | 'isHeaderDefault';
11
- export interface DashboardProps extends Pick<ListMenuProps, 'listMenu' | 'styleList'> {
12
- Footer?: ReactNode;
13
- columnMenu?: Partial<MuiMenuProps['columnMenu'] & {
14
- position?: 'right' | 'left';
15
- }>;
16
- children?: ReactNode;
17
- HeaderContent?: ReactNode | ((config: DashboardControlProps) => React.ReactNode);
18
- statuses?: Partial<Record<Statuses_OR, boolean>>;
19
- sx?: SxProps<Theme>;
20
- itemsProps?: {
21
- MuiHeader?: Pick<MuiHeaderProps, 'sx' | 'bgColor' | 'AfterComponent'>;
22
- MuiListMenu?: Pick<ListMenuProps, 'sx'>;
23
- };
24
- classes?: Partial<Record<'listMenu' | 'header' | 'dashboard' | 'main', string>>;
25
- }
1
+ import { default as React } from 'react';
2
+ import { DashboardControlProps, DashboardProps } from './Dashboard.types';
26
3
  export declare const Dashboard: React.MemoExoticComponent<React.ForwardRefExoticComponent<DashboardProps & React.RefAttributes<DashboardControlProps>>>;
27
- export {};
@@ -0,0 +1,24 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { SxProps, Theme } from '@mui/material';
3
+ import { ListMenuProps, MuiHeaderProps, MuiMenuProps } from './components';
4
+ export type DashboardControlProps = Record<'handleMenuOpen' | 'handleMenuClose' | 'handleMenuToggle', () => void> & {
5
+ isOpen: boolean;
6
+ listRef: React.RefObject<HTMLUListElement>;
7
+ };
8
+ type Statuses_OR = 'isDefaultOpen' | 'isHeader' | 'isMenu' | 'isMenuHeader' | 'isHeaderResize' | 'isButtonCenterMenu' | 'isHeaderDefault';
9
+ export interface DashboardProps extends Pick<ListMenuProps, 'listMenu' | 'styleList'> {
10
+ Footer?: ReactNode;
11
+ columnMenu?: Partial<MuiMenuProps['columnMenu'] & {
12
+ position?: 'right' | 'left';
13
+ }>;
14
+ children?: ReactNode;
15
+ HeaderContent?: ReactNode | ((config: DashboardControlProps) => React.ReactNode);
16
+ statuses?: Partial<Record<Statuses_OR, boolean>>;
17
+ sx?: SxProps<Theme>;
18
+ itemsProps?: {
19
+ MuiHeader?: Pick<MuiHeaderProps, 'sx' | 'bgColor' | 'AfterComponent'>;
20
+ MuiListMenu?: Pick<ListMenuProps, 'sx'>;
21
+ };
22
+ classes?: Partial<Record<'listMenu' | 'header' | 'dashboard' | 'main', string>>;
23
+ }
24
+ export {};
@@ -1,2 +1,3 @@
1
1
  export * from './Dashboard';
2
+ export * from './Dashboard.types';
2
3
  export { MuiHeader, type MuiHeaderProps } from './components/MuiHeader';
@@ -1 +1 @@
1
- export * from './useShowPanel';
1
+ export * from './useTimer';
@@ -0,0 +1,13 @@
1
+ interface UseTimerProps {
2
+ timer?: number;
3
+ defaultIsActive?: boolean;
4
+ }
5
+ export declare const useTimer: ({ defaultIsActive, timer }: UseTimerProps) => {
6
+ isActive: boolean;
7
+ handleActive: () => void;
8
+ handleResetTime: () => void;
9
+ handlePauseTimer: () => void;
10
+ handleResumeTimer: () => void;
11
+ handleDeActive: () => void;
12
+ };
13
+ export {};
package/dist/hooks.js CHANGED
@@ -1,35 +1,35 @@
1
- import { useState as h, useRef as m, useEffect as P, useCallback as r } from "react";
2
- import { T as w } from "./index-DjJlkTF6.js";
3
- import { s as f } from "./index-B7GqTJat.js";
4
- const p = (s = { timerShowPanel: 5e3 }) => {
5
- const [t, a] = h({
6
- showPanel: !0
7
- }), n = f(t, a), e = m(null);
8
- P(() => (e.current = new w(s.timerShowPanel, () => {
9
- console.log("Время истекло, скрываем панель"), n({ showPanel: !1 });
1
+ import { useState as v, useRef as A, useEffect as T, useCallback as r } from "react";
2
+ import { T as l } from "./index-DjJlkTF6.js";
3
+ import { s as p } from "./index-B7GqTJat.js";
4
+ const S = ({ defaultIsActive: c = !0, timer: s = 5e3 }) => {
5
+ const [t, n] = v({
6
+ isActive: c
7
+ }), i = p(t, n), e = A(null);
8
+ T(() => (e.current = new l(s, () => {
9
+ console.log("Время истекло, скрываем панель"), i({ isActive: !1 });
10
10
  }), e.current.startTime(), () => {
11
11
  e.current && e.current.resetTime();
12
- }), [s.timerShowPanel]);
13
- const o = r(() => {
14
- t.showPanel || (n({ showPanel: !0 }), e.current && (e.current.resetTime(), e.current.startTime()));
15
- }, [t.showPanel]), l = r(() => {
16
- e.current && t.showPanel && (e.current.resetTime(), e.current.startTime());
17
- }, [t.showPanel]), c = r(() => {
18
- e.current && t.showPanel && e.current.pauseTime();
19
- }, [t.showPanel]), u = r(() => {
20
- e.current && t.showPanel && e.current.startTime();
21
- }, [t.showPanel]), i = r(() => {
22
- n({ showPanel: !1 }), e.current && e.current.resetTime();
12
+ }), [s]);
13
+ const u = r(() => {
14
+ t.isActive || (i({ isActive: !0 }), e.current && (e.current.resetTime(), e.current.startTime()));
15
+ }, [t.isActive]), a = r(() => {
16
+ e.current && t.isActive && (e.current.resetTime(), e.current.startTime());
17
+ }, [t.isActive]), m = r(() => {
18
+ e.current && t.isActive && e.current.pauseTime();
19
+ }, [t.isActive]), o = r(() => {
20
+ e.current && t.isActive && e.current.startTime();
21
+ }, [t.isActive]), f = r(() => {
22
+ i({ isActive: !1 }), e.current && e.current.resetTime();
23
23
  }, []);
24
24
  return {
25
- showPanel: t.showPanel,
26
- handleShowPanel: o,
27
- handleResetTimePanel: l,
28
- handlePauseTimer: c,
29
- handleResumeTimer: u,
30
- handleHidePanel: i
25
+ isActive: t.isActive,
26
+ handleActive: u,
27
+ handleResetTime: a,
28
+ handlePauseTimer: m,
29
+ handleResumeTimer: o,
30
+ handleDeActive: f
31
31
  };
32
32
  };
33
33
  export {
34
- p as useShowPanel
34
+ S as useTimer
35
35
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rc-lib-ui",
3
3
  "private": false,
4
- "version": "1.2.26",
4
+ "version": "1.3.1",
5
5
  "author": "SinGlEBW",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -1,12 +0,0 @@
1
- interface UseShowPanelProps {
2
- timerShowPanel?: number;
3
- }
4
- export declare const useShowPanel: (props?: UseShowPanelProps) => {
5
- showPanel: boolean;
6
- handleShowPanel: () => void;
7
- handleResetTimePanel: () => void;
8
- handlePauseTimer: () => void;
9
- handleResumeTimer: () => void;
10
- handleHidePanel: () => void;
11
- };
12
- export {};