@mijn-ui/react-select 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 +5 -4
- package/dist/index.js +84 -28
- package/dist/metafile-esm.json +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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-
|
|
3
|
+
import { UnstyledComponentWithSlots, SelectSlots, UnstyledProps } from '@mijn-ui/react-theme';
|
|
4
4
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
5
|
|
|
6
|
+
type SelectBaseProps = UnstyledComponentWithSlots<SelectSlots>;
|
|
6
7
|
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
8
|
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
8
|
-
type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root> &
|
|
9
|
-
declare const Select: ({ unstyled, ...props }: SelectProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root> & SelectBaseProps;
|
|
10
|
+
declare const Select: ({ classNames, unstyled, ...props }: SelectProps) => react_jsx_runtime.JSX.Element;
|
|
10
11
|
type SelectTriggerProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Trigger> & UnstyledProps;
|
|
11
12
|
declare const SelectTrigger: ({ unstyled, className, children, ...props }: SelectTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
12
13
|
type SelectScrollUpButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollUpButton> & UnstyledProps;
|
|
@@ -22,4 +23,4 @@ declare const SelectItem: ({ unstyled, className, children, ...props }: SelectIt
|
|
|
22
23
|
type SelectSeparatorProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Separator> & UnstyledProps;
|
|
23
24
|
declare const SelectSeparator: ({ unstyled, className, ...props }: SelectSeparatorProps) => react_jsx_runtime.JSX.Element;
|
|
24
25
|
|
|
25
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
|
|
26
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
// src/select.tsx
|
|
4
|
+
import { useTVUnstyled } from "@mijn-ui/react-hooks";
|
|
5
|
+
import {
|
|
6
|
+
cn,
|
|
7
|
+
selectStyles
|
|
8
|
+
} from "@mijn-ui/react-theme";
|
|
4
9
|
import { createContext } from "@mijn-ui/react-utilities";
|
|
5
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
6
10
|
import {
|
|
7
11
|
CheckIcon,
|
|
8
12
|
ChevronDownIcon,
|
|
9
13
|
ChevronUpIcon
|
|
10
14
|
} from "@mijn-ui/shared-icons";
|
|
11
|
-
import
|
|
12
|
-
import { useTVUnstyled } from "@mijn-ui/react-hooks";
|
|
15
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
13
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
17
|
var [SelectProvider, useSelectContext] = createContext({
|
|
15
18
|
name: "SelectContext",
|
|
@@ -18,13 +21,14 @@ var [SelectProvider, useSelectContext] = createContext({
|
|
|
18
21
|
});
|
|
19
22
|
var useSelectStyles = (unstyledOverride) => {
|
|
20
23
|
const context = useSelectContext();
|
|
21
|
-
|
|
24
|
+
const unstyledSlots = useTVUnstyled(context, unstyledOverride);
|
|
25
|
+
return { ...unstyledSlots, classNames: context.classNames };
|
|
22
26
|
};
|
|
23
27
|
var SelectGroup = SelectPrimitive.Group;
|
|
24
28
|
var SelectValue = SelectPrimitive.Value;
|
|
25
|
-
var Select = ({ unstyled = false, ...props }) => {
|
|
29
|
+
var Select = ({ classNames, unstyled = false, ...props }) => {
|
|
26
30
|
const styles = selectStyles();
|
|
27
|
-
return /* @__PURE__ */ jsx(SelectProvider, { value: { unstyled, styles }, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { ...props }) });
|
|
31
|
+
return /* @__PURE__ */ jsx(SelectProvider, { value: { unstyled, styles, classNames }, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { ...props }) });
|
|
28
32
|
};
|
|
29
33
|
var SelectTrigger = ({
|
|
30
34
|
unstyled,
|
|
@@ -32,24 +36,35 @@ var SelectTrigger = ({
|
|
|
32
36
|
children,
|
|
33
37
|
...props
|
|
34
38
|
}) => {
|
|
35
|
-
const { trigger } = useSelectStyles(unstyled);
|
|
36
|
-
return /* @__PURE__ */ jsxs(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const { trigger, classNames } = useSelectStyles(unstyled);
|
|
40
|
+
return /* @__PURE__ */ jsxs(
|
|
41
|
+
SelectPrimitive.Trigger,
|
|
42
|
+
{
|
|
43
|
+
className: trigger({
|
|
44
|
+
className: cn(classNames?.trigger, className)
|
|
45
|
+
}),
|
|
46
|
+
...props,
|
|
47
|
+
children: [
|
|
48
|
+
children,
|
|
49
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
40
53
|
};
|
|
41
54
|
var SelectScrollUpButton = ({
|
|
42
55
|
unstyled,
|
|
43
56
|
className,
|
|
44
57
|
...props
|
|
45
58
|
}) => {
|
|
46
|
-
const { scrollUpBtn } = useSelectStyles(unstyled);
|
|
59
|
+
const { scrollUpBtn, classNames } = useSelectStyles(unstyled);
|
|
47
60
|
return /* @__PURE__ */ jsx(
|
|
48
61
|
SelectPrimitive.ScrollUpButton,
|
|
49
62
|
{
|
|
50
|
-
className: scrollUpBtn({
|
|
63
|
+
className: scrollUpBtn({
|
|
64
|
+
className: cn(classNames?.scrollUpBtn, className)
|
|
65
|
+
}),
|
|
51
66
|
...props,
|
|
52
|
-
children: /* @__PURE__ */ jsx(ChevronUpIcon, {
|
|
67
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
53
68
|
}
|
|
54
69
|
);
|
|
55
70
|
};
|
|
@@ -58,11 +73,13 @@ var SelectScrollDownButton = ({
|
|
|
58
73
|
className,
|
|
59
74
|
...props
|
|
60
75
|
}) => {
|
|
61
|
-
const { scrollDownBtn } = useSelectStyles(unstyled);
|
|
76
|
+
const { scrollDownBtn, classNames } = useSelectStyles(unstyled);
|
|
62
77
|
return /* @__PURE__ */ jsx(
|
|
63
78
|
SelectPrimitive.ScrollDownButton,
|
|
64
79
|
{
|
|
65
|
-
className: scrollDownBtn({
|
|
80
|
+
className: scrollDownBtn({
|
|
81
|
+
className: cn(classNames?.scrollDownBtn, className)
|
|
82
|
+
}),
|
|
66
83
|
...props,
|
|
67
84
|
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
68
85
|
}
|
|
@@ -75,24 +92,44 @@ var SelectContent = ({
|
|
|
75
92
|
position = "popper",
|
|
76
93
|
...props
|
|
77
94
|
}) => {
|
|
78
|
-
const { content, viewport } = useSelectStyles(unstyled);
|
|
95
|
+
const { content, viewport, classNames } = useSelectStyles(unstyled);
|
|
79
96
|
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
80
97
|
SelectPrimitive.Content,
|
|
81
98
|
{
|
|
82
|
-
className: content({
|
|
99
|
+
className: content({
|
|
100
|
+
className: cn(classNames?.content, className),
|
|
101
|
+
position
|
|
102
|
+
}),
|
|
83
103
|
position,
|
|
84
104
|
...props,
|
|
85
105
|
children: [
|
|
86
106
|
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
SelectPrimitive.Viewport,
|
|
109
|
+
{
|
|
110
|
+
className: viewport({
|
|
111
|
+
className: classNames?.viewport,
|
|
112
|
+
position
|
|
113
|
+
}),
|
|
114
|
+
children
|
|
115
|
+
}
|
|
116
|
+
),
|
|
88
117
|
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
89
118
|
]
|
|
90
119
|
}
|
|
91
120
|
) });
|
|
92
121
|
};
|
|
93
122
|
var SelectLabel = ({ unstyled, className, ...props }) => {
|
|
94
|
-
const { label } = useSelectStyles(unstyled);
|
|
95
|
-
return /* @__PURE__ */ jsx(
|
|
123
|
+
const { label, classNames } = useSelectStyles(unstyled);
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
SelectPrimitive.Label,
|
|
126
|
+
{
|
|
127
|
+
className: label({
|
|
128
|
+
className: cn(classNames?.label, className)
|
|
129
|
+
}),
|
|
130
|
+
...props
|
|
131
|
+
}
|
|
132
|
+
);
|
|
96
133
|
};
|
|
97
134
|
var SelectItem = ({
|
|
98
135
|
unstyled,
|
|
@@ -100,22 +137,41 @@ var SelectItem = ({
|
|
|
100
137
|
children,
|
|
101
138
|
...props
|
|
102
139
|
}) => {
|
|
103
|
-
const { item, itemIndicator } = useSelectStyles(unstyled);
|
|
104
|
-
return /* @__PURE__ */ jsxs(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
140
|
+
const { item, itemIndicator, classNames } = useSelectStyles(unstyled);
|
|
141
|
+
return /* @__PURE__ */ jsxs(
|
|
142
|
+
SelectPrimitive.Item,
|
|
143
|
+
{
|
|
144
|
+
className: item({
|
|
145
|
+
className: cn(classNames?.item, className)
|
|
146
|
+
}),
|
|
147
|
+
...props,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }),
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
className: itemIndicator({
|
|
154
|
+
className: classNames?.itemIndicator
|
|
155
|
+
}),
|
|
156
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
);
|
|
108
162
|
};
|
|
109
163
|
var SelectSeparator = ({
|
|
110
164
|
unstyled,
|
|
111
165
|
className,
|
|
112
166
|
...props
|
|
113
167
|
}) => {
|
|
114
|
-
const { separator } = useSelectStyles(unstyled);
|
|
168
|
+
const { separator, classNames } = useSelectStyles(unstyled);
|
|
115
169
|
return /* @__PURE__ */ jsx(
|
|
116
170
|
SelectPrimitive.Separator,
|
|
117
171
|
{
|
|
118
|
-
className: separator({
|
|
172
|
+
className: separator({
|
|
173
|
+
className: cn(classNames?.separator, className)
|
|
174
|
+
}),
|
|
119
175
|
...props
|
|
120
176
|
}
|
|
121
177
|
);
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/select.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"src/select.tsx":{"bytes":8277,"imports":[{"path":"react","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":"@radix-ui/react-select","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":25,"imports":[{"path":"src/select.tsx","kind":"import-statement","original":"./select"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"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":"@radix-ui/react-select","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Select","SelectContent","SelectGroup","SelectItem","SelectLabel","SelectScrollDownButton","SelectScrollUpButton","SelectSeparator","SelectTrigger","SelectValue"],"entryPoint":"src/index.ts","inputs":{"src/select.tsx":{"bytesInOutput":4636},"src/index.ts":{"bytesInOutput":0}},"bytes":4837}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mijn-ui/react-select",
|
|
3
3
|
"author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.12",
|
|
5
5
|
"homepage": "https://mijn-ui.vercel.app",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -25,22 +25,23 @@
|
|
|
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.
|
|
28
|
+
"@mijn-ui/react-core": "0.0.4",
|
|
29
|
+
"@mijn-ui/react-theme": "0.0.9",
|
|
29
30
|
"eslint-config-custom": "0.0.1",
|
|
30
31
|
"tsconfig": "0.0.0",
|
|
31
32
|
"tsup-config": "0.0.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@radix-ui/react-select": "^2.1.3",
|
|
35
|
-
"@mijn-ui/shared-icons": "0.0.
|
|
36
|
-
"@mijn-ui/react-utilities": "0.0.
|
|
37
|
-
"@mijn-ui/react-hooks": "0.0.
|
|
36
|
+
"@mijn-ui/shared-icons": "0.0.4",
|
|
37
|
+
"@mijn-ui/react-utilities": "0.0.9",
|
|
38
|
+
"@mijn-ui/react-hooks": "0.0.11"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"react": "^19.0",
|
|
41
42
|
"react-dom": "^19.0",
|
|
42
|
-
"@mijn-ui/react-theme": "^0.0.
|
|
43
|
-
"@mijn-ui/react-core": "^0.0.
|
|
43
|
+
"@mijn-ui/react-theme": "^0.0.9",
|
|
44
|
+
"@mijn-ui/react-core": "^0.0.4"
|
|
44
45
|
},
|
|
45
46
|
"publishConfig": {
|
|
46
47
|
"access": "public"
|