@mijn-ui/react-dropdown-menu 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,41 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { UnstyledProps } from '@mijn-ui/react-utilities/shared';
4
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
5
+
6
+ declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
7
+ declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
8
+ declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
9
+ declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
10
+ type DropdownMenuProps = DropdownMenuPrimitive.DropdownMenuProps & UnstyledProps;
11
+ declare const DropdownMenu: ({ unstyled, ...props }: DropdownMenuProps) => react_jsx_runtime.JSX.Element;
12
+ type DropdownTriggerProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Trigger> & UnstyledProps;
13
+ declare const DropdownMenuTrigger: ({ unstyled, className, ...props }: DropdownTriggerProps) => react_jsx_runtime.JSX.Element;
14
+ type DropdownMenuSubTriggerProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.SubTrigger> & UnstyledProps & {
15
+ inset?: boolean;
16
+ };
17
+ declare const DropdownMenuSubTrigger: ({ unstyled, className, inset, children, ...props }: DropdownMenuSubTriggerProps) => react_jsx_runtime.JSX.Element;
18
+ type DropdownMenuSubContentProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.SubContent> & UnstyledProps;
19
+ declare const DropdownMenuSubContent: ({ unstyled, className, ...props }: DropdownMenuSubContentProps) => react_jsx_runtime.JSX.Element;
20
+ type DropdownMenuContentProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Content> & UnstyledProps;
21
+ declare const DropdownMenuContent: ({ className, unstyled, sideOffset, ...props }: DropdownMenuContentProps) => react_jsx_runtime.JSX.Element;
22
+ type DropdownMenuItemProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Item> & {
23
+ inset?: boolean;
24
+ } & UnstyledProps;
25
+ declare const DropdownMenuItem: ({ unstyled, className, inset, ...props }: DropdownMenuItemProps) => react_jsx_runtime.JSX.Element;
26
+ type DropdownMenuCheckboxItemProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.CheckboxItem> & UnstyledProps;
27
+ declare const DropdownMenuCheckboxItem: ({ className, unstyled, children, checked, ...props }: DropdownMenuCheckboxItemProps) => react_jsx_runtime.JSX.Element;
28
+ type DropdownMenuRadioItemProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.RadioItem> & UnstyledProps;
29
+ declare const DropdownMenuRadioItem: ({ className, unstyled, children, ...props }: DropdownMenuRadioItemProps) => react_jsx_runtime.JSX.Element;
30
+ type DropdownMenuLabelProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Label> & {
31
+ inset?: boolean;
32
+ } & UnstyledProps;
33
+ declare const DropdownMenuLabel: ({ className, unstyled, inset, ...props }: DropdownMenuLabelProps) => react_jsx_runtime.JSX.Element;
34
+ type DropdownMenuSeparatorProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Separator> & UnstyledProps;
35
+ declare const DropdownMenuSeparator: ({ className, unstyled, ...props }: DropdownMenuSeparatorProps) => react_jsx_runtime.JSX.Element;
36
+ declare const DropdownMenuShortcut: {
37
+ ({ className, unstyled, ...props }: React.HTMLAttributes<HTMLSpanElement> & UnstyledProps): react_jsx_runtime.JSX.Element;
38
+ displayName: string;
39
+ };
40
+
41
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
package/dist/index.js ADDED
@@ -0,0 +1,274 @@
1
+ "use client"
2
+
3
+ // src/dropdown-menu.tsx
4
+ import { buttonStyles } from "@mijn-ui/react-button";
5
+ import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
6
+ import {
7
+ applyUnstyled,
8
+ cn
9
+ } from "@mijn-ui/react-utilities/shared";
10
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
11
+ import { LuCheck, LuChevronRight, LuCircle } from "react-icons/lu";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
14
+ var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
15
+ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
16
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
17
+ var DropdownMenu = ({ unstyled = false, ...props }) => {
18
+ return /* @__PURE__ */ jsx(UnstyledProvider, { unstyled, children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { ...props }) });
19
+ };
20
+ var DropdownMenuTrigger = ({
21
+ unstyled,
22
+ className,
23
+ ...props
24
+ }) => {
25
+ const { unstyled: contextUnstyled } = useUnstyled();
26
+ const isUnstyled = unstyled ?? contextUnstyled;
27
+ return /* @__PURE__ */ jsx(
28
+ DropdownMenuPrimitive.Trigger,
29
+ {
30
+ className: applyUnstyled(
31
+ isUnstyled,
32
+ buttonStyles({ color: "secondary" }),
33
+ className
34
+ ),
35
+ ...props
36
+ }
37
+ );
38
+ };
39
+ var DropdownMenuSubTrigger = ({
40
+ unstyled,
41
+ className,
42
+ inset,
43
+ children,
44
+ ...props
45
+ }) => {
46
+ const { unstyled: contextUnstyled } = useUnstyled();
47
+ const isUnstyled = unstyled ?? contextUnstyled;
48
+ return /* @__PURE__ */ jsxs(
49
+ DropdownMenuPrimitive.SubTrigger,
50
+ {
51
+ className: cn(
52
+ applyUnstyled(
53
+ isUnstyled,
54
+ cn(
55
+ "focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
56
+ inset && "pl-8"
57
+ ),
58
+ className
59
+ )
60
+ ),
61
+ ...props,
62
+ children: [
63
+ children,
64
+ /* @__PURE__ */ jsx(LuChevronRight, { className: "ml-auto" })
65
+ ]
66
+ }
67
+ );
68
+ };
69
+ var DropdownMenuSubContent = ({
70
+ unstyled,
71
+ className,
72
+ ...props
73
+ }) => {
74
+ const { unstyled: contextUnstyled } = useUnstyled();
75
+ const isUnstyled = unstyled ?? contextUnstyled;
76
+ return /* @__PURE__ */ jsx(
77
+ DropdownMenuPrimitive.SubContent,
78
+ {
79
+ className: applyUnstyled(
80
+ isUnstyled,
81
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-surface p-1 text-surface-text shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
82
+ className
83
+ ),
84
+ ...props
85
+ }
86
+ );
87
+ };
88
+ var DropdownMenuContent = ({
89
+ className,
90
+ unstyled,
91
+ sideOffset = 4,
92
+ ...props
93
+ }) => {
94
+ const { unstyled: contextUnstyled } = useUnstyled();
95
+ const isUnstyled = unstyled ?? contextUnstyled;
96
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
97
+ DropdownMenuPrimitive.Content,
98
+ {
99
+ sideOffset,
100
+ className: applyUnstyled(
101
+ isUnstyled,
102
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-surface p-1 text-surface-text shadow-md !duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-bottom-6 data-[side=left]:slide-in-from-left-6 data-[side=right]:slide-in-from-right-6 data-[side=top]:slide-in-from-top-6",
103
+ className
104
+ ),
105
+ ...props
106
+ }
107
+ ) });
108
+ };
109
+ var DropdownMenuItem = ({
110
+ unstyled,
111
+ className,
112
+ inset,
113
+ ...props
114
+ }) => {
115
+ const { unstyled: contextUnstyled } = useUnstyled();
116
+ const isUnstyled = unstyled ?? contextUnstyled;
117
+ return /* @__PURE__ */ jsx(
118
+ DropdownMenuPrimitive.Item,
119
+ {
120
+ className: applyUnstyled(
121
+ isUnstyled,
122
+ cn(
123
+ "focus:bg-accent focus:text-accent-text relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
124
+ inset && "pl-8"
125
+ ),
126
+ className
127
+ ),
128
+ ...props
129
+ }
130
+ );
131
+ };
132
+ var DropdownMenuCheckboxItem = ({
133
+ className,
134
+ unstyled,
135
+ children,
136
+ checked,
137
+ ...props
138
+ }) => {
139
+ const { unstyled: contextUnstyled } = useUnstyled();
140
+ const isUnstyled = unstyled ?? contextUnstyled;
141
+ return /* @__PURE__ */ jsxs(
142
+ DropdownMenuPrimitive.CheckboxItem,
143
+ {
144
+ className: applyUnstyled(
145
+ isUnstyled,
146
+ "relative flex cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
147
+ className
148
+ ),
149
+ checked,
150
+ ...props,
151
+ children: [
152
+ /* @__PURE__ */ jsx(
153
+ "span",
154
+ {
155
+ className: applyUnstyled(
156
+ isUnstyled,
157
+ "absolute left-2 flex h-3.5 w-3.5 items-center justify-center"
158
+ ),
159
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(LuCheck, { className: "size-4" }) })
160
+ }
161
+ ),
162
+ children
163
+ ]
164
+ }
165
+ );
166
+ };
167
+ var DropdownMenuRadioItem = ({
168
+ className,
169
+ unstyled,
170
+ children,
171
+ ...props
172
+ }) => {
173
+ const { unstyled: contextUnstyled } = useUnstyled();
174
+ const isUnstyled = unstyled ?? contextUnstyled;
175
+ return /* @__PURE__ */ jsxs(
176
+ DropdownMenuPrimitive.RadioItem,
177
+ {
178
+ className: cn(
179
+ "focus:bg-accent focus:text-accent-text relative flex cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
180
+ className
181
+ ),
182
+ ...props,
183
+ children: [
184
+ /* @__PURE__ */ jsx(
185
+ "span",
186
+ {
187
+ className: applyUnstyled(
188
+ isUnstyled,
189
+ "absolute left-2 flex h-3.5 w-3.5 items-center justify-center"
190
+ ),
191
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(LuCircle, { className: "size-2 fill-current" }) })
192
+ }
193
+ ),
194
+ children
195
+ ]
196
+ }
197
+ );
198
+ };
199
+ var DropdownMenuLabel = ({
200
+ className,
201
+ unstyled,
202
+ inset,
203
+ ...props
204
+ }) => {
205
+ const { unstyled: contextUnstyled } = useUnstyled();
206
+ const isUnstyled = unstyled ?? contextUnstyled;
207
+ return /* @__PURE__ */ jsx(
208
+ DropdownMenuPrimitive.Label,
209
+ {
210
+ className: applyUnstyled(
211
+ isUnstyled,
212
+ cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8"),
213
+ className
214
+ ),
215
+ ...props
216
+ }
217
+ );
218
+ };
219
+ var DropdownMenuSeparator = ({
220
+ className,
221
+ unstyled,
222
+ ...props
223
+ }) => {
224
+ const { unstyled: contextUnstyled } = useUnstyled();
225
+ const isUnstyled = unstyled ?? contextUnstyled;
226
+ return /* @__PURE__ */ jsx(
227
+ DropdownMenuPrimitive.Separator,
228
+ {
229
+ className: applyUnstyled(
230
+ isUnstyled,
231
+ "-mx-1 my-1 h-px bg-neutral",
232
+ className
233
+ ),
234
+ ...props
235
+ }
236
+ );
237
+ };
238
+ var DropdownMenuShortcut = ({
239
+ className,
240
+ unstyled,
241
+ ...props
242
+ }) => {
243
+ const { unstyled: contextUnstyled } = useUnstyled();
244
+ const isUnstyled = unstyled ?? contextUnstyled;
245
+ return /* @__PURE__ */ jsx(
246
+ "span",
247
+ {
248
+ className: applyUnstyled(
249
+ isUnstyled,
250
+ "ml-auto text-xs tracking-widest opacity-60",
251
+ className
252
+ ),
253
+ ...props
254
+ }
255
+ );
256
+ };
257
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
258
+ export {
259
+ DropdownMenu,
260
+ DropdownMenuCheckboxItem,
261
+ DropdownMenuContent,
262
+ DropdownMenuGroup,
263
+ DropdownMenuItem,
264
+ DropdownMenuLabel,
265
+ DropdownMenuPortal,
266
+ DropdownMenuRadioGroup,
267
+ DropdownMenuRadioItem,
268
+ DropdownMenuSeparator,
269
+ DropdownMenuShortcut,
270
+ DropdownMenuSub,
271
+ DropdownMenuSubContent,
272
+ DropdownMenuSubTrigger,
273
+ DropdownMenuTrigger
274
+ };
@@ -0,0 +1 @@
1
+ {"inputs":{"src/dropdown-menu.tsx":{"bytes":12040,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-button","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@radix-ui/react-dropdown-menu","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":32,"imports":[{"path":"src/dropdown-menu.tsx","kind":"import-statement","original":"./dropdown-menu"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@mijn-ui/react-button","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@radix-ui/react-dropdown-menu","kind":"import-statement","external":true},{"path":"react-icons/lu","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["DropdownMenu","DropdownMenuCheckboxItem","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuLabel","DropdownMenuPortal","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSeparator","DropdownMenuShortcut","DropdownMenuSub","DropdownMenuSubContent","DropdownMenuSubTrigger","DropdownMenuTrigger"],"entryPoint":"src/index.ts","inputs":{"src/dropdown-menu.tsx":{"bytesInOutput":7802},"src/index.ts":{"bytesInOutput":0}},"bytes":8183}}}
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@mijn-ui/react-dropdown-menu",
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/dropdown-menu"
16
16
  },
17
17
  "bugs": {
18
18
  "url": "https://github.com/mijn-ui/mijn-ui-react/issues"
@@ -31,8 +31,8 @@
31
31
  "react-dom": "19.0.0-rc-b01722d5-20241114",
32
32
  "react-icons": "^5.3.0",
33
33
  "@radix-ui/react-dropdown-menu": "^2.1.2",
34
- "@mijn-ui/react-button": "0.0.3",
35
- "@mijn-ui/react-utilities": "0.0.3"
34
+ "@mijn-ui/react-button": "0.0.5",
35
+ "@mijn-ui/react-utilities": "0.0.4"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "19.0.0-rc-b01722d5-20241114",