@alphakits/ui 2.4.7 → 2.4.8

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 +1 @@
1
- .container_WE0K{position:fixed;inset:0;display:flex;align-items:center;justify-content:center}.content_p1kc{background:var(--color-bg-primary);box-shadow:0 0 10px #0003}@media print{.content_p1kc{width:100%!important}}.button_js2W{position:absolute!important;top:36px;right:32px;z-index:999}.inner_Zsdb{height:100%;box-sizing:border-box;overflow:auto}.right_e065{position:fixed;top:0;right:0;bottom:0;transition:width .2s,opacity .2s,right .2s;transition-delay:width .1s;transition-timing-function:ease-in}.bg_8ZfP{transition:opacity .2s;background:#00000080;position:fixed;display:block;border:0;inset:0}@media screen and (max-width:823px){.right_e065,.center_nguy{max-width:100%!important;inset:0!important}.content_p1kc{width:100%!important;height:100%!important;max-height:100%!important;box-shadow:none!important;margin:0!important;border-radius:0!important}.button_js2W{top:24px!important;right:16px!important}}
1
+ .container_WE0K{position:fixed;inset:0;display:flex;align-items:center;justify-content:center}.content_p1kc{background:var(--color-bg-primary);box-shadow:0 0 10px #0003}@media print{.content_p1kc{width:100%!important}}.button_js2W{position:absolute!important;top:36px;right:32px;z-index:999}.button_js2W.doubleModal_1ZTt{right:384px}.inner_Zsdb{height:100%;box-sizing:border-box;overflow:auto}.right_e065{position:fixed;top:0;right:0;bottom:0;transition:width .2s,opacity .2s,right .2s;transition-delay:width .1s;transition-timing-function:ease-in}.bg_8ZfP{transition:opacity .2s;background:#00000080;position:fixed;display:block;border:0;inset:0}@media screen and (max-width:823px){.right_e065,.center_nguy{max-width:100%!important;inset:0!important}.content_p1kc{width:100%!important;height:100%!important;max-height:100%!important;box-shadow:none!important;margin:0!important;border-radius:0!important}.button_js2W{top:24px!important;right:16px!important}}
@@ -1,19 +1,21 @@
1
1
  import * as __css from './index.css';
2
2
  export const __cssModule = __css;
3
- const n = "container_WE0K", t = "content_p1kc", o = "button_js2W", c = "inner_Zsdb", e = "right_e065", s = "bg_8ZfP", r = {
4
- container: n,
5
- content: t,
3
+ const t = "container_WE0K", n = "content_p1kc", o = "button_js2W", e = "doubleModal_1ZTt", c = "inner_Zsdb", s = "right_e065", b = "bg_8ZfP", r = {
4
+ container: t,
5
+ content: n,
6
6
  button: o,
7
+ doubleModal: e,
7
8
  inner: c,
8
- right: e,
9
- bg: s
9
+ right: s,
10
+ bg: b
10
11
  };
11
12
  export {
12
- s as bg,
13
+ b as bg,
13
14
  o as button,
14
- n as container,
15
- t as content,
15
+ t as container,
16
+ n as content,
16
17
  r as default,
18
+ e as doubleModal,
17
19
  c as inner,
18
- e as right
20
+ s as right
19
21
  };
@@ -1,16 +1,16 @@
1
- import { jsxs as k, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as d, jsx as i } from "react/jsx-runtime";
2
2
  import y from "@alphakits/icons/dist/CloseM";
3
- import b from "classnames";
3
+ import k from "classnames";
4
4
  import { useState as v, useLayoutEffect as x, useCallback as w, useEffect as E } from "react";
5
5
  import { Button as g } from "../../../button/component.js";
6
6
  import { showConfirm as F } from "../../../confirm-popup/component.js";
7
- import t from "./index.module.css.js";
7
+ import s from "./index.module.css.js";
8
8
  const C = {
9
9
  s: 488,
10
10
  m: 888,
11
11
  full: "96%"
12
- }, d = 102, N = (e) => e === "full" ? `calc(-96vw - ${d}px)` : -C[e] - d, j = ({ modal: e, t: r, index: f, dirtyModals: a, closeModal: l, currentModalId: c }) => {
13
- const m = N(e.props.size), [h, p] = v(m);
12
+ }, b = 102, N = (e) => e === "full" ? `calc(-96vw - ${b}px)` : -C[e] - b, j = ({ modal: e, t: r, index: m, dirtyModals: a, closeModal: l, currentModalId: c }) => {
13
+ const f = N(e.props.size), [h, p] = v(f);
14
14
  x(() => {
15
15
  const o = requestAnimationFrame(() => p(0));
16
16
  return () => cancelAnimationFrame(o);
@@ -24,56 +24,58 @@ const C = {
24
24
  }) : Promise.resolve(!0),
25
25
  // eslint-disable-next-line react-hooks/exhaustive-deps
26
26
  [a, r]
27
- ), n = w(
27
+ ), t = w(
28
28
  async (o) => {
29
- const { id: s } = e;
30
- await u(o || s) && (p(m), setTimeout(() => {
31
- e.props.closeCallback && e.props.closeCallback(), l(o || s);
29
+ const { id: n } = e;
30
+ await u(o || n) && (p(f), setTimeout(() => {
31
+ e.props.closeCallback && e.props.closeCallback(), l(o || n);
32
32
  }, 250));
33
33
  },
34
- [l, u, e, m]
34
+ [l, u, e, f]
35
35
  );
36
36
  return E(() => {
37
- const o = (s) => {
38
- (s.key === "27" || s.key === "Escape") && n(c);
37
+ const o = (n) => {
38
+ (n.key === "27" || n.key === "Escape") && t(c);
39
39
  };
40
40
  return e.id === c && window?.addEventListener("keydown", o), () => {
41
41
  window?.removeEventListener("keydown", o);
42
42
  };
43
- }, [n, c, e.id]), /* @__PURE__ */ k(
43
+ }, [t, c, e.id]), /* @__PURE__ */ d(
44
44
  "div",
45
45
  {
46
- className: t.container,
46
+ className: s.container,
47
47
  style: {
48
- zIndex: 9999998 + f
48
+ zIndex: 9999998 + m
49
49
  },
50
50
  children: [
51
51
  /* @__PURE__ */ i(
52
52
  "div",
53
53
  {
54
- className: b(t.right, t.content),
54
+ className: k(s.right, s.content),
55
55
  style: {
56
- zIndex: 9999999 + f,
56
+ zIndex: 9999999 + m,
57
57
  width: C[e.props.size],
58
58
  right: h
59
59
  },
60
- children: /* @__PURE__ */ k("div", { className: t.inner, children: [
60
+ children: /* @__PURE__ */ d("div", { className: s.inner, children: [
61
61
  /* @__PURE__ */ i(
62
62
  e.modal,
63
63
  {
64
64
  ...e.props,
65
65
  modalId: e.id,
66
- close: () => n()
66
+ close: () => t()
67
67
  }
68
68
  ),
69
69
  /* @__PURE__ */ i(
70
70
  g,
71
71
  {
72
- className: t.button,
72
+ className: k(s.button, {
73
+ [s.doubleModal]: e.props.isDouble
74
+ }),
73
75
  view: "secondary",
74
76
  size: "xs",
75
77
  leftAddons: /* @__PURE__ */ i(y, {}),
76
- onClick: () => n()
78
+ onClick: () => t()
77
79
  }
78
80
  )
79
81
  ] })
@@ -82,10 +84,10 @@ const C = {
82
84
  /* @__PURE__ */ i(
83
85
  "button",
84
86
  {
85
- className: t.bg,
87
+ className: s.bg,
86
88
  "aria-label": "close_backdrop",
87
89
  type: "button",
88
- onClick: () => n()
90
+ onClick: () => t()
89
91
  }
90
92
  )
91
93
  ]
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { ModalObject, ModalSize, OwnModalProps, TFunction } from '../types';
3
3
  export declare const useModal: (t: TFunction) => {
4
- openModal: <T>(modal: React.FC<T>, size?: ModalSize) => (props?: OwnModalProps<T>, closeCallback?: () => void) => void;
4
+ openModal: <T>(modal: React.FC<T>, size?: ModalSize, isDouble?: boolean) => (props?: OwnModalProps<T>, closeCallback?: () => void) => void;
5
5
  modals: ModalObject[];
6
6
  setModalDirty: (id: string, isDirty: boolean) => void;
7
7
  currentModalId: string;
@@ -1,11 +1,11 @@
1
- import d, { useRef as R, useCallback as r, useEffect as S } from "react";
2
- import { v4 as b } from "uuid";
3
- import { deletePropertyById as h } from "../utils/delete-property-by-id.js";
4
- const w = (n) => {
5
- const [s, l] = d.useState([]), [f, a] = d.useState(""), [p, c] = d.useState({}), u = R(n);
1
+ import d, { useRef as S, useCallback as r, useEffect as b } from "react";
2
+ import { v4 as h } from "uuid";
3
+ import { deletePropertyById as v } from "../utils/delete-property-by-id.js";
4
+ const x = (n) => {
5
+ const [s, l] = d.useState([]), [f, a] = d.useState(""), [p, c] = d.useState({}), u = S(n);
6
6
  u.current = n;
7
7
  const i = r((t) => {
8
- c((e) => h(e, t)), l((e) => e.filter((o) => o.id !== t));
8
+ c((e) => v(e, t)), l((e) => e.filter((o) => o.id !== t));
9
9
  }, []), M = r((t) => {
10
10
  l((e) => [...e, t]), a(t.id);
11
11
  }, []), m = r((t, e) => {
@@ -14,21 +14,22 @@ const w = (n) => {
14
14
  [t]: e
15
15
  });
16
16
  }, []);
17
- return S(() => {
17
+ return b(() => {
18
18
  const t = [...s].pop()?.id;
19
19
  a(t || ""), document.body.style.overflow = s.length ? "hidden" : "unset";
20
20
  }, [s]), {
21
21
  openModal: r(
22
- (t, e = "s") => (o, y) => {
23
- const I = b();
22
+ (t, e = "s", o) => (y, I) => {
23
+ const R = h();
24
24
  M({
25
- id: I,
25
+ id: R,
26
26
  modal: t,
27
27
  props: {
28
28
  size: e,
29
- closeCallback: y,
29
+ isDouble: o,
30
+ closeCallback: I,
30
31
  t: u.current,
31
- ...o
32
+ ...y
32
33
  }
33
34
  });
34
35
  },
@@ -42,5 +43,5 @@ const w = (n) => {
42
43
  };
43
44
  };
44
45
  export {
45
- w as useModal
46
+ x as useModal
46
47
  };
@@ -4,6 +4,7 @@ type ModalProps = {
4
4
  close: () => void;
5
5
  modalId?: string;
6
6
  size: ModalSize;
7
+ isDouble?: boolean;
7
8
  t: TFunction;
8
9
  } & unknown;
9
10
  export type TFunction = (field: string, options?: {
@@ -19,7 +20,7 @@ export type ModalObject = {
19
20
  props: ModalProps;
20
21
  };
21
22
  export type ContextProps = {
22
- openModal: <T>(modal: React.FC<T>, size?: ModalSize) => (props?: OwnModalProps<T>, closeCallback?: () => void) => void;
23
+ openModal: <T>(modal: React.FC<T>, size?: ModalSize, isDouble?: boolean) => (props?: OwnModalProps<T>, closeCallback?: () => void) => void;
23
24
  modals: ModalObject[];
24
25
  currentModalId: ModalObject['id'];
25
26
  setModalDirty: (id: ModalObject['id'], isDirty: boolean) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphakits/ui",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "files": [
5
5
  "dist"
6
6
  ],