@elcrm/tooltip 0.0.2 → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 MaSkal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -0,0 +1,97 @@
1
+ # `@elcrm/tooltip`
2
+
3
+ React-подсказки для elCRM: portal в `document.body`, общий стек **z-index** (`globalThis.elcrm.overlayZ`), показ по hover/focus, позиция с clamp к краям viewport. Не нативный `title`.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@elcrm/tooltip.svg)](https://www.npmjs.com/package/@elcrm/tooltip)
6
+ [![license](https://img.shields.io/npm/l/@elcrm/tooltip.svg)](https://www.npmjs.com/package/@elcrm/tooltip)
7
+
8
+ ## Установка
9
+
10
+ ```bash
11
+ npm install @elcrm/tooltip
12
+ # или
13
+ bun add @elcrm/tooltip
14
+ ```
15
+
16
+ **Требования:** Node.js ≥ 18. Peer-зависимости: `react` ≥ 18, `react-dom` ≥ 18.
17
+
18
+ Для разработки пакета удобен **Bun** ≥ 1.3 (см. `deploy.md` / `dev.md`).
19
+
20
+ ## Быстрый старт
21
+
22
+ ```tsx
23
+ import { Tooltip } from "@elcrm/tooltip";
24
+ import "@elcrm/tooltip/style.css";
25
+
26
+ function Example() {
27
+ return (
28
+ <Tooltip content="Подсказка" placement="top">
29
+ <button type="button">Наведите</button>
30
+ </Tooltip>
31
+ );
32
+ }
33
+ ```
34
+
35
+ Стили также инжектятся при импорте JS (через `vite-plugin-lib-inject-css`). Явный импорт `@elcrm/tooltip/style.css` полезен для SSR или если CSS нужен отдельно.
36
+
37
+ В elWMS удобнее `IconAction` (`tip=…`).
38
+
39
+ ## API
40
+
41
+ ### `Tooltip`
42
+
43
+ | Проп | Тип | По умолчанию | Описание |
44
+ | ------------- | ---------------------------------------- | ------------ | --------------------------------- |
45
+ | `content` | `ReactNode` | — | Текст или разметка подсказки |
46
+ | `children` | `ReactNode` | — | Якорь (триггер) |
47
+ | `placement` | `"top" \| "bottom" \| "left" \| "right"` | `"top"` | Сторона относительно якоря |
48
+ | `orientation` | то же, что `placement` | — | **@deprecated** — используйте `placement` |
49
+ | `textAlign` | `"center" \| "left" \| "right"` | `"center"` | Выравнивание текста |
50
+ | `delay` | `number` | `180` | Задержка показа, мс |
51
+ | `delayHide` | `number` | `60` | Задержка скрытия, мс |
52
+ | `disabled` | `boolean` | `false` | Не показывать |
53
+ | `open` | `boolean` | — | Принудительно открыт (отладка) |
54
+ | `className` | `string` | — | Класс на обёртке якоря |
55
+
56
+ ### `overlayZ`
57
+
58
+ Общий стек с modal / form / alert / notice:
59
+
60
+ ```ts
61
+ import {
62
+ acquireOverlayZIndex,
63
+ releaseOverlayZIndex,
64
+ peekOverlayZIndex,
65
+ } from "@elcrm/tooltip";
66
+ ```
67
+
68
+ Обычно вызывать вручную не нужно — `Tooltip` берёт и отпускает z-index сам.
69
+
70
+ ## CSS-переменные
71
+
72
+ | Переменная | Назначение |
73
+ | ----------------------- | ----------------- |
74
+ | `--tooltip-background` | Фон |
75
+ | `--tooltip-color` | Цвет текста |
76
+ | `--tooltip-radius` | Скругление |
77
+ | `--tooltip-max-width` | Макс. ширина |
78
+ | `--tooltip-font-size` | Размер шрифта |
79
+ | `--tooltip-padding` | Внутренние отступы |
80
+ | `--tooltip-shadow` | Тень |
81
+ | `--tooltip-gap` | Зазор до якоря |
82
+
83
+ ## Поведение
84
+
85
+ - SSR-безопасно (без `document` portal не создаётся)
86
+ - Portal в `document.body`
87
+ - ARIA: `role="tooltip"`, `aria-describedby` на якоре
88
+ - При нехватке места сторона зеркалится (top↔bottom, left↔right)
89
+ - Позиция обновляется на `resize` / `scroll` (capture)
90
+
91
+ ## Публикация
92
+
93
+ Автодеплой на npm через GitHub Actions — см. **[deploy.md](./deploy.md)**.
94
+
95
+ ## Лицензия
96
+
97
+ MIT © MaSkal
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- :root{--tooltip-background: #28292d;--tooltip-color: #ffffff94;--tooltip-radius: 15px}._t_15niz_7{position:fixed;z-index:99;opacity:0;background:var(--tooltip-background);color:var(--tooltip-color);display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:.5rem;border-radius:var(--tooltip-radius);padding:10px;max-width:300px;font-size:14px;margin-inline:10px;width:min-content!important}._t_15niz_7:before{content:"";position:fixed;pointer-events:none;top:var(--tooltip-arrow-y);left:var(--tooltip-arrow-x);margin-left:-8px;border-width:8px;border-style:solid;border-color:#28292d transparent transparent transparent}
1
+ @charset "UTF-8";:root{--tooltip-background: #1e1f24;--tooltip-color: rgba(255, 255, 255, .92);--tooltip-radius: 10px;--tooltip-max-width: 280px;--tooltip-font-size: 13px;--tooltip-padding: 8px 10px;--tooltip-shadow: 0 8px 24px rgba(0, 0, 0, .28);--tooltip-gap: 8px}._t_ai3lm_13{position:fixed;box-sizing:border-box;max-width:var(--tooltip-max-width);padding:var(--tooltip-padding);border-radius:var(--tooltip-radius);background:var(--tooltip-background);color:var(--tooltip-color);font-size:var(--tooltip-font-size);line-height:1.35;font-weight:500;box-shadow:var(--tooltip-shadow);pointer-events:none;opacity:0;transition:opacity .12s ease;white-space:normal;word-break:break-word}._t_ai3lm_13[data-visible=true]{opacity:1}._t_ai3lm_13[data-align=left]{text-align:left}._t_ai3lm_13[data-align=center]{text-align:center}._t_ai3lm_13[data-align=right]{text-align:right}._t_ai3lm_13:before{content:"";position:fixed;pointer-events:none;width:0;height:0;top:var(--tooltip-arrow-y);left:var(--tooltip-arrow-x);transform:var(--tooltip-arrow-r, none);margin-left:-6px;border-width:6px;border-style:solid;border-color:var(--tooltip-background) transparent transparent transparent}._root_ai3lm_64{display:inline-flex;vertical-align:middle;max-width:100%}
package/dist/index.d.ts CHANGED
@@ -1,30 +1,48 @@
1
- export type TTooltipText = {
2
- content: string | JSX.Element;
3
- children?: string | JSX.Element;
4
- className?: string;
5
- orientation?: "up" | "down" | "left" | "right";
6
- textAlign?: "center" | "left" | "right";
7
- dev?: boolean;
8
- element?: any;
9
- };
10
- /**
11
- * Renders a single tooltip component.
12
- *
13
- * The component takes care of positioning itself relative to the given
14
- * `position` object. The `orientation` prop can be set to one of the
15
- * following values: `"up"`, `"down"`, `"left"`, `"right"`.
16
- *
17
- * The `update` prop is used to trigger a re-render of the component.
18
- * The `textAlign` prop is used to set the text alignment of the tooltip
19
- * content.
20
- *
21
- * @param {Object} props
22
- * @param {string|JSX.Element} props.content - The content of the tooltip.
23
- * @param {{top: number, left: number, width: number, height: number}} props.position - The position of the element that the tooltip is attached to.
24
- * @param {"up"|"down"|"left"|"right"} [props.orientation="up"] - The orientation of the tooltip.
25
- * @param {number} [props.update=0] - A number that triggers a re-render of the component when changed.
26
- * @param {"center"|"left"|"right"} [props.textAlign="center"] - The text alignment of the tooltip content.
27
- * @returns {JSX.Element} A React element that displays the tooltip content.
28
- */
29
- export declare const Item: ({ content, position, orientation, update, textAlign, }: any) => JSX.Element;
30
- export declare const Tooltip: ({ content, children, className, textAlign, orientation, dev, ...props }: TTooltipText) => import("react/jsx-runtime").JSX.Element;
1
+ import { default as default_2 } from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Счётчик z-index оверлеев общий через globalThis.elcrm.overlayZ
6
+ * (тот же стек, что у modal / form / alert / notice).
7
+ */
8
+ /** Выделить z-index поверх текущего стека оверлеев */
9
+ export declare function acquireOverlayZIndex(): number;
10
+
11
+ /** @deprecated используйте `Tooltip` */
12
+ export declare const Item: () => null;
13
+
14
+ /** Текущий верхний активный слой (или FLOOR) */
15
+ export declare function peekOverlayZIndex(): number;
16
+
17
+ /** Освободить слой; при пустом стеке сброс счётчика */
18
+ export declare function releaseOverlayZIndex(z: number): void;
19
+
20
+ /**
21
+ * Подсказка при наведении / фокусе.
22
+ * Рендер в portal + z-index из общего стека оверлеев elCRM.
23
+ */
24
+ export declare function Tooltip({ content, children, placement, orientation, textAlign, delay, delayHide, className, disabled, open: openForced, }: TooltipProps): default_2.JSX.Element;
25
+
26
+ export declare type TooltipPlacement = "top" | "bottom" | "left" | "right";
27
+
28
+ export declare type TooltipProps = {
29
+ /** Текст или разметка подсказки */
30
+ content: ReactNode;
31
+ children: ReactNode;
32
+ /** Сторона относительно якоря */
33
+ placement?: TooltipPlacement;
34
+ /** @deprecated используйте placement */
35
+ orientation?: TooltipPlacement;
36
+ textAlign?: "center" | "left" | "right";
37
+ /** Задержка показа, мс */
38
+ delay?: number;
39
+ /** Задержка скрытия, мс */
40
+ delayHide?: number;
41
+ className?: string;
42
+ /** Не показывать */
43
+ disabled?: boolean;
44
+ /** Принудительно открыт (отладка) */
45
+ open?: boolean;
46
+ };
47
+
48
+ export { }
package/dist/index.es.js CHANGED
@@ -1,716 +1,159 @@
1
- import $ from "react";
2
- import { createPortal as fr } from "react-dom";
3
- import './index.css';var Z = { exports: {} }, I = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.min.js
7
- *
8
- * Copyright (c) Facebook, Inc. and its affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var xe;
14
- function cr() {
15
- if (xe) return I;
16
- xe = 1;
17
- var w = $, d = Symbol.for("react.element"), O = Symbol.for("react.fragment"), E = Object.prototype.hasOwnProperty, T = w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function s(p, f, b) {
19
- var u, R = {}, P = null, Y = null;
20
- b !== void 0 && (P = "" + b), f.key !== void 0 && (P = "" + f.key), f.ref !== void 0 && (Y = f.ref);
21
- for (u in f) E.call(f, u) && !m.hasOwnProperty(u) && (R[u] = f[u]);
22
- if (p && p.defaultProps) for (u in f = p.defaultProps, f) R[u] === void 0 && (R[u] = f[u]);
23
- return { $$typeof: d, type: p, key: P, ref: Y, props: R, _owner: T.current };
1
+ import P, { useId as A, useRef as v, useState as T, useCallback as X, useLayoutEffect as B, useEffect as D } from "react";
2
+ import { createPortal as V } from "react-dom";
3
+ import './index.css';const F = "0.1.0", J = {
4
+ version: F
5
+ }, K = "_t_ai3lm_13", Q = "_root_ai3lm_64", z = {
6
+ t: K,
7
+ root: Q
8
+ }, Y = 1e3, U = 10;
9
+ function R() {
10
+ const e = globalThis;
11
+ return e.elcrm || (e.elcrm = {}), e.elcrm.overlayZ || (e.elcrm.overlayZ = { seq: 0, active: /* @__PURE__ */ new Set() }), e.elcrm.overlayZ;
12
+ }
13
+ function ee() {
14
+ const e = R();
15
+ e.seq += 1;
16
+ const t = Y + e.seq * U;
17
+ return e.active.add(t), t;
18
+ }
19
+ function C(e) {
20
+ const t = R();
21
+ t.active.delete(e), t.active.size === 0 && (t.seq = 0);
22
+ }
23
+ function oe() {
24
+ const e = R();
25
+ return e.active.size === 0 ? Y : Math.max(...e.active);
26
+ }
27
+ const n = 8, s = 8;
28
+ function te(e, t, y) {
29
+ const w = e.left + e.width / 2, d = e.top + e.height / 2;
30
+ let o = 0, i = 0, u = w, l = 0, r = "";
31
+ const m = (p) => Math.min(
32
+ Math.max(s, p),
33
+ window.innerWidth - t.width - s
34
+ );
35
+ switch (y) {
36
+ case "top":
37
+ o = e.top - t.height - n, i = m(w - t.width / 2), l = e.top - n, r = "", o < s && (o = e.bottom + n, l = e.bottom + n - 2, r = "rotate(180deg)");
38
+ break;
39
+ case "bottom":
40
+ o = e.bottom + n, i = m(w - t.width / 2), l = e.bottom + n - 2, r = "rotate(180deg)", o + t.height > window.innerHeight - s && (o = e.top - t.height - n, l = e.top - n, r = "");
41
+ break;
42
+ case "left":
43
+ o = Math.min(
44
+ Math.max(s, d - t.height / 2),
45
+ window.innerHeight - t.height - s
46
+ ), i = e.left - t.width - n, u = e.left - n + 2, l = d, r = "rotate(270deg)", i < s && (i = e.right + n, u = e.right + n - 2, r = "rotate(90deg)");
47
+ break;
48
+ case "right":
49
+ o = Math.min(
50
+ Math.max(s, d - t.height / 2),
51
+ window.innerHeight - t.height - s
52
+ ), i = e.right + n, u = e.right + n - 2, l = d, r = "rotate(90deg)", i + t.width > window.innerWidth - s && (i = e.left - t.width - n, u = e.left - n + 2, r = "rotate(270deg)");
53
+ break;
24
54
  }
25
- return I.Fragment = O, I.jsx = s, I.jsxs = s, I;
55
+ return { top: o, left: i, arrowX: u, arrowY: l, arrowR: r };
26
56
  }
27
- var W = {};
28
- /**
29
- * @license React
30
- * react-jsx-runtime.development.js
31
- *
32
- * Copyright (c) Facebook, Inc. and its affiliates.
33
- *
34
- * This source code is licensed under the MIT license found in the
35
- * LICENSE file in the root directory of this source tree.
36
- */
37
- var Oe;
38
- function dr() {
39
- return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
40
- var w = $, d = Symbol.for("react.element"), O = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), p = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), Y = Symbol.for("react.offscreen"), Q = Symbol.iterator, Pe = "@@iterator";
41
- function Ce(e) {
42
- if (e === null || typeof e != "object")
43
- return null;
44
- var r = Q && e[Q] || e[Pe];
45
- return typeof r == "function" ? r : null;
46
- }
47
- var j = w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
48
- function y(e) {
49
- {
50
- for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
51
- t[n - 1] = arguments[n];
52
- Se("error", e, t);
53
- }
54
- }
55
- function Se(e, r, t) {
56
- {
57
- var n = j.ReactDebugCurrentFrame, i = n.getStackAddendum();
58
- i !== "" && (r += "%s", t = t.concat([i]));
59
- var l = t.map(function(o) {
60
- return String(o);
61
- });
62
- l.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, l);
63
- }
64
- }
65
- var je = !1, ke = !1, De = !1, Fe = !1, Ae = !1, ee;
66
- ee = Symbol.for("react.module.reference");
67
- function Ie(e) {
68
- return !!(typeof e == "string" || typeof e == "function" || e === E || e === m || Ae || e === T || e === b || e === u || Fe || e === Y || je || ke || De || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === R || e.$$typeof === s || e.$$typeof === p || e.$$typeof === f || // This needs to include all possible module reference object
69
- // types supported by any Flight configuration anywhere since
70
- // we don't know which Flight build this will end up being used
71
- // with.
72
- e.$$typeof === ee || e.getModuleId !== void 0));
73
- }
74
- function We(e, r, t) {
75
- var n = e.displayName;
76
- if (n)
77
- return n;
78
- var i = r.displayName || r.name || "";
79
- return i !== "" ? t + "(" + i + ")" : t;
80
- }
81
- function re(e) {
82
- return e.displayName || "Context";
83
- }
84
- function x(e) {
85
- if (e == null)
86
- return null;
87
- if (typeof e.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
88
- return e.displayName || e.name || null;
89
- if (typeof e == "string")
90
- return e;
91
- switch (e) {
92
- case E:
93
- return "Fragment";
94
- case O:
95
- return "Portal";
96
- case m:
97
- return "Profiler";
98
- case T:
99
- return "StrictMode";
100
- case b:
101
- return "Suspense";
102
- case u:
103
- return "SuspenseList";
104
- }
105
- if (typeof e == "object")
106
- switch (e.$$typeof) {
107
- case p:
108
- var r = e;
109
- return re(r) + ".Consumer";
110
- case s:
111
- var t = e;
112
- return re(t._context) + ".Provider";
113
- case f:
114
- return We(e, e.render, "ForwardRef");
115
- case R:
116
- var n = e.displayName || null;
117
- return n !== null ? n : x(e.type) || "Memo";
118
- case P: {
119
- var i = e, l = i._payload, o = i._init;
120
- try {
121
- return x(o(l));
122
- } catch {
123
- return null;
124
- }
125
- }
126
- }
127
- return null;
128
- }
129
- var C = Object.assign, F = 0, te, ne, ae, oe, ie, ue, se;
130
- function le() {
131
- }
132
- le.__reactDisabledLog = !0;
133
- function $e() {
134
- {
135
- if (F === 0) {
136
- te = console.log, ne = console.info, ae = console.warn, oe = console.error, ie = console.group, ue = console.groupCollapsed, se = console.groupEnd;
137
- var e = {
138
- configurable: !0,
139
- enumerable: !0,
140
- value: le,
141
- writable: !0
142
- };
143
- Object.defineProperties(console, {
144
- info: e,
145
- log: e,
146
- warn: e,
147
- error: e,
148
- group: e,
149
- groupCollapsed: e,
150
- groupEnd: e
151
- });
152
- }
153
- F++;
154
- }
155
- }
156
- function Ye() {
157
- {
158
- if (F--, F === 0) {
159
- var e = {
160
- configurable: !0,
161
- enumerable: !0,
162
- writable: !0
163
- };
164
- Object.defineProperties(console, {
165
- log: C({}, e, {
166
- value: te
167
- }),
168
- info: C({}, e, {
169
- value: ne
170
- }),
171
- warn: C({}, e, {
172
- value: ae
173
- }),
174
- error: C({}, e, {
175
- value: oe
176
- }),
177
- group: C({}, e, {
178
- value: ie
179
- }),
180
- groupCollapsed: C({}, e, {
181
- value: ue
182
- }),
183
- groupEnd: C({}, e, {
184
- value: se
185
- })
186
- });
187
- }
188
- F < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
189
- }
190
- }
191
- var B = j.ReactCurrentDispatcher, J;
192
- function M(e, r, t) {
193
- {
194
- if (J === void 0)
195
- try {
196
- throw Error();
197
- } catch (i) {
198
- var n = i.stack.trim().match(/\n( *(at )?)/);
199
- J = n && n[1] || "";
200
- }
201
- return `
202
- ` + J + e;
203
- }
204
- }
205
- var K = !1, L;
206
- {
207
- var Me = typeof WeakMap == "function" ? WeakMap : Map;
208
- L = new Me();
209
- }
210
- function fe(e, r) {
211
- if (!e || K)
212
- return "";
213
- {
214
- var t = L.get(e);
215
- if (t !== void 0)
216
- return t;
217
- }
218
- var n;
219
- K = !0;
220
- var i = Error.prepareStackTrace;
221
- Error.prepareStackTrace = void 0;
222
- var l;
223
- l = B.current, B.current = null, $e();
224
- try {
225
- if (r) {
226
- var o = function() {
227
- throw Error();
228
- };
229
- if (Object.defineProperty(o.prototype, "props", {
230
- set: function() {
231
- throw Error();
232
- }
233
- }), typeof Reflect == "object" && Reflect.construct) {
234
- try {
235
- Reflect.construct(o, []);
236
- } catch (g) {
237
- n = g;
238
- }
239
- Reflect.construct(e, [], o);
240
- } else {
241
- try {
242
- o.call();
243
- } catch (g) {
244
- n = g;
245
- }
246
- e.call(o.prototype);
247
- }
248
- } else {
249
- try {
250
- throw Error();
251
- } catch (g) {
252
- n = g;
253
- }
254
- e();
255
- }
256
- } catch (g) {
257
- if (g && n && typeof g.stack == "string") {
258
- for (var a = g.stack.split(`
259
- `), h = n.stack.split(`
260
- `), c = a.length - 1, v = h.length - 1; c >= 1 && v >= 0 && a[c] !== h[v]; )
261
- v--;
262
- for (; c >= 1 && v >= 0; c--, v--)
263
- if (a[c] !== h[v]) {
264
- if (c !== 1 || v !== 1)
265
- do
266
- if (c--, v--, v < 0 || a[c] !== h[v]) {
267
- var _ = `
268
- ` + a[c].replace(" at new ", " at ");
269
- return e.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, _), _;
270
- }
271
- while (c >= 1 && v >= 0);
272
- break;
273
- }
274
- }
275
- } finally {
276
- K = !1, B.current = l, Ye(), Error.prepareStackTrace = i;
277
- }
278
- var D = e ? e.displayName || e.name : "", S = D ? M(D) : "";
279
- return typeof e == "function" && L.set(e, S), S;
280
- }
281
- function Le(e, r, t) {
282
- return fe(e, !1);
283
- }
284
- function Ve(e) {
285
- var r = e.prototype;
286
- return !!(r && r.isReactComponent);
287
- }
288
- function V(e, r, t) {
289
- if (e == null)
290
- return "";
291
- if (typeof e == "function")
292
- return fe(e, Ve(e));
293
- if (typeof e == "string")
294
- return M(e);
295
- switch (e) {
296
- case b:
297
- return M("Suspense");
298
- case u:
299
- return M("SuspenseList");
300
- }
301
- if (typeof e == "object")
302
- switch (e.$$typeof) {
303
- case f:
304
- return Le(e.render);
305
- case R:
306
- return V(e.type, r, t);
307
- case P: {
308
- var n = e, i = n._payload, l = n._init;
309
- try {
310
- return V(l(i), r, t);
311
- } catch {
312
- }
313
- }
314
- }
315
- return "";
316
- }
317
- var A = Object.prototype.hasOwnProperty, ce = {}, de = j.ReactDebugCurrentFrame;
318
- function U(e) {
319
- if (e) {
320
- var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
321
- de.setExtraStackFrame(t);
322
- } else
323
- de.setExtraStackFrame(null);
324
- }
325
- function Ue(e, r, t, n, i) {
326
- {
327
- var l = Function.call.bind(A);
328
- for (var o in e)
329
- if (l(e, o)) {
330
- var a = void 0;
331
- try {
332
- if (typeof e[o] != "function") {
333
- var h = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
334
- throw h.name = "Invariant Violation", h;
335
- }
336
- a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
337
- } catch (c) {
338
- a = c;
339
- }
340
- a && !(a instanceof Error) && (U(i), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), U(null)), a instanceof Error && !(a.message in ce) && (ce[a.message] = !0, U(i), y("Failed %s type: %s", t, a.message), U(null));
341
- }
342
- }
343
- }
344
- var Ne = Array.isArray;
345
- function q(e) {
346
- return Ne(e);
347
- }
348
- function Be(e) {
349
- {
350
- var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
351
- return t;
352
- }
353
- }
354
- function Je(e) {
355
- try {
356
- return ve(e), !1;
357
- } catch {
358
- return !0;
359
- }
360
- }
361
- function ve(e) {
362
- return "" + e;
363
- }
364
- function pe(e) {
365
- if (Je(e))
366
- return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Be(e)), ve(e);
367
- }
368
- var ye = j.ReactCurrentOwner, Ke = {
369
- key: !0,
370
- ref: !0,
371
- __self: !0,
372
- __source: !0
373
- }, he, ge;
374
- function qe(e) {
375
- if (A.call(e, "ref")) {
376
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
377
- if (r && r.isReactWarning)
378
- return !1;
379
- }
380
- return e.ref !== void 0;
381
- }
382
- function ze(e) {
383
- if (A.call(e, "key")) {
384
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
385
- if (r && r.isReactWarning)
386
- return !1;
387
- }
388
- return e.key !== void 0;
389
- }
390
- function Ge(e, r) {
391
- typeof e.ref == "string" && ye.current;
392
- }
393
- function Xe(e, r) {
394
- {
395
- var t = function() {
396
- he || (he = !0, y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
397
- };
398
- t.isReactWarning = !0, Object.defineProperty(e, "key", {
399
- get: t,
400
- configurable: !0
401
- });
402
- }
403
- }
404
- function He(e, r) {
405
- {
406
- var t = function() {
407
- ge || (ge = !0, y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
408
- };
409
- t.isReactWarning = !0, Object.defineProperty(e, "ref", {
410
- get: t,
411
- configurable: !0
412
- });
413
- }
414
- }
415
- var Ze = function(e, r, t, n, i, l, o) {
416
- var a = {
417
- // This tag allows us to uniquely identify this as a React Element
418
- $$typeof: d,
419
- // Built-in properties that belong on the element
420
- type: e,
421
- key: r,
422
- ref: t,
423
- props: o,
424
- // Record the component responsible for creating this element.
425
- _owner: l
426
- };
427
- return a._store = {}, Object.defineProperty(a._store, "validated", {
428
- configurable: !1,
429
- enumerable: !1,
430
- writable: !0,
431
- value: !1
432
- }), Object.defineProperty(a, "_self", {
433
- configurable: !1,
434
- enumerable: !1,
435
- writable: !1,
436
- value: n
437
- }), Object.defineProperty(a, "_source", {
438
- configurable: !1,
439
- enumerable: !1,
440
- writable: !1,
441
- value: i
442
- }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
57
+ function ie({
58
+ content: e,
59
+ children: t,
60
+ placement: y,
61
+ orientation: w,
62
+ textAlign: d = "center",
63
+ delay: o = 180,
64
+ delayHide: i = 60,
65
+ className: u,
66
+ disabled: l = !1,
67
+ open: r
68
+ }) {
69
+ const m = y ?? w ?? "top", p = A(), M = v(null), k = v(null), b = v(null), x = v(null), c = v(null), [G, L] = T(!1), [a, O] = T(null), [Z, S] = T(null), E = () => {
70
+ b.current != null && (window.clearTimeout(b.current), b.current = null), x.current != null && (window.clearTimeout(x.current), x.current = null);
71
+ }, _ = X(() => {
72
+ l || e == null || e === "" || (E(), b.current = window.setTimeout(() => {
73
+ L(!0);
74
+ }, o));
75
+ }, [e, o, l]), q = X(() => {
76
+ r || (E(), x.current = window.setTimeout(() => {
77
+ L(!1), O(null);
78
+ }, i));
79
+ }, [i, r]), f = r || G;
80
+ B(() => {
81
+ if (f) {
82
+ if (c.current == null) {
83
+ const g = ee();
84
+ c.current = g, S(g);
85
+ }
86
+ return;
87
+ }
88
+ c.current != null && (C(c.current), c.current = null, S(null));
89
+ }, [f]), D(() => () => {
90
+ E(), c.current != null && (C(c.current), c.current = null);
91
+ }, []), B(() => {
92
+ if (!f) return;
93
+ const g = M.current, $ = k.current;
94
+ if (!g || !$) return;
95
+ const h = () => {
96
+ const W = g.getBoundingClientRect(), j = $.getBoundingClientRect();
97
+ O(te(W, j, m));
443
98
  };
444
- function Qe(e, r, t, n, i) {
445
- {
446
- var l, o = {}, a = null, h = null;
447
- t !== void 0 && (pe(t), a = "" + t), ze(r) && (pe(r.key), a = "" + r.key), qe(r) && (h = r.ref, Ge(r, i));
448
- for (l in r)
449
- A.call(r, l) && !Ke.hasOwnProperty(l) && (o[l] = r[l]);
450
- if (e && e.defaultProps) {
451
- var c = e.defaultProps;
452
- for (l in c)
453
- o[l] === void 0 && (o[l] = c[l]);
454
- }
455
- if (a || h) {
456
- var v = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
457
- a && Xe(o, v), h && He(o, v);
458
- }
459
- return Ze(e, a, h, i, n, ye.current, o);
460
- }
461
- }
462
- var z = j.ReactCurrentOwner, be = j.ReactDebugCurrentFrame;
463
- function k(e) {
464
- if (e) {
465
- var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
466
- be.setExtraStackFrame(t);
467
- } else
468
- be.setExtraStackFrame(null);
469
- }
470
- var G;
471
- G = !1;
472
- function X(e) {
473
- return typeof e == "object" && e !== null && e.$$typeof === d;
474
- }
475
- function _e() {
476
- {
477
- if (z.current) {
478
- var e = x(z.current.type);
479
- if (e)
480
- return `
481
-
482
- Check the render method of \`` + e + "`.";
483
- }
484
- return "";
485
- }
486
- }
487
- function er(e) {
488
- return "";
489
- }
490
- var Ee = {};
491
- function rr(e) {
492
- {
493
- var r = _e();
494
- if (!r) {
495
- var t = typeof e == "string" ? e : e.displayName || e.name;
496
- t && (r = `
497
-
498
- Check the top-level render call using <` + t + ">.");
499
- }
500
- return r;
501
- }
502
- }
503
- function Re(e, r) {
504
- {
505
- if (!e._store || e._store.validated || e.key != null)
506
- return;
507
- e._store.validated = !0;
508
- var t = rr(r);
509
- if (Ee[t])
510
- return;
511
- Ee[t] = !0;
512
- var n = "";
513
- e && e._owner && e._owner !== z.current && (n = " It was passed a child from " + x(e._owner.type) + "."), k(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), k(null);
514
- }
515
- }
516
- function me(e, r) {
517
- {
518
- if (typeof e != "object")
519
- return;
520
- if (q(e))
521
- for (var t = 0; t < e.length; t++) {
522
- var n = e[t];
523
- X(n) && Re(n, r);
524
- }
525
- else if (X(e))
526
- e._store && (e._store.validated = !0);
527
- else if (e) {
528
- var i = Ce(e);
529
- if (typeof i == "function" && i !== e.entries)
530
- for (var l = i.call(e), o; !(o = l.next()).done; )
531
- X(o.value) && Re(o.value, r);
532
- }
533
- }
534
- }
535
- function tr(e) {
536
- {
537
- var r = e.type;
538
- if (r == null || typeof r == "string")
539
- return;
540
- var t;
541
- if (typeof r == "function")
542
- t = r.propTypes;
543
- else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
544
- // Inner props are checked in the reconciler.
545
- r.$$typeof === R))
546
- t = r.propTypes;
547
- else
548
- return;
549
- if (t) {
550
- var n = x(r);
551
- Ue(t, e.props, "prop", n, e);
552
- } else if (r.PropTypes !== void 0 && !G) {
553
- G = !0;
554
- var i = x(r);
555
- y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
556
- }
557
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
558
- }
559
- }
560
- function nr(e) {
561
- {
562
- for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
563
- var n = r[t];
564
- if (n !== "children" && n !== "key") {
565
- k(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), k(null);
566
- break;
567
- }
568
- }
569
- e.ref !== null && (k(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
570
- }
571
- }
572
- var we = {};
573
- function Te(e, r, t, n, i, l) {
574
- {
575
- var o = Ie(e);
576
- if (!o) {
577
- var a = "";
578
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
579
- var h = er();
580
- h ? a += h : a += _e();
581
- var c;
582
- e === null ? c = "null" : q(e) ? c = "array" : e !== void 0 && e.$$typeof === d ? (c = "<" + (x(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : c = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", c, a);
583
- }
584
- var v = Qe(e, r, t, i, l);
585
- if (v == null)
586
- return v;
587
- if (o) {
588
- var _ = r.children;
589
- if (_ !== void 0)
590
- if (n)
591
- if (q(_)) {
592
- for (var D = 0; D < _.length; D++)
593
- me(_[D], e);
594
- Object.freeze && Object.freeze(_);
595
- } else
596
- y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
597
- else
598
- me(_, e);
599
- }
600
- if (A.call(r, "key")) {
601
- var S = x(e), g = Object.keys(r).filter(function(lr) {
602
- return lr !== "key";
603
- }), H = g.length > 0 ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}";
604
- if (!we[S + H]) {
605
- var sr = g.length > 0 ? "{" + g.join(": ..., ") + ": ...}" : "{}";
606
- y(`A props object containing a "key" prop is being spread into JSX:
607
- let props = %s;
608
- <%s {...props} />
609
- React keys must be passed directly to JSX without using spread:
610
- let props = %s;
611
- <%s key={someKey} {...props} />`, H, S, sr, S), we[S + H] = !0;
612
- }
613
- }
614
- return e === E ? nr(v) : tr(v), v;
615
- }
616
- }
617
- function ar(e, r, t) {
618
- return Te(e, r, t, !0);
619
- }
620
- function or(e, r, t) {
621
- return Te(e, r, t, !1);
622
- }
623
- var ir = or, ur = ar;
624
- W.Fragment = E, W.jsx = ir, W.jsxs = ur;
625
- }()), W;
626
- }
627
- process.env.NODE_ENV === "production" ? Z.exports = cr() : Z.exports = dr();
628
- var N = Z.exports;
629
- const vr = "_t_15niz_7", pr = {
630
- t: vr
631
- }, yr = ({
632
- content: w,
633
- position: d,
634
- orientation: O = "up",
635
- update: E,
636
- textAlign: T
637
- }) => {
638
- const m = $.useRef(null);
639
- return $.useEffect(() => {
640
- const s = m.current;
641
- s.style.opacity = "0", s.style.width = "auto", s.style.left = "0px", s.style.top = "0px";
642
- let p = {
643
- x: 0,
644
- y: 0
99
+ return h(), window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), () => {
100
+ window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0);
645
101
  };
646
- const f = s.getBoundingClientRect();
647
- let b = d.width / 2;
648
- s.style.width = f.width + "px";
649
- let u = 0;
650
- switch (O) {
651
- case "up":
652
- u = d.left + b - f.width / 2 - 10, u = window.innerWidth < u + f.width ? window.innerWidth - f.width - 20 : u, u = u < 0 ? 0 : u, s.style.left = u + "px", s.style.top = d.top - f.height - 10 + "px", p.x = d.left + b, p.y = d.top - 10;
653
- break;
654
- case "down":
655
- u = d.left + b - f.width / 2, u = u < 0 ? 0 : u, s.style.left = u + "px", s.style.top = d.bottom + 10 + "px";
656
- break;
657
- case "left":
658
- s.style.top = d.top + "px", s.style.left = d.left - f.width - d.width + "px";
659
- break;
660
- case "right":
661
- s.style.top = d.top + "px", s.style.left = d.right + "px";
662
- break;
663
- }
664
- s.style.setProperty("--tooltip-arrow-x", p.x + "px"), s.style.setProperty("--tooltip-arrow-y", p.y + "px"), s.style.transition = "opacity 0.3s", s.style.textAlign = T, s.style.opacity = "1";
665
- }, [E]), /* @__PURE__ */ N.jsx("div", { ref: m, className: pr.t, children: w });
666
- }, br = ({
667
- content: w,
668
- children: d,
669
- className: O,
670
- textAlign: E = "center",
671
- orientation: T = "down",
672
- dev: m,
673
- ...s
674
- }) => {
675
- const [p, f] = $.useState(null), b = (R) => {
676
- f(R.currentTarget);
677
- }, u = () => {
678
- m || f(null);
679
- };
680
- return /* @__PURE__ */ N.jsxs(
102
+ }, [f, m, e]);
103
+ const H = a ? {
104
+ top: a.top,
105
+ left: a.left,
106
+ zIndex: Z ?? 1e3,
107
+ "--tooltip-arrow-x": `${a.arrowX}px`,
108
+ "--tooltip-arrow-y": `${a.arrowY}px`,
109
+ "--tooltip-arrow-r": a.arrowR || "none"
110
+ } : {
111
+ // скрытый замер до первой позиции
112
+ top: -9999,
113
+ left: -9999,
114
+ zIndex: Z ?? 1e3,
115
+ visibility: "hidden"
116
+ }, N = f && typeof document < "u" ? V(
117
+ /* @__PURE__ */ P.createElement(
118
+ "div",
119
+ {
120
+ ref: k,
121
+ id: p,
122
+ role: "tooltip",
123
+ className: z.t,
124
+ "data-visible": a ? "true" : "false",
125
+ "data-align": d,
126
+ style: H
127
+ },
128
+ e
129
+ ),
130
+ document.body
131
+ ) : null;
132
+ return /* @__PURE__ */ P.createElement(
681
133
  "span",
682
134
  {
683
- className: O,
684
- onMouseOver: b,
685
- onMouseOut: u,
686
- children: [
687
- d,
688
- p !== null && fr(
689
- s.element ? /* @__PURE__ */ N.jsx(
690
- s.element,
691
- {
692
- content: w,
693
- position: p.getBoundingClientRect(),
694
- textAlign: E,
695
- update: Date.now()
696
- }
697
- ) : /* @__PURE__ */ N.jsx(
698
- yr,
699
- {
700
- update: Date.now(),
701
- orientation: T,
702
- content: w,
703
- textAlign: E,
704
- position: p.getBoundingClientRect()
705
- }
706
- ),
707
- document.body
708
- )
709
- ]
710
- }
135
+ ref: M,
136
+ className: u ? `${z.root} ${u}` : z.root,
137
+ onMouseEnter: _,
138
+ onMouseLeave: q,
139
+ onFocus: _,
140
+ onBlur: q,
141
+ "aria-describedby": f ? p : void 0
142
+ },
143
+ t,
144
+ N
711
145
  );
712
- };
146
+ }
147
+ const le = () => null;
148
+ function I() {
149
+ return typeof globalThis < "u" ? globalThis : {};
150
+ }
151
+ I().elcrm || (I().elcrm = {});
152
+ Object.assign(I().elcrm, { tooltip: J.version });
713
153
  export {
714
- yr as Item,
715
- br as Tooltip
154
+ le as Item,
155
+ ie as Tooltip,
156
+ ee as acquireOverlayZIndex,
157
+ oe as peekOverlayZIndex,
158
+ C as releaseOverlayZIndex
716
159
  };
package/dist/index.umd.js CHANGED
@@ -1,31 +1,2 @@
1
- (function(m,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],w):(m=typeof globalThis<"u"?globalThis:m||self,w((m.elCRM=m.elCRM||{},m.elCRM.components={}),m.React,m.ReactDOM))})(this,function(m,w,je){"use strict";var ee=document.createElement("style");ee.textContent=`:root{--tooltip-background: #28292d;--tooltip-color: #ffffff94;--tooltip-radius: 15px}._t_15niz_7{position:fixed;z-index:99;opacity:0;background:var(--tooltip-background);color:var(--tooltip-color);display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:.5rem;border-radius:var(--tooltip-radius);padding:10px;max-width:300px;font-size:14px;margin-inline:10px;width:min-content!important}._t_15niz_7:before{content:"";position:fixed;pointer-events:none;top:var(--tooltip-arrow-y);left:var(--tooltip-arrow-x);margin-left:-8px;border-width:8px;border-style:solid;border-color:#28292d transparent transparent transparent}
2
- /*$vite$:1*/`,document.head.appendChild(ee);var z={exports:{}},I={};/**
3
- * @license React
4
- * react-jsx-runtime.production.min.js
5
- *
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var re;function ke(){if(re)return I;re=1;var T=w,d=Symbol.for("react.element"),P=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,O=T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function l(p,f,_){var u,R={},S=null,L=null;_!==void 0&&(S=""+_),f.key!==void 0&&(S=""+f.key),f.ref!==void 0&&(L=f.ref);for(u in f)E.call(f,u)&&!x.hasOwnProperty(u)&&(R[u]=f[u]);if(p&&p.defaultProps)for(u in f=p.defaultProps,f)R[u]===void 0&&(R[u]=f[u]);return{$$typeof:d,type:p,key:S,ref:L,props:R,_owner:O.current}}return I.Fragment=P,I.jsx=l,I.jsxs=l,I}var $={};/**
11
- * @license React
12
- * react-jsx-runtime.development.js
13
- *
14
- * Copyright (c) Facebook, Inc. and its affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var te;function De(){return te||(te=1,process.env.NODE_ENV!=="production"&&function(){var T=w,d=Symbol.for("react.element"),P=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),p=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),ae=Symbol.iterator,Ie="@@iterator";function $e(e){if(e===null||typeof e!="object")return null;var r=ae&&e[ae]||e[Ie];return typeof r=="function"?r:null}var D=T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];We("error",e,t)}}function We(e,r,t){{var n=D.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Me=!1,Ye=!1,Le=!1,Ve=!1,Ue=!1,oe;oe=Symbol.for("react.module.reference");function Ne(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===x||Ue||e===O||e===_||e===u||Ve||e===L||Me||Ye||Le||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===R||e.$$typeof===l||e.$$typeof===p||e.$$typeof===f||e.$$typeof===oe||e.getModuleId!==void 0))}function Be(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ie(e){return e.displayName||"Context"}function C(e){if(e==null)return null;if(typeof e.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case P:return"Portal";case x:return"Profiler";case O:return"StrictMode";case _:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var r=e;return ie(r)+".Consumer";case l:var t=e;return ie(t._context)+".Provider";case f:return Be(e,e.render,"ForwardRef");case R:var n=e.displayName||null;return n!==null?n:C(e.type)||"Memo";case S:{var i=e,s=i._payload,o=i._init;try{return C(o(s))}catch{return null}}}return null}var j=Object.assign,W=0,ue,le,se,fe,ce,de,ve;function pe(){}pe.__reactDisabledLog=!0;function ze(){{if(W===0){ue=console.log,le=console.info,se=console.warn,fe=console.error,ce=console.group,de=console.groupCollapsed,ve=console.groupEnd;var e={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function qe(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},e,{value:ue}),info:j({},e,{value:le}),warn:j({},e,{value:se}),error:j({},e,{value:fe}),group:j({},e,{value:ce}),groupCollapsed:j({},e,{value:de}),groupEnd:j({},e,{value:ve})})}W<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var q=D.ReactCurrentDispatcher,J;function V(e,r,t){{if(J===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);J=n&&n[1]||""}return`
19
- `+J+e}}var K=!1,U;{var Je=typeof WeakMap=="function"?WeakMap:Map;U=new Je}function ye(e,r){if(!e||K)return"";{var t=U.get(e);if(t!==void 0)return t}var n;K=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=q.current,q.current=null,ze();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(g){n=g}Reflect.construct(e,[],o)}else{try{o.call()}catch(g){n=g}e.call(o.prototype)}}else{try{throw Error()}catch(g){n=g}e()}}catch(g){if(g&&n&&typeof g.stack=="string"){for(var a=g.stack.split(`
20
- `),h=n.stack.split(`
21
- `),c=a.length-1,v=h.length-1;c>=1&&v>=0&&a[c]!==h[v];)v--;for(;c>=1&&v>=0;c--,v--)if(a[c]!==h[v]){if(c!==1||v!==1)do if(c--,v--,v<0||a[c]!==h[v]){var b=`
22
- `+a[c].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,b),b}while(c>=1&&v>=0);break}}}finally{K=!1,q.current=s,qe(),Error.prepareStackTrace=i}var A=e?e.displayName||e.name:"",k=A?V(A):"";return typeof e=="function"&&U.set(e,k),k}function Ke(e,r,t){return ye(e,!1)}function Ge(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function N(e,r,t){if(e==null)return"";if(typeof e=="function")return ye(e,Ge(e));if(typeof e=="string")return V(e);switch(e){case _:return V("Suspense");case u:return V("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Ke(e.render);case R:return N(e.type,r,t);case S:{var n=e,i=n._payload,s=n._init;try{return N(s(i),r,t)}catch{}}}return""}var M=Object.prototype.hasOwnProperty,he={},ge=D.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);ge.setExtraStackFrame(t)}else ge.setExtraStackFrame(null)}function Xe(e,r,t,n,i){{var s=Function.call.bind(M);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){a=c}a&&!(a instanceof Error)&&(B(i),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),B(null)),a instanceof Error&&!(a.message in he)&&(he[a.message]=!0,B(i),y("Failed %s type: %s",t,a.message),B(null))}}}var He=Array.isArray;function G(e){return He(e)}function Ze(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Qe(e){try{return _e(e),!1}catch{return!0}}function _e(e){return""+e}function be(e){if(Qe(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ze(e)),_e(e)}var me=D.ReactCurrentOwner,er={key:!0,ref:!0,__self:!0,__source:!0},Ee,Re;function rr(e){if(M.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function tr(e){if(M.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function nr(e,r){typeof e.ref=="string"&&me.current}function ar(e,r){{var t=function(){Ee||(Ee=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function or(e,r){{var t=function(){Re||(Re=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ir=function(e,r,t,n,i,s,o){var a={$$typeof:d,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ur(e,r,t,n,i){{var s,o={},a=null,h=null;t!==void 0&&(be(t),a=""+t),tr(r)&&(be(r.key),a=""+r.key),rr(r)&&(h=r.ref,nr(r,i));for(s in r)M.call(r,s)&&!er.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var c=e.defaultProps;for(s in c)o[s]===void 0&&(o[s]=c[s])}if(a||h){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ar(o,v),h&&or(o,v)}return ir(e,a,h,i,n,me.current,o)}}var X=D.ReactCurrentOwner,we=D.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);we.setExtraStackFrame(t)}else we.setExtraStackFrame(null)}var H;H=!1;function Z(e){return typeof e=="object"&&e!==null&&e.$$typeof===d}function xe(){{if(X.current){var e=C(X.current.type);if(e)return`
23
-
24
- Check the render method of \``+e+"`."}return""}}function lr(e){return""}var Te={};function sr(e){{var r=xe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
25
-
26
- Check the top-level render call using <`+t+">.")}return r}}function Oe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=sr(r);if(Te[t])return;Te[t]=!0;var n="";e&&e._owner&&e._owner!==X.current&&(n=" It was passed a child from "+C(e._owner.type)+"."),F(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function Ce(e,r){{if(typeof e!="object")return;if(G(e))for(var t=0;t<e.length;t++){var n=e[t];Z(n)&&Oe(n,r)}else if(Z(e))e._store&&(e._store.validated=!0);else if(e){var i=$e(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)Z(o.value)&&Oe(o.value,r)}}}function fr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===R))t=r.propTypes;else return;if(t){var n=C(r);Xe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!H){H=!0;var i=C(r);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}var Pe={};function Se(e,r,t,n,i,s){{var o=Ne(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=lr();h?a+=h:a+=xe();var c;e===null?c="null":G(e)?c="array":e!==void 0&&e.$$typeof===d?(c="<"+(C(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):c=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,a)}var v=ur(e,r,t,i,s);if(v==null)return v;if(o){var b=r.children;if(b!==void 0)if(n)if(G(b)){for(var A=0;A<b.length;A++)Ce(b[A],e);Object.freeze&&Object.freeze(b)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ce(b,e)}if(M.call(r,"key")){var k=C(e),g=Object.keys(r).filter(function(gr){return gr!=="key"}),Q=g.length>0?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}";if(!Pe[k+Q]){var hr=g.length>0?"{"+g.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
27
- let props = %s;
28
- <%s {...props} />
29
- React keys must be passed directly to JSX without using spread:
30
- let props = %s;
31
- <%s key={someKey} {...props} />`,Q,k,hr,k),Pe[k+Q]=!0}}return e===E?cr(v):fr(v),v}}function dr(e,r,t){return Se(e,r,t,!0)}function vr(e,r,t){return Se(e,r,t,!1)}var pr=vr,yr=dr;$.Fragment=E,$.jsx=pr,$.jsxs=yr}()),$}process.env.NODE_ENV==="production"?z.exports=ke():z.exports=De();var Y=z.exports;const Fe={t:"_t_15niz_7"},ne=({content:T,position:d,orientation:P="up",update:E,textAlign:O})=>{const x=w.useRef(null);return w.useEffect(()=>{const l=x.current;l.style.opacity="0",l.style.width="auto",l.style.left="0px",l.style.top="0px";let p={x:0,y:0};const f=l.getBoundingClientRect();let _=d.width/2;l.style.width=f.width+"px";let u=0;switch(P){case"up":u=d.left+_-f.width/2-10,u=window.innerWidth<u+f.width?window.innerWidth-f.width-20:u,u=u<0?0:u,l.style.left=u+"px",l.style.top=d.top-f.height-10+"px",p.x=d.left+_,p.y=d.top-10;break;case"down":u=d.left+_-f.width/2,u=u<0?0:u,l.style.left=u+"px",l.style.top=d.bottom+10+"px";break;case"left":l.style.top=d.top+"px",l.style.left=d.left-f.width-d.width+"px";break;case"right":l.style.top=d.top+"px",l.style.left=d.right+"px";break}l.style.setProperty("--tooltip-arrow-x",p.x+"px"),l.style.setProperty("--tooltip-arrow-y",p.y+"px"),l.style.transition="opacity 0.3s",l.style.textAlign=O,l.style.opacity="1"},[E]),Y.jsx("div",{ref:x,className:Fe.t,children:T})},Ae=({content:T,children:d,className:P,textAlign:E="center",orientation:O="down",dev:x,...l})=>{const[p,f]=w.useState(null),_=R=>{f(R.currentTarget)},u=()=>{x||f(null)};return Y.jsxs("span",{className:P,onMouseOver:_,onMouseOut:u,children:[d,p!==null&&je.createPortal(l.element?Y.jsx(l.element,{content:T,position:p.getBoundingClientRect(),textAlign:E,update:Date.now()}):Y.jsx(ne,{update:Date.now(),orientation:O,content:T,textAlign:E,position:p.getBoundingClientRect()}),document.body)]})};m.Item=ne,m.Tooltip=Ae,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],o):(n=typeof globalThis<"u"?globalThis:n||self,o((n.elCRM=n.elCRM||{},n.elCRM.tooltip={}),n.React,n.ReactDOM))})(this,function(n,o,R){"use strict";var M=document.createElement("style");M.textContent=`@charset "UTF-8";:root{--tooltip-background: #1e1f24;--tooltip-color: rgba(255, 255, 255, .92);--tooltip-radius: 10px;--tooltip-max-width: 280px;--tooltip-font-size: 13px;--tooltip-padding: 8px 10px;--tooltip-shadow: 0 8px 24px rgba(0, 0, 0, .28);--tooltip-gap: 8px}._t_ai3lm_13{position:fixed;box-sizing:border-box;max-width:var(--tooltip-max-width);padding:var(--tooltip-padding);border-radius:var(--tooltip-radius);background:var(--tooltip-background);color:var(--tooltip-color);font-size:var(--tooltip-font-size);line-height:1.35;font-weight:500;box-shadow:var(--tooltip-shadow);pointer-events:none;opacity:0;transition:opacity .12s ease;white-space:normal;word-break:break-word}._t_ai3lm_13[data-visible=true]{opacity:1}._t_ai3lm_13[data-align=left]{text-align:left}._t_ai3lm_13[data-align=center]{text-align:center}._t_ai3lm_13[data-align=right]{text-align:right}._t_ai3lm_13:before{content:"";position:fixed;pointer-events:none;width:0;height:0;top:var(--tooltip-arrow-y);left:var(--tooltip-arrow-x);transform:var(--tooltip-arrow-r, none);margin-left:-6px;border-width:6px;border-style:solid;border-color:var(--tooltip-background) transparent transparent transparent}._root_ai3lm_64{display:inline-flex;vertical-align:middle;max-width:100%}
2
+ /*$vite$:1*/`,document.head.appendChild(M);const Y={version:"0.1.0"},y={t:"_t_ai3lm_13",root:"_root_ai3lm_64"},O=1e3,D=10;function T(){const t=globalThis;return t.elcrm||(t.elcrm={}),t.elcrm.overlayZ||(t.elcrm.overlayZ={seq:0,active:new Set}),t.elcrm.overlayZ}function S(){const t=T();t.seq+=1;const e=O+t.seq*D;return t.active.add(e),e}function E(t){const e=T();e.active.delete(t),e.active.size===0&&(e.seq=0)}function G(){const t=T();return t.active.size===0?O:Math.max(...t.active)}const i=8,a=8;function H(t,e,z){const w=t.left+t.width/2,p=t.top+t.height/2;let l=0,s=0,u=w,d=0,r="";const g=x=>Math.min(Math.max(a,x),window.innerWidth-e.width-a);switch(z){case"top":l=t.top-e.height-i,s=g(w-e.width/2),d=t.top-i,r="",l<a&&(l=t.bottom+i,d=t.bottom+i-2,r="rotate(180deg)");break;case"bottom":l=t.bottom+i,s=g(w-e.width/2),d=t.bottom+i-2,r="rotate(180deg)",l+e.height>window.innerHeight-a&&(l=t.top-e.height-i,d=t.top-i,r="");break;case"left":l=Math.min(Math.max(a,p-e.height/2),window.innerHeight-e.height-a),s=t.left-e.width-i,u=t.left-i+2,d=p,r="rotate(270deg)",s<a&&(s=t.right+i,u=t.right+i-2,r="rotate(90deg)");break;case"right":l=Math.min(Math.max(a,p-e.height/2),window.innerHeight-e.height-a),s=t.right+i,u=t.right+i-2,d=p,r="rotate(90deg)",s+e.width>window.innerWidth-a&&(s=t.left-e.width-i,u=t.left-i+2,r="rotate(270deg)");break}return{top:l,left:s,arrowX:u,arrowY:d,arrowR:r}}function N({content:t,children:e,placement:z,orientation:w,textAlign:p="center",delay:l=180,delayHide:s=60,className:u,disabled:d=!1,open:r}){const g=z??w??"top",x=o.useId(),Z=o.useRef(null),C=o.useRef(null),b=o.useRef(null),_=o.useRef(null),c=o.useRef(null),[A,q]=o.useState(!1),[f,L]=o.useState(null),[$,P]=o.useState(null),I=()=>{b.current!=null&&(window.clearTimeout(b.current),b.current=null),_.current!=null&&(window.clearTimeout(_.current),_.current=null)},X=o.useCallback(()=>{d||t==null||t===""||(I(),b.current=window.setTimeout(()=>{q(!0)},l))},[t,l,d]),j=o.useCallback(()=>{r||(I(),_.current=window.setTimeout(()=>{q(!1),L(null)},s))},[s,r]),m=r||A;o.useLayoutEffect(()=>{if(m){if(c.current==null){const h=S();c.current=h,P(h)}return}c.current!=null&&(E(c.current),c.current=null,P(null))},[m]),o.useEffect(()=>()=>{I(),c.current!=null&&(E(c.current),c.current=null)},[]),o.useLayoutEffect(()=>{if(!m)return;const h=Z.current,B=C.current;if(!h||!B)return;const v=()=>{const V=h.getBoundingClientRect(),J=B.getBoundingClientRect();L(H(V,J,g))};return v(),window.addEventListener("resize",v),window.addEventListener("scroll",v,!0),()=>{window.removeEventListener("resize",v),window.removeEventListener("scroll",v,!0)}},[m,g,t]);const F=f?{top:f.top,left:f.left,zIndex:$??1e3,"--tooltip-arrow-x":`${f.arrowX}px`,"--tooltip-arrow-y":`${f.arrowY}px`,"--tooltip-arrow-r":f.arrowR||"none"}:{top:-9999,left:-9999,zIndex:$??1e3,visibility:"hidden"},U=m&&typeof document<"u"?R.createPortal(o.createElement("div",{ref:C,id:x,role:"tooltip",className:y.t,"data-visible":f?"true":"false","data-align":p,style:F},t),document.body):null;return o.createElement("span",{ref:Z,className:u?`${y.root} ${u}`:y.root,onMouseEnter:X,onMouseLeave:j,onFocus:X,onBlur:j,"aria-describedby":m?x:void 0},e,U)}const W=()=>null;function k(){return typeof globalThis<"u"?globalThis:{}}k().elcrm||(k().elcrm={}),Object.assign(k().elcrm,{tooltip:Y.version}),n.Item=W,n.Tooltip=N,n.acquireOverlayZIndex=S,n.peekOverlayZIndex=G,n.releaseOverlayZIndex=E,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,17 +1,36 @@
1
1
  {
2
2
  "name": "@elcrm/tooltip",
3
- "version": "0.0.2",
4
- "description": "plugin for elCRM",
3
+ "version": "0.1.0",
4
+ "description": "React-подсказки для elCRM: portal, общий overlayZ-стек, hover/focus, CSS-переменные.",
5
5
  "type": "module",
6
6
  "author": "MaSkal <dev@elcrm.online>",
7
7
  "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/elcrm-lib/elcrm.tooltip.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/elcrm-lib/elcrm.tooltip/issues"
14
+ },
15
+ "homepage": "https://www.npmjs.com/package/@elcrm/tooltip",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
8
22
  "files": [
9
23
  "dist"
10
24
  ],
11
25
  "keywords": [
12
26
  "elcrm",
13
- "state",
14
- "react"
27
+ "tooltip",
28
+ "react",
29
+ "overlay",
30
+ "portal"
31
+ ],
32
+ "sideEffects": [
33
+ "**/*.css"
15
34
  ],
16
35
  "main": "./dist/index.umd.js",
17
36
  "module": "./dist/index.es.js",
@@ -22,13 +41,53 @@
22
41
  "import": "./dist/index.es.js",
23
42
  "require": "./dist/index.umd.js"
24
43
  },
44
+ "./style.css": {
45
+ "import": "./dist/index.css",
46
+ "require": "./dist/index.css",
47
+ "default": "./dist/index.css"
48
+ },
25
49
  "./dist/style.css": {
26
50
  "import": "./dist/index.css",
27
- "require": "./dist/index.css"
28
- }
51
+ "require": "./dist/index.css",
52
+ "default": "./dist/index.css"
53
+ },
54
+ "./package.json": "./package.json"
55
+ },
56
+ "scripts": {
57
+ "dev": "vite",
58
+ "build": "vite build",
59
+ "test": "vitest run",
60
+ "test:watch": "vitest",
61
+ "prepublishOnly": "vitest run && vite build",
62
+ "pack:check": "npm pack --dry-run"
29
63
  },
30
64
  "peerDependencies": {
31
65
  "@types/react": ">=18.0.0",
32
- "react": ">=18.0.0"
66
+ "react": ">=18.0.0",
67
+ "react-dom": ">=18.0.0"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "@types/react": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "devDependencies": {
75
+ "@elcrm/storybook": "^0.0.3",
76
+ "@testing-library/jest-dom": "^6.6.3",
77
+ "@testing-library/react": "^16.2.0",
78
+ "@testing-library/user-event": "^14.6.1",
79
+ "@types/node": "^22.13.10",
80
+ "@types/react": "^18.2.66",
81
+ "@types/react-dom": "^18.2.22",
82
+ "@vitejs/plugin-react": "^4.3.1",
83
+ "jsdom": "^26.0.0",
84
+ "react": "^18.2.0",
85
+ "react-dom": "^18.2.0",
86
+ "sass-embedded": "^1.85.1",
87
+ "typescript": "^5.8.2",
88
+ "vite": "^5.4.2",
89
+ "vite-plugin-dts": "^4.0.3",
90
+ "vite-plugin-lib-inject-css": "^2.1.1",
91
+ "vitest": "^3.0.8"
33
92
  }
34
93
  }