@scaleflex/ui-tw 0.0.158 → 0.0.159
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/accordion/accordion.component.d.ts +2 -1
- package/accordion/accordion.component.js +22 -5
- package/accordion/accordion.constants.d.ts +3 -0
- package/accordion/accordion.constants.js +14 -0
- package/accordion/accordion.types.d.ts +12 -0
- package/accordion/accordion.types.js +1 -0
- package/accordion/index.d.ts +2 -0
- package/accordion/index.js +2 -1
- package/badge/badge.constants.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { ComponentProps } from 'react';
|
|
4
|
+
import { AccordionTriggerProps } from './accordion.types';
|
|
4
5
|
declare function Accordion({ ...props }: ComponentProps<typeof AccordionPrimitive.Root>): React.JSX.Element;
|
|
5
6
|
declare function AccordionItem({ className, ...props }: ComponentProps<typeof AccordionPrimitive.Item>): React.JSX.Element;
|
|
6
|
-
declare function AccordionTrigger({ className, children, ...props }:
|
|
7
|
+
declare function AccordionTrigger({ className, children, chevronPosition, chevronRotation, icon, hideChevron, style, ...props }: AccordionTriggerProps): React.JSX.Element;
|
|
7
8
|
declare function AccordionContent({ className, children, ...props }: ComponentProps<typeof AccordionPrimitive.Content>): React.JSX.Element;
|
|
8
9
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
3
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
5
|
var _excluded = ["className"],
|
|
5
|
-
_excluded2 = ["className", "children"],
|
|
6
|
+
_excluded2 = ["className", "children", "chevronPosition", "chevronRotation", "icon", "hideChevron", "style"],
|
|
6
7
|
_excluded3 = ["className", "children"];
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
10
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
11
|
+
import { accordionTriggerVariants } from '@scaleflex/ui-tw/accordion/accordion.constants';
|
|
8
12
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
9
13
|
import { ChevronDownIcon } from 'lucide-react';
|
|
10
14
|
import * as React from 'react';
|
|
@@ -25,15 +29,28 @@ function AccordionItem(_ref2) {
|
|
|
25
29
|
function AccordionTrigger(_ref3) {
|
|
26
30
|
var className = _ref3.className,
|
|
27
31
|
children = _ref3.children,
|
|
32
|
+
chevronPosition = _ref3.chevronPosition,
|
|
33
|
+
_ref3$chevronRotation = _ref3.chevronRotation,
|
|
34
|
+
chevronRotation = _ref3$chevronRotation === void 0 ? 180 : _ref3$chevronRotation,
|
|
35
|
+
icon = _ref3.icon,
|
|
36
|
+
_ref3$hideChevron = _ref3.hideChevron,
|
|
37
|
+
hideChevron = _ref3$hideChevron === void 0 ? false : _ref3$hideChevron,
|
|
38
|
+
style = _ref3.style,
|
|
28
39
|
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
29
40
|
return /*#__PURE__*/React.createElement(AccordionPrimitive.Header, {
|
|
30
41
|
className: "flex"
|
|
31
42
|
}, /*#__PURE__*/React.createElement(AccordionPrimitive.Trigger, _extends({
|
|
32
43
|
"data-slot": "accordion-trigger",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
style: _objectSpread(_defineProperty({}, '--accordion-chevron-rotation', "".concat(chevronRotation, "deg")), style),
|
|
45
|
+
className: cn(accordionTriggerVariants({
|
|
46
|
+
chevronPosition: chevronPosition
|
|
47
|
+
}), '[&[data-state=open]>[data-slot=accordion-chevron]]:rotate-(--accordion-chevron-rotation)', className)
|
|
48
|
+
}, props), children, !hideChevron && /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
"data-slot": "accordion-chevron",
|
|
50
|
+
className: "text-muted-foreground pointer-events-none shrink-0 translate-y-0.5 transition-transform duration-200"
|
|
51
|
+
}, icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
52
|
+
className: "size-4"
|
|
53
|
+
}))));
|
|
37
54
|
}
|
|
38
55
|
function AccordionContent(_ref4) {
|
|
39
56
|
var className = _ref4.className,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
export var accordionTriggerVariants = cva('focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 cursor-pointer items-start 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', {
|
|
3
|
+
variants: {
|
|
4
|
+
// Where the chevron sits relative to the label.
|
|
5
|
+
// `end` pushes it to the far right (default), `inline` keeps it right next to the label.
|
|
6
|
+
chevronPosition: {
|
|
7
|
+
end: 'justify-between gap-4',
|
|
8
|
+
inline: 'justify-start gap-2'
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
chevronPosition: 'end'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
4
|
+
import { accordionTriggerVariants } from './accordion.constants';
|
|
5
|
+
export type AccordionTriggerProps = ComponentProps<typeof AccordionPrimitive.Trigger> & VariantProps<typeof accordionTriggerVariants> & {
|
|
6
|
+
/** Custom indicator icon. Defaults to a chevron-down icon. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Rotation in degrees applied to the icon when the item is open. Defaults to 180. */
|
|
9
|
+
chevronRotation?: number;
|
|
10
|
+
/** Hide the indicator icon entirely. */
|
|
11
|
+
hideChevron?: boolean;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/accordion/index.d.ts
CHANGED
package/accordion/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './accordion.component';
|
|
1
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './accordion.component';
|
|
2
|
+
export { accordionTriggerVariants } from './accordion.constants';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const badgeVariants: (props?: ({
|
|
2
|
-
variant?: "
|
|
2
|
+
variant?: "green" | "yellow" | "neutral" | "greenSoft" | null | undefined;
|
|
3
3
|
size?: "md" | "lg" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.159",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@radix-ui/react-switch": "^1.0.1",
|
|
30
30
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
31
31
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
32
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
32
|
+
"@scaleflex/icons-tw": "^0.0.159",
|
|
33
33
|
"@tanstack/react-table": "^8.21.3",
|
|
34
34
|
"@types/lodash.merge": "^4.6.9",
|
|
35
35
|
"class-variance-authority": "^0.7.1",
|