@mijn-ui/react-select 0.2.0 → 0.3.0

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,62 +1,139 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as tailwind_merge from 'tailwind-merge';
3
+ import * as _mijn_ui_react_core from '@mijn-ui/react-core';
4
+ import { UnstyledComponentWithSlots } from '@mijn-ui/react-core';
2
5
  import * as tailwind_variants from 'tailwind-variants';
3
- import * as _mijn_ui_react_theme from '@mijn-ui/react-theme';
4
- import { UnstyledComponentWithSlots, SelectSlots, UnstyledProps } from '@mijn-ui/react-theme';
6
+ import { VariantProps } from 'tailwind-variants';
5
7
  import * as React from 'react';
6
8
  import * as SelectPrimitive from '@radix-ui/react-select';
7
9
 
10
+ declare const selectStyles: tailwind_variants.TVReturnType<{
11
+ position: {
12
+ popper: {
13
+ content: string;
14
+ viewport: string;
15
+ };
16
+ "item-aligned": {};
17
+ };
18
+ }, {
19
+ base: string;
20
+ trigger: string[];
21
+ scrollUpBtn: string;
22
+ scrollDownBtn: string;
23
+ content: string[];
24
+ viewport: string;
25
+ label: string;
26
+ item: string[];
27
+ itemIndicator: string;
28
+ separator: string;
29
+ }, undefined, {
30
+ position: {
31
+ popper: {
32
+ content: string;
33
+ viewport: string;
34
+ };
35
+ "item-aligned": {};
36
+ };
37
+ }, {
38
+ base: string;
39
+ trigger: string[];
40
+ scrollUpBtn: string;
41
+ scrollDownBtn: string;
42
+ content: string[];
43
+ viewport: string;
44
+ label: string;
45
+ item: string[];
46
+ itemIndicator: string;
47
+ separator: string;
48
+ }, tailwind_variants.TVReturnType<{
49
+ position: {
50
+ popper: {
51
+ content: string;
52
+ viewport: string;
53
+ };
54
+ "item-aligned": {};
55
+ };
56
+ }, {
57
+ base: string;
58
+ trigger: string[];
59
+ scrollUpBtn: string;
60
+ scrollDownBtn: string;
61
+ content: string[];
62
+ viewport: string;
63
+ label: string;
64
+ item: string[];
65
+ itemIndicator: string;
66
+ separator: string;
67
+ }, undefined, unknown, unknown, undefined>>;
68
+ type SelectVariantProps = VariantProps<typeof selectStyles>;
69
+ type SelectSlots = keyof ReturnType<typeof selectStyles>;
70
+
8
71
  type SelectBaseProps = UnstyledComponentWithSlots<SelectSlots>;
