@mijn-ui/react-select 0.0.2 → 0.0.4
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 +27 -0
- package/dist/index.js +198 -0
- package/dist/metafile-esm.json +1 -0
- package/package.json +6 -6
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 SelectPrimitive from '@radix-ui/react-select';
|
|
5
|
+
|
|
6
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root> & UnstyledProps;
|
|
9
|
+
declare const Select: ({ unstyled, ...props }: SelectProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
type SelectTriggerProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Trigger> & UnstyledProps & {
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
declare const SelectTrigger: ({ unstyled, className, children, ...props }: SelectTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
+
type SelectScrollUpButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollUpButton> & UnstyledProps;
|
|
15
|
+
declare const SelectScrollUpButton: ({ unstyled, className, ...props }: SelectScrollUpButtonProps) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
type SelectScrollDownButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollDownButton> & UnstyledProps;
|
|
17
|
+
declare const SelectScrollDownButton: ({ unstyled, className, ...props }: SelectScrollDownButtonProps) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
type SelectContentProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Content> & UnstyledProps;
|
|
19
|
+
declare const SelectContent: ({ unstyled, className, children, position, ...props }: SelectContentProps) => react_jsx_runtime.JSX.Element;
|
|
20
|
+
type SelectLabelProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Label> & UnstyledProps;
|
|
21
|
+
declare const SelectLabel: ({ unstyled, className, ...props }: SelectLabelProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
type SelectItemProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Item> & UnstyledProps;
|
|
23
|
+
declare const SelectItem: ({ unstyled, className, children, ...props }: SelectItemProps) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
type SelectSeparatorProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Separator> & UnstyledProps;
|
|
25
|
+
declare const SelectSeparator: ({ unstyled, className, ...props }: SelectSeparatorProps) => react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
// src/select.tsx
|
|
4
|
+
import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
|
|
5
|
+
import {
|
|
6
|
+
applyUnstyled,
|
|
7
|
+
cn
|
|
8
|
+
} from "@mijn-ui/react-utilities/shared";
|
|
9
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
10
|
+
import { LuCheck, LuChevronDown, LuChevronUp } from "react-icons/lu";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var SelectGroup = SelectPrimitive.Group;
|
|
13
|
+
var SelectValue = SelectPrimitive.Value;
|
|
14
|
+
var Select = ({ unstyled = false, ...props }) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(UnstyledProvider, { unstyled, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { ...props }) });
|
|
16
|
+
};
|
|
17
|
+
var SelectTrigger = ({
|
|
18
|
+
unstyled,
|
|
19
|
+
className,
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
24
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
SelectPrimitive.Trigger,
|
|
27
|
+
{
|
|
28
|
+
className: applyUnstyled(
|
|
29
|
+
isUnstyled,
|
|
30
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-main-border bg-surface px-3 py-2 text-sm placeholder:text-neutral-text focus:border-input-border focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 hover:bg-accent",
|
|
31
|
+
className
|
|
32
|
+
),
|
|
33
|
+
...props,
|
|
34
|
+
children: [
|
|
35
|
+
children,
|
|
36
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(LuChevronDown, { className: "size-4 opacity-50" }) })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
var SelectScrollUpButton = ({
|
|
42
|
+
unstyled,
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}) => {
|
|
46
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
47
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
SelectPrimitive.ScrollUpButton,
|
|
50
|
+
{
|
|
51
|
+
className: applyUnstyled(
|
|
52
|
+
isUnstyled,
|
|
53
|
+
"flex cursor-default items-center justify-center py-1",
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
...props,
|
|
57
|
+
children: /* @__PURE__ */ jsx(LuChevronUp, { className: "size-4" })
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
var SelectScrollDownButton = ({
|
|
62
|
+
unstyled,
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}) => {
|
|
66
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
67
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
SelectPrimitive.ScrollDownButton,
|
|
70
|
+
{
|
|
71
|
+
className: applyUnstyled(
|
|
72
|
+
isUnstyled,
|
|
73
|
+
"flex cursor-default items-center justify-center py-1",
|
|
74
|
+
className
|
|
75
|
+
),
|
|
76
|
+
...props,
|
|
77
|
+
children: /* @__PURE__ */ jsx(LuChevronDown, { className: "size-4" })
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
var SelectContent = ({
|
|
82
|
+
unstyled,
|
|
83
|
+
className,
|
|
84
|
+
children,
|
|
85
|
+
position = "popper",
|
|
86
|
+
...props
|
|
87
|
+
}) => {
|
|
88
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
89
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
90
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
91
|
+
SelectPrimitive.Content,
|
|
92
|
+
{
|
|
93
|
+
className: applyUnstyled(
|
|
94
|
+
isUnstyled,
|
|
95
|
+
cn(
|
|
96
|
+
"border-main-border bg-surface text-surface-text 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 relative z-50 max-h-96 min-w-32 overflow-hidden rounded-lg border shadow-md !duration-300",
|
|
97
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1"
|
|
98
|
+
),
|
|
99
|
+
className
|
|
100
|
+
),
|
|
101
|
+
position,
|
|
102
|
+
...props,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
SelectPrimitive.Viewport,
|
|
107
|
+
{
|
|
108
|
+
className: cn(
|
|
109
|
+
"p-1",
|
|
110
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
111
|
+
),
|
|
112
|
+
children
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) });
|
|
119
|
+
};
|
|
120
|
+
var SelectLabel = ({ unstyled, className, ...props }) => {
|
|
121
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
122
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
SelectPrimitive.Label,
|
|
125
|
+
{
|
|
126
|
+
className: applyUnstyled(
|
|
127
|
+
isUnstyled,
|
|
128
|
+
"py-1.5 pr-8 pl-2 text-sm font-semibold",
|
|
129
|
+
className
|
|
130
|
+
),
|
|
131
|
+
...props
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
var SelectItem = ({
|
|
136
|
+
unstyled,
|
|
137
|
+
className,
|
|
138
|
+
children,
|
|
139
|
+
...props
|
|
140
|
+
}) => {
|
|
141
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
142
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
143
|
+
return /* @__PURE__ */ jsxs(
|
|
144
|
+
SelectPrimitive.Item,
|
|
145
|
+
{
|
|
146
|
+
className: applyUnstyled(
|
|
147
|
+
isUnstyled,
|
|
148
|
+
"relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pr-8 pl-2 text-sm outline-none focus:bg-accent focus:text-accent-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[state=checked]:text-primary data-[state=checked]:bg-primary/10",
|
|
149
|
+
className
|
|
150
|
+
),
|
|
151
|
+
...props,
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
"span",
|
|
156
|
+
{
|
|
157
|
+
className: applyUnstyled(
|
|
158
|
+
isUnstyled,
|
|
159
|
+
"absolute right-2 flex h-3.5 w-3.5 items-center justify-center"
|
|
160
|
+
),
|
|
161
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(LuCheck, { className: "size-4" }) })
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
var SelectSeparator = ({
|
|
169
|
+
unstyled,
|
|
170
|
+
className,
|
|
171
|
+
...props
|
|
172
|
+
}) => {
|
|
173
|
+
const { unstyled: contextUnstyled } = useUnstyled();
|
|
174
|
+
const isUnstyled = unstyled ?? contextUnstyled;
|
|
175
|
+
return /* @__PURE__ */ jsx(
|
|
176
|
+
SelectPrimitive.Separator,
|
|
177
|
+
{
|
|
178
|
+
className: applyUnstyled(
|
|
179
|
+
isUnstyled,
|
|
180
|
+
"-mx-1 my-1 h-px bg-neutral",
|
|
181
|
+
className
|
|
182
|
+
),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
export {
|
|
188
|
+
Select,
|
|
189
|
+
SelectContent,
|
|
190
|
+
SelectGroup,
|
|
191
|
+
SelectItem,
|
|
192
|
+
SelectLabel,
|
|
193
|
+
SelectScrollDownButton,
|
|
194
|
+
SelectScrollUpButton,
|
|
195
|
+
SelectSeparator,
|
|
196
|
+
SelectTrigger,
|
|
197
|
+
SelectValue
|
|
198
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/select.tsx":{"bytes":8917,"imports":[{"path":"react","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-select","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":25,"imports":[{"path":"src/select.tsx","kind":"import-statement","original":"./select"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"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-select","kind":"import-statement","external":true},{"path":"react-icons/lu","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":5940},"src/index.ts":{"bytesInOutput":0}},"bytes":6141}}}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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.4",
|
|
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
|
-
"url": "git+https://github.com/mijn-ui/
|
|
14
|
+
"url": "git+https://github.com/mijn-ui/mijn-ui-react.git",
|
|
15
15
|
"directory": "packages/components/src"
|
|
16
16
|
},
|
|
17
17
|
"bugs": {
|
|
18
|
-
"url": "https://github.com/mijn-ui/
|
|
18
|
+
"url": "https://github.com/mijn-ui/mijn-ui-react/issues"
|
|
19
19
|
},
|
|
20
20
|
"exports": "./dist/index.js",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@next/eslint-plugin-next": "^15.0.3",
|
|
24
24
|
"@types/react": "^18.3.12",
|
|
25
25
|
"@types/react-dom": "^18.3.1",
|
|
26
|
-
"eslint-config-custom": "0.0.
|
|
26
|
+
"eslint-config-custom": "0.0.1",
|
|
27
27
|
"tsconfig": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-dom": "19.0.0-rc-b01722d5-20241114",
|
|
32
32
|
"react-icons": "^5.3.0",
|
|
33
33
|
"@radix-ui/react-select": "^2.1.2",
|
|
34
|
-
"@mijn-ui/react-utilities": "0.0.
|
|
34
|
+
"@mijn-ui/react-utilities": "0.0.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": "19.0.0-rc-b01722d5-20241114",
|