@mijn-ui/react-select 0.2.1 → 0.4.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,68 @@
1
1
  "use client";
2
2
 
3
3
  // src/select.tsx
4
- import { useTVUnstyled } from "@mijn-ui/react-hooks";
5
4
  import {
6
5
  cn,
7
- selectStyles
8
- } from "@mijn-ui/react-theme";
9
- import { createContext } from "@mijn-ui/react-utilities";
6
+ createContext,
7
+ useTVUnstyled
8
+ } from "@mijn-ui/react-core";
10
9
  import {
11
10
  CheckIcon,
12
11
  ChevronDownIcon,
13
12
  ChevronUpIcon
14
13
  } from "@mijn-ui/shared-icons";
15
14
  import * as SelectPrimitive from "@radix-ui/react-select";
15
+ import { tv } from "tailwind-variants";
16
16
  import { jsx, jsxs } from "react/jsx-runtime";
17
+ var selectStyles = tv({
18
+ slots: {
19
+ base: "",
20
+ trigger: [
21
+ "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",
22
+ "[&_svg]:size-4 [&_svg]:opacity-50",
23
+ "disabled:pointer-events-none",
24
+ "disabled:opacity-50",
25
+ "focus-visible:outline-none",
26
+ "focus-visible:ring-2",
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"
31
+ ],
32
+ scrollUpBtn: "",
33
+ scrollDownBtn: "",
34
+ content: [
35
+ "data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=open]:fade-in-0",
36
+ "data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
37
+ "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",
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 !duration-300 w-60"
39
+ ],
40
+ viewport: "",
41
+ label: "py-1.5 pl-2 pr-8 text-sm font-semibold",
42
+ item: [
43
+ "data-disabled:pointer-events-none group",
44
+ "data-disabled:opacity-50",
45
+ "focus:bg-bg-secondary relative flex w-full cursor-default select-none items-center h-9 pl-4 pr-8 text-sm outline-none"
46
+ ],
47
+ itemIndicator: "absolute right-4 flex size-3.5 items-center justify-center [&_svg]:size-4 group-data-[state=checked]:text-fg-brand",
48
+ separator: "bg-outline-default -mx-1 my-1 h-px"
49
+ },
50
+ compoundSlots: [
51
+ {
52
+ slots: ["scrollUpBtn", "scrollDownBtn"],
53
+ class: "flex cursor-default items-center justify-center py-1 [&_svg]:size-4"
54
+ }
55
+ ],
56
+ variants: {
57
+ position: {
58
+ popper: {
59
+ 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",
60
+ viewport: "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
61
+ },
62
+ "item-aligned": {}
63
+ }
64
+ }
65
+ });
17
66
  var [SelectProvider, useSelectContext] = createContext({
18
67
  name: "SelectContext",
19
68
  strict: true,
@@ -187,5 +236,6 @@ export {
187
236
  SelectSeparator,
188
237
  SelectTrigger,
189
238
  SelectValue,
239
+ selectStyles,
190
240
  useSelectStyles
191
241
  };
@@ -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":10756,"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":6813},"src/index.ts":{"bytesInOutput":0}},"bytes":7064}}}
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.1",
4
+ "version": "0.4.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.2.0",
29
- "@mijn-ui/react-theme": "0.2.0",
28
+ "@mijn-ui/react-core": "0.4.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.19"
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.4.0",
41
+ "tailwind-merge": "^3.0.0",
42
+ "tailwind-variants": "^3.0.0"
45
43
  },
46
44
  "publishConfig": {
47
45
  "access": "public"