guestbell-forms 3.0.38 → 3.0.40
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 +45 -46
- package/build/components/bookingCalendar/BookingCalendar.js +4 -5
- 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/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 +2 -0
- package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js.map +1 -1
- 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 +23 -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 +52 -50
- 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 +157 -171
- 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 +30 -7
- package/build/scss/components/inputHeader/inputHeader.scss +7 -1
- 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 +327 -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 +97 -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 +217 -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 +61 -0
- package/src/lib/components/bookingCalendar/index.ts +3 -0
- package/src/lib/components/bookingCalendar/utils.ts +348 -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 +272 -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 +73 -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,298 @@
|
|
1
|
+
import * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_24px.svg';
|
2
|
+
|
3
|
+
// Libs
|
4
|
+
import * as React from 'react';
|
5
|
+
|
6
|
+
// Misc
|
7
|
+
import { Select, SelectValue } from '../select/Select';
|
8
|
+
import { Text } from '../text/Text';
|
9
|
+
import InputGroup from '../inputGroup/InputGroup';
|
10
|
+
import {
|
11
|
+
BaseInputProps,
|
12
|
+
BaseInputState,
|
13
|
+
BaseInput,
|
14
|
+
defaultBaseTranslations,
|
15
|
+
} from '../base/input/BaseInput';
|
16
|
+
import { Button } from '../button/Button';
|
17
|
+
import { withFormContext } from '../form/withFormContext';
|
18
|
+
import { withThemeContext } from '../themeProvider/withThemeContext';
|
19
|
+
|
20
|
+
export interface MoneyWithCurrency {
|
21
|
+
value: number | undefined;
|
22
|
+
currency: SelectValue;
|
23
|
+
}
|
24
|
+
|
25
|
+
export const defaultMoneyTranslations = {
|
26
|
+
...defaultBaseTranslations,
|
27
|
+
cannotRemoveDefaultCurrency: 'Cannot remove default currency',
|
28
|
+
removePrice: 'Remove price',
|
29
|
+
addPrice: 'Add price',
|
30
|
+
addNewCurrency: 'Add new currency',
|
31
|
+
};
|
32
|
+
|
33
|
+
export type MoneyTranslations = Partial<typeof defaultMoneyTranslations>;
|
34
|
+
|
35
|
+
export interface MoneyProps extends BaseInputProps<never, MoneyTranslations> {
|
36
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
37
|
+
onPricesChange: (prices: MoneyWithCurrency[]) => void;
|
38
|
+
allowMultiple?: boolean;
|
39
|
+
currencies: SelectValue[];
|
40
|
+
prices: MoneyWithCurrency[];
|
41
|
+
disableDelete?: boolean;
|
42
|
+
}
|
43
|
+
|
44
|
+
export interface MoneyState extends BaseInputState {}
|
45
|
+
|
46
|
+
export class MoneyRaw extends BaseInput<
|
47
|
+
MoneyProps,
|
48
|
+
MoneyState,
|
49
|
+
never,
|
50
|
+
MoneyTranslations
|
51
|
+
> {
|
52
|
+
public static defaultProps = Object.assign({}, BaseInput.defaultProps, {
|
53
|
+
type: 'money',
|
54
|
+
allowMultiple: false,
|
55
|
+
onChange: undefined,
|
56
|
+
});
|
57
|
+
|
58
|
+
constructor(props: MoneyProps) {
|
59
|
+
super(props, false);
|
60
|
+
if (!props.currencies || !props.currencies.length) {
|
61
|
+
throw Error('No currencies supplied to money input');
|
62
|
+
}
|
63
|
+
this.state = Object.assign(this.state, {
|
64
|
+
isValid: props.required ? props.prices.length > 0 : true,
|
65
|
+
errors:
|
66
|
+
props.required && props.prices.length === 0
|
67
|
+
? [this.getTranslations(defaultMoneyTranslations).required]
|
68
|
+
: [],
|
69
|
+
handleValueChangeEnabled: false,
|
70
|
+
});
|
71
|
+
const forcedCurrencies = props.currencies.filter((c) => c.forceSelected);
|
72
|
+
const missingForced = forcedCurrencies.filter(
|
73
|
+
(c) => !props.prices.find((p) => p.currency.value === c.value)
|
74
|
+
);
|
75
|
+
if (missingForced.length > 0) {
|
76
|
+
props.onPricesChange(
|
77
|
+
props.prices.concat(
|
78
|
+
missingForced.map((c) => ({ currency: c, value: undefined }))
|
79
|
+
)
|
80
|
+
);
|
81
|
+
}
|
82
|
+
this.subscribeSelf(props);
|
83
|
+
}
|
84
|
+
|
85
|
+
public render() {
|
86
|
+
let unusedCurrencies = this.props.currencies;
|
87
|
+
const translations = this.getTranslations(defaultMoneyTranslations);
|
88
|
+
return (
|
89
|
+
<InputGroup
|
90
|
+
title={this.props.title}
|
91
|
+
tooltip={this.props.tooltip}
|
92
|
+
className={this.props.inputGroupClassName}
|
93
|
+
>
|
94
|
+
<div
|
95
|
+
{...(this.props.id && { id: this.props.id })}
|
96
|
+
className={
|
97
|
+
'input__base money-input ' +
|
98
|
+
this.getValidationClass() +
|
99
|
+
(this.props.className ? ' ' + this.props.className : '')
|
100
|
+
}
|
101
|
+
ref={this.containerRef}
|
102
|
+
>
|
103
|
+
{this.props.prices &&
|
104
|
+
this.props.prices.map((item, index) => {
|
105
|
+
let currentCurrencies = this.props.currencies.filter(
|
106
|
+
(c) =>
|
107
|
+
this.props.prices.filter(
|
108
|
+
(priceCurrency, priceIndex) =>
|
109
|
+
priceIndex !== index &&
|
110
|
+
priceCurrency.currency.value === c.value
|
111
|
+
).length === 0
|
112
|
+
);
|
113
|
+
const currency = this.props.currencies.find(
|
114
|
+
(c) => c.value === item.currency.value
|
115
|
+
);
|
116
|
+
let retComponents = currentCurrencies.length ? (
|
117
|
+
<div key={index}>
|
118
|
+
{currentCurrencies.length > 1 ? (
|
119
|
+
<Select
|
120
|
+
{...(this.props.id && {
|
121
|
+
id:
|
122
|
+
this.props.id +
|
123
|
+
'-currency-select-' +
|
124
|
+
index.toString(),
|
125
|
+
})}
|
126
|
+
onFocus={this.onFocus}
|
127
|
+
onBlur={this.onBlur}
|
128
|
+
className={'money-input__select m-0'}
|
129
|
+
values={currentCurrencies}
|
130
|
+
onChange={this.onCurrencyChanged(
|
131
|
+
index,
|
132
|
+
currentCurrencies
|
133
|
+
)}
|
134
|
+
value={item.currency.value.toString()}
|
135
|
+
/>
|
136
|
+
) : (
|
137
|
+
currentCurrencies?.[0]?.label
|
138
|
+
)}
|
139
|
+
<Text
|
140
|
+
{...(this.props.id && {
|
141
|
+
id: this.props.id + '-amount-input-' + index.toString(),
|
142
|
+
})}
|
143
|
+
onFocus={this.onFocus}
|
144
|
+
onBlur={this.onBlur}
|
145
|
+
onTheFlightValidate={this.onTheFlightValidate}
|
146
|
+
placeholder={'0.00'}
|
147
|
+
className={'money-input__text m-0'}
|
148
|
+
validators={['number']}
|
149
|
+
value={item.value ? item.value.toString() : ''}
|
150
|
+
onChange={this.onPriceChanged(index)}
|
151
|
+
type="number"
|
152
|
+
/>
|
153
|
+
{!this.props.disableDelete &&
|
154
|
+
this.props.prices.length > 0 && (
|
155
|
+
<Button
|
156
|
+
{...(this.props.id && {
|
157
|
+
id:
|
158
|
+
this.props.id +
|
159
|
+
'-remove-button-' +
|
160
|
+
index.toString(),
|
161
|
+
})}
|
162
|
+
blank={true}
|
163
|
+
type="error"
|
164
|
+
onClick={this.removePriceClick(index)}
|
165
|
+
className="transform-rotate--45 line-height--0"
|
166
|
+
buttonProps={{
|
167
|
+
...Button.defaultProps?.buttonProps,
|
168
|
+
title:
|
169
|
+
currency && currency.forceSelected
|
170
|
+
? translations.cannotRemoveDefaultCurrency
|
171
|
+
: translations.removePrice,
|
172
|
+
}}
|
173
|
+
circular={true}
|
174
|
+
disabled={currency && currency.forceSelected}
|
175
|
+
>
|
176
|
+
<PlusIcon />
|
177
|
+
</Button>
|
178
|
+
)}
|
179
|
+
</div>
|
180
|
+
) : null;
|
181
|
+
unusedCurrencies = unusedCurrencies.filter(
|
182
|
+
(c) => c.value !== item.currency.value
|
183
|
+
);
|
184
|
+
return retComponents;
|
185
|
+
})}
|
186
|
+
{(this.props.allowMultiple ||
|
187
|
+
(this.props.prices && !this.props.prices.length)) &&
|
188
|
+
unusedCurrencies.length ? (
|
189
|
+
<Button
|
190
|
+
blank={true}
|
191
|
+
{...(this.props.id && {
|
192
|
+
id: this.props.id + '-add-button',
|
193
|
+
})}
|
194
|
+
type="primary"
|
195
|
+
className="line-height--0 align-self-start"
|
196
|
+
onClick={this.addPriceClick(unusedCurrencies)}
|
197
|
+
circular={true}
|
198
|
+
buttonProps={{
|
199
|
+
...Button.defaultProps?.buttonProps,
|
200
|
+
title:
|
201
|
+
this.props.prices && this.props.prices.length === 0
|
202
|
+
? translations.addPrice
|
203
|
+
: translations.addNewCurrency,
|
204
|
+
}}
|
205
|
+
>
|
206
|
+
<PlusIcon />
|
207
|
+
</Button>
|
208
|
+
) : null}
|
209
|
+
<span className="highlight" />
|
210
|
+
<span className={'bar ' + (this.state.focused ? 'focused' : '')} />
|
211
|
+
{this.renderDefaultValidation()}
|
212
|
+
{this.props.label && (
|
213
|
+
<label
|
214
|
+
className={
|
215
|
+
this.props.prices && this.props.prices ? 'label--focused' : ''
|
216
|
+
}
|
217
|
+
>
|
218
|
+
{this.renderLabel()}
|
219
|
+
</label>
|
220
|
+
)}
|
221
|
+
</div>
|
222
|
+
</InputGroup>
|
223
|
+
);
|
224
|
+
}
|
225
|
+
|
226
|
+
private onCurrencyChanged =
|
227
|
+
(index: number, currentCurrencies: SelectValue[]) => (e) => {
|
228
|
+
let newPrices: MoneyWithCurrency[] = [].concat(this.props.prices);
|
229
|
+
newPrices[index].currency = currentCurrencies.filter(
|
230
|
+
(cc) => cc.value.toString() === e.target.value
|
231
|
+
)[0];
|
232
|
+
this.props.onPricesChange(newPrices);
|
233
|
+
};
|
234
|
+
|
235
|
+
private onTheFlightValidate = (value: string) => {
|
236
|
+
let num = Number(value);
|
237
|
+
const parts = value.split('.');
|
238
|
+
if (parts && parts.length > 1 && parts[parts.length - 1].length > 2) {
|
239
|
+
return false;
|
240
|
+
}
|
241
|
+
if (!isNaN(num)) {
|
242
|
+
return true;
|
243
|
+
}
|
244
|
+
if (num) {
|
245
|
+
return false;
|
246
|
+
}
|
247
|
+
};
|
248
|
+
|
249
|
+
private onPriceChanged =
|
250
|
+
(index: number) => (e: React.ChangeEvent<HTMLInputElement>) => {
|
251
|
+
let newPrices: MoneyWithCurrency[] = [].concat(this.props.prices);
|
252
|
+
let str = e.target.value;
|
253
|
+
let num = Number(str);
|
254
|
+
if (!isNaN(num)) {
|
255
|
+
newPrices[index].value = num;
|
256
|
+
}
|
257
|
+
this.props.onPricesChange(newPrices);
|
258
|
+
if (!this.state.touched) {
|
259
|
+
this.touch();
|
260
|
+
}
|
261
|
+
};
|
262
|
+
|
263
|
+
private removePriceClick = (index: number) => () => {
|
264
|
+
const newPrices = this.props.prices.filter(
|
265
|
+
(price, itemIndex) => itemIndex !== index
|
266
|
+
);
|
267
|
+
this.props.onPricesChange(newPrices);
|
268
|
+
if (newPrices.length === 0 && this.props.required) {
|
269
|
+
this.setInvalid([
|
270
|
+
this.getTranslations(defaultMoneyTranslations).required,
|
271
|
+
]);
|
272
|
+
}
|
273
|
+
if (!this.state.touched) {
|
274
|
+
this.touch();
|
275
|
+
}
|
276
|
+
};
|
277
|
+
|
278
|
+
private addPriceClick = (unusedCurrencies: SelectValue[]) => () => {
|
279
|
+
this.props.onPricesChange(
|
280
|
+
this.props.prices.concat([{ value: 0, currency: unusedCurrencies[0] }])
|
281
|
+
);
|
282
|
+
this.setValid();
|
283
|
+
if (!this.state.touched) {
|
284
|
+
this.touch();
|
285
|
+
}
|
286
|
+
};
|
287
|
+
|
288
|
+
private onFocus = () => this.setState({ focused: true });
|
289
|
+
|
290
|
+
private onBlur = () => this.setState({ focused: false });
|
291
|
+
}
|
292
|
+
|
293
|
+
export const Money = withThemeContext<
|
294
|
+
MoneyProps,
|
295
|
+
InstanceType<typeof MoneyRaw>
|
296
|
+
>(withFormContext<MoneyProps>(MoneyRaw), 'money');
|
297
|
+
|
298
|
+
export default Money;
|
@@ -0,0 +1,186 @@
|
|
1
|
+
import * as ArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_down_24px.svg';
|
2
|
+
|
3
|
+
// Libs
|
4
|
+
import * as React from 'react';
|
5
|
+
|
6
|
+
// Misc
|
7
|
+
import InputGroup from '../inputGroup/InputGroup';
|
8
|
+
import {
|
9
|
+
BaseInputProps,
|
10
|
+
BaseInputState,
|
11
|
+
BaseInput,
|
12
|
+
} from '../base/input/BaseInput';
|
13
|
+
import { withFormContext } from '../form/withFormContext';
|
14
|
+
import { withThemeContext } from '../themeProvider/withThemeContext';
|
15
|
+
import classNames from 'classnames';
|
16
|
+
|
17
|
+
export interface NumberInputProps extends BaseInputProps<HTMLInputElement> {
|
18
|
+
value?: never;
|
19
|
+
onChange?: never;
|
20
|
+
onNumberChange: (num: number) => void;
|
21
|
+
number: number;
|
22
|
+
min?: number;
|
23
|
+
max?: number;
|
24
|
+
unit?: string;
|
25
|
+
}
|
26
|
+
|
27
|
+
export interface NumberInputState extends BaseInputState {
|
28
|
+
currentText: string;
|
29
|
+
}
|
30
|
+
|
31
|
+
export class NumberInputRaw extends BaseInput<
|
32
|
+
NumberInputProps,
|
33
|
+
NumberInputState,
|
34
|
+
HTMLInputElement
|
35
|
+
> {
|
36
|
+
public static defaultProps = (Object.assign({}, BaseInput.defaultProps, {
|
37
|
+
type: 'time',
|
38
|
+
placeholder: '',
|
39
|
+
}) as unknown) as Partial<NumberInputProps>;
|
40
|
+
|
41
|
+
constructor(props: NumberInputProps) {
|
42
|
+
super(props);
|
43
|
+
this.removeUnitClick = this.removeUnitClick.bind(this);
|
44
|
+
this.addUnitClick = this.addUnitClick.bind(this);
|
45
|
+
this.onUnitChanged = this.onUnitChanged.bind(this);
|
46
|
+
}
|
47
|
+
|
48
|
+
public render() {
|
49
|
+
const { unit } = this.props;
|
50
|
+
return (
|
51
|
+
<InputGroup
|
52
|
+
title={this.props.title}
|
53
|
+
className={this.props.inputGroupClassName}
|
54
|
+
tooltip={this.props.tooltip}
|
55
|
+
>
|
56
|
+
<div
|
57
|
+
{...(this.props.id && {
|
58
|
+
id: this.props.id,
|
59
|
+
})}
|
60
|
+
className={
|
61
|
+
'input__base number-input ' +
|
62
|
+
this.getValidationClass() +
|
63
|
+
' ' +
|
64
|
+
(this.props.className ? this.props.className : '')
|
65
|
+
}
|
66
|
+
ref={this.containerRef}
|
67
|
+
>
|
68
|
+
<div className="">
|
69
|
+
<div className="number-input__arrows__container">
|
70
|
+
<button
|
71
|
+
className="plus"
|
72
|
+
onClick={this.addUnitClick}
|
73
|
+
{...(this.props.id && {
|
74
|
+
id: this.props.id + '-add-hours-button',
|
75
|
+
})}
|
76
|
+
tabIndex={0}
|
77
|
+
>
|
78
|
+
<ArrowIcon />
|
79
|
+
</button>
|
80
|
+
<div className="input-padding">
|
81
|
+
<input
|
82
|
+
{...(this.props.id && {
|
83
|
+
id: this.props.id + '-input',
|
84
|
+
})}
|
85
|
+
disabled={this.getDisabled()}
|
86
|
+
required={this.props.required}
|
87
|
+
className={classNames('number-input__time', {
|
88
|
+
filled: this.props.number !== undefined,
|
89
|
+
})}
|
90
|
+
onChange={this.onUnitChanged}
|
91
|
+
value={
|
92
|
+
this.state.currentText !== undefined
|
93
|
+
? this.state.currentText
|
94
|
+
: this.props.number
|
95
|
+
}
|
96
|
+
onBlur={this.onBlur}
|
97
|
+
onFocus={this.handleFocus}
|
98
|
+
type="number"
|
99
|
+
onKeyDown={this.onKeyDown}
|
100
|
+
/>
|
101
|
+
<span className="highlight" />
|
102
|
+
</div>
|
103
|
+
<button
|
104
|
+
className="minus"
|
105
|
+
onClick={this.removeUnitClick}
|
106
|
+
{...(this.props.id && {
|
107
|
+
id: this.props.id + '-subtract-hours-button',
|
108
|
+
})}
|
109
|
+
tabIndex={0}
|
110
|
+
>
|
111
|
+
<ArrowIcon />
|
112
|
+
</button>
|
113
|
+
</div>
|
114
|
+
{unit}
|
115
|
+
</div>
|
116
|
+
{this.renderDefaultValidation()}
|
117
|
+
<span className="highlight" />
|
118
|
+
<span className={'bar ' + (this.state.focused ? 'focused' : '')} />
|
119
|
+
{this.props.label && (
|
120
|
+
<label className={classNames('number-input__label label--focused')}>
|
121
|
+
{this.renderLabel()}
|
122
|
+
</label>
|
123
|
+
)}
|
124
|
+
</div>
|
125
|
+
</InputGroup>
|
126
|
+
);
|
127
|
+
}
|
128
|
+
|
129
|
+
private commitState() {
|
130
|
+
if (this.state.currentText) {
|
131
|
+
var num = Number(this.state.currentText);
|
132
|
+
if (!isNaN(num)) {
|
133
|
+
this.handleLimits(num);
|
134
|
+
}
|
135
|
+
this.setState({ currentText: undefined });
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
private onBlur = () => {
|
140
|
+
this.commitState();
|
141
|
+
this.handleBlur();
|
142
|
+
};
|
143
|
+
|
144
|
+
private removeUnitClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
145
|
+
e.preventDefault();
|
146
|
+
this.handleLimits((this.props.number || 0) - 1);
|
147
|
+
};
|
148
|
+
|
149
|
+
private onUnitChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
|
150
|
+
this.setState({ currentText: e.target.value });
|
151
|
+
};
|
152
|
+
|
153
|
+
private onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
154
|
+
if (e.key === 'Enter') {
|
155
|
+
this.commitState();
|
156
|
+
}
|
157
|
+
};
|
158
|
+
|
159
|
+
private addUnitClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
160
|
+
e.preventDefault();
|
161
|
+
this.handleLimits((this.props.number || 0) + 1);
|
162
|
+
};
|
163
|
+
|
164
|
+
private handleLimits(num: number) {
|
165
|
+
if (this.props.min !== undefined) {
|
166
|
+
if (num - this.props.min <= 0) {
|
167
|
+
this.props.onNumberChange(this.props.min);
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
if (this.props.max !== undefined) {
|
172
|
+
if (this.props.max - num <= 0) {
|
173
|
+
this.props.onNumberChange(this.props.max);
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
this.props.onNumberChange(num);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
export const NumberInput = withThemeContext<
|
182
|
+
NumberInputProps,
|
183
|
+
InstanceType<typeof NumberInputRaw>
|
184
|
+
>(withFormContext<NumberInputProps>(NumberInputRaw), 'numberInput');
|
185
|
+
|
186
|
+
export default NumberInput;
|