@mijn-ui/react-dropdown-menu 0.0.11 → 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 CHANGED
@@ -1,14 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { UnstyledProps } from '@mijn-ui/react-core';
3
+ import { UnstyledProps, UnstyledComponentWithSlots } from '@mijn-ui/react-core';
4
4
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
5
+ import { DropdownMenuSlots } from '@mijn-ui/react-theme';
5
6
 
6
7
  declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
7
8
  declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
8
9
  declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
9
10
  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;
11
+ type DropdownMenuBaseProps = UnstyledComponentWithSlots<DropdownMenuSlots>;
12
+ type DropdownMenuProps = DropdownMenuPrimitive.DropdownMenuProps & DropdownMenuBaseProps;
13
+ declare const DropdownMenu: ({ classNames, unstyled, ...props }: DropdownMenuProps) => react_jsx_runtime.JSX.Element;
12
14
  type DropdownTriggerProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Trigger> & UnstyledProps;
13
15
  declare const DropdownMenuTrigger: ({ unstyled, className, ...props }: DropdownTriggerProps) => react_jsx_runtime.JSX.Element;
14
16
  type DropdownMenuSubTriggerProps = React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.SubTrigger> & UnstyledProps & {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  // src/dropdown-menu.tsx
4
- import { createContext } from "@mijn-ui/react-utilities";
4
+ import { cn, createContext } from "@mijn-ui/react-utilities";
5
5
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
6
6
  import { CheckIcon, ChevronRightIcon, CircleIcon } from "@mijn-ui/shared-icons";
7
7
  import { dropdownMenuStyles } from "@mijn-ui/react-theme";
@@ -18,22 +18,29 @@ var [DropdownProvider, useDropdownContext] = createContext({
18
18
  });
19
19
  var useDropdownStyles = (unstyledOverride) => {
20
20
  const context = useDropdownContext();
21
- return useTVUnstyled(context, unstyledOverride);
21
+ const unstyledSlots = useTVUnstyled(context, unstyledOverride);
22
+ return { ...unstyledSlots, classNames: context.classNames };
22
23
  };
23
- var DropdownMenu = ({ unstyled = false, ...props }) => {
24
+ var DropdownMenu = ({
25
+ classNames,
26
+ unstyled = false,
27
+ ...props
28
+ }) => {
24
29
  const styles = dropdownMenuStyles();
25
- return /* @__PURE__ */ jsx(DropdownProvider, { value: { unstyled, styles }, children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { ...props }) });
30
+ return /* @__PURE__ */ jsx(DropdownProvider, { value: { unstyled, styles, classNames }, children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { ...props }) });
26
31
  };
27
32
  var DropdownMenuTrigger = ({
28
33
  unstyled,
29
34
  className,
30
35
  ...props
31
36
  }) => {
32
- const { trigger } = useDropdownStyles(unstyled);
37
+ const { trigger, classNames } = useDropdownStyles(unstyled);
33
38
  return /* @__PURE__ */ jsx(
34
39
  DropdownMenuPrimitive.Trigger,
35
40
  {
36
- className: trigger({ className }),
41
+ className: trigger({
42
+ className: cn(classNames?.trigger, className)
43
+ }),
37
44
  ...props
38
45
  }
39
46
  );
@@ -45,15 +52,23 @@ var DropdownMenuSubTrigger = ({
45
52
  children,
46
53
  ...props
47
54
  }) => {
48
- const { subTrigger } = useDropdownStyles(unstyled);
55
+ const { subTrigger, subTriggerIcon, classNames } = useDropdownStyles(unstyled);
49
56
  return /* @__PURE__ */ jsxs(
50
57
  DropdownMenuPrimitive.SubTrigger,
51
58
  {
52
- className: subTrigger({ className, inset }),
59
+ className: subTrigger({
60
+ className: cn(classNames?.subTrigger, className),
61
+ inset
62
+ }),
53
63
  ...props,
54
64
  children: [
55
65
  children,
56
- /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })
66
+ /* @__PURE__ */ jsx(
67
+ ChevronRightIcon,
68
+ {
69
+ className: subTriggerIcon({ className: classNames?.subTriggerIcon })
70
+ }
71
+ )
57
72
  ]
58
73
  }
59
74
  );
