skillgrid 0.0.86 → 0.0.87

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.
@@ -0,0 +1 @@
1
+ :root{--dialog-margin: 12px;--dialog-border-radius: 24px}._overlay_12slx_6{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden;display:flex;flex-direction:column;background:#00000080;transition:opacity .2s ease-in-out}._container_12slx_19{position:absolute;overflow:hidden;overflow-y:auto;min-width:300px;background:var(--bg-primary);border-radius:var(--dialog-border-radius);box-shadow:0 4px 24px #0000001a}._placement-default_12slx_32{top:0;left:50%;translate:-50% 0;max-width:90dvw;max-height:90dvh;margin-right:auto;margin-left:auto;margin-block:80px}._placement-bottom-left_12slx_45{bottom:0;left:0;max-width:90dvw;max-height:90dvh;margin:12px}._placement-bottom-right_12slx_54{right:0;bottom:0;max-width:90dvw;max-height:90dvh;margin:12px}._placement-center_12slx_64{position:fixed;top:50%;left:50%;translate:-50% -50%;max-width:90dvw;max-height:90dvh;margin-right:auto;margin-left:auto}._placement-left-drawer_12slx_77{inset:0 auto 0 0;margin:12px;border-radius:16px}._placement-right-drawer_12slx_83{inset:0 0 0 auto;margin:12px;border-radius:16px}._placement-bottom-sheet_12slx_89{inset:auto 0 0;max-width:100dvw;max-height:90dvh;margin:0;border-radius:var(--dialog-border-radius) var(--dialog-border-radius) 0 0}._grabber_12slx_100{touch-action:none;position:absolute;z-index:1000;width:40px;height:4px;opacity:.7;background:var(--stroke-neutral);border-radius:4px}._grabber_12slx_100:before{content:"";position:absolute;top:-10px;right:-10px;bottom:-10px;left:-10px}._container_12slx_19:hover ._grabber_12slx_100{opacity:1}._grabber-top_12slx_127,._grabber-bottom_12slx_128{top:10px;left:50%;transform:translate(-50%)}._grabber-right_12slx_134{top:50%;left:10px;transform:translateY(-50%);width:4px;height:40px}._grabber-left_12slx_143{top:50%;right:10px;transform:translateY(-50%);width:4px;height:40px}
@@ -1,18 +1,18 @@
1
- import { jsxs as f, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as p, jsx as n } from "react/jsx-runtime";
2
2
  import { useMergeRefs as w, FloatingPortal as V, FloatingOverlay as E, FloatingFocusManager as $ } from "@floating-ui/react";
3
- import o from "./Dialog.module.css.js";
3
+ import a from "./Dialog.module.css.js";
4
4
  import { forwardRef as j } from "react";
5
5
  import { clsx as c } from "clsx";
6
6
  import { useDialogDraggable as I } from "./lib/use-dialog-draggable.js";
7
7
  import { useVisualViewportCenter as M } from "./lib/use-visual-viewport-center.js";
8
- const G = j((p, u) => {
8
+ const B = j((f, u) => {
9
9
  const {
10
10
  placement: i = "default",
11
11
  open: d,
12
- onOpenChange: m,
12
+ onOpenChange: g,
13
13
  overlayProps: e,
14
14
  portalProps: b,
15
- focusManagement: a,
15
+ focusManagement: r,
16
16
  children: h,
17
17
  disableOutsideClick: N = !1,
18
18
  disableEscapeKey: O = !1,
@@ -22,29 +22,29 @@ const G = j((p, u) => {
22
22
  style: D,
23
23
  "data-testid": s,
24
24
  ...F
25
- } = p;
25
+ } = f;
26
26
  d === void 0 && process.env.NODE_ENV !== "production" && console.error(
27
27
  "Dialog: компонент должен быть контролируемым. Используйте пропсы open и onOpenChange."
28
28
  );
29
- const r = I({
29
+ const o = I({
30
30
  open: d,
31
- onOpenChange: m,
31
+ onOpenChange: g,
32
32
  placement: i,
33
33
  disableEscapeKey: O,
34
34
  closeOnDrag: l
35
- }), { isMounted: g, transitionStyles: t } = r, y = M(i === "center" && g), v = w([u, r.refs.setFloating]), k = () => {
36
- N || m(!1);
35
+ }), { isMounted: m, transitionStyles: t } = o, y = M(i === "center" && m), v = w([u, o.refs.setFloating]), k = () => {
36
+ N || g(!1);
37
37
  };
38
- return g ? (
38
+ return m ? (
39
39
  // `FloatingPortal` рендерит диалог в корне `document.body`,
40
40
  // чтобы избежать проблем с z-index и overflow.
41
- /* @__PURE__ */ f(V, { ...b, children: [
41
+ /* @__PURE__ */ p(V, { ...b, children: [
42
42
  !x && /* @__PURE__ */ n(
43
43
  E,
44
44
  {
45
45
  onPointerDown: k,
46
46
  "data-testid": "dialog-overlay",
47
- className: c(o.overlay, e == null ? void 0 : e.className),
47
+ className: c(a.overlay, e == null ? void 0 : e.className),
48
48
  lockScroll: (e == null ? void 0 : e.lockScroll) ?? !0,
49
49
  style: {
50
50
  // Стили для анимации прозрачности оверлея
@@ -58,35 +58,36 @@ const G = j((p, u) => {
58
58
  $,
59
59
  {
60
60
  initialFocus: 1 / 0,
61
- ...a,
62
- context: { ...r.context, ...a == null ? void 0 : a.context },
63
- children: /* @__PURE__ */ f(
61
+ ...r,
62
+ context: { ...o.context, ...r == null ? void 0 : r.context },
63
+ children: /* @__PURE__ */ p(
64
64
  "section",
65
65
  {
66
66
  ref: v,
67
67
  "aria-modal": "true",
68
68
  role: "dialog",
69
- className: c(C, o.container, o[`placement-${i}`]),
69
+ className: c(C, a.container, a[`placement-${i}`]),
70
70
  style: {
71
71
  ...y ?? {},
72
72
  ...D,
73
73
  ...t
74
74
  },
75
75
  "data-testid": s,
76
- ...r.getFloatingProps(F),
76
+ ...o.getFloatingProps(F),
77
77
  children: [
78
78
  h,
79
79
  l && /* @__PURE__ */ n(
80
80
  "div",
81
81
  {
82
82
  className: c(
83
- o.grabber,
84
- o[`grabber-${l.direction}`]
83
+ a.grabber,
84
+ a[`grabber-${l.direction}`]
85
85
  // classNames?.grabber,
86
86
  ),
87
87
  role: "presentation",
88
88
  "aria-hidden": "true",
89
- "data-testid": s ? `${s}-grabber` : void 0
89
+ "data-testid": s ? `${s}-grabber` : void 0,
90
+ ...o.getGrabberProps()
90
91
  }
91
92
  )
92
93
  ]
@@ -98,5 +99,5 @@ const G = j((p, u) => {
98
99
  ) : null;
99
100
  });
100
101
  export {
101
- G as Dialog
102
+ B as Dialog
102
103
  };
@@ -1,18 +1,18 @@
1
- import '../../assets/components/Dialog/Dialog.module-OXi8ThCq.css';const e = "_overlay_1gisq_6", t = "_container_1gisq_19", r = "_grabber_1gisq_100", _ = {
1
+ import '../../assets/components/Dialog/Dialog.module-BvSBnHQm.css';const e = "_overlay_12slx_6", t = "_container_12slx_19", r = "_grabber_12slx_100", _ = {
2
2
  overlay: e,
3
3
  container: t,
4
- "placement-default": "_placement-default_1gisq_32",
5
- "placement-bottom-left": "_placement-bottom-left_1gisq_45",
6
- "placement-bottom-right": "_placement-bottom-right_1gisq_54",
7
- "placement-center": "_placement-center_1gisq_64",
8
- "placement-left-drawer": "_placement-left-drawer_1gisq_77",
9
- "placement-right-drawer": "_placement-right-drawer_1gisq_83",
10
- "placement-bottom-sheet": "_placement-bottom-sheet_1gisq_89",
4
+ "placement-default": "_placement-default_12slx_32",
5
+ "placement-bottom-left": "_placement-bottom-left_12slx_45",
6
+ "placement-bottom-right": "_placement-bottom-right_12slx_54",
7
+ "placement-center": "_placement-center_12slx_64",
8
+ "placement-left-drawer": "_placement-left-drawer_12slx_77",
9
+ "placement-right-drawer": "_placement-right-drawer_12slx_83",
10
+ "placement-bottom-sheet": "_placement-bottom-sheet_12slx_89",
11
11
  grabber: r,
12
- "grabber-top": "_grabber-top_1gisq_118",
13
- "grabber-bottom": "_grabber-bottom_1gisq_119",
14
- "grabber-right": "_grabber-right_1gisq_125",
15
- "grabber-left": "_grabber-left_1gisq_134"
12
+ "grabber-top": "_grabber-top_12slx_127",
13
+ "grabber-bottom": "_grabber-bottom_12slx_128",
14
+ "grabber-right": "_grabber-right_12slx_134",
15
+ "grabber-left": "_grabber-left_12slx_143"
16
16
  };
17
17
  export {
18
18
  t as container,
@@ -6,9 +6,12 @@ type UseDialogDraggableOptions = Pick<DialogProps, 'placement' | 'open' | 'disab
6
6
  * Оборачивает `useDialog` и добавляет обработчики событий указателя (`PointerEvents`)
7
7
  * для отслеживания перетаскивания и закрытия диалога при превышении порога.
8
8
  *
9
+ * Обработчики вешаются на граббер (`getGrabberProps`), а не на корень диалога: у контейнера
10
+ * есть `overflow-y: auto`, и на touch вертикальный жест иначе уходит в скролл.
11
+ *
9
12
  * @param {UseDialogDraggableOptions} options - Опции для конфигурации хука.
10
13
  * @returns Возвращает объект с данными и пропсами, аналогичный `useDialog`,
11
- * но с модифицированными `transitionStyles` и `getFloatingProps` для поддержки перетаскивания.
14
+ * но с модифицированными `transitionStyles` и `getGrabberProps` для поддержки перетаскивания.
12
15
  */
13
16
  export declare function useDialogDraggable({ open, onOpenChange, placement, disableEscapeKey, closeOnDrag, }: UseDialogDraggableOptions): {
14
17
  isMounted: boolean;
@@ -37,6 +40,7 @@ export declare function useDialogDraggable({ open, onOpenChange, placement, disa
37
40
  setFloating: (node: HTMLElement | null) => void;
38
41
  } & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
39
42
  transitionStyles: CSSProperties;
40
- getFloatingProps: (userProps: HTMLProps<HTMLElement>) => Record<string, unknown>;
43
+ getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
44
+ getGrabberProps: () => HTMLProps<HTMLDivElement> | undefined;
41
45
  };
42
46
  export {};
@@ -1,97 +1,108 @@
1
- import { useRef as T, useState as w, useEffect as C, useCallback as d, useMemo as k } from "react";
2
- import { useDialog as L } from "./use-dialog.js";
3
- const R = 80;
4
- function v({
5
- open: u,
6
- onOpenChange: h,
7
- placement: E = "center",
8
- disableEscapeKey: F = !1,
9
- closeOnDrag: i
1
+ import { useRef as w, useState as A, useEffect as _, useCallback as p, useMemo as L } from "react";
2
+ import { useDialog as F } from "./use-dialog.js";
3
+ const G = 80;
4
+ function U(s, a, u, h) {
5
+ switch (s) {
6
+ case "bottom":
7
+ return Math.max(0, u);
8
+ // Разрешаем движение только вниз
9
+ case "top":
10
+ return Math.max(0, -u);
11
+ // Движение вверх (отрицательный dy)
12
+ case "right":
13
+ return Math.max(0, a);
14
+ // Только вправо
15
+ case "left":
16
+ return Math.max(0, -a);
17
+ // Только влево (отрицательный dx)
18
+ default:
19
+ return h ? u : a;
20
+ }
21
+ }
22
+ function $({
23
+ open: s,
24
+ onOpenChange: a,
25
+ placement: u = "center",
26
+ disableEscapeKey: h = !1,
27
+ closeOnDrag: o
10
28
  }) {
11
- const { getFloatingProps: b, transitionStyles: f, isMounted: p, context: P, refs: x } = L({
12
- open: u,
13
- onOpenChange: h,
14
- placement: E,
15
- disableEscapeKey: F
16
- }), r = T({ startX: 0, startY: 0, dragging: !1 }), [o, g] = w(0), a = i == null ? void 0 : i.direction, M = (i == null ? void 0 : i.threshold) ?? R, l = a === "top" || a === "bottom", e = u && !!a;
17
- C(() => {
18
- u || (r.current.dragging = !1, g(0));
19
- }, [u]);
20
- const S = d(
29
+ const { getFloatingProps: M, transitionStyles: l, isMounted: X, context: Y, refs: y } = F({
30
+ open: s,
31
+ onOpenChange: a,
32
+ placement: u,
33
+ disableEscapeKey: h
34
+ }), r = w({ startX: 0, startY: 0, dragging: !1 }), f = w(0), [S, P] = A(!1), [g, d] = A(0), e = o == null ? void 0 : o.direction, D = (o == null ? void 0 : o.threshold) ?? G, i = e === "top" || e === "bottom", n = s && !!e;
35
+ _(() => {
36
+ s || (r.current.dragging = !1, P(!1), f.current = 0, d(0));
37
+ }, [s]);
38
+ const T = p(
21
39
  (t) => {
22
- e && (r.current.dragging = !0, r.current.startX = t.clientX, r.current.startY = t.clientY, g(0));
40
+ if (n) {
41
+ t.preventDefault(), t.stopPropagation(), r.current.startX = t.clientX, r.current.startY = t.clientY, r.current.dragging = !0, f.current = 0, P(!0), d(0);
42
+ try {
43
+ t.currentTarget.setPointerCapture(t.pointerId);
44
+ } catch {
45
+ }
46
+ }
23
47
  },
24
- [e]
25
- ), y = d(
48
+ [n]
49
+ ), v = p(
26
50
  (t) => {
27
- if (!r.current.dragging || !e) return;
28
- const n = t.clientX - r.current.startX, s = t.clientY - r.current.startY;
29
- let c;
30
- switch (a) {
31
- case "bottom":
32
- c = Math.max(0, s);
33
- break;
34
- case "top":
35
- c = Math.max(0, -s);
36
- break;
37
- case "right":
38
- c = Math.max(0, n);
39
- break;
40
- case "left":
41
- c = Math.max(0, -n);
42
- break;
43
- default:
44
- c = l ? s : n;
45
- }
46
- g(c);
51
+ if (!r.current.dragging || !n) return;
52
+ const c = t.clientX - r.current.startX, b = t.clientY - r.current.startY, x = U(e, c, b, i);
53
+ f.current = x, d(x);
47
54
  },
48
- [e, a, l]
49
- ), m = d(
55
+ [n, e, i]
56
+ ), m = p(
50
57
  (t) => {
51
- var n, s;
52
- if (!(!r.current.dragging || !e)) {
53
- r.current.dragging = !1;
54
- try {
55
- (s = (n = t.currentTarget).hasPointerCapture) != null && s.call(n, t.pointerId) && t.currentTarget.releasePointerCapture(t.pointerId);
56
- } catch {
57
- }
58
- o >= M ? h(!1) : g(0);
58
+ var I, R;
59
+ if (!r.current.dragging || !n) return;
60
+ r.current.dragging = !1, P(!1);
61
+ try {
62
+ (R = (I = t.currentTarget).hasPointerCapture) != null && R.call(I, t.pointerId) && t.currentTarget.releasePointerCapture(t.pointerId);
63
+ } catch {
59
64
  }
65
+ const c = t.clientX - r.current.startX, b = t.clientY - r.current.startY;
66
+ Math.max(
67
+ f.current,
68
+ U(e, c, b, i)
69
+ ) >= D ? a(!1) : (f.current = 0, d(0));
60
70
  },
61
- [o, M, h, e]
62
- ), X = k(() => {
63
- if (!e) return f;
64
- if (r.current.dragging) {
65
- const t = { ...f, transitionProperty: "none" };
66
- if (o > 0) {
67
- const n = a === "left" || a === "top" ? -o : o;
68
- t.transform = l ? `translateY(${n}px)` : `translateX(${n}px)`;
71
+ [D, a, n, e, i]
72
+ ), C = L(() => {
73
+ if (!n) return l;
74
+ if (S) {
75
+ const t = { ...l, transitionProperty: "none" };
76
+ if (g > 0) {
77
+ const c = e === "left" || e === "top" ? -g : g;
78
+ t.transform = i ? `translateY(${c}px)` : `translateX(${c}px)`;
69
79
  }
70
80
  return t;
71
81
  }
72
- return f;
73
- }, [f, o, e, l, a]), Y = d(
74
- (t) => b(e ? {
75
- ...t,
76
- onPointerDown: S,
77
- onPointerUp: m,
78
- onPointerMove: y,
79
- onPointerCancel: m
80
- // Отмена (например, уход фокуса) также завершает перетаскивание
81
- } : t),
82
- [b, S, y, m, e]
83
- );
84
- return k(
82
+ return l;
83
+ }, [l, g, n, i, e, S]), E = p(() => {
84
+ if (n)
85
+ return {
86
+ onPointerDown: T,
87
+ onPointerUp: m,
88
+ onPointerMove: v,
89
+ onPointerCancel: m,
90
+ // Отмена (например, уход фокуса) также завершает перетаскивание
91
+ style: { touchAction: "none" }
92
+ };
93
+ }, [T, v, m, n]);
94
+ return L(
85
95
  () => ({
86
- isMounted: p,
87
- context: P,
88
- refs: x,
89
- transitionStyles: X,
90
- getFloatingProps: Y
96
+ isMounted: X,
97
+ context: Y,
98
+ refs: y,
99
+ transitionStyles: C,
100
+ getFloatingProps: M,
101
+ getGrabberProps: E
91
102
  }),
92
- [p, X, Y, P, x]
103
+ [X, C, M, E, Y, y]
93
104
  );
94
105
  }
95
106
  export {
96
- v as useDialogDraggable
107
+ $ as useDialogDraggable
97
108
  };
@@ -1,15 +1,15 @@
1
1
  import { jsxs as N, jsx as r } from "react/jsx-runtime";
2
2
  import { useRef as W, useState as g, useEffect as w } from "react";
3
- import { clsx as i } from "clsx";
3
+ import { clsx as a } from "clsx";
4
4
  import e from "./ScrollWrapper.module.css.js";
5
5
  import { useBackgroundColor as M } from "../../hooks/useBackgroundColor.js";
6
6
  const B = "white", G = ({
7
7
  children: b,
8
- withControls: a = !0,
8
+ withControls: i = !0,
9
9
  className: L,
10
10
  size: c
11
11
  }) => {
12
- const s = W(null), [d, C] = g(!1), [h, k] = g(!1), { ref: x, bgColor: R } = M(), E = x ?? { current: null }, f = R ?? B, u = a && d, m = a && h, v = ({ direction: t }) => /* @__PURE__ */ r(
12
+ const s = W(null), [d, C] = g(!1), [h, k] = g(!1), { ref: x, bgColor: R } = M(), E = x ?? { current: null }, f = R ?? B, u = i && d, m = i && h, v = ({ direction: t }) => /* @__PURE__ */ r(
13
13
  "svg",
14
14
  {
15
15
  height: "12px",
@@ -49,11 +49,11 @@ const B = "white", G = ({
49
49
  return t.addEventListener("scroll", l, { passive: !0 }), window.addEventListener("resize", l), () => {
50
50
  t.removeEventListener("scroll", l), window.removeEventListener("resize", l);
51
51
  };
52
- }, []), /* @__PURE__ */ N("div", { ref: E, className: i(e.wrapper, L), children: [
52
+ }, []), /* @__PURE__ */ N("div", { ref: E, className: a(e.wrapper, L), children: [
53
53
  u && /* @__PURE__ */ r(
54
54
  "div",
55
55
  {
56
- className: i(e.mask, e.maskLeft, d && e.visible),
56
+ className: a(e.mask, e.maskLeft, d && e.visible),
57
57
  style: {
58
58
  background: `linear-gradient(to right, ${f} 17%, transparent 80%)`
59
59
  }
@@ -62,7 +62,7 @@ const B = "white", G = ({
62
62
  m && /* @__PURE__ */ r(
63
63
  "div",
64
64
  {
65
- className: i(e.mask, e.maskRight, h && e.visible),
65
+ className: a(e.mask, e.maskRight, h && e.visible),
66
66
  style: {
67
67
  background: `linear-gradient(to left, ${f} 17%, transparent 80%)`
68
68
  }
@@ -75,7 +75,8 @@ const B = "white", G = ({
75
75
  type: "button",
76
76
  tabIndex: -1,
77
77
  "aria-hidden": "true",
78
- className: i(e.control, e.left, e[c]),
78
+ "data-testid": "tabs-scroll-control-left",
79
+ className: a(e.control, e.left, e[c]),
79
80
  onClick: () => p("left"),
80
81
  children: /* @__PURE__ */ r(v, { direction: "left" })
81
82
  }
@@ -86,7 +87,8 @@ const B = "white", G = ({
86
87
  type: "button",
87
88
  tabIndex: -1,
88
89
  "aria-hidden": "true",
89
- className: i(e.control, e.right, e[c]),
90
+ "data-testid": "tabs-scroll-control-right",
91
+ className: a(e.control, e.right, e[c]),
90
92
  onClick: () => p("right"),
91
93
  children: /* @__PURE__ */ r(v, { direction: "right" })
92
94
  }