@modul/mbui 0.0.20-beta-pv-53154-4403aebc → 0.0.21-beta-test-8a4f2b68
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/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +3 -3
- package/dist/Switch/Switch.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 +2 -2
- 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/Switch/Switch.tsx +15 -21
- package/src/index.ts +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -19,11 +19,10 @@ import { Alert } from './Alert';
|
|
|
19
19
|
import { Switch } from './Switch';
|
|
20
20
|
import { Label } from './Label';
|
|
21
21
|
import { Textarea } from './Textarea';
|
|
22
|
-
import { SelectAccountCard, SelectAsync } from './Select';
|
|
22
|
+
import { SelectAccountCard, SelectAsync, SelectAccount, Select } from './Select';
|
|
23
23
|
import { Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage } from './Form';
|
|
24
24
|
import { Calendar } from './Calendar';
|
|
25
25
|
import { DatePicker } from './DatePicker';
|
|
26
|
-
import { Select } from './Select';
|
|
27
26
|
import { Progress } from './Progress';
|
|
28
27
|
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel } from './AlertDialog';
|
|
29
28
|
import { MessageTyping } from "./Chat";
|
|
@@ -31,4 +30,4 @@ import { FavoritePaymentsList, FavoritePaymentsItem, FarvoritePaymentDescription
|
|
|
31
30
|
import { DigitKeyPad } from "./DigitKeyPad";
|
|
32
31
|
import { Badge, badgeVariants } from './Badge';
|
|
33
32
|
import { Toaster, toast } from './Toaster';
|
|
34
|
-
export { Tooltip, Tabs, Slider, Popover, Logo, InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, Collapsible, CollapsibleTrigger, CollapsibleContent, AccountCollapsible, AccountCollapsibleHeader, AccountCollapsibleTrigger, AccountCollapsibleContent, AccountCollapsibleContentItem, Button, buttonVariants, InputField, InputLabel, Audio, cn, Icon, Drawer, DrawerTrigger, DrawerTitle, DrawerClose, DrawerContent, BottomNavigation, BottomNavigationList, BottomNavigationListItem, BottomNavigationLink, Page, Chip, Progress, Alert, Switch, Label, Textarea, SelectAccountCard, Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage, Calendar, DatePicker,
|
|
33
|
+
export { Tooltip, Tabs, Slider, Popover, Logo, InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, Collapsible, CollapsibleTrigger, CollapsibleContent, AccountCollapsible, AccountCollapsibleHeader, AccountCollapsibleTrigger, AccountCollapsibleContent, AccountCollapsibleContentItem, Button, buttonVariants, InputField, InputLabel, Audio, cn, Icon, Drawer, DrawerTrigger, DrawerTitle, DrawerClose, DrawerContent, BottomNavigation, BottomNavigationList, BottomNavigationListItem, BottomNavigationLink, Page, Chip, Progress, Alert, Switch, Label, Textarea, SelectAccountCard, SelectAccount, SelectAsync, Select, Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage, Calendar, DatePicker, InputMask, AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, MessageTyping, FavoritePaymentsList, FavoritePaymentsItem, FarvoritePaymentDescription, farvoriteLinkClasses, Badge, badgeVariants, DigitKeyPad, ButtonWidget, Toaster, toast, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.toast = exports.Toaster = exports.ButtonWidget = exports.DigitKeyPad = exports.badgeVariants = exports.Badge = exports.farvoriteLinkClasses = exports.FarvoritePaymentDescription = exports.FavoritePaymentsItem = exports.FavoritePaymentsList = exports.MessageTyping = exports.AlertDialogCancel = exports.AlertDialogAction = exports.AlertDialogDescription = exports.AlertDialogTitle = exports.AlertDialogFooter = exports.AlertDialogHeader = exports.AlertDialogContent = exports.AlertDialogTrigger = exports.AlertDialog = exports.
|
|
3
|
+
exports.FormDescription = exports.FormControl = exports.FormItem = exports.FormField = exports.FormLabel = exports.Form = exports.Select = exports.SelectAsync = exports.SelectAccount = exports.SelectAccountCard = exports.Textarea = exports.Label = exports.Switch = exports.Alert = exports.Progress = exports.Chip = exports.Page = exports.BottomNavigationLink = exports.BottomNavigationListItem = exports.BottomNavigationList = exports.BottomNavigation = exports.DrawerContent = exports.DrawerClose = exports.DrawerTitle = exports.DrawerTrigger = exports.Drawer = exports.Icon = exports.cn = exports.Audio = exports.InputLabel = exports.InputField = exports.buttonVariants = exports.Button = exports.AccountCollapsibleContentItem = exports.AccountCollapsibleContent = exports.AccountCollapsibleTrigger = exports.AccountCollapsibleHeader = exports.AccountCollapsible = exports.CollapsibleContent = exports.CollapsibleTrigger = exports.Collapsible = exports.InputOTPSeparator = exports.InputOTPSlot = exports.InputOTPGroup = exports.InputOTP = exports.Logo = exports.Popover = exports.Slider = exports.Tabs = exports.Tooltip = void 0;
|
|
4
|
+
exports.toast = exports.Toaster = exports.ButtonWidget = exports.DigitKeyPad = exports.badgeVariants = exports.Badge = exports.farvoriteLinkClasses = exports.FarvoritePaymentDescription = exports.FavoritePaymentsItem = exports.FavoritePaymentsList = exports.MessageTyping = exports.AlertDialogCancel = exports.AlertDialogAction = exports.AlertDialogDescription = exports.AlertDialogTitle = exports.AlertDialogFooter = exports.AlertDialogHeader = exports.AlertDialogContent = exports.AlertDialogTrigger = exports.AlertDialog = exports.InputMask = exports.DatePicker = exports.Calendar = exports.FormMessage = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const Tooltip_1 = require("./Tooltip");
|
|
7
7
|
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
|
|
@@ -68,6 +68,8 @@ Object.defineProperty(exports, "Textarea", { enumerable: true, get: function ()
|
|
|
68
68
|
const Select_1 = require("./Select");
|
|
69
69
|
Object.defineProperty(exports, "SelectAccountCard", { enumerable: true, get: function () { return Select_1.SelectAccountCard; } });
|
|
70
70
|
Object.defineProperty(exports, "SelectAsync", { enumerable: true, get: function () { return Select_1.SelectAsync; } });
|
|
71
|
+
Object.defineProperty(exports, "SelectAccount", { enumerable: true, get: function () { return Select_1.SelectAccount; } });
|
|
72
|
+
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return Select_1.Select; } });
|
|
71
73
|
const Form_1 = require("./Form");
|
|
72
74
|
Object.defineProperty(exports, "Form", { enumerable: true, get: function () { return Form_1.Form; } });
|
|
73
75
|
Object.defineProperty(exports, "FormLabel", { enumerable: true, get: function () { return Form_1.FormLabel; } });
|
|
@@ -80,8 +82,6 @@ const Calendar_1 = require("./Calendar");
|
|
|
80
82
|
Object.defineProperty(exports, "Calendar", { enumerable: true, get: function () { return Calendar_1.Calendar; } });
|
|
81
83
|
const DatePicker_1 = require("./DatePicker");
|
|
82
84
|
Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return DatePicker_1.DatePicker; } });
|
|
83
|
-
const Select_2 = require("./Select");
|
|
84
|
-
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return Select_2.Select; } });
|
|
85
85
|
const Progress_1 = require("./Progress");
|
|
86
86
|
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return Progress_1.Progress; } });
|
|
87
87
|
const AlertDialog_1 = require("./AlertDialog");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,uCAAmC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,uCAAmC;AAuDlC,wFAvDQ,iBAAO,OAuDR;AAtDR,iCAA6B;AAuD5B,qFAvDQ,WAAI,OAuDR;AAtDL,qCAAiC;AAuDhC,uFAvDQ,eAAM,OAuDR;AAtDP,uCAAmC;AAuDlC,wFAvDQ,iBAAO,OAuDR;AAtDR,+DAAyB;AAuDxB,eAvDM,cAAI,CAuDN;AAtDL,2CAAsF;AAuDrF,yFAvDQ,oBAAQ,OAuDR;AACR,8FAxDkB,yBAAa,OAwDlB;AACb,6FAzDiC,wBAAY,OAyDjC;AACZ,kGA1D+C,6BAAiB,OA0D/C;AAzDlB,yDAK2B;AAyE1B,iGA7EA,mCAAgB,OA6EA;AAChB,qGA7EA,uCAAoB,OA6EA;AACpB,yGA7EA,2CAAwB,OA6EA;AACxB,qGA7EA,uCAAoB,OA6EA;AA3ErB,0D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"types": "./dist/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@radix-ui/react-select": "2.1.1",
|
|
33
33
|
"@radix-ui/react-slider": "^1.2.0",
|
|
34
34
|
"@radix-ui/react-slot": "1.1.0",
|
|
35
|
-
"@radix-ui/react-switch": "1.1.
|
|
35
|
+
"@radix-ui/react-switch": "1.1.1",
|
|
36
36
|
"@radix-ui/react-tabs": "^1.1.0",
|
|
37
37
|
"@radix-ui/react-tooltip": "^1.1.2",
|
|
38
38
|
"@types/lodash": "4.17.5",
|
package/src/Icon/icons/Share.tsx
CHANGED
|
@@ -3,15 +3,15 @@ import type { SVGProps } from 'react'
|
|
|
3
3
|
import { SvgIcon } from '../SvgIcon'
|
|
4
4
|
const SvgShare = (props: SVGProps<SVGSVGElement>) => (
|
|
5
5
|
<SvgIcon
|
|
6
|
-
width={
|
|
7
|
-
height={
|
|
6
|
+
width={24}
|
|
7
|
+
height={24}
|
|
8
8
|
fill="none"
|
|
9
|
-
viewBox="0 0
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
10
|
{...props}
|
|
11
11
|
>
|
|
12
12
|
<path
|
|
13
13
|
fill="currentColor"
|
|
14
|
-
d="
|
|
14
|
+
d="M19 23H5c-1.1 0-2-.9-2-2V10c0-1.1.9-2 2-2h3c.55 0 1 .45 1 1s-.45 1-1 1H5v11h14V10h-3c-.55 0-1-.45-1-1s.45-1 1-1h3c1.1 0 2 .9 2 2v11c0 1.1-.9 2-2 2ZM15.71 4.29l-3-3a.9959.9959 0 0 0-1.41 0l-3 3c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L11 4.41V15c0 .55.45 1 1 1s1-.45 1-1V4.41l1.29 1.29c.39.39 1.02.39 1.41 0 .4-.38.4-1.02.01-1.41Z"
|
|
15
15
|
/>
|
|
16
16
|
</SvgIcon>
|
|
17
17
|
)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { CheckSmall } from '../../src/Icon'
|
|
3
|
+
import Select, { components, OptionProps, SingleValueProps, GroupBase, Props } from 'react-select'
|
|
4
|
+
import { cn } from '../@/lib/utils'
|
|
5
|
+
import {
|
|
6
|
+
colourStyles,
|
|
7
|
+
Control,
|
|
8
|
+
DropdownIndicator,
|
|
9
|
+
IndicatorsContainer,
|
|
10
|
+
Input,
|
|
11
|
+
LoadingIndicator,
|
|
12
|
+
Menu,
|
|
13
|
+
optionClasses,
|
|
14
|
+
Placeholder,
|
|
15
|
+
ValueContainer,
|
|
16
|
+
} from './components'
|
|
17
|
+
|
|
18
|
+
const Option = ({ children, ...props }: OptionProps) => {
|
|
19
|
+
const {
|
|
20
|
+
isSelected,
|
|
21
|
+
isFocused,
|
|
22
|
+
isDisabled,
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
data: { label, account, balance, cur },
|
|
25
|
+
} = props
|
|
26
|
+
return (
|
|
27
|
+
<components.Option
|
|
28
|
+
className={cn(optionClasses, 'items-start', { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
<span className="flex basis-0 grow">
|
|
32
|
+
<span>
|
|
33
|
+
<span className="text-[16px`] leading-[1.375]">{label}</span>
|
|
34
|
+
<br />
|
|
35
|
+
<span className="text-[12px] text-light">{account}</span>
|
|
36
|
+
</span>
|
|
37
|
+
<span className="ml-auto shrink-0">{cur}</span>
|
|
38
|
+
</span>
|
|
39
|
+
|
|
40
|
+
<span className="ml-[16px] shrink-0 size-[24px]">
|
|
41
|
+
{isSelected && (
|
|
42
|
+
<CheckSmall
|
|
43
|
+
width="24"
|
|
44
|
+
height="24"
|
|
45
|
+
className="text-primary"
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
</span>
|
|
49
|
+
</components.Option>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
54
|
+
const {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
data: { account, cur },
|
|
57
|
+
} = props
|
|
58
|
+
return (
|
|
59
|
+
<components.SingleValue
|
|
60
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
{account} ({cur})
|
|
64
|
+
</components.SingleValue>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type SelectAccountProps<
|
|
69
|
+
Option,
|
|
70
|
+
IsMulti extends boolean = false,
|
|
71
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
72
|
+
> = Props<Option, IsMulti, Group>
|
|
73
|
+
|
|
74
|
+
function SelectAccount<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(
|
|
75
|
+
props: SelectAccountProps<Option, IsMulti, Group>
|
|
76
|
+
) {
|
|
77
|
+
return (
|
|
78
|
+
<Select
|
|
79
|
+
components={{
|
|
80
|
+
Control,
|
|
81
|
+
Option,
|
|
82
|
+
SingleValue,
|
|
83
|
+
DropdownIndicator,
|
|
84
|
+
IndicatorSeparator: () => null,
|
|
85
|
+
Menu,
|
|
86
|
+
ValueContainer,
|
|
87
|
+
Placeholder,
|
|
88
|
+
Input,
|
|
89
|
+
LoadingIndicator,
|
|
90
|
+
IndicatorsContainer,
|
|
91
|
+
}}
|
|
92
|
+
styles={colourStyles}
|
|
93
|
+
unstyled={true}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
SelectAccount.displayName = 'SelectAccount'
|
|
100
|
+
|
|
101
|
+
export { SelectAccount }
|
|
@@ -5,14 +5,12 @@ import Select, {
|
|
|
5
5
|
ControlProps,
|
|
6
6
|
OptionProps,
|
|
7
7
|
DropdownIndicatorProps,
|
|
8
|
-
StylesConfig,
|
|
9
8
|
SingleValueProps,
|
|
10
|
-
MenuProps,
|
|
11
|
-
ValueContainerProps,
|
|
12
9
|
Props,
|
|
13
10
|
GroupBase,
|
|
14
11
|
} from 'react-select'
|
|
15
12
|
import { cn } from '../@/lib/utils'
|
|
13
|
+
import { colourStyles, Menu, optionClasses, ValueContainer } from './components'
|
|
16
14
|
|
|
17
15
|
const selectTriggerClasses: string = `
|
|
18
16
|
flex
|
|
@@ -30,19 +28,6 @@ const selectTriggerClasses: string = `
|
|
|
30
28
|
shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)]
|
|
31
29
|
cursor-pointer
|
|
32
30
|
`
|
|
33
|
-
|
|
34
|
-
const colourStyles: StylesConfig = {
|
|
35
|
-
control: () => ({}),
|
|
36
|
-
option: () => ({}),
|
|
37
|
-
input: () => ({}),
|
|
38
|
-
dropdownIndicator: () => ({}),
|
|
39
|
-
indicatorsContainer: () => ({}),
|
|
40
|
-
menu: () => ({}),
|
|
41
|
-
menuList: () => ({}),
|
|
42
|
-
singleValue: () => ({}),
|
|
43
|
-
valueContainer: () => ({}),
|
|
44
|
-
}
|
|
45
|
-
|
|
46
31
|
const Control = ({ children, ...props }: ControlProps) => {
|
|
47
32
|
const { isFocused } = props
|
|
48
33
|
return (
|
|
@@ -58,19 +43,6 @@ const Control = ({ children, ...props }: ControlProps) => {
|
|
|
58
43
|
)
|
|
59
44
|
}
|
|
60
45
|
|
|
61
|
-
const optionClasses = `
|
|
62
|
-
flex
|
|
63
|
-
items-center
|
|
64
|
-
py-[16px]
|
|
65
|
-
px-[12px]
|
|
66
|
-
w-full
|
|
67
|
-
first:rounded-t-md
|
|
68
|
-
last:rounded-b-md
|
|
69
|
-
cursor-default
|
|
70
|
-
select-none
|
|
71
|
-
outline-none
|
|
72
|
-
`
|
|
73
|
-
|
|
74
46
|
const Option = ({ children, ...props }: OptionProps) => {
|
|
75
47
|
const {
|
|
76
48
|
isSelected,
|
|
@@ -123,17 +95,6 @@ const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
|
123
95
|
)
|
|
124
96
|
}
|
|
125
97
|
|
|
126
|
-
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
127
|
-
return (
|
|
128
|
-
<components.ValueContainer
|
|
129
|
-
className="flex-1 grid"
|
|
130
|
-
{...props}
|
|
131
|
-
>
|
|
132
|
-
{children}
|
|
133
|
-
</components.ValueContainer>
|
|
134
|
-
)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
98
|
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
138
99
|
// @ts-ignore
|
|
139
100
|
const { label, account, balance, cur } = props.data
|
|
@@ -152,17 +113,6 @@ const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
|
152
113
|
)
|
|
153
114
|
}
|
|
154
115
|
|
|
155
|
-
const Menu = ({ children, ...props }: MenuProps) => {
|
|
156
|
-
return (
|
|
157
|
-
<components.Menu
|
|
158
|
-
className="z-[1] absolute inset-x-0 bg-page shadow-md mt-[8px] rounded-md"
|
|
159
|
-
{...props}
|
|
160
|
-
>
|
|
161
|
-
{children}
|
|
162
|
-
</components.Menu>
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
116
|
type SelectAccountCardProps<
|
|
167
117
|
Option,
|
|
168
118
|
IsMulti extends boolean = false,
|
|
@@ -1,167 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { DropdownSmallOld, CheckSmall } from '../../src/Icon'
|
|
3
|
-
import {
|
|
4
|
-
components,
|
|
5
|
-
ControlProps,
|
|
6
|
-
OptionProps,
|
|
7
|
-
DropdownIndicatorProps,
|
|
8
|
-
StylesConfig,
|
|
9
|
-
SingleValueProps,
|
|
10
|
-
MenuProps,
|
|
11
|
-
PlaceholderProps,
|
|
12
|
-
ValueContainerProps,
|
|
13
|
-
InputProps,
|
|
14
|
-
LoadingIndicatorProps,
|
|
15
|
-
IndicatorsContainerProps,
|
|
16
|
-
} from 'react-select'
|
|
17
2
|
import AsyncSelect from 'react-select/async'
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
const selectTriggerClasses: string = `
|
|
21
|
-
flex
|
|
22
|
-
items-center
|
|
23
|
-
py-[12px]
|
|
24
|
-
px-[16px]
|
|
25
|
-
h-[44px]
|
|
26
|
-
border-[1px]
|
|
27
|
-
border-input
|
|
28
|
-
rounded-sm
|
|
29
|
-
text-left
|
|
30
|
-
cursor-pointer
|
|
31
|
-
`
|
|
32
|
-
|
|
33
|
-
const colourStyles: StylesConfig = {
|
|
34
|
-
control: () => ({}),
|
|
35
|
-
option: () => ({}),
|
|
36
|
-
input: () => ({}),
|
|
37
|
-
dropdownIndicator: () => ({}),
|
|
38
|
-
indicatorsContainer: () => ({}),
|
|
39
|
-
menu: () => ({}),
|
|
40
|
-
menuList: () => ({}),
|
|
41
|
-
singleValue: () => ({}),
|
|
42
|
-
valueContainer: () => ({}),
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const Input = ({...props }: InputProps) => {
|
|
46
|
-
return <components.Input className='col-start-1 col-end-3 row-start-1 row-end-2' {...props} />
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const Control = ({ children, ...props }: ControlProps) => {
|
|
50
|
-
const { isFocused } = props
|
|
51
|
-
return (
|
|
52
|
-
<components.Control
|
|
53
|
-
className={cn(selectTriggerClasses, { 'outline outline-primary outline-offset-2 outline-2': isFocused })}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
{children}
|
|
57
|
-
</components.Control>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const optionClasses =
|
|
62
|
-
'flex items-center first:rounded-t-sm last:rounded-b-sm px-[16px] py-[12px] w-full cursor-default select-none outline-none'
|
|
63
|
-
|
|
64
|
-
const Option = ({ children, ...props }: OptionProps) => {
|
|
65
|
-
const {
|
|
66
|
-
isSelected,
|
|
67
|
-
isFocused,
|
|
68
|
-
isDisabled,
|
|
69
|
-
} = props
|
|
70
|
-
return (
|
|
71
|
-
<components.Option
|
|
72
|
-
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
<span className="flex basis-0 grow">{children}</span>
|
|
76
|
-
|
|
77
|
-
<span className="ml-[16px] shrink-0 size-[24px]">
|
|
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 IndicatorsContainer = ({ children, ...props }: IndicatorsContainerProps) => {
|
|
91
|
-
return (
|
|
92
|
-
<components.IndicatorsContainer className='flex items-center gap-x-[8px] shrink-0' {...props}>
|
|
93
|
-
{children}
|
|
94
|
-
</components.IndicatorsContainer>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const LoadingIndicator = ({...props }: LoadingIndicatorProps) => {
|
|
99
|
-
return (
|
|
100
|
-
<components.LoadingIndicator
|
|
101
|
-
className='text-light shrink-0'
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
108
|
-
return (
|
|
109
|
-
<components.DropdownIndicator
|
|
110
|
-
className="shrink-0"
|
|
111
|
-
{...props}
|
|
112
|
-
>
|
|
113
|
-
<DropdownSmallOld
|
|
114
|
-
className="text-light"
|
|
115
|
-
width="12"
|
|
116
|
-
height="12"
|
|
117
|
-
/>
|
|
118
|
-
</components.DropdownIndicator>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
123
|
-
return (
|
|
124
|
-
<components.ValueContainer
|
|
125
|
-
className="flex-1 grid"
|
|
126
|
-
{...props}
|
|
127
|
-
>
|
|
128
|
-
{children}
|
|
129
|
-
</components.ValueContainer>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
134
|
-
return (
|
|
135
|
-
<components.SingleValue
|
|
136
|
-
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
137
|
-
{...props}
|
|
138
|
-
>
|
|
139
|
-
{children}
|
|
140
|
-
</components.SingleValue>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const Menu = ({ children, ...props }: MenuProps) => {
|
|
145
|
-
return (
|
|
146
|
-
<components.Menu
|
|
147
|
-
className="z-[1] absolute inset-x-0 bg-page shadow-sm mt-[8px] rounded-sm"
|
|
148
|
-
{...props}
|
|
149
|
-
>
|
|
150
|
-
{children}
|
|
151
|
-
</components.Menu>
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const Placeholder = ({ children, ...props }: PlaceholderProps) => {
|
|
156
|
-
return (
|
|
157
|
-
<components.Placeholder
|
|
158
|
-
className="col-start-1 col-end-3 row-start-1 row-end-2 text-[16px] text-light truncate"
|
|
159
|
-
{...props}
|
|
160
|
-
>
|
|
161
|
-
{children}
|
|
162
|
-
</components.Placeholder>
|
|
163
|
-
)
|
|
164
|
-
}
|
|
3
|
+
import { colourStyles, Control, DropdownIndicator, IndicatorsContainer, Input, LoadingIndicator, Menu, Option, Placeholder, SingleValue, ValueContainer } from './components'
|
|
165
4
|
|
|
166
5
|
const SelectAsync = ({ ...props }) => (
|
|
167
6
|
<AsyncSelect
|
|
@@ -1,169 +1,22 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
|
|
3
|
-
import { DropdownSmallOld, CheckSmall } from '../../src/Icon'
|
|
4
|
-
|
|
5
3
|
import Select, {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
OptionProps,
|
|
9
|
-
DropdownIndicatorProps,
|
|
10
|
-
StylesConfig,
|
|
11
|
-
SingleValueProps,
|
|
12
|
-
MenuProps,
|
|
13
|
-
PlaceholderProps,
|
|
14
|
-
ValueContainerProps,
|
|
15
|
-
InputProps,
|
|
16
|
-
LoadingIndicatorProps,
|
|
17
|
-
IndicatorsContainerProps, GroupBase, Props,
|
|
4
|
+
GroupBase,
|
|
5
|
+
Props,
|
|
18
6
|
} from 'react-select'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cursor-pointer
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
const colourStyles: StylesConfig = {
|
|
36
|
-
control: () => ({}),
|
|
37
|
-
option: () => ({}),
|
|
38
|
-
input: () => ({}),
|
|
39
|
-
dropdownIndicator: () => ({}),
|
|
40
|
-
indicatorsContainer: () => ({}),
|
|
41
|
-
menu: () => ({}),
|
|
42
|
-
menuList: () => ({}),
|
|
43
|
-
singleValue: () => ({}),
|
|
44
|
-
valueContainer: () => ({}),
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const Input = ({...props }: InputProps) => {
|
|
48
|
-
return <components.Input className='col-start-1 col-end-3 row-start-1 row-end-2' {...props} />
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const Control = ({ children, ...props }: ControlProps) => {
|
|
52
|
-
const { isFocused } = props
|
|
53
|
-
return (
|
|
54
|
-
<components.Control
|
|
55
|
-
className={cn(selectTriggerClasses, { 'outline outline-primary outline-offset-2 outline-2': isFocused })}
|
|
56
|
-
{...props}
|
|
57
|
-
>
|
|
58
|
-
{children}
|
|
59
|
-
</components.Control>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const optionClasses =
|
|
64
|
-
'flex items-center first:rounded-t-sm last:rounded-b-sm px-[16px] py-[12px] w-full cursor-default select-none outline-none'
|
|
65
|
-
|
|
66
|
-
const Option = ({ children, ...props }: OptionProps) => {
|
|
67
|
-
const {
|
|
68
|
-
isSelected,
|
|
69
|
-
isFocused,
|
|
70
|
-
isDisabled,
|
|
71
|
-
} = props
|
|
72
|
-
return (
|
|
73
|
-
<components.Option
|
|
74
|
-
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
75
|
-
{...props}
|
|
76
|
-
>
|
|
77
|
-
<span className="flex basis-0 grow">{children}</span>
|
|
78
|
-
|
|
79
|
-
<span className="ml-[16px] shrink-0 size-[24px]">
|
|
80
|
-
{isSelected && (
|
|
81
|
-
<CheckSmall
|
|
82
|
-
width="24"
|
|
83
|
-
height="24"
|
|
84
|
-
className="text-primary"
|
|
85
|
-
/>
|
|
86
|
-
)}
|
|
87
|
-
</span>
|
|
88
|
-
</components.Option>
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const IndicatorsContainer = ({ children, ...props }: IndicatorsContainerProps) => {
|
|
93
|
-
return (
|
|
94
|
-
<components.IndicatorsContainer className='flex items-center gap-x-[8px] shrink-0' {...props}>
|
|
95
|
-
{children}
|
|
96
|
-
</components.IndicatorsContainer>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const LoadingIndicator = ({...props }: LoadingIndicatorProps) => {
|
|
101
|
-
return (
|
|
102
|
-
<components.LoadingIndicator
|
|
103
|
-
className='text-light shrink-0'
|
|
104
|
-
{...props}
|
|
105
|
-
/>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
110
|
-
return (
|
|
111
|
-
<components.DropdownIndicator
|
|
112
|
-
className="shrink-0"
|
|
113
|
-
{...props}
|
|
114
|
-
>
|
|
115
|
-
<DropdownSmallOld
|
|
116
|
-
className="text-light"
|
|
117
|
-
width="12"
|
|
118
|
-
height="12"
|
|
119
|
-
/>
|
|
120
|
-
</components.DropdownIndicator>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const ValueContainer = ({ children, ...props }: ValueContainerProps) => {
|
|
125
|
-
return (
|
|
126
|
-
<components.ValueContainer
|
|
127
|
-
className="flex-1 grid"
|
|
128
|
-
{...props}
|
|
129
|
-
>
|
|
130
|
-
{children}
|
|
131
|
-
</components.ValueContainer>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
136
|
-
return (
|
|
137
|
-
<components.SingleValue
|
|
138
|
-
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
139
|
-
{...props}
|
|
140
|
-
>
|
|
141
|
-
{children}
|
|
142
|
-
</components.SingleValue>
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const Menu = ({ children, ...props }: MenuProps) => {
|
|
147
|
-
return (
|
|
148
|
-
<components.Menu
|
|
149
|
-
className="z-[1] absolute inset-x-0 bg-page shadow-sm mt-[8px] rounded-sm"
|
|
150
|
-
{...props}
|
|
151
|
-
>
|
|
152
|
-
{children}
|
|
153
|
-
</components.Menu>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const Placeholder = ({ children, ...props }: PlaceholderProps) => {
|
|
158
|
-
return (
|
|
159
|
-
<components.Placeholder
|
|
160
|
-
className="col-start-1 col-end-3 row-start-1 row-end-2 text-[16px] text-light truncate"
|
|
161
|
-
{...props}
|
|
162
|
-
>
|
|
163
|
-
{children}
|
|
164
|
-
</components.Placeholder>
|
|
165
|
-
)
|
|
166
|
-
}
|
|
7
|
+
import {
|
|
8
|
+
colourStyles,
|
|
9
|
+
Control,
|
|
10
|
+
DropdownIndicator,
|
|
11
|
+
IndicatorsContainer,
|
|
12
|
+
Input,
|
|
13
|
+
LoadingIndicator,
|
|
14
|
+
Menu,
|
|
15
|
+
Placeholder,
|
|
16
|
+
SingleValue,
|
|
17
|
+
ValueContainer,
|
|
18
|
+
Option,
|
|
19
|
+
} from './components'
|
|
167
20
|
|
|
168
21
|
type SelectBaseProps<
|
|
169
22
|
Option,
|
|
@@ -171,11 +24,9 @@ type SelectBaseProps<
|
|
|
171
24
|
Group extends GroupBase<Option> = GroupBase<Option>
|
|
172
25
|
> = Props<Option, IsMulti, Group>
|
|
173
26
|
|
|
174
|
-
function SelectBase<
|
|
175
|
-
Option,
|
|
176
|
-
|
|
177
|
-
Group extends GroupBase<Option> = GroupBase<Option>
|
|
178
|
-
>(props: SelectBaseProps<Option, IsMulti, Group>) {
|
|
27
|
+
function SelectBase<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(
|
|
28
|
+
props: SelectBaseProps<Option, IsMulti, Group>
|
|
29
|
+
) {
|
|
179
30
|
return (
|
|
180
31
|
<Select
|
|
181
32
|
components={{
|
|
@@ -189,7 +40,7 @@ function SelectBase<
|
|
|
189
40
|
Placeholder,
|
|
190
41
|
Input,
|
|
191
42
|
LoadingIndicator,
|
|
192
|
-
IndicatorsContainer
|
|
43
|
+
IndicatorsContainer,
|
|
193
44
|
}}
|
|
194
45
|
styles={colourStyles}
|
|
195
46
|
unstyled={true}
|