@mijn-ui/react-select 0.4.1 → 0.4.3
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.js +37 -24
- package/dist/metafile-esm.json +1 -1
- package/package.json +12 -8
package/dist/index.js
CHANGED
|
@@ -18,16 +18,15 @@ var selectStyles = tv({
|
|
|
18
18
|
slots: {
|
|
19
19
|
base: "",
|
|
20
20
|
trigger: [
|
|
21
|
-
"border-outline-default
|
|
22
|
-
|
|
21
|
+
"border-outline-default bg-bg-default-alt placeholder:text-fg-tertiary hover:bg-bg-secondary flex h-10 w-full items-center justify-between rounded-md border px-3 py-2 text-sm [&>span]:line-clamp-1 gap-4",
|
|
22
|
+
// Only the chevron is dimmed. An icon in the selected value (a status
|
|
23
|
+
// dot, a flag) keeps its colour, and any explicit `size-*` it carries;
|
|
24
|
+
// unsized icons still default to 16px.
|
|
25
|
+
"[&_svg:not([class*='size-'])]:size-4 [&_[data-slot=select-trigger-icon]]:opacity-50",
|
|
23
26
|
"disabled:pointer-events-none",
|
|
24
27
|
"disabled:opacity-50",
|
|
25
|
-
"focus-visible:
|
|
26
|
-
"focus-visible:ring-
|
|
27
|
-
"focus-visible:ring-outline-brand",
|
|
28
|
-
"focus-visible:ring-outline-brand",
|
|
29
|
-
"focus-visible:ring-offset-2",
|
|
30
|
-
"focus-visible:ring-offset-bg-default"
|
|
28
|
+
"focus-visible:mijn-focus-ring",
|
|
29
|
+
"focus-visible:ring-outline-brand"
|
|
31
30
|
],
|
|
32
31
|
scrollUpBtn: "",
|
|
33
32
|
scrollDownBtn: "",
|
|
@@ -35,7 +34,7 @@ var selectStyles = tv({
|
|
|
35
34
|
"data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
36
35
|
"data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
|
|
37
36
|
"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 duration-300",
|
|
38
|
-
"border-outline-default bg-bg-default-alt text-fg-default relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border shadow-sm
|
|
37
|
+
"border-outline-default bg-bg-default-alt text-fg-default relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border shadow-(--mijn-shadow-sm)"
|
|
39
38
|
],
|
|
40
39
|
viewport: "",
|
|
41
40
|
label: "py-1.5 pl-2 pr-8 text-sm font-semibold",
|
|
@@ -56,8 +55,12 @@ var selectStyles = tv({
|
|
|
56
55
|
variants: {
|
|
57
56
|
position: {
|
|
58
57
|
popper: {
|
|
59
|
-
|
|
60
|
-
viewport
|
|
58
|
+
// At least as wide as the trigger, wider for a long option, never
|
|
59
|
+
// past the viewport edge. (Radix sets both variables in popper mode.)
|
|
60
|
+
content: "min-w-(--radix-select-trigger-width) max-w-(--radix-select-content-available-width) data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
61
|
+
// No min-width here: the content already has the trigger's, and a
|
|
62
|
+
// second one inside its 1px border made the list 2px wider.
|
|
63
|
+
viewport: "h-[var(--radix-select-trigger-height)] w-full"
|
|
61
64
|
},
|
|
62
65
|
"item-aligned": {}
|
|
63
66
|
}
|
|
@@ -77,7 +80,7 @@ var SelectGroup = SelectPrimitive.Group;
|
|
|
77
80
|
var SelectValue = SelectPrimitive.Value;
|
|
78
81
|
var Select = ({ classNames, unstyled = false, ...props }) => {
|
|
79
82
|
const styles = selectStyles();
|
|
80
|
-
return /* @__PURE__ */ jsx(SelectProvider, { value: { unstyled, styles, classNames }, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { ...props }) });
|
|
83
|
+
return /* @__PURE__ */ jsx(SelectProvider, { value: { unstyled, styles, classNames }, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props }) });
|
|
81
84
|
};
|
|
82
85
|
var SelectTrigger = ({
|
|
83
86
|
hideIcon,
|
|
@@ -91,6 +94,7 @@ var SelectTrigger = ({
|
|
|
91
94
|
return /* @__PURE__ */ jsxs(
|
|
92
95
|
SelectPrimitive.Trigger,
|
|
93
96
|
{
|
|
97
|
+
"data-slot": "select-trigger",
|
|
94
98
|
className: trigger({
|
|
95
99
|
className: cn(classNames?.trigger, className)
|
|
96
100
|
}),
|
|
@@ -107,7 +111,15 @@ var SelectTriggerIcon = ({
|
|
|
107
111
|
asChild = true,
|
|
108
112
|
...props
|
|
109
113
|
}) => {
|
|
110
|
-
return /* @__PURE__ */ jsx(
|
|
114
|
+
return /* @__PURE__ */ jsx(
|
|
115
|
+
SelectPrimitive.Icon,
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "select-trigger-icon",
|
|
118
|
+
asChild,
|
|
119
|
+
...props,
|
|
120
|
+
children: children ? children : /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
121
|
+
}
|
|
122
|
+
);
|
|
111
123
|
};
|
|
112
124
|
var SelectScrollUpButton = ({
|
|
113
125
|
unstyled,
|
|
@@ -118,6 +130,7 @@ var SelectScrollUpButton = ({
|
|
|
118
130
|
return /* @__PURE__ */ jsx(
|
|
119
131
|
SelectPrimitive.ScrollUpButton,
|
|
120
132
|
{
|
|
133
|
+
"data-slot": "select-scroll-up-button",
|
|
121
134
|
className: scrollUpBtn({
|
|
122
135
|
className: cn(classNames?.scrollUpBtn, className)
|
|
123
136
|
}),
|
|
@@ -135,6 +148,7 @@ var SelectScrollDownButton = ({
|
|
|
135
148
|
return /* @__PURE__ */ jsx(
|
|
136
149
|
SelectPrimitive.ScrollDownButton,
|
|
137
150
|
{
|
|
151
|
+
"data-slot": "select-scroll-down-button",
|
|
138
152
|
className: scrollDownBtn({
|
|
139
153
|
className: cn(classNames?.scrollDownBtn, className)
|
|
140
154
|
}),
|
|
@@ -151,13 +165,11 @@ var SelectContent = ({
|
|
|
151
165
|
...props
|
|
152
166
|
}) => {
|
|
153
167
|
const { content, viewport, classNames } = useSelectStyles(unstyled);
|
|
154
|
-
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
168
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { "data-slot": "select-portal", children: /* @__PURE__ */ jsxs(
|
|
155
169
|
SelectPrimitive.Content,
|
|
156
170
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
position
|
|
160
|
-
}),
|
|
171
|
+
"data-slot": "select-content",
|
|
172
|
+
className: cn(content({ position }), classNames?.content, className),
|
|
161
173
|
position,
|
|
162
174
|
...props,
|
|
163
175
|
children: [
|
|
@@ -165,10 +177,8 @@ var SelectContent = ({
|
|
|
165
177
|
/* @__PURE__ */ jsx(
|
|
166
178
|
SelectPrimitive.Viewport,
|
|
167
179
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
position
|
|
171
|
-
}),
|
|
180
|
+
"data-slot": "select-viewport",
|
|
181
|
+
className: cn(viewport({ position }), classNames?.viewport),
|
|
172
182
|
children
|
|
173
183
|
}
|
|
174
184
|
),
|
|
@@ -182,6 +192,7 @@ var SelectLabel = ({ unstyled, className, ...props }) => {
|
|
|
182
192
|
return /* @__PURE__ */ jsx(
|
|
183
193
|
SelectPrimitive.Label,
|
|
184
194
|
{
|
|
195
|
+
"data-slot": "select-label",
|
|
185
196
|
className: label({
|
|
186
197
|
className: cn(classNames?.label, className)
|
|
187
198
|
}),
|
|
@@ -199,19 +210,20 @@ var SelectItem = ({
|
|
|
199
210
|
return /* @__PURE__ */ jsxs(
|
|
200
211
|
SelectPrimitive.Item,
|
|
201
212
|
{
|
|
213
|
+
"data-slot": "select-item",
|
|
202
214
|
className: item({
|
|
203
215
|
className: cn(classNames?.item, className)
|
|
204
216
|
}),
|
|
205
217
|
...props,
|
|
206
218
|
children: [
|
|
207
|
-
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }),
|
|
219
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { "data-slot": "select-item-text", children }),
|
|
208
220
|
/* @__PURE__ */ jsx(
|
|
209
221
|
"span",
|
|
210
222
|
{
|
|
211
223
|
className: itemIndicator({
|
|
212
224
|
className: classNames?.itemIndicator
|
|
213
225
|
}),
|
|
214
|
-
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
226
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { "data-slot": "select-item-indicator", children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
215
227
|
}
|
|
216
228
|
)
|
|
217
229
|
]
|
|
@@ -227,6 +239,7 @@ var SelectSeparator = ({
|
|
|
227
239
|
return /* @__PURE__ */ jsx(
|
|
228
240
|
SelectPrimitive.Separator,
|
|
229
241
|
{
|
|
242
|
+
"data-slot": "select-separator",
|
|
230
243
|
className: separator({
|
|
231
244
|
className: cn(classNames?.separator, className)
|
|
232
245
|
}),
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/select.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"src/select.tsx":{"bytes":12570,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","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":"tailwind-variants","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-core","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":"tailwind-variants","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Select","SelectContent","SelectGroup","SelectItem","SelectLabel","SelectScrollDownButton","SelectScrollUpButton","SelectSeparator","SelectTrigger","SelectTriggerIcon","SelectValue","selectStyles","useSelectStyles"],"entryPoint":"src/index.ts","inputs":{"src/select.tsx":{"bytesInOutput":7900},"src/index.ts":{"bytesInOutput":0}},"bytes":8172}}}
|
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.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"homepage": "https://mijn-ui.vercel.app",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -20,24 +20,27 @@
|
|
|
20
20
|
"exports": "./dist/index.js",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"react": "19.0.
|
|
24
|
-
"react-dom": "19.0.
|
|
23
|
+
"react": "19.0.1",
|
|
24
|
+
"react-dom": "19.0.1",
|
|
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
|
-
"@
|
|
28
|
+
"@testing-library/react": "^16.1.0",
|
|
29
|
+
"jsdom": "^30.1.3",
|
|
30
|
+
"@mijn-ui/react-core": "0.6.0",
|
|
29
31
|
"eslint-config-custom": "0.0.1",
|
|
30
32
|
"tsconfig": "0.0.0",
|
|
31
|
-
"tsup-config": "0.0.0"
|
|
33
|
+
"tsup-config": "0.0.0",
|
|
34
|
+
"test-utils": "0.0.0"
|
|
32
35
|
},
|
|
33
36
|
"dependencies": {
|
|
34
|
-
"@radix-ui/react-select": "^2.1
|
|
35
|
-
"@mijn-ui/shared-icons": "0.
|
|
37
|
+
"@radix-ui/react-select": "^2.4.1",
|
|
38
|
+
"@mijn-ui/shared-icons": "0.2.0"
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
38
41
|
"react": "^19.0",
|
|
39
42
|
"react-dom": "^19.0",
|
|
40
|
-
"@mijn-ui/react-core": "^0.
|
|
43
|
+
"@mijn-ui/react-core": "^0.6.0",
|
|
41
44
|
"tailwind-merge": "^3.0.0",
|
|
42
45
|
"tailwind-variants": "^3.0.0"
|
|
43
46
|
},
|
|
@@ -52,6 +55,7 @@
|
|
|
52
55
|
"scripts": {
|
|
53
56
|
"clean": "rimraf dist .turbo",
|
|
54
57
|
"build": "tsup",
|
|
58
|
+
"test": "vitest run",
|
|
55
59
|
"lint": "eslint .",
|
|
56
60
|
"lint:fix": "eslint . --fix",
|
|
57
61
|
"types:check": "tsc --noEmit"
|