@modul/mbui 0.0.27-beta-webpack-559623b1 → 0.0.27-beta-webpack-305b06ab
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/Chip/Chip.d.ts +1 -1
- package/dist/Input-OTP/Input.d.ts +2 -2
- package/dist/{index.js → main.js} +3 -3
- package/package.json +3 -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 +134 -0
- package/src/pages/payments/SmsSign/sms-sign.tsx +91 -0
- package/dist/@/config/button.d.ts +0 -78
- package/dist/@/config/index.d.ts +0 -223
- package/dist/@/config/index.js +0 -1
- package/dist/@/config/label.d.ts +0 -90
- package/dist/Alert/index.js +0 -1
- package/dist/AlertDialog/index.js +0 -21
- package/dist/Audio/index.js +0 -11
- package/dist/Badge/index.js +0 -1
- package/dist/Base/Input/Base.d.ts +0 -4
- package/dist/Base/Input/Input.d.ts +0 -4
- package/dist/Base/Input/index.d.ts +0 -2
- package/dist/Base/Input/index.js +0 -1
- package/dist/Base/Input/types.d.ts +0 -9
- package/dist/Base/Links/TextLink.d.ts +0 -4
- package/dist/Base/Links/index.d.ts +0 -2
- package/dist/Base/Links/index.js +0 -1
- package/dist/BottomNavigation/index.js +0 -11
- package/dist/Button/index.js +0 -11
- package/dist/Calendar/index.js +0 -1
- package/dist/Chat/index.js +0 -1
- package/dist/Checkbox/index.js +0 -11
- package/dist/Chip/index.js +0 -11
- package/dist/Collapsible/index.js +0 -11
- package/dist/DatePicker/index.js +0 -11
- package/dist/DigitKeyPad/index.js +0 -1
- package/dist/Drawer/index.js +0 -15
- package/dist/FavoritePyments/index.js +0 -1
- package/dist/Form/index.js +0 -11
- package/dist/Icon/icons/index.js +0 -1
- package/dist/Icon/index.js +0 -1
- package/dist/Input/index.js +0 -1
- package/dist/Input-OTP/index.js +0 -20
- package/dist/Label/index.js +0 -11
- package/dist/Logo/index.js +0 -1
- package/dist/Navbar/Navbar.d.ts +0 -6
- package/dist/Navbar/index.d.ts +0 -1
- package/dist/Navbar/index.js +0 -1
- package/dist/Page/index.js +0 -1
- package/dist/Popover/index.js +0 -11
- package/dist/Progress/index.js +0 -16
- package/dist/Select/components/index.js +0 -10
- package/dist/Select/index.js +0 -10
- package/dist/Skeleton/index.js +0 -1
- package/dist/Slider/index.js +0 -11
- package/dist/Swipe2Show/index.js +0 -1
- package/dist/Switch/index.js +0 -11
- package/dist/Tabs/index.js +0 -11
- package/dist/Textarea/index.js +0 -1
- package/dist/Toaster/index.js +0 -2
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Slider from '../Slider'
|
|
3
|
+
// import './Audio.styl'
|
|
4
|
+
import {EAudioStatuses, IAudioProps, IState} from "./types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Функция отображения продолжительности записи в "мм:cc"
|
|
8
|
+
* @param {number} value Значение в секундах
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
function Duration(value) {
|
|
12
|
+
let result = '––:––'
|
|
13
|
+
if (value || value === 0) {
|
|
14
|
+
const minutes = Math.floor(value / 60)
|
|
15
|
+
const seconds = Math.round(value - minutes * 60)
|
|
16
|
+
const leadZero = (value) => `${value < 10 ? '0' : ''}${value}`
|
|
17
|
+
result = `${leadZero(minutes)}:${leadZero(seconds)}`
|
|
18
|
+
}
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Компонент прослушивания аудиозаписей
|
|
24
|
+
*/
|
|
25
|
+
export class Audio extends React.Component<IAudioProps, IState> {
|
|
26
|
+
/* начальное состояние */
|
|
27
|
+
state: any = {
|
|
28
|
+
loadingProgress: 0,
|
|
29
|
+
progress: 0,
|
|
30
|
+
duration: 0,
|
|
31
|
+
status: EAudioStatuses.PAUSED,
|
|
32
|
+
currentTime: 0,
|
|
33
|
+
drag: false,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// static defaultProps = {
|
|
37
|
+
// onlyOneIsPlayed: true,
|
|
38
|
+
// }
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ссылка на аудио элемент на странице
|
|
42
|
+
* @memberof Audio
|
|
43
|
+
*/
|
|
44
|
+
audioRef = React.createRef<HTMLAudioElement>()
|
|
45
|
+
|
|
46
|
+
componentDidMount() {
|
|
47
|
+
this.changeVolume(this.props.volume)
|
|
48
|
+
this.setState({
|
|
49
|
+
duration: this.props.duration,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
componentDidUpdate(prevProps) {
|
|
54
|
+
if (prevProps.changeVolume !== this.props.volume) {
|
|
55
|
+
this.changeVolume(this.props.volume)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
changeVolume(value) {
|
|
60
|
+
const audio = this.audioRef.current
|
|
61
|
+
if (audio.volume) {
|
|
62
|
+
audio.volume = value || 0.5
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getDuration = () => {
|
|
67
|
+
const audio = this.audioRef.current
|
|
68
|
+
return Number(this.state.duration || audio.duration)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Метод включение записи на проигрывание
|
|
73
|
+
* @memberof Audio
|
|
74
|
+
*/
|
|
75
|
+
play() {
|
|
76
|
+
const audio = this.audioRef.current
|
|
77
|
+
if (audio && (!audio.src || audio.src.indexOf('_abortedAudio') >= 0)) {
|
|
78
|
+
audio.src = this.props.src
|
|
79
|
+
}
|
|
80
|
+
/** Останавливаем проигрывание остальных записей */
|
|
81
|
+
const allAudioElements = document.getElementsByTagName('audio')
|
|
82
|
+
for (let i = allAudioElements.length - 1; i >= 0; i--) {
|
|
83
|
+
const audioElement = allAudioElements.item(i)
|
|
84
|
+
if (audioElement !== this.audioRef.current && !!audioElement.getAttribute('data-only-one-is-played')) {
|
|
85
|
+
audioElement.pause()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
audio.play().catch(() => {
|
|
89
|
+
audio.pause()
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Метод постановки проигрываемой записи на паузу
|
|
95
|
+
* @memberof Audio
|
|
96
|
+
*/
|
|
97
|
+
pause() {
|
|
98
|
+
const audio = this.audioRef.current
|
|
99
|
+
audio.pause()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Метод прерывания процесса загрузки записи
|
|
104
|
+
* @memberof Audio
|
|
105
|
+
*/
|
|
106
|
+
loadCancel() {
|
|
107
|
+
this.pause()
|
|
108
|
+
const audio = this.audioRef.current
|
|
109
|
+
if (audio.src) {
|
|
110
|
+
audio.src = '_abortedAudio'
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Метод перемотки записи до нужной секунды
|
|
116
|
+
* @param {number} sec значение в секундах
|
|
117
|
+
* @memberof Audio
|
|
118
|
+
*/
|
|
119
|
+
seek(sec) {
|
|
120
|
+
const audio = this.audioRef.current
|
|
121
|
+
audio.currentTime = Math.min(Math.max(sec, 0), this.getDuration())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Обработчик изменения позиции слайдера момента исполнения записи
|
|
126
|
+
* @param {*} value значение слайдера
|
|
127
|
+
* @memberof Audio
|
|
128
|
+
*/
|
|
129
|
+
onSliderChange = (value) => {
|
|
130
|
+
const duration = this.getDuration()
|
|
131
|
+
const newTimeValue = (value / 100) * duration
|
|
132
|
+
this.seek(newTimeValue)
|
|
133
|
+
const audio = this.audioRef.current
|
|
134
|
+
const progress = audio ? (audio.currentTime / duration) * 100 : 0
|
|
135
|
+
this.setState({ progress, drag: true, currentTime: newTimeValue })
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
onAfterChange = () => {
|
|
139
|
+
this.setState({ drag: false })
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Обработчик нажатия кнопки управления
|
|
144
|
+
* @memberof Audio
|
|
145
|
+
*/
|
|
146
|
+
onButtonClick = () => {
|
|
147
|
+
switch (this.state.status) {
|
|
148
|
+
case EAudioStatuses.LOADING:
|
|
149
|
+
this.loadCancel()
|
|
150
|
+
break
|
|
151
|
+
case EAudioStatuses.PLAYING:
|
|
152
|
+
this.pause()
|
|
153
|
+
break
|
|
154
|
+
default:
|
|
155
|
+
this.play()
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Обработчик события загрузки метаданных записи
|
|
161
|
+
* @param {*} event дескриптор события
|
|
162
|
+
* @memberof Audio
|
|
163
|
+
*/
|
|
164
|
+
onLoadedMetaData = ({ target }) => {
|
|
165
|
+
const { duration } = target || {}
|
|
166
|
+
this.setState({
|
|
167
|
+
duration: duration,
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Обработчик изменения отметки времени исполнения
|
|
173
|
+
* @param {*} event дексриптор события
|
|
174
|
+
* @memberof Audio
|
|
175
|
+
*/
|
|
176
|
+
onTimeUpdate = (event) => {
|
|
177
|
+
const { currentTime } = event.target
|
|
178
|
+
const progress = (currentTime / this.getDuration()) * 100
|
|
179
|
+
this.setState({ progress, currentTime })
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Метод расчета прогресса загруженной записи
|
|
184
|
+
* @param {TimeRanges} timeRanges загруженные промежутки
|
|
185
|
+
* @param {number} duration длительность записи
|
|
186
|
+
* @returns {number}
|
|
187
|
+
* @memberof Audio
|
|
188
|
+
*/
|
|
189
|
+
calcProgress(timeRanges, duration) {
|
|
190
|
+
let buffered = 0
|
|
191
|
+
if (timeRanges && timeRanges.length) {
|
|
192
|
+
for (let i = timeRanges.length - 1; 0 <= i; i--) {
|
|
193
|
+
buffered += timeRanges.end(i) - timeRanges.start(i) + 1
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return Math.min(duration && buffered !== duration ? (buffered / duration) * 100 : 0, 100)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
updateLoadingProgress(buffered, duration) {
|
|
200
|
+
this.setState({
|
|
201
|
+
loadingProgress: this.calcProgress(buffered, duration),
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Обработчик загрузки нового фрагмента записи
|
|
207
|
+
* @param {*} event
|
|
208
|
+
* @memberof Audio
|
|
209
|
+
*/
|
|
210
|
+
onProgress = ({ target }) => {
|
|
211
|
+
const { buffered, duration } = target || {}
|
|
212
|
+
/* считаем и записываем процент загрузки аудиозаписи*/
|
|
213
|
+
this.updateLoadingProgress(buffered, duration)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Обработчик при включении проигрывания записи
|
|
218
|
+
* @param {*} event
|
|
219
|
+
* @memberof Audio
|
|
220
|
+
*/
|
|
221
|
+
onPlay = () => {
|
|
222
|
+
this.setState({ status: EAudioStatuses.PLAYING })
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Обработчик при постновки записи на паузу
|
|
227
|
+
* @param {*} event дескриптор события
|
|
228
|
+
* @memberof Audio
|
|
229
|
+
*/
|
|
230
|
+
onPause = () => {
|
|
231
|
+
this.setState({ status: EAudioStatuses.PAUSED })
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Обработчик перехода к проигрыванию записи
|
|
236
|
+
* @memberof Audio
|
|
237
|
+
*/
|
|
238
|
+
onPlaying = () => {
|
|
239
|
+
if (this.state.waitingTimerId) {
|
|
240
|
+
clearTimeout(this.state.waitingTimerId)
|
|
241
|
+
}
|
|
242
|
+
this.setState({ status: EAudioStatuses.PLAYING })
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Обработчик события ожидания, когда что-то грузится
|
|
247
|
+
* @param {*} event дескриптор события
|
|
248
|
+
* @memberof Audio
|
|
249
|
+
*/
|
|
250
|
+
onWaiting = (event) => {
|
|
251
|
+
const { buffered, duration } = event.target || {}
|
|
252
|
+
/* устанавливаем статус "загрузка" через задержку, чтобы не видеть моргания "||" -> "Х" -> "||" при переходе к уже загруженному фрагменту */
|
|
253
|
+
this.setState({
|
|
254
|
+
waitingTimerId: setTimeout(() => {
|
|
255
|
+
this.setState({
|
|
256
|
+
status: EAudioStatuses.LOADING,
|
|
257
|
+
})
|
|
258
|
+
}, 5),
|
|
259
|
+
})
|
|
260
|
+
this.updateLoadingProgress(buffered, duration)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Обработчик достижения конца проигрываемой записи
|
|
265
|
+
* @param {*} event дескриптор события
|
|
266
|
+
* @memberof Audio
|
|
267
|
+
*/
|
|
268
|
+
onEnded = (event) => {
|
|
269
|
+
event.target.currentTime = 0
|
|
270
|
+
this.setState({ status: EAudioStatuses.PAUSED })
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Обработчик возникновения ошибки аудио элемента
|
|
275
|
+
* @memberof Audio
|
|
276
|
+
*/
|
|
277
|
+
onError = () => {
|
|
278
|
+
this.setState({ status: EAudioStatuses.PAUSED })
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Метод рендера содержимого кнопки управления
|
|
283
|
+
* @returns
|
|
284
|
+
* @memberof Audio
|
|
285
|
+
*/
|
|
286
|
+
getButtonCaption() {
|
|
287
|
+
switch (this.state.status) {
|
|
288
|
+
case EAudioStatuses.PAUSED:
|
|
289
|
+
return <i className="icon-play-solid" />
|
|
290
|
+
case EAudioStatuses.PLAYING:
|
|
291
|
+
return <i className="icon-pause" />
|
|
292
|
+
case EAudioStatuses.LOADING:
|
|
293
|
+
return (
|
|
294
|
+
<div>
|
|
295
|
+
<i className="icon-close" />
|
|
296
|
+
</div>
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
durationRender = () => {
|
|
302
|
+
const duration = this.state.currentTime || this.state.drag ? this.state.currentTime : this.state.duration
|
|
303
|
+
return Duration(duration)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
render() {
|
|
307
|
+
let { src, fileName, durationView = 'right', onlyOneIsPlayed } = this.props
|
|
308
|
+
return (
|
|
309
|
+
<>
|
|
310
|
+
<div className="player">
|
|
311
|
+
{/* кнопка */}
|
|
312
|
+
<button
|
|
313
|
+
className="player__btn"
|
|
314
|
+
onClick={this.onButtonClick}
|
|
315
|
+
>
|
|
316
|
+
{this.getButtonCaption()}
|
|
317
|
+
</button>
|
|
318
|
+
{/* полоса прогресса и перемотки */}
|
|
319
|
+
<div className="player__progress">
|
|
320
|
+
<div
|
|
321
|
+
className="player__progress-buffer"
|
|
322
|
+
style={{ width: `${this.state.loadingProgress}%` }}
|
|
323
|
+
/>
|
|
324
|
+
<Slider
|
|
325
|
+
value={[this.state.progress ? this.state.progress : 0]}
|
|
326
|
+
onValueChange={this.onSliderChange}
|
|
327
|
+
onValueCommit={this.onAfterChange}
|
|
328
|
+
/>
|
|
329
|
+
{durationView === 'bottom' && <div className="player__time">{this.durationRender()}</div>}
|
|
330
|
+
</div>
|
|
331
|
+
{/* продолжительность аудиозаписи */}
|
|
332
|
+
{durationView === 'right' && <div className="player__time">{this.durationRender()}</div>}
|
|
333
|
+
{/* HTML5 элемент аудио */}
|
|
334
|
+
<audio
|
|
335
|
+
ref={this.audioRef}
|
|
336
|
+
preload="none"
|
|
337
|
+
onLoadedMetadata={this.onLoadedMetaData}
|
|
338
|
+
onDurationChange={this.onLoadedMetaData}
|
|
339
|
+
onTimeUpdate={this.onTimeUpdate}
|
|
340
|
+
onProgress={this.onProgress}
|
|
341
|
+
onPlay={this.onPlay}
|
|
342
|
+
onPause={this.onPause}
|
|
343
|
+
onPlaying={this.onPlaying}
|
|
344
|
+
onWaiting={this.onWaiting}
|
|
345
|
+
onEnded={this.onEnded}
|
|
346
|
+
onAbort={this.onError}
|
|
347
|
+
onError={this.onError}
|
|
348
|
+
src={src}
|
|
349
|
+
data-only-one-is-played={onlyOneIsPlayed ? 'true' : ''}
|
|
350
|
+
>
|
|
351
|
+
<p>
|
|
352
|
+
<a href={src}>{fileName}</a>
|
|
353
|
+
</p>
|
|
354
|
+
</audio>
|
|
355
|
+
</div>
|
|
356
|
+
</>
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* статусы состояния аудио компонента
|
|
3
|
+
*/
|
|
4
|
+
export enum EAudioStatuses {
|
|
5
|
+
LOADING,
|
|
6
|
+
PLAYING,
|
|
7
|
+
PAUSED
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IState {
|
|
11
|
+
/* текущий статус */
|
|
12
|
+
status: EAudioStatuses;
|
|
13
|
+
/* процесс загрузки */
|
|
14
|
+
loadingProgress: number;
|
|
15
|
+
/* прогресс прослушивания */
|
|
16
|
+
progress: number;
|
|
17
|
+
/** Продолжительность записи (инициализация), будет пересчитано при получении метаданных */
|
|
18
|
+
duration: number;
|
|
19
|
+
/* ИД таймера задержки перед показом лоадера */
|
|
20
|
+
waitingTimerId?: ReturnType<typeof setTimeout>;
|
|
21
|
+
/** Текущее время воспроизведения */
|
|
22
|
+
currentTime: number,
|
|
23
|
+
/** признак когда пользователь взял ползунок перемотки */
|
|
24
|
+
drag: boolean,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IAudioProps {
|
|
28
|
+
/** Продолжительность записи (инициализация), будет пересчитано при получении метаданных */
|
|
29
|
+
duration: number;
|
|
30
|
+
/** Источник аудиозаписи */
|
|
31
|
+
src: string,
|
|
32
|
+
/** Имя файла, отображаемое когда невозможно отобразить контрол аудиозаписи */
|
|
33
|
+
fileName: string,
|
|
34
|
+
/** Уровень звука [0,1] */
|
|
35
|
+
volume: number,
|
|
36
|
+
/** Расположение продолжительности аудиозаписи */
|
|
37
|
+
durationView: 'right' | 'bottom',
|
|
38
|
+
/** Только один элемент проигрывается на странице */
|
|
39
|
+
onlyOneIsPlayed: boolean,
|
|
40
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const badgeClasses = {
|
|
7
|
+
variant: {
|
|
8
|
+
base: `
|
|
9
|
+
inline-block
|
|
10
|
+
focus:ring-2
|
|
11
|
+
focus:ring-ring
|
|
12
|
+
focus:ring-offset-2
|
|
13
|
+
focus:outline-none
|
|
14
|
+
transition-colors
|
|
15
|
+
rounded-full
|
|
16
|
+
`,
|
|
17
|
+
default: `
|
|
18
|
+
bg-critical
|
|
19
|
+
text-white
|
|
20
|
+
`,
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: 'size-[16px] text-[10px] text-center leadimg-[1] truncate',
|
|
24
|
+
dot: 'size-[10px] bg-critical-light border-critical border-[3px]',
|
|
25
|
+
sm: '',
|
|
26
|
+
md: '',
|
|
27
|
+
lg: '',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const badgeVariants = cva(badgeClasses.variant.base, {
|
|
32
|
+
variants: {
|
|
33
|
+
variant: {
|
|
34
|
+
default: badgeClasses.variant.default,
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
default: badgeClasses.size.default,
|
|
38
|
+
dot: badgeClasses.size.dot
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
variant: 'default',
|
|
43
|
+
size: 'default',
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
|
48
|
+
|
|
49
|
+
function Badge({ className, variant, size, ...props }: BadgeProps) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
className={cn(badgeVariants({ variant, size }), className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Badge, badgeVariants } from './Badge'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { ChangeEvent, ForwardedRef } from 'react'
|
|
2
|
+
import { IMaskInput } from 'react-imask'
|
|
3
|
+
import { IInputProps } from './types'
|
|
4
|
+
|
|
5
|
+
const Base = React.forwardRef<HTMLInputElement, IInputProps>(
|
|
6
|
+
({ onChange, type = 'text', mask, ...props }: IInputProps, ref: ForwardedRef<HTMLInputElement>) => {
|
|
7
|
+
const handleChange = (event: ChangeEvent<HTMLInputElement>): void => {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const val = event.target.value
|
|
10
|
+
onChange?.(val, event)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!mask) {
|
|
14
|
+
return (
|
|
15
|
+
<input
|
|
16
|
+
type={type}
|
|
17
|
+
ref={ref}
|
|
18
|
+
onChange={handleChange}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
<IMaskInput
|
|
27
|
+
type={type}
|
|
28
|
+
inputRef={ref}
|
|
29
|
+
mask={mask}
|
|
30
|
+
onChange={handleChange}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
export default Base
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { ForwardedRef } from 'react'
|
|
2
|
+
import Base from './Base'
|
|
3
|
+
import { IInputProps } from './types'
|
|
4
|
+
|
|
5
|
+
const Input = React.forwardRef<HTMLInputElement, IInputProps>(
|
|
6
|
+
({ onChange, value, clearable, ...props }: IInputProps, ref: ForwardedRef<HTMLInputElement>) => {
|
|
7
|
+
const handleClearClick = (): void => {
|
|
8
|
+
onChange?.('')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!clearable) {
|
|
12
|
+
return (
|
|
13
|
+
<Base
|
|
14
|
+
ref={ref}
|
|
15
|
+
onChange={onChange}
|
|
16
|
+
value={value}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="input_wrap_clear">
|
|
24
|
+
<Base
|
|
25
|
+
ref={ref}
|
|
26
|
+
onChange={onChange}
|
|
27
|
+
value={value}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
{value && (
|
|
31
|
+
<a
|
|
32
|
+
className="input_clear icon-cancel"
|
|
33
|
+
onClick={handleClearClick}
|
|
34
|
+
style={{ visibility: 'initial' }}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
export default Input
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ChangeEvent, ChangeEventHandler } from 'react'
|
|
2
|
+
|
|
3
|
+
type CustomChangeEventHandler = (value: string, event?: ChangeEvent<HTMLInputElement>) => void
|
|
4
|
+
|
|
5
|
+
type CombinedChangeEventHandler = ChangeEventHandler<HTMLInputElement> & CustomChangeEventHandler
|
|
6
|
+
|
|
7
|
+
export interface IInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
8
|
+
onChange?: CombinedChangeEventHandler
|
|
9
|
+
mask?: string | RegExp | (string | RegExp)[] | NumberConstructor
|
|
10
|
+
clearable?: boolean
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
type TextLinkProps = React.HTMLProps<HTMLAnchorElement>
|
|
4
|
+
|
|
5
|
+
const TextLink = React.forwardRef<HTMLAnchorElement, TextLinkProps>(({ children, ...props }, ref) => {
|
|
6
|
+
return (
|
|
7
|
+
<a
|
|
8
|
+
ref={ref}
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
{children}
|
|
12
|
+
</a>
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export default TextLink
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
3
|
+
import { cn } from '../@/lib/utils'
|
|
4
|
+
|
|
5
|
+
export interface BottomNavigationLinkProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
asChild?: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type IProps = {
|
|
10
|
+
className?: string
|
|
11
|
+
children: React.ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const btnClasses = `
|
|
15
|
+
inline-flex
|
|
16
|
+
flex-col
|
|
17
|
+
place-items-center
|
|
18
|
+
gap-y-[8px]
|
|
19
|
+
w-full
|
|
20
|
+
p-[8px]
|
|
21
|
+
text-[10px]
|
|
22
|
+
text-center
|
|
23
|
+
text-light
|
|
24
|
+
leading-[1.33]
|
|
25
|
+
transition
|
|
26
|
+
duration-300
|
|
27
|
+
hover:bg-btn-ghost-hover
|
|
28
|
+
hover:text-primary
|
|
29
|
+
focus:bg-btn-ghost-focus
|
|
30
|
+
active:bg-btn-ghost-active
|
|
31
|
+
data-[status=active]:text-primary
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
const BottomNavigationLink = React.forwardRef<HTMLButtonElement, BottomNavigationLinkProps>(({ className, asChild, ...props }, ref) => {
|
|
35
|
+
const Comp = asChild ? Slot : "button"
|
|
36
|
+
return (
|
|
37
|
+
<Comp
|
|
38
|
+
className={cn(btnClasses, className)}
|
|
39
|
+
ref={ref}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
BottomNavigationLink.displayName = 'BottomNavigationLink'
|
|
46
|
+
|
|
47
|
+
const BottomNavigationListItem = React.forwardRef(({ className, children }: IProps, ref) => (
|
|
48
|
+
<li className={className}>{children}</li>
|
|
49
|
+
))
|
|
50
|
+
BottomNavigationListItem.displayName = 'BottomNavigationListItem'
|
|
51
|
+
|
|
52
|
+
const BottomNavigationList = React.forwardRef(({ className, children }: IProps, ref) => (
|
|
53
|
+
<ul className="flex *:w-[calc(100%_/_5)]">{children}</ul>
|
|
54
|
+
))
|
|
55
|
+
BottomNavigationList.displayName = 'BottomNavigationList'
|
|
56
|
+
|
|
57
|
+
const BottomNavigation = React.forwardRef(({ className, children }: IProps, ref) => {
|
|
58
|
+
return <nav className={className}>{children}</nav>
|
|
59
|
+
})
|
|
60
|
+
BottomNavigation.displayName = 'BottomNavigation'
|
|
61
|
+
|
|
62
|
+
export { BottomNavigation, BottomNavigationList, BottomNavigationListItem, BottomNavigationLink }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BottomNavigation, BottomNavigationList, BottomNavigationListItem, BottomNavigationLink } from './BottomNavigation'
|