@scaleflex/ui-tw 0.0.96 → 0.0.98

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.
@@ -30,7 +30,7 @@ import { cva } from 'class-variance-authority';
30
30
  import { Command as CommandPrimitive } from 'cmdk';
31
31
  import { useCommandState } from 'cmdk';
32
32
  import { CheckIcon, SearchIcon, UserCircle2Icon, XIcon } from 'lucide-react';
33
- import React from 'react';
33
+ import React, { useEffect, useRef } from 'react';
34
34
  import { useCallback } from 'react';
35
35
  import { selectCommandHeadingOptions } from './command.utils';
36
36
  function Command(_ref) {
@@ -133,7 +133,25 @@ function CommandClear(_ref4) {
133
133
  function CommandList(_ref5) {
134
134
  var className = _ref5.className,
135
135
  props = _objectWithoutProperties(_ref5, _excluded5);
136
+ var listRef = useRef(null);
137
+ useEffect(function () {
138
+ var listNode = listRef.current;
139
+ if (!listNode) return;
140
+ var observer = new MutationObserver(function () {
141
+ listNode.scrollTo({
142
+ top: 0
143
+ });
144
+ });
145
+ observer.observe(listNode, {
146
+ childList: true,
147
+ subtree: true
148
+ });
149
+ return function () {
150
+ return observer.disconnect();
151
+ };
152
+ }, []);
136
153
  return /*#__PURE__*/React.createElement(CommandPrimitive.List, _extends({
154
+ ref: listRef,
137
155
  "data-slot": "command-list",
138
156
  className: cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', className)
139
157
  }, props));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.96",
3
+ "version": "0.0.98",
4
4
  "author": "scaleflex",
5
5
  "repository": "github:scaleflex/ui",
6
6
  "homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
@@ -23,7 +23,7 @@
23
23
  "@radix-ui/react-slot": "^1.1.2",
24
24
  "@radix-ui/react-switch": "^1.0.1",
25
25
  "@radix-ui/react-tooltip": "^1.2.6",
26
- "@scaleflex/icons-tw": "^0.0.96",
26
+ "@scaleflex/icons-tw": "^0.0.98",
27
27
  "@tanstack/react-table": "^8.21.3",
28
28
  "@types/lodash.merge": "^4.6.9",
29
29
  "class-variance-authority": "^0.7.1",