rc-lib-ui 1.2.25 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +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
- };
9
- type Statuses_OR = 'isDefaultOpen' | 'isHeader' | 'isMenu' | 'isMenuHeader' | 'isHeaderResize' | 'isButtonCenterMenu' | 'isHeaderDefault';
10
- export interface DashboardProps extends Pick<ListMenuProps, 'listMenu' | 'styleList'> {
11
- Footer?: ReactNode;
12
- columnMenu?: Partial<MuiMenuProps['columnMenu'] & {
13
- position?: 'right' | 'left';
14
- }>;
15
- children?: ReactNode;
16
- HeaderContent?: ReactNode | ((config: DashboardControlProps) => React.ReactNode);
17
- statuses?: Partial<Record<Statuses_OR, boolean>>;
18
- sx?: SxProps<Theme>;
19
- itemsProps?: {
20
- MuiHeader?: Pick<MuiHeaderProps, 'sx' | 'bgColor' | 'AfterComponent'>;
21
- MuiListMenu?: Pick<ListMenuProps, 'sx'>;
22
- };
23
- classes?: Partial<Record<'listMenu' | 'header' | 'dashboard' | 'main', string>>;
24
- }
1
+ import { default as React } from 'react';
2
+ import { DashboardControlProps, DashboardProps } from './Dashboard.types';
25
3
  export declare const Dashboard: React.MemoExoticComponent<React.ForwardRefExoticComponent<DashboardProps & React.RefAttributes<DashboardControlProps>>>;
