@shmidko61/lc-ui-kit 0.13.0 → 0.15.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.
Files changed (62) hide show
  1. package/README.md +54 -0
  2. package/dist/box/box.d.ts +1 -1
  3. package/dist/box/box.types.d.ts +2 -2
  4. package/dist/box/helpers/box-animation.helpers.d.ts +8 -0
  5. package/dist/box/helpers/index.d.ts +1 -0
  6. package/dist/box/types/box-animation.types.d.ts +3 -0
  7. package/dist/box/types/index.d.ts +1 -0
  8. package/dist/box.cjs +1 -1
  9. package/dist/box.js +436 -312
  10. package/dist/button.cjs +1 -1
  11. package/dist/button.js +163 -156
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +70 -62
  15. package/dist/loader/helpers/index.d.ts +1 -0
  16. package/dist/loader/helpers/loader.helpers.d.ts +2 -0
  17. package/dist/loader/index.d.ts +2 -0
  18. package/dist/loader/loader.d.ts +5 -0
  19. package/dist/loader/types/index.d.ts +1 -0
  20. package/dist/loader/types/loader.types.d.ts +28 -0
  21. package/dist/loader-Daam055i.js +104 -0
  22. package/dist/loader-ODTCTLKE.cjs +1 -0
  23. package/dist/loader.cjs +1 -0
  24. package/dist/loader.js +4 -0
  25. package/dist/media-gallery.cjs +1 -1
  26. package/dist/media-gallery.js +42 -30
  27. package/dist/progress-bar/helpers/index.d.ts +1 -0
  28. package/dist/progress-bar/helpers/progress-bar.helpers.d.ts +6 -0
  29. package/dist/progress-bar/index.d.ts +2 -0
  30. package/dist/progress-bar/progress-bar.d.ts +5 -0
  31. package/dist/progress-bar/types/index.d.ts +1 -0
  32. package/dist/progress-bar/types/progress-bar.types.d.ts +80 -0
  33. package/dist/progress-bar-D4CL9r42.js +236 -0
  34. package/dist/progress-bar-XIJDb_UM.cjs +1 -0
  35. package/dist/progress-bar.cjs +1 -0
  36. package/dist/progress-bar.js +4 -0
  37. package/dist/styles.css +1 -1
  38. package/dist/tabs/helpers/index.d.ts +1 -0
  39. package/dist/tabs/helpers/tabs.helpers.d.ts +7 -0
  40. package/dist/tabs/hooks/index.d.ts +1 -0
  41. package/dist/tabs/hooks/tabs.hooks.d.ts +5 -0
  42. package/dist/tabs/index.d.ts +2 -0
  43. package/dist/tabs/tabs.d.ts +4 -0
  44. package/dist/tabs/types/index.d.ts +1 -0
  45. package/dist/tabs/types/tabs.types.d.ts +95 -0
  46. package/dist/tabs-BNZDJRz_.cjs +1 -0
  47. package/dist/tabs-DIPSJX1z.js +264 -0
  48. package/dist/tabs.cjs +1 -0
  49. package/dist/tabs.js +5 -0
  50. package/dist/tooltip/helpers/index.d.ts +1 -0
  51. package/dist/tooltip/helpers/tooltip.helpers.d.ts +7 -0
  52. package/dist/tooltip/index.d.ts +2 -0
  53. package/dist/tooltip/tooltip.d.ts +5 -0
  54. package/dist/tooltip/types/index.d.ts +1 -0
  55. package/dist/tooltip/types/tooltip.types.d.ts +51 -0
  56. package/dist/tooltip-0RbTCYn_.cjs +1 -0
  57. package/dist/tooltip-CWnHAfbI.js +166 -0
  58. package/dist/tooltip.cjs +1 -0
  59. package/dist/tooltip.js +4 -0
  60. package/dist/types/animation.types.d.ts +35 -0
  61. package/dist/types/index.d.ts +1 -0
  62. package/package.json +42 -4
