bright-components 9.32.0 → 10.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc +1 -1
- package/dist/animations/SlideUp/index.js +32 -20
- package/dist/components/A/index.js +18 -14
- package/dist/components/Alert/index.js +24 -57
- package/dist/components/Avatar/index.js +29 -34
- package/dist/components/Avatar/utils/getAcronym/index.js +2 -4
- package/dist/components/Badge/index.js +14 -20
- package/dist/components/Breadcrumbs/index.js +33 -41
- package/dist/components/BrowserWarning/index.js +39 -37
- package/dist/components/BrowserWarning/supportsStaticImport.js +1 -1
- package/dist/components/BulletedList/index.js +19 -35
- package/dist/components/Button/BaseButton/index.js +46 -38
- package/dist/components/Button/BrandButton/index.js +20 -13
- package/dist/components/Button/Button/index.js +63 -66
- package/dist/components/Button/OutlineButton/index.js +41 -43
- package/dist/components/Button/WhiteOutlineButton/index.js +16 -13
- package/dist/components/ButtonGroup/index.js +33 -16
- package/dist/components/Checkbox/index.js +89 -68
- package/dist/components/Chevron/Chevron/index.js +13 -18
- package/dist/components/Chevron/CircledChevron/index.js +30 -17
- package/dist/components/CopyToClipboard/index.js +49 -59
- package/dist/components/CountryPicker/index.js +17 -19
- package/dist/components/DateInput/index.js +68 -89
- package/dist/components/DayMonthInput/index.js +29 -47
- package/dist/components/DayMonthInput/utils/getDayValue/index.js +3 -3
- package/dist/components/DayPicker/index.js +176 -214
- package/dist/components/DayPickerPanel/Cancel/index.js +15 -13
- package/dist/components/DayPickerPanel/Header/index.js +53 -96
- package/dist/components/DayPickerPanel/HeaderDayPickerPanel/dayPickerCSS.js +160 -11
- package/dist/components/DayPickerPanel/HeaderDayPickerPanel/index.js +149 -252
- package/dist/components/DayPickerPanel/HeaderMonthPanel/index.js +31 -40
- package/dist/components/DayPickerPanel/HeaderYearPanel/index.js +28 -41
- package/dist/components/DayPickerPanel/ItemSelector/index.js +44 -59
- package/dist/components/DayPickerPanel/Shortcuts/index.js +23 -28
- package/dist/components/DayPickerPanel/index.js +173 -217
- package/dist/components/DayPickerPanel/utils/getYearRangeChunks/index.js +3 -3
- package/dist/components/DayPickerPanel/utils/getYearRangeIndex/index.js +1 -5
- package/dist/components/Donut/index.js +73 -31
- package/dist/components/DropZone/index.js +21 -54
- package/dist/components/Dropdown/DropdownItem/index.js +11 -14
- package/dist/components/Dropdown/index.js +71 -118
- package/dist/components/DurationInput/index.js +41 -56
- package/dist/components/DurationInput/utils/roundOnBlur/index.js +13 -11
- package/dist/components/EmployeeCard/index.js +24 -40
- package/dist/components/EmployeePicker/DisplayFilter/index.js +29 -37
- package/dist/components/EmployeePicker/FilterBar/index.js +51 -84
- package/dist/components/EmployeePicker/Group/index.js +70 -127
- package/dist/components/EmployeePicker/GroupList/index.js +20 -24
- package/dist/components/EmployeePicker/Item/index.js +76 -122
- package/dist/components/EmployeePicker/index.js +67 -77
- package/dist/components/EmployeePicker/utils/index.js +9 -21
- package/dist/components/ErrorMessage/index.js +16 -29
- package/dist/components/Expando/index.js +62 -96
- package/dist/components/Fieldset/index.js +24 -18
- package/dist/components/FileIcons/index.js +14 -12
- package/dist/components/FilterRadioGroup/index.js +59 -55
- package/dist/components/Form/index.js +195 -198
- package/dist/components/Form/utils/runFormValidation.js +11 -11
- package/dist/components/FormLayout/FormRow/FormContent/index.js +4 -16
- package/dist/components/FormLayout/FormRow/FormLabel/index.js +10 -14
- package/dist/components/FormLayout/FormRow/index.js +9 -14
- package/dist/components/FormLayout/index.js +1 -14
- package/dist/components/Formik/FormikCheckbox/index.js +8 -8
- package/dist/components/Formik/FormikDayPicker/index.js +23 -17
- package/dist/components/Formik/FormikInput/index.js +10 -10
- package/dist/components/Formik/FormikOptions/index.js +13 -20
- package/dist/components/Formik/FormikRadio/index.js +10 -10
- package/dist/components/Formik/FormikRadioGroup/index.js +3 -5
- package/dist/components/Formik/FormikResetButton/index.js +5 -3
- package/dist/components/Formik/FormikSelect/index.js +10 -10
- package/dist/components/Formik/FormikSubmitButton/index.js +8 -8
- package/dist/components/Formik/FormikTextarea/index.js +10 -10
- package/dist/components/Formik/FormikTypeahead/index.js +26 -30
- package/dist/components/Formik/FormikValidation/index.js +12 -21
- package/dist/components/Formik/index.js +1 -14
- package/dist/components/HR/index.js +12 -14
- package/dist/components/Icons/AddIcon/index.js +6 -8
- package/dist/components/Icons/AddSquare/index.js +5 -7
- package/dist/components/Icons/Alarmclock/index.js +5 -7
- package/dist/components/Icons/Anchor/index.js +5 -7
- package/dist/components/Icons/Apps/index.js +5 -7
- package/dist/components/Icons/ArrowBigDown/index.js +5 -7
- package/dist/components/Icons/ArrowLoop/index.js +5 -7
- package/dist/components/Icons/Baby/index.js +5 -7
- package/dist/components/Icons/BackArrow/index.js +5 -7
- package/dist/components/Icons/BackToWorkNavigator/index.js +7 -9
- package/dist/components/Icons/Beta/index.js +5 -7
- package/dist/components/Icons/Blip/index.js +12 -14
- package/dist/components/Icons/Book/index.js +5 -7
- package/dist/components/Icons/Bookmark/index.js +5 -7
- package/dist/components/Icons/BoomMoodle/index.js +8 -10
- package/dist/components/Icons/BoxTruck/index.js +5 -7
- package/dist/components/Icons/BrighhrApp/index.js +5 -7
- package/dist/components/Icons/BrightAdvice/index.js +5 -7
- package/dist/components/Icons/Browser/index.js +5 -7
- package/dist/components/Icons/Bullhorn/index.js +5 -7
- package/dist/components/Icons/Cake/index.js +5 -7
- package/dist/components/Icons/Calculator/index.js +5 -7
- package/dist/components/Icons/Calendar/index.js +25 -27
- package/dist/components/Icons/CalendarAdd/index.js +11 -13
- package/dist/components/Icons/CalendarBlackout/index.js +5 -7
- package/dist/components/Icons/CalendarCross/index.js +9 -11
- package/dist/components/Icons/CalendarDates/index.js +5 -7
- package/dist/components/Icons/CalendarInfo/index.js +5 -7
- package/dist/components/Icons/CalendarOverlap/index.js +5 -7
- package/dist/components/Icons/Camera/index.js +5 -7
- package/dist/components/Icons/CameraAperture/index.js +5 -7
- package/dist/components/Icons/Cart/index.js +11 -13
- package/dist/components/Icons/Case/index.js +5 -7
- package/dist/components/Icons/Certificate/index.js +5 -7
- package/dist/components/Icons/Chair/index.js +5 -7
- package/dist/components/Icons/Chat/index.js +5 -7
- package/dist/components/Icons/CheckCircle/index.js +5 -7
- package/dist/components/Icons/Checklist/index.js +5 -7
- package/dist/components/Icons/Chevron/index.js +5 -7
- package/dist/components/Icons/ChevronCircleDown/index.js +5 -7
- package/dist/components/Icons/ChevronCircleLeft/index.js +5 -7
- package/dist/components/Icons/ChevronCircleRight/index.js +5 -7
- package/dist/components/Icons/ChevronCircleUp/index.js +5 -7
- package/dist/components/Icons/ChevronDoubleDown/index.js +13 -15
- package/dist/components/Icons/ChevronDoubleUp/index.js +13 -15
- package/dist/components/Icons/ChevronDown/index.js +5 -7
- package/dist/components/Icons/ChevronLeft/index.js +5 -7
- package/dist/components/Icons/ChevronRight/index.js +5 -7
- package/dist/components/Icons/ChevronUp/index.js +5 -7
- package/dist/components/Icons/Clear/index.js +5 -7
- package/dist/components/Icons/Clipboard/index.js +40 -42
- package/dist/components/Icons/Clock/index.js +7 -9
- package/dist/components/Icons/Close/index.js +7 -3
- package/dist/components/Icons/ClothesHanger/index.js +5 -7
- package/dist/components/Icons/Clothing/index.js +5 -7
- package/dist/components/Icons/Cog/index.js +5 -7
- package/dist/components/Icons/Compass/index.js +5 -7
- package/dist/components/Icons/Compassion/index.js +7 -9
- package/dist/components/Icons/Compassionate/index.js +5 -7
- package/dist/components/Icons/Conflict/index.js +5 -7
- package/dist/components/Icons/ContactCard/index.js +5 -7
- package/dist/components/Icons/Contrast/index.js +5 -7
- package/dist/components/Icons/Copy/index.js +5 -7
- package/dist/components/Icons/Court/index.js +5 -7
- package/dist/components/Icons/Crib/index.js +5 -7
- package/dist/components/Icons/Crop/index.js +5 -7
- package/dist/components/Icons/Cross/index.js +5 -7
- package/dist/components/Icons/CrossCircle/index.js +5 -7
- package/dist/components/Icons/CrossThick/index.js +29 -0
- package/dist/components/Icons/Crown/index.js +5 -7
- package/dist/components/Icons/Dependants/index.js +5 -7
- package/dist/components/Icons/DesktopComputer/index.js +5 -7
- package/dist/components/Icons/Dial/index.js +5 -7
- package/dist/components/Icons/Diamond/index.js +5 -7
- package/dist/components/Icons/Diaper/index.js +5 -7
- package/dist/components/Icons/DisabilityMobility/index.js +5 -7
- package/dist/components/Icons/Door/index.js +5 -7
- package/dist/components/Icons/DownArrow/index.js +5 -7
- package/dist/components/Icons/Download/index.js +5 -7
- package/dist/components/Icons/Dropdown/index.js +17 -22
- package/dist/components/Icons/Edit/index.js +5 -7
- package/dist/components/Icons/Education/index.js +5 -7
- package/dist/components/Icons/Emergency/index.js +5 -7
- package/dist/components/Icons/Enter/index.js +5 -7
- package/dist/components/Icons/Error/index.js +5 -7
- package/dist/components/Icons/ErrorOctagon/index.js +5 -7
- package/dist/components/Icons/Exit/index.js +5 -7
- package/dist/components/Icons/Expand/index.js +5 -7
- package/dist/components/Icons/Eye/index.js +7 -3
- package/dist/components/Icons/Factory/index.js +20 -22
- package/dist/components/Icons/FactoryIcon/index.js +5 -7
- package/dist/components/Icons/Featus/index.js +5 -7
- package/dist/components/Icons/FeedbackLoop/index.js +5 -7
- package/dist/components/Icons/FileAudio/index.js +7 -9
- package/dist/components/Icons/FileCode/index.js +5 -7
- package/dist/components/Icons/FileDocument/index.js +11 -13
- package/dist/components/Icons/FileEmail/index.js +5 -7
- package/dist/components/Icons/FileMovie/index.js +5 -7
- package/dist/components/Icons/FilePath/index.js +5 -7
- package/dist/components/Icons/FilePdf/index.js +9 -11
- package/dist/components/Icons/FilePresentation/index.js +13 -15
- package/dist/components/Icons/FileSpreadsheet/index.js +9 -11
- package/dist/components/Icons/FileText/index.js +11 -13
- package/dist/components/Icons/FileVector/index.js +5 -7
- package/dist/components/Icons/Filter/index.js +5 -7
- package/dist/components/Icons/Fingerprint/index.js +5 -7
- package/dist/components/Icons/Flag/index.js +5 -7
- package/dist/components/Icons/Flash/index.js +5 -7
- package/dist/components/Icons/FlashOff/index.js +5 -7
- package/dist/components/Icons/Flower/index.js +5 -7
- package/dist/components/Icons/Folder/index.js +6 -8
- package/dist/components/Icons/FolderSolid/index.js +5 -7
- package/dist/components/Icons/FolderZip/index.js +6 -8
- package/dist/components/Icons/FurloughNavigator/index.js +7 -9
- package/dist/components/Icons/Gallery/index.js +5 -7
- package/dist/components/Icons/GestureTouch/index.js +5 -7
- package/dist/components/Icons/Ghost/index.js +5 -7
- package/dist/components/Icons/Gift/index.js +5 -7
- package/dist/components/Icons/Globe/index.js +5 -7
- package/dist/components/Icons/Grid/index.js +5 -7
- package/dist/components/Icons/Headset/index.js +5 -7
- package/dist/components/Icons/Health/index.js +5 -7
- package/dist/components/Icons/Heart/index.js +5 -7
- package/dist/components/Icons/Help/index.js +5 -7
- package/dist/components/Icons/Home/index.js +5 -7
- package/dist/components/Icons/Hourglass/index.js +5 -7
- package/dist/components/Icons/IdCard/index.js +5 -7
- package/dist/components/Icons/Image/index.js +9 -11
- package/dist/components/Icons/Inbox/index.js +5 -7
- package/dist/components/Icons/InboxEmpty/index.js +5 -7
- package/dist/components/Icons/Information/index.js +5 -7
- package/dist/components/Icons/Injury/index.js +64 -66
- package/dist/components/Icons/KebabMenuHorizontal/index.js +5 -7
- package/dist/components/Icons/KebabMenuVertical/index.js +5 -7
- package/dist/components/Icons/Lazydave/index.js +71 -73
- package/dist/components/Icons/LazydaveMoodle/index.js +71 -73
- package/dist/components/Icons/LeftArrow/index.js +5 -7
- package/dist/components/Icons/Legal/index.js +5 -7
- package/dist/components/Icons/Lightning/index.js +5 -7
- package/dist/components/Icons/LineChart/index.js +5 -7
- package/dist/components/Icons/Link/index.js +5 -7
- package/dist/components/Icons/List/index.js +21 -23
- package/dist/components/Icons/ListBullets/index.js +5 -7
- package/dist/components/Icons/LocationPin/index.js +5 -7
- package/dist/components/Icons/Loop/index.js +5 -7
- package/dist/components/Icons/Magicwand/index.js +5 -7
- package/dist/components/Icons/Mail/index.js +5 -7
- package/dist/components/Icons/MandatoryLeave/index.js +5 -7
- package/dist/components/Icons/Medal/index.js +5 -7
- package/dist/components/Icons/Medical/index.js +5 -7
- package/dist/components/Icons/MedicalBag/index.js +5 -7
- package/dist/components/Icons/Medication/index.js +5 -7
- package/dist/components/Icons/MenuHamburger/index.js +5 -7
- package/dist/components/Icons/Message/index.js +5 -7
- package/dist/components/Icons/Meteor/index.js +5 -7
- package/dist/components/Icons/MinusCircle/index.js +5 -7
- package/dist/components/Icons/MinusSquare/index.js +5 -7
- package/dist/components/Icons/MoneyStack/index.js +5 -7
- package/dist/components/Icons/MoveFile/index.js +5 -7
- package/dist/components/Icons/New/index.js +9 -11
- package/dist/components/Icons/New2/index.js +9 -11
- package/dist/components/Icons/NewWindow/index.js +5 -7
- package/dist/components/Icons/Night/index.js +5 -7
- package/dist/components/Icons/NotAllowed/index.js +5 -7
- package/dist/components/Icons/Note/index.js +7 -9
- package/dist/components/Icons/Notepad/index.js +5 -7
- package/dist/components/Icons/Notifications/index.js +5 -7
- package/dist/components/Icons/OrganisationConnection/index.js +5 -7
- package/dist/components/Icons/Overtime/index.js +5 -7
- package/dist/components/Icons/Pacman/index.js +5 -7
- package/dist/components/Icons/PadlockLocked/index.js +5 -7
- package/dist/components/Icons/PadlockUnlocked/index.js +5 -7
- package/dist/components/Icons/PaperStack/index.js +5 -7
- package/dist/components/Icons/Paperclip/index.js +5 -7
- package/dist/components/Icons/PayrollNavigator/index.js +5 -7
- package/dist/components/Icons/Pencil/index.js +5 -7
- package/dist/components/Icons/Perspective/index.js +5 -7
- package/dist/components/Icons/Phone/index.js +5 -7
- package/dist/components/Icons/PhoneWork/index.js +5 -7
- package/dist/components/Icons/PieChart/index.js +5 -7
- package/dist/components/Icons/Pin/index.js +5 -7
- package/dist/components/Icons/Plaster/index.js +5 -7
- package/dist/components/Icons/Plus/index.js +5 -7
- package/dist/components/Icons/PlusCircle/index.js +5 -7
- package/dist/components/Icons/PoP/index.js +7 -9
- package/dist/components/Icons/Power/index.js +5 -7
- package/dist/components/Icons/Pram/index.js +5 -7
- package/dist/components/Icons/PrintIcon/index.js +14 -16
- package/dist/components/Icons/Printer/index.js +5 -7
- package/dist/components/Icons/Pulse/index.js +5 -7
- package/dist/components/Icons/Puzzle/index.js +5 -7
- package/dist/components/Icons/Question/index.js +5 -7
- package/dist/components/Icons/Radar/index.js +5 -7
- package/dist/components/Icons/Records/index.js +5 -7
- package/dist/components/Icons/RedunancyNavigator/index.js +5 -7
- package/dist/components/Icons/Refresh/index.js +5 -7
- package/dist/components/Icons/Requests/index.js +5 -7
- package/dist/components/Icons/Ribbon/index.js +5 -7
- package/dist/components/Icons/RightArrow/index.js +5 -7
- package/dist/components/Icons/Road/index.js +9 -11
- package/dist/components/Icons/Rosette/index.js +5 -7
- package/dist/components/Icons/Rotas/index.js +5 -7
- package/dist/components/Icons/RotateImage/index.js +5 -7
- package/dist/components/Icons/Rush/index.js +5 -7
- package/dist/components/Icons/Search/index.js +5 -7
- package/dist/components/Icons/SelectArrow/index.js +5 -7
- package/dist/components/Icons/Send/index.js +5 -7
- package/dist/components/Icons/SettingsSliders/index.js +5 -7
- package/dist/components/Icons/Share/index.js +5 -7
- package/dist/components/Icons/Shield/index.js +5 -7
- package/dist/components/Icons/Shifts/index.js +5 -7
- package/dist/components/Icons/Shredder/index.js +5 -7
- package/dist/components/Icons/Signature/index.js +5 -7
- package/dist/components/Icons/Skull/index.js +5 -7
- package/dist/components/Icons/SocialFacebook/index.js +5 -7
- package/dist/components/Icons/SocialInstagram/index.js +5 -7
- package/dist/components/Icons/SocialLinkedin/index.js +5 -7
- package/dist/components/Icons/SocialTwitter/index.js +5 -7
- package/dist/components/Icons/SocialYoutube/index.js +5 -7
- package/dist/components/Icons/SortAscending/index.js +5 -7
- package/dist/components/Icons/SortDescending/index.js +5 -7
- package/dist/components/Icons/Stamp/index.js +5 -7
- package/dist/components/Icons/Star/index.js +5 -7
- package/dist/components/Icons/Steam/index.js +5 -7
- package/dist/components/Icons/Stethoscope/index.js +5 -7
- package/dist/components/Icons/Stop/index.js +5 -7
- package/dist/components/Icons/Suitcase/index.js +5 -7
- package/dist/components/Icons/Sun/index.js +5 -7
- package/dist/components/Icons/Switch/index.js +5 -7
- package/dist/components/Icons/TableGrid/index.js +5 -7
- package/dist/components/Icons/Tachograph/index.js +5 -7
- package/dist/components/Icons/Tag/index.js +5 -7
- package/dist/components/Icons/Target/index.js +5 -7
- package/dist/components/Icons/Tasklist/index.js +40 -42
- package/dist/components/Icons/ThumbsDown/index.js +5 -7
- package/dist/components/Icons/ThumbsUp/index.js +5 -7
- package/dist/components/Icons/Tick/index.js +5 -7
- package/dist/components/Icons/TickCircle/index.js +5 -7
- package/dist/components/Icons/TickThick/index.js +29 -0
- package/dist/components/Icons/ToilEarned/index.js +9 -11
- package/dist/components/Icons/ToilTaken/index.js +13 -15
- package/dist/components/Icons/Tooth/index.js +5 -7
- package/dist/components/Icons/TrainingEvents/index.js +5 -7
- package/dist/components/Icons/Trash/index.js +5 -7
- package/dist/components/Icons/Umbrella/index.js +5 -7
- package/dist/components/Icons/Unpaid/index.js +5 -7
- package/dist/components/Icons/UpArrow/index.js +5 -7
- package/dist/components/Icons/Upload/index.js +5 -7
- package/dist/components/Icons/User/index.js +5 -7
- package/dist/components/Icons/UserAdd/index.js +5 -7
- package/dist/components/Icons/UserId/index.js +5 -7
- package/dist/components/Icons/UserRemove/index.js +5 -7
- package/dist/components/Icons/Users/index.js +5 -7
- package/dist/components/Icons/Virus/index.js +5 -7
- package/dist/components/Icons/Visibility/index.js +14 -16
- package/dist/components/Icons/Wallet/index.js +5 -7
- package/dist/components/Icons/Watch/index.js +5 -7
- package/dist/components/Icons/Week/index.js +10 -12
- package/dist/components/Icons/Xing/index.js +5 -7
- package/dist/components/Icons/index.js +35 -46
- package/dist/components/InlineLoader/index.js +46 -61
- package/dist/components/Input/index.js +49 -34
- package/dist/components/InputBox/AdornedBox/Adornment/index.js +37 -53
- package/dist/components/InputBox/AdornedBox/index.js +60 -53
- package/dist/components/InputBox/InputError/index.js +5 -15
- package/dist/components/InputBox/InputFactory/index.js +17 -15
- package/dist/components/InputBox/UnadornedBox/index.js +34 -25
- package/dist/components/InputBox/index.js +4 -6
- package/dist/components/InputWithIcon/index.js +30 -30
- package/dist/components/InputWithUnit/index.js +63 -73
- package/dist/components/Label/index.js +9 -14
- package/dist/components/Legend/index.js +5 -14
- package/dist/components/LinkButton/index.js +29 -20
- package/dist/components/Lists/DL/DD/index.js +3 -14
- package/dist/components/Lists/DL/DT/index.js +4 -14
- package/dist/components/Lists/DL/index.js +3 -14
- package/dist/components/Lists/LI/index.js +3 -14
- package/dist/components/Lists/OL/index.js +3 -14
- package/dist/components/Lists/UL/index.js +3 -14
- package/dist/components/LoadingContainer/index.js +24 -25
- package/dist/components/Modal/ModalBody/index.js +3 -16
- package/dist/components/Modal/ModalHeader/index.js +23 -31
- package/dist/components/Modal/index.js +71 -96
- package/dist/components/NumberInput/componentMap/index.js +4 -2
- package/dist/components/NumberInput/decimalFilter/index.js +1 -1
- package/dist/components/NumberInput/index.js +51 -55
- package/dist/components/NumberInput/inputMode/index.js +1 -1
- package/dist/components/NumberInput/integerFilter/index.js +1 -1
- package/dist/components/Options/index.js +59 -66
- package/dist/components/PageLoader/index.js +75 -91
- package/dist/components/Pill/index.js +22 -35
- package/dist/components/ProgressBar/index.js +39 -58
- package/dist/components/ProgressSteps/index.js +100 -49
- package/dist/components/ProvincePicker/index.js +21 -23
- package/dist/components/Radio/index.js +54 -59
- package/dist/components/RadioBlock/index.js +59 -80
- package/dist/components/ResponsiveTabs/index.js +93 -110
- package/dist/components/SearchInput/index.js +64 -52
- package/dist/components/Select/Optgroup/index.js +7 -3
- package/dist/components/Select/Option/index.js +8 -4
- package/dist/components/Select/index.js +42 -28
- package/dist/components/SelectedFile/index.js +62 -85
- package/dist/components/Snackbar/index.js +108 -157
- package/dist/components/StatusBadge/index.js +15 -19
- package/dist/components/Styleguide/ConstantsList/index.js +40 -88
- package/dist/components/Switch/index.js +55 -82
- package/dist/components/Table/Cell/index.js +18 -21
- package/dist/components/Table/HeaderCell/index.js +4 -13
- package/dist/components/Table/Row/index.js +6 -13
- package/dist/components/Table/TableBody/index.js +7 -3
- package/dist/components/Table/TableFooter/index.js +7 -3
- package/dist/components/Table/TableHeader/index.js +7 -3
- package/dist/components/Table/index.js +3 -14
- package/dist/components/Tabs/Tab/index.js +23 -13
- package/dist/components/Tabs/TabList/index.js +8 -13
- package/dist/components/Tabs/TabPanel/index.js +6 -12
- package/dist/components/Tabs/index.js +4 -13
- package/dist/components/Textarea/index.js +50 -27
- package/dist/components/Time/DurationPicker/DurationOverlay/index.js +40 -42
- package/dist/components/Time/DurationPicker/index.js +46 -62
- package/dist/components/Time/OverlayBase/UnitInput/index.js +68 -103
- package/dist/components/Time/OverlayBase/index.js +77 -85
- package/dist/components/Time/TimePicker/TimeOverlay/UnitInput/index.js +62 -91
- package/dist/components/Time/TimePicker/TimeOverlay/index.js +87 -133
- package/dist/components/Time/TimePicker/index.js +76 -95
- package/dist/components/TimeInput/index.js +1 -1
- package/dist/components/TimePicker/DayPart/DayPartOverlay/index.js +98 -189
- package/dist/components/TimePicker/DayPart/index.js +59 -105
- package/dist/components/TimePicker/Elements/Actions/index.js +6 -14
- package/dist/components/TimePicker/Elements/CancelLink/index.js +7 -13
- package/dist/components/TimePicker/Elements/DownIcon/index.js +10 -19
- package/dist/components/TimePicker/Elements/IncrementNotice/index.js +6 -14
- package/dist/components/TimePicker/Elements/PickerSeparator/index.js +5 -14
- package/dist/components/TimePicker/Elements/Title/index.js +8 -14
- package/dist/components/TimePicker/Elements/TitleUnderline/index.js +9 -14
- package/dist/components/TimePicker/Elements/UpIcon/index.js +10 -19
- package/dist/components/TimePicker/Time/TimeInput/index.js +58 -77
- package/dist/components/TimePicker/Time/TimeOverlay/index.js +185 -210
- package/dist/components/TimePicker/Time/index.js +76 -105
- package/dist/components/TimePicker/utils/PickerGA/index.js +9 -7
- package/dist/components/TimePicker/utils/constants/loopStatus.js +1 -1
- package/dist/components/TimePicker/utils/limitAround/index.js +1 -1
- package/dist/components/TimePicker/utils/loopAround/index.js +3 -3
- package/dist/components/TimePicker/utils/loopAroundMinutes/index.js +3 -3
- package/dist/components/TimePicker/utils/roundToMultiple/index.js +1 -3
- package/dist/components/Tooltip/index.js +74 -80
- package/dist/components/Typeahead/MobileHeader/index.js +29 -24
- package/dist/components/Typeahead/Option/OptionImage/index.js +12 -35
- package/dist/components/Typeahead/Option/index.js +59 -103
- package/dist/components/Typeahead/Options/index.js +15 -18
- package/dist/components/Typeahead/index.js +191 -185
- package/dist/components/Typeahead/mocks/employees.js +1 -1
- package/dist/components/Typeahead/utils/getSelected/index.js +2 -4
- package/dist/components/Typography/H1/index.js +7 -14
- package/dist/components/Typography/H2/index.js +7 -14
- package/dist/components/Typography/H3/index.js +7 -14
- package/dist/components/Typography/H4/index.js +7 -14
- package/dist/components/Typography/H5/index.js +7 -14
- package/dist/components/Typography/H6/index.js +7 -14
- package/dist/components/Typography/P/index.js +4 -16
- package/dist/components/Typography/Small/index.js +3 -16
- package/dist/components/Validation/index.js +18 -20
- package/dist/components/WithDayPicker/index.js +40 -65
- package/dist/components/WithValidation/index.js +44 -61
- package/dist/components/XingLoader/index.js +56 -112
- package/dist/components/withConfirmation/index.js +69 -68
- package/dist/components/withModal/index.js +14 -28
- package/dist/constants/breakpoints/index.js +1 -1
- package/dist/constants/colors/index.js +47 -47
- package/dist/constants/documents/index.js +3 -3
- package/dist/constants/spacing/index.js +1 -1
- package/dist/constants/vars/index.js +8 -8
- package/dist/constants/z-index/index.js +1 -1
- package/dist/hooks/useClickOutside/index.js +5 -5
- package/dist/setupTests.js +8 -8
- package/dist/test-utils/renderCheck/index.js +15 -17
- package/dist/test-utils/waitForAsync/index.js +1 -5
- package/dist/utils/numbers/getBoundedValue/index.js +1 -1
- package/dist/utils/pad/index.js +2 -2
- package/dist/utils/range/index.js +3 -5
- package/dist/utils/roundTo/index.js +5 -5
- package/dist/utils/setBreakPoint/index.js +1 -3
- package/dist/utils/stripUnit/index.js +2 -2
- package/dist/utils/time/Duration/index.js +33 -41
- package/dist/utils/time/durationToMilliseconds/index.js +11 -21
- package/dist/utils/time/durationToTimeString/index.js +3 -5
- package/dist/utils/time/millisecondsToDuration/index.js +6 -6
- package/dist/utils/trackForm/index.js +34 -37
- package/package.json +5 -5
- package/src/components/Icons/CrossThick/examples.md +5 -0
- package/src/components/Icons/CrossThick/index.js +19 -0
- package/src/components/Icons/TickThick/examples.md +5 -0
- package/src/components/Icons/TickThick/index.js +19 -0
- package/src/components/Typeahead/Option/index.js +0 -1
- package/src/components/WithDayPicker/index.js +3 -3
@@ -21,144 +21,128 @@ var _Validation = _interopRequireDefault(require("../Validation"));
|
|
21
21
|
|
22
22
|
var _trackForm = _interopRequireDefault(require("../../utils/trackForm"));
|
23
23
|
|
24
|
-
var
|
24
|
+
var _runFormValidation = _interopRequireDefault(require("./utils/runFormValidation"));
|
25
25
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27
27
|
|
28
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
29
29
|
|
30
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {};
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
31
31
|
|
32
32
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
33
33
|
|
34
|
-
function
|
35
|
-
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
34
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
37
35
|
|
38
|
-
function
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
39
37
|
|
40
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
41
39
|
|
42
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
43
41
|
|
44
42
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
45
43
|
|
46
|
-
|
47
|
-
|
44
|
+
const setData = (original, key, value) => {
|
45
|
+
const obj = (0, _lodash3.default)(original);
|
48
46
|
(0, _lodash.default)(obj, key, value);
|
49
47
|
return obj;
|
50
48
|
};
|
51
49
|
|
52
|
-
|
53
|
-
|
54
|
-
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
function Form(props) {
|
70
|
-
var _this;
|
71
|
-
|
72
|
-
_this = _Component.call(this, props) || this;
|
73
|
-
(0, _reactAutobind.default)(_assertThisInitialized(_this));
|
74
|
-
var initialData = _this.props.initialData || _this.props.formData;
|
75
|
-
|
76
|
-
var _runFormValidation = (0, _runFormValidation3.default)(initialData, _this.props.fieldValidation),
|
77
|
-
fieldValidationResult = _runFormValidation.fieldValidationResult;
|
78
|
-
|
79
|
-
var analyticsTracking = (0, _trackForm.default)(props.name);
|
80
|
-
var currentValue;
|
81
|
-
_this.state = {
|
50
|
+
const mergeData = (original, newItems) => _objectSpread({}, (0, _lodash3.default)(original), {}, newItems);
|
51
|
+
|
52
|
+
const getTouchedObject = fieldValidation => Object.keys(fieldValidation).reduce((current, name) => _objectSpread({}, current, {
|
53
|
+
[name]: true
|
54
|
+
}), {});
|
55
|
+
|
56
|
+
class Form extends _react.Component {
|
57
|
+
constructor(props) {
|
58
|
+
super(props);
|
59
|
+
(0, _reactAutobind.default)(this);
|
60
|
+
const initialData = this.props.initialData || this.props.formData;
|
61
|
+
const {
|
62
|
+
fieldValidationResult
|
63
|
+
} = (0, _runFormValidation.default)(initialData, this.props.fieldValidation);
|
64
|
+
const analyticsTracking = (0, _trackForm.default)(props.name);
|
65
|
+
let currentValue;
|
66
|
+
this.state = {
|
82
67
|
error: false,
|
83
68
|
formData: initialData,
|
84
69
|
validationData: fieldValidationResult,
|
85
70
|
touched: {}
|
86
71
|
};
|
87
|
-
|
72
|
+
this.initialState = (0, _lodash3.default)(this.state);
|
88
73
|
|
89
|
-
|
74
|
+
this.gaChangeField = e => {
|
90
75
|
// special case for checkboxes because hidden so no blur event
|
91
76
|
if (e.target.type === 'checkbox') {
|
92
77
|
analyticsTracking(e);
|
93
78
|
}
|
94
79
|
};
|
95
80
|
|
96
|
-
|
81
|
+
this.gaButtonClick = e => {
|
97
82
|
if (e.target.type === 'button' || e.target.type === 'submit') {
|
98
83
|
analyticsTracking(e);
|
99
84
|
}
|
100
85
|
};
|
101
86
|
|
102
|
-
|
103
|
-
|
87
|
+
this.gaHover = e => {
|
88
|
+
const trackTooltip = e.target && e.target.getAttribute('data-track-tooltip');
|
104
89
|
|
105
90
|
if (trackTooltip) {
|
106
91
|
analyticsTracking(e);
|
107
92
|
}
|
108
93
|
};
|
109
94
|
|
110
|
-
|
95
|
+
this.gaFocusField = e => {
|
111
96
|
currentValue = e.target.value;
|
112
97
|
};
|
113
98
|
|
114
|
-
|
99
|
+
this.trackEvent = e => {
|
115
100
|
if (currentValue !== e.target.value) {
|
116
101
|
analyticsTracking(e);
|
117
102
|
}
|
118
103
|
};
|
119
104
|
|
120
|
-
|
121
|
-
return _this;
|
105
|
+
this.componentMounted = false;
|
122
106
|
}
|
123
107
|
|
124
|
-
|
125
|
-
|
126
|
-
_proto.componentDidMount = function componentDidMount() {
|
108
|
+
componentDidMount() {
|
127
109
|
this.componentMounted = true;
|
128
110
|
} // eslint-disable-next-line camelcase
|
129
|
-
;
|
130
111
|
|
131
|
-
|
112
|
+
|
113
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
132
114
|
if (!this.props.initialData && !(0, _fastDeepEqual.default)(nextProps.formData, this.initialState.formData)) {
|
133
115
|
this.initialState.formData = (0, _lodash3.default)(nextProps.formData);
|
134
116
|
this.setState({
|
135
117
|
formData: nextProps.formData
|
136
118
|
});
|
137
119
|
}
|
138
|
-
}
|
120
|
+
}
|
139
121
|
|
140
|
-
|
122
|
+
componentWillUnmount() {
|
141
123
|
this.componentMounted = false;
|
142
|
-
}
|
143
|
-
|
144
|
-
_proto.onChange = function onChange(e, cb) {
|
145
|
-
var _this2 = this;
|
124
|
+
}
|
146
125
|
|
126
|
+
onChange(e, cb) {
|
147
127
|
if (cb === void 0) {
|
148
|
-
cb =
|
128
|
+
cb = () => {};
|
149
129
|
}
|
150
130
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
this.setState(
|
159
|
-
|
160
|
-
|
161
|
-
|
131
|
+
const {
|
132
|
+
name,
|
133
|
+
value,
|
134
|
+
checked,
|
135
|
+
type
|
136
|
+
} = e.target || e;
|
137
|
+
let isValid = true;
|
138
|
+
this.setState((state, props) => {
|
139
|
+
const {
|
140
|
+
formData,
|
141
|
+
validationData
|
142
|
+
} = state;
|
143
|
+
const {
|
144
|
+
fieldValidation
|
145
|
+
} = props;
|
162
146
|
|
163
147
|
if (fieldValidation[name]) {
|
164
148
|
isValid = fieldValidation[name](value, formData);
|
@@ -169,34 +153,38 @@ function (_Component) {
|
|
169
153
|
formData: setData(formData, name, type === 'checkbox' ? checked : value),
|
170
154
|
validationData: setData(validationData, name, isValid)
|
171
155
|
};
|
172
|
-
},
|
173
|
-
if (
|
174
|
-
|
175
|
-
name
|
176
|
-
value
|
177
|
-
formData:
|
156
|
+
}, () => {
|
157
|
+
if (this.props.onChange) {
|
158
|
+
this.props.onChange({
|
159
|
+
name,
|
160
|
+
value,
|
161
|
+
formData: this.state.formData
|
178
162
|
});
|
179
163
|
}
|
180
164
|
|
181
|
-
cb(
|
165
|
+
cb(this.state.formData);
|
182
166
|
});
|
183
|
-
}
|
167
|
+
}
|
184
168
|
|
185
|
-
|
169
|
+
onBlur(e) {
|
186
170
|
if (e === undefined) {
|
187
171
|
return;
|
188
172
|
}
|
189
173
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
this.setState(
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
174
|
+
const {
|
175
|
+
name,
|
176
|
+
value
|
177
|
+
} = e.target || e;
|
178
|
+
let isValid = true;
|
179
|
+
this.setState((state, props) => {
|
180
|
+
const {
|
181
|
+
validationData,
|
182
|
+
touched,
|
183
|
+
formData
|
184
|
+
} = state;
|
185
|
+
const {
|
186
|
+
fieldValidation
|
187
|
+
} = props;
|
200
188
|
|
201
189
|
if (fieldValidation[name]) {
|
202
190
|
isValid = fieldValidation[name](value, formData);
|
@@ -207,26 +195,25 @@ function (_Component) {
|
|
207
195
|
touched: setData(touched, name, true)
|
208
196
|
};
|
209
197
|
});
|
210
|
-
}
|
211
|
-
|
212
|
-
_proto.onSubmit = function onSubmit(e) {
|
213
|
-
var _this3 = this;
|
214
|
-
|
215
|
-
var _this$props = this.props,
|
216
|
-
validate = _this$props.validate,
|
217
|
-
onSubmit = _this$props.onSubmit,
|
218
|
-
fieldValidation = _this$props.fieldValidation,
|
219
|
-
updateOnSubmit = _this$props.updateOnSubmit;
|
220
|
-
var _this$state = this.state,
|
221
|
-
validationData = _this$state.validationData,
|
222
|
-
formData = _this$state.formData;
|
223
|
-
var validationResult = validate(formData, validationData);
|
224
|
-
|
225
|
-
var _runFormValidation2 = (0, _runFormValidation3.default)(formData, fieldValidation),
|
226
|
-
fieldError = _runFormValidation2.fieldError,
|
227
|
-
fieldValidationResult = _runFormValidation2.fieldValidationResult;
|
198
|
+
}
|
228
199
|
|
229
|
-
|
200
|
+
onSubmit(e) {
|
201
|
+
const {
|
202
|
+
validate,
|
203
|
+
onSubmit,
|
204
|
+
fieldValidation,
|
205
|
+
updateOnSubmit
|
206
|
+
} = this.props;
|
207
|
+
const {
|
208
|
+
validationData,
|
209
|
+
formData
|
210
|
+
} = this.state;
|
211
|
+
const validationResult = validate(formData, validationData);
|
212
|
+
const {
|
213
|
+
fieldError,
|
214
|
+
fieldValidationResult
|
215
|
+
} = (0, _runFormValidation.default)(formData, fieldValidation);
|
216
|
+
const isValid = validationResult === true && !fieldError;
|
230
217
|
|
231
218
|
if (!isValid) {
|
232
219
|
e.preventDefault();
|
@@ -239,98 +226,108 @@ function (_Component) {
|
|
239
226
|
this.setState({
|
240
227
|
submitting: true
|
241
228
|
});
|
242
|
-
return Promise.resolve(onSubmit(e, formData)).then(
|
243
|
-
if (
|
229
|
+
return Promise.resolve(onSubmit(e, formData)).then(() => {
|
230
|
+
if (this.componentMounted) {
|
244
231
|
if (updateOnSubmit) {
|
245
|
-
|
232
|
+
this.initialState.formData = (0, _lodash3.default)(this.state.formData);
|
246
233
|
}
|
247
234
|
|
248
|
-
|
235
|
+
this.setState({
|
249
236
|
submitting: false
|
250
237
|
});
|
251
238
|
}
|
252
|
-
}).catch(
|
253
|
-
if (
|
254
|
-
|
239
|
+
}).catch(err => {
|
240
|
+
if (this.componentMounted) {
|
241
|
+
this.setState({
|
255
242
|
error: err.message || 'Oops, something went wrong. Please try again.',
|
256
243
|
submitting: false
|
257
244
|
});
|
258
245
|
}
|
259
246
|
});
|
260
247
|
}
|
261
|
-
}
|
248
|
+
}
|
262
249
|
|
263
|
-
|
250
|
+
onReset() {
|
264
251
|
if (this.props.onReset) {
|
265
252
|
this.props.onReset(this.initialState);
|
266
253
|
}
|
267
254
|
|
268
255
|
this.setState((0, _lodash3.default)(this.initialState));
|
269
|
-
}
|
256
|
+
}
|
270
257
|
|
271
|
-
|
272
|
-
|
258
|
+
getError(name) {
|
259
|
+
const {
|
260
|
+
validationData
|
261
|
+
} = this.state;
|
273
262
|
return (0, _lodash2.default)(validationData, name, '');
|
274
|
-
}
|
263
|
+
}
|
275
264
|
|
276
|
-
|
277
|
-
|
265
|
+
getValue(name) {
|
266
|
+
const {
|
267
|
+
formData
|
268
|
+
} = this.state;
|
278
269
|
return (0, _lodash2.default)(formData, name, '');
|
279
|
-
}
|
280
|
-
|
281
|
-
_proto.setValue = function setValue(name, value, cb) {
|
282
|
-
var _this4 = this;
|
270
|
+
}
|
283
271
|
|
272
|
+
setValue(name, value, cb) {
|
284
273
|
if (cb === void 0) {
|
285
|
-
cb =
|
274
|
+
cb = () => {};
|
286
275
|
}
|
287
276
|
|
288
|
-
this.setState(
|
289
|
-
|
277
|
+
this.setState(state => {
|
278
|
+
const {
|
279
|
+
formData
|
280
|
+
} = state;
|
290
281
|
return {
|
291
282
|
formData: setData(formData, name, value)
|
292
283
|
};
|
293
|
-
},
|
294
|
-
cb(
|
284
|
+
}, () => {
|
285
|
+
cb(this.state.formData);
|
295
286
|
});
|
296
|
-
}
|
297
|
-
|
298
|
-
_proto.setValues = function setValues(data, cb) {
|
299
|
-
var _this5 = this;
|
287
|
+
}
|
300
288
|
|
289
|
+
setValues(data, cb) {
|
301
290
|
if (cb === void 0) {
|
302
|
-
cb =
|
291
|
+
cb = () => {};
|
303
292
|
}
|
304
293
|
|
305
|
-
this.setState(
|
306
|
-
|
294
|
+
this.setState(state => {
|
295
|
+
const {
|
296
|
+
formData
|
297
|
+
} = state;
|
307
298
|
return {
|
308
299
|
formData: mergeData(formData, data)
|
309
300
|
};
|
310
|
-
},
|
311
|
-
cb(
|
301
|
+
}, () => {
|
302
|
+
cb(this.state.formData);
|
312
303
|
});
|
313
|
-
}
|
304
|
+
}
|
314
305
|
|
315
|
-
|
316
|
-
|
306
|
+
isTouched(name) {
|
307
|
+
const {
|
308
|
+
touched
|
309
|
+
} = this.state;
|
317
310
|
return (0, _lodash2.default)(touched, name, false);
|
318
|
-
}
|
311
|
+
}
|
319
312
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
313
|
+
hasError(name) {
|
314
|
+
const {
|
315
|
+
touched,
|
316
|
+
validationData
|
317
|
+
} = this.state;
|
324
318
|
return (0, _lodash2.default)(validationData, name, false) !== true && (0, _lodash2.default)(touched, name, false);
|
325
|
-
}
|
319
|
+
}
|
326
320
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
321
|
+
runFieldValidation(name, value) {
|
322
|
+
const {
|
323
|
+
fieldValidation
|
324
|
+
} = this.props;
|
325
|
+
const {
|
326
|
+
validationData,
|
327
|
+
touched,
|
328
|
+
formData
|
329
|
+
} = this.state;
|
330
|
+
let isValid = true;
|
334
331
|
|
335
332
|
if (fieldValidation[name]) {
|
336
333
|
isValid = fieldValidation[name](value, formData);
|
@@ -340,36 +337,41 @@ function (_Component) {
|
|
340
337
|
validationData: setData(validationData, name, isValid),
|
341
338
|
touched: setData(touched, name, true)
|
342
339
|
});
|
343
|
-
}
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
340
|
+
}
|
341
|
+
|
342
|
+
render() {
|
343
|
+
const _this$props = this.props,
|
344
|
+
{
|
345
|
+
children,
|
346
|
+
validate,
|
347
|
+
onSubmit,
|
348
|
+
onReset,
|
349
|
+
initialData,
|
350
|
+
formData: x,
|
351
|
+
// Omit
|
352
|
+
fieldValidation: y,
|
353
|
+
// Samesies
|
354
|
+
updateOnSubmit: z
|
355
|
+
} = _this$props,
|
356
|
+
props = _objectWithoutProperties(_this$props, ["children", "validate", "onSubmit", "onReset", "initialData", "formData", "fieldValidation", "updateOnSubmit"]);
|
357
|
+
|
358
|
+
const {
|
359
|
+
validationData,
|
360
|
+
formData,
|
361
|
+
error,
|
362
|
+
submitting
|
363
|
+
} = this.state;
|
364
|
+
const isPristine = (0, _fastDeepEqual.default)(this.initialState.formData, formData);
|
365
|
+
const isValid = validate(formData, validationData) === true;
|
366
|
+
const formApi = {
|
365
367
|
runFieldValidation: this.runFieldValidation,
|
366
368
|
onChange: this.onChange,
|
367
369
|
onBlur: this.onBlur,
|
368
370
|
resetForm: this.onReset,
|
369
|
-
formData
|
370
|
-
validationData
|
371
|
-
isPristine
|
372
|
-
isValid
|
371
|
+
formData,
|
372
|
+
validationData,
|
373
|
+
isPristine,
|
374
|
+
isValid,
|
373
375
|
setValue: this.setValue,
|
374
376
|
setValues: this.setValues,
|
375
377
|
getValue: this.getValue,
|
@@ -378,12 +380,10 @@ function (_Component) {
|
|
378
380
|
isTouched: this.isTouched,
|
379
381
|
canSubmit: !isPristine && isValid,
|
380
382
|
isSubmitting: submitting,
|
381
|
-
ServerValidation:
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
}, error || '');
|
386
|
-
}
|
383
|
+
ServerValidation: () => _react.default.createElement(_Validation.default, {
|
384
|
+
center: true,
|
385
|
+
visible: Boolean(error)
|
386
|
+
}, error || '')
|
387
387
|
};
|
388
388
|
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions
|
389
389
|
_react.default.createElement("form", _extends({}, props, {
|
@@ -396,10 +396,9 @@ function (_Component) {
|
|
396
396
|
onMouseOver: this.gaHover
|
397
397
|
}), children(formApi))
|
398
398
|
);
|
399
|
-
}
|
399
|
+
}
|
400
400
|
|
401
|
-
|
402
|
-
}(_react.Component);
|
401
|
+
}
|
403
402
|
|
404
403
|
Form.displayName = 'Form';
|
405
404
|
Form.propTypes = {
|
@@ -421,9 +420,7 @@ Form.defaultProps = {
|
|
421
420
|
onChange: undefined,
|
422
421
|
updateOnSubmit: false,
|
423
422
|
onReset: undefined,
|
424
|
-
validate:
|
425
|
-
return true;
|
426
|
-
},
|
423
|
+
validate: () => true,
|
427
424
|
formData: {},
|
428
425
|
fieldValidation: {},
|
429
426
|
name: 'Form',
|
@@ -7,28 +7,28 @@ var _lodash = _interopRequireDefault(require("lodash.get"));
|
|
7
7
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
9
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
11
11
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
13
13
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
var result = fieldValidation[fieldName]((0, _lodash.default)(formData, fieldName, ''), formData);
|
16
|
+
const runFormValidation = (formData, fieldValidation) => {
|
17
|
+
let fieldError = false;
|
18
|
+
const fieldValidationResult = Object.keys(fieldValidation).reduce((errors, fieldName) => {
|
19
|
+
const result = fieldValidation[fieldName]((0, _lodash.default)(formData, fieldName, ''), formData);
|
22
20
|
|
23
21
|
if (result !== true) {
|
24
22
|
fieldError = true;
|
25
23
|
}
|
26
24
|
|
27
|
-
return _objectSpread({}, errors,
|
25
|
+
return _objectSpread({}, errors, {
|
26
|
+
[fieldName]: result
|
27
|
+
});
|
28
28
|
}, {});
|
29
29
|
return {
|
30
|
-
fieldError
|
31
|
-
fieldValidationResult
|
30
|
+
fieldError,
|
31
|
+
fieldValidationResult
|
32
32
|
};
|
33
33
|
};
|
34
34
|
|
@@ -9,22 +9,10 @@ var _propTypes = require("prop-types");
|
|
9
9
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
return data;
|
17
|
-
};
|
18
|
-
|
19
|
-
return data;
|
20
|
-
}
|
21
|
-
|
22
|
-
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
23
|
-
|
24
|
-
var FormContent = _styledComponents.default.div(_templateObject(), function (props) {
|
25
|
-
return props.fullWidth ? 'flex-grow: 1' : 'max-width: 20rem; width: 100%;';
|
26
|
-
});
|
27
|
-
|
12
|
+
const FormContent = _styledComponents.default.div`
|
13
|
+
min-width: 15rem;
|
14
|
+
${props => props.fullWidth ? 'flex-grow: 1' : 'max-width: 20rem; width: 100%;'};
|
15
|
+
`;
|
28
16
|
FormContent.displayName = 'FormContent';
|
29
17
|
FormContent.defaultProps = {
|
30
18
|
fullWidth: false
|