@mijn-ui/react-command 0.0.11 → 0.0.13

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,13 +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';
4
- import { DialogProps } from '@radix-ui/react-dialog';
3
+ import { DialogProps } from '@mijn-ui/react-dialog';
4
+ import { UnstyledComponentWithSlots, CommandSlots, UnstyledProps } from '@mijn-ui/react-theme';
5
5
  import { Command as Command$1 } from 'cmdk';
6
6
 
7
- type CommandProps = React.ComponentPropsWithRef<typeof Command$1> & UnstyledProps;
8
- declare const Command: ({ unstyled, className, ...props }: CommandProps) => react_jsx_runtime.JSX.Element;
9
- type CommandDialogProps = DialogProps & UnstyledProps;
10
- declare const CommandDialog: ({ children, unstyled, ...props }: CommandDialogProps) => react_jsx_runtime.JSX.Element;
7
+ type CommandBaseProps = UnstyledComponentWithSlots<CommandSlots>;
8
+ type CommandProps = React.ComponentPropsWithRef<typeof Command$1> & CommandBaseProps;
9
+ declare const Command: ({ className, classNames, unstyled, ...props }: CommandProps) => react_jsx_runtime.JSX.Element;
10
+ type CommandDialogProps = Omit<DialogProps, "classNames"> & CommandBaseProps & {
11
+ className?: string;
12
+ };
13
+ declare const CommandDialog: ({ children, className, classNames, unstyled, ...props }: CommandDialogProps) => react_jsx_runtime.JSX.Element;
11
14
  type CommandInputProps = React.ComponentPropsWithRef<typeof Command$1.Input> & UnstyledProps;
12
15
  declare const CommandInput: ({ className, unstyled, ...props }: CommandInputProps) => react_jsx_runtime.JSX.Element;
13
16
  type CommandListProps = React.ComponentPropsWithRef<typeof Command$1.List> & UnstyledProps;
@@ -23,4 +26,4 @@ declare const CommandItem: ({ className, unstyled, ...props }: CommandItemProps)
23
26
  type CommandShortcutProps = React.HTMLAttributes<HTMLSpanElement> & UnstyledProps;
24
27
  declare const CommandShortcut: ({ className, unstyled, ...props }: CommandShortcutProps) => react_jsx_runtime.JSX.Element;
25
28
 
26
- export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
29
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, type CommandProps, CommandSeparator, CommandShortcut };
package/dist/index.js CHANGED
@@ -1,13 +1,16 @@
1
1
  "use client"
2
2
 
3
3
  // src/command.tsx
4
+ import { createTVUnstyledSlots } from "@mijn-ui/react-core";
4
5
  import { Dialog, DialogContent } from "@mijn-ui/react-dialog";
6
+ import { useTVUnstyled } from "@mijn-ui/react-hooks";
7
+ import {
8
+ cn,
9
+ commandStyles
10
+ } from "@mijn-ui/react-theme";
5
11
  import { createContext } from "@mijn-ui/react-utilities";
6
- import { applyUnstyled } from "@mijn-ui/react-core";
7
- import { Command as CommandPrimitive } from "cmdk";
8
12
  import { SearchIcon } from "@mijn-ui/shared-icons";
9
- import { commandStyles } from "@mijn-ui/react-theme";
10
- import { useTVUnstyled } from "@mijn-ui/react-hooks";
13
+ import { Command as CommandPrimitive } from "cmdk";
11
14
  import { jsx, jsxs } from "react/jsx-runtime";