@@ -0,0 +1,166 @@
1
+ "use client";
2
+ import { jsxs as Y, jsx as G } from "react/jsx-runtime";
3
+ import { useState as g, useId as J, useRef as b, useEffect as N, isValidElement as Q, cloneElement as U } from "react";
4
+ import { Flex as Z } from "./flex.js";
5
+ import { Box as K } from "./box.js";
6
+ function v(o) {
7
+ const [e, s] = o.split("-"), m = e === "top" || e === "bottom", n = s === "start", t = s === "end";
8
+ return { box: m ? {
9
+ left: n ? "0" : t ? "auto" : "50%",
10
+ right: t ? "0" : "auto",
11
+ top: e === "bottom" ? "calc(100% + 6px)" : "auto",
12
+ bottom: e === "top" ? "calc(100% + 6px)" : "auto",
13
+ transform: n || t ? "none" : "translateX(-50%)"
14
+ } : {
15
+ top: n ? "0" : t ? "auto" : "50%",
16
+ bottom: t ? "0" : "auto",
17
+ left: e === "right" ? "calc(100% + 6px)" : "auto",
18
+ right: e === "left" ? "calc(100% + 6px)" : "auto",
19
+ transform: n || t ? "none" : "translateY(-50%)"
20
+ }, arrow: m ? {
21
+ left: n ? "12px" : t ? "auto" : "50%",
22
+ right: t ? "12px" : "auto",
23
+ top: e === "bottom" ? "-4px" : "auto",
24
+ bottom: e === "top" ? "-4px" : "auto",
25
+ transform: "translateX(-50%) rotate(45deg)"
26
+ } : {
27
+ top: n ? "12px" : t ? "auto" : "50%",
28
+ bottom: t ? "12px" : "auto",
29
+ left: e === "right" ? "-4px" : "auto",
30
+ right: e === "left" ? "-4px" : "auto",
31
+ transform: "translateY(-50%) rotate(45deg)"
32
+ } };
33
+ }
34
+ function i(o) {
35
+ return {
36
+ position: {
37
+ type: "absolute",
38
+ top: o.top,
39
+ bottom: o.bottom,
40
+ left: o.left,
41
+ right: o.right
42
+ },
43
+ transform: o.transform
44
+ };
45
+ }
46
+ function tt({
47
+ children: o,
48
+ content: e,
49
+ placement: s = "top",
50
+ responsive: m,
51
+ md: n,
52
+ lg: t,
53
+ xl: h,
54
+ open: x,
55
+ defaultOpen: L = !1,
56
+ onOpenChange: y,
57
+ delay: E = 0,
58
+ showArrow: O = !0,
59
+ disabled: d = !1,
60
+ contentProps: r
61
+ }) {
62
+ const [V, W] = g(L), [B, R] = g(!1), [j, z] = g(!1), [F, w] = g(!1), I = J(), f = !d && (x ?? V), p = b(!1), M = b(x), k = b(f);
63
+ M.current = x, k.current = f;
64
+ const D = b(y);
65
+ D.current = y, N(() => {
66
+ if (!p.current && !d) return;
67
+ const a = !d && !F && (B || j);
68
+ if (a === k.current) return;
69
+ const A = setTimeout(
70
+ () => {
71
+ M.current === void 0 && W(a), D.current?.(a);
72
+ },
73
+ a ? Math.max(0, E) : 0
74
+ );
75
+ return () => clearTimeout(A);
76
+ }, [B, j, d, F, E]);
77
+ const q = Q(o) ? U(o, {
78
+ "aria-describedby": [o.props["aria-describedby"], f ? I : void 0].filter(Boolean).join(" ") || void 0
79
+ }) : o, T = v(s), H = n?.placement !== void 0 ? n.placement ?? s : m?.md, l = H ? v(H) : void 0, S = t?.placement !== void 0 ? t.placement ?? s : m?.lg, u = S ? v(S) : void 0, X = h?.placement !== void 0 ? h.placement ?? s : m?.xl, c = X ? v(X) : void 0;
80
+ return /* @__PURE__ */ Y(
81
+ Z,
82
+ {
83
+ as: "span",
84
+ inline: !0,
85
+ position: { type: "relative" },
86
+ onMouseEnter: () => {
87
+ p.current = !0, w(!1), R(!0);
88
+ },
89
+ onMouseLeave: () => {
90
+ p.current = !0, R(!1);
91
+ },
92
+ onFocus: () => {
93
+ p.current = !0, w(!1), z(!0);
94
+ },
95
+ onBlur: (a) => {
96
+ a.currentTarget.contains(a.relatedTarget) || (p.current = !0, z(!1));
97
+ },
98
+ onKeyDown: (a) => {
99
+ a.key === "Escape" && (p.current = !0, w(!0));
100
+ },
101
+ children: [
102
+ q,
103
+ f && /* @__PURE__ */ Y(
104
+ K,
105
+ {
106
+ role: "tooltip",
107
+ id: I,
108
+ bg: "--color-background-default",
109
+ color: "--color-text-primary",
110
+ p: { px: 8, py: 6 },
111
+ border: { radius: "4px" },
112
+ width: "max-content",
113
+ maxWidth: "min(280px, calc(100vw - 24px))",
114
+ ...i(T.box),
115
+ ...r,
116
+ position: { ...i(T.box).position, ...r?.position },
117
+ md: l || r?.md ? {
118
+ ...l ? i(l.box) : {},
119
+ ...r?.md,
120
+ position: {
121
+ ...l ? i(l.box).position : {},
122
+ ...r?.md?.position
123
+ }
124
+ } : void 0,
125
+ lg: u || r?.lg ? {
126
+ ...u ? i(u.box) : {},
127
+ ...r?.lg,
128
+ position: {
129
+ ...u ? i(u.box).position : {},
130
+ ...r?.lg?.position
131
+ }
132
+ } : void 0,
133
+ xl: c || r?.xl ? {
134
+ ...c ? i(c.box) : {},
135
+ ...r?.xl,
136
+ position: {
137
+ ...c ? i(c.box).position : {},
138
+ ...r?.xl?.position
139
+ }
140
+ } : void 0,
141
+ style: { fontSize: "12px", lineHeight: "14px", zIndex: 1e3, ...r?.style },
142
+ children: [
143
+ O && /* @__PURE__ */ G(
144
+ K,
145
+ {
146
+ "aria-hidden": "true",
147
+ width: 8,
148
+ height: 8,
149
+ bg: "inherit",
150
+ ...i(T.arrow),
151
+ md: l ? i(l.arrow) : void 0,
152
+ lg: u ? i(u.arrow) : void 0,
153
+ xl: c ? i(c.arrow) : void 0
154
+ }
155
+ ),
156
+ e
157
+ ]
158
+ }
159
+ )
160
+ ]
161
+ }
162
+ );
163
+ }
164
+ export {
165
+ tt as T
166
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./tooltip-0RbTCYn_.cjs");exports.Tooltip=o.Tooltip;
@@ -0,0 +1,4 @@
1
+ import { T as r } from "./tooltip-CWnHAfbI.js";
2
+ export {
3
+ r as Tooltip
4
+ };
@@ -0,0 +1,35 @@
1
+ import { CSSProperties } from 'react';
2
+ /** Параметры одной CSS-анимации. Частичные объекты наследуются по base/md/lg/xl. */
3
+ export type UiKitAnimation = {
4
+ /** Кадры Web Animations API; null удаляет наследуемые кадры и возвращает выбранный preset. */
5
+ keyframes?: Array<Keyframe> | null;
6
+ /** Настройка reduced motion для keyframes и spin: disable (по умолчанию) или keep. */
7
+ reducedMotion?: 'disable' | 'keep';
8
+ /** Синоним timingFunction в стиле Web Animations; ближайшее заданное значение побеждает. */
9
+ easing?: string;
10
+ /** Синоним iterationCount: число или Infinity; ближайшее заданное значение побеждает. */
11
+ iterations?: number;
12
+ /** Готовый набор spin (Web Animations) или имя пользовательского CSS @keyframes; по умолчанию none. */
13
+ preset?: 'spin' | (string & {});
14
+ /** Продолжительность CSS, например 800ms или 1.5s; число — миллисекунды, по умолчанию 1s. */
15
+ duration?: string | number;
16
+ /** Функция скорости CSS; по умолчанию linear. */
17
+ timingFunction?: CSSProperties['animationTimingFunction'];
18
+ /** Количество повторов или infinite; по умолчанию infinite. */
19
+ iterationCount?: number | 'infinite';
20
+ /** Задержка CSS, например 0ms; число — миллисекунды, по умолчанию 0ms. */
21
+ delay?: string | number;
22
+ /** Направление проигрывания; по умолчанию normal. */
23
+ direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
24
+ /** Применение кадров до и после анимации; по умолчанию none. */
25
+ fillMode?: 'none' | 'forwards' | 'backwards' | 'both';
26
+ /** Состояние воспроизведения; по умолчанию running. */
27
+ playState?: 'running' | 'paused';
28
+ };
29
+ /** Анимация: объект параметров, готовый spin или none для полного сброса. */
30
+ export type UiKitAnimationValue = UiKitAnimation | 'spin' | 'none';
31
+ /** Базовая и responsive-настройка анимации Box; явный style приоритетнее. */
32
+ export type UiKitAnimationProps = {
33
+ /** Анимация. На md/lg/xl объекты наследуют свойства; none сбрасывает накопленные значения. */
34
+ animation?: UiKitAnimationValue;
35
+ };
@@ -1,3 +1,4 @@
1
+ export type * from './animation.types';
1
2
  export type * from './flex.types';
2
3
  export type * from './interaction.types';
3
4
  export type * from './layout.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shmidko61/lc-ui-kit",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -78,6 +78,18 @@
78
78
  ],