@@ -63,11 +78,13 @@ var DropdownMenuSubContent = ({
63
78
  className,
64
79
  ...props
65
80
  }) => {
66
- const { subContent } = useDropdownStyles(unstyled);
81
+ const { subContent, classNames } = useDropdownStyles(unstyled);
67
82
  return /* @__PURE__ */ jsx(
68
83
  DropdownMenuPrimitive.SubContent,
69
84
  {
70
- className: subContent({ className }),
85
+ className: subContent({
86
+ className: cn(classNames?.subContent, className)
87
+ }),
71
88
  ...props
72
89
  }
73
90
  );
@@ -78,12 +95,14 @@ var DropdownMenuContent = ({
78
95
  sideOffset = 4,
79
96
  ...props
80
97
  }) => {
81
- const { content } = useDropdownStyles(unstyled);
98
+ const { content, classNames } = useDropdownStyles(unstyled);
82
99
  return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
83
100
  DropdownMenuPrimitive.Content,
84
101
  {
85
102
  sideOffset,
86
- className: content({ className }),
103
+ className: content({
104
+ className: cn(classNames?.content, className)
105
+ }),
87
106
  ...props
88
107
  }
89
108
  ) });
@@ -94,11 +113,14 @@ var DropdownMenuItem = ({
94
113
  inset,
95
114
  ...props
96
115
  }) => {
97
- const { item } = useDropdownStyles(unstyled);
116
+ const { item, classNames } = useDropdownStyles(unstyled);
98
117
  return /* @__PURE__ */ jsx(
99
118
  DropdownMenuPrimitive.Item,
100
119
  {
101
- className: item({ className, inset }),
120
+ className: item({
121
+ className: cn(classNames?.item, className),
122
+ inset
123
+ }),
102
124
  ...props
103
125
  }
104
126
  );
@@ -110,15 +132,37 @@ var DropdownMenuCheckboxItem = ({
110
132
  checked,
111
133
  ...props
112
134
  }) => {
113
- const { checkboxItem, checkboxItemIconWrapper, checkboxItemIcon } = useDropdownStyles(unstyled);
135
+ const {
136
+ checkboxItem,
137
+ checkboxItemIconWrapper,
138
+ checkboxItemIcon,
139
+ classNames
140
+ } = useDropdownStyles(unstyled);
114
141
  return /* @__PURE__ */ jsxs(
115
142
  DropdownMenuPrimitive.CheckboxItem,
116
143
  {
117
- className: checkboxItem({ className }),
144
+ className: checkboxItem({
145
+ className: cn(classNames?.checkboxItem, className)
146
+ }),
118
147
  checked,
119
148
  ...props,
120
149
  children: [
121
- /* @__PURE__ */ jsx("span", { className: checkboxItemIconWrapper(), children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: checkboxItemIcon() }) }) }),
150
+ /* @__PURE__ */ jsx(
151
+ "span",
152
+ {
153
+ className: checkboxItemIconWrapper({
154
+ className: classNames?.checkboxItemIconWrapper
155
+ }),
156
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(
157
+ CheckIcon,
158
+ {
159
+ className: checkboxItemIcon({
160
+ className: classNames?.checkboxItemIcon
161
+ })
162
+ }
163
+ ) })
164
+ }
165
+ ),
122
166
  children
123
167
  ]
124
168
  }
