@onesy/ui-react 1.0.129 → 1.0.131
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/Accordion/Accordion.js +342 -242
- package/Accordion/index.js +12 -7
- package/AdvancedTextField/AdvancedTextField.js +165 -157
- package/AdvancedTextField/index.js +12 -7
- package/Append/Append.js +502 -519
- package/Append/index.js +12 -7
- package/AreaChart/AreaChart.js +53 -40
- package/AreaChart/index.js +12 -7
- package/AreaChartItem/AreaChartItem.js +325 -237
- package/AreaChartItem/index.js +12 -7
- package/AudioPlayer/AudioPlayer.js +683 -466
- package/AudioPlayer/index.js +12 -7
- package/AudioRecorder/AudioRecorder.js +359 -259
- package/AudioRecorder/index.js +12 -7
- package/AutoComplete/AutoComplete.js +693 -568
- package/AutoComplete/index.js +12 -7
- package/AutoCompleteCountry/AutoCompleteCountry.js +99 -62
- package/AutoCompleteCountry/index.js +12 -7
- package/AutoCompleteCurrency/AutoCompleteCurrency.js +73 -61
- package/AutoCompleteCurrency/index.js +12 -7
- package/Avatar/Avatar.js +113 -86
- package/Avatar/index.js +12 -7
- package/AvatarGroup/AvatarGroup.js +104 -87
- package/AvatarGroup/index.js +12 -7
- package/Backdrop/Backdrop.js +160 -139
- package/Backdrop/index.js +12 -7
- package/Badge/Badge.js +116 -96
- package/Badge/index.js +12 -7
- package/Banner/Banner.js +126 -85
- package/Banner/index.js +12 -7
- package/BottomAppBar/BottomAppBar.js +89 -60
- package/BottomAppBar/index.js +12 -7
- package/BottomSheet/BottomSheet.js +66 -59
- package/BottomSheet/index.js +12 -7
- package/Box/Box.js +43 -35
- package/Box/index.js +12 -7
- package/Breadcrumbs/Breadcrumbs.js +168 -144
- package/Breadcrumbs/index.js +12 -7
- package/BubbleChart/BubbleChart.js +261 -132
- package/BubbleChart/index.js +12 -7
- package/BubbleChartItem/BubbleChartItem.js +228 -161
- package/BubbleChartItem/index.js +12 -7
- package/Button/Button.js +488 -467
- package/Button/index.js +12 -7
- package/Buttons/Buttons.js +366 -293
- package/Buttons/index.js +12 -7
- package/Calendar/Calendar.js +715 -452
- package/Calendar/index.js +12 -7
- package/CalendarAvailability/CalendarAvailability.js +709 -388
- package/CalendarAvailability/index.js +12 -7
- package/CalendarMenu/CalendarMenu.js +430 -303
- package/CalendarMenu/index.js +12 -7
- package/CalendarMonth/CalendarMonth.js +537 -498
- package/CalendarMonth/index.js +12 -7
- package/CalendarViews/CalendarViews.js +403 -254
- package/CalendarViews/index.js +12 -7
- package/CalendarWeek/CalendarWeek.js +536 -395
- package/CalendarWeek/index.js +12 -7
- package/Card/Card.js +133 -101
- package/Card/index.js +12 -7
- package/CardButton/CardButton.js +78 -58
- package/CardButton/index.js +12 -7
- package/CardFooter/CardFooter.js +58 -39
- package/CardFooter/index.js +12 -7
- package/CardHeader/CardHeader.js +61 -44
- package/CardHeader/index.js +12 -7
- package/CardImage/CardImage.js +80 -67
- package/CardImage/index.js +12 -7
- package/CardMain/CardMain.js +53 -39
- package/CardMain/index.js +12 -7
- package/Carousel/Carousel.js +1025 -913
- package/Carousel/index.js +12 -7
- package/Chart/Chart.js +1325 -1174
- package/Chart/index.js +12 -7
- package/Checkbox/Checkbox.js +339 -325
- package/Checkbox/index.js +12 -7
- package/Chip/Chip.js +131 -102
- package/Chip/index.js +12 -7
- package/Chips/Chips.js +121 -94
- package/Chips/index.js +12 -7
- package/ClickListener/ClickListener.js +86 -89
- package/ClickListener/index.js +12 -7
- package/Clock/Clock.js +470 -417
- package/Clock/index.js +12 -7
- package/ColorTextField/ColorTextField.js +234 -171
- package/ColorTextField/index.js +12 -7
- package/ColumnChart/ColumnChart.js +63 -46
- package/ColumnChart/index.js +12 -7
- package/ColumnChartItem/ColumnChartItem.js +208 -149
- package/ColumnChartItem/index.js +12 -7
- package/Confirm/Confirm.js +184 -129
- package/Confirm/Context.js +9 -7
- package/Confirm/index.js +32 -13
- package/Confirm/useConfirm.js +11 -10
- package/Container/Container.js +154 -133
- package/Container/index.js +12 -7
- package/CookieBanner/CookieBanner.js +142 -76
- package/CookieBanner/index.js +12 -7
- package/Countdown/Countdown.js +403 -255
- package/Countdown/index.js +12 -7
- package/DatePicker/DatePicker.js +802 -547
- package/DatePicker/index.js +12 -7
- package/DateRangePicker/DateRangePicker.js +44 -37
- package/DateRangePicker/index.js +12 -7
- package/DateTimePicker/DateTimePicker.js +672 -459
- package/DateTimePicker/index.js +12 -7
- package/DateTimeRangePicker/DateTimeRangePicker.js +44 -37
- package/DateTimeRangePicker/index.js +12 -7
- package/Divider/Divider.js +198 -185
- package/Divider/index.js +12 -7
- package/DonutChart/DonutChart.js +49 -42
- package/DonutChart/index.js +12 -7
- package/DragAndDropList/DragAndDropList.js +160 -156
- package/DragAndDropList/index.js +12 -7
- package/Drawing/Drawing.js +850 -523
- package/Drawing/index.js +12 -7
- package/DropZone/DropZone.js +239 -201
- package/DropZone/index.js +12 -7
- package/Emojis/Emojis.js +409 -317
- package/Emojis/emojis_list.js +7279 -9250
- package/Emojis/index.js +19 -9
- package/Expand/Expand.js +201 -149
- package/Expand/index.js +12 -7
- package/Fab/Fab.js +46 -26
- package/Fab/index.js +12 -7
- package/Fade/Fade.js +131 -101
- package/Fade/index.js +12 -7
- package/FileChoose/FileChoose.js +218 -150
- package/FileChoose/index.js +12 -7
- package/Focus/Focus.js +87 -88
- package/Focus/index.js +12 -7
- package/Form/Form.js +194 -120
- package/Form/index.js +12 -7
- package/FormRow/FormRow.js +123 -78
- package/FormRow/index.js +12 -7
- package/Forms/Forms.js +55 -41
- package/Forms/index.js +12 -7
- package/Frame/Frame.js +212 -150
- package/Frame/index.js +12 -7
- package/Grid/Grid.js +231 -166
- package/Grid/index.js +12 -7
- package/Grow/Grow.js +137 -109
- package/Grow/index.js +12 -7
- package/HTMLCanvas/HTMLCanvas.js +752 -542
- package/HTMLCanvas/index.js +24 -21
- package/IFrame/IFrame.js +122 -104
- package/IFrame/index.js +12 -7
- package/Icon/Icon.js +112 -95
- package/Icon/index.js +24 -21
- package/IconButton/IconButton.js +49 -37
- package/IconButton/index.js +12 -7
- package/Image/Image.js +285 -252
- package/Image/index.js +12 -7
- package/ImageCrop/ImageCrop.js +1073 -1048
- package/ImageCrop/index.js +12 -7
- package/ImageEdit/ImageEdit.js +1088 -783
- package/ImageEdit/index.js +12 -7
- package/ImageGallery/ImageGallery.js +518 -473
- package/ImageGallery/index.js +12 -7
- package/ImageList/ImageList.js +136 -129
- package/ImageList/index.js +12 -7
- package/ImageListItem/ImageListItem.js +101 -87
- package/ImageListItem/index.js +12 -7
- package/ImageListItemBox/ImageListItemBox.js +61 -50
- package/ImageListItemBox/index.js +12 -7
- package/Info/Info.js +99 -63
- package/Info/index.js +12 -7
- package/Interaction/Interaction.js +405 -345
- package/Interaction/index.js +12 -7
- package/Keyframes/Context.js +9 -7
- package/Keyframes/Keyframes.js +189 -174
- package/Keyframes/index.js +42 -25
- package/Keyframes/useKeyframes.js +11 -10
- package/Label/Label.js +177 -151
- package/Label/index.js +12 -7
- package/Labels/Labels.js +126 -98
- package/Labels/index.js +12 -7
- package/Line/Line.js +296 -174
- package/Line/index.js +12 -7
- package/LineChart/LineChart.js +57 -40
- package/LineChart/index.js +12 -7
- package/LineChartItem/LineChartItem.js +239 -177
- package/LineChartItem/index.js +12 -7
- package/LinearMeter/LinearMeter.js +453 -377
- package/LinearMeter/index.js +12 -7
- package/LinearProgress/LinearProgress.js +324 -255
- package/LinearProgress/index.js +12 -7
- package/Link/Link.js +182 -127
- package/Link/index.js +12 -7
- package/Links/Links.js +277 -156
- package/Links/index.js +12 -7
- package/List/List.js +148 -113
- package/List/index.js +12 -7
- package/ListItem/ListItem.js +388 -362
- package/ListItem/index.js +12 -7
- package/ListSubheader/ListSubheader.js +52 -44
- package/ListSubheader/index.js +12 -7
- package/MainProgress/Context.js +9 -7
- package/MainProgress/MainProgress.js +193 -161
- package/MainProgress/index.js +32 -13
- package/MainProgress/useMainProgress.js +11 -10
- package/Markdown/Markdown.js +676 -704
- package/Markdown/index.js +12 -7
- package/Masonry/Masonry.js +207 -181
- package/Masonry/index.js +12 -7
- package/Medias/Medias.js +436 -398
- package/Medias/index.js +12 -7
- package/Menu/Menu.js +278 -243
- package/Menu/index.js +12 -7
- package/MenuDesktop/MenuDesktop.js +496 -419
- package/MenuDesktop/index.js +12 -7
- package/MenuItem/MenuItem.js +286 -231
- package/MenuItem/index.js +12 -7
- package/Meta/Meta.js +78 -54
- package/Meta/index.js +12 -7
- package/Modal/Modal.js +333 -272
- package/Modal/index.js +12 -7
- package/ModalFooter/ModalFooter.js +50 -39
- package/ModalFooter/index.js +12 -7
- package/ModalHeader/ModalHeader.js +51 -39
- package/ModalHeader/index.js +12 -7
- package/ModalIcon/ModalIcon.js +29 -23
- package/ModalIcon/index.js +12 -7
- package/ModalMain/ModalMain.js +50 -41
- package/ModalMain/index.js +12 -7
- package/ModalText/ModalText.js +47 -37
- package/ModalText/index.js +12 -7
- package/ModalTitle/ModalTitle.js +47 -37
- package/ModalTitle/index.js +12 -7
- package/MoreOptions/MoreOptions.js +72 -52
- package/MoreOptions/index.js +12 -7
- package/Move/Move.js +166 -141
- package/Move/index.js +12 -7
- package/NavigationBar/NavigationBar.js +133 -109
- package/NavigationBar/index.js +12 -7
- package/NavigationDrawer/NavigationDrawer.js +241 -211
- package/NavigationDrawer/index.js +12 -7
- package/NavigationItem/NavigationItem.js +293 -262
- package/NavigationItem/index.js +12 -7
- package/NavigationRail/NavigationRail.js +187 -150
- package/NavigationRail/index.js +12 -7
- package/NotFound/NotFound.js +89 -66
- package/NotFound/index.js +12 -7
- package/NumericTextField/NumericTextField.js +217 -212
- package/NumericTextField/index.js +12 -7
- package/Page/Page.js +131 -67
- package/Page/index.js +12 -7
- package/PageTransition/PageTransition.js +112 -102
- package/PageTransition/index.js +12 -7
- package/Pagination/Pagination.js +153 -98
- package/Pagination/index.js +12 -7
- package/PaginationItem/PaginationItem.js +85 -65
- package/PaginationItem/index.js +12 -7
- package/Parallax/Parallax.js +138 -145
- package/Parallax/index.js +12 -7
- package/Path/Path.js +40 -35
- package/Path/index.js +12 -7
- package/PieChart/PieChart.js +382 -267
- package/PieChart/index.js +12 -7
- package/Placeholder/Placeholder.js +125 -117
- package/Placeholder/index.js +12 -7
- package/Portal/Portal.js +37 -38
- package/Portal/index.js +12 -7
- package/Properties/Properties.js +85 -64
- package/Properties/index.js +12 -7
- package/Property/Property.js +120 -108
- package/Property/index.js +12 -7
- package/Radio/Radio.js +211 -181
- package/Radio/index.js +12 -7
- package/Radios/Radios.js +124 -92
- package/Radios/index.js +12 -7
- package/Rating/Rating.js +353 -360
- package/Rating/index.js +12 -7
- package/Reset/Reset.js +19 -24
- package/Reset/index.js +12 -7
- package/Reveal/Reveal.js +98 -89
- package/Reveal/index.js +12 -7
- package/RichTextEditor/RichTextEditor.js +1764 -972
- package/RichTextEditor/index.js +12 -7
- package/RoundMeter/RoundMeter.js +629 -537
- package/RoundMeter/index.js +12 -7
- package/RoundProgress/RoundProgress.js +233 -174
- package/RoundProgress/index.js +12 -7
- package/ScatterChart/ScatterChart.js +53 -40
- package/ScatterChart/index.js +12 -7
- package/ScatterChartItem/ScatterChartItem.js +214 -153
- package/ScatterChartItem/index.js +12 -7
- package/ScreenCapture/ScreenCapture.js +427 -335
- package/ScreenCapture/index.js +12 -7
- package/Section/Section.js +380 -319
- package/Section/index.js +12 -7
- package/SectionAction/SectionAction.js +72 -61
- package/SectionAction/index.js +12 -7
- package/SectionBoxes/SectionBoxes.js +240 -208
- package/SectionBoxes/index.js +12 -7
- package/SectionCards/SectionCards.js +256 -217
- package/SectionCards/index.js +12 -7
- package/SectionCarousel/SectionCarousel.js +284 -242
- package/SectionCarousel/index.js +12 -7
- package/SectionContact/SectionContact.js +174 -116
- package/SectionContact/index.js +12 -7
- package/SectionImageGallery/SectionImageGallery.js +64 -51
- package/SectionImageGallery/index.js +12 -7
- package/SectionLogos/SectionLogos.js +123 -109
- package/SectionLogos/index.js +12 -7
- package/SectionMedia/SectionMedia.js +170 -152
- package/SectionMedia/index.js +12 -7
- package/SectionReviews/SectionReviews.js +170 -129
- package/SectionReviews/index.js +12 -7
- package/SectionTextMedia/SectionTextMedia.js +187 -142
- package/SectionTextMedia/index.js +12 -7
- package/SectionTimeline/SectionTimeline.js +126 -95
- package/SectionTimeline/index.js +12 -7
- package/SectionWatch/SectionWatch.js +65 -53
- package/SectionWatch/index.js +12 -7
- package/Select/Select.js +517 -406
- package/Select/index.js +12 -7
- package/Share/Share.js +458 -319
- package/Share/index.js +12 -7
- package/Slide/Slide.js +184 -140
- package/Slide/index.js +12 -7
- package/Slider/Slider.js +927 -837
- package/Slider/index.js +12 -7
- package/SmartTextField/SmartTextField.js +1406 -1014
- package/SmartTextField/index.js +12 -7
- package/Snackbar/Snackbar.js +227 -185
- package/Snackbar/index.js +12 -7
- package/Snackbars/Context.js +9 -7
- package/Snackbars/Snackbars.js +234 -210
- package/Snackbars/index.js +32 -13
- package/Snackbars/useSnackbars.js +11 -10
- package/Space/Space.js +1683 -968
- package/Space/index.js +24 -21
- package/SpeechToText/SpeechToText.js +207 -172
- package/SpeechToText/index.js +12 -7
- package/SpeedDial/SpeedDial.js +434 -398
- package/SpeedDial/index.js +12 -7
- package/SpeedDialItem/SpeedDialItem.js +89 -63
- package/SpeedDialItem/index.js +12 -7
- package/SpyScroll/SpyScroll.js +154 -142
- package/SpyScroll/index.js +12 -7
- package/Step/Step.js +181 -127
- package/Step/index.js +12 -7
- package/Stepper/Stepper.js +159 -139
- package/Stepper/index.js +12 -7
- package/Surface/Surface.js +760 -798
- package/Surface/index.js +12 -7
- package/Switch/Switch.js +688 -532
- package/Switch/index.js +12 -7
- package/Tab/Tab.js +185 -150
- package/Tab/index.js +12 -7
- package/Table/Table.js +100 -77
- package/Table/index.js +12 -7
- package/TableBody/TableBody.js +76 -63
- package/TableBody/index.js +12 -7
- package/TableCell/TableCell.js +258 -220
- package/TableCell/index.js +12 -7
- package/TableFooter/TableFooter.js +60 -48
- package/TableFooter/index.js +12 -7
- package/TableHead/TableHead.js +139 -120
- package/TableHead/index.js +12 -7
- package/TableHeader/TableHeader.js +65 -50
- package/TableHeader/index.js +12 -7
- package/TablePagination/TablePagination.js +171 -98
- package/TablePagination/index.js +12 -7
- package/TableRow/TableRow.js +77 -64
- package/TableRow/index.js +12 -7
- package/Tabs/Tabs.js +425 -377
- package/Tabs/index.js +12 -7
- package/Text/Text.js +131 -113
- package/Text/index.js +12 -7
- package/TextField/TextField.js +940 -879
- package/TextField/index.js +12 -7
- package/TextToSpeech/TextToSpeech.js +176 -153
- package/TextToSpeech/index.js +12 -7
- package/TimePicker/TimePicker.js +985 -718
- package/TimePicker/index.js +12 -7
- package/TimeRangePicker/TimeRangePicker.js +44 -37
- package/TimeRangePicker/index.js +12 -7
- package/Timeline/Timeline.js +54 -42
- package/Timeline/index.js +12 -7
- package/TimelineItem/TimelineItem.js +144 -147
- package/TimelineItem/index.js +12 -7
- package/Timer/Timer.js +321 -204
- package/Timer/index.js +12 -7
- package/ToggleButton/ToggleButton.js +67 -58
- package/ToggleButton/index.js +12 -7
- package/ToggleButtons/ToggleButtons.js +46 -37
- package/ToggleButtons/index.js +12 -7
- package/Tooltip/Tooltip.js +489 -454
- package/Tooltip/index.js +12 -7
- package/TopAppBar/TopAppBar.js +237 -197
- package/TopAppBar/index.js +12 -7
- package/Transition/Context.js +9 -7
- package/Transition/Transition.js +321 -339
- package/Transition/index.js +42 -25
- package/Transition/useTransition.js +11 -10
- package/Transitions/Transitions.js +215 -179
- package/Transitions/index.js +12 -7
- package/Tree/Tree.js +375 -312
- package/Tree/index.js +12 -7
- package/Type/Type.js +251 -152
- package/Type/index.js +12 -7
- package/VideoPlayer/VideoPlayer.js +866 -656
- package/VideoPlayer/index.js +12 -7
- package/ViewSplit/ViewSplit.js +413 -387
- package/ViewSplit/index.js +12 -7
- package/Watch/Watch.js +436 -290
- package/Watch/index.js +12 -7
- package/Weather/Weather.js +294 -247
- package/Weather/index.js +12 -7
- package/Whiteboard/Whiteboard.js +1392 -1292
- package/Whiteboard/index.js +12 -7
- package/Widgets/Context.js +9 -7
- package/Widgets/Widgets.js +220 -168
- package/Widgets/index.js +32 -13
- package/Widgets/useWidgets.js +11 -10
- package/WindowSplit/WindowSplit.js +381 -336
- package/WindowSplit/index.js +12 -7
- package/Zoom/Zoom.js +126 -99
- package/Zoom/index.js +12 -7
- package/esm/BottomAppBar/BottomAppBar.js +5 -4
- package/esm/Buttons/Buttons.js +1 -1
- package/esm/index.js +1 -1
- package/index.js +4053 -660
- package/package.json +1 -1
- package/types.js +4 -1
- package/useForm/index.js +25 -11
- package/useForm/useForm.js +203 -174
- package/useForm/validate.js +215 -203
- package/useLocation/index.js +12 -7
- package/useLocation/useLocation.js +54 -49
- package/useMediaQuery/index.js +12 -7
- package/useMediaQuery/useMediaQuery.js +44 -43
- package/useQuery/index.js +12 -7
- package/useQuery/useQuery.js +14 -10
- package/useScroll/index.js +12 -7
- package/useScroll/useScroll.js +61 -56
- package/useSubscription/index.js +12 -7
- package/useSubscription/useSubscription.js +35 -35
- package/useSwipe/index.js +12 -7
- package/useSwipe/useSwipe.js +157 -131
- package/useVisible/index.js +12 -7
- package/useVisible/useVisible.js +86 -76
- package/utils.js +1224 -1362
package/TextField/TextField.js
CHANGED
|
@@ -1,900 +1,961 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _utils = require("@onesy/utils");
|
|
13
|
+
var _styleReact = require("@onesy/style-react");
|
|
14
|
+
var _IconMaterialPassword2W = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialPassword2W100"));
|
|
15
|
+
var _IconMaterialPassword2OffW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialPassword2OffW100"));
|
|
16
|
+
var _IconMaterialCloseW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialCloseW100"));
|
|
17
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip"));
|
|
18
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
19
|
+
var _Type = _interopRequireDefault(require("../Type"));
|
|
20
|
+
var _Line = _interopRequireDefault(require("../Line"));
|
|
21
|
+
var _useMediaQuery = _interopRequireDefault(require("../useMediaQuery"));
|
|
22
|
+
var _utils2 = require("../utils");
|
|
23
|
+
const _excluded = ["tonal", "color", "version", "size", "rootRef", "valueDefault", "value", "onChange", "name", "label", "align", "start", "startVerticalAlign", "end", "endVerticalAlign", "placeholder", "fullWidth", "helperText", "counter", "prefix", "sufix", "noPrefixMargin", "noSufixMargin", "enabled", "autoFocus", "autoComplete", "type", "required", "optional", "optionalText", "error", "multiline", "rows", "minRows", "maxRows", "clear", "focus", "footer", "subscription", "controlled", "minimal", "restoreSelection", "minWidth", "readOnly", "disabled", "onInput", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "inputProps", "InputWrapperProps", "HelperTextProps", "IconProps", "IconClear", "InputComponent", "WrapperComponent", "Component", "className", "style", "children", "colorUnchecked"];
|
|
24
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
|
+
const useStyle = (0, _styleReact.style)(theme => {
|
|
27
|
+
const other = {
|
|
28
|
+
pointerEvents: 'none',
|
|
29
|
+
borderRadius: 'inherit',
|
|
30
|
+
boxSizing: 'border-box',
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
inset: '0',
|
|
33
|
+
width: '100%',
|
|
34
|
+
height: '100%'
|
|
35
|
+
};
|
|
36
|
+
const overflow = {
|
|
37
|
+
width: '100%',
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
whiteSpace: 'nowrap',
|
|
40
|
+
textOverflow: 'ellipsis'
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
wrapper: {
|
|
44
|
+
position: 'relative',
|
|
45
|
+
display: 'inline-flex',
|
|
46
|
+
flexDirection: 'column'
|
|
47
|
+
},
|
|
48
|
+
root: {
|
|
49
|
+
display: 'inline-flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
position: 'relative',
|
|
52
|
+
borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
|
|
53
|
+
'& > *': {
|
|
54
|
+
'&::-webkit-scrollbar': {
|
|
55
|
+
width: '0px',
|
|
56
|
+
height: '0px'
|
|
10
57
|
}
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
// Color
|
|
61
|
+
color_default: {
|
|
62
|
+
color: theme.palette.text.default.primary
|
|
63
|
+
},
|
|
64
|
+
color_neutral: {
|
|
65
|
+
color: theme.palette.color.neutral.main
|
|
66
|
+
},
|
|
67
|
+
color_primary: {
|
|
68
|
+
color: theme.palette.color.primary.main
|
|
69
|
+
},
|
|
70
|
+
color_secondary: {
|
|
71
|
+
color: theme.palette.color.secondary.main
|
|
72
|
+
},
|
|
73
|
+
color_tertiary: {
|
|
74
|
+
color: theme.palette.color.tertiary.main
|
|
75
|
+
},
|
|
76
|
+
color_quaternary: {
|
|
77
|
+
color: theme.palette.color.quaternary.main
|
|
78
|
+
},
|
|
79
|
+
color_info: {
|
|
80
|
+
color: theme.palette.color.info.main
|
|
81
|
+
},
|
|
82
|
+
color_success: {
|
|
83
|
+
color: theme.palette.color.success.main
|
|
84
|
+
},
|
|
85
|
+
color_warning: {
|
|
86
|
+
color: theme.palette.color.warning.main
|
|
87
|
+
},
|
|
88
|
+
color_error: {
|
|
89
|
+
color: theme.palette.color.error.main
|
|
90
|
+
},
|
|
91
|
+
error_color: {
|
|
92
|
+
color: [theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80], '!important']
|
|
93
|
+
},
|
|
94
|
+
error_hover_color: {
|
|
95
|
+
color: [theme.palette.light ? theme.palette.color.error[20] : theme.palette.color.error[90], '!important']
|
|
96
|
+
},
|
|
97
|
+
inputWrapper: _objectSpread({
|
|
98
|
+
// Reset
|
|
99
|
+
margin: '0',
|
|
100
|
+
border: '0',
|
|
101
|
+
fontFamily: 'inherit',
|
|
102
|
+
fontSize: '100%',
|
|
103
|
+
lineHeight: '1.15',
|
|
104
|
+
overflow: 'visible',
|
|
105
|
+
boxSizing: 'border-box',
|
|
106
|
+
display: 'flex',
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
flexWrap: 'wrap',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
opacity: '0',
|
|
111
|
+
transition: theme.methods.transitions.make('opacity'),
|
|
112
|
+
borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
|
|
113
|
+
cursor: 'text',
|
|
114
|
+
zIndex: '1',
|
|
115
|
+
flex: '1 1 auto'
|
|
116
|
+
}, theme.typography.values.b2),
|
|
117
|
+
inputWrapper_focus: {
|
|
118
|
+
opacity: '1'
|
|
119
|
+
},
|
|
120
|
+
input: _objectSpread(_objectSpread({
|
|
121
|
+
// Reset
|
|
122
|
+
margin: '0',
|
|
123
|
+
border: '0',
|
|
124
|
+
outline: 'none',
|
|
125
|
+
color: theme.palette.text.default.primary,
|
|
126
|
+
background: 'transparent',
|
|
127
|
+
'-webkit-tap-highlight-color': 'transparent',
|
|
128
|
+
textAlign: 'start'
|
|
129
|
+
}, theme.typography.values.b2), overflow),
|
|
130
|
+
multiline: {
|
|
131
|
+
resize: 'none',
|
|
132
|
+
overflow: 'auto',
|
|
133
|
+
whiteSpace: 'normal'
|
|
134
|
+
},
|
|
135
|
+
input_size_small: {
|
|
136
|
+
// height: '48px',
|
|
137
|
+
padding: `${theme.methods.space.value(1, 'px')} ${theme.methods.space.value(2, 'px')}`,
|
|
138
|
+
paddingTop: theme.methods.space.value(2.5, 'px')
|
|
139
|
+
},
|
|
140
|
+
input_size_regular: {
|
|
141
|
+
// height: '56px',
|
|
142
|
+
padding: `11px ${theme.methods.space.value(2, 'px')}`,
|
|
143
|
+
paddingTop: theme.methods.space.value(3, 'px')
|
|
144
|
+
},
|
|
145
|
+
input_size_large: {
|
|
146
|
+
// height: '64px',
|
|
147
|
+
padding: theme.methods.space.value(2, 'px'),
|
|
148
|
+
paddingTop: theme.methods.space.value(3.5, 'px')
|
|
149
|
+
},
|
|
150
|
+
inputWrapper_without_label_size_small: {
|
|
151
|
+
paddingTop: `${theme.methods.space.value(1, 'px')}`
|
|
152
|
+
},
|
|
153
|
+
inputWrapper_without_label_size_regular: {
|
|
154
|
+
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
155
|
+
},
|
|
156
|
+
inputWrapper_without_label_size_large: {
|
|
157
|
+
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
158
|
+
},
|
|
159
|
+
input_version_text: {
|
|
160
|
+
'&:not($input_start_icon)': {
|
|
161
|
+
paddingInline: '0'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
input_start_icon: {
|
|
165
|
+
paddingInlineStart: '0'
|
|
166
|
+
},
|
|
167
|
+
input_end_icon: {
|
|
168
|
+
paddingInlineEnd: '0'
|
|
169
|
+
},
|
|
170
|
+
input_version_outlined_size_small: {
|
|
171
|
+
paddingTop: theme.methods.space.value(1.75, 'px'),
|
|
172
|
+
paddingBottom: theme.methods.space.value(1.75, 'px')
|
|
173
|
+
},
|
|
174
|
+
input_version_outlined_size_regular: {
|
|
175
|
+
paddingTop: theme.methods.space.value(2.25, 'px'),
|
|
176
|
+
paddingBottom: theme.methods.space.value(2.25, 'px')
|
|
177
|
+
},
|
|
178
|
+
input_version_outlined_size_large: {
|
|
179
|
+
paddingTop: theme.methods.space.value(2.75, 'px'),
|
|
180
|
+
paddingBottom: theme.methods.space.value(2.75, 'px')
|
|
181
|
+
},
|
|
182
|
+
input_align_start: {
|
|
183
|
+
textAlign: 'start'
|
|
184
|
+
},
|
|
185
|
+
input_align_center: {
|
|
186
|
+
textAlign: 'center'
|
|
187
|
+
},
|
|
188
|
+
input_align_end: {
|
|
189
|
+
textAlign: 'end'
|
|
190
|
+
},
|
|
191
|
+
label: _objectSpread(_objectSpread({
|
|
192
|
+
position: 'absolute',
|
|
193
|
+
insetInlineStart: '16px',
|
|
194
|
+
transformOrigin: 'top left',
|
|
195
|
+
transition: theme.methods.transitions.make(['color', 'inset', 'margin', 'transform']),
|
|
196
|
+
pointerEvents: 'none',
|
|
197
|
+
userSelect: 'none',
|
|
198
|
+
zIndex: '1'
|
|
199
|
+
}, overflow), {}, {
|
|
200
|
+
width: 'auto'
|
|
201
|
+
}),
|
|
202
|
+
label_regular: {
|
|
203
|
+
top: '50%',
|
|
204
|
+
transform: 'translate(0px, -50%) scale(1)'
|
|
205
|
+
},
|
|
206
|
+
label_multiline: {
|
|
207
|
+
top: '0px'
|
|
208
|
+
},
|
|
209
|
+
label_rtl: {
|
|
210
|
+
transformOrigin: 'top right'
|
|
211
|
+
},
|
|
212
|
+
label_version_text: {
|
|
213
|
+
insetInlineStart: '0px'
|
|
214
|
+
},
|
|
215
|
+
label_icon_start: {
|
|
216
|
+
insetInlineStart: theme.methods.space.value(6.5, 'px')
|
|
217
|
+
},
|
|
218
|
+
label_size_small_multiline: {
|
|
219
|
+
transform: 'translate(4px, 14px) scale(1)'
|
|
220
|
+
},
|
|
221
|
+
label_size_regular_multiline: {
|
|
222
|
+
transform: 'translate(4px, 18px) scale(1)'
|
|
223
|
+
},
|
|
224
|
+
label_size_large_multiline: {
|
|
225
|
+
transform: 'translate(4px, 22px) scale(1)'
|
|
226
|
+
},
|
|
227
|
+
// Focus
|
|
228
|
+
label_version_text_focus: {
|
|
229
|
+
top: '0px',
|
|
230
|
+
insetInlineStart: '0px',
|
|
231
|
+
transform: 'translate(0, 6px) scale(0.667)'
|
|
232
|
+
},
|
|
233
|
+
label_version_outlined_focus: {
|
|
234
|
+
top: '0px',
|
|
235
|
+
insetInlineStart: '15px',
|
|
236
|
+
marginInlineStart: '4px',
|
|
237
|
+
transform: 'translate(0, -6px) scale(0.667)'
|
|
238
|
+
},
|
|
239
|
+
label_version_filled_focus: {
|
|
240
|
+
top: '0px',
|
|
241
|
+
insetInlineStart: '15px',
|
|
242
|
+
transform: 'translate(0, 6px) scale(0.667)'
|
|
243
|
+
},
|
|
244
|
+
background: _objectSpread(_objectSpread({}, other), {}, {
|
|
245
|
+
background: 'currentColor',
|
|
246
|
+
borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
|
|
247
|
+
opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected,
|
|
248
|
+
zIndex: '0',
|
|
249
|
+
transition: theme.methods.transitions.make(['opacity'])
|
|
250
|
+
}),
|
|
251
|
+
background_hover: {
|
|
252
|
+
opacity: theme.palette.visual_contrast.default.opacity.focus
|
|
253
|
+
},
|
|
254
|
+
background_focus: {
|
|
255
|
+
opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected
|
|
256
|
+
},
|
|
257
|
+
border: _objectSpread(_objectSpread({}, other), {}, {
|
|
258
|
+
borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
|
|
259
|
+
boxShadow: 'inset 0px -1px 0px 0px currentColor',
|
|
260
|
+
zIndex: '1',
|
|
261
|
+
transition: theme.methods.transitions.make(['box-shadow'])
|
|
262
|
+
}),
|
|
263
|
+
border_focus: {
|
|
264
|
+
boxShadow: 'inset 0px -2px 0px 0px currentColor'
|
|
265
|
+
},
|
|
266
|
+
fieldset: _objectSpread(_objectSpread({}, other), {}, {
|
|
267
|
+
top: '-5px',
|
|
268
|
+
height: 'calc(100% + 5px)',
|
|
269
|
+
borderRadius: `${theme.shape.radius.unit}px`,
|
|
270
|
+
border: '1px solid currentColor',
|
|
271
|
+
padding: '0',
|
|
272
|
+
paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`,
|
|
273
|
+
transition: theme.methods.transitions.make(['border', 'padding'])
|
|
274
|
+
}),
|
|
275
|
+
fieldset_focus: {
|
|
276
|
+
borderWidth: '2px',
|
|
277
|
+
paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`
|
|
278
|
+
},
|
|
279
|
+
legend: _objectSpread(_objectSpread({
|
|
280
|
+
display: 'inline-flex',
|
|
281
|
+
height: '11px',
|
|
282
|
+
width: 'auto',
|
|
283
|
+
padding: '0px',
|
|
284
|
+
maxWidth: '0.001px',
|
|
285
|
+
whiteSpace: 'nowrap',
|
|
286
|
+
visibility: 'hidden',
|
|
287
|
+
overflow: 'hidden',
|
|
288
|
+
transition: theme.methods.transitions.make(['max-width', 'padding'], {
|
|
289
|
+
duration: 'xxs'
|
|
290
|
+
})
|
|
291
|
+
}, theme.typography.values.b2), {}, {
|
|
292
|
+
fontSize: '0.64rem',
|
|
293
|
+
letterSpacing: 'normal'
|
|
294
|
+
}),
|
|
295
|
+
legend_focus: {
|
|
296
|
+
maxWidth: '100%',
|
|
297
|
+
padding: `0 ${theme.methods.space.value(0.5, 'px')}`,
|
|
298
|
+
transition: theme.methods.transitions.make(['max-width', 'padding'], {
|
|
299
|
+
duration: 'xs'
|
|
300
|
+
})
|
|
301
|
+
},
|
|
302
|
+
footer: {
|
|
303
|
+
marginTop: '4px',
|
|
304
|
+
paddingInline: theme.methods.space.value(2, 'px')
|
|
305
|
+
},
|
|
306
|
+
footer_version_text: {
|
|
307
|
+
paddingInline: '0'
|
|
308
|
+
},
|
|
309
|
+
helperText: {
|
|
310
|
+
display: 'inline-flex',
|
|
311
|
+
color: theme.palette.text.default.secondary,
|
|
312
|
+
userSelect: 'none'
|
|
313
|
+
},
|
|
314
|
+
counterText: {
|
|
315
|
+
display: 'inline-flex',
|
|
316
|
+
justifyContent: 'flex-end',
|
|
317
|
+
color: theme.palette.text.default.secondary,
|
|
318
|
+
userSelect: 'none',
|
|
319
|
+
flex: '1 0 auto'
|
|
320
|
+
},
|
|
321
|
+
// Start and end icon
|
|
322
|
+
icon: {
|
|
323
|
+
display: 'inline-flex',
|
|
324
|
+
alignItems: 'center',
|
|
325
|
+
flex: '0 0 auto'
|
|
326
|
+
},
|
|
327
|
+
icon_size_small: {
|
|
328
|
+
paddingBlock: '12px'
|
|
329
|
+
},
|
|
330
|
+
icon_size_regular: {
|
|
331
|
+
paddingBlock: '16px'
|
|
332
|
+
},
|
|
333
|
+
icon_size_large: {
|
|
334
|
+
paddingBlock: '24px'
|
|
335
|
+
},
|
|
336
|
+
icon_version_text_size_small: {
|
|
337
|
+
paddingBlock: '6px'
|
|
338
|
+
},
|
|
339
|
+
icon_version_text_size_regular: {
|
|
340
|
+
paddingBlock: '8px'
|
|
341
|
+
},
|
|
342
|
+
icon_version_text_size_large: {
|
|
343
|
+
paddingBlock: '12px'
|
|
344
|
+
},
|
|
345
|
+
icon_version_outlined_size_small: {
|
|
346
|
+
paddingBlock: '9px'
|
|
347
|
+
},
|
|
348
|
+
icon_version_outlined_size_regular: {
|
|
349
|
+
paddingBlock: '12px'
|
|
350
|
+
},
|
|
351
|
+
icon_version_outlined_size_large: {
|
|
352
|
+
paddingBlock: '17px'
|
|
353
|
+
},
|
|
354
|
+
icon_version_filled_size_small: {
|
|
355
|
+
paddingBlock: '9px'
|
|
356
|
+
},
|
|
357
|
+
icon_version_filled_size_regular: {
|
|
358
|
+
paddingBlock: '12px'
|
|
359
|
+
},
|
|
360
|
+
icon_version_filled_size_large: {
|
|
361
|
+
paddingBlock: '17px'
|
|
362
|
+
},
|
|
363
|
+
icon_button_size_small: {
|
|
364
|
+
paddingBlock: '4px'
|
|
365
|
+
},
|
|
366
|
+
icon_button_size_regular: {
|
|
367
|
+
paddingBlock: '8px'
|
|
368
|
+
},
|
|
369
|
+
icon_button_size_large: {
|
|
370
|
+
paddingBlock: '12px'
|
|
371
|
+
},
|
|
372
|
+
icon_start: {
|
|
373
|
+
maxWidth: '40%',
|
|
374
|
+
overflow: 'auto hidden',
|
|
375
|
+
paddingInlineEnd: '16px',
|
|
376
|
+
paddingInlineStart: '12px'
|
|
377
|
+
},
|
|
378
|
+
icon_vertical_align_start: {
|
|
379
|
+
alignSelf: 'flex-start'
|
|
380
|
+
},
|
|
381
|
+
icon_vertical_align_center: {
|
|
382
|
+
alignSelf: 'center',
|
|
383
|
+
paddingBlock: '0px !important'
|
|
384
|
+
},
|
|
385
|
+
icon_vertical_align_end: {
|
|
386
|
+
alignSelf: 'flex-end'
|
|
387
|
+
},
|
|
388
|
+
icon_end: {
|
|
389
|
+
maxWidth: '40%',
|
|
390
|
+
overflow: 'auto hidden',
|
|
391
|
+
paddingInlineStart: theme.methods.space.value(2, 'px'),
|
|
392
|
+
paddingInlineEnd: theme.methods.space.value(1.5, 'px')
|
|
393
|
+
},
|
|
394
|
+
addition: {
|
|
395
|
+
color: theme.palette.text.default.secondary
|
|
396
|
+
},
|
|
397
|
+
addition_size_small: {
|
|
398
|
+
paddingBottom: theme.methods.space.value(1, 'px'),
|
|
399
|
+
paddingTop: theme.methods.space.value(2.5, 'px')
|
|
400
|
+
},
|
|
401
|
+
addition_size_regular: {
|
|
402
|
+
paddingBottom: theme.methods.space.value(2, 'px'),
|
|
403
|
+
paddingTop: theme.methods.space.value(3, 'px')
|
|
404
|
+
},
|
|
405
|
+
addition_size_large: {
|
|
406
|
+
paddingBottom: theme.methods.space.value(2, 'px'),
|
|
407
|
+
paddingTop: theme.methods.space.value(3.5, 'px')
|
|
408
|
+
},
|
|
409
|
+
addition_version_outlined_size_small: {
|
|
410
|
+
paddingTop: theme.methods.space.value(1.75, 'px'),
|
|
411
|
+
paddingBottom: theme.methods.space.value(1.75, 'px')
|
|
412
|
+
},
|
|
413
|
+
addition_version_outlined_size_regular: {
|
|
414
|
+
paddingTop: theme.methods.space.value(2.25, 'px'),
|
|
415
|
+
paddingBottom: theme.methods.space.value(2.25, 'px')
|
|
416
|
+
},
|
|
417
|
+
addition_version_outlined_size_large: {
|
|
418
|
+
paddingTop: theme.methods.space.value(2.75, 'px'),
|
|
419
|
+
paddingBottom: theme.methods.space.value(2.75, 'px')
|
|
420
|
+
},
|
|
421
|
+
addition_without_label_size_small: {
|
|
422
|
+
paddingTop: `${theme.methods.space.value(1, 'px')}`
|
|
423
|
+
},
|
|
424
|
+
addition_without_label_size_regular: {
|
|
425
|
+
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
426
|
+
},
|
|
427
|
+
addition_without_label_size_large: {
|
|
428
|
+
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
429
|
+
},
|
|
430
|
+
prefix: {
|
|
431
|
+
flex: '0 0 auto',
|
|
432
|
+
marginInlineStart: '16px',
|
|
433
|
+
marginInlineEnd: '8px',
|
|
434
|
+
opacity: '0',
|
|
435
|
+
transition: theme.methods.transitions.make('opacity')
|
|
436
|
+
},
|
|
437
|
+
prefix_noStartMargin: {
|
|
438
|
+
marginInlineStart: '0px'
|
|
439
|
+
},
|
|
440
|
+
prefix_focus: {
|
|
441
|
+
opacity: '1'
|
|
442
|
+
},
|
|
443
|
+
noPrefixMargin: {
|
|
444
|
+
marginInlineEnd: '0'
|
|
445
|
+
},
|
|
446
|
+
sufix: {
|
|
447
|
+
flex: '0 0 auto',
|
|
448
|
+
marginInlineEnd: '16px',
|
|
449
|
+
marginInlineStart: '8px',
|
|
450
|
+
opacity: '0',
|
|
451
|
+
transition: theme.methods.transitions.make('opacity')
|
|
452
|
+
},
|
|
453
|
+
sufix_focus: {
|
|
454
|
+
opacity: '1'
|
|
455
|
+
},
|
|
456
|
+
sufix_noEndMargin: {
|
|
457
|
+
marginInlineEnd: '0px'
|
|
458
|
+
},
|
|
459
|
+
noSufixMargin: {
|
|
460
|
+
marginInlineStart: '0'
|
|
461
|
+
},
|
|
462
|
+
fullWidth: {
|
|
463
|
+
width: '100%'
|
|
464
|
+
},
|
|
465
|
+
clear: {
|
|
466
|
+
cursor: 'pointer',
|
|
467
|
+
pointerEvents: 'all !important',
|
|
468
|
+
userSelect: 'none',
|
|
469
|
+
transition: theme.methods.transitions.make('transform', {
|
|
470
|
+
duration: 'xs'
|
|
471
|
+
}),
|
|
472
|
+
'&:active': {
|
|
473
|
+
transform: 'scale(0.87)'
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
disabled: {
|
|
477
|
+
opacity: '0.54',
|
|
478
|
+
pointerEvents: 'none',
|
|
479
|
+
cursor: 'default'
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
}, {
|
|
483
|
+
name: 'onesy-TextField'
|
|
484
|
+
});
|
|
485
|
+
const TextField = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
486
|
+
var _ComponentProps, _type, _type2, _String;
|
|
487
|
+
const theme = (0, _styleReact.useOnesyTheme)();
|
|
488
|
+
const l = theme.l;
|
|
489
|
+
const props = _react.default.useMemo(() => {
|
|
490
|
+
var _theme$ui, _theme$ui2;
|
|
491
|
+
return _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyTextField) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
|
|
492
|
+
}, [props_]);
|
|
493
|
+
const Line = _react.default.useMemo(() => {
|
|
494
|
+
var _theme$elements;
|
|
495
|
+
return (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
|
|
496
|
+
}, [theme]);
|
|
497
|
+
const Type = _react.default.useMemo(() => {
|
|
498
|
+
var _theme$elements2;
|
|
499
|
+
return (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Type) || _Type.default;
|
|
500
|
+
}, [theme]);
|
|
501
|
+
const Tooltip = _react.default.useMemo(() => {
|
|
502
|
+
var _theme$elements3;
|
|
503
|
+
return (theme === null || theme === void 0 || (_theme$elements3 = theme.elements) === null || _theme$elements3 === void 0 ? void 0 : _theme$elements3.Tooltip) || _Tooltip.default;
|
|
504
|
+
}, [theme]);
|
|
505
|
+
const IconButton = _react.default.useMemo(() => {
|
|
506
|
+
var _theme$elements4;
|
|
507
|
+
return (theme === null || theme === void 0 || (_theme$elements4 = theme.elements) === null || _theme$elements4 === void 0 ? void 0 : _theme$elements4.IconButton) || _IconButton.default;
|
|
508
|
+
}, [theme]);
|
|
509
|
+
const {
|
|
510
|
+
tonal = true,
|
|
511
|
+
color = 'primary',
|
|
512
|
+
version = 'filled',
|
|
513
|
+
size = 'regular',
|
|
514
|
+
rootRef,
|
|
515
|
+
valueDefault,
|
|
516
|
+
value: value_,
|
|
517
|
+
onChange,
|
|
518
|
+
name,
|
|
519
|
+
label: label_,
|
|
520
|
+
align,
|
|
521
|
+
start,
|
|
522
|
+
startVerticalAlign: startVerticalAlign_ = 'start',
|
|
523
|
+
end: end_,
|
|
524
|
+
endVerticalAlign: endVerticalAlign_ = 'start',
|
|
525
|
+
placeholder,
|
|
526
|
+
fullWidth: fullWidth_,
|
|
527
|
+
helperText,
|
|
528
|
+
counter,
|
|
529
|
+
prefix,
|
|
530
|
+
sufix,
|
|
531
|
+
noPrefixMargin,
|
|
532
|
+
noSufixMargin,
|
|
533
|
+
enabled,
|
|
534
|
+
autoFocus,
|
|
535
|
+
autoComplete,
|
|
536
|
+
type: type_ = 'text',
|
|
537
|
+
required,
|
|
538
|
+
optional,
|
|
539
|
+
optionalText = 'optional',
|
|
540
|
+
error,
|
|
541
|
+
multiline,
|
|
542
|
+
rows: rows_,
|
|
543
|
+
minRows = 1,
|
|
544
|
+
maxRows,
|
|
545
|
+
clear,
|
|
546
|
+
focus: focus_,
|
|
547
|
+
footer: footer_,
|
|
548
|
+
subscription,
|
|
549
|
+
controlled,
|
|
550
|
+
minimal,
|
|
551
|
+
restoreSelection = false,
|
|
552
|
+
minWidth,
|
|
553
|
+
readOnly,
|
|
554
|
+
disabled,
|
|
555
|
+
onInput: onInput_,
|
|
556
|
+
onFocus: onFocus_,
|
|
557
|
+
onBlur: onBlur_,
|
|
558
|
+
onMouseEnter: onMouseEnter_,
|
|
559
|
+
onMouseLeave: onMouseLeave_,
|
|
560
|
+
inputProps = {},
|
|
561
|
+
InputWrapperProps = {},
|
|
562
|
+
HelperTextProps,
|
|
563
|
+
IconProps,
|
|
564
|
+
IconClear = _IconMaterialCloseW.default,
|
|
565
|
+
InputComponent: InputComponent_,
|
|
566
|
+
WrapperComponent = 'div',
|
|
567
|
+
Component = 'div',
|
|
568
|
+
className,
|
|
569
|
+
style,
|
|
570
|
+
children,
|
|
571
|
+
// Other
|
|
572
|
+
colorUnchecked
|
|
573
|
+
} = props,
|
|
574
|
+
other = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
575
|
+
const {
|
|
576
|
+
classes
|
|
577
|
+
} = useStyle();
|
|
578
|
+
const refs = {
|
|
579
|
+
root: _react.default.useRef(undefined),
|
|
580
|
+
input: _react.default.useRef(undefined),
|
|
581
|
+
carret: _react.default.useRef(undefined),
|
|
582
|
+
restoreSelection: _react.default.useRef(restoreSelection),
|
|
583
|
+
controlled: _react.default.useRef(controlled),
|
|
584
|
+
ids: {
|
|
585
|
+
label: _react.default.useId(),
|
|
586
|
+
clear: _react.default.useId()
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
refs.controlled.current = controlled;
|
|
590
|
+
const keys = _react.default.useMemo(() => {
|
|
591
|
+
const result = [];
|
|
592
|
+
const items = [fullWidth_];
|
|
593
|
+
items.forEach(item => {
|
|
594
|
+
if ((0, _utils.is)('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key => result.push(key));
|
|
595
|
+
});
|
|
596
|
+
return (0, _utils.unique)(result);
|
|
597
|
+
}, [fullWidth_]);
|
|
598
|
+
const breakpoints = {};
|
|
599
|
+
keys.forEach(key => {
|
|
600
|
+
breakpoints[key] = (0, _useMediaQuery.default)(theme.breakpoints.media[key], {
|
|
601
|
+
element: refs.root.current
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
const label = name !== undefined ? name : label_;
|
|
605
|
+
let startVerticalAlign = startVerticalAlign_;
|
|
606
|
+
let endVerticalAlign = endVerticalAlign_;
|
|
607
|
+
const fullWidth = (0, _utils2.valueBreakpoints)(fullWidth_, undefined, breakpoints, theme);
|
|
608
|
+
const rowValue = () => {
|
|
609
|
+
var _refs$root$current;
|
|
610
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current = refs.root.current) === null || _refs$root$current === void 0 ? void 0 : _refs$root$current.ownerDocument) || window.document : undefined;
|
|
611
|
+
const htmlFontSize = (0, _utils.isEnvironment)('browser') ? +window.getComputedStyle(rootDocument.documentElement).fontSize.slice(0, -2) : 16;
|
|
612
|
+
const padding = size === 'small' ? 28 : size === 'regular' ? 36 : 44;
|
|
613
|
+
const row_ = Math.round(htmlFontSize * 0.875 * 1.4285714285714286);
|
|
46
614
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
display: 'inline-flex',
|
|
50
|
-
flexDirection: 'column'
|
|
51
|
-
},
|
|
52
|
-
root: {
|
|
53
|
-
display: 'inline-flex',
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
position: 'relative',
|
|
56
|
-
borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
|
|
57
|
-
'& > *': {
|
|
58
|
-
'&::-webkit-scrollbar': {
|
|
59
|
-
width: '0px',
|
|
60
|
-
height: '0px'
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
// Color
|
|
65
|
-
color_default: { color: theme.palette.text.default.primary },
|
|
66
|
-
color_neutral: { color: theme.palette.color.neutral.main },
|
|
67
|
-
color_primary: { color: theme.palette.color.primary.main },
|
|
68
|
-
color_secondary: { color: theme.palette.color.secondary.main },
|
|
69
|
-
color_tertiary: { color: theme.palette.color.tertiary.main },
|
|
70
|
-
color_quaternary: { color: theme.palette.color.quaternary.main },
|
|
71
|
-
color_info: { color: theme.palette.color.info.main },
|
|
72
|
-
color_success: { color: theme.palette.color.success.main },
|
|
73
|
-
color_warning: { color: theme.palette.color.warning.main },
|
|
74
|
-
color_error: { color: theme.palette.color.error.main },
|
|
75
|
-
error_color: {
|
|
76
|
-
color: [theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80], '!important']
|
|
77
|
-
},
|
|
78
|
-
error_hover_color: {
|
|
79
|
-
color: [theme.palette.light ? theme.palette.color.error[20] : theme.palette.color.error[90], '!important']
|
|
80
|
-
},
|
|
81
|
-
inputWrapper: Object.assign({
|
|
82
|
-
// Reset
|
|
83
|
-
margin: '0', border: '0', fontFamily: 'inherit', fontSize: '100%', lineHeight: '1.15', overflow: 'visible', boxSizing: 'border-box', display: 'flex', flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', opacity: '0', transition: theme.methods.transitions.make('opacity'), borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`, cursor: 'text', zIndex: '1', flex: '1 1 auto' }, theme.typography.values.b2),
|
|
84
|
-
inputWrapper_focus: {
|
|
85
|
-
opacity: '1'
|
|
86
|
-
},
|
|
87
|
-
input: Object.assign(Object.assign({
|
|
88
|
-
// Reset
|
|
89
|
-
margin: '0', border: '0', outline: 'none', color: theme.palette.text.default.primary, background: 'transparent', '-webkit-tap-highlight-color': 'transparent', textAlign: 'start' }, theme.typography.values.b2), overflow),
|
|
90
|
-
multiline: {
|
|
91
|
-
resize: 'none',
|
|
92
|
-
overflow: 'auto',
|
|
93
|
-
whiteSpace: 'normal'
|
|
94
|
-
},
|
|
95
|
-
input_size_small: {
|
|
96
|
-
// height: '48px',
|
|
97
|
-
padding: `${theme.methods.space.value(1, 'px')} ${theme.methods.space.value(2, 'px')}`,
|
|
98
|
-
paddingTop: theme.methods.space.value(2.5, 'px')
|
|
99
|
-
},
|
|
100
|
-
input_size_regular: {
|
|
101
|
-
// height: '56px',
|
|
102
|
-
padding: `11px ${theme.methods.space.value(2, 'px')}`,
|
|
103
|
-
paddingTop: theme.methods.space.value(3, 'px')
|
|
104
|
-
},
|
|
105
|
-
input_size_large: {
|
|
106
|
-
// height: '64px',
|
|
107
|
-
padding: theme.methods.space.value(2, 'px'),
|
|
108
|
-
paddingTop: theme.methods.space.value(3.5, 'px')
|
|
109
|
-
},
|
|
110
|
-
inputWrapper_without_label_size_small: {
|
|
111
|
-
paddingTop: `${theme.methods.space.value(1, 'px')}`
|
|
112
|
-
},
|
|
113
|
-
inputWrapper_without_label_size_regular: {
|
|
114
|
-
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
115
|
-
},
|
|
116
|
-
inputWrapper_without_label_size_large: {
|
|
117
|
-
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
118
|
-
},
|
|
119
|
-
input_version_text: {
|
|
120
|
-
'&:not($input_start_icon)': {
|
|
121
|
-
paddingInline: '0'
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
input_start_icon: {
|
|
125
|
-
paddingInlineStart: '0'
|
|
126
|
-
},
|
|
127
|
-
input_end_icon: {
|
|
128
|
-
paddingInlineEnd: '0'
|
|
129
|
-
},
|
|
130
|
-
input_version_outlined_size_small: {
|
|
131
|
-
paddingTop: theme.methods.space.value(1.75, 'px'),
|
|
132
|
-
paddingBottom: theme.methods.space.value(1.75, 'px')
|
|
133
|
-
},
|
|
134
|
-
input_version_outlined_size_regular: {
|
|
135
|
-
paddingTop: theme.methods.space.value(2.25, 'px'),
|
|
136
|
-
paddingBottom: theme.methods.space.value(2.25, 'px')
|
|
137
|
-
},
|
|
138
|
-
input_version_outlined_size_large: {
|
|
139
|
-
paddingTop: theme.methods.space.value(2.75, 'px'),
|
|
140
|
-
paddingBottom: theme.methods.space.value(2.75, 'px')
|
|
141
|
-
},
|
|
142
|
-
input_align_start: {
|
|
143
|
-
textAlign: 'start'
|
|
144
|
-
},
|
|
145
|
-
input_align_center: {
|
|
146
|
-
textAlign: 'center'
|
|
147
|
-
},
|
|
148
|
-
input_align_end: {
|
|
149
|
-
textAlign: 'end'
|
|
150
|
-
},
|
|
151
|
-
label: Object.assign(Object.assign({ position: 'absolute', insetInlineStart: '16px', transformOrigin: 'top left', transition: theme.methods.transitions.make(['color', 'inset', 'margin', 'transform']), pointerEvents: 'none', userSelect: 'none', zIndex: '1' }, overflow), { width: 'auto' }),
|
|
152
|
-
label_regular: {
|
|
153
|
-
top: '50%',
|
|
154
|
-
transform: 'translate(0px, -50%) scale(1)'
|
|
155
|
-
},
|
|
156
|
-
label_multiline: {
|
|
157
|
-
top: '0px'
|
|
158
|
-
},
|
|
159
|
-
label_rtl: {
|
|
160
|
-
transformOrigin: 'top right'
|
|
161
|
-
},
|
|
162
|
-
label_version_text: {
|
|
163
|
-
insetInlineStart: '0px'
|
|
164
|
-
},
|
|
165
|
-
label_icon_start: {
|
|
166
|
-
insetInlineStart: theme.methods.space.value(6.5, 'px')
|
|
167
|
-
},
|
|
168
|
-
label_size_small_multiline: {
|
|
169
|
-
transform: 'translate(4px, 14px) scale(1)'
|
|
170
|
-
},
|
|
171
|
-
label_size_regular_multiline: {
|
|
172
|
-
transform: 'translate(4px, 18px) scale(1)'
|
|
173
|
-
},
|
|
174
|
-
label_size_large_multiline: {
|
|
175
|
-
transform: 'translate(4px, 22px) scale(1)'
|
|
176
|
-
},
|
|
177
|
-
// Focus
|
|
178
|
-
label_version_text_focus: {
|
|
179
|
-
top: '0px',
|
|
180
|
-
insetInlineStart: '0px',
|
|
181
|
-
transform: 'translate(0, 6px) scale(0.667)'
|
|
182
|
-
},
|
|
183
|
-
label_version_outlined_focus: {
|
|
184
|
-
top: '0px',
|
|
185
|
-
insetInlineStart: '15px',
|
|
186
|
-
marginInlineStart: '4px',
|
|
187
|
-
transform: 'translate(0, -6px) scale(0.667)'
|
|
188
|
-
},
|
|
189
|
-
label_version_filled_focus: {
|
|
190
|
-
top: '0px',
|
|
191
|
-
insetInlineStart: '15px',
|
|
192
|
-
transform: 'translate(0, 6px) scale(0.667)'
|
|
193
|
-
},
|
|
194
|
-
background: Object.assign(Object.assign({}, other), { background: 'currentColor', borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`, opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected, zIndex: '0', transition: theme.methods.transitions.make(['opacity']) }),
|
|
195
|
-
background_hover: {
|
|
196
|
-
opacity: theme.palette.visual_contrast.default.opacity.focus
|
|
197
|
-
},
|
|
198
|
-
background_focus: {
|
|
199
|
-
opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected
|
|
200
|
-
},
|
|
201
|
-
border: Object.assign(Object.assign({}, other), { borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`, boxShadow: 'inset 0px -1px 0px 0px currentColor', zIndex: '1', transition: theme.methods.transitions.make(['box-shadow']) }),
|
|
202
|
-
border_focus: {
|
|
203
|
-
boxShadow: 'inset 0px -2px 0px 0px currentColor'
|
|
204
|
-
},
|
|
205
|
-
fieldset: Object.assign(Object.assign({}, other), { top: '-5px', height: 'calc(100% + 5px)', borderRadius: `${theme.shape.radius.unit}px`, border: '1px solid currentColor', padding: '0', paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`, transition: theme.methods.transitions.make(['border', 'padding']) }),
|
|
206
|
-
fieldset_focus: {
|
|
207
|
-
borderWidth: '2px',
|
|
208
|
-
paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`
|
|
209
|
-
},
|
|
210
|
-
legend: Object.assign(Object.assign({ display: 'inline-flex', height: '11px', width: 'auto', padding: '0px', maxWidth: '0.001px', whiteSpace: 'nowrap', visibility: 'hidden', overflow: 'hidden', transition: theme.methods.transitions.make(['max-width', 'padding'], { duration: 'xxs' }) }, theme.typography.values.b2), { fontSize: '0.64rem', letterSpacing: 'normal' }),
|
|
211
|
-
legend_focus: {
|
|
212
|
-
maxWidth: '100%',
|
|
213
|
-
padding: `0 ${theme.methods.space.value(0.5, 'px')}`,
|
|
214
|
-
transition: theme.methods.transitions.make(['max-width', 'padding'], { duration: 'xs' })
|
|
215
|
-
},
|
|
216
|
-
footer: {
|
|
217
|
-
marginTop: '4px',
|
|
218
|
-
paddingInline: theme.methods.space.value(2, 'px')
|
|
219
|
-
},
|
|
220
|
-
footer_version_text: {
|
|
221
|
-
paddingInline: '0'
|
|
222
|
-
},
|
|
223
|
-
helperText: {
|
|
224
|
-
display: 'inline-flex',
|
|
225
|
-
color: theme.palette.text.default.secondary,
|
|
226
|
-
userSelect: 'none'
|
|
227
|
-
},
|
|
228
|
-
counterText: {
|
|
229
|
-
display: 'inline-flex',
|
|
230
|
-
justifyContent: 'flex-end',
|
|
231
|
-
color: theme.palette.text.default.secondary,
|
|
232
|
-
userSelect: 'none',
|
|
233
|
-
flex: '1 0 auto'
|
|
234
|
-
},
|
|
235
|
-
// Start and end icon
|
|
236
|
-
icon: {
|
|
237
|
-
display: 'inline-flex',
|
|
238
|
-
alignItems: 'center',
|
|
239
|
-
flex: '0 0 auto'
|
|
240
|
-
},
|
|
241
|
-
icon_size_small: {
|
|
242
|
-
paddingBlock: '12px'
|
|
243
|
-
},
|
|
244
|
-
icon_size_regular: {
|
|
245
|
-
paddingBlock: '16px'
|
|
246
|
-
},
|
|
247
|
-
icon_size_large: {
|
|
248
|
-
paddingBlock: '24px'
|
|
249
|
-
},
|
|
250
|
-
icon_version_text_size_small: {
|
|
251
|
-
paddingBlock: '6px'
|
|
252
|
-
},
|
|
253
|
-
icon_version_text_size_regular: {
|
|
254
|
-
paddingBlock: '8px'
|
|
255
|
-
},
|
|
256
|
-
icon_version_text_size_large: {
|
|
257
|
-
paddingBlock: '12px'
|
|
258
|
-
},
|
|
259
|
-
icon_version_outlined_size_small: {
|
|
260
|
-
paddingBlock: '9px'
|
|
261
|
-
},
|
|
262
|
-
icon_version_outlined_size_regular: {
|
|
263
|
-
paddingBlock: '12px'
|
|
264
|
-
},
|
|
265
|
-
icon_version_outlined_size_large: {
|
|
266
|
-
paddingBlock: '17px'
|
|
267
|
-
},
|
|
268
|
-
icon_version_filled_size_small: {
|
|
269
|
-
paddingBlock: '9px'
|
|
270
|
-
},
|
|
271
|
-
icon_version_filled_size_regular: {
|
|
272
|
-
paddingBlock: '12px'
|
|
273
|
-
},
|
|
274
|
-
icon_version_filled_size_large: {
|
|
275
|
-
paddingBlock: '17px'
|
|
276
|
-
},
|
|
277
|
-
icon_button_size_small: {
|
|
278
|
-
paddingBlock: '4px'
|
|
279
|
-
},
|
|
280
|
-
icon_button_size_regular: {
|
|
281
|
-
paddingBlock: '8px'
|
|
282
|
-
},
|
|
283
|
-
icon_button_size_large: {
|
|
284
|
-
paddingBlock: '12px'
|
|
285
|
-
},
|
|
286
|
-
icon_start: {
|
|
287
|
-
maxWidth: '40%',
|
|
288
|
-
overflow: 'auto hidden',
|
|
289
|
-
paddingInlineEnd: '16px',
|
|
290
|
-
paddingInlineStart: '12px'
|
|
291
|
-
},
|
|
292
|
-
icon_vertical_align_start: {
|
|
293
|
-
alignSelf: 'flex-start'
|
|
294
|
-
},
|
|
295
|
-
icon_vertical_align_center: {
|
|
296
|
-
alignSelf: 'center',
|
|
297
|
-
paddingBlock: '0px !important'
|
|
298
|
-
},
|
|
299
|
-
icon_vertical_align_end: {
|
|
300
|
-
alignSelf: 'flex-end'
|
|
301
|
-
},
|
|
302
|
-
icon_end: {
|
|
303
|
-
maxWidth: '40%',
|
|
304
|
-
overflow: 'auto hidden',
|
|
305
|
-
paddingInlineStart: theme.methods.space.value(2, 'px'),
|
|
306
|
-
paddingInlineEnd: theme.methods.space.value(1.5, 'px')
|
|
307
|
-
},
|
|
308
|
-
addition: {
|
|
309
|
-
color: theme.palette.text.default.secondary
|
|
310
|
-
},
|
|
311
|
-
addition_size_small: {
|
|
312
|
-
paddingBottom: theme.methods.space.value(1, 'px'),
|
|
313
|
-
paddingTop: theme.methods.space.value(2.5, 'px')
|
|
314
|
-
},
|
|
315
|
-
addition_size_regular: {
|
|
316
|
-
paddingBottom: theme.methods.space.value(2, 'px'),
|
|
317
|
-
paddingTop: theme.methods.space.value(3, 'px')
|
|
318
|
-
},
|
|
319
|
-
addition_size_large: {
|
|
320
|
-
paddingBottom: theme.methods.space.value(2, 'px'),
|
|
321
|
-
paddingTop: theme.methods.space.value(3.5, 'px')
|
|
322
|
-
},
|
|
323
|
-
addition_version_outlined_size_small: {
|
|
324
|
-
paddingTop: theme.methods.space.value(1.75, 'px'),
|
|
325
|
-
paddingBottom: theme.methods.space.value(1.75, 'px')
|
|
326
|
-
},
|
|
327
|
-
addition_version_outlined_size_regular: {
|
|
328
|
-
paddingTop: theme.methods.space.value(2.25, 'px'),
|
|
329
|
-
paddingBottom: theme.methods.space.value(2.25, 'px')
|
|
330
|
-
},
|
|
331
|
-
addition_version_outlined_size_large: {
|
|
332
|
-
paddingTop: theme.methods.space.value(2.75, 'px'),
|
|
333
|
-
paddingBottom: theme.methods.space.value(2.75, 'px')
|
|
334
|
-
},
|
|
335
|
-
addition_without_label_size_small: {
|
|
336
|
-
paddingTop: `${theme.methods.space.value(1, 'px')}`
|
|
337
|
-
},
|
|
338
|
-
addition_without_label_size_regular: {
|
|
339
|
-
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
340
|
-
},
|
|
341
|
-
addition_without_label_size_large: {
|
|
342
|
-
paddingTop: `${theme.methods.space.value(2, 'px')}`
|
|
343
|
-
},
|
|
344
|
-
prefix: {
|
|
345
|
-
flex: '0 0 auto',
|
|
346
|
-
marginInlineStart: '16px',
|
|
347
|
-
marginInlineEnd: '8px',
|
|
348
|
-
opacity: '0',
|
|
349
|
-
transition: theme.methods.transitions.make('opacity'),
|
|
350
|
-
},
|
|
351
|
-
prefix_noStartMargin: {
|
|
352
|
-
marginInlineStart: '0px'
|
|
353
|
-
},
|
|
354
|
-
prefix_focus: {
|
|
355
|
-
opacity: '1'
|
|
356
|
-
},
|
|
357
|
-
noPrefixMargin: {
|
|
358
|
-
marginInlineEnd: '0'
|
|
359
|
-
},
|
|
360
|
-
sufix: {
|
|
361
|
-
flex: '0 0 auto',
|
|
362
|
-
marginInlineEnd: '16px',
|
|
363
|
-
marginInlineStart: '8px',
|
|
364
|
-
opacity: '0',
|
|
365
|
-
transition: theme.methods.transitions.make('opacity'),
|
|
366
|
-
},
|
|
367
|
-
sufix_focus: {
|
|
368
|
-
opacity: '1'
|
|
369
|
-
},
|
|
370
|
-
sufix_noEndMargin: {
|
|
371
|
-
marginInlineEnd: '0px'
|
|
372
|
-
},
|
|
373
|
-
noSufixMargin: {
|
|
374
|
-
marginInlineStart: '0'
|
|
375
|
-
},
|
|
376
|
-
fullWidth: {
|
|
377
|
-
width: '100%'
|
|
378
|
-
},
|
|
379
|
-
clear: {
|
|
380
|
-
cursor: 'pointer',
|
|
381
|
-
pointerEvents: 'all !important',
|
|
382
|
-
userSelect: 'none',
|
|
383
|
-
transition: theme.methods.transitions.make('transform', { duration: 'xs' }),
|
|
384
|
-
'&:active': {
|
|
385
|
-
transform: 'scale(0.87)'
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
disabled: {
|
|
389
|
-
opacity: '0.54',
|
|
390
|
-
pointerEvents: 'none',
|
|
391
|
-
cursor: 'default'
|
|
392
|
-
}
|
|
615
|
+
height: row_,
|
|
616
|
+
padding
|
|
393
617
|
};
|
|
394
|
-
}
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
refs.controlled.current = controlled;
|
|
420
|
-
const keys = react_1.default.useMemo(() => {
|
|
421
|
-
const result = [];
|
|
422
|
-
const items = [fullWidth_];
|
|
423
|
-
items.forEach(item => {
|
|
424
|
-
if ((0, utils_1.is)('object', item))
|
|
425
|
-
Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key => result.push(key));
|
|
426
|
-
});
|
|
427
|
-
return (0, utils_1.unique)(result);
|
|
428
|
-
}, [fullWidth_]);
|
|
429
|
-
const breakpoints = {};
|
|
430
|
-
keys.forEach(key => {
|
|
431
|
-
breakpoints[key] = (0, useMediaQuery_1.default)(theme.breakpoints.media[key], { element: refs.root.current });
|
|
618
|
+
};
|
|
619
|
+
const [value, setValue] = _react.default.useState(valueDefault !== undefined ? valueDefault : value_);
|
|
620
|
+
const [focus, setFocus] = _react.default.useState(focus_);
|
|
621
|
+
const [mouseDown, setMouseDown] = _react.default.useState(false);
|
|
622
|
+
const [hover, setHover] = _react.default.useState(false);
|
|
623
|
+
const [row, setRow] = _react.default.useState(rowValue);
|
|
624
|
+
const [rows, setRows] = _react.default.useState(1);
|
|
625
|
+
const [visible, setVisible] = _react.default.useState(false);
|
|
626
|
+
let type = type_;
|
|
627
|
+
const styles = {
|
|
628
|
+
root: {},
|
|
629
|
+
input: {},
|
|
630
|
+
inputWrapper: {},
|
|
631
|
+
background: {
|
|
632
|
+
color: theme.palette.text.default.secondary
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
refs.restoreSelection.current = restoreSelection;
|
|
636
|
+
_react.default.useEffect(() => {
|
|
637
|
+
var _refs$root$current2;
|
|
638
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current2 = refs.root.current) === null || _refs$root$current2 === void 0 ? void 0 : _refs$root$current2.ownerDocument) || window.document : undefined;
|
|
639
|
+
const htmlObserver = new MutationObserver(() => setRow(rowValue));
|
|
640
|
+
htmlObserver.observe(rootDocument.documentElement, {
|
|
641
|
+
attributes: true,
|
|
642
|
+
attributeFilter: ['style']
|
|
432
643
|
});
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
var _a;
|
|
439
|
-
const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
|
|
440
|
-
const htmlFontSize = (0, utils_1.isEnvironment)('browser') ? +window.getComputedStyle(rootDocument.documentElement).fontSize.slice(0, -2) : 16;
|
|
441
|
-
const padding = size === 'small' ? 28 : size === 'regular' ? 36 : 44;
|
|
442
|
-
const row_ = Math.round(htmlFontSize * 0.875 * 1.4285714285714286);
|
|
443
|
-
return {
|
|
444
|
-
height: row_,
|
|
445
|
-
padding
|
|
446
|
-
};
|
|
447
|
-
};
|
|
448
|
-
const [value, setValue] = react_1.default.useState((valueDefault !== undefined ? valueDefault : value_));
|
|
449
|
-
const [focus, setFocus] = react_1.default.useState(focus_);
|
|
450
|
-
const [mouseDown, setMouseDown] = react_1.default.useState(false);
|
|
451
|
-
const [hover, setHover] = react_1.default.useState(false);
|
|
452
|
-
const [row, setRow] = react_1.default.useState(rowValue);
|
|
453
|
-
const [rows, setRows] = react_1.default.useState(1);
|
|
454
|
-
const [visible, setVisible] = react_1.default.useState(false);
|
|
455
|
-
let type = type_;
|
|
456
|
-
const styles = {
|
|
457
|
-
root: {},
|
|
458
|
-
input: {},
|
|
459
|
-
inputWrapper: {},
|
|
460
|
-
background: {
|
|
461
|
-
color: theme.palette.text.default.secondary
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
refs.restoreSelection.current = restoreSelection;
|
|
465
|
-
react_1.default.useEffect(() => {
|
|
466
|
-
var _a;
|
|
467
|
-
const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
|
|
468
|
-
const htmlObserver = new MutationObserver(() => setRow(rowValue));
|
|
469
|
-
htmlObserver.observe(rootDocument.documentElement, { attributes: true, attributeFilter: ['style'] });
|
|
470
|
-
rootDocument.addEventListener('mouseup', onInputWrapperMouseUp);
|
|
471
|
-
return () => {
|
|
472
|
-
// Clean up
|
|
473
|
-
rootDocument.removeEventListener('mouseup', onInputWrapperMouseUp);
|
|
474
|
-
htmlObserver.disconnect();
|
|
475
|
-
};
|
|
476
|
-
}, []);
|
|
477
|
-
react_1.default.useEffect(() => {
|
|
478
|
-
setTimeout(() => {
|
|
479
|
-
if (refs.restoreSelection.current && refs.carret.current) {
|
|
480
|
-
// Carret restore previous value
|
|
481
|
-
try {
|
|
482
|
-
refs.input.current.selectionStart = refs.carret.current.start;
|
|
483
|
-
refs.input.current.selectionEnd = refs.carret.current.end;
|
|
484
|
-
}
|
|
485
|
-
catch (error) { }
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
}, [value]);
|
|
489
|
-
react_1.default.useEffect(() => {
|
|
490
|
-
if (value_ !== undefined && value_ !== value) {
|
|
491
|
-
setValue(value_);
|
|
492
|
-
}
|
|
493
|
-
}, [value_]);
|
|
494
|
-
react_1.default.useEffect(() => {
|
|
495
|
-
if (focus_ !== focus && focus_ !== undefined)
|
|
496
|
-
setFocus(focus_);
|
|
497
|
-
}, [focus_]);
|
|
498
|
-
react_1.default.useEffect(() => {
|
|
499
|
-
const method = (event) => {
|
|
500
|
-
if (event === 'clear')
|
|
501
|
-
onClear();
|
|
502
|
-
};
|
|
503
|
-
if (subscription)
|
|
504
|
-
subscription.subscribe(method);
|
|
505
|
-
return () => {
|
|
506
|
-
if (subscription)
|
|
507
|
-
subscription.unsubscribe(method);
|
|
508
|
-
};
|
|
509
|
-
}, [subscription]);
|
|
510
|
-
const onToggleVisible = react_1.default.useCallback(() => {
|
|
511
|
-
setVisible((item) => !item);
|
|
512
|
-
}, []);
|
|
513
|
-
const onUpdateRows = () => {
|
|
514
|
-
if (multiline && row !== undefined) {
|
|
515
|
-
const heightValue = refs.input.current.style.height;
|
|
516
|
-
// Get actual height with auto
|
|
517
|
-
refs.input.current.style.height = 'auto';
|
|
518
|
-
const scrollHeight = refs.input.current.scrollHeight;
|
|
519
|
-
// Revert back to previous value
|
|
520
|
-
refs.input.current.style.height = heightValue;
|
|
521
|
-
const newRows = Math.floor(scrollHeight / row.height);
|
|
522
|
-
setRows(newRows);
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
const onUpdate = (event) => {
|
|
526
|
-
const inputValue = event.target.value;
|
|
527
|
-
// Carret save previous value
|
|
528
|
-
refs.carret.current = { start: refs.input.current.selectionStart, end: refs.input.current.selectionEnd };
|
|
529
|
-
// Only restore if it's not regular carret value
|
|
530
|
-
if (refs.carret.current.start === inputValue.length)
|
|
531
|
-
refs.carret.current = undefined;
|
|
532
|
-
onUpdateRows();
|
|
533
|
-
// Inner controlled value
|
|
534
|
-
if (!refs.controlled.current)
|
|
535
|
-
setValue(inputValue);
|
|
536
|
-
if ((0, utils_1.is)('function', onChange))
|
|
537
|
-
onChange(inputValue, event);
|
|
644
|
+
rootDocument.addEventListener('mouseup', onInputWrapperMouseUp);
|
|
645
|
+
return () => {
|
|
646
|
+
// Clean up
|
|
647
|
+
rootDocument.removeEventListener('mouseup', onInputWrapperMouseUp);
|
|
648
|
+
htmlObserver.disconnect();
|
|
538
649
|
};
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
650
|
+
}, []);
|
|
651
|
+
_react.default.useEffect(() => {
|
|
652
|
+
setTimeout(() => {
|
|
653
|
+
if (refs.restoreSelection.current && refs.carret.current) {
|
|
654
|
+
// Carret restore previous value
|
|
655
|
+
try {
|
|
656
|
+
refs.input.current.selectionStart = refs.carret.current.start;
|
|
657
|
+
refs.input.current.selectionEnd = refs.carret.current.end;
|
|
658
|
+
} catch (error) {}
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}, [value]);
|
|
662
|
+
_react.default.useEffect(() => {
|
|
663
|
+
if (value_ !== undefined && value_ !== value) {
|
|
664
|
+
setValue(value_);
|
|
665
|
+
}
|
|
666
|
+
}, [value_]);
|
|
667
|
+
_react.default.useEffect(() => {
|
|
668
|
+
if (focus_ !== focus && focus_ !== undefined) setFocus(focus_);
|
|
669
|
+
}, [focus_]);
|
|
670
|
+
_react.default.useEffect(() => {
|
|
671
|
+
const method = event => {
|
|
672
|
+
if (event === 'clear') onClear();
|
|
543
673
|
};
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
// Inner controlled value
|
|
548
|
-
if (!refs.controlled.current)
|
|
549
|
-
setValue(valueNew);
|
|
550
|
-
if ((0, utils_1.is)('function', onChange))
|
|
551
|
-
onChange(valueNew);
|
|
552
|
-
}
|
|
553
|
-
}, [disabled, onChange]);
|
|
554
|
-
const onInputWrapperMouseDown = react_1.default.useCallback((event) => {
|
|
555
|
-
if (!disabled) {
|
|
556
|
-
setMouseDown(true);
|
|
557
|
-
refs.input.current.focus();
|
|
558
|
-
if ((0, utils_1.is)('function', InputWrapperProps.onMouseDown))
|
|
559
|
-
InputWrapperProps.onMouseDown(event);
|
|
560
|
-
}
|
|
561
|
-
}, []);
|
|
562
|
-
const onInputWrapperMouseUp = react_1.default.useCallback((event) => {
|
|
563
|
-
if (!disabled) {
|
|
564
|
-
setMouseDown(false);
|
|
565
|
-
if ((0, utils_1.is)('function', InputWrapperProps.onMouseUp))
|
|
566
|
-
InputWrapperProps.onMouseUp(event);
|
|
567
|
-
}
|
|
568
|
-
}, []);
|
|
569
|
-
const onInputWrapperClick = react_1.default.useCallback((event) => {
|
|
570
|
-
var _a;
|
|
571
|
-
if (!disabled) {
|
|
572
|
-
if (event.target === event.currentTarget)
|
|
573
|
-
(_a = refs.input.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
574
|
-
if ((0, utils_1.is)('function', InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.onClick))
|
|
575
|
-
InputWrapperProps.onClick(event);
|
|
576
|
-
}
|
|
577
|
-
}, []);
|
|
578
|
-
const onFocus = (event) => {
|
|
579
|
-
if (!disabled) {
|
|
580
|
-
setFocus(focus_ !== undefined ? focus_ : true);
|
|
581
|
-
if ((0, utils_1.is)('function', onFocus_))
|
|
582
|
-
onFocus_(event);
|
|
583
|
-
}
|
|
674
|
+
if (subscription) subscription.subscribe(method);
|
|
675
|
+
return () => {
|
|
676
|
+
if (subscription) subscription.unsubscribe(method);
|
|
584
677
|
};
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
678
|
+
}, [subscription]);
|
|
679
|
+
const onToggleVisible = _react.default.useCallback(() => {
|
|
680
|
+
setVisible(item => !item);
|
|
681
|
+
}, []);
|
|
682
|
+
const onUpdateRows = () => {
|
|
683
|
+
if (multiline && row !== undefined) {
|
|
684
|
+
const heightValue = refs.input.current.style.height;
|
|
685
|
+
|
|
686
|
+
// Get actual height with auto
|
|
687
|
+
refs.input.current.style.height = 'auto';
|
|
688
|
+
const scrollHeight = refs.input.current.scrollHeight;
|
|
689
|
+
|
|
690
|
+
// Revert back to previous value
|
|
691
|
+
refs.input.current.style.height = heightValue;
|
|
692
|
+
const newRows = Math.floor(scrollHeight / row.height);
|
|
693
|
+
setRows(newRows);
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
const onUpdate = event => {
|
|
697
|
+
const inputValue = event.target.value;
|
|
698
|
+
|
|
699
|
+
// Carret save previous value
|
|
700
|
+
refs.carret.current = {
|
|
701
|
+
start: refs.input.current.selectionStart,
|
|
702
|
+
end: refs.input.current.selectionEnd
|
|
591
703
|
};
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
704
|
+
|
|
705
|
+
// Only restore if it's not regular carret value
|
|
706
|
+
if (refs.carret.current.start === inputValue.length) refs.carret.current = undefined;
|
|
707
|
+
onUpdateRows();
|
|
708
|
+
|
|
709
|
+
// Inner controlled value
|
|
710
|
+
if (!refs.controlled.current) setValue(inputValue);
|
|
711
|
+
if ((0, _utils.is)('function', onChange)) onChange(inputValue, event);
|
|
712
|
+
};
|
|
713
|
+
const onInput = event => {
|
|
714
|
+
onUpdateRows();
|
|
715
|
+
if ((0, _utils.is)('function', onInput_)) onInput_(event);
|
|
716
|
+
};
|
|
717
|
+
const onClear = _react.default.useCallback(() => {
|
|
718
|
+
if (!disabled) {
|
|
719
|
+
const valueNew = '';
|
|
720
|
+
|
|
721
|
+
// Inner controlled value
|
|
722
|
+
if (!refs.controlled.current) setValue(valueNew);
|
|
723
|
+
if ((0, _utils.is)('function', onChange)) onChange(valueNew);
|
|
609
724
|
}
|
|
610
|
-
|
|
611
|
-
|
|
725
|
+
}, [disabled, onChange]);
|
|
726
|
+
const onInputWrapperMouseDown = _react.default.useCallback(event => {
|
|
727
|
+
if (!disabled) {
|
|
728
|
+
setMouseDown(true);
|
|
729
|
+
refs.input.current.focus();
|
|
730
|
+
if ((0, _utils.is)('function', InputWrapperProps.onMouseDown)) InputWrapperProps.onMouseDown(event);
|
|
612
731
|
}
|
|
613
|
-
|
|
614
|
-
|
|
732
|
+
}, []);
|
|
733
|
+
const onInputWrapperMouseUp = _react.default.useCallback(event => {
|
|
734
|
+
if (!disabled) {
|
|
735
|
+
setMouseDown(false);
|
|
736
|
+
if ((0, _utils.is)('function', InputWrapperProps.onMouseUp)) InputWrapperProps.onMouseUp(event);
|
|
615
737
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
if (footer) {
|
|
623
|
-
WrapperProps = Object.assign({}, other);
|
|
624
|
-
WrapperProps.ref = item => {
|
|
625
|
-
if (rootRef) {
|
|
626
|
-
if ((0, utils_1.is)('function', rootRef))
|
|
627
|
-
rootRef(item);
|
|
628
|
-
else
|
|
629
|
-
rootRef.current = item;
|
|
630
|
-
}
|
|
631
|
-
refs.root.current = item;
|
|
632
|
-
};
|
|
633
|
-
WrapperProps['className'] = (0, style_react_1.classNames)([
|
|
634
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
635
|
-
'onesy-TextField-wrapper',
|
|
636
|
-
fullWidth && 'onesy-TextField-full-width',
|
|
637
|
-
disabled && 'onesy-TextField-disabled',
|
|
638
|
-
fullWidth && 'onesy-full-width'
|
|
639
|
-
],
|
|
640
|
-
className,
|
|
641
|
-
classes.wrapper,
|
|
642
|
-
fullWidth && classes.fullWidth,
|
|
643
|
-
disabled && classes.disabled
|
|
644
|
-
]);
|
|
645
|
-
WrapperProps.style = Object.assign({}, style);
|
|
738
|
+
}, []);
|
|
739
|
+
const onInputWrapperClick = _react.default.useCallback(event => {
|
|
740
|
+
if (!disabled) {
|
|
741
|
+
var _refs$input$current;
|
|
742
|
+
if (event.target === event.currentTarget) (_refs$input$current = refs.input.current) === null || _refs$input$current === void 0 || _refs$input$current.focus();
|
|
743
|
+
if ((0, _utils.is)('function', InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.onClick)) InputWrapperProps.onClick(event);
|
|
646
744
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
rootRef(item);
|
|
653
|
-
else
|
|
654
|
-
rootRef.current = item;
|
|
655
|
-
}
|
|
656
|
-
refs.root.current = item;
|
|
657
|
-
};
|
|
658
|
-
ComponentProps.className = className;
|
|
659
|
-
ComponentProps.style = Object.assign({}, style);
|
|
745
|
+
}, []);
|
|
746
|
+
const onFocus = event => {
|
|
747
|
+
if (!disabled) {
|
|
748
|
+
setFocus(focus_ !== undefined ? focus_ : true);
|
|
749
|
+
if ((0, _utils.is)('function', onFocus_)) onFocus_(event);
|
|
660
750
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
if (
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
type = undefined;
|
|
667
|
-
if (row) {
|
|
668
|
-
if (rows_) {
|
|
669
|
-
styles.input.height = (rows_ * row.height);
|
|
670
|
-
styles.inputWrapper.height = (rows_ * row.height) + row.padding;
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
styles.input.height = (row.height * (0, utils_1.clamp)(rows, minRows, maxRows));
|
|
674
|
-
styles.inputWrapper.height = (row.height * (0, utils_1.clamp)(rows, minRows, maxRows)) + row.padding;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
751
|
+
};
|
|
752
|
+
const onBlur = event => {
|
|
753
|
+
if (!disabled) {
|
|
754
|
+
setFocus(focus_ !== undefined ? focus_ : false);
|
|
755
|
+
if ((0, _utils.is)('function', onBlur_)) onBlur_(event);
|
|
677
756
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
if (
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
if (!['input', 'textarea'].includes(InputComponent)) {
|
|
684
|
-
inputProps.onInput = onInput;
|
|
757
|
+
};
|
|
758
|
+
const onMouseEnter = _react.default.useCallback(event => {
|
|
759
|
+
if (!disabled) {
|
|
760
|
+
setHover(true);
|
|
761
|
+
if ((0, _utils.is)('function', onMouseEnter_)) onMouseEnter_(event);
|
|
685
762
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
if (value && clear) {
|
|
692
|
-
const exists = end === null || end === void 0 ? void 0 : end.find(item => item.key === refs.ids.clear);
|
|
693
|
-
if (!exists) {
|
|
694
|
-
end.push((0, jsx_runtime_1.jsx)(IconClear, Object.assign({ color: 'inherit', onClick: onClear }, IconProps, { className: (0, style_react_1.classNames)([
|
|
695
|
-
IconProps === null || IconProps === void 0 ? void 0 : IconProps.className,
|
|
696
|
-
classes.clear
|
|
697
|
-
]) }), refs.ids.clear));
|
|
698
|
-
}
|
|
763
|
+
}, []);
|
|
764
|
+
const onMouseLeave = _react.default.useCallback(event => {
|
|
765
|
+
if (!disabled) {
|
|
766
|
+
setHover(false);
|
|
767
|
+
if ((0, _utils.is)('function', onMouseLeave_)) onMouseLeave_(event);
|
|
699
768
|
}
|
|
700
|
-
|
|
701
|
-
|
|
769
|
+
}, []);
|
|
770
|
+
const palette = color === 'default' ? theme.palette.color.neutral : !theme.palette.color[color] ? theme.methods.color(color) : theme.palette.color[color];
|
|
771
|
+
if (!focus) {
|
|
772
|
+
styles.root.color = theme.palette.text.default.secondary;
|
|
773
|
+
} else {
|
|
774
|
+
var _theme$palette$color$;
|
|
775
|
+
styles.root.color = styles.input.caretColor = tonal ? theme.methods.palette.color.value(color, 30, true, palette) : color === 'default' ? theme.palette.text.default.primary : ((_theme$palette$color$ = theme.palette.color[color]) === null || _theme$palette$color$ === void 0 ? void 0 : _theme$palette$color$.main) || color;
|
|
776
|
+
}
|
|
777
|
+
if (error) {
|
|
778
|
+
styles.input.caretColor = theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80];
|
|
779
|
+
}
|
|
780
|
+
if (tonal) styles.background.color = theme.methods.palette.color.value(color, 20, true, palette);
|
|
781
|
+
const footer = footer_ || !!helperText || counter !== undefined || required;
|
|
782
|
+
const Wrapper = footer ? WrapperComponent : _react.default.Fragment;
|
|
783
|
+
let ComponentProps = {};
|
|
784
|
+
let WrapperProps = {};
|
|
785
|
+
if (footer) {
|
|
786
|
+
WrapperProps = _objectSpread({}, other);
|
|
787
|
+
WrapperProps.ref = item => {
|
|
788
|
+
if (rootRef) {
|
|
789
|
+
if ((0, _utils.is)('function', rootRef)) rootRef(item);else rootRef.current = item;
|
|
790
|
+
}
|
|
791
|
+
refs.root.current = item;
|
|
792
|
+
};
|
|
793
|
+
WrapperProps['className'] = (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-wrapper', fullWidth && 'onesy-TextField-full-width', disabled && 'onesy-TextField-disabled', fullWidth && 'onesy-full-width'], className, classes.wrapper, fullWidth && classes.fullWidth, disabled && classes.disabled]);
|
|
794
|
+
WrapperProps.style = _objectSpread({}, style);
|
|
795
|
+
} else {
|
|
796
|
+
ComponentProps = _objectSpread({}, other);
|
|
797
|
+
ComponentProps.ref = item => {
|
|
798
|
+
if (rootRef) {
|
|
799
|
+
if ((0, _utils.is)('function', rootRef)) rootRef(item);else rootRef.current = item;
|
|
800
|
+
}
|
|
801
|
+
refs.root.current = item;
|
|
802
|
+
};
|
|
803
|
+
ComponentProps.className = className;
|
|
804
|
+
ComponentProps.style = _objectSpread({}, style);
|
|
805
|
+
}
|
|
806
|
+
ComponentProps.style = _objectSpread(_objectSpread({}, ComponentProps.style), styles.root);
|
|
807
|
+
let InputComponent = 'input';
|
|
808
|
+
if (multiline) {
|
|
809
|
+
InputComponent = 'textarea';
|
|
810
|
+
inputProps.rows = 1;
|
|
811
|
+
type = undefined;
|
|
812
|
+
if (row) {
|
|
813
|
+
if (rows_) {
|
|
814
|
+
styles.input.height = rows_ * row.height;
|
|
815
|
+
styles.inputWrapper.height = rows_ * row.height + row.padding;
|
|
816
|
+
} else {
|
|
817
|
+
styles.input.height = row.height * (0, _utils.clamp)(rows, minRows, maxRows);
|
|
818
|
+
styles.inputWrapper.height = row.height * (0, _utils.clamp)(rows, minRows, maxRows) + row.padding;
|
|
819
|
+
}
|
|
702
820
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// override the input element
|
|
824
|
+
// with a custom value
|
|
825
|
+
if (InputComponent_) InputComponent = InputComponent_;
|
|
826
|
+
|
|
827
|
+
// onInput
|
|
828
|
+
if (!['input', 'textarea'].includes(InputComponent)) {
|
|
829
|
+
inputProps.onInput = onInput;
|
|
830
|
+
}
|
|
831
|
+
const iconProps = {
|
|
832
|
+
size
|
|
833
|
+
};
|
|
834
|
+
const isTypePassword = type === 'password';
|
|
835
|
+
const end = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
|
|
836
|
+
if (value && clear) {
|
|
837
|
+
const exists = end === null || end === void 0 ? void 0 : end.find(item => item.key === refs.ids.clear);
|
|
838
|
+
if (!exists) {
|
|
839
|
+
end.push(/*#__PURE__*/_react.default.createElement(IconClear, (0, _extends2.default)({
|
|
840
|
+
key: refs.ids.clear,
|
|
841
|
+
color: "inherit",
|
|
842
|
+
onClick: onClear
|
|
843
|
+
}, IconProps, {
|
|
844
|
+
className: (0, _styleReact.classNames)([IconProps === null || IconProps === void 0 ? void 0 : IconProps.className, classes.clear])
|
|
845
|
+
})));
|
|
708
846
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
(prefix || start) && classes.input_start_icon,
|
|
822
|
-
(sufix || end) && classes.input_end_icon,
|
|
823
|
-
minimal && !label && classes[`inputWrapper_without_label_size_${size}`]
|
|
824
|
-
]), onClick: onInputWrapperClick, onMouseUp: onInputWrapperMouseUp, onMouseDown: onInputWrapperMouseDown, style: Object.assign(Object.assign({}, styles.inputWrapper), InputWrapperProps.style) }, { children: [children, (0, jsx_runtime_1.jsx)(InputComponent, Object.assign({}, inputProps, { ref: item => {
|
|
825
|
-
if (ref) {
|
|
826
|
-
if ((0, utils_1.is)('function', ref))
|
|
827
|
-
ref(item);
|
|
828
|
-
else
|
|
829
|
-
ref.current = item;
|
|
830
|
-
}
|
|
831
|
-
refs.input.current = item;
|
|
832
|
-
if (inputProps.ref) {
|
|
833
|
-
if ((0, utils_1.is)('function', inputProps.ref))
|
|
834
|
-
inputProps.ref(item);
|
|
835
|
-
else
|
|
836
|
-
inputProps.ref.current = item;
|
|
837
|
-
}
|
|
838
|
-
}, className: (0, style_react_1.classNames)([
|
|
839
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
840
|
-
'onesy-TextField-input'
|
|
841
|
-
],
|
|
842
|
-
classes.input,
|
|
843
|
-
inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
844
|
-
multiline && classes.multiline,
|
|
845
|
-
align && classes[`input_align_${align}`]
|
|
846
|
-
]), onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, onChange: onUpdate, value: value !== undefined ? value : '', type: type === 'password' && visible ? 'text' : type, autoFocus: autoFocus, autoComplete: autoComplete, readOnly: readOnly, disabled: disabled, style: Object.assign(Object.assign({}, styles.input), inputProps.style) }))] })), sufix !== undefined && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ className: (0, style_react_1.classNames)([
|
|
847
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
848
|
-
'onesy-TextField-addition',
|
|
849
|
-
'onesy-TextField-sufix'
|
|
850
|
-
],
|
|
851
|
-
classes.addition,
|
|
852
|
-
classes.sufix,
|
|
853
|
-
(end || version === 'text') && classes.sufix_noEndMargin,
|
|
854
|
-
classes[`addition_size_${size}`],
|
|
855
|
-
classes[`addition_version_${version}_size_${size}`],
|
|
856
|
-
(enabled || valueWithData || focus) && classes.sufix_focus,
|
|
857
|
-
noSufixMargin && classes.noSufixMargin
|
|
858
|
-
]), version: 'b2' }, { children: sufix }))), !minimal && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!react_1.default.Children.toArray(end).length && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
|
|
859
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
860
|
-
'onesy-TextField-icon',
|
|
861
|
-
'onesy-TextField-icon-end'
|
|
862
|
-
],
|
|
863
|
-
classes.icon,
|
|
864
|
-
classes.icon_end,
|
|
865
|
-
classes[`icon${((_e = (_d = end === null || end === void 0 ? void 0 : end.type) === null || _d === void 0 ? void 0 : _d.displayName) === null || _e === void 0 ? void 0 : _e.includes('IconButton')) ? '_button' : ''}_size_${size}`],
|
|
866
|
-
classes[`icon_version_${version}`],
|
|
867
|
-
classes[`icon_version_${version}_size_${size}`],
|
|
868
|
-
classes[`icon_vertical_align_${endVerticalAlign}`]
|
|
869
|
-
]) }, { children: react_1.default.Children.toArray(end).map((item, index) => {
|
|
870
|
-
var _a, _b, _c, _d;
|
|
871
|
-
return (react_1.default.cloneElement(item, {
|
|
872
|
-
key: index,
|
|
873
|
-
size: ((_a = item.props) === null || _a === void 0 ? void 0 : _a.size) !== undefined ? (_b = item.props) === null || _b === void 0 ? void 0 : _b.size : size,
|
|
874
|
-
color: ((_c = item.props) === null || _c === void 0 ? void 0 : _c.color) !== undefined ? (_d = item.props) === null || _d === void 0 ? void 0 : _d.color : error ? theme.palette.light ? theme.palette.color.error[hover ? 20 : 40] : theme.palette.color.error[hover ? 90 : 80] : theme.palette.text.default.secondary,
|
|
875
|
-
style: Object.assign(Object.assign({}, item.props.style), styles.icon)
|
|
876
|
-
}));
|
|
877
|
-
}) }))) })] })), footer && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(!!helperText || counter !== undefined || required) && ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 2, direction: 'row', justify: 'space-between', className: (0, style_react_1.classNames)([
|
|
878
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
879
|
-
'onesy-TextField-footer'
|
|
880
|
-
],
|
|
881
|
-
classes.footer,
|
|
882
|
-
classes[`footer_version_${version}`]
|
|
883
|
-
]) }, { children: [(helperText || required) && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, HelperTextProps, { className: (0, style_react_1.classNames)([
|
|
884
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
885
|
-
'onesy-TextField-helper-text',
|
|
886
|
-
error && 'onesy-TextField-error'
|
|
887
|
-
],
|
|
888
|
-
HelperTextProps === null || HelperTextProps === void 0 ? void 0 : HelperTextProps.className,
|
|
889
|
-
classes.helperText,
|
|
890
|
-
error && classes.error_color
|
|
891
|
-
]) }, { children: helperText !== undefined ? helperText : required ? `*${l('required')}` : '' }))), counter && ((0, jsx_runtime_1.jsxs)(Type, Object.assign({ version: 'b3', className: (0, style_react_1.classNames)([
|
|
892
|
-
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
893
|
-
'onesy-TextField-counter'
|
|
894
|
-
],
|
|
895
|
-
classes.counterText,
|
|
896
|
-
error && classes.error_color
|
|
897
|
-
]) }, { children: [((_f = String(value)) === null || _f === void 0 ? void 0 : _f.length) || 0, "/", counter] })))] }))), footer_] })] })));
|
|
847
|
+
}
|
|
848
|
+
if (value && isTypePassword) {
|
|
849
|
+
end.unshift(/*#__PURE__*/_react.default.createElement(Tooltip, {
|
|
850
|
+
name: visible ? l('Hide password') : l('View password'),
|
|
851
|
+
color: "inverted"
|
|
852
|
+
}, /*#__PURE__*/_react.default.createElement(IconButton, {
|
|
853
|
+
onClick: onToggleVisible,
|
|
854
|
+
color: "default",
|
|
855
|
+
size: size === 'large' ? 'regular' : 'small'
|
|
856
|
+
}, visible ? /*#__PURE__*/_react.default.createElement(_IconMaterialPassword2OffW.default, iconProps) : /*#__PURE__*/_react.default.createElement(_IconMaterialPassword2W.default, iconProps))));
|
|
857
|
+
}
|
|
858
|
+
if (!multiline) {
|
|
859
|
+
if (props.startVerticalAlign === undefined) startVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
860
|
+
if (props.endVerticalAlign === undefined) endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
861
|
+
}
|
|
862
|
+
const valueWithData = value !== undefined && String(value);
|
|
863
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, WrapperProps, /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
|
|
864
|
+
onMouseEnter: onMouseEnter,
|
|
865
|
+
onMouseLeave: onMouseLeave,
|
|
866
|
+
onTouchStart: onMouseEnter,
|
|
867
|
+
onTouchEnd: onMouseLeave,
|
|
868
|
+
role: "textbox",
|
|
869
|
+
"aria-multiline": multiline,
|
|
870
|
+
"aria-labelledby": refs.ids.label
|
|
871
|
+
}, ComponentProps, {
|
|
872
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-root',, `onesy-TextField-version-${version}`, `onesy-TextField-size-${size}`, multiline && `onesy-TextField-multiline`, valueWithData && 'onesy-TextField-value', error && `onesy-TextField-error`, required && 'onesy-TextField-required', enabled && 'onesy-TextField-enabled', hover && `onesy-TextField-hover`, mouseDown && `onesy-TextField-mouse-down`, focus && `onesy-TextField-focus`, readOnly && `onesy-TextField-read-only`, disabled && 'onesy-TextField-disabled', fullWidth && 'onesy-full-width'], ComponentProps.className, classes.root, classes[`color_${color}`], fullWidth && classes.fullWidth, error && (hover ? classes.error_hover_color : classes.error_color), !footer && disabled && classes.disabled]),
|
|
873
|
+
style: _objectSpread({
|
|
874
|
+
minWidth
|
|
875
|
+
}, (_ComponentProps = ComponentProps) === null || _ComponentProps === void 0 ? void 0 : _ComponentProps.style)
|
|
876
|
+
}), !minimal && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ['filled'].includes(version) && /*#__PURE__*/_react.default.createElement("span", {
|
|
877
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-background'], classes.background, (enabled || valueWithData || focus) && classes.background_focus, hover && classes.background_hover]),
|
|
878
|
+
style: styles.background
|
|
879
|
+
}), ['text', 'filled'].includes(version) && /*#__PURE__*/_react.default.createElement("span", {
|
|
880
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-border'], classes.border, focus && classes.border_focus]),
|
|
881
|
+
style: styles.border
|
|
882
|
+
}), ['outlined'].includes(version) && /*#__PURE__*/_react.default.createElement("fieldset", {
|
|
883
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-fieldset'], classes.fieldset, focus && classes.fieldset_focus]),
|
|
884
|
+
style: styles.fieldset
|
|
885
|
+
}, /*#__PURE__*/_react.default.createElement("legend", {
|
|
886
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-legend'], classes.legend, (enabled || valueWithData || focus) && label !== undefined && classes.legend_focus])
|
|
887
|
+
}, label, required ? '*' : '', optional ? ` (${optionalText})` : ''))), label && /*#__PURE__*/_react.default.createElement(Type, {
|
|
888
|
+
version: "b2",
|
|
889
|
+
id: refs.ids.label,
|
|
890
|
+
Component: "label",
|
|
891
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-label'], classes.label, classes[`label_${multiline ? 'multiline' : 'regular'}`], classes[`label_version_${version}`], classes[`label_size_${size}`], multiline && classes[`label_size_${size}_multiline`], classes[`label_version_${version}_size_${size}`], (enabled || valueWithData || focus) && [classes[`label_focus`], classes[`label_version_${version}_focus`], classes[`label_version_${version}_size_${size}${multiline ? '_multiline' : ''}_focus`], multiline && classes.label_multiline_focus], theme.direction === 'rtl' && classes.label_rtl, start && [classes.label_icon_start, classes[`label_version_${version}_icon_start`]]])
|
|
892
|
+
}, label, required ? '*' : '', optional ? ` (${optionalText})` : ''), !minimal && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !!_react.default.Children.toArray(start).length && /*#__PURE__*/_react.default.createElement("span", {
|
|
893
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-icon', 'onesy-TextField-icon-start'], classes.icon, classes.icon_start, classes[`icon${start !== null && start !== void 0 && (_type = start.type) !== null && _type !== void 0 && (_type = _type.displayName) !== null && _type !== void 0 && _type.includes('IconButton') ? '_button' : ''}_size_${size}`], classes[`icon_version_${version}`], classes[`icon_version_${version}_size_${size}`], classes[`icon_vertical_align_${startVerticalAlign}`]])
|
|
894
|
+
}, _react.default.Children.toArray(start).map((item, index) => {
|
|
895
|
+
var _item$props, _item$props2, _item$props3, _item$props4;
|
|
896
|
+
return /*#__PURE__*/_react.default.cloneElement(item, {
|
|
897
|
+
key: index,
|
|
898
|
+
size: ((_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.size) !== undefined ? (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.size : 'regular',
|
|
899
|
+
color: ((_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.color) !== undefined ? (_item$props4 = item.props) === null || _item$props4 === void 0 ? void 0 : _item$props4.color : theme.palette.text.default.secondary,
|
|
900
|
+
style: _objectSpread(_objectSpread({}, item.props.style), styles.icon)
|
|
901
|
+
});
|
|
902
|
+
}))), prefix !== undefined && /*#__PURE__*/_react.default.createElement(Type, {
|
|
903
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-addition', 'onesy-TextField-prefix'], classes.addition, classes.prefix, (start || version === 'text') && classes.prefix_noStartMargin, classes[`addition_size_${size}`], classes[`addition_version_${version}_size_${size}`], (enabled || valueWithData || focus) && classes.prefix_focus, noPrefixMargin && classes.noPrefixMargin, minimal && !label && classes[`addition_without_label_size_${size}`]]),
|
|
904
|
+
version: "b2"
|
|
905
|
+
}, prefix), /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, InputWrapperProps, {
|
|
906
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-input-wrapper'], classes.inputWrapper, InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.className, (enabled || label === undefined || valueWithData || focus) && classes.inputWrapper_focus, classes[`input_version_${version}`], classes[`input_size_${size}`], classes[`input_version_${version}_size_${size}`], (prefix || start) && classes.input_start_icon, (sufix || end) && classes.input_end_icon, minimal && !label && classes[`inputWrapper_without_label_size_${size}`]]),
|
|
907
|
+
onClick: onInputWrapperClick,
|
|
908
|
+
onMouseUp: onInputWrapperMouseUp,
|
|
909
|
+
onMouseDown: onInputWrapperMouseDown,
|
|
910
|
+
style: _objectSpread(_objectSpread({}, styles.inputWrapper), InputWrapperProps.style)
|
|
911
|
+
}), children, /*#__PURE__*/_react.default.createElement(InputComponent, (0, _extends2.default)({}, inputProps, {
|
|
912
|
+
ref: item => {
|
|
913
|
+
if (ref) {
|
|
914
|
+
if ((0, _utils.is)('function', ref)) ref(item);else ref.current = item;
|
|
915
|
+
}
|
|
916
|
+
refs.input.current = item;
|
|
917
|
+
if (inputProps.ref) {
|
|
918
|
+
if ((0, _utils.is)('function', inputProps.ref)) inputProps.ref(item);else inputProps.ref.current = item;
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-input'], classes.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className, multiline && classes.multiline, align && classes[`input_align_${align}`]]),
|
|
922
|
+
onFocus: onFocus,
|
|
923
|
+
onBlur: onBlur,
|
|
924
|
+
placeholder: placeholder,
|
|
925
|
+
onChange: onUpdate,
|
|
926
|
+
value: value !== undefined ? value : '',
|
|
927
|
+
type: type === 'password' && visible ? 'text' : type,
|
|
928
|
+
autoFocus: autoFocus,
|
|
929
|
+
autoComplete: autoComplete,
|
|
930
|
+
readOnly: readOnly,
|
|
931
|
+
disabled: disabled,
|
|
932
|
+
style: _objectSpread(_objectSpread({}, styles.input), inputProps.style)
|
|
933
|
+
}))), sufix !== undefined && /*#__PURE__*/_react.default.createElement(Type, {
|
|
934
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-addition', 'onesy-TextField-sufix'], classes.addition, classes.sufix, (end || version === 'text') && classes.sufix_noEndMargin, classes[`addition_size_${size}`], classes[`addition_version_${version}_size_${size}`], (enabled || valueWithData || focus) && classes.sufix_focus, noSufixMargin && classes.noSufixMargin]),
|
|
935
|
+
version: "b2"
|
|
936
|
+
}, sufix), !minimal && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !!_react.default.Children.toArray(end).length && /*#__PURE__*/_react.default.createElement("span", {
|
|
937
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-icon', 'onesy-TextField-icon-end'], classes.icon, classes.icon_end, classes[`icon${end !== null && end !== void 0 && (_type2 = end.type) !== null && _type2 !== void 0 && (_type2 = _type2.displayName) !== null && _type2 !== void 0 && _type2.includes('IconButton') ? '_button' : ''}_size_${size}`], classes[`icon_version_${version}`], classes[`icon_version_${version}_size_${size}`], classes[`icon_vertical_align_${endVerticalAlign}`]])
|
|
938
|
+
}, _react.default.Children.toArray(end).map((item, index) => {
|
|
939
|
+
var _item$props5, _item$props6, _item$props7, _item$props8;
|
|
940
|
+
return /*#__PURE__*/_react.default.cloneElement(item, {
|
|
941
|
+
key: index,
|
|
942
|
+
size: ((_item$props5 = item.props) === null || _item$props5 === void 0 ? void 0 : _item$props5.size) !== undefined ? (_item$props6 = item.props) === null || _item$props6 === void 0 ? void 0 : _item$props6.size : size,
|
|
943
|
+
color: ((_item$props7 = item.props) === null || _item$props7 === void 0 ? void 0 : _item$props7.color) !== undefined ? (_item$props8 = item.props) === null || _item$props8 === void 0 ? void 0 : _item$props8.color : error ? theme.palette.light ? theme.palette.color.error[hover ? 20 : 40] : theme.palette.color.error[hover ? 90 : 80] : theme.palette.text.default.secondary,
|
|
944
|
+
style: _objectSpread(_objectSpread({}, item.props.style), styles.icon)
|
|
945
|
+
});
|
|
946
|
+
})))), footer && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (!!helperText || counter !== undefined || required) && /*#__PURE__*/_react.default.createElement(Line, {
|
|
947
|
+
gap: 2,
|
|
948
|
+
direction: "row",
|
|
949
|
+
justify: "space-between",
|
|
950
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-footer'], classes.footer, classes[`footer_version_${version}`]])
|
|
951
|
+
}, (helperText || required) && /*#__PURE__*/_react.default.createElement(Type, (0, _extends2.default)({
|
|
952
|
+
version: "b3"
|
|
953
|
+
}, HelperTextProps, {
|
|
954
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-helper-text', error && 'onesy-TextField-error'], HelperTextProps === null || HelperTextProps === void 0 ? void 0 : HelperTextProps.className, classes.helperText, error && classes.error_color])
|
|
955
|
+
}), helperText !== undefined ? helperText : required ? `*${l('required')}` : ''), counter && /*#__PURE__*/_react.default.createElement(Type, {
|
|
956
|
+
version: "b3",
|
|
957
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-counter'], classes.counterText, error && classes.error_color])
|
|
958
|
+
}, ((_String = String(value)) === null || _String === void 0 ? void 0 : _String.length) || 0, "/", counter)), footer_));
|
|
898
959
|
});
|
|
899
960
|
TextField.displayName = 'onesy-TextField';
|
|
900
|
-
exports.default = TextField;
|
|
961
|
+
var _default = exports.default = TextField;
|