@modul/mbui 0.0.20-beta-pv-53154-4403aebc → 0.0.21
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/Icon/icons/Share.js +2 -2
- package/dist/Icon/icons/Share.js.map +1 -1
- package/dist/Select/SelectAccount.d.ts +8 -0
- package/dist/Select/SelectAccount.js +50 -0
- package/dist/Select/SelectAccount.js.map +1 -0
- package/dist/Select/SelectAccountCard.js +5 -33
- package/dist/Select/SelectAccountCard.js.map +1 -1
- package/dist/Select/SelectAsync.js +12 -73
- package/dist/Select/SelectAsync.js.map +1 -1
- package/dist/Select/SelectBase.js +13 -73
- package/dist/Select/SelectBase.js.map +1 -1
- package/dist/Select/components/components.d.ts +15 -0
- package/dist/Select/components/components.js +80 -0
- package/dist/Select/components/components.js.map +1 -0
- package/dist/Select/components/index.d.ts +1 -0
- package/dist/Select/components/index.js +17 -0
- package/dist/Select/components/index.js.map +1 -0
- package/dist/Select/index.d.ts +1 -0
- package/dist/Select/index.js +3 -1
- package/dist/Select/index.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Icon/icons/Share.tsx +4 -4
- package/src/Select/SelectAccount.tsx +101 -0
- package/src/Select/SelectAccountCard.tsx +1 -51
- package/src/Select/SelectAsync.tsx +1 -162
- package/src/Select/SelectBase.tsx +19 -168
- package/src/Select/components/components.tsx +186 -0
- package/src/Select/components/index.tsx +15 -0
- package/src/Select/index.ts +1 -0
- package/src/index.ts +4 -4
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
components,
|
|
4
|
+
ControlProps,
|
|
5
|
+
OptionProps,
|
|
6
|
+
DropdownIndicatorProps,
|
|
7
|
+
StylesConfig,
|
|
8
|
+
SingleValueProps,
|
|
9
|
+
MenuProps,
|
|
10
|
+
PlaceholderProps,
|
|
11
|
+
ValueContainerProps,
|
|
12
|
+
InputProps,
|
|
13
|
+
LoadingIndicatorProps,
|
|
14
|
+
IndicatorsContainerProps,
|
|
15
|
+
} from 'react-select'
|
|
16
|
+
import { cn } from '../../@/lib/utils'
|
|
17
|
+
import { CheckSmall, DropdownSmallOld } from '../../Icon'
|
|
18
|
+
|
|
19
|
+
const Input = ({ ...props }: InputProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<components.Input
|
|
22
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const selectTriggerClasses: string = `
|
|
29
|
+
flex
|
|
30
|
+
items-center
|
|
31
|
+
py-[12px]
|
|
32
|
+
px-[16px]
|
|
33
|
+
h-[44px]
|
|
34
|
+
text-left
|
|
35
|
+
border-[1px]
|
|
36
|
+
border-input
|
|
37
|
+
rounded-sm
|
|
38
|
+
cursor-pointer
|
|
39
|
+
`
|
|
40
|
+
const Control = ({ children, ...props }: ControlProps) => {
|
|
41
|
+
const { isFocused } = props
|
|
42
|
+
return (
|
|
43
|
+
<components.Control
|
|
44
|
+
className={cn(selectTriggerClasses, { 'outline outline-primary outline-offset-2 outline-2': isFocused })}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</components.Control>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const colourStyles: StylesConfig = {
|
|
53
|
+
control: () => ({}),
|
|
54
|
+
option: () => ({}),
|
|
55
|
+
input: () => ({}),
|
|
56
|
+
dropdownIndicator: () => ({}),
|
|
57
|
+
indicatorsContainer: () => ({}),
|
|
58
|
+
menu: () => ({}),
|
|
59
|
+
menuList: () => ({}),
|
|
60
|
+
singleValue: () => ({}),
|
|
61
|
+
valueContainer: () => ({}),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const optionClasses =
|
|
65
|
+
'flex items-center first:rounded-t-sm last:rounded-b-sm px-[16px] py-[12px] w-full cursor-default select-none outline-none'
|
|
66
|
+
|
|
67
|
+
const Option = ({ children, ...props }: OptionProps) => {
|
|
68
|
+
const { isSelected, isFocused, isDisabled } = props
|
|
69
|
+
return (
|
|
70
|
+
<components.Option
|
|
71
|
+
className={cn(
|
|
72
|
+
optionClasses,
|
|
73
|
+
'items-start',
|
|
74
|
+
{ 'bg-light': isFocused },
|
|
75
|
+
{ 'opacity-50 pointer-events-none': isDisabled }
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
<span className="flex basis-0 grow">{children}</span>
|
|
80
|
+
|
|
81
|
+
<span className="ml-[16px] shrink-0 size-[24px]">
|
|
82
|
+
{isSelected && (
|
|
83
|
+
<CheckSmall
|
|
84
|
+
width="24"
|
|
85
|
+
height="24"
|
|
86
|
+
className="text-primary"
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
</span>
|
|
90
|
+
</components.Option>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const IndicatorsContainer = ({ children, ...props }: IndicatorsContainerProps) => {
|
|
95
|
+
return (
|
|
96
|
+
<components.IndicatorsContainer
|
|
97
|
+
className="flex items-center gap-x-[8px] shrink-0"
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
</components.IndicatorsContainer>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const LoadingIndicator = ({ ...props }: LoadingIndicatorProps) => {
|
|
106
|
+
return (
|
|
107
|
+
<components.LoadingIndicator
|
|
108
|
+
className="text-light shrink-0"
|
|
109
|
+
{...props}
|
|
110
|
+
/>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
115
|
+
return (
|
|
116
|
+
<components.DropdownIndicator
|
|
117
|
+
className="shrink-0"
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
<DropdownSmallOld
|
|
121
|
+
className="text-light"
|
|
122
|
+
width="12"
|
|
123
|
+
height="12"
|
|
124
|
+
/>
|
|
125
|
+
</components.DropdownIndicator>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
130
|
+
return (
|
|
131
|
+
<components.ValueContainer
|
|
132
|
+
className="flex-1 grid"
|
|
133
|
+
{...props}
|
|
134
|
+
>
|
|
135
|
+
{children}
|
|
136
|
+
</components.ValueContainer>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
141
|
+
return (
|
|
142
|
+
<components.SingleValue
|
|
143
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
144
|
+
{...props}
|
|
145
|
+
>
|
|
146
|
+
{children}
|
|
147
|
+
</components.SingleValue>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const Menu = ({ children, ...props }: MenuProps) => {
|
|
152
|
+
return (
|
|
153
|
+
<components.Menu
|
|
154
|
+
className="z-[1] absolute inset-x-0 bg-page shadow-sm mt-[8px] rounded-sm"
|
|
155
|
+
{...props}
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</components.Menu>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const Placeholder = ({ children, ...props }: PlaceholderProps) => {
|
|
163
|
+
return (
|
|
164
|
+
<components.Placeholder
|
|
165
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2 text-[16px] text-light truncate"
|
|
166
|
+
{...props}
|
|
167
|
+
>
|
|
168
|
+
{children}
|
|
169
|
+
</components.Placeholder>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
Input,
|
|
175
|
+
Control,
|
|
176
|
+
colourStyles,
|
|
177
|
+
optionClasses,
|
|
178
|
+
Option,
|
|
179
|
+
IndicatorsContainer,
|
|
180
|
+
LoadingIndicator,
|
|
181
|
+
DropdownIndicator,
|
|
182
|
+
ValueContainer,
|
|
183
|
+
SingleValue,
|
|
184
|
+
Menu,
|
|
185
|
+
Placeholder,
|
|
186
|
+
}
|
package/src/Select/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -30,11 +30,10 @@ import { Alert } from './Alert'
|
|
|
30
30
|
import { Switch } from './Switch'
|
|
31
31
|
import { Label } from './Label'
|
|
32
32
|
import { Textarea } from './Textarea'
|
|
33
|
-
import { SelectAccountCard, SelectAsync } from './Select'
|
|
33
|
+
import { SelectAccountCard, SelectAsync, SelectAccount, Select } from './Select'
|
|
34
34
|
import { Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage } from './Form'
|
|
35
35
|
import { Calendar } from './Calendar'
|
|
36
36
|
import { DatePicker } from './DatePicker'
|
|
37
|
-
import { Select } from './Select'
|
|
38
37
|
import { Progress } from './Progress'
|
|
39
38
|
import {
|
|
40
39
|
AlertDialog,
|
|
@@ -95,6 +94,9 @@ export {
|
|
|
95
94
|
Label,
|
|
96
95
|
Textarea,
|
|
97
96
|
SelectAccountCard,
|
|
97
|
+
SelectAccount,
|
|
98
|
+
SelectAsync,
|
|
99
|
+
Select,
|
|
98
100
|
Form,
|
|
99
101
|
FormLabel,
|
|
100
102
|
FormField,
|
|
@@ -104,9 +106,7 @@ export {
|
|
|
104
106
|
FormMessage,
|
|
105
107
|
Calendar,
|
|
106
108
|
DatePicker,
|
|
107
|
-
SelectAsync,
|
|
108
109
|
InputMask,
|
|
109
|
-
Select,
|
|
110
110
|
AlertDialog,
|
|
111
111
|
AlertDialogTrigger,
|
|
112
112
|
AlertDialogContent,
|