@mijn-ui/react-accordion 0.0.3 → 0.0.5

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,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import * as React from 'react';
4
+ import { VariantProps } from 'class-variance-authority';
5
+ import { UnstyledProps } from '@mijn-ui/react-utilities/shared';
6
+ import * as RadixAccordion from '@radix-ui/react-accordion';
7
+
8
+ declare const accordionStyles: (props?: ({
9
+ variant?: "default" | "surface" | "bordered" | null | undefined;
10
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
11
+ type AccordionProps = React.ComponentPropsWithRef<typeof RadixAccordion.Root> & VariantProps<typeof accordionStyles> & UnstyledProps;
12
+ declare const Accordion: ({ className, unstyled, variant, ...props }: AccordionProps) => react_jsx_runtime.JSX.Element;
13
+ type AccordionItemProps = React.ComponentPropsWithRef<typeof RadixAccordion.Item> & UnstyledProps;
14
+ declare const AccordionItem: ({ className, unstyled, ...props }: AccordionItemProps) => react_jsx_runtime.JSX.Element;
15
+ type AccordionTriggerProps = React.ComponentPropsWithRef<typeof RadixAccordion.Trigger> & UnstyledProps & {
16
+ icon?: React.ReactNode;
17
+ };
18
+ declare const AccordionTrigger: ({ className, icon, unstyled, children, ...props }: AccordionTriggerProps) => react_jsx_runtime.JSX.Element;
19
+ type AccordionContentProps = React.ComponentPropsWithRef<typeof RadixAccordion.Content> & UnstyledProps;
20
+ declare const AccordionContent: ({ className, unstyled, children, ...props }: AccordionContentProps) => react_jsx_runtime.JSX.Element;
21
+
22
+ export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, accordionStyles };
package/dist/index.js ADDED
@@ -0,0 +1,112 @@
1
+ "use client"
2
+
3
+ // src/accordion.tsx
4
+ import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
5
+ import { cva } from "class-variance-authority";
6
+ import { applyUnstyled } from "@mijn-ui/react-utilities/shared";
7
+ import * as RadixAccordion from "@radix-ui/react-accordion";
8
+ import { LuChevronDown } from "react-icons/lu";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var accordionStyles = cva("[&>div]:border-b-main-border [&>div]:border-b", {
11
+ variants: {
12
+ variant: {
13
+ default: "",
14
+ surface: "bg-surface rounded-xl px-4 pb-4 pt-2 shadow-sm",
15
+ bordered: "border-main-border rounded-xl border px-4 pb-4 pt-2"
16
+ }
17
+ },
18
+ defaultVariants: {
19
+ variant: "default"
20
+ }
21
+ });
22
+ var Accordion = ({
23
+ className,
24
+ unstyled = false,
25
+ variant,
26
+ ...props
27
+ }) => /* @__PURE__ */ jsx(UnstyledProvider, { unstyled, children: /* @__PURE__ */ jsx(
28
+ RadixAccordion.Root,
29
+ {
30
+ className: applyUnstyled(
31
+ unstyled,
32
+ accordionStyles({ variant }),
33
+ className
34
+ ),
35
+ ...props
36
+ }
37
+ ) });
38
+ var AccordionItem = ({
39
+ className,
40
+ unstyled,
41
+ ...props
42
+ }) => {
43
+ const { unstyled: contextUnstyled } = useUnstyled();
44
+ const isUnstyled = unstyled ?? contextUnstyled;
45
+ return /* @__PURE__ */ jsx(
46
+ RadixAccordion.Item,
47
+ {
48
+ className: applyUnstyled(isUnstyled, "w-full", className),
49
+ ...props
50
+ }
51
+ );
52
+ };
53
+ var AccordionTrigger = ({
54
+ className,
55
+ icon,
56
+ unstyled,
57
+ children,
58
+ ...props
59
+ }) => {
60
+ const { unstyled: contextUnstyled } = useUnstyled();
61
+ const isUnstyled = unstyled ?? contextUnstyled;
62
+ return /* @__PURE__ */ jsx(RadixAccordion.Header, { className: applyUnstyled(isUnstyled, "flex"), children: /* @__PURE__ */ jsxs(
63
+ RadixAccordion.Trigger,
64
+ {
65
+ className: applyUnstyled(
66
+ isUnstyled,
67
+ "group flex w-full items-center justify-between py-3",
68
+ className
69
+ ),
70
+ ...props,
71
+ children: [
72
+ children,
73
+ icon ? icon : /* @__PURE__ */ jsx(
74
+ LuChevronDown,
75
+ {
76
+ className: applyUnstyled(
77
+ isUnstyled,
78
+ "h-4 w-4 shrink-0 text-muted-text duration-400 ease-in-out group-data-[state=open]:rotate-180"
79
+ )
80
+ }
81
+ )
82
+ ]
83
+ }
84
+ ) });
85
+ };
86
+ var AccordionContent = ({
87
+ className,
88
+ unstyled,
89
+ children,
90
+ ...props
91
+ }) => {
92
+ const { unstyled: contextUnstyled } = useUnstyled();
93
+ const isUnstyled = unstyled ?? contextUnstyled;
94
+ return /* @__PURE__ */ jsx(
95
+ RadixAccordion.Content,
96
+ {
97
+ className: applyUnstyled(
98
+ isUnstyled,
99
+ "overflow-hidden text-sm transition-[height] data-[state=closed]:animate-accordion-close data-[state=open]:animate-accordion-open"
100
+ ),
101
+ ...props,
102
+ children: /* @__PURE__ */ jsx("div", { className: applyUnstyled(isUnstyled, "pb-3 pt-0", className), children })
103
+ }
104
+ );
105
+ };
106
+ export {
107
+ Accordion,
108
+ AccordionContent,
109
+ AccordionItem,
110
+ AccordionTrigger,
111
+ accordionStyles
112
+ };
@@ -0,0 +1 @@
1
+ {"inputs":{"src/accordion.tsx":{"bytes":4471,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"class-variance-authority","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@radix-ui/react-accordion","kind":"import-statement","external":true},{"path":"react-icons/lu","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-utilities/context","kind":"import-statement","external":true},{"path":"class-variance-authority","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@radix-ui/react-accordion","kind":"import-statement","external":true},{"path":"react-icons/lu","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Accordion","AccordionContent","AccordionItem","AccordionTrigger","accordionStyles"],"entryPoint":"src/index.ts","inputs":{"src/accordion.tsx":{"bytesInOutput":2786},"src/index.ts":{"bytesInOutput":0}},"bytes":2907}}}
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@mijn-ui/react-accordion",
3
3
  "author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "sideEffects": false,
9
9
  "files": [
10
- "dist/*"
10
+ "dist"
11
11
  ],
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/mijn-ui/mijn-ui-react.git",
15
- "directory": "packages/components/src"
15
+ "directory": "packages/components/accordion"
16
16
  },
17
17
  "bugs": {
18
18
  "url": "https://github.com/mijn-ui/mijn-ui-react/issues"
@@ -32,11 +32,11 @@
32
32
  "react": "19.0.0-rc-b01722d5-20241114",
33
33
  "react-dom": "19.0.0-rc-b01722d5-20241114",
34
34
  "react-icons": "^5.3.0",
35
- "@mijn-ui/react-utilities": "0.0.3"
35
+ "@mijn-ui/react-utilities": "0.0.5"
36
36
  },
37
37
  "peerDependencies": {
38
- "react": "19.0.0-rc-b01722d5-20241114",
39
- "react-dom": "19.0.0-rc-b01722d5-20241114"
38
+ "react": "^19.0",
39
+ "react-dom": "^19.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"