79
79
  "notification-provider": [
80
80
  "dist/notification-provider/index.d.ts"
81
+ ],
82
+ "tooltip": [
83
+ "dist/tooltip/tooltip.d.ts"
84
+ ],
85
+ "loader": [
86
+ "dist/loader/index.d.ts"
87
+ ],
88
+ "progress-bar": [
89
+ "dist/progress-bar/index.d.ts"
90
+ ],
91
+ "tabs": [
92
+ "dist/tabs/index.d.ts"
81
93
  ]
82
94
  }
83
95
  },
@@ -197,6 +209,26 @@
197
209
  "types": "./dist/notification-provider/index.d.ts",
198
210
  "import": "./dist/notification-provider.js",
199
211
  "require": "./dist/notification-provider.cjs"
212
+ },
213
+ "./tooltip": {
214
+ "types": "./dist/tooltip/tooltip.d.ts",
215
+ "import": "./dist/tooltip.js",
216
+ "require": "./dist/tooltip.cjs"
217
+ },
218
+ "./loader": {
219
+ "types": "./dist/loader/index.d.ts",
220
+ "import": "./dist/loader.js",
221
+ "require": "./dist/loader.cjs"
222
+ },
223
+ "./progress-bar": {
224
+ "types": "./dist/progress-bar/index.d.ts",
225
+ "import": "./dist/progress-bar.js",
226
+ "require": "./dist/progress-bar.cjs"
227
+ },
228
+ "./tabs": {
229
+ "types": "./dist/tabs/index.d.ts",
230
+ "import": "./dist/tabs.js",
231
+ "require": "./dist/tabs.cjs"
200
232
  }
