@deepnoid/ui 0.1.85 → 0.1.86
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/.turbo/turbo-build.log +151 -151
- package/dist/{chunk-FKHKYVZH.mjs → chunk-VSURAISO.mjs} +40 -10
- package/dist/components/accordion/accordionItem.d.mts +2 -5
- package/dist/components/accordion/accordionItem.d.ts +2 -5
- package/dist/components/accordion/accordionItem.js +34 -4646
- package/dist/components/accordion/accordionItem.mjs +1 -4
- package/dist/components/accordion/index.d.mts +0 -3
- package/dist/components/accordion/index.d.ts +0 -3
- package/dist/components/accordion/index.js +33 -4647
- package/dist/components/accordion/index.mjs +1 -4
- package/dist/components/table/index.mjs +3 -3
- package/dist/index.js +778 -754
- package/dist/index.mjs +16 -16
- package/package.json +1 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
Icon_default
|
|
4
|
-
} from "./chunk-JP4TEWP7.mjs";
|
|
5
2
|
import {
|
|
6
3
|
mapPropsVariants
|
|
7
4
|
} from "./chunk-E3G5QXSH.mjs";
|
|
@@ -10,11 +7,29 @@ import {
|
|
|
10
7
|
} from "./chunk-CDXBML6O.mjs";
|
|
11
8
|
|
|
12
9
|
// src/components/accordion/accordionItem.tsx
|
|
13
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
forwardRef,
|
|
12
|
+
useCallback,
|
|
13
|
+
useMemo,
|
|
14
|
+
useRef,
|
|
15
|
+
useState,
|
|
16
|
+
useEffect,
|
|
17
|
+
isValidElement,
|
|
18
|
+
cloneElement
|
|
19
|
+
} from "react";
|
|
14
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
21
|
var AccordionItem = forwardRef((originalProps, ref) => {
|
|
16
22
|
const [props, variantProps] = mapPropsVariants(originalProps, accordionItem.variantKeys);
|
|
17
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
title,
|
|
25
|
+
children,
|
|
26
|
+
startContent,
|
|
27
|
+
endContent,
|
|
28
|
+
classNames,
|
|
29
|
+
isOpen = false,
|
|
30
|
+
onToggle,
|
|
31
|
+
disableAnimation
|
|
32
|
+
} = {
|
|
18
33
|
...props,
|
|
19
34
|
...variantProps
|
|
20
35
|
};
|
|
@@ -29,7 +44,22 @@ var AccordionItem = forwardRef((originalProps, ref) => {
|
|
|
29
44
|
setContentHeight(isOpen ? `${contentRef.current.scrollHeight}px` : "0px");
|
|
30
45
|
}
|
|
31
46
|
}, [isOpen]);
|
|
32
|
-
const
|
|
47
|
+
const handleToggle = useCallback(() => {
|
|
48
|
+
onToggle == null ? void 0 : onToggle();
|
|
49
|
+
}, [onToggle]);
|
|
50
|
+
const renderContent = (content) => {
|
|
51
|
+
const actualContent = typeof content === "function" ? content(isOpen) : content;
|
|
52
|
+
if (isValidElement(actualContent)) {
|
|
53
|
+
const _content = actualContent;
|
|
54
|
+
const existingProps = _content.props;
|
|
55
|
+
const mergedProps = {
|
|
56
|
+
className: `${slots.icon({ class: classNames == null ? void 0 : classNames.icon }) || ""} ${existingProps.className || ""}`.trim()
|
|
57
|
+
};
|
|
58
|
+
return cloneElement(actualContent, mergedProps);
|
|
59
|
+
} else {
|
|
60
|
+
return /* @__PURE__ */ jsx("div", { className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), children: actualContent });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
33
63
|
const getContentProps = useCallback(() => {
|
|
34
64
|
if (disableAnimation) {
|
|
35
65
|
return {
|
|
@@ -50,10 +80,10 @@ var AccordionItem = forwardRef((originalProps, ref) => {
|
|
|
50
80
|
};
|
|
51
81
|
}, [slots, classNames == null ? void 0 : classNames.content, contentHeight, isOpen, disableAnimation]);
|
|
52
82
|
return /* @__PURE__ */ jsxs("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
53
|
-
/* @__PURE__ */ jsxs("div", { "data-isOpen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }), onClick:
|
|
54
|
-
|
|
83
|
+
/* @__PURE__ */ jsxs("div", { "data-isOpen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }), onClick: handleToggle, children: [
|
|
84
|
+
startContent && renderContent(startContent),
|
|
55
85
|
/* @__PURE__ */ jsx("span", { className: slots.headerTitle({ class: classNames == null ? void 0 : classNames.headerTitle }), children: title }),
|
|
56
|
-
|
|
86
|
+
endContent && renderContent(endContent)
|
|
57
87
|
] }),
|
|
58
88
|
isOpen && /* @__PURE__ */ jsx("div", { ref: contentRef, ...getContentProps(), children })
|
|
59
89
|
] });
|
|
@@ -62,7 +92,7 @@ AccordionItem.displayName = "AccordionItem";
|
|
|
62
92
|
var accordionItem_default = AccordionItem;
|
|
63
93
|
var accordionItem = tv({
|
|
64
94
|
slots: {
|
|
65
|
-
base: ["group/accordion", "w-full", "flex", "flex-col", "gap-[12px]", "p-[12px]"],
|
|
95
|
+
base: ["group/accordion", "w-full", "flex", "flex-col", "gap-[12px]", "p-[12px]", "bg-body-background"],
|
|
66
96
|
header: [
|
|
67
97
|
"flex",
|
|
68
98
|
"justify-between",
|
|
@@ -3,15 +3,12 @@ import { VariantProps } from 'tailwind-variants';
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import { SlotsToClasses } from '../../utils/types.mjs';
|
|
6
|
-
import { IconName } from '../icon/Icon.mjs';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
|
-
import '../icon/template.mjs';
|
|
9
6
|
|
|
10
7
|
interface Props {
|
|
11
8
|
title?: string;
|
|
12
9
|
children?: ReactNode;
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
startContent?: ReactNode | ((isOpen: boolean) => ReactNode);
|
|
11
|
+
endContent?: ReactNode | ((isOpen: boolean) => ReactNode);
|
|
15
12
|
classNames?: SlotsToClasses<AccordionItemSlots>;
|
|
16
13
|
isOpen?: boolean;
|
|
17
14
|
onToggle?: () => void;
|
|
@@ -3,15 +3,12 @@ import { VariantProps } from 'tailwind-variants';
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import { SlotsToClasses } from '../../utils/types.js';
|
|
6
|
-
import { IconName } from '../icon/Icon.js';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
|
-
import '../icon/template.js';
|
|
9
6
|
|
|
10
7
|
interface Props {
|
|
11
8
|
title?: string;
|
|
12
9
|
children?: ReactNode;
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
startContent?: ReactNode | ((isOpen: boolean) => ReactNode);
|
|
11
|
+
endContent?: ReactNode | ((isOpen: boolean) => ReactNode);
|
|
15
12
|
classNames?: SlotsToClasses<AccordionItemSlots>;
|
|
16
13
|
isOpen?: boolean;
|
|
17
14
|
onToggle?: () => void;
|