@kkkarsss/ui 1.4.7 → 1.4.9

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.
@@ -14,5 +14,5 @@ export const Block = ({ children, title, topAcc, filters, type = 'fill', maxWidt
14
14
  config: config.gentle,
15
15
  immediate: !animate,
16
16
  });
17
- return (_jsxs(animated.div, { className: jc('w-full flex flex-col', 'rounded-2xl', 'bg-background-accent', 'shadow-[0_0_8px_var(--shadow)]', 'scrollbar-none', 'overflow-hidden', typeMap[type]), style: { ...springs, maxWidth, maxHeight, minWidth, minHeight }, children: [_jsx("div", { className: jc('sticky', 'top-0', 'z-20', 'bg-background-accent', 'w-full', 'shrink-0'), children: _jsxs(Flex, { direction: 'column', children: [_jsxs(Flex, { justify: 'space-between', align: 'center', children: [title && (_jsxs(Flex, { gap: '4px', align: 'center', children: [onBack && (_jsx(Offset, { type: 'both', children: _jsx(IconAction, { icon: _jsx(CornerUpLeft, { size: 16, color: 'var(--accent)' }), onClick: onBack }) })), _jsx(Offset, { type: 'both', children: title })] })), _jsx("div", { className: 'mx-m', children: _jsx(Flex, { direction: 'column', children: _jsx(Flex, { align: 'center', gap: '4px', children: topAcc }) }) })] }), filters && _jsx("div", { className: 'mb-l', children: filters })] }) }), _jsx("div", { className: "flex-1 overflow-auto scrollbar-none", children: _jsx(Flex, { direction: 'column', type: 'fill', children: children }) })] }));
17
+ return (_jsxs(animated.div, { className: jc('w-full flex flex-col', 'rounded-2xl', 'bg-background-accent', 'shadow-[0_0_8px_var(--shadow)]', 'scrollbar-none', 'overflow-hidden', typeMap[type]), style: { ...springs, maxWidth, maxHeight, minWidth, minHeight }, children: [_jsx("div", { className: jc('sticky', 'top-0', 'z-20', 'bg-background-accent', 'w-full', 'shrink-0'), children: _jsxs(Flex, { direction: 'column', children: [_jsxs(Flex, { justify: 'space-between', align: 'center', children: [title && (_jsx(Offset, { type: 'both', children: _jsxs(Flex, { gap: '4px', align: 'center', children: [onBack && _jsx(IconAction, { icon: _jsx(CornerUpLeft, { size: 16, color: 'var(--accent)' }), onClick: onBack }), title] }) })), _jsx("div", { className: 'mx-m', children: _jsx(Flex, { direction: 'column', children: _jsx(Flex, { align: 'center', gap: '4px', children: topAcc }) }) })] }), filters && _jsx("div", { className: 'mb-l', children: filters })] }) }), _jsx("div", { className: "flex-1 overflow-auto scrollbar-none", children: _jsx(Flex, { direction: 'column', type: 'fill', children: children }) })] }));
18
18
  };
@@ -32,29 +32,37 @@ export const CalendarLike = ({ tasks, slots = DEFAULT_SLOTS, showCurrentTime = t
32
32
  const tasksBySlot = useMemo(() => groupTasksBySlot(tasksWithPosition), [tasksWithPosition]);
33
33
  useEffect(() => {
34
34
  if (showCurrentTime && autoScrollToCurrentTime && containerRef.current) {
35
- const now = new Date();
36
- const hours = now.getHours();
37
- const minutes = now.getMinutes();
38
- const totalMinutes = hours * 60 + minutes;
39
- // 15 минут = 20 пикселей (высота слота)
40
- const topOffset = totalMinutes * (20 / 15);
41
- // Находим ближайший скроллируемый родитель или используем окно
42
- const scrollParent = (node) => {
43
- if (!node)
44
- return null;
45
- const style = window.getComputedStyle(node);
46
- if (/(auto|scroll)/.test(style.overflow + style.overflowY))
47
- return node;
48
- return scrollParent(node.parentElement);
35
+ const scroll = () => {
36
+ if (!containerRef.current)
37
+ return;
38
+ const now = new Date();
39
+ const hours = now.getHours();
40
+ const minutes = now.getMinutes();
41
+ const totalMinutes = hours * 60 + minutes;
42
+ // 15 минут = 20 пикселей (высота слота)
43
+ const topOffset = totalMinutes * (20 / 15);
44
+ // Находим ближайший скроллируемый родитель или используем окно
45
+ const scrollParent = (node) => {
46
+ if (!node)
47
+ return null;
48
+ const style = window.getComputedStyle(node);
49
+ if (/(auto|scroll)/.test(style.overflow + style.overflowY))
50
+ return node;
51
+ return scrollParent(node.parentElement);
52
+ };
53
+ const parent = scrollParent(containerRef.current);
54
+ if (parent) {
55
+ const containerRect = containerRef.current.getBoundingClientRect();
56
+ const parentRect = parent.getBoundingClientRect();
57
+ const relativeTop = containerRect.top - parentRect.top + parent.scrollTop;
58
+ parent.scrollTo({
59
+ top: relativeTop + topOffset - parent.clientHeight / 2,
60
+ behavior: 'smooth',
61
+ });
62
+ }
49
63
  };
50
- const parent = scrollParent(containerRef.current);
51
- if (parent) {
52
- const containerTop = containerRef.current.getBoundingClientRect().top + parent.scrollTop;
53
- parent.scrollTo({
54
- top: containerTop + topOffset - parent.clientHeight / 2,
55
- behavior: 'smooth',
56
- });
57
- }
64
+ const timeoutId = setTimeout(scroll, 100);
65
+ return () => clearTimeout(timeoutId);
58
66
  }
59
67
  }, [showCurrentTime, autoScrollToCurrentTime]);
60
68
  const handleDragStart = (e, task) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kkkarsss/ui",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "UI Kit for kkkarsss projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",