26
- 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';
package/dist/dashboard.js CHANGED
@@ -171,22 +171,22 @@ const Mi = g("main")(() => ({
171
171
  }
172
172
  }
173
173
  })), q = ({ isIcon: i }) => ({ paddingRight: 1.2, ...!i && { paddingLeft: 1.2 } }), ji = V(({ styleList: i = "variant1", isRight: a, columnMenu: l, isWrapText: e = !1, listMenu: n, isOpen: t, sx: o, className: r }, c) => {
174
- const { minWidthColumn: u } = l, [I, C] = O(""), W = li(() => n.map(({ action: H, icon: x, title: F, sx: k = {}, onClick: S, children: w, to: D, id: h }, L) => {
175
- const p = `${h || L}`, b = (m) => {
176
- C(p), S && S(m);
174
+ const { minWidthColumn: u } = l, [I, C] = O(""), W = li(() => n.map(({ action: H, icon: x, title: F, sx: k = {}, onClick: S, children: b, to: D, id: h }, L) => {
175
+ const p = `${h || L}`, m = (w) => {
176
+ C(p), S && S(w);
177
177
  };
178
- return w && Array.isArray(w) ? /* @__PURE__ */ d(vi, { children: /* @__PURE__ */ d(
178
+ return b && Array.isArray(b) ? /* @__PURE__ */ d(vi, { children: /* @__PURE__ */ d(
179
179
  $i,
180
180
  {
181
181
  defaultStatus: t,
182
- render: (m) => /* @__PURE__ */ d(G, { children: /* @__PURE__ */ s(Y, { disablePadding: !0, sx: k, visual: i, children: [
182
+ render: (w) => /* @__PURE__ */ d(G, { children: /* @__PURE__ */ s(Y, { disablePadding: !0, sx: k, visual: i, children: [
183
183
  /* @__PURE__ */ s(
184
184
  U,
185
185
  {
186
- isOpen: m.is,
186
+ isOpen: w.is,
187
187
  isWrapText: e,
188
188
  onClick: (M) => {
189
- m.handleToggle(), typeof S == "function" && S(M);
189
+ w.handleToggle(), typeof S == "function" && S(M);
190
190
  },
191
191
  sx: { ...q({ isIcon: x }) },
192
192
  className: "MuiButtonControlCollapse",
@@ -209,12 +209,12 @@ const Mi = g("main")(() => ({
209
209
  ),
210
210
  t && /* @__PURE__ */ s(G, { children: [
211
211
  H,
212
- m.is ? /* @__PURE__ */ d(Wi, {}) : /* @__PURE__ */ d(Hi, {})
212
+ w.is ? /* @__PURE__ */ d(Wi, {}) : /* @__PURE__ */ d(Hi, {})
213
213
  ] })
214
214
  ]
215
215
  }
216
216
  ),
217
- /* @__PURE__ */ d(pi, { in: m.is && t, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ d(ai, { disablePadding: !0, className: r, children: w.map(({ action: M, icon: y, title: T, to: R, sx: j = {}, id: $, onClick: B }, v) => {
217
+ /* @__PURE__ */ d(pi, { in: w.is && t, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ d(ai, { disablePadding: !0, className: r, children: b.map(({ action: M, icon: y, title: T, to: R, sx: j = {}, id: $, onClick: B }, v) => {
218
218
  const f = `${L}-${$ || v}`, z = (ci) => {
219
219
  C(f), B && B(ci);
220
220
  };
@@ -247,7 +247,7 @@ const Mi = g("main")(() => ({
247
247
  U,
248
248
  {
249
249
  isOpen: t,
250
- onClick: b,
250
+ onClick: m,
251
251
  isWrapText: e,
252
252
  ...D ? { to: D, component: ni } : { to: "", className: _({ "Mui-selected": I === p }) },
253
253
  sx: { ...q({ isIcon: x }) },
@@ -386,7 +386,7 @@ const Mi = g("main")(() => ({
386
386
  var R, j, $, B;
387
387
  const C = bi(), W = (r == null ? void 0 : r.position) === "right", H = !1, x = !0;
388
388
  //!!statuses?.isScrollIndentation
389
- const F = (n == null ? void 0 : n.isHeaderDefault) === void 0 ? !0 : n == null ? void 0 : n.isHeaderDefault, k = (n == null ? void 0 : n.isHeader) === void 0 ? !0 : n == null ? void 0 : n.isHeader, S = (n == null ? void 0 : n.isMenu) === void 0 ? !0 : n == null ? void 0 : n.isMenu, w = (r == null ? void 0 : r.initWidth) || 250, D = li(() => r != null && r.minWidthColumn && Object.keys(r == null ? void 0 : r.minWidthColumn).length ? r == null ? void 0 : r.minWidthColumn : {
389
+ const F = (n == null ? void 0 : n.isHeaderDefault) === void 0 ? !0 : n == null ? void 0 : n.isHeaderDefault, k = (n == null ? void 0 : n.isHeader) === void 0 ? !0 : n == null ? void 0 : n.isHeader, S = (n == null ? void 0 : n.isMenu) === void 0 ? !0 : n == null ? void 0 : n.isMenu, b = (r == null ? void 0 : r.initWidth) || 250, D = li(() => r != null && r.minWidthColumn && Object.keys(r == null ? void 0 : r.minWidthColumn).length ? r == null ? void 0 : r.minWidthColumn : {
390
390
  width: `calc(${C.spacing(7)} + 1px)`,
391
391
  [C.breakpoints.up("sm")]: {
392
392
  width: `calc(${C.spacing(8)} + 1px)`
@@ -395,20 +395,20 @@ const Mi = g("main")(() => ({
395
395
  isOpen: !!(n != null && n.isDefaultOpen),
396
396
  widthCloseColumn: 0,
397
397
  widthScroll: 0
398
- }), p = Ii(h, L), b = K(null);
398
+ }), p = Ii(h, L), m = K(null);
399
399
  Q(() => {
400
- if (b.current) {
401
- const v = ei(b.current);
400
+ if (m.current) {
401
+ const v = ei(m.current);
402
402
  let f = !1;
403
403
  v > 0 && (f = !0), p({ widthScroll: f ? v + 1 : 0 }), window.onresize = function() {
404
- if (b.current) {
405
- const z = ei(b.current);
404
+ if (m.current) {
405
+ const z = ei(m.current);
406
406
  f && !z && (f = !1, p({ widthScroll: 0 })), !f && z && (f = !0, p({ widthScroll: z + 1 }));
407
407
  }
408
408
  };
409
409
  }
410
410
  }, [x]);
411
- const m = () => {
411
+ const w = () => {
412
412
  p({ isOpen: !0 });
413
413
  }, M = () => {
414
414
  p({ isOpen: !1 });
@@ -416,15 +416,16 @@ const Mi = g("main")(() => ({
416
416
  L((v) => ({ ...v, isOpen: !v.isOpen }));
417
417
  }, T = {
418
418
  isOpen: h.isOpen,
419
- handleMenuOpen: m,
419
+ handleMenuOpen: w,
420
420
  handleMenuClose: M,
421
- handleMenuToggle: y
421
+ handleMenuToggle: y,
422
+ listRef: m
422
423
  };
423
424
  return Ci(I, () => T), /* @__PURE__ */ s(J, { className: _("Dashboard", o == null ? void 0 : o.dashboard), sx: { display: "flex", height: "inherit", ...u }, children: [
424
425
  k ? F ? /* @__PURE__ */ d(
425
426
  Vi,
426
427
  {
427
- initWidth: w,
428
+ initWidth: b,
428
429
  isOpen: h.isOpen,
429
430
  bgColor: (R = t == null ? void 0 : t.MuiHeader) == null ? void 0 : R.bgColor,
430
431
  isRight: W,
@@ -442,7 +443,7 @@ const Mi = g("main")(() => ({
442
443
  open: h.isOpen,
443
444
  isRight: W,
444
445
  isWrapText: H,
445
- columnMenu: { initWidth: w, minWidthColumn: D },
446
+ columnMenu: { initWidth: b, minWidthColumn: D },
446
447
  styleList: c,
447
448
  children: [
448
449
  (n == null ? void 0 : n.isMenuHeader) !== !1 && /* @__PURE__ */ s(G, { children: [
@@ -457,10 +458,10 @@ const Mi = g("main")(() => ({
457
458
  }, children: /* @__PURE__ */ d(
458
459
  Ai,
459
460
  {
460
- ref: b,
461
+ ref: m,
461
462
  isRight: W,
462
463
  columnMenu: {
463
- initWidth: w,
464
+ initWidth: b,
464
465
  minWidthColumn: Ri(D, { newProp: "width", positionCorrect: `- ${h.widthScroll}px` })
465
466
  },
466
467
  listMenu: a,
@@ -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
+ handleResetTimePanel: () => 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 l, useCallback as r } from "react";
2
+ import { T } 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
+ l(() => (e.current = new T(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
+ handleResetTimePanel: 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.25",
4
+ "version": "1.3.0",
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 {};