@mijn-ui/react-accordion 0.0.10 → 0.0.12
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/dist/index.d.ts +32 -10
- package/dist/index.js +60 -18
- package/dist/metafile-esm.json +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
4
|
+
import * as _mijn_ui_react_theme from '@mijn-ui/react-theme';
|
|
5
|
+
import { AccordionVariantProps, UnstyledProps, UnstyledComponentWithSlots, AccordionSlots } from '@mijn-ui/react-theme';
|
|
2
6
|
import * as React from 'react';
|
|
3
|
-
import { UnstyledProps } from '@mijn-ui/react-core';
|
|
4
7
|
import * as RadixAccordion from '@radix-ui/react-accordion';
|
|
5
|
-
import { AccordionVariantProps, accordionStyles } from '@mijn-ui/react-theme';
|
|
6
|
-
export { accordionStyles } from '@mijn-ui/react-theme';
|
|
7
8
|
|
|
8
|
-
type
|
|
9
|
-
|
|
9
|
+
type AccordionBaseProps = UnstyledComponentWithSlots<AccordionSlots>;
|
|
10
|
+
declare const useAccordionStyles: (unstyledOverride?: boolean) => {
|
|
11
|
+
classNames: _mijn_ui_react_theme.SlotsToClasses<"base" | "item" | "triggerWrapper" | "trigger" | "icon" | "contentWrapper" | "content"> | undefined;
|
|
12
|
+
isUnstyled: boolean | undefined;
|
|
13
|
+
base: (slotProps?: ({
|
|
14
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
15
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
16
|
+
item: (slotProps?: ({
|
|
17
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
18
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
19
|
+
triggerWrapper: (slotProps?: ({
|
|
20
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
21
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
22
|
+
trigger: (slotProps?: ({
|
|
23
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
24
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
25
|
+
icon: (slotProps?: ({
|
|
26
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
27
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
28
|
+
contentWrapper: (slotProps?: ({
|
|
29
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
30
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
31
|
+
content: (slotProps?: ({
|
|
32
|
+
variant?: "default" | "filled" | "outlined" | undefined;
|
|
33
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
10
34
|
};
|
|
11
|
-
|
|
12
|
-
declare const
|
|
13
|
-
type AccordionProps = React.ComponentPropsWithRef<typeof RadixAccordion.Root> & AccordionVariantProps & UnstyledProps;
|
|
14
|
-
declare const Accordion: ({ className, unstyled, variant, ...props }: AccordionProps) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
type AccordionProps = React.ComponentPropsWithRef<typeof RadixAccordion.Root> & AccordionVariantProps & AccordionBaseProps;
|
|
36
|
+
declare const Accordion: ({ className, classNames, unstyled, variant, ...props }: AccordionProps) => react_jsx_runtime.JSX.Element;
|
|
15
37
|
type AccordionItemProps = React.ComponentPropsWithRef<typeof RadixAccordion.Item> & UnstyledProps;
|
|
16
38
|
declare const AccordionItem: ({ className, unstyled, ...props }: AccordionItemProps) => react_jsx_runtime.JSX.Element;
|
|
17
39
|
type AccordionTriggerProps = React.ComponentPropsWithRef<typeof RadixAccordion.Trigger> & UnstyledProps & {
|
|
@@ -21,4 +43,4 @@ declare const AccordionTrigger: ({ className, icon, unstyled, children, ...props
|
|
|
21
43
|
type AccordionContentProps = React.ComponentPropsWithRef<typeof RadixAccordion.Content> & UnstyledProps;
|
|
22
44
|
declare const AccordionContent: ({ className, unstyled, children, ...props }: AccordionContentProps) => react_jsx_runtime.JSX.Element;
|
|
23
45
|
|
|
24
|
-
export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps,
|
|
46
|
+
export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, useAccordionStyles };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
// src/accordion.tsx
|
|
4
|
-
import {
|
|
4
|
+
import { createTVUnstyledSlots } from "@mijn-ui/react-core";
|
|
5
|
+
import { useTVUnstyled } from "@mijn-ui/react-hooks";
|
|
6
|
+
import {
|
|
7
|
+
accordionStyles,
|
|
8
|
+
cn
|
|
9
|
+
} from "@mijn-ui/react-theme";
|
|
5
10
|
import { createContext } from "@mijn-ui/react-utilities";
|
|
6
|
-
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
7
11
|
import { ChevronDownIcon } from "@mijn-ui/shared-icons";
|
|
8
|
-
import
|
|
9
|
-
import { useTVUnstyled } from "@mijn-ui/react-hooks";
|
|
12
|
+
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
10
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
14
|
var [AccordionProvider, useAccordionContext] = createContext({
|
|
12
15
|
name: "AccordionContext",
|
|
@@ -15,19 +18,22 @@ var [AccordionProvider, useAccordionContext] = createContext({
|
|
|
15
18
|
});
|
|
16
19
|
var useAccordionStyles = (unstyledOverride) => {
|
|
17
20
|
const context = useAccordionContext();
|
|
18
|
-
|
|
21
|
+
const unstyledSlots = useTVUnstyled(context, unstyledOverride);
|
|
22
|
+
return { ...unstyledSlots, classNames: context.classNames };
|
|
19
23
|
};
|
|
20
24
|
var Accordion = ({
|
|
21
25
|
className,
|
|
26
|
+
classNames,
|
|
22
27
|
unstyled = false,
|
|
23
28
|
variant,
|
|
24
29
|
...props
|
|
25
30
|
}) => {
|
|
26
31
|
const styles = accordionStyles({ variant });
|
|
27
|
-
|
|
32
|
+
const { base } = createTVUnstyledSlots({ base: styles.base }, unstyled);
|
|
33
|
+
return /* @__PURE__ */ jsx(AccordionProvider, { value: { classNames, unstyled, styles }, children: /* @__PURE__ */ jsx(
|
|
28
34
|
RadixAccordion.Root,
|
|
29
35
|
{
|
|
30
|
-
className:
|
|
36
|
+
className: base({ className: cn(classNames?.base, className) }),
|
|
31
37
|
...props
|
|
32
38
|
}
|
|
33
39
|
) });
|
|
@@ -37,8 +43,14 @@ var AccordionItem = ({
|
|
|
37
43
|
unstyled,
|
|
38
44
|
...props
|
|
39
45
|
}) => {
|
|
40
|
-
const { item } = useAccordionStyles(unstyled);
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
46
|
+
const { item, classNames } = useAccordionStyles(unstyled);
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
RadixAccordion.Item,
|
|
49
|
+
{
|
|
50
|
+
className: item({ className: cn(classNames?.item, className) }),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
42
54
|
};
|
|
43
55
|
var AccordionTrigger = ({
|
|
44
56
|
className,
|
|
@@ -48,14 +60,33 @@ var AccordionTrigger = ({
|
|
|
48
60
|
...props
|
|
49
61
|
}) => {
|
|
50
62
|
const {
|
|
63
|
+
classNames,
|
|
51
64
|
triggerWrapper,
|
|
52
65
|
trigger,
|
|
53
66
|
icon: iconStyles
|
|
54
67
|
} = useAccordionStyles(unstyled);
|
|
55
|
-
return /* @__PURE__ */ jsx(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
RadixAccordion.Header,
|
|
70
|
+
{
|
|
71
|
+
className: triggerWrapper({ className: classNames?.triggerWrapper }),
|
|
72
|
+
children: /* @__PURE__ */ jsxs(
|
|
73
|
+
RadixAccordion.Trigger,
|
|
74
|
+
{
|
|
75
|
+
className: trigger({ className: cn(classNames?.trigger, className) }),
|
|
76
|
+
...props,
|
|
77
|
+
children: [
|
|
78
|
+
children,
|
|
79
|
+
icon ? icon : /* @__PURE__ */ jsx(
|
|
80
|
+
ChevronDownIcon,
|
|
81
|
+
{
|
|
82
|
+
className: iconStyles({ className: classNames?.icon })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
);
|
|
59
90
|
};
|
|
60
91
|
var AccordionContent = ({
|
|
61
92
|
className,
|
|
@@ -63,15 +94,26 @@ var AccordionContent = ({
|
|
|
63
94
|
children,
|
|
64
95
|
...props
|
|
65
96
|
}) => {
|
|
66
|
-
const { contentWrapper, content } = useAccordionStyles(unstyled);
|
|
67
|
-
return /* @__PURE__ */ jsx(
|
|
97
|
+
const { contentWrapper, content, classNames } = useAccordionStyles(unstyled);
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
RadixAccordion.Content,
|
|
100
|
+
{
|
|
101
|
+
className: contentWrapper({ className: classNames?.contentWrapper }),
|
|
102
|
+
...props,
|
|
103
|
+
children: /* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: content({ className: cn(classNames?.content, className) }),
|
|
107
|
+
children
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
);
|
|
68
112
|
};
|
|
69
113
|
export {
|
|
70
114
|
Accordion,
|
|
71
115
|
AccordionContent,
|
|
72
116
|
AccordionItem,
|
|
73
|
-
AccordionProvider,
|
|
74
117
|
AccordionTrigger,
|
|
75
|
-
|
|
76
|
-
useAccordionContext
|
|
118
|
+
useAccordionStyles
|
|
77
119
|
};
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/accordion.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"src/accordion.tsx":{"bytes":5478,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"@radix-ui/react-accordion","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":28,"imports":[{"path":"src/accordion.tsx","kind":"import-statement","original":"./accordion"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"@radix-ui/react-accordion","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Accordion","AccordionContent","AccordionItem","AccordionTrigger","useAccordionStyles"],"entryPoint":"src/index.ts","inputs":{"src/accordion.tsx":{"bytesInOutput":2935},"src/index.ts":{"bytesInOutput":0}},"bytes":3059}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mijn-ui/react-accordion",
|
|
3
3
|
"author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.12",
|
|
5
5
|
"homepage": "https://mijn-ui.vercel.app",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -25,20 +25,21 @@
|
|
|
25
25
|
"@types/react-dom": "^19.0.0",
|
|
26
26
|
"react": "19.0.0",
|
|
27
27
|
"react-dom": "19.0.0",
|
|
28
|
-
"@mijn-ui/react-core": "0.0.
|
|
28
|
+
"@mijn-ui/react-core": "0.0.4",
|
|
29
|
+
"@mijn-ui/react-theme": "0.0.9",
|
|
29
30
|
"eslint-config-custom": "0.0.1",
|
|
30
31
|
"tsconfig": "0.0.0",
|
|
31
32
|
"tsup-config": "0.0.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@radix-ui/react-accordion": "^1.2.2",
|
|
35
|
-
"@mijn-ui/shared-icons": "0.0.
|
|
36
|
-
"@mijn-ui/react-utilities": "0.0.
|
|
37
|
-
"@mijn-ui/react-hooks": "0.0.
|
|
36
|
+
"@mijn-ui/shared-icons": "0.0.4",
|
|
37
|
+
"@mijn-ui/react-utilities": "0.0.9",
|
|
38
|
+
"@mijn-ui/react-hooks": "0.0.11"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@mijn-ui/react-theme": "^0.0.
|
|
41
|
-
"@mijn-ui/react-core": "^0.0.
|
|
41
|
+
"@mijn-ui/react-theme": "^0.0.9",
|
|
42
|
+
"@mijn-ui/react-core": "^0.0.4",
|
|
42
43
|
"react": "^19.0",
|
|
43
44
|
"react-dom": "^19.0"
|
|
44
45
|
},
|