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