guestbell-forms 3.0.39 → 3.0.41
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/.env.bat +1 -0
- package/.eslintrc.json +21 -14
- package/build/components/base/input/BaseInput.d.ts +99 -99
- package/build/components/base/input/BaseInput.js +4 -0
- package/build/components/base/input/BaseInput.js.map +1 -1
- package/build/components/base/input/index.d.ts +1 -1
- package/build/components/bookingCalendar/BookingCalendar.d.ts +47 -46
- package/build/components/bookingCalendar/BookingCalendar.js +38 -14
- package/build/components/bookingCalendar/BookingCalendar.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.d.ts +17 -17
- package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js +12 -12
- package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarControls/classes.d.ts +9 -9
- package/build/components/bookingCalendar/bookingCalendarControls/index.d.ts +2 -2
- package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.d.ts +13 -13
- package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js +3 -3
- package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarDatePicker/classes.d.ts +5 -5
- package/build/components/bookingCalendar/bookingCalendarDatePicker/index.d.ts +2 -2
- package/build/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.d.ts +10 -10
- package/build/components/bookingCalendar/bookingCalendarGrid/classes.d.ts +5 -5
- package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.d.ts +57 -57
- package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.js +2 -1
- package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarItem/classes.d.ts +4 -4
- package/build/components/bookingCalendar/bookingCalendarItem/index.d.ts +2 -2
- package/build/components/bookingCalendar/bookingCalendarLane/BookingCalendarLane.d.ts +16 -16
- package/build/components/bookingCalendar/bookingCalendarLane/classes.d.ts +4 -4
- package/build/components/bookingCalendar/bookingCalendarLane/index.d.ts +2 -2
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/BookingCalendarLaneHeader.d.ts +7 -7
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/classes.d.ts +4 -4
- package/build/components/bookingCalendar/bookingCalendarLaneHeader/index.d.ts +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.d.ts +11 -11
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.js +3 -3
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.d.ts +4 -5
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/classes.d.ts +5 -5
- package/build/components/bookingCalendar/bookingCalendarLanesHeader/index.d.ts +2 -2
- package/build/components/bookingCalendar/bookingCalendarRenderItem/BookingCalendarRenderItem.d.ts +9 -9
- package/build/components/bookingCalendar/bookingCalendarRenderItem/classes.d.ts +6 -6
- package/build/components/bookingCalendar/bookingCalendarRenderItem/index.d.ts +1 -1
- package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.d.ts +38 -37
- package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js +7 -4
- package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js.map +1 -1
- package/build/components/bookingCalendar/bookingCalendarSelection/classes.d.ts +5 -0
- package/build/components/bookingCalendar/bookingCalendarSelection/classes.js +12 -0
- package/build/components/bookingCalendar/bookingCalendarSelection/classes.js.map +1 -0
- package/build/components/bookingCalendar/bookingCalendarTimeAxis/BookingCalendarTimeAxis.d.ts +11 -11
- package/build/components/bookingCalendar/bookingCalendarTimeAxis/classes.d.ts +5 -5
- package/build/components/bookingCalendar/classes.d.ts +11 -11
- package/build/components/bookingCalendar/common.d.ts +24 -23
- package/build/components/bookingCalendar/common.js +3 -4
- package/build/components/bookingCalendar/common.js.map +1 -1
- package/build/components/bookingCalendar/index.d.ts +3 -3
- package/build/components/bookingCalendar/utils.d.ts +55 -50
- package/build/components/bookingCalendar/utils.js +2 -1
- package/build/components/bookingCalendar/utils.js.map +1 -1
- package/build/components/button/Button.d.ts +81 -81
- package/build/components/button/Button.js +1 -0
- package/build/components/button/Button.js.map +1 -1
- package/build/components/button/index.d.ts +2 -2
- package/build/components/checkbox/Checkbox.d.ts +23 -23
- package/build/components/checkbox/index.d.ts +2 -2
- package/build/components/dropdown/Dropdown.d.ts +44 -44
- package/build/components/dropdown/index.d.ts +2 -2
- package/build/components/dynamicSubmit/DynamicSubmit.d.ts +54 -54
- package/build/components/dynamicSubmit/DynamicSubmit.js.map +1 -1
- package/build/components/dynamicSubmit/index.d.ts +2 -2
- package/build/components/externalValidationComponent/ExternalValidationComponent.d.ts +15 -15
- package/build/components/externalValidationComponent/index.d.ts +2 -2
- package/build/components/form/Form.d.ts +47 -47
- package/build/components/form/FormContext.d.ts +30 -30
- package/build/components/form/FormValidationSummary.d.ts +38 -38
- package/build/components/form/FormValidationSummary.js.map +1 -1
- package/build/components/form/index.d.ts +5 -5
- package/build/components/form/withFormContext.d.ts +3 -3
- package/build/components/inputGroup/InputGroup.d.ts +15 -17
- package/build/components/inputGroup/index.d.ts +2 -2
- package/build/components/inputHeader/InputHeader.d.ts +97 -97
- package/build/components/inputHeader/InputHeader.js.map +1 -1
- package/build/components/inputHeader/InputHeaderContext.d.ts +24 -24
- package/build/components/inputHeader/index.d.ts +2 -2
- package/build/components/inputHeader/withInputHeaderContext.d.ts +3 -3
- package/build/components/money/Money.d.ts +78 -78
- package/build/components/money/Money.js.map +1 -1
- package/build/components/money/index.d.ts +2 -2
- package/build/components/numberInput/NumberInput.d.ts +28 -28
- package/build/components/numberInput/index.d.ts +2 -2
- package/build/components/openingHours/openingHoursDay/OpeningHoursDay.d.ts +84 -84
- package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js +3 -3
- package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js.map +1 -1
- package/build/components/openingHours/openingHoursDay/index.d.ts +2 -2
- package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.d.ts +92 -90
- package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.js.map +1 -1
- package/build/components/openingHours/openingHoursSpecial/index.d.ts +2 -2
- package/build/components/openingHours/openingHoursWeek/OpeningHoursWeek.d.ts +109 -109
- package/build/components/openingHours/openingHoursWeek/index.d.ts +2 -2
- package/build/components/openingHours/utils/OpeningHoursUtil.d.ts +21 -21
- package/build/components/radio/Radio.d.ts +20 -20
- package/build/components/radio/index.d.ts +2 -2
- package/build/components/radioContainer/RadioContainer.d.ts +17 -16
- package/build/components/radioContainer/RadioContainer.js.map +1 -1
- package/build/components/radioContainer/index.d.ts +2 -2
- package/build/components/select/Select.d.ts +79 -79
- package/build/components/select/index.d.ts +2 -2
- package/build/components/submit/Submit.d.ts +137 -137
- package/build/components/submit/index.d.ts +2 -2
- package/build/components/submit/subComponents/SubmitValidationSummary.d.ts +5 -5
- package/build/components/tags/Tags.d.ts +92 -92
- package/build/components/tags/Tags.js +2 -0
- package/build/components/tags/Tags.js.map +1 -1
- package/build/components/tags/index.d.ts +2 -2
- package/build/components/tags/subComponents/TagsSuggestions.d.ts +34 -34
- package/build/components/tags/subComponents/TagsSuggestions.js +2 -2
- package/build/components/tags/subComponents/TagsSuggestions.js.map +1 -1
- package/build/components/text/Text.d.ts +31 -31
- package/build/components/text/index.d.ts +2 -2
- package/build/components/textArea/TextArea.d.ts +28 -28
- package/build/components/textArea/TextArea.js +1 -0
- package/build/components/textArea/TextArea.js.map +1 -1
- package/build/components/textArea/index.d.ts +2 -2
- package/build/components/themeProvider/ThemeContext.d.ts +9 -9
- package/build/components/themeProvider/ThemeProvider.d.ts +8 -7
- package/build/components/themeProvider/ThemeProvider.js.map +1 -1
- package/build/components/themeProvider/index.d.ts +4 -4
- package/build/components/themeProvider/withThemeContext.d.ts +4 -4
- package/build/components/time/Time.d.ts +32 -32
- package/build/components/time/Time.js +3 -3
- package/build/components/time/Time.js.map +1 -1
- package/build/components/time/index.d.ts +2 -2
- package/build/components/timeSpan/TimeSpan.d.ts +46 -46
- package/build/components/timeSpan/TimeSpan.js +6 -6
- package/build/components/timeSpan/TimeSpan.js.map +1 -1
- package/build/components/timeSpan/index.d.ts +2 -2
- package/build/components/utils/Guid.d.ts +2 -2
- package/build/components/utils/ShallowEqual.d.ts +16 -16
- package/build/components/utils/TimeUtil.d.ts +6 -6
- package/build/components/utils/Typescript.d.ts +5 -5
- package/build/dist/guestbell-forms.css +154 -170
- package/build/dist/guestbell-forms.css.map +1 -1
- package/build/dist/guestbell-forms.js +15 -24
- package/build/dist/guestbell-forms.js.map +1 -1
- package/build/dist/guestbell-forms.min.css +1 -1
- package/build/dist/guestbell-forms.min.js +1 -1
- package/build/dist/guestbell-forms.min.js.map +1 -1
- package/build/dist/report.html +3 -3
- package/build/index.d.ts +24 -24
- package/build/scss/components/bookingCalendar/bookingCalendar.scss +32 -7
- package/build/types/ElementOverrideProp.d.ts +3 -3
- package/build/types/Theme.d.ts +4 -4
- package/build/types/ThemeOverrides.d.ts +45 -45
- package/build/validators/EmailValidator.d.ts +4 -4
- package/build/validators/LatitudeValidator.d.ts +4 -4
- package/build/validators/LongitudeValidator.d.ts +4 -4
- package/build/validators/NumberValidator.d.ts +12 -12
- package/build/validators/NumberValidator.js +1 -0
- package/build/validators/NumberValidator.js.map +1 -1
- package/build/validators/UrlValidator.d.ts +4 -4
- package/build/validators/base.d.ts +4 -4
- package/build/validators/index.d.ts +6 -6
- package/package.json +130 -136
- package/src/lib/components/base/input/BaseInput.tsx +526 -0
- package/src/lib/components/base/input/index.tsx +1 -0
- package/src/lib/components/bookingCalendar/BookingCalendar.tsx +399 -0
- package/src/lib/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.tsx +249 -0
- package/src/lib/components/bookingCalendar/bookingCalendarControls/classes.ts +20 -0
- package/src/lib/components/bookingCalendar/bookingCalendarControls/index.ts +2 -0
- package/src/lib/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.tsx +104 -0
- package/src/lib/components/bookingCalendar/bookingCalendarDatePicker/classes.ts +9 -0
- package/src/lib/components/bookingCalendar/bookingCalendarDatePicker/index.ts +2 -0
- package/src/lib/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.tsx +56 -0
- package/src/lib/components/bookingCalendar/bookingCalendarGrid/classes.ts +9 -0
- package/src/lib/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.tsx +98 -0
- package/src/lib/components/bookingCalendar/bookingCalendarItem/classes.ts +7 -0
- package/src/lib/components/bookingCalendar/bookingCalendarItem/index.ts +2 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLane/BookingCalendarLane.tsx +69 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLane/classes.ts +7 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLane/index.ts +2 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLaneHeader/BookingCalendarLaneHeader.tsx +28 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLaneHeader/classes.ts +7 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLaneHeader/index.ts +1 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.tsx +57 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.tsx +53 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLanesHeader/classes.ts +9 -0
- package/src/lib/components/bookingCalendar/bookingCalendarLanesHeader/index.ts +2 -0
- package/src/lib/components/bookingCalendar/bookingCalendarRenderItem/BookingCalendarRenderItem.tsx +57 -0
- package/src/lib/components/bookingCalendar/bookingCalendarRenderItem/classes.ts +11 -0
- package/src/lib/components/bookingCalendar/bookingCalendarRenderItem/index.ts +1 -0
- package/src/lib/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.tsx +225 -0
- package/src/lib/components/bookingCalendar/bookingCalendarSelection/classes.ts +10 -0
- package/src/lib/components/bookingCalendar/bookingCalendarTimeAxis/BookingCalendarTimeAxis.tsx +53 -0
- package/src/lib/components/bookingCalendar/bookingCalendarTimeAxis/classes.ts +9 -0
- package/src/lib/components/bookingCalendar/classes.ts +21 -0
- package/src/lib/components/bookingCalendar/common.ts +62 -0
- package/src/lib/components/bookingCalendar/index.ts +3 -0
- package/src/lib/components/bookingCalendar/utils.ts +350 -0
- package/src/lib/components/button/Button.tsx +193 -0
- package/src/lib/components/button/index.tsx +2 -0
- package/src/lib/components/checkbox/Checkbox.tsx +178 -0
- package/src/lib/components/checkbox/index.tsx +2 -0
- package/src/lib/components/dropdown/Dropdown.tsx +135 -0
- package/src/lib/components/dropdown/index.tsx +2 -0
- package/src/lib/components/dynamicSubmit/DynamicSubmit.tsx +153 -0
- package/src/lib/components/dynamicSubmit/index.tsx +2 -0
- package/src/lib/components/externalValidationComponent/ExternalValidationComponent.tsx +78 -0
- package/src/lib/components/externalValidationComponent/index.tsx +2 -0
- package/src/lib/components/form/Form.tsx +276 -0
- package/src/lib/components/form/FormContext.ts +49 -0
- package/src/lib/components/form/FormValidationSummary.tsx +122 -0
- package/src/lib/components/form/index.tsx +5 -0
- package/src/lib/components/form/withFormContext.tsx +20 -0
- package/src/lib/components/inputGroup/InputGroup.tsx +60 -0
- package/src/lib/components/inputGroup/index.tsx +2 -0
- package/src/lib/components/inputHeader/InputHeader.tsx +448 -0
- package/src/lib/components/inputHeader/InputHeaderContext.ts +42 -0
- package/src/lib/components/inputHeader/index.tsx +2 -0
- package/src/lib/components/inputHeader/withInputHeaderContext.tsx +24 -0
- package/src/lib/components/money/Money.tsx +298 -0
- package/src/lib/components/money/index.tsx +2 -0
- package/src/lib/components/numberInput/NumberInput.tsx +186 -0
- package/src/lib/components/numberInput/index.tsx +2 -0
- package/src/lib/components/openingHours/openingHoursDay/OpeningHoursDay.tsx +394 -0
- package/src/lib/components/openingHours/openingHoursDay/index.tsx +2 -0
- package/src/lib/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.tsx +227 -0
- package/src/lib/components/openingHours/openingHoursSpecial/index.tsx +2 -0
- package/src/lib/components/openingHours/openingHoursWeek/OpeningHoursWeek.tsx +283 -0
- package/src/lib/components/openingHours/openingHoursWeek/index.tsx +2 -0
- package/src/lib/components/openingHours/utils/OpeningHoursUtil.tsx +111 -0
- package/src/lib/components/radio/Radio.tsx +87 -0
- package/src/lib/components/radio/index.tsx +2 -0
- package/src/lib/components/radioContainer/RadioContainer.tsx +50 -0
- package/src/lib/components/radioContainer/index.tsx +2 -0
- package/src/lib/components/select/Select.tsx +335 -0
- package/src/lib/components/select/index.tsx +2 -0
- package/src/lib/components/submit/Submit.tsx +117 -0
- package/src/lib/components/submit/index.tsx +2 -0
- package/src/lib/components/submit/subComponents/SubmitValidationSummary.tsx +55 -0
- package/src/lib/components/tags/Tags.tsx +702 -0
- package/src/lib/components/tags/index.tsx +2 -0
- package/src/lib/components/tags/subComponents/TagsSuggestions.tsx +150 -0
- package/src/lib/components/text/Text.tsx +200 -0
- package/src/lib/components/text/index.tsx +2 -0
- package/src/lib/components/textArea/TextArea.tsx +109 -0
- package/src/lib/components/textArea/index.tsx +2 -0
- package/src/lib/components/themeProvider/ThemeContext.ts +16 -0
- package/src/lib/components/themeProvider/ThemeProvider.tsx +21 -0
- package/src/lib/components/themeProvider/index.tsx +4 -0
- package/src/lib/components/themeProvider/withThemeContext.tsx +30 -0
- package/src/lib/components/time/Time.tsx +296 -0
- package/src/lib/components/time/index.tsx +2 -0
- package/src/lib/components/timeSpan/TimeSpan.tsx +378 -0
- package/src/lib/components/timeSpan/index.tsx +2 -0
- package/src/lib/components/utils/Guid.ts +9 -0
- package/src/lib/components/utils/ShallowEqual.ts +75 -0
- package/src/lib/components/utils/TimeUtil.ts +22 -0
- package/src/lib/components/utils/Typescript.ts +11 -0
- package/src/lib/declarations/import.d.ts +1 -0
- package/src/lib/index.ts +24 -0
- package/src/lib/scss/components/base/index.scss +1 -0
- package/src/lib/scss/components/base/input/index.scss +1 -0
- package/src/lib/scss/components/base/input/input.scss +237 -0
- package/src/lib/scss/components/bookingCalendar/bookingCalendar.scss +274 -0
- package/src/lib/scss/components/bookingCalendar/index.scss +1 -0
- package/src/lib/scss/components/button/buttons.scss +161 -0
- package/src/lib/scss/components/button/index.scss +1 -0
- package/src/lib/scss/components/checkbox/checkbox.scss +115 -0
- package/src/lib/scss/components/checkbox/index.scss +1 -0
- package/src/lib/scss/components/dropdown/dropdown.scss +111 -0
- package/src/lib/scss/components/dropdown/index.scss +1 -0
- package/src/lib/scss/components/dynamicSubmit/dynamicSubmit.scss +1 -0
- package/src/lib/scss/components/dynamicSubmit/index.scss +1 -0
- package/src/lib/scss/components/form/form.scss +1 -0
- package/src/lib/scss/components/form/formValidationSummary.scss +55 -0
- package/src/lib/scss/components/form/index.scss +2 -0
- package/src/lib/scss/components/index.scss +21 -0
- package/src/lib/scss/components/inputGroup/index.scss +1 -0
- package/src/lib/scss/components/inputGroup/inputGroup.scss +67 -0
- package/src/lib/scss/components/inputHeader/index.scss +1 -0
- package/src/lib/scss/components/inputHeader/inputHeader.scss +132 -0
- package/src/lib/scss/components/money/index.scss +1 -0
- package/src/lib/scss/components/money/money.scss +51 -0
- package/src/lib/scss/components/numberInput/index.scss +1 -0
- package/src/lib/scss/components/numberInput/numberInput.scss +116 -0
- package/src/lib/scss/components/openingHours/index.scss +3 -0
- package/src/lib/scss/components/openingHours/openingHoursDay/index.scss +1 -0
- package/src/lib/scss/components/openingHours/openingHoursDay/openingHoursDay.scss +127 -0
- package/src/lib/scss/components/openingHours/openingHoursSpecial/index.scss +1 -0
- package/src/lib/scss/components/openingHours/openingHoursSpecial/openingHoursSpecial.scss +93 -0
- package/src/lib/scss/components/openingHours/openingHoursWeek/index.scss +1 -0
- package/src/lib/scss/components/openingHours/openingHoursWeek/openingHoursWeek.scss +23 -0
- package/src/lib/scss/components/radio/index.scss +1 -0
- package/src/lib/scss/components/radio/radio.scss +68 -0
- package/src/lib/scss/components/radioContainer/index.scss +1 -0
- package/src/lib/scss/components/radioContainer/radioContainer.scss +15 -0
- package/src/lib/scss/components/select/index.scss +1 -0
- package/src/lib/scss/components/select/select.scss +64 -0
- package/src/lib/scss/components/submit/index.scss +1 -0
- package/src/lib/scss/components/submit/submitValidationSummary.scss +35 -0
- package/src/lib/scss/components/tags/index.scss +1 -0
- package/src/lib/scss/components/tags/tags.scss +128 -0
- package/src/lib/scss/components/text/index.scss +1 -0
- package/src/lib/scss/components/text/text.scss +42 -0
- package/src/lib/scss/components/textArea/index.scss +1 -0
- package/src/lib/scss/components/textArea/textArea.scss +32 -0
- package/src/lib/scss/components/time/index.scss +1 -0
- package/src/lib/scss/components/time/time.scss +111 -0
- package/src/lib/scss/components/timeSpan/index.scss +1 -0
- package/src/lib/scss/components/timeSpan/timeSpan.scss +115 -0
- package/src/lib/scss/index.scss +8 -0
- package/src/lib/scss/styles/base.scss +7 -0
- package/src/lib/scss/styles/index.scss +2 -0
- package/src/lib/scss/styles/react-tippy.scss +4 -0
- package/src/lib/scss/variables/_buttons.scss +6 -0
- package/src/lib/scss/variables/_colors.scss +1 -0
- package/src/lib/scss/variables/_common.scss +12 -0
- package/src/lib/tsconfig.json +19 -0
- package/src/lib/types/ElementOverrideProp.ts +3 -0
- package/src/lib/types/Theme.ts +5 -0
- package/src/lib/types/ThemeOverrides.ts +46 -0
- package/src/lib/validators/EmailValidator.ts +15 -0
- package/src/lib/validators/LatitudeValidator.ts +25 -0
- package/src/lib/validators/LongitudeValidator.ts +25 -0
- package/src/lib/validators/NumberValidator.ts +50 -0
- package/src/lib/validators/UrlValidator.ts +20 -0
- package/src/lib/validators/base.ts +15 -0
- package/src/lib/validators/index.ts +6 -0
- package/src/stories/Basic.stories.ts +17 -0
- package/src/stories/Basic.tsx +1065 -0
- package/src/stories/Schedule.stories.ts +16 -0
- package/src/stories/Schedule.tsx +85 -0
- package/src/stories/ValidationPage.tsx +417 -0
- package/tsconfig.json +9 -22
- package/typedoc.json +6 -0
- package/webpack/webpack.config.base.js +139 -0
- package/webpack/webpack.config.dev.js +78 -0
- package/webpack/webpack.config.gh-pages.js +78 -0
- package/webpack/webpack.config.js +21 -0
- package/webpack/webpack.config.min.js +100 -0
- package/.vscode/launch.json +0 -15
- package/.vscode/settings.json +0 -27
- package/.vscode/tasks.json +0 -12
@@ -0,0 +1,335 @@
|
|
1
|
+
// Libs
|
2
|
+
import * as React from 'react';
|
3
|
+
|
4
|
+
// Misc
|
5
|
+
import InputGroup from '../inputGroup/InputGroup';
|
6
|
+
import * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_circle_outline_24px.svg';
|
7
|
+
import {
|
8
|
+
BaseInputProps,
|
9
|
+
BaseInputState,
|
10
|
+
BaseInput,
|
11
|
+
ValidationError,
|
12
|
+
defaultBaseTranslations,
|
13
|
+
} from '../base/input/BaseInput';
|
14
|
+
import { Button } from '../button/Button';
|
15
|
+
import { withFormContext } from '../form/withFormContext';
|
16
|
+
import { withThemeContext } from '../themeProvider/withThemeContext';
|
17
|
+
|
18
|
+
export interface SelectValue {
|
19
|
+
value: number | string;
|
20
|
+
label?: string;
|
21
|
+
forceSelected?: boolean;
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface SelectProps extends BaseInputProps<HTMLSelectElement> {
|
25
|
+
values?: SelectValue[];
|
26
|
+
defaultEmpty?: boolean;
|
27
|
+
multiple?: boolean;
|
28
|
+
selectedValues?: SelectValue[];
|
29
|
+
onSelectedValuesChange?: (newValues: SelectValue[]) => void;
|
30
|
+
inputRef?: (input: HTMLSelectElement) => void;
|
31
|
+
readOnly?: boolean;
|
32
|
+
readonlyEmptyPlaceholder?: string;
|
33
|
+
}
|
34
|
+
|
35
|
+
export interface SelectState extends BaseInputState {}
|
36
|
+
|
37
|
+
export class SelectRaw extends BaseInput<
|
38
|
+
SelectProps,
|
39
|
+
SelectState,
|
40
|
+
HTMLSelectElement
|
41
|
+
> {
|
42
|
+
public static defaultProps = Object.assign({}, BaseInput.defaultProps, {
|
43
|
+
defaultEmpty: true,
|
44
|
+
multiple: false,
|
45
|
+
readOnly: false,
|
46
|
+
readonlyEmptyPlaceholder: 'N/A',
|
47
|
+
});
|
48
|
+
|
49
|
+
constructor(props: SelectProps) {
|
50
|
+
super(props);
|
51
|
+
const val = !props.value
|
52
|
+
? props.defaultEmpty
|
53
|
+
? ''
|
54
|
+
: props.values && props.values.length > 0
|
55
|
+
? props.values[0]
|
56
|
+
: ''
|
57
|
+
: props.value;
|
58
|
+
this.state = Object.assign(this.state, { value: val });
|
59
|
+
this.handleChangeCustom = this.handleChangeCustom.bind(this);
|
60
|
+
}
|
61
|
+
|
62
|
+
public componentDidMount() {
|
63
|
+
this.props.multiple && this.handleValid(this.props.selectedValues);
|
64
|
+
}
|
65
|
+
|
66
|
+
public componentDidUpdate(oldProps: SelectProps) {
|
67
|
+
if (
|
68
|
+
oldProps.value !== this.props.value ||
|
69
|
+
oldProps.validators !== this.props.validators ||
|
70
|
+
oldProps.customValidators !== this.props.customValidators ||
|
71
|
+
oldProps.required !== this.props.required ||
|
72
|
+
oldProps.selectedValues !== this.props.selectedValues
|
73
|
+
) {
|
74
|
+
if (this.props.multiple) {
|
75
|
+
this.handleValid(this.props.selectedValues);
|
76
|
+
} else {
|
77
|
+
this.handleValueChange(this.props.value, true, [], this.props);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
public render() {
|
83
|
+
const finalValues = this.props.multiple
|
84
|
+
? this.props.values.filter(
|
85
|
+
item =>
|
86
|
+
this.props.selectedValues.findIndex(t => t.value === item.value) < 0
|
87
|
+
)
|
88
|
+
: this.props.values;
|
89
|
+
return (
|
90
|
+
<InputGroup
|
91
|
+
title={this.props.title}
|
92
|
+
tooltip={this.props.tooltip}
|
93
|
+
className={this.props.inputGroupClassName}
|
94
|
+
>
|
95
|
+
<div
|
96
|
+
className={
|
97
|
+
'input__base select-input ' +
|
98
|
+
this.getValidationClass() +
|
99
|
+
' ' +
|
100
|
+
(this.props.className ? this.props.className : '') +
|
101
|
+
' ' +
|
102
|
+
(this.props.readOnly ? 'readonly' : '') +
|
103
|
+
' ' +
|
104
|
+
(this.props.multiple ? 'multiple' : '')
|
105
|
+
}
|
106
|
+
ref={this.containerRef}
|
107
|
+
>
|
108
|
+
{this.renderSelectedValues()}
|
109
|
+
{finalValues.length > 0 &&
|
110
|
+
((this.props.multiple && !this.props.readOnly) ||
|
111
|
+
!this.props.multiple) && (
|
112
|
+
<div className="select-input__select__wrapper">
|
113
|
+
{(!this.props.multiple && !this.props.readOnly) ||
|
114
|
+
this.props.multiple ? (
|
115
|
+
<select
|
116
|
+
{...(this.props.id && {
|
117
|
+
id: this.props.id,
|
118
|
+
})}
|
119
|
+
ref={this.inputRef}
|
120
|
+
disabled={this.getDisabled()}
|
121
|
+
required={this.props.required}
|
122
|
+
onChange={this.handleChangeCustom}
|
123
|
+
value={this.state.value}
|
124
|
+
className={
|
125
|
+
'select-input__select ' +
|
126
|
+
(this.state.value !== '' ||
|
127
|
+
(this.props.selectedValues &&
|
128
|
+
this.props.selectedValues.length > 0)
|
129
|
+
? 'filled'
|
130
|
+
: '')
|
131
|
+
}
|
132
|
+
onBlur={this.handleBlur}
|
133
|
+
onFocus={this.handleFocus}
|
134
|
+
tabIndex={0}
|
135
|
+
>
|
136
|
+
{this.props.defaultEmpty && (
|
137
|
+
<option
|
138
|
+
key={-1}
|
139
|
+
disabled={true}
|
140
|
+
value=""
|
141
|
+
style={{ display: 'none' }}
|
142
|
+
/>
|
143
|
+
)}
|
144
|
+
{finalValues.map((value, index) => (
|
145
|
+
<option key={index} value={value.value}>
|
146
|
+
{value.label ? value.label : value.value}
|
147
|
+
</option>
|
148
|
+
))}
|
149
|
+
</select>
|
150
|
+
) : (
|
151
|
+
<span
|
152
|
+
className={
|
153
|
+
'select-input__select ' +
|
154
|
+
(this.state.value !== '' ||
|
155
|
+
(this.props.selectedValues &&
|
156
|
+
this.props.selectedValues.length > 0)
|
157
|
+
? 'filled'
|
158
|
+
: '')
|
159
|
+
}
|
160
|
+
>
|
161
|
+
{this.renderReadonly()}
|
162
|
+
</span>
|
163
|
+
)}
|
164
|
+
<span className="highlight" />
|
165
|
+
<span className="bar" />
|
166
|
+
{this.renderDefaultValidation()}
|
167
|
+
{this.props.label && finalValues.length > 0 && (
|
168
|
+
<label>{this.renderLabel()}</label>
|
169
|
+
)}
|
170
|
+
</div>
|
171
|
+
)}
|
172
|
+
</div>
|
173
|
+
</InputGroup>
|
174
|
+
);
|
175
|
+
}
|
176
|
+
|
177
|
+
protected handleValueChange(
|
178
|
+
value: string,
|
179
|
+
isValid: boolean = true,
|
180
|
+
errors: ValidationError[] = [],
|
181
|
+
props: SelectProps = this.props,
|
182
|
+
initializing: boolean = false
|
183
|
+
) {
|
184
|
+
if (!this.props.multiple) {
|
185
|
+
return super.handleValueChange(
|
186
|
+
value,
|
187
|
+
isValid,
|
188
|
+
errors,
|
189
|
+
props,
|
190
|
+
initializing
|
191
|
+
);
|
192
|
+
} else if (!initializing) {
|
193
|
+
this.handleValid(this.props.selectedValues);
|
194
|
+
}
|
195
|
+
return {
|
196
|
+
isValid: true,
|
197
|
+
errors: [],
|
198
|
+
};
|
199
|
+
}
|
200
|
+
|
201
|
+
protected handleBlur() {
|
202
|
+
this.props.onBlur && this.props.onBlur();
|
203
|
+
let state = { focused: false };
|
204
|
+
if (!this.state.touched && this.props.touchOn === 'blur') {
|
205
|
+
state = Object.assign(state, { touched: true });
|
206
|
+
if (!this.props.multiple) {
|
207
|
+
this.handleValueChange(this.state.value);
|
208
|
+
} else {
|
209
|
+
this.handleValid(this.props.selectedValues);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
this.setState(state);
|
213
|
+
}
|
214
|
+
|
215
|
+
protected handleFocus() {
|
216
|
+
this.props.onFocus?.();
|
217
|
+
let state = { focused: true };
|
218
|
+
if (!this.state.touched && this.props.touchOn === 'focus') {
|
219
|
+
state = Object.assign(state, { touched: true });
|
220
|
+
if (!this.props.multiple) {
|
221
|
+
this.handleValueChange(this.state.value);
|
222
|
+
} else {
|
223
|
+
this.handleValid(this.props.selectedValues);
|
224
|
+
}
|
225
|
+
}
|
226
|
+
this.setState(state);
|
227
|
+
}
|
228
|
+
|
229
|
+
private handleChangeCustom(event: React.ChangeEvent<HTMLSelectElement>) {
|
230
|
+
if (this.props.multiple) {
|
231
|
+
let value = event.target.value;
|
232
|
+
let val = this.props.values.filter(item => item.value === value)[0];
|
233
|
+
if (!val) {
|
234
|
+
if (!isNaN(Number(value))) {
|
235
|
+
let valNumber = Number(value);
|
236
|
+
val = this.props.values.filter(item => item.value === valNumber)[0];
|
237
|
+
}
|
238
|
+
}
|
239
|
+
let newValues = this.props.selectedValues.concat(val);
|
240
|
+
if (val) {
|
241
|
+
this.props.onSelectedValuesChange &&
|
242
|
+
this.props.onSelectedValuesChange(newValues);
|
243
|
+
this.handleValid(newValues);
|
244
|
+
this.setState({ value: '' });
|
245
|
+
}
|
246
|
+
} else {
|
247
|
+
this.handleChange(event);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
private handleValid(newValues: SelectValue[]) {
|
252
|
+
let isValid = true;
|
253
|
+
let errors: ValidationError[] = [];
|
254
|
+
if (this.props.required) {
|
255
|
+
if (newValues.length === 0) {
|
256
|
+
isValid = false;
|
257
|
+
errors.push(this.getTranslations(defaultBaseTranslations).required);
|
258
|
+
}
|
259
|
+
}
|
260
|
+
if (this.props.customValidators) {
|
261
|
+
this.props.customValidators.forEach(customValidator => {
|
262
|
+
let validInner = false;
|
263
|
+
validInner = customValidator.Validate(
|
264
|
+
this.state?.value,
|
265
|
+
this.props.required,
|
266
|
+
error => errors.push(error)
|
267
|
+
);
|
268
|
+
if (isValid && !validInner) {
|
269
|
+
isValid = validInner;
|
270
|
+
}
|
271
|
+
});
|
272
|
+
}
|
273
|
+
if (isValid) {
|
274
|
+
this.setValid();
|
275
|
+
} else {
|
276
|
+
this.setInvalid(errors);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
private renderReadonly() {
|
281
|
+
const value = this.props.values.filter(
|
282
|
+
item => item.value.toString() === this.state.value
|
283
|
+
)[0];
|
284
|
+
return value ? (value.label ? value.label : value.value) : '';
|
285
|
+
}
|
286
|
+
|
287
|
+
private renderSelectedValues() {
|
288
|
+
return this.props.multiple ? (
|
289
|
+
this.props.selectedValues.length > 0 ? (
|
290
|
+
<div className="select-input__selectedValue__wrapper">
|
291
|
+
{this.props.selectedValues.map((item, index) => (
|
292
|
+
<div className="select-input__selectedValue" key={index}>
|
293
|
+
{item.label ? item.label : item.value}
|
294
|
+
{!this.props.readOnly && (
|
295
|
+
<Button
|
296
|
+
disabled={item.forceSelected}
|
297
|
+
circular={true}
|
298
|
+
blank={true}
|
299
|
+
onClick={this.removeItemClick(item)}
|
300
|
+
className="ml-1 transform-rotate--45 line-height--0 p-0"
|
301
|
+
>
|
302
|
+
<PlusIcon />
|
303
|
+
</Button>
|
304
|
+
)}
|
305
|
+
</div>
|
306
|
+
))}
|
307
|
+
</div>
|
308
|
+
) : (
|
309
|
+
this.props.readOnly && (
|
310
|
+
<div className="select-input__selectedValue__wrapper">
|
311
|
+
<div className="select-input__selectedValue">
|
312
|
+
{this.props.readonlyEmptyPlaceholder}
|
313
|
+
</div>
|
314
|
+
</div>
|
315
|
+
)
|
316
|
+
)
|
317
|
+
) : null;
|
318
|
+
}
|
319
|
+
|
320
|
+
private removeItemClick = (item: SelectValue) => () => {
|
321
|
+
const newValues = this.props.selectedValues.filter(
|
322
|
+
sv => sv.value !== item.value
|
323
|
+
);
|
324
|
+
this.handleValid(newValues);
|
325
|
+
this.props.onSelectedValuesChange &&
|
326
|
+
this.props.onSelectedValuesChange(newValues);
|
327
|
+
};
|
328
|
+
}
|
329
|
+
|
330
|
+
export const Select = withThemeContext<
|
331
|
+
SelectProps,
|
332
|
+
InstanceType<typeof SelectRaw>
|
333
|
+
>(withFormContext<SelectProps>(SelectRaw), 'select');
|
334
|
+
|
335
|
+
export default Select;
|
@@ -0,0 +1,117 @@
|
|
1
|
+
// Libs
|
2
|
+
import * as React from 'react';
|
3
|
+
import {
|
4
|
+
BaseInputProps,
|
5
|
+
BaseInputState,
|
6
|
+
BaseInput,
|
7
|
+
defaultBaseTranslations,
|
8
|
+
} from '../base/input/BaseInput';
|
9
|
+
import { Button, ButtonProps } from '../button/Button';
|
10
|
+
import { withFormContext } from '../form/withFormContext';
|
11
|
+
import { FormValidationSummaryRaw } from './../form/FormValidationSummary';
|
12
|
+
import SubmitValidationSummary from './subComponents/SubmitValidationSummary';
|
13
|
+
import { withThemeContext } from '../themeProvider/withThemeContext';
|
14
|
+
|
15
|
+
// Misc
|
16
|
+
export const defaultSubmitTranslations = {
|
17
|
+
...defaultBaseTranslations,
|
18
|
+
hangOn: 'Hang on',
|
19
|
+
needsFixing: '... needs fixing',
|
20
|
+
};
|
21
|
+
|
22
|
+
export type SubmitTranslations = Partial<typeof defaultSubmitTranslations>;
|
23
|
+
|
24
|
+
export type SubmitProps = BaseInputProps<never, SubmitTranslations> &
|
25
|
+
ButtonProps & {
|
26
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
27
|
+
validateForm?: boolean;
|
28
|
+
disabledTitle?: string;
|
29
|
+
showValidationSummaryTooltip?: boolean;
|
30
|
+
};
|
31
|
+
|
32
|
+
export interface SubmitState extends BaseInputState {}
|
33
|
+
|
34
|
+
export class SubmitRaw extends BaseInput<
|
35
|
+
SubmitProps,
|
36
|
+
SubmitState,
|
37
|
+
never,
|
38
|
+
SubmitTranslations
|
39
|
+
> {
|
40
|
+
public static defaultProps = Object.assign({}, BaseInput.defaultProps, {
|
41
|
+
validateForm: true,
|
42
|
+
ignoreContext: true,
|
43
|
+
reRendersWhenContextChanges: true,
|
44
|
+
showValidationSummaryTooltip: true,
|
45
|
+
preventsDefault: true,
|
46
|
+
});
|
47
|
+
|
48
|
+
constructor(props: SubmitProps) {
|
49
|
+
super(props);
|
50
|
+
this.handleClick = this.handleClick.bind(this);
|
51
|
+
}
|
52
|
+
|
53
|
+
public render() {
|
54
|
+
const disabled = this.isDisabled();
|
55
|
+
const translations = this.getTranslations(defaultSubmitTranslations);
|
56
|
+
return (
|
57
|
+
<Button
|
58
|
+
{...this.props}
|
59
|
+
className={`${this.props.className ? this.props.className : ''}`}
|
60
|
+
onClick={this.handleClick}
|
61
|
+
disabled={disabled}
|
62
|
+
buttonProps={{
|
63
|
+
...this.props.buttonProps,
|
64
|
+
type: 'submit',
|
65
|
+
title: disabled
|
66
|
+
? this.props.disabledTitle
|
67
|
+
: this.props.buttonProps && this.props.buttonProps.title,
|
68
|
+
}}
|
69
|
+
tooltip={
|
70
|
+
this.props.tooltip
|
71
|
+
? this.props.tooltip
|
72
|
+
: this.props.showValidationSummaryTooltip &&
|
73
|
+
!this.props.formContext.isFormValid && (
|
74
|
+
<FormValidationSummaryRaw
|
75
|
+
title={translations.hangOn}
|
76
|
+
footer={translations.needsFixing}
|
77
|
+
containerClassName=""
|
78
|
+
headerClassName="submitValidationSummary__header"
|
79
|
+
footerClassName="submitValidationSummary__footer"
|
80
|
+
Component={SubmitValidationSummary}
|
81
|
+
formContext={this.props.formContext}
|
82
|
+
/>
|
83
|
+
)
|
84
|
+
}
|
85
|
+
tooltipProps={{
|
86
|
+
theme: 'validation',
|
87
|
+
...this.props.tooltipProps,
|
88
|
+
}}
|
89
|
+
>
|
90
|
+
{this.props.children}
|
91
|
+
</Button>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
|
95
|
+
private handleClick(e: React.MouseEvent<HTMLButtonElement>) {
|
96
|
+
if (this.props.preventsDefault) {
|
97
|
+
e.preventDefault();
|
98
|
+
}
|
99
|
+
this.props.onClick && this.props.onClick(e);
|
100
|
+
}
|
101
|
+
|
102
|
+
private isDisabled() {
|
103
|
+
const disabled = this.getDisabled();
|
104
|
+
return disabled
|
105
|
+
? disabled
|
106
|
+
: this.props.validateForm && this.props.formContext
|
107
|
+
? !this.props.formContext.isFormValid
|
108
|
+
: false;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
export const Submit = withThemeContext<
|
113
|
+
SubmitProps,
|
114
|
+
InstanceType<typeof SubmitRaw>
|
115
|
+
>(withFormContext<SubmitProps>(SubmitRaw), 'submit');
|
116
|
+
|
117
|
+
export default Submit;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormValidationSummaryComponentProps } from './../../form/FormValidationSummary';
|
3
|
+
import Button from '../../button';
|
4
|
+
import * as ArrowIcon from 'material-design-icons/maps/svg/production/ic_my_location_24px.svg';
|
5
|
+
|
6
|
+
export type SubmitValidationSummaryProps = {} & FormValidationSummaryComponentProps;
|
7
|
+
|
8
|
+
const SubmitValidationSummary: React.FC<SubmitValidationSummaryProps> = props => {
|
9
|
+
return (
|
10
|
+
<React.Fragment>
|
11
|
+
{props.componentsWithErrors.map((component, index) => {
|
12
|
+
return (
|
13
|
+
<div key={index} className="submitValidationSummary__item">
|
14
|
+
<div className="submitValidationSummary__item__header">
|
15
|
+
{component.validation.name
|
16
|
+
? component.validation.name
|
17
|
+
: 'unknown'}
|
18
|
+
</div>
|
19
|
+
{/*<div className="submitValidationSummary__item__errors">
|
20
|
+
{component.validation.errors && component.validation.errors.map((err, errIndex) => (
|
21
|
+
<span
|
22
|
+
className="submitValidationSummary__item__error"
|
23
|
+
key={errIndex}
|
24
|
+
>
|
25
|
+
{err}
|
26
|
+
</span>
|
27
|
+
))}
|
28
|
+
</div>*/}
|
29
|
+
<div style={{ flex: 'auto' }} />
|
30
|
+
{component.componentApi &&
|
31
|
+
component.componentApi.focus &&
|
32
|
+
component.componentApi.scrollTo && (
|
33
|
+
<Button
|
34
|
+
icon={true}
|
35
|
+
className="submitValidationSummary__item__locate-button"
|
36
|
+
circular={true}
|
37
|
+
type="white"
|
38
|
+
small={true}
|
39
|
+
blank={true}
|
40
|
+
onClick={() => {
|
41
|
+
component.componentApi.scrollTo();
|
42
|
+
component.componentApi.focus();
|
43
|
+
}}
|
44
|
+
>
|
45
|
+
<ArrowIcon />
|
46
|
+
</Button>
|
47
|
+
)}
|
48
|
+
</div>
|
49
|
+
);
|
50
|
+
})}
|
51
|
+
</React.Fragment>
|
52
|
+
);
|
53
|
+
};
|
54
|
+
|
55
|
+
export default SubmitValidationSummary;
|