201
233
  },
202
234
  "sideEffects": [
@@ -231,14 +263,14 @@
231
263
  "vite-plugin-svgr": "^5.2.0"
232
264
  },
233
265
  "scripts": {
234
- "verify:package": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build && pnpm typecheck:package && pnpm test:checks && pnpm test:package && pnpm test:hover && pnpm test:states && pnpm pack:check && pnpm storybook:build",
266
+ "verify:package": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build && pnpm typecheck:package && pnpm test:checks && pnpm test:package && pnpm test:hover && pnpm test:states && pnpm test:animation && pnpm test:progress-bar && pnpm test:tabs && pnpm pack:check && pnpm storybook:build",
235
267
  "build": "vite build && tailwindcss -i src/styles.css -o dist/styles.css --minify",
236
268
  "lint": "eslint src .storybook vite.config.ts --max-warnings=0",
237
269
  "lint:fix": "eslint src .storybook vite.config.ts --fix",
238
270
  "format": "prettier src .storybook scripts type-tests README.md CHANGELOG.md postcss.config.cjs tailwind.config.cjs tsconfig*.json vite.config.ts package.json --write",
239
271
  "format:check": "prettier src .storybook scripts type-tests README.md CHANGELOG.md postcss.config.cjs tailwind.config.cjs tsconfig*.json vite.config.ts package.json --check",
240
272
  "storybook": "storybook dev -p 6006 --host 127.0.0.1",
241
- "storybook:build": "storybook build",
273
+ "storybook:build": "node --max-old-space-size=8192 ./node_modules/storybook/dist/bin/dispatcher.js build",
242
274
  "typecheck": "tsc --noEmit",
243
275
  "test:hover": "node scripts/check-hover.mjs",
244
276
  "test:states": "node scripts/check-states.mjs",
@@ -247,6 +279,12 @@
247
279
  "pack:check": "node scripts/check-tarball.mjs",
248
280
  "typecheck:package": "tsc -p tsconfig.package-test.json",
249
281
  "test:notifications": "node scripts/check-notifications-browser.mjs",
250
- "test:compatibility": "node scripts/check-compatibility.mjs"
282
+ "test:compatibility": "node scripts/check-compatibility.mjs",
283
+ "test:animation": "node scripts/check-animation.mjs",
284
+ "test:animation:browser": "node scripts/check-animation-browser.mjs",
285
+ "test:progress-bar": "node scripts/check-progress-bar.mjs",
286
+ "test:progress-bar:browser": "node scripts/check-progress-bar-browser.mjs",
287
+ "test:tabs:browser": "node scripts/check-tabs-browser.mjs",
288
+ "test:tabs": "node scripts/check-tabs.mjs"
251
289
  }
252
290
  }