@@ -130,14 +174,31 @@ var DropdownMenuRadioItem = ({
130
174
  children,
131
175
  ...props
132
176
  }) => {
133
- const { radioItem, radioItemIconWrapper, radioItemIcon } = useDropdownStyles(unstyled);
177
+ const { radioItem, radioItemIconWrapper, radioItemIcon, classNames } = useDropdownStyles(unstyled);
134
178
  return /* @__PURE__ */ jsxs(
135
179
  DropdownMenuPrimitive.RadioItem,
136
180
  {
137
- className: radioItem({ className }),
181
+ className: radioItem({
182
+ className: cn(classNames?.radioItem, className)
183
+ }),
138
184
  ...props,
139
185
  children: [
140
- /* @__PURE__ */ jsx("span", { className: radioItemIconWrapper(), children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: radioItemIcon() }) }) }),
186
+ /* @__PURE__ */ jsx(
187
+ "span",
188
+ {
189
+ className: radioItemIconWrapper({
190
+ className: classNames?.radioItemIconWrapper
191
+ }),
192
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(
193
+ CircleIcon,
194
+ {
195
+ className: radioItemIcon({
196
+ className: classNames?.radioItemIcon
197
+ })
198
+ }
199
+ ) })
200
+ }
201
+ ),
141
202
  children
142
203
  ]
143
204
  }
@@ -149,11 +210,14 @@ var DropdownMenuLabel = ({
149
210
  inset,
150
211
  ...props
151
212
  }) => {
152
- const { label } = useDropdownStyles(unstyled);
213
+ const { label, classNames } = useDropdownStyles(unstyled);
153
214
  return /* @__PURE__ */ jsx(
154
215
  DropdownMenuPrimitive.Label,
155
216
  {
156
- className: label({ className, inset }),
217
+ className: label({
218
+ className: cn(classNames?.label, className),
219
+ inset
220
+ }),
157
221
  ...props
158
222
  }
159
223
  );
@@ -163,11 +227,13 @@ var DropdownMenuSeparator = ({
163
227
  unstyled,
164
228
  ...props
165
229
  }) => {
166
- const { separator } = useDropdownStyles(unstyled);
230
+ const { separator, classNames } = useDropdownStyles(unstyled);
167
231
  return /* @__PURE__ */ jsx(
168
232
  DropdownMenuPrimitive.Separator,
169
233
  {
170
- className: separator({ className }),
234
+ className: separator({
235
+ className: cn(classNames?.separator, className)
236
+ }),
171
237
  ...props
172
238
  }
173
239
  );
@@ -177,8 +243,16 @@ var DropdownMenuShortcut = ({
177
243
  unstyled,
178
244
  ...props
179
245
  }) => {
180
- const { shortcut } = useDropdownStyles(unstyled);
181
- return /* @__PURE__ */ jsx("span", { className: shortcut({ className }), ...props });
246
+ const { shortcut, classNames } = useDropdownStyles(unstyled);
247
+ return /* @__PURE__ */ jsx(
248
+ "span",
249
+ {
250
+ className: shortcut({
251
+ className: cn(classNames?.shortcut, className)
252
+ }),
253
+ ...props
254
+ }
255
+ );
182
256
  };
183
257
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
184
258
  export {
@@ -1 +1 @@
1
- {"inputs":{"src/dropdown-menu.tsx":{"bytes":9876,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@radix-ui/react-dropdown-menu","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","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-utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-dropdown-menu","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","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":4862},"src/index.ts":{"bytesInOutput":0}},"bytes":5243}}}
1
+ {"inputs":{"src/dropdown-menu.tsx":{"bytes":11264,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@radix-ui/react-dropdown-menu","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","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-utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-dropdown-menu","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","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":6363},"src/index.ts":{"bytesInOutput":0}},"bytes":6744}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mijn-ui/react-dropdown-menu",
3
3
  "author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -26,6 +26,7 @@
26
26
  "@types/react": "^19.0.0",
27
27
  "@types/react-dom": "^19.0.0",
28
28
  "@mijn-ui/react-core": "0.0.3",
29
+ "@mijn-ui/react-theme": "0.0.8",
29
30
  "eslint-config-custom": "0.0.1",
30
31
  "tsconfig": "0.0.0",
31
32
  "tsup-config": "0.0.0"
@@ -39,7 +40,7 @@
39
40
  "peerDependencies": {
40
41
  "react": "^19.0",
41
42
  "react-dom": "^19.0",
42
- "@mijn-ui/react-theme": "^0.0.6",
43
+ "@mijn-ui/react-theme": "^0.0.8",
43
44
  "@mijn-ui/react-core": "^0.0.3"
44
45
  },
45
46
  "publishConfig": {