@modul/mbui 0.0.27-beta-webpack-559623b1 → 0.0.27-beta-webpack-6d7a3f6c
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/5df09ceadd47d11f8760.woff2 +0 -0
- package/dist/@/config/index.js +1 -1
- package/dist/Alert/index.js +1 -1
- package/dist/AlertDialog/index.js +5 -15
- package/dist/Audio/index.js +1 -11
- package/dist/Badge/index.js +1 -1
- package/dist/Base/Input/index.js +1 -1
- package/dist/Base/Links/index.js +1 -1
- package/dist/BottomNavigation/index.js +1 -11
- package/dist/Button/index.js +1 -11
- package/dist/Calendar/index.js +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/Checkbox/index.js +1 -11
- package/dist/Chip/index.js +1 -11
- package/dist/Collapsible/index.js +1 -11
- package/dist/DatePicker/index.js +1 -11
- package/dist/DigitKeyPad/index.js +1 -1
- package/dist/Drawer/index.js +2 -12
- package/dist/FavoritePyments/index.js +1 -1
- package/dist/Form/index.js +1 -11
- package/dist/Icon/icons/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Input/index.js +1 -1
- package/dist/Input-OTP/index.js +2 -2
- package/dist/Label/index.js +1 -11
- package/dist/Logo/index.js +1 -1
- package/dist/Navbar/index.js +1 -1
- package/dist/Page/index.js +1 -1
- package/dist/Popover/index.js +1 -11
- package/dist/Progress/index.js +2 -12
- package/dist/Select/components/index.js +1 -10
- package/dist/Select/index.js +1 -10
- package/dist/Skeleton/index.js +1 -1
- package/dist/Slider/index.js +1 -11
- package/dist/Swipe2Show/index.js +1 -1
- package/dist/Switch/index.js +1 -11
- package/dist/Tabs/index.js +1 -11
- package/dist/Textarea/index.js +1 -1
- package/dist/Toaster/index.js +2 -2
- package/dist/ac50880e253005087d8a.woff2 +0 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -32
- package/package.json +4 -1
- package/src/@/config/button.ts +77 -0
- package/src/@/config/index.ts +97 -0
- package/src/@/config/label.ts +89 -0
- package/src/@/lib/utils.ts +7 -0
- package/src/Alert/Alert.tsx +81 -0
- package/src/Alert/index.ts +1 -0
- package/src/AlertDialog/AlertDialog.tsx +137 -0
- package/src/AlertDialog/index.ts +13 -0
- package/src/Audio/Audio.styl +115 -0
- package/src/Audio/Audio.tsx +359 -0
- package/src/Audio/index.ts +4 -0
- package/src/Audio/types.ts +40 -0
- package/src/Badge/Badge.tsx +58 -0
- package/src/Badge/index.ts +1 -0
- package/src/Base/Input/Base.tsx +37 -0
- package/src/Base/Input/Input.tsx +42 -0
- package/src/Base/Input/index.ts +3 -0
- package/src/Base/Input/types.ts +11 -0
- package/src/Base/Links/TextLink.tsx +16 -0
- package/src/Base/Links/index.ts +3 -0
- package/src/BottomNavigation/BottomNavigation.tsx +62 -0
- package/src/BottomNavigation/index.ts +1 -0
- package/src/Button/Button.tsx +124 -0
- package/src/Button/ButtonWidget.tsx +67 -0
- package/src/Button/index.ts +2 -0
- package/src/Calendar/Calendar.tsx +61 -0
- package/src/Calendar/index.ts +1 -0
- package/src/Chat/MessageTyping.tsx +61 -0
- package/src/Chat/index.ts +1 -0
- package/src/Checkbox/Checkbox.tsx +28 -0
- package/src/Checkbox/index.ts +1 -0
- package/src/Chip/Chip.tsx +55 -0
- package/src/Chip/index.ts +1 -0
- package/src/Collapsible/AccountCollapsible.tsx +79 -0
- package/src/Collapsible/Collapsible.tsx +13 -0
- package/src/Collapsible/index.ts +8 -0
- package/src/DatePicker/DatePicker.tsx +41 -0
- package/src/DatePicker/index.ts +1 -0
- package/src/DigitKeyPad/DigitKeyPad.tsx +69 -0
- package/src/DigitKeyPad/index.ts +1 -0
- package/src/Drawer/Drawer.tsx +89 -0
- package/src/Drawer/index.ts +7 -0
- package/src/FavoritePyments/FavoritePaymentsList.tsx +40 -0
- package/src/FavoritePyments/index.ts +1 -0
- package/src/Form/Form.tsx +154 -0
- package/src/Form/index.ts +1 -0
- package/src/Icon/SvgIcon.tsx +32 -0
- package/src/Icon/icons/AddList.tsx +19 -0
- package/src/Icon/icons/AlertCircle.tsx +18 -0
- package/src/Icon/icons/AlertCircleSolid.tsx +18 -0
- package/src/Icon/icons/AlertDiamond.tsx +18 -0
- package/src/Icon/icons/AlertDiamondSolid.tsx +18 -0
- package/src/Icon/icons/AlertShield.tsx +18 -0
- package/src/Icon/icons/Android.tsx +18 -0
- package/src/Icon/icons/Apple.tsx +18 -0
- package/src/Icon/icons/Archive.tsx +18 -0
- package/src/Icon/icons/ArrowCircle.tsx +18 -0
- package/src/Icon/icons/ArrowDown.tsx +18 -0
- package/src/Icon/icons/ArrowLeft.tsx +18 -0
- package/src/Icon/icons/ArrowRight.tsx +18 -0
- package/src/Icon/icons/ArrowUp.tsx +18 -0
- package/src/Icon/icons/ArrowUpCorner.tsx +18 -0
- package/src/Icon/icons/ArrowsChange.tsx +18 -0
- package/src/Icon/icons/Atm.tsx +18 -0
- package/src/Icon/icons/Attach.tsx +18 -0
- package/src/Icon/icons/Bank.tsx +18 -0
- package/src/Icon/icons/Bold.tsx +18 -0
- package/src/Icon/icons/Bonus.tsx +18 -0
- package/src/Icon/icons/Building.tsx +18 -0
- package/src/Icon/icons/Calendar.tsx +18 -0
- package/src/Icon/icons/CalendarCancel.tsx +18 -0
- package/src/Icon/icons/Call.tsx +18 -0
- package/src/Icon/icons/CallEnd.tsx +18 -0
- package/src/Icon/icons/CallMissed.tsx +18 -0
- package/src/Icon/icons/Callback.tsx +18 -0
- package/src/Icon/icons/Camera.tsx +18 -0
- package/src/Icon/icons/Cancel.tsx +18 -0
- package/src/Icon/icons/CancelSolid.tsx +18 -0
- package/src/Icon/icons/Card.tsx +18 -0
- package/src/Icon/icons/CardLock.tsx +18 -0
- package/src/Icon/icons/CardRefill.tsx +18 -0
- package/src/Icon/icons/CardReissue.tsx +18 -0
- package/src/Icon/icons/CardScan.tsx +18 -0
- package/src/Icon/icons/CardToCard.tsx +18 -0
- package/src/Icon/icons/CardUnlock.tsx +18 -0
- package/src/Icon/icons/Change.tsx +18 -0
- package/src/Icon/icons/Chart.tsx +18 -0
- package/src/Icon/icons/Chat.tsx +18 -0
- package/src/Icon/icons/ChatSolid.tsx +18 -0
- package/src/Icon/icons/Check.tsx +18 -0
- package/src/Icon/icons/CheckCircle.tsx +18 -0
- package/src/Icon/icons/CheckCircleSolid.tsx +18 -0
- package/src/Icon/icons/CheckShield.tsx +20 -0
- package/src/Icon/icons/CheckSmall.tsx +18 -0
- package/src/Icon/icons/Checklist.tsx +18 -0
- package/src/Icon/icons/Circle.tsx +18 -0
- package/src/Icon/icons/Clock.tsx +18 -0
- package/src/Icon/icons/ClockSolid.tsx +18 -0
- package/src/Icon/icons/Close.tsx +18 -0
- package/src/Icon/icons/Coins.tsx +18 -0
- package/src/Icon/icons/Collapse.tsx +18 -0
- package/src/Icon/icons/Copy.tsx +18 -0
- package/src/Icon/icons/Cup.tsx +18 -0
- package/src/Icon/icons/CurrencyChange.tsx +18 -0
- package/src/Icon/icons/CurrencyTransfer.tsx +18 -0
- package/src/Icon/icons/Deposit.tsx +18 -0
- package/src/Icon/icons/Diamond.tsx +18 -0
- package/src/Icon/icons/Dislike.tsx +18 -0
- package/src/Icon/icons/DislikeSolid.tsx +18 -0
- package/src/Icon/icons/Doc.tsx +18 -0
- package/src/Icon/icons/DocCancel.tsx +18 -0
- package/src/Icon/icons/Dollar.tsx +18 -0
- package/src/Icon/icons/DoubleArrow.tsx +18 -0
- package/src/Icon/icons/DoubleTick.tsx +18 -0
- package/src/Icon/icons/Download.tsx +18 -0
- package/src/Icon/icons/Dropdown.tsx +18 -0
- package/src/Icon/icons/DropdownSmall.tsx +20 -0
- package/src/Icon/icons/DropdownSmallOld.tsx +20 -0
- package/src/Icon/icons/Dropup.tsx +18 -0
- package/src/Icon/icons/Edit.tsx +18 -0
- package/src/Icon/icons/Email.tsx +18 -0
- package/src/Icon/icons/Erase.tsx +16 -0
- package/src/Icon/icons/Excel.tsx +18 -0
- package/src/Icon/icons/Expand.tsx +18 -0
- package/src/Icon/icons/Eye.tsx +18 -0
- package/src/Icon/icons/EyeOff.tsx +18 -0
- package/src/Icon/icons/Favorite.tsx +18 -0
- package/src/Icon/icons/FavoriteSolid.tsx +18 -0
- package/src/Icon/icons/Fb.tsx +18 -0
- package/src/Icon/icons/FbCircle.tsx +18 -0
- package/src/Icon/icons/File.tsx +18 -0
- package/src/Icon/icons/FileAdd.tsx +18 -0
- package/src/Icon/icons/Files.tsx +18 -0
- package/src/Icon/icons/Filter.tsx +18 -0
- package/src/Icon/icons/Folder.tsx +18 -0
- package/src/Icon/icons/Geolocation.tsx +18 -0
- package/src/Icon/icons/Gift.tsx +18 -0
- package/src/Icon/icons/Globe.tsx +18 -0
- package/src/Icon/icons/Heart.tsx +18 -0
- package/src/Icon/icons/HeartSolid.tsx +18 -0
- package/src/Icon/icons/Help.tsx +18 -0
- package/src/Icon/icons/Home.tsx +18 -0
- package/src/Icon/icons/Housing.tsx +18 -0
- package/src/Icon/icons/Ig.tsx +18 -0
- package/src/Icon/icons/IgCircle.tsx +18 -0
- package/src/Icon/icons/Info.tsx +18 -0
- package/src/Icon/icons/InfoBook.tsx +18 -0
- package/src/Icon/icons/InfoSolid.tsx +18 -0
- package/src/Icon/icons/Italic.tsx +18 -0
- package/src/Icon/icons/Key.tsx +18 -0
- package/src/Icon/icons/Left.tsx +18 -0
- package/src/Icon/icons/Lightbulb.tsx +18 -0
- package/src/Icon/icons/Like.tsx +18 -0
- package/src/Icon/icons/LikeSolid.tsx +18 -0
- package/src/Icon/icons/Link.tsx +18 -0
- package/src/Icon/icons/Lock.tsx +18 -0
- package/src/Icon/icons/Logout.tsx +18 -0
- package/src/Icon/icons/MagicWand.tsx +18 -0
- package/src/Icon/icons/Mail.tsx +18 -0
- package/src/Icon/icons/MailSend.tsx +18 -0
- package/src/Icon/icons/Map.tsx +18 -0
- package/src/Icon/icons/MapPin.tsx +18 -0
- package/src/Icon/icons/MapPinSolid.tsx +18 -0
- package/src/Icon/icons/Menu.tsx +18 -0
- package/src/Icon/icons/Mic.tsx +18 -0
- package/src/Icon/icons/MicOff.tsx +18 -0
- package/src/Icon/icons/Minus.tsx +18 -0
- package/src/Icon/icons/MinusCircle.tsx +18 -0
- package/src/Icon/icons/MinusShort.tsx +18 -0
- package/src/Icon/icons/Moneybox.tsx +18 -0
- package/src/Icon/icons/More.tsx +18 -0
- package/src/Icon/icons/Move.tsx +18 -0
- package/src/Icon/icons/Newbie.tsx +20 -0
- package/src/Icon/icons/News.tsx +18 -0
- package/src/Icon/icons/Notes.tsx +18 -0
- package/src/Icon/icons/Notification.tsx +18 -0
- package/src/Icon/icons/Ok.tsx +18 -0
- package/src/Icon/icons/OkCircle.tsx +18 -0
- package/src/Icon/icons/Order.tsx +18 -0
- package/src/Icon/icons/OrderLoad.tsx +18 -0
- package/src/Icon/icons/OrderSend.tsx +18 -0
- package/src/Icon/icons/Pause.tsx +18 -0
- package/src/Icon/icons/PauseCircle.tsx +18 -0
- package/src/Icon/icons/Payment.tsx +18 -0
- package/src/Icon/icons/PhoneShake.tsx +18 -0
- package/src/Icon/icons/Play.tsx +18 -0
- package/src/Icon/icons/PlaySolid.tsx +18 -0
- package/src/Icon/icons/Plus.tsx +18 -0
- package/src/Icon/icons/PlusCircle.tsx +18 -0
- package/src/Icon/icons/Pos.tsx +18 -0
- package/src/Icon/icons/Print.tsx +18 -0
- package/src/Icon/icons/QrPay.tsx +18 -0
- package/src/Icon/icons/Redirect.tsx +18 -0
- package/src/Icon/icons/Refill.tsx +18 -0
- package/src/Icon/icons/Refund.tsx +18 -0
- package/src/Icon/icons/Reload.tsx +19 -0
- package/src/Icon/icons/Reply.tsx +18 -0
- package/src/Icon/icons/ReplyShape.tsx +18 -0
- package/src/Icon/icons/ReplyShapeSolid.tsx +18 -0
- package/src/Icon/icons/Request.tsx +18 -0
- package/src/Icon/icons/Right.tsx +18 -0
- package/src/Icon/icons/Route.tsx +18 -0
- package/src/Icon/icons/Ruble.tsx +18 -0
- package/src/Icon/icons/Sbp.tsx +18 -0
- package/src/Icon/icons/SbpColored.tsx +46 -0
- package/src/Icon/icons/Search.tsx +18 -0
- package/src/Icon/icons/Send.tsx +18 -0
- package/src/Icon/icons/Services.tsx +17 -0
- package/src/Icon/icons/Settings.tsx +17 -0
- package/src/Icon/icons/Share.tsx +18 -0
- package/src/Icon/icons/ShoppingCart.tsx +18 -0
- package/src/Icon/icons/Sign.tsx +18 -0
- package/src/Icon/icons/SlotMachine.tsx +18 -0
- package/src/Icon/icons/SortDown.tsx +18 -0
- package/src/Icon/icons/SortDownSolid.tsx +18 -0
- package/src/Icon/icons/SortUp.tsx +18 -0
- package/src/Icon/icons/SortUpSolid.tsx +18 -0
- package/src/Icon/icons/Stop.tsx +18 -0
- package/src/Icon/icons/Support.tsx +18 -0
- package/src/Icon/icons/Sync.tsx +18 -0
- package/src/Icon/icons/Table.tsx +18 -0
- package/src/Icon/icons/Tariffs.tsx +19 -0
- package/src/Icon/icons/Tg.tsx +18 -0
- package/src/Icon/icons/TgCircle.tsx +18 -0
- package/src/Icon/icons/Timeout.tsx +18 -0
- package/src/Icon/icons/Timer.tsx +18 -0
- package/src/Icon/icons/Transfer.tsx +17 -0
- package/src/Icon/icons/Trash.tsx +18 -0
- package/src/Icon/icons/TurnOff.tsx +18 -0
- package/src/Icon/icons/Twitter.tsx +18 -0
- package/src/Icon/icons/TwitterCircle.tsx +18 -0
- package/src/Icon/icons/Underline.tsx +18 -0
- package/src/Icon/icons/Unlink.tsx +18 -0
- package/src/Icon/icons/Unsorted.tsx +18 -0
- package/src/Icon/icons/UnsortedSolid.tsx +18 -0
- package/src/Icon/icons/Upload.tsx +18 -0
- package/src/Icon/icons/User.tsx +18 -0
- package/src/Icon/icons/UserAdd.tsx +18 -0
- package/src/Icon/icons/UserCard.tsx +18 -0
- package/src/Icon/icons/UserEdit.tsx +18 -0
- package/src/Icon/icons/UserQueue.tsx +18 -0
- package/src/Icon/icons/Viber.tsx +18 -0
- package/src/Icon/icons/ViberCircle.tsx +18 -0
- package/src/Icon/icons/ViewGrid.tsx +18 -0
- package/src/Icon/icons/ViewHorizontal.tsx +18 -0
- package/src/Icon/icons/ViewList.tsx +18 -0
- package/src/Icon/icons/ViewRows.tsx +18 -0
- package/src/Icon/icons/ViewVertical.tsx +18 -0
- package/src/Icon/icons/Vk.tsx +18 -0
- package/src/Icon/icons/VkCircle.tsx +18 -0
- package/src/Icon/icons/Wallet.tsx +17 -0
- package/src/Icon/icons/Warning.tsx +18 -0
- package/src/Icon/icons/WarningClean.tsx +18 -0
- package/src/Icon/icons/Whatsapp.tsx +18 -0
- package/src/Icon/icons/WhatsappCircle.tsx +18 -0
- package/src/Icon/icons/Wheelchair.tsx +18 -0
- package/src/Icon/icons/index.ts +209 -0
- package/src/Icon/index.ts +2 -0
- package/src/Input/Input.tsx +35 -0
- package/src/Input/InputMask.tsx +36 -0
- package/src/Input/index.ts +2 -0
- package/src/Input-OTP/Input.tsx +64 -0
- package/src/Input-OTP/index.ts +3 -0
- package/src/Label/Label.tsx +20 -0
- package/src/Label/index.ts +1 -0
- package/src/Logo/Logo.tsx +22 -0
- package/src/Logo/index.ts +3 -0
- package/src/Navbar/Navbar.tsx +21 -0
- package/src/Navbar/index.tsx +2 -0
- package/src/Page/Page.tsx +43 -0
- package/src/Page/index.ts +1 -0
- package/src/Popover/Popover.tsx +64 -0
- package/src/Popover/index.ts +5 -0
- package/src/Progress/Progress.tsx +31 -0
- package/src/Progress/index.ts +1 -0
- package/src/Select/Select.tsx +19 -0
- package/src/Select/SelectAccount.tsx +101 -0
- package/src/Select/SelectAccountCard.tsx +146 -0
- package/src/Select/SelectAsync.tsx +28 -0
- package/src/Select/SelectBase.tsx +54 -0
- package/src/Select/components/components.tsx +186 -0
- package/src/Select/components/index.tsx +15 -0
- package/src/Select/index.ts +5 -0
- package/src/Skeleton/Skeleton.tsx +25 -0
- package/src/Skeleton/index.ts +1 -0
- package/src/Slider/Slider.tsx +38 -0
- package/src/Slider/index.ts +4 -0
- package/src/Swipe2Show/Swipe2Show.tsx +71 -0
- package/src/Swipe2Show/index.ts +1 -0
- package/src/Switch/Switch.tsx +59 -0
- package/src/Switch/index.ts +1 -0
- package/src/Tabs/Tabs.tsx +106 -0
- package/src/Tabs/index.ts +1 -0
- package/src/Textarea/Textarea.tsx +35 -0
- package/src/Textarea/index.ts +1 -0
- package/src/Toaster/Toaster.tsx +71 -0
- package/src/Toaster/index.ts +1 -0
- package/src/assets/css/global.css +209 -0
- package/src/assets/fonts/Roboto-Italic.ttf +0 -0
- package/src/assets/fonts/Roboto-Italic.woff2 +0 -0
- package/src/assets/fonts/Roboto.ttf +0 -0
- package/src/assets/fonts/Roboto.woff2 +0 -0
- package/src/assets/images/logo/1c.svg +1 -0
- package/src/assets/images/logo/bank/emblem-white.svg +1 -0
- package/src/assets/images/logo/bank/emblem.svg +1 -0
- package/src/assets/images/logo/bank/logo-white.svg +1 -0
- package/src/assets/images/logo/bank/logo.svg +1 -0
- package/src/assets/images/logo/garant/emblem-white.svg +1 -0
- package/src/assets/images/logo/garant/emblem.svg +1 -0
- package/src/assets/images/logo/garant/logo-white.svg +1 -0
- package/src/assets/images/logo/garant/logo.svg +1 -0
- package/src/assets/images/logo/kassa/emblem-white.svg +1 -0
- package/src/assets/images/logo/kassa/emblem.svg +1 -0
- package/src/assets/images/logo/kassa/logo-white.svg +1 -0
- package/src/assets/images/logo/kassa/logo.svg +1 -0
- package/src/assets/images/logo/sbp-logo.svg +1 -0
- package/src/assets/images/statusbar.svg +1 -0
- package/src/index.ts +135 -0
- package/src/pages/payments/SmsSign/sms-sign.tsx +91 -0
|
@@ -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 }
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { DropdownSmallOld, CheckSmall } from '../../src/Icon'
|
|
3
|
+
import Select, {
|
|
4
|
+
components,
|
|
5
|
+
ControlProps,
|
|
6
|
+
OptionProps,
|
|
7
|
+
DropdownIndicatorProps,
|
|
8
|
+
SingleValueProps,
|
|
9
|
+
Props,
|
|
10
|
+
GroupBase,
|
|
11
|
+
} from 'react-select'
|
|
12
|
+
import { cn } from '../@/lib/utils'
|
|
13
|
+
import { colourStyles, Menu, optionClasses, ValueContainer } from './components'
|
|
14
|
+
|
|
15
|
+
const selectTriggerClasses: string = `
|
|
16
|
+
flex
|
|
17
|
+
items-center
|
|
18
|
+
py-[8px]
|
|
19
|
+
px-[16px]
|
|
20
|
+
min-h-[80px]
|
|
21
|
+
border-none
|
|
22
|
+
rounded-md
|
|
23
|
+
text-left
|
|
24
|
+
text-white
|
|
25
|
+
bg-gradient-to-r
|
|
26
|
+
from-[--cl-blue-3]
|
|
27
|
+
to-primary
|
|
28
|
+
shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)]
|
|
29
|
+
cursor-pointer
|
|
30
|
+
`
|
|
31
|
+
const Control = ({ children, ...props }: ControlProps) => {
|
|
32
|
+
const { isFocused } = props
|
|
33
|
+
return (
|
|
34
|
+
<components.Control
|
|
35
|
+
className={cn(
|
|
36
|
+
selectTriggerClasses,
|
|
37
|
+
{ 'outline outline-primary outline-offset-2 outline-2': isFocused }
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</components.Control>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const Option = ({ children, ...props }: OptionProps) => {
|
|
47
|
+
const {
|
|
48
|
+
isSelected,
|
|
49
|
+
isFocused,
|
|
50
|
+
isDisabled,
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
data: { label, account, balance, cur },
|
|
53
|
+
} = props
|
|
54
|
+
return (
|
|
55
|
+
<components.Option
|
|
56
|
+
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<span className="flex basis-0 grow">
|
|
60
|
+
<span>
|
|
61
|
+
<span>{label}</span>
|
|
62
|
+
<br />
|
|
63
|
+
<span className="text-[14px] text-light">{account}</span>
|
|
64
|
+
</span>
|
|
65
|
+
<span className="ml-auto shrink-0">
|
|
66
|
+
{balance} {cur}
|
|
67
|
+
</span>
|
|
68
|
+
</span>
|
|
69
|
+
|
|
70
|
+
<span className="ml-[16px] shrink-0 size-[24px]">
|
|
71
|
+
{isSelected && (
|
|
72
|
+
<CheckSmall
|
|
73
|
+
width="24"
|
|
74
|
+
height="24"
|
|
75
|
+
className="text-primary"
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
</span>
|
|
79
|
+
</components.Option>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const DropdownIndicator = ({ children, ...props }: DropdownIndicatorProps) => {
|
|
84
|
+
return (
|
|
85
|
+
<components.DropdownIndicator
|
|
86
|
+
className="shrink-0"
|
|
87
|
+
{...props}
|
|
88
|
+
>
|
|
89
|
+
<DropdownSmallOld
|
|
90
|
+
className="text-white"
|
|
91
|
+
width="16"
|
|
92
|
+
height="16"
|
|
93
|
+
/>
|
|
94
|
+
</components.DropdownIndicator>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
const { label, account, balance, cur } = props.data
|
|
101
|
+
return (
|
|
102
|
+
<components.SingleValue
|
|
103
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
<span className="block max-w-full text-[16px] truncate leading-[1.5]">
|
|
107
|
+
{label} <span className="opacity-75 text-[14px] leading-[1.42]">{account}</span>
|
|
108
|
+
</span>
|
|
109
|
+
<span className="block mt-[8px] font-medium text-[24px] leading-[1.333]">
|
|
110
|
+
{balance} {cur}
|
|
111
|
+
</span>
|
|
112
|
+
</components.SingleValue>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
type SelectAccountCardProps<
|
|
117
|
+
Option,
|
|
118
|
+
IsMulti extends boolean = false,
|
|
119
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
120
|
+
> = Props<Option, IsMulti, Group>
|
|
121
|
+
|
|
122
|
+
const SelectAccountCard = <
|
|
123
|
+
Option,
|
|
124
|
+
IsMulti extends boolean = false,
|
|
125
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
126
|
+
>(props: SelectAccountCardProps<Option, IsMulti, Group>) => {
|
|
127
|
+
return (
|
|
128
|
+
<Select
|
|
129
|
+
isSearchable={false}
|
|
130
|
+
components={{
|
|
131
|
+
Control,
|
|
132
|
+
Option,
|
|
133
|
+
SingleValue,
|
|
134
|
+
DropdownIndicator,
|
|
135
|
+
IndicatorSeparator: () => null,
|
|
136
|
+
Menu,
|
|
137
|
+
ValueContainer,
|
|
138
|
+
}}
|
|
139
|
+
styles={colourStyles}
|
|
140
|
+
unstyled={true}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { SelectAccountCard }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import AsyncSelect from 'react-select/async'
|
|
3
|
+
import { colourStyles, Control, DropdownIndicator, IndicatorsContainer, Input, LoadingIndicator, Menu, Option, Placeholder, SingleValue, ValueContainer } from './components'
|
|
4
|
+
|
|
5
|
+
const SelectAsync = ({ ...props }) => (
|
|
6
|
+
<AsyncSelect
|
|
7
|
+
components={{
|
|
8
|
+
Control,
|
|
9
|
+
Option,
|
|
10
|
+
SingleValue,
|
|
11
|
+
DropdownIndicator,
|
|
12
|
+
IndicatorSeparator: () => null,
|
|
13
|
+
Menu,
|
|
14
|
+
ValueContainer,
|
|
15
|
+
Placeholder,
|
|
16
|
+
Input,
|
|
17
|
+
LoadingIndicator,
|
|
18
|
+
IndicatorsContainer
|
|
19
|
+
}}
|
|
20
|
+
styles={colourStyles}
|
|
21
|
+
unstyled={true}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
SelectAsync.displayName = 'SelectAsync'
|
|
27
|
+
|
|
28
|
+
export { SelectAsync }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import Select, {
|
|
4
|
+
GroupBase,
|
|
5
|
+
Props,
|
|
6
|
+
} from 'react-select'
|
|
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'
|
|
20
|
+
|
|
21
|
+
type SelectBaseProps<
|
|
22
|
+
Option,
|
|
23
|
+
IsMulti extends boolean = false,
|
|
24
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
25
|
+
> = Props<Option, IsMulti, Group>
|
|
26
|
+
|
|
27
|
+
function SelectBase<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(
|
|
28
|
+
props: SelectBaseProps<Option, IsMulti, Group>
|
|
29
|
+
) {
|
|
30
|
+
return (
|
|
31
|
+
<Select
|
|
32
|
+
components={{
|
|
33
|
+
Control,
|
|
34
|
+
Option,
|
|
35
|
+
SingleValue,
|
|
36
|
+
DropdownIndicator,
|
|
37
|
+
IndicatorSeparator: () => null,
|
|
38
|
+
Menu,
|
|
39
|
+
ValueContainer,
|
|
40
|
+
Placeholder,
|
|
41
|
+
Input,
|
|
42
|
+
LoadingIndicator,
|
|
43
|
+
IndicatorsContainer,
|
|
44
|
+
}}
|
|
45
|
+
styles={colourStyles}
|
|
46
|
+
unstyled={true}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
SelectBase.displayName = 'SelectBase'
|
|
53
|
+
|
|
54
|
+
export { SelectBase }
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import { cn } from '../@/lib/utils'
|
|
3
|
+
|
|
4
|
+
interface ISkeletonProps {
|
|
5
|
+
displayName: string
|
|
6
|
+
Item: typeof Item
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Skeleton: FC<HTMLAttributes<HTMLDivElement>> & ISkeletonProps = ({ className, children, ...props }) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className={className} {...props} role="status">
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Item: FC<HTMLAttributes<HTMLDivElement>> = ({ className }) => (
|
|
18
|
+
<div className={cn('animate-pulse bg-[--skeleton-bg] rounded-sm', className)} />
|
|
19
|
+
)
|
|
20
|
+
Skeleton.displayName = 'Skeleton'
|
|
21
|
+
|
|
22
|
+
Skeleton.Item = Item
|
|
23
|
+
Skeleton.Item.displayName = 'Skeleton.Item'
|
|
24
|
+
|
|
25
|
+
export { Skeleton }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from "./Skeleton";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider'
|
|
3
|
+
import cn from 'clsx'
|
|
4
|
+
|
|
5
|
+
const sliderThumb = `
|
|
6
|
+
block
|
|
7
|
+
size-5
|
|
8
|
+
border-2
|
|
9
|
+
border-primary
|
|
10
|
+
bg-background
|
|
11
|
+
rounded-full
|
|
12
|
+
ring-offset-background
|
|
13
|
+
focus-visible:ring-2
|
|
14
|
+
focus-visible:ring-ring
|
|
15
|
+
focus-visible:ring-offset-2
|
|
16
|
+
focus-visible:outline-none
|
|
17
|
+
disabled:pointer-events-none
|
|
18
|
+
disabled:opacity-50
|
|
19
|
+
transition-colors
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
const Slider = React.forwardRef<
|
|
23
|
+
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
24
|
+
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
|
|
25
|
+
>(({ className = '', ...props }, ref) => (
|
|
26
|
+
<SliderPrimitive.Root
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn('relative flex w-full touch-none select-none items-center', className)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
<SliderPrimitive.Track className="relative bg-secondary rounded-full w-full h-2 overflow-hidden grow">
|
|
32
|
+
<SliderPrimitive.Range className="absolute bg-primary h-full" />
|
|
33
|
+
</SliderPrimitive.Track>
|
|
34
|
+
<SliderPrimitive.Thumb className={sliderThumb} />
|
|
35
|
+
</SliderPrimitive.Root>
|
|
36
|
+
))
|
|
37
|
+
|
|
38
|
+
export default Slider
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { cloneElement, FC, useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { useSwipeable } from 'react-swipeable'
|
|
3
|
+
|
|
4
|
+
interface IProps extends React.PropsWithChildren {
|
|
5
|
+
contentToShowRight: React.ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Swipe2Show: FC<IProps> = ({ children, contentToShowRight }) => {
|
|
9
|
+
const wrapperRef = useRef<HTMLDivElement>(null)
|
|
10
|
+
const actionRef = useRef<HTMLDivElement>(null)
|
|
11
|
+
const [showRight, setShowRight] = useState(false)
|
|
12
|
+
const translateX = actionRef.current?.offsetWidth
|
|
13
|
+
|
|
14
|
+
const handlers = useSwipeable({
|
|
15
|
+
onSwipedLeft: () => setShowRight(true),
|
|
16
|
+
onSwipedRight: () => setShowRight(false),
|
|
17
|
+
swipeDuration: 500,
|
|
18
|
+
preventScrollOnSwipe: true,
|
|
19
|
+
trackMouse: true,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const checkClickOutside = (evt) => {
|
|
23
|
+
if (showRight && wrapperRef.current && !wrapperRef.current.contains(evt.target)) {
|
|
24
|
+
setShowRight(false)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
document.addEventListener('mousedown', checkClickOutside)
|
|
30
|
+
document.addEventListener('touchstart', checkClickOutside)
|
|
31
|
+
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener('mousedown', checkClickOutside)
|
|
34
|
+
document.removeEventListener('touchstart', checkClickOutside)
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
style={{ position: 'relative' }}
|
|
41
|
+
ref={wrapperRef}
|
|
42
|
+
>
|
|
43
|
+
{cloneElement(children as React.ReactElement<any>, {
|
|
44
|
+
style: {
|
|
45
|
+
position: 'relative',
|
|
46
|
+
transform: showRight && `translateX(-${translateX}px)`,
|
|
47
|
+
transition: 'transform .15s ease-in-out',
|
|
48
|
+
width: '100%',
|
|
49
|
+
zIndex: '1',
|
|
50
|
+
touchAction: 'pan-x',
|
|
51
|
+
},
|
|
52
|
+
...handlers,
|
|
53
|
+
})}
|
|
54
|
+
<div
|
|
55
|
+
ref={actionRef}
|
|
56
|
+
style={{
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
top: '.5px',
|
|
59
|
+
right: '0',
|
|
60
|
+
bottom: '.5px',
|
|
61
|
+
opacity: `${showRight ? '1' : '0'}`,
|
|
62
|
+
transition: 'opacity .15s ease-in-out',
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{contentToShowRight}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { Swipe2Show }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Swipe2Show } from './Swipe2Show'
|