9
72
  declare const useSelectStyles: (unstyledOverride?: boolean) => {
10
- classNames: _mijn_ui_react_theme.SlotsToClasses<"base" | "trigger" | "scrollUpBtn" | "scrollDownBtn" | "content" | "viewport" | "label" | "item" | "itemIndicator" | "separator"> | undefined;
73
+ classNames: _mijn_ui_react_core.SlotsToClasses<"base" | "scrollUpBtn" | "scrollDownBtn" | "viewport" | "label" | "itemIndicator" | "separator" | "trigger" | "content" | "item"> | undefined;
11
74
  isUnstyled: boolean | undefined;
12
75
  base: (slotProps?: ({
13
- position?: "item-aligned" | "popper" | undefined;
14
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
76
+ position?: "popper" | "item-aligned" | undefined;
77
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
15
78
  trigger: (slotProps?: ({
16
- position?: "item-aligned" | "popper" | undefined;
17
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
79
+ position?: "popper" | "item-aligned" | undefined;
80
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
18
81
  scrollUpBtn: (slotProps?: ({
19
- position?: "item-aligned" | "popper" | undefined;
20
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
82
+ position?: "popper" | "item-aligned" | undefined;
83
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
21
84
  scrollDownBtn: (slotProps?: ({
22
- position?: "item-aligned" | "popper" | undefined;
23
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
85
+ position?: "popper" | "item-aligned" | undefined;
86
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
24
87
  content: (slotProps?: ({
25
- position?: "item-aligned" | "popper" | undefined;
26
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
88
+ position?: "popper" | "item-aligned" | undefined;
89
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
27
90
  viewport: (slotProps?: ({
28
- position?: "item-aligned" | "popper" | undefined;
29
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
91
+ position?: "popper" | "item-aligned" | undefined;
92
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
30
93
  label: (slotProps?: ({
31
- position?: "item-aligned" | "popper" | undefined;
32
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
94
+ position?: "popper" | "item-aligned" | undefined;
95
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
33
96
  item: (slotProps?: ({
34
- position?: "item-aligned" | "popper" | undefined;
35
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
97
+ position?: "popper" | "item-aligned" | undefined;
98
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
36
99
  itemIndicator: (slotProps?: ({
37
- position?: "item-aligned" | "popper" | undefined;
38
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
100
+ position?: "popper" | "item-aligned" | undefined;
101
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
39
102
  separator: (slotProps?: ({
40
- position?: "item-aligned" | "popper" | undefined;
41
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
103
+ position?: "popper" | "item-aligned" | undefined;
104
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
42
105
  };
43
106
  declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
44
107
  declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
45
108
  type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root> & SelectBaseProps;
46
109
  declare const Select: ({ classNames, unstyled, ...props }: SelectProps) => react_jsx_runtime.JSX.Element;
47
- type SelectTriggerProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Trigger> & UnstyledProps;
110
+ type SelectTriggerProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Trigger> & {
111
+ unstyled?: boolean;
112
+ };
48
113
  declare const SelectTrigger: ({ unstyled, className, children, ...props }: SelectTriggerProps) => react_jsx_runtime.JSX.Element;
49
- type SelectScrollUpButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollUpButton> & UnstyledProps;
114
+ type SelectScrollUpButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollUpButton> & {
115
+ unstyled?: boolean;
116
+ };
50
117
  declare const SelectScrollUpButton: ({ unstyled, className, ...props }: SelectScrollUpButtonProps) => react_jsx_runtime.JSX.Element;
51
- type SelectScrollDownButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollDownButton> & UnstyledProps;
118
+ type SelectScrollDownButtonProps = React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollDownButton> & {
119
+ unstyled?: boolean;
120
+ };
52
121
  declare const SelectScrollDownButton: ({ unstyled, className, ...props }: SelectScrollDownButtonProps) => react_jsx_runtime.JSX.Element;
53
- type SelectContentProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Content> & UnstyledProps;
122
+ type SelectContentProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Content> & {
123
+ unstyled?: boolean;
124
+ };
54
125
  declare const SelectContent: ({ unstyled, className, children, position, ...props }: SelectContentProps) => react_jsx_runtime.JSX.Element;
55
- type SelectLabelProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Label> & UnstyledProps;
126
+ type SelectLabelProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Label> & {
127
+ unstyled?: boolean;
128
+ };
56
129
  declare const SelectLabel: ({ unstyled, className, ...props }: SelectLabelProps) => react_jsx_runtime.JSX.Element;
57
- type SelectItemProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Item> & UnstyledProps;
130
+ type SelectItemProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Item> & {
131
+ unstyled?: boolean;
132
+ };
58
133
  declare const SelectItem: ({ unstyled, className, children, ...props }: SelectItemProps) => react_jsx_runtime.JSX.Element;
59
- type SelectSeparatorProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Separator> & UnstyledProps;
134
+ type SelectSeparatorProps = React.ComponentPropsWithRef<typeof SelectPrimitive.Separator> & {
135
+ unstyled?: boolean;
136
+ };
60
137
  declare const SelectSeparator: ({ unstyled, className, ...props }: SelectSeparatorProps) => react_jsx_runtime.JSX.Element;
61
138
 
62
- export { Select, SelectContent, type SelectContentProps, SelectGroup, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, type SelectProps, SelectScrollDownButton, type SelectScrollDownButtonProps, SelectScrollUpButton, type SelectScrollUpButtonProps, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, SelectValue, useSelectStyles };
139
+ export { Select, SelectContent, type SelectContentProps, SelectGroup, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, type SelectProps, SelectScrollDownButton, type SelectScrollDownButtonProps, SelectScrollUpButton, type SelectScrollUpButtonProps, SelectSeparator, type SelectSeparatorProps, type SelectSlots, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectVariantProps, selectStyles, useSelectStyles };
package/dist/index.js CHANGED
@@ -1,19 +1,67 @@
1
1
  "use client";
2
2
 
3
3
  // src/select.tsx
4
- import { useTVUnstyled } from "@mijn-ui/react-hooks";
5
4
  import {
6
- cn,
7
- selectStyles
8
- } from "@mijn-ui/react-theme";
9
- import { createContext } from "@mijn-ui/react-utilities";
5
+ createContext,
6
+ useTVUnstyled
7
+ } from "@mijn-ui/react-core";
10
8
  import {
11
9
  CheckIcon,
12
10
  ChevronDownIcon,
13
11
  ChevronUpIcon
14
12
  } from "@mijn-ui/shared-icons";
15
13
  import * as SelectPrimitive from "@radix-ui/react-select";
14
+ import { cnBase, tv } from "tailwind-variants";
16
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
+ var selectStyles = tv({
17
+ slots: {
18
+ base: "",
19
+ trigger: [
20
+ "border-outline-default min-w-44 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",
21
+ "[&_svg]:size-4 [&_svg]:opacity-50",
22
+ "disabled:pointer-events-none",
23
+ "disabled:opacity-50",
24
+ "focus-visible:outline-none",
25
+ "focus-visible:ring-2",
26
+ "focus-visible:ring-outline-brand",
27
+ "focus-visible:ring-outline-brand",
28
+ "focus-visible:ring-offset-2",
29
+ "focus-visible:ring-offset-bg-default"
30
+ ],
31
+ scrollUpBtn: "",
32
+ scrollDownBtn: "",
33
+ content: [
34
+ "data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=open]:fade-in-0",
35
+ "data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
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",
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-sm !duration-300 w-60"
38
+ ],
39
+ viewport: "",
40
+ label: "py-1.5 pl-2 pr-8 text-sm font-semibold",
41
+ item: [
42
+ "data-disabled:pointer-events-none group",
43
+ "data-disabled:opacity-50",
44
+ "focus:bg-bg-secondary relative flex w-full cursor-default select-none items-center h-9 pl-4 pr-8 text-sm outline-none"
45
+ ],
46
+ itemIndicator: "absolute right-4 flex size-3.5 items-center justify-center [&_svg]:size-4 group-data-[state=checked]:text-fg-brand",
47
+ separator: "bg-outline-default -mx-1 my-1 h-px"
48
+ },
49
+ compoundSlots: [
50
+ {
51
+ slots: ["scrollUpBtn", "scrollDownBtn"],
52
+ class: "flex cursor-default items-center justify-center py-1 [&_svg]:size-4"
53
+ }
54
+ ],
55
+ variants: {
56
+ position: {
57
+ popper: {
58
+ content: "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
59
+ viewport: "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
60
+ },
61
+ "item-aligned": {}
62
+ }
63
+ }
64
+ });
17
65
  var [SelectProvider, useSelectContext] = createContext({
18
66
  name: "SelectContext",
19
67
  strict: true,
@@ -41,7 +89,7 @@ var SelectTrigger = ({
41
89
  SelectPrimitive.Trigger,
42
90
  {
43
91
  className: trigger({
44
- className: cn(classNames?.trigger, className)
92
+ className: cnBase(classNames?.trigger, className)
45
93
  }),
46
94
  ...props,
47
95
  children: [
@@ -61,7 +109,7 @@ var SelectScrollUpButton = ({
61
109
  SelectPrimitive.ScrollUpButton,
62
110
  {
63
111
  className: scrollUpBtn({
64
- className: cn(classNames?.scrollUpBtn, className)
112
+ className: cnBase(classNames?.scrollUpBtn, className)
65
113
  }),
66
114
  ...props,
67
115
  children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
@@ -78,7 +126,7 @@ var SelectScrollDownButton = ({
78
126
  SelectPrimitive.ScrollDownButton,
79
127
  {
80
128
  className: scrollDownBtn({
81
- className: cn(classNames?.scrollDownBtn, className)
129
+ className: cnBase(classNames?.scrollDownBtn, className)
82
130
  }),
83
131
  ...props,
84
132
  children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
@@ -97,7 +145,7 @@ var SelectContent = ({
97
145
  SelectPrimitive.Content,
98
146
  {
99
147
  className: content({
100
- className: cn(classNames?.content, className),
148
+ className: cnBase(classNames?.content, className),
101
149
  position
102
150
  }),
103
151
  position,
@@ -125,7 +173,7 @@ var SelectLabel = ({ unstyled, className, ...props }) => {
125
173
  SelectPrimitive.Label,
126
174
  {
127
175
  className: label({
128
- className: cn(classNames?.label, className)
176
+ className: cnBase(classNames?.label, className)
129
177
  }),
130
178
  ...props
131
179
  }
@@ -142,7 +190,7 @@ var SelectItem = ({
142
190
  SelectPrimitive.Item,
143
191
  {
144
192
  className: item({
145
- className: cn(classNames?.item, className)
193
+ className: cnBase(classNames?.item, className)
146
194
  }),
147
195
  ...props,
148
196
  children: [
@@ -170,7 +218,7 @@ var SelectSeparator = ({
170
218
  SelectPrimitive.Separator,
171
219
  {
172
220
  className: separator({
173
- className: cn(classNames?.separator, className)
221
+ className: cnBase(classNames?.separator, className)
174
222
  }),
175
223
  ...props
176
224
  }
@@ -187,5 +235,6 @@ export {
187
235
  SelectSeparator,
188
236
  SelectTrigger,
189
237
  SelectValue,
238
+ selectStyles,
190
239
  useSelectStyles
191
240
  };
@@ -1 +1 @@
1
- {"inputs":{"src/select.tsx":{"bytes":8344,"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","useSelectStyles"],"entryPoint":"src/index.ts","inputs":{"src/select.tsx":{"bytesInOutput":4636},"src/index.ts":{"bytesInOutput":0}},"bytes":4871}}}
1
+ {"inputs":{"src/select.tsx":{"bytes":10786,"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","SelectValue","selectStyles","useSelectStyles"],"entryPoint":"src/index.ts","inputs":{"src/select.tsx":{"bytesInOutput":6843},"src/index.ts":{"bytesInOutput":0}},"bytes":7094}}}
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.2.0",
4
+ "version": "0.3.0",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -25,23 +25,21 @@
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.1.0",
29
- "@mijn-ui/react-theme": "0.2.0",
28
+ "@mijn-ui/react-core": "0.3.0",
30
29
  "eslint-config-custom": "0.0.1",
31
30
  "tsconfig": "0.0.0",
32
31
  "tsup-config": "0.0.0"
33
32
  },
34
33
  "dependencies": {
35
34
  "@radix-ui/react-select": "^2.1.3",
36
- "@mijn-ui/shared-icons": "0.1.0",
37
- "@mijn-ui/react-utilities": "0.0.9",
38
- "@mijn-ui/react-hooks": "0.0.18"
35
+ "@mijn-ui/shared-icons": "0.1.0"
39
36
  },
40
37
  "peerDependencies": {
41
38
  "react": "^19.0",
42
39
  "react-dom": "^19.0",
43
- "@mijn-ui/react-theme": "^0.2.0",
44
- "@mijn-ui/react-core": "^0.2.0"
40
+ "@mijn-ui/react-core": "^0.3.0",
41
+ "tailwind-merge": "^3.0.0",
42
+ "tailwind-variants": "^3.0.0"
45
43
  },
46
44
  "publishConfig": {
47
45
  "access": "public"