@scaleflex/ui-tw 0.0.96 → 0.0.99
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,8 @@
|
|
|
1
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
declare function Accordion({ ...props }: ComponentProps<typeof AccordionPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare function AccordionItem({ className, ...props }: ComponentProps<typeof AccordionPrimitive.Item>): React.JSX.Element;
|
|
6
|
+
declare function AccordionTrigger({ className, children, ...props }: ComponentProps<typeof AccordionPrimitive.Trigger>): React.JSX.Element;
|
|
7
|
+
declare function AccordionContent({ className, children, ...props }: ComponentProps<typeof AccordionPrimitive.Content>): React.JSX.Element;
|
|
8
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
var _excluded = ["className"],
|
|
5
|
+
_excluded2 = ["className", "children"],
|
|
6
|
+
_excluded3 = ["className", "children"];
|
|
7
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
8
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
9
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
function Accordion(_ref) {
|
|
12
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
13
|
+
return /*#__PURE__*/React.createElement(AccordionPrimitive.Root, _extends({
|
|
14
|
+
"data-slot": "accordion"
|
|
15
|
+
}, props));
|
|
16
|
+
}
|
|
17
|
+
function AccordionItem(_ref2) {
|
|
18
|
+
var className = _ref2.className,
|
|
19
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement(AccordionPrimitive.Item, _extends({
|
|
21
|
+
"data-slot": "accordion-item",
|
|
22
|
+
className: cn('border-b-border border-b last:border-b-0', className)
|
|
23
|
+
}, props));
|
|
24
|
+
}
|
|
25
|
+
function AccordionTrigger(_ref3) {
|
|
26
|
+
var className = _ref3.className,
|
|
27
|
+
children = _ref3.children,
|
|
28
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
29
|
+
return /*#__PURE__*/React.createElement(AccordionPrimitive.Header, {
|
|
30
|
+
className: "flex"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(AccordionPrimitive.Trigger, _extends({
|
|
32
|
+
"data-slot": "accordion-trigger",
|
|
33
|
+
className: cn('focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className)
|
|
34
|
+
}, props), children, /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
35
|
+
className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
function AccordionContent(_ref4) {
|
|
39
|
+
var className = _ref4.className,
|
|
40
|
+
children = _ref4.children,
|
|
41
|
+
props = _objectWithoutProperties(_ref4, _excluded3);
|
|
42
|
+
return /*#__PURE__*/React.createElement(AccordionPrimitive.Content, _extends({
|
|
43
|
+
"data-slot": "accordion-content",
|
|
44
|
+
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
45
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: cn('pt-0 pb-4', className)
|
|
47
|
+
}, children));
|
|
48
|
+
}
|
|
49
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './accordion.component';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './accordion.component';
|
|
@@ -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.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"main": "lib/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@popperjs/core": "^2.6.0",
|
|
16
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
16
17
|
"@radix-ui/react-checkbox": "^1.3.2",
|
|
17
18
|
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
18
19
|
"@radix-ui/react-label": "^2.1.6",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
"@radix-ui/react-slot": "^1.1.2",
|
|
24
25
|
"@radix-ui/react-switch": "^1.0.1",
|
|
25
26
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
26
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
27
|
+
"@scaleflex/icons-tw": "^0.0.99",
|
|
27
28
|
"@tanstack/react-table": "^8.21.3",
|
|
28
29
|
"@types/lodash.merge": "^4.6.9",
|
|
29
30
|
"class-variance-authority": "^0.7.1",
|