@modul/mbui 0.0.13-beta-pv-53127-63b6a630 → 0.0.13-beta-pv-53036-3ecb0556
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/{Info/Info.d.ts → Alert/Alert.d.ts} +4 -4
- package/dist/{Info/Info.js → Alert/Alert.js} +7 -7
- package/dist/Alert/Alert.js.map +1 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/index.js +6 -0
- package/dist/Alert/index.js.map +1 -0
- package/dist/AlertDialog/AlertDialog.d.ts +20 -0
- package/dist/AlertDialog/AlertDialog.js +42 -0
- package/dist/AlertDialog/AlertDialog.js.map +1 -0
- package/dist/AlertDialog/index.d.ts +1 -0
- package/dist/AlertDialog/index.js +16 -0
- package/dist/AlertDialog/index.js.map +1 -0
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Calendar/Calendar.d.ts +8 -0
- package/dist/Calendar/Calendar.js +45 -0
- package/dist/Calendar/Calendar.js.map +1 -0
- package/dist/Calendar/index.d.ts +1 -0
- package/dist/Calendar/index.js +6 -0
- package/dist/Calendar/index.js.map +1 -0
- package/dist/Chip/Chip.d.ts +1 -1
- package/dist/DatePicker/DatePicker.d.ts +9 -0
- package/dist/DatePicker/DatePicker.js +23 -0
- package/dist/DatePicker/DatePicker.js.map +1 -0
- package/dist/DatePicker/index.d.ts +1 -0
- package/dist/DatePicker/index.js +6 -0
- package/dist/DatePicker/index.js.map +1 -0
- package/dist/Drawer/Drawer.js +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/Form/Form.d.ts +23 -0
- package/dist/Form/Form.js +73 -0
- package/dist/Form/Form.js.map +1 -0
- package/dist/Form/index.d.ts +1 -0
- package/dist/Form/index.js +13 -0
- package/dist/Form/index.js.map +1 -0
- package/dist/Input/Input.js +1 -1
- package/dist/Input/Input.js.map +1 -1
- package/dist/Input/InputMask.d.ts +3 -0
- package/dist/Input/InputMask.js +12 -0
- package/dist/Input/InputMask.js.map +1 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Input/index.js +3 -1
- package/dist/Input/index.js.map +1 -1
- package/dist/Input-OTP/Input.d.ts +4 -4
- package/dist/Label/Label.d.ts +5 -0
- package/dist/Label/Label.js +13 -0
- package/dist/Label/Label.js.map +1 -0
- package/dist/Label/index.d.ts +1 -0
- package/dist/Label/index.js +6 -0
- package/dist/Label/index.js.map +1 -0
- package/dist/Page/Page.js +1 -1
- package/dist/Page/Page.js.map +1 -1
- package/dist/Select/Select.d.ts +3 -0
- package/dist/Select/Select.js +11 -0
- package/dist/Select/Select.js.map +1 -0
- package/dist/Select/SelectAccountCard.d.ts +5 -0
- package/dist/Select/SelectAccountCard.js +77 -0
- package/dist/Select/SelectAccountCard.js.map +1 -0
- package/dist/Select/SelectAsync.d.ts +8 -0
- package/dist/Select/SelectAsync.js +73 -0
- package/dist/Select/SelectAsync.js.map +1 -0
- package/dist/Select/SelectBase.d.ts +6 -0
- package/dist/Select/SelectBase.js +72 -0
- package/dist/Select/SelectBase.js.map +1 -0
- package/dist/Select/index.d.ts +4 -0
- package/dist/Select/index.js +12 -0
- package/dist/Select/index.js.map +1 -0
- package/dist/Switch/Switch.d.ts +4 -0
- package/dist/Switch/Switch.js +31 -0
- package/dist/Switch/Switch.js.map +1 -0
- package/dist/Switch/index.d.ts +1 -0
- package/dist/Switch/index.js +6 -0
- package/dist/Switch/index.js.map +1 -0
- package/dist/Textarea/Textarea.d.ts +5 -0
- package/dist/Textarea/Textarea.js +12 -0
- package/dist/Textarea/Textarea.js.map +1 -0
- package/dist/Textarea/index.d.ts +1 -0
- package/dist/Textarea/index.js +6 -0
- package/dist/Textarea/index.js.map +1 -0
- package/dist/index.d.ts +27 -20
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/package.json +11 -4
- package/src/{Info/Info.tsx → Alert/Alert.tsx} +6 -6
- package/src/Alert/index.ts +1 -0
- package/src/AlertDialog/AlertDialog.tsx +138 -0
- package/src/AlertDialog/index.ts +13 -0
- package/src/Calendar/Calendar.tsx +61 -0
- package/src/Calendar/index.ts +1 -0
- package/src/DatePicker/DatePicker.tsx +38 -0
- package/src/DatePicker/index.ts +1 -0
- package/src/Drawer/Drawer.tsx +2 -2
- package/src/Form/Form.tsx +152 -0
- package/src/Form/index.ts +1 -0
- package/src/Input/Input.tsx +1 -1
- package/src/Input/InputMask.tsx +15 -0
- package/src/Input/index.ts +2 -1
- package/src/Label/Label.tsx +1 -1
- package/src/Page/Page.tsx +1 -1
- package/src/Select/Select.tsx +8 -0
- package/src/Select/SelectAccountCard.tsx +175 -0
- package/src/Select/SelectAsync.tsx +183 -0
- package/src/Select/SelectBase.tsx +181 -0
- package/src/Select/index.ts +4 -0
- package/src/Switch/Switch.tsx +47 -0
- package/src/Switch/index.ts +1 -0
- package/src/Textarea/Textarea.tsx +24 -0
- package/src/Textarea/index.ts +1 -0
- package/src/assets/css/global.css +22 -9
- package/src/index.ts +67 -41
- package/dist/Base/Input/Base.d.ts +0 -4
- package/dist/Base/Input/Base.js +0 -20
- package/dist/Base/Input/Base.js.map +0 -1
- package/dist/Base/Input/Input.d.ts +0 -4
- package/dist/Base/Input/Input.js +0 -18
- package/dist/Base/Input/Input.js.map +0 -1
- package/dist/Base/Input/index.d.ts +0 -2
- package/dist/Base/Input/index.js +0 -7
- package/dist/Base/Input/index.js.map +0 -1
- package/dist/Base/Input/types.d.ts +0 -9
- package/dist/Base/Input/types.js +0 -3
- package/dist/Base/Input/types.js.map +0 -1
- package/dist/Info/Info.js.map +0 -1
- package/dist/Info/index.d.ts +0 -1
- package/dist/Info/index.js +0 -6
- package/dist/Info/index.js.map +0 -1
- package/dist/Progress/Progress.d.ts +0 -4
- package/dist/Progress/Progress.js +0 -12
- package/dist/Progress/Progress.js.map +0 -1
- package/dist/Progress/index.d.ts +0 -1
- package/dist/Progress/index.js +0 -6
- package/dist/Progress/index.js.map +0 -1
- package/src/DrawerCompanyList/CompanyList.tsx +0 -63
- package/src/DrawerCompanyList/index.ts +0 -1
- package/src/Info/index.ts +0 -1
- package/src/Progress/Progress.tsx +0 -23
- package/src/Progress/index.ts +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { DropdownSmallOld, CheckSmall } from '../Icon'
|
|
4
|
+
|
|
5
|
+
import Select, {
|
|
6
|
+
components,
|
|
7
|
+
ControlProps,
|
|
8
|
+
OptionProps,
|
|
9
|
+
DropdownIndicatorProps,
|
|
10
|
+
StylesConfig,
|
|
11
|
+
SingleValueProps,
|
|
12
|
+
MenuProps,
|
|
13
|
+
ValueContainerProps,
|
|
14
|
+
Props,
|
|
15
|
+
GroupBase,
|
|
16
|
+
} from 'react-select'
|
|
17
|
+
|
|
18
|
+
import { cn } from '../@/lib/utils'
|
|
19
|
+
|
|
20
|
+
const selectTriggerClasses: string =
|
|
21
|
+
'flex items-center bg-gradient-to-r from-[--cl-blue-3] to-primary shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)] px-[16px] py-[8px] border-none rounded-md min-h-[80px] text-left text-white cursor-pointer'
|
|
22
|
+
|
|
23
|
+
const colourStyles: StylesConfig = {
|
|
24
|
+
control: () => ({}),
|
|
25
|
+
option: () => ({}),
|
|
26
|
+
input: () => ({}),
|
|
27
|
+
dropdownIndicator: () => ({}),
|
|
28
|
+
indicatorsContainer: () => ({}),
|
|
29
|
+
menu: () => ({}),
|
|
30
|
+
menuList: () => ({}),
|
|
31
|
+
singleValue: () => ({}),
|
|
32
|
+
valueContainer: () => ({}),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Control = ({ children, ...props }: ControlProps) => {
|
|
36
|
+
const { isFocused } = props
|
|
37
|
+
return (
|
|
38
|
+
<components.Control
|
|
39
|
+
className={cn(
|
|
40
|
+
selectTriggerClasses,
|
|
41
|
+
{ 'outline outline-primary outline-offset-2 outline-2': isFocused }
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</components.Control>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const optionClasses =
|
|
51
|
+
'flex items-center first:rounded-t-md last:rounded-b-md px-[12px] py-[16px] w-full cursor-default select-none outline-none'
|
|
52
|
+
|
|
53
|
+
const Option = ({ children, ...props }: OptionProps) => {
|
|
54
|
+
const {
|
|
55
|
+
isSelected,
|
|
56
|
+
isFocused,
|
|
57
|
+
isDisabled,
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
data: { label, account, balance, cur },
|
|
60
|
+
} = props
|
|
61
|
+
return (
|
|
62
|
+
<components.Option
|
|
63
|
+
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
<span className="flex basis-0 grow">
|
|
67
|
+
<span>
|
|
68
|
+
<span>{label}</span>
|
|
69
|
+
<br />
|
|
70
|
+
<span className="text-[14px] text-light">{account}</span>
|
|
71
|
+
</span>
|
|
72
|
+
<span className="ml-auto shrink-0">
|
|
73
|
+
{balance} {cur}
|
|
74
|
+
</span>
|
|
75
|
+
</span>
|
|
76
|
+
|
|
77
|
+
<span className="ml-[16px] w-[24px] h-[24px] shrink-0">
|
|
78
|
+
{isSelected && (
|
|
79
|
+
<CheckSmall
|
|
80
|
+
width="24"
|
|
81
|
+
height="24"
|
|
82
|
+
className="text-primary"
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
</span>
|
|
86
|
+
</components.Option>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
91
|
+
return (
|
|
92
|
+
<components.DropdownIndicator
|
|
93
|
+
className="shrink-0"
|
|
94
|
+
{...props}
|
|
95
|
+
>
|
|
96
|
+
<DropdownSmallOld
|
|
97
|
+
className="text-white"
|
|
98
|
+
width="16"
|
|
99
|
+
height="16"
|
|
100
|
+
/>
|
|
101
|
+
</components.DropdownIndicator>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
106
|
+
return (
|
|
107
|
+
<components.ValueContainer
|
|
108
|
+
className="flex-1 grid"
|
|
109
|
+
{...props}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</components.ValueContainer>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
const { label, account, balance, cur } = props.data
|
|
119
|
+
return (
|
|
120
|
+
<components.SingleValue
|
|
121
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
122
|
+
{...props}
|
|
123
|
+
>
|
|
124
|
+
<span className="block max-w-full text-[16px] truncate leading-[1.5]">
|
|
125
|
+
{label} <span className="opacity-75 text-[14px] leading-[1.42]">{account}</span>
|
|
126
|
+
</span>
|
|
127
|
+
<span className="block mt-[8px] font-medium text-[24px] leading-[1.333]">
|
|
128
|
+
{balance} {cur}
|
|
129
|
+
</span>
|
|
130
|
+
</components.SingleValue>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const Menu = ({ children, ...props }: MenuProps) => {
|
|
135
|
+
return (
|
|
136
|
+
<components.Menu
|
|
137
|
+
className="z-[1] absolute inset-x-0 bg-page shadow-md mt-[8px] rounded-md"
|
|
138
|
+
{...props}
|
|
139
|
+
>
|
|
140
|
+
{children}
|
|
141
|
+
</components.Menu>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
type SelectAccountCardProps<
|
|
146
|
+
Option,
|
|
147
|
+
IsMulti extends boolean = false,
|
|
148
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
149
|
+
> = Props<Option, IsMulti, Group>
|
|
150
|
+
|
|
151
|
+
const SelectAccountCard = <
|
|
152
|
+
Option,
|
|
153
|
+
IsMulti extends boolean = false,
|
|
154
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
155
|
+
>(props: SelectAccountCardProps<Option, IsMulti, Group>) => {
|
|
156
|
+
return (
|
|
157
|
+
<Select
|
|
158
|
+
isSearchable={false}
|
|
159
|
+
components={{
|
|
160
|
+
Control,
|
|
161
|
+
Option,
|
|
162
|
+
SingleValue,
|
|
163
|
+
DropdownIndicator,
|
|
164
|
+
IndicatorSeparator: () => null,
|
|
165
|
+
Menu,
|
|
166
|
+
ValueContainer,
|
|
167
|
+
}}
|
|
168
|
+
styles={colourStyles}
|
|
169
|
+
unstyled={true}
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { SelectAccountCard }
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { DropdownSmallOld, CheckSmall } from '../Icon'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
components,
|
|
7
|
+
ControlProps,
|
|
8
|
+
OptionProps,
|
|
9
|
+
DropdownIndicatorProps,
|
|
10
|
+
StylesConfig,
|
|
11
|
+
SingleValueProps,
|
|
12
|
+
MenuProps,
|
|
13
|
+
PlaceholderProps,
|
|
14
|
+
ValueContainerProps,
|
|
15
|
+
InputProps,
|
|
16
|
+
LoadingIndicatorProps,
|
|
17
|
+
IndicatorsContainerProps,
|
|
18
|
+
} from 'react-select'
|
|
19
|
+
|
|
20
|
+
import AsyncSelect from 'react-select/async'
|
|
21
|
+
|
|
22
|
+
import { cn } from '../@/lib/utils'
|
|
23
|
+
|
|
24
|
+
const selectTriggerClasses: string =
|
|
25
|
+
'flex items-center border-[1px] border-input rounded-sm h-[44px] text-left px-[16px] py-[12px] cursor-pointer'
|
|
26
|
+
|
|
27
|
+
const colourStyles: StylesConfig = {
|
|
28
|
+
control: () => ({}),
|
|
29
|
+
option: () => ({}),
|
|
30
|
+
input: () => ({}),
|
|
31
|
+
dropdownIndicator: () => ({}),
|
|
32
|
+
indicatorsContainer: () => ({}),
|
|
33
|
+
menu: () => ({}),
|
|
34
|
+
menuList: () => ({}),
|
|
35
|
+
singleValue: () => ({}),
|
|
36
|
+
valueContainer: () => ({}),
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Input = ({...props }: InputProps) => {
|
|
40
|
+
return <components.Input className='col-start-1 col-end-3 row-start-1 row-end-2' {...props} />
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const Control = ({ children, ...props }: ControlProps) => {
|
|
44
|
+
const { isFocused } = props
|
|
45
|
+
return (
|
|
46
|
+
<components.Control
|
|
47
|
+
className={cn(selectTriggerClasses, { 'outline outline-primary outline-offset-2 outline-2': isFocused })}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</components.Control>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const optionClasses =
|
|
56
|
+
'flex items-center first:rounded-t-sm last:rounded-b-sm px-[16px] py-[12px] w-full cursor-default select-none outline-none'
|
|
57
|
+
|
|
58
|
+
const Option = ({ children, ...props }: OptionProps) => {
|
|
59
|
+
const {
|
|
60
|
+
isSelected,
|
|
61
|
+
isFocused,
|
|
62
|
+
isDisabled,
|
|
63
|
+
} = props
|
|
64
|
+
return (
|
|
65
|
+
<components.Option
|
|
66
|
+
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
<span className="flex basis-0 grow">{children}</span>
|
|
70
|
+
|
|
71
|
+
<span className="ml-[16px] w-[24px] h-[24px] shrink-0">
|
|
72
|
+
{isSelected && (
|
|
73
|
+
<CheckSmall
|
|
74
|
+
width="24"
|
|
75
|
+
height="24"
|
|
76
|
+
className="text-primary"
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
</span>
|
|
80
|
+
</components.Option>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const IndicatorsContainer = ({ children, ...props }: IndicatorsContainerProps) => {
|
|
85
|
+
return (
|
|
86
|
+
<components.IndicatorsContainer className='flex items-center gap-x-[8px] shrink-0' {...props}>
|
|
87
|
+
{children}
|
|
88
|
+
</components.IndicatorsContainer>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const LoadingIndicator = ({...props }: LoadingIndicatorProps) => {
|
|
93
|
+
return (
|
|
94
|
+
<components.LoadingIndicator
|
|
95
|
+
className='text-light shrink-0'
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
102
|
+
return (
|
|
103
|
+
<components.DropdownIndicator
|
|
104
|
+
className="shrink-0"
|
|
105
|
+
{...props}
|
|
106
|
+
>
|
|
107
|
+
<DropdownSmallOld
|
|
108
|
+
className="text-light"
|
|
109
|
+
width="12"
|
|
110
|
+
height="12"
|
|
111
|
+
/>
|
|
112
|
+
</components.DropdownIndicator>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
117
|
+
return (
|
|
118
|
+
<components.ValueContainer
|
|
119
|
+
className="flex-1 grid"
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
{children}
|
|
123
|
+
</components.ValueContainer>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
128
|
+
return (
|
|
129
|
+
<components.SingleValue
|
|
130
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
131
|
+
{...props}
|
|
132
|
+
>
|
|
133
|
+
{children}
|
|
134
|
+
</components.SingleValue>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const Menu = ({ children, ...props }: MenuProps) => {
|
|
139
|
+
return (
|
|
140
|
+
<components.Menu
|
|
141
|
+
className="z-[1] absolute inset-x-0 bg-page shadow-sm mt-[8px] rounded-sm"
|
|
142
|
+
{...props}
|
|
143
|
+
>
|
|
144
|
+
{children}
|
|
145
|
+
</components.Menu>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const Placeholder = ({ children, ...props }: PlaceholderProps) => {
|
|
150
|
+
return (
|
|
151
|
+
<components.Placeholder
|
|
152
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2 text-[16px] text-light truncate"
|
|
153
|
+
{...props}
|
|
154
|
+
>
|
|
155
|
+
{children}
|
|
156
|
+
</components.Placeholder>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const SelectAsync = ({ ...props }) => (
|
|
161
|
+
<AsyncSelect
|
|
162
|
+
components={{
|
|
163
|
+
Control,
|
|
164
|
+
Option,
|
|
165
|
+
SingleValue,
|
|
166
|
+
DropdownIndicator,
|
|
167
|
+
IndicatorSeparator: () => null,
|
|
168
|
+
Menu,
|
|
169
|
+
ValueContainer,
|
|
170
|
+
Placeholder,
|
|
171
|
+
Input,
|
|
172
|
+
LoadingIndicator,
|
|
173
|
+
IndicatorsContainer
|
|
174
|
+
}}
|
|
175
|
+
styles={colourStyles}
|
|
176
|
+
unstyled={true}
|
|
177
|
+
{...props}
|
|
178
|
+
/>
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
SelectAsync.displayName = 'SelectAsync'
|
|
182
|
+
|
|
183
|
+
export { SelectAsync }
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { DropdownSmallOld, CheckSmall } from '../Icon'
|
|
4
|
+
|
|
5
|
+
import Select, {
|
|
6
|
+
components,
|
|
7
|
+
ControlProps,
|
|
8
|
+
OptionProps,
|
|
9
|
+
DropdownIndicatorProps,
|
|
10
|
+
StylesConfig,
|
|
11
|
+
SingleValueProps,
|
|
12
|
+
MenuProps,
|
|
13
|
+
PlaceholderProps,
|
|
14
|
+
ValueContainerProps,
|
|
15
|
+
InputProps,
|
|
16
|
+
LoadingIndicatorProps,
|
|
17
|
+
IndicatorsContainerProps,
|
|
18
|
+
} from 'react-select'
|
|
19
|
+
|
|
20
|
+
import { cn } from '../@/lib/utils'
|
|
21
|
+
|
|
22
|
+
const selectTriggerClasses: string =
|
|
23
|
+
'flex items-center border-[1px] border-input rounded-sm h-[44px] text-left px-[16px] py-[12px] cursor-pointer'
|
|
24
|
+
|
|
25
|
+
const colourStyles: StylesConfig = {
|
|
26
|
+
control: () => ({}),
|
|
27
|
+
option: () => ({}),
|
|
28
|
+
input: () => ({}),
|
|
29
|
+
dropdownIndicator: () => ({}),
|
|
30
|
+
indicatorsContainer: () => ({}),
|
|
31
|
+
menu: () => ({}),
|
|
32
|
+
menuList: () => ({}),
|
|
33
|
+
singleValue: () => ({}),
|
|
34
|
+
valueContainer: () => ({}),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const Input = ({...props }: InputProps) => {
|
|
38
|
+
return <components.Input className='col-start-1 col-end-3 row-start-1 row-end-2' {...props} />
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const Control = ({ children, ...props }: ControlProps) => {
|
|
42
|
+
const { isFocused } = props
|
|
43
|
+
return (
|
|
44
|
+
<components.Control
|
|
45
|
+
className={cn(selectTriggerClasses, { 'outline outline-primary outline-offset-2 outline-2': isFocused })}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</components.Control>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const optionClasses =
|
|
54
|
+
'flex items-center first:rounded-t-sm last:rounded-b-sm px-[16px] py-[12px] w-full cursor-default select-none outline-none'
|
|
55
|
+
|
|
56
|
+
const Option = ({ children, ...props }: OptionProps) => {
|
|
57
|
+
const {
|
|
58
|
+
isSelected,
|
|
59
|
+
isFocused,
|
|
60
|
+
isDisabled,
|
|
61
|
+
} = props
|
|
62
|
+
return (
|
|
63
|
+
<components.Option
|
|
64
|
+
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
<span className="flex basis-0 grow">{children}</span>
|
|
68
|
+
|
|
69
|
+
<span className="ml-[16px] w-[24px] h-[24px] shrink-0">
|
|
70
|
+
{isSelected && (
|
|
71
|
+
<CheckSmall
|
|
72
|
+
width="24"
|
|
73
|
+
height="24"
|
|
74
|
+
className="text-primary"
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
</span>
|
|
78
|
+
</components.Option>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const IndicatorsContainer = ({ children, ...props }: IndicatorsContainerProps) => {
|
|
83
|
+
return (
|
|
84
|
+
<components.IndicatorsContainer className='flex items-center gap-x-[8px] shrink-0' {...props}>
|
|
85
|
+
{children}
|
|
86
|
+
</components.IndicatorsContainer>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const LoadingIndicator = ({...props }: LoadingIndicatorProps) => {
|
|
91
|
+
return (
|
|
92
|
+
<components.LoadingIndicator
|
|
93
|
+
className='text-light shrink-0'
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
100
|
+
return (
|
|
101
|
+
<components.DropdownIndicator
|
|
102
|
+
className="shrink-0"
|
|
103
|
+
{...props}
|
|
104
|
+
>
|
|
105
|
+
<DropdownSmallOld
|
|
106
|
+
className="text-light"
|
|
107
|
+
width="12"
|
|
108
|
+
height="12"
|
|
109
|
+
/>
|
|
110
|
+
</components.DropdownIndicator>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
115
|
+
return (
|
|
116
|
+
<components.ValueContainer
|
|
117
|
+
className="flex-1 grid"
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
{children}
|
|
121
|
+
</components.ValueContainer>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
126
|
+
return (
|
|
127
|
+
<components.SingleValue
|
|
128
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
129
|
+
{...props}
|
|
130
|
+
>
|
|
131
|
+
{children}
|
|
132
|
+
</components.SingleValue>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const Menu = ({ children, ...props }: MenuProps) => {
|
|
137
|
+
return (
|
|
138
|
+
<components.Menu
|
|
139
|
+
className="z-[1] absolute inset-x-0 bg-page shadow-sm mt-[8px] rounded-sm"
|
|
140
|
+
{...props}
|
|
141
|
+
>
|
|
142
|
+
{children}
|
|
143
|
+
</components.Menu>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const Placeholder = ({ children, ...props }: PlaceholderProps) => {
|
|
148
|
+
return (
|
|
149
|
+
<components.Placeholder
|
|
150
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2 text-[16px] text-light truncate"
|
|
151
|
+
{...props}
|
|
152
|
+
>
|
|
153
|
+
{children}
|
|
154
|
+
</components.Placeholder>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const SelectBase = (props) => (
|
|
159
|
+
<Select
|
|
160
|
+
components={{
|
|
161
|
+
Control,
|
|
162
|
+
Option,
|
|
163
|
+
SingleValue,
|
|
164
|
+
DropdownIndicator,
|
|
165
|
+
IndicatorSeparator: () => null,
|
|
166
|
+
Menu,
|
|
167
|
+
ValueContainer,
|
|
168
|
+
Placeholder,
|
|
169
|
+
Input,
|
|
170
|
+
LoadingIndicator,
|
|
171
|
+
IndicatorsContainer
|
|
172
|
+
}}
|
|
173
|
+
styles={colourStyles}
|
|
174
|
+
unstyled={true}
|
|
175
|
+
{...props}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
SelectBase.displayName = 'SelectBase'
|
|
180
|
+
|
|
181
|
+
export { SelectBase }
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const rootClasses = `
|
|
8
|
+
inline-flex items-center bg-light
|
|
9
|
+
data-[state=checked]:bg-primary data-[state=unchecked]:bg-input
|
|
10
|
+
disabled:opacity-50 shadow-sm rounded-full
|
|
11
|
+
focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
12
|
+
w-[32px] h-[18px]
|
|
13
|
+
transition-colors cursor-pointer
|
|
14
|
+
disabled:cursor-not-allowed peer shrink-0
|
|
15
|
+
focus-visible:outline-none
|
|
16
|
+
`
|
|
17
|
+
const ThumbClasses = `
|
|
18
|
+
border-2 border-input data-[state=checked]:border-primary
|
|
19
|
+
bg-page shadow-md rounded-full ring-0
|
|
20
|
+
w-[18px] h-[18px]
|
|
21
|
+
transition-transform
|
|
22
|
+
data-[state=checked]:translate-x-[14px] data-[state=unchecked]:translate-x-0
|
|
23
|
+
pointer-events-none
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
const Switch = React.forwardRef<
|
|
27
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<SwitchPrimitives.Root
|
|
31
|
+
className={cn(
|
|
32
|
+
rootClasses,
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
ref={ref}
|
|
37
|
+
>
|
|
38
|
+
<span className=""></span>
|
|
39
|
+
<SwitchPrimitives.Thumb
|
|
40
|
+
className={ThumbClasses}
|
|
41
|
+
/>
|
|
42
|
+
</SwitchPrimitives.Root>
|
|
43
|
+
))
|
|
44
|
+
|
|
45
|
+
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
46
|
+
|
|
47
|
+
export { Switch }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from './Switch'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../@/lib/utils"
|
|
4
|
+
|
|
5
|
+
export interface TextareaProps
|
|
6
|
+
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
|
7
|
+
|
|
8
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
9
|
+
({ className, ...props }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<textarea
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 placeholder:text-light focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
ref={ref}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
Textarea.displayName = "Textarea"
|
|
23
|
+
|
|
24
|
+
export { Textarea }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Textarea } from './Textarea'
|
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
@tailwind utilities;
|
|
4
4
|
|
|
5
5
|
@layer base {
|
|
6
|
+
html,
|
|
7
|
+
body {
|
|
8
|
+
height: 100%;
|
|
9
|
+
min-height: 100%;
|
|
10
|
+
color: var(--text-base)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
margin: 0;
|
|
15
|
+
/* max-width: 640px; */
|
|
16
|
+
min-width: 320px;
|
|
17
|
+
-webkit-overflow-scrolling: touch;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@supports (-webkit-touch-callout: none) {
|
|
21
|
+
html,
|
|
22
|
+
body {
|
|
23
|
+
height: -webkit-fill-available;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
6
26
|
|
|
7
27
|
@font-face {
|
|
8
28
|
font-weight: 100 900;
|
|
@@ -130,6 +150,7 @@
|
|
|
130
150
|
/* =========================================== */
|
|
131
151
|
/* ЦВЕТ КНОПОК */
|
|
132
152
|
|
|
153
|
+
|
|
133
154
|
/* ЦВЕТ ПОЛЯ ВВОДА */
|
|
134
155
|
/* =========================================== */
|
|
135
156
|
|
|
@@ -137,6 +158,7 @@
|
|
|
137
158
|
/* =========================================== */
|
|
138
159
|
/* ЦВЕТ ПОЛЯ ВВОДА */
|
|
139
160
|
|
|
161
|
+
|
|
140
162
|
/* BORDER */
|
|
141
163
|
/* =========================================== */
|
|
142
164
|
--border-color: var(--cl-graphite-5);
|
|
@@ -151,15 +173,6 @@
|
|
|
151
173
|
--shadow-md: 0 2px 10px rgba(36, 48, 54, 0.12);
|
|
152
174
|
/* =========================================== */
|
|
153
175
|
/* SHADOWS */
|
|
154
|
-
|
|
155
|
-
/* PROGRESS */
|
|
156
|
-
/* =========================================== */
|
|
157
|
-
--progress-height: 4px;
|
|
158
|
-
--progress-bg: var(--cl-graphite-6);
|
|
159
|
-
/* =========================================== */
|
|
160
|
-
/* PROGRESS */
|
|
161
|
-
|
|
162
|
-
|
|
163
176
|
}
|
|
164
177
|
|
|
165
178
|
|