12
15
  var [CommandProvider, useCommandContext] = createContext({
13
16
  name: "CommandContext",
@@ -16,83 +19,171 @@ var [CommandProvider, useCommandContext] = createContext({
16
19
  });
17
20
  var useCommandStyles = (unstyledOverride) => {
18
21
  const context = useCommandContext();
19
- return useTVUnstyled(context, unstyledOverride);
22
+ const unstyledSlots = useTVUnstyled(context, unstyledOverride);
23
+ return { ...unstyledSlots, classNames: context.classNames };
20
24
  };
21
- var Command = ({ unstyled = false, className, ...props }) => {
25
+ var Command = ({
26
+ className,
27
+ classNames,
28
+ unstyled = false,
29
+ ...props
30
+ }) => {
22
31
  const styles = commandStyles();
23
- return /* @__PURE__ */ jsx(CommandProvider, { value: { unstyled, styles }, children: /* @__PURE__ */ jsx(
32
+ const { command } = createTVUnstyledSlots(
33
+ { command: styles.command },
34
+ unstyled
35
+ );
36
+ return /* @__PURE__ */ jsx(CommandProvider, { value: { unstyled, styles, classNames }, children: /* @__PURE__ */ jsx(
24
37
  CommandPrimitive,
25
38
  {
26
- className: applyUnstyled(unstyled, styles.command({ className })),
39
+ className: command({ className: cn(classNames?.command, className) }),
27
40
  ...props
28
41
  }
29
42
  ) });
30
43
  };
31
44
  var CommandDialog = ({
32
45
  children,
46
+ className,
47
+ classNames,
33
48
  unstyled,
34
49
  ...props
35
50
  }) => {
36
51
  const styles = commandStyles();
37
- return /* @__PURE__ */ jsx(CommandProvider, { value: { unstyled, styles }, children: /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(
52
+ const { dialogContent, dialogCommand } = createTVUnstyledSlots(
53
+ {
54
+ dialogContent: styles.dialogContent,
55
+ dialogCommand: styles.dialogCommand
56
+ },
57
+ unstyled
58
+ );
59
+ return /* @__PURE__ */ jsx(CommandProvider, { value: { unstyled, styles, classNames }, children: /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(
38
60
  DialogContent,
39
61
  {
40
- className: applyUnstyled(unstyled, styles.dialogContent()),
41
- children: /* @__PURE__ */ jsx(Command, { className: applyUnstyled(unstyled, styles.dialogCommand()), children })
62
+ className: dialogContent({
63
+ className: cn(classNames?.dialogContent)
64
+ }),
65
+ children: /* @__PURE__ */ jsx(
66
+ Command,
67
+ {
68
+ className: dialogCommand({
69
+ className: cn(classNames?.dialogCommand, className)
70
+ }),
71
+ children
72
+ }
73
+ )
42
74
  }
43
75
  ) }) });
44
76
  };
45
77
  var CommandInput = ({ className, unstyled, ...props }) => {
46
- const { input, inputIcon, inputWrapper } = useCommandStyles(unstyled);
78
+ const { input, inputIcon, inputWrapper, classNames } = useCommandStyles(unstyled);
47
79
  return /* @__PURE__ */ jsxs(
48
80
  "div",
49
81
  {
50
- className: inputWrapper(),
82
+ className: inputWrapper({
83
+ className: classNames?.inputWrapper
84
+ }),
51
85
  "cmdk-input-wrapper": "",
52
86
  children: [
53
- /* @__PURE__ */ jsx(SearchIcon, { className: inputIcon() }),
54
- /* @__PURE__ */ jsx(CommandPrimitive.Input, { className: input({ className }), ...props })
87
+ /* @__PURE__ */ jsx(
88
+ SearchIcon,
89
+ {
90
+ className: inputIcon({
91
+ className: classNames?.inputIcon
92
+ })
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsx(
96
+ CommandPrimitive.Input,
97
+ {
98
+ className: input({
99
+ className: cn(classNames?.input, className)
100
+ }),
101
+ ...props
102
+ }
103
+ )
55
104
  ]
56
105
  }
57
106
  );
58
107
  };
59
108
  var CommandList = ({ className, unstyled, ...props }) => {
60
- const { list } = useCommandStyles(unstyled);
61
- return /* @__PURE__ */ jsx(CommandPrimitive.List, { className: list({ className }), ...props });
109
+ const { list, classNames } = useCommandStyles(unstyled);
110
+ return /* @__PURE__ */ jsx(
111
+ CommandPrimitive.List,
112
+ {
113
+ className: list({
114
+ className: cn(classNames?.list, className)
115
+ }),
116
+ ...props
117
+ }
118
+ );
62
119
  };
63
120
  var CommandEmpty = ({ unstyled, className, ...props }) => {
64
- const { empty } = useCommandStyles(unstyled);
65
- return /* @__PURE__ */ jsx(CommandPrimitive.Empty, { className: empty({ className }), ...props });
121
+ const { empty, classNames } = useCommandStyles(unstyled);
122
+ return /* @__PURE__ */ jsx(
123
+ CommandPrimitive.Empty,
124
+ {
125
+ className: empty({
126
+ className: cn(classNames?.empty, className)
127
+ }),
128
+ ...props
129
+ }
130
+ );
66
131
  };
67
132
  var CommandGroup = ({ className, unstyled, ...props }) => {
68
- const { group } = useCommandStyles(unstyled);
69
- return /* @__PURE__ */ jsx(CommandPrimitive.Group, { className: group({ className }), ...props });
133
+ const { group, classNames } = useCommandStyles(unstyled);
134
+ return /* @__PURE__ */ jsx(
135
+ CommandPrimitive.Group,
136
+ {
137
+ className: group({
138
+ className: cn(classNames?.group, className)
139
+ }),
140
+ ...props
141
+ }
142
+ );
70
143
  };
71
144
  var CommandSeparator = ({
72
145
  className,
73
146
  unstyled,
74
147
  ...props
75
148
  }) => {
76
- const { separator } = useCommandStyles(unstyled);
149
+ const { separator, classNames } = useCommandStyles(unstyled);
77
150
  return /* @__PURE__ */ jsx(
78
151
  CommandPrimitive.Separator,
79
152
  {
80
- className: separator({ className }),
153
+ className: separator({
154
+ className: cn(classNames?.separator, className)
155
+ }),
81
156
  ...props
82
157
  }
83
158
  );
84
159
  };
85
160
  var CommandItem = ({ className, unstyled, ...props }) => {
86
- const { item } = useCommandStyles(unstyled);
87
- return /* @__PURE__ */ jsx(CommandPrimitive.Item, { className: item({ className }), ...props });
161
+ const { item, classNames } = useCommandStyles(unstyled);
162
+ return /* @__PURE__ */ jsx(
163
+ CommandPrimitive.Item,
164
+ {
165
+ className: item({
166
+ className: cn(classNames?.item, className)
167
+ }),
168
+ ...props
169
+ }
170
+ );
88
171
  };
89
172
  var CommandShortcut = ({
90
173
  className,
91
174
  unstyled,
92
175
  ...props
93
176
  }) => {
94
- const { shortcut } = useCommandStyles(unstyled);
95
- return /* @__PURE__ */ jsx("span", { className: shortcut({ className }), ...props });
177
+ const { shortcut, classNames } = useCommandStyles(unstyled);
178
+ return /* @__PURE__ */ jsx(
179
+ "span",
180
+ {
181
+ className: shortcut({
182
+ className: cn(classNames?.shortcut, className)
183
+ }),
184
+ ...props
185
+ }
186
+ );
96
187
  };
97
188
  export {
98
189
  Command,
@@ -1 +1 @@
1
- {"inputs":{"src/command.tsx":{"bytes":7273,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-dialog","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-dialog","kind":"import-statement","external":true},{"path":"cmdk","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":26,"imports":[{"path":"src/command.tsx","kind":"import-statement","original":"./command"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@mijn-ui/react-dialog","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":"cmdk","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":["Command","CommandDialog","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","CommandSeparator","CommandShortcut"],"entryPoint":"src/index.ts","inputs":{"src/command.tsx":{"bytesInOutput":3386},"src/index.ts":{"bytesInOutput":0}},"bytes":3561}}}
1
+ {"inputs":{"src/command.tsx":{"bytes":8686,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@mijn-ui/react-dialog","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":"cmdk","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":26,"imports":[{"path":"src/command.tsx","kind":"import-statement","original":"./command"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@mijn-ui/react-dialog","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":"cmdk","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Command","CommandDialog","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","CommandSeparator","CommandShortcut"],"entryPoint":"src/index.ts","inputs":{"src/command.tsx":{"bytesInOutput":4764},"src/index.ts":{"bytesInOutput":0}},"bytes":4939}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mijn-ui/react-command",
3
3
  "author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -22,27 +22,28 @@
22
22
  "devDependencies": {
23
23
  "react": "19.0.0",
24
24
  "react-dom": "19.0.0",
25
+ "react-icons": "^5.3.0",
25
26
  "@next/eslint-plugin-next": "^15.0.3",
26
27
  "@types/react": "^19.0.0",
27
28
  "@types/react-dom": "^19.0.0",
28
- "@mijn-ui/react-core": "0.0.3",
29
+ "@mijn-ui/react-core": "0.0.4",
30
+ "@mijn-ui/react-theme": "0.0.9",
29
31
  "eslint-config-custom": "0.0.1",
30
32
  "tsconfig": "0.0.0",
31
33
  "tsup-config": "0.0.0"
32
34
  },
33
35
  "dependencies": {
34
- "@radix-ui/react-dialog": "^1.1.3",
35
36
  "cmdk": "^1.0.4",
36
- "@mijn-ui/react-dialog": "0.0.11",
37
- "@mijn-ui/shared-icons": "0.0.3",
38
- "@mijn-ui/react-utilities": "0.0.8",
39
- "@mijn-ui/react-hooks": "0.0.10"
37
+ "@mijn-ui/react-dialog": "0.0.13",
38
+ "@mijn-ui/shared-icons": "0.0.4",
39
+ "@mijn-ui/react-utilities": "0.0.9",
40
+ "@mijn-ui/react-hooks": "0.0.11"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "react": "^19.0",
43
44
  "react-dom": "^19.0",
44
- "@mijn-ui/react-theme": "^0.0.6",
45
- "@mijn-ui/react-core": "^0.0.3"
45
+ "@mijn-ui/react-theme": "^0.0.9",
46
+ "@mijn-ui/react-core": "^0.0.4"
46
47
  },
47
48
  "publishConfig": {
48
49
  "access": "public"