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,16 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
|
3
|
+
import Schedule from './Schedule';
|
4
|
+
|
5
|
+
const meta = {
|
6
|
+
title: 'Example/Schedule',
|
7
|
+
component: Schedule,
|
8
|
+
parameters: {
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
|
10
|
+
},
|
11
|
+
} satisfies Meta<typeof Schedule>;
|
12
|
+
|
13
|
+
export default meta;
|
14
|
+
type Story = StoryObj<typeof meta>;
|
15
|
+
|
16
|
+
export const Default: Story = {};
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import moment, { duration, Moment } from 'moment';
|
2
|
+
import * as React from 'react';
|
3
|
+
import { BookingCalendar, BookingCalendarItemT } from '../lib';
|
4
|
+
import { itemsOverlap } from '../lib/components/bookingCalendar/utils';
|
5
|
+
|
6
|
+
function randomIntFromInterval(min: number, max: number) {
|
7
|
+
// min and max included
|
8
|
+
return Math.floor(Math.random() * (max - min + 1) + min);
|
9
|
+
}
|
10
|
+
|
11
|
+
const generateBookingItemsBetweenDates = (
|
12
|
+
from: Moment,
|
13
|
+
till: Moment,
|
14
|
+
count = 50
|
15
|
+
) => {
|
16
|
+
const width = till.valueOf() - from.valueOf();
|
17
|
+
const startMs = from.valueOf();
|
18
|
+
return new Array(count).fill(0).map(() => {
|
19
|
+
const _from = randomIntFromInterval(0, till.valueOf() - startMs) + startMs;
|
20
|
+
const _width = randomIntFromInterval(width / 100, width / 50);
|
21
|
+
return {
|
22
|
+
from: moment(_from),
|
23
|
+
till: moment(_from).add(_width, 'ms'),
|
24
|
+
laneKey:
|
25
|
+
randomIntFromInterval(1, 3) === 1
|
26
|
+
? undefined
|
27
|
+
: randomIntFromInterval(1, 3),
|
28
|
+
} as BookingCalendarItemT;
|
29
|
+
});
|
30
|
+
};
|
31
|
+
|
32
|
+
export const Schedule = () => {
|
33
|
+
const [{ from, till }, setRange] = React.useState({
|
34
|
+
from: moment().startOf('day').subtract(0, 'day'),
|
35
|
+
till: moment().startOf('day').add(7, 'days'),
|
36
|
+
});
|
37
|
+
|
38
|
+
const bookings = React.useMemo(
|
39
|
+
() =>
|
40
|
+
generateBookingItemsBetweenDates(
|
41
|
+
from.clone().subtract(10, 'day'),
|
42
|
+
till.clone().add(10, 'day')
|
43
|
+
),
|
44
|
+
[]
|
45
|
+
);
|
46
|
+
const items = React.useMemo(
|
47
|
+
() => bookings.filter((b) => itemsOverlap(b, { from, till })),
|
48
|
+
[from, till, bookings]
|
49
|
+
);
|
50
|
+
return (
|
51
|
+
<div className="container">
|
52
|
+
<BookingCalendar
|
53
|
+
bookings={items}
|
54
|
+
from={from}
|
55
|
+
till={till}
|
56
|
+
step={duration(1, 'day')}
|
57
|
+
onRangeChange={setRange}
|
58
|
+
// lanesCount={3}
|
59
|
+
lanesSource={new Array(3).fill(0).map((_, index) => ({
|
60
|
+
laneKey: index,
|
61
|
+
data: { data: 'test' },
|
62
|
+
rowClassName: 'test',
|
63
|
+
}))}
|
64
|
+
zoomLevels={[
|
65
|
+
{ step: duration(1, 'day'), label: 'Day' },
|
66
|
+
{ step: duration(1, 'week'), label: 'Week' },
|
67
|
+
]}
|
68
|
+
/>
|
69
|
+
</div>
|
70
|
+
);
|
71
|
+
};
|
72
|
+
|
73
|
+
export default Schedule;
|
@@ -0,0 +1,417 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import {
|
3
|
+
Form,
|
4
|
+
Select,
|
5
|
+
Submit,
|
6
|
+
Checkbox,
|
7
|
+
Radio,
|
8
|
+
RadioContainer,
|
9
|
+
MoneyWithCurrency,
|
10
|
+
OpeningHoursDayObj,
|
11
|
+
OpeningHoursSpecialDayObj,
|
12
|
+
InputHeader,
|
13
|
+
Button,
|
14
|
+
ButtonTypes,
|
15
|
+
Tags,
|
16
|
+
Tag,
|
17
|
+
SelectValue,
|
18
|
+
ButtonProps,
|
19
|
+
FormValidationSummary,
|
20
|
+
ValidatorTypes,
|
21
|
+
} from '../lib';
|
22
|
+
|
23
|
+
export interface TestProps {}
|
24
|
+
|
25
|
+
export interface TestState {
|
26
|
+
name: string;
|
27
|
+
gender: 'M' | 'F' | '';
|
28
|
+
email: string;
|
29
|
+
age: string;
|
30
|
+
min1: string;
|
31
|
+
checkbox1: boolean;
|
32
|
+
checkbox2: boolean;
|
33
|
+
validateFormSubmit: boolean;
|
34
|
+
food: string;
|
35
|
+
drink: string;
|
36
|
+
touchOn: 'blur' | 'focus';
|
37
|
+
submitDisablesInputs: boolean;
|
38
|
+
simulateUnmount: boolean;
|
39
|
+
prices1: MoneyWithCurrency[];
|
40
|
+
prices2: MoneyWithCurrency[];
|
41
|
+
time1: Date;
|
42
|
+
time2: Date;
|
43
|
+
openingHours: OpeningHoursDayObj;
|
44
|
+
openingHoursWeek: OpeningHoursDayObj[];
|
45
|
+
openingHoursWeekDay: OpeningHoursDayObj;
|
46
|
+
openingHoursSpecial: OpeningHoursSpecialDayObj[];
|
47
|
+
website: string;
|
48
|
+
tags: Tag[];
|
49
|
+
selectedValues: SelectValue[];
|
50
|
+
multipleValues: SelectValue[];
|
51
|
+
multipleReadonly: boolean;
|
52
|
+
textAreaText: string;
|
53
|
+
}
|
54
|
+
|
55
|
+
export class AgeValidator {
|
56
|
+
public static instance = new AgeValidator();
|
57
|
+
public Validate(
|
58
|
+
value: string,
|
59
|
+
isRequired: boolean,
|
60
|
+
addError: (error: string) => void
|
61
|
+
): boolean {
|
62
|
+
let num = Number(value);
|
63
|
+
if (!isNaN(num)) {
|
64
|
+
if (num <= 0) {
|
65
|
+
addError('Not born yet?');
|
66
|
+
return false;
|
67
|
+
}
|
68
|
+
if (num > 122) {
|
69
|
+
addError('Older than Jeanne Calment? Really?');
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
return true;
|
73
|
+
} else {
|
74
|
+
addError('Invalid age');
|
75
|
+
}
|
76
|
+
return false;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
const tagsValidators: ValidatorTypes[] = ['email'];
|
81
|
+
|
82
|
+
const types: ButtonTypes[] = [
|
83
|
+
'primary',
|
84
|
+
'warning',
|
85
|
+
'error',
|
86
|
+
'info',
|
87
|
+
'success',
|
88
|
+
'gray',
|
89
|
+
'white',
|
90
|
+
'none',
|
91
|
+
];
|
92
|
+
const ButtonsShowcase: React.FC<ButtonProps> = (props) => {
|
93
|
+
return (
|
94
|
+
<div
|
95
|
+
className="px-2"
|
96
|
+
style={{
|
97
|
+
backgroundColor: 'rgb(248, 247, 247)',
|
98
|
+
display: 'flex',
|
99
|
+
flexWrap: 'wrap',
|
100
|
+
}}
|
101
|
+
>
|
102
|
+
{types.map((item, index) => (
|
103
|
+
<Button key={index} type={item} {...props}>
|
104
|
+
{item}
|
105
|
+
</Button>
|
106
|
+
))}
|
107
|
+
</div>
|
108
|
+
);
|
109
|
+
};
|
110
|
+
|
111
|
+
ButtonsShowcase.defaultProps = {
|
112
|
+
className: 'my-2 mr-2',
|
113
|
+
};
|
114
|
+
|
115
|
+
export class Test extends React.PureComponent<TestProps, TestState> {
|
116
|
+
private form: Form;
|
117
|
+
|
118
|
+
private initialState: TestState = {
|
119
|
+
gender: '',
|
120
|
+
name: '',
|
121
|
+
email: '',
|
122
|
+
age: '',
|
123
|
+
min1: '',
|
124
|
+
checkbox1: true,
|
125
|
+
checkbox2: false,
|
126
|
+
validateFormSubmit: true,
|
127
|
+
food: 'breakfast',
|
128
|
+
drink: 'breakfast',
|
129
|
+
touchOn: 'focus',
|
130
|
+
submitDisablesInputs: true,
|
131
|
+
simulateUnmount: false,
|
132
|
+
prices1: [],
|
133
|
+
prices2: [],
|
134
|
+
time1: new Date(),
|
135
|
+
time2: new Date(),
|
136
|
+
openingHours: {
|
137
|
+
times: [],
|
138
|
+
},
|
139
|
+
openingHoursWeek: [],
|
140
|
+
openingHoursWeekDay: {
|
141
|
+
times: [],
|
142
|
+
},
|
143
|
+
openingHoursSpecial: [],
|
144
|
+
website: '',
|
145
|
+
tags: [],
|
146
|
+
selectedValues: [],
|
147
|
+
multipleValues: [
|
148
|
+
{ value: 'One option' },
|
149
|
+
{ value: 'Second option' },
|
150
|
+
{ value: 'Third option' },
|
151
|
+
{ value: 'one more option' },
|
152
|
+
{ value: 'rly long last option' },
|
153
|
+
],
|
154
|
+
multipleReadonly: false,
|
155
|
+
textAreaText: '',
|
156
|
+
};
|
157
|
+
|
158
|
+
constructor(props: TestProps) {
|
159
|
+
super(props);
|
160
|
+
this.state = this.initialState;
|
161
|
+
this.handleGenderChange = this.handleGenderChange.bind(this);
|
162
|
+
this.submitForm = this.submitForm.bind(this);
|
163
|
+
this.dynamicSubmitSuccessForm = this.dynamicSubmitSuccessForm.bind(this);
|
164
|
+
this.dynamicSubmitErrorForm = this.dynamicSubmitErrorForm.bind(this);
|
165
|
+
}
|
166
|
+
|
167
|
+
public render() {
|
168
|
+
let time2Max = new Date();
|
169
|
+
time2Max.setHours(time2Max.getHours() + 1);
|
170
|
+
time2Max.setMinutes(time2Max.getMinutes() + 5);
|
171
|
+
|
172
|
+
let time2Min = new Date();
|
173
|
+
time2Min.setHours(time2Min.getHours() - 1);
|
174
|
+
time2Min.setMinutes(time2Min.getMinutes() - 5);
|
175
|
+
|
176
|
+
return (
|
177
|
+
<div className="container">
|
178
|
+
<div className="row mt-5">
|
179
|
+
<div className="col-lg-12">
|
180
|
+
<div className="card">
|
181
|
+
<div className="card-block p-0 input__form">
|
182
|
+
<Checkbox
|
183
|
+
label="Turn form validation on or off"
|
184
|
+
onChecked={this.formValidationToggle}
|
185
|
+
checked={this.state.validateFormSubmit}
|
186
|
+
title="Validate form submit"
|
187
|
+
/>
|
188
|
+
<RadioContainer title="Touch on">
|
189
|
+
<Radio
|
190
|
+
name="touch"
|
191
|
+
value="blur"
|
192
|
+
label="Blur"
|
193
|
+
result={this.state.touchOn}
|
194
|
+
onChecked={this.touchOnChecked}
|
195
|
+
/>
|
196
|
+
<Radio
|
197
|
+
name="touch"
|
198
|
+
value="focus"
|
199
|
+
label="Focus"
|
200
|
+
result={this.state.touchOn}
|
201
|
+
onChecked={this.touchOnChecked}
|
202
|
+
/>
|
203
|
+
</RadioContainer>
|
204
|
+
<Checkbox
|
205
|
+
label="Disables inputs"
|
206
|
+
onChecked={this.disablesInputsChecked}
|
207
|
+
checked={this.state.submitDisablesInputs}
|
208
|
+
title="Submit"
|
209
|
+
/>
|
210
|
+
<Checkbox
|
211
|
+
label="Unmount"
|
212
|
+
onChecked={this.simulateUnmountChecked}
|
213
|
+
checked={this.state.simulateUnmount}
|
214
|
+
title="Simulate"
|
215
|
+
/>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
<div className="row my-5">
|
221
|
+
<div className="col-lg-12">
|
222
|
+
<div className={'card '}>
|
223
|
+
<div className="card-block p-0">
|
224
|
+
{!this.state.simulateUnmount && (
|
225
|
+
<Form
|
226
|
+
noValidate={true}
|
227
|
+
ref={this.formRef}
|
228
|
+
onSubmit={this.submitForm}
|
229
|
+
extraComponents={{
|
230
|
+
'extra-check': {
|
231
|
+
validation: {
|
232
|
+
isValid: this.state.checkbox2,
|
233
|
+
errors: this.state.checkbox2
|
234
|
+
? []
|
235
|
+
: ['Please check custom context'],
|
236
|
+
name: 'Extra context',
|
237
|
+
},
|
238
|
+
componentApi: undefined,
|
239
|
+
},
|
240
|
+
}}
|
241
|
+
>
|
242
|
+
<InputHeader
|
243
|
+
icon={<i className="material-icons md-48">edit</i>}
|
244
|
+
title={'Example form'}
|
245
|
+
subTitle={
|
246
|
+
"And this is subtitle. There's also icon on the left"
|
247
|
+
}
|
248
|
+
showExpandAll={true}
|
249
|
+
type="hero"
|
250
|
+
collapsible={true}
|
251
|
+
collapsedDefault={false}
|
252
|
+
mainButton={
|
253
|
+
<Submit
|
254
|
+
type="primary"
|
255
|
+
onClick={this.submitForm}
|
256
|
+
validateForm={this.state.validateFormSubmit}
|
257
|
+
>
|
258
|
+
Submit
|
259
|
+
</Submit>
|
260
|
+
}
|
261
|
+
extraButtons={[
|
262
|
+
<Button key={1} dropdown={true} onClick={this.touchAll}>
|
263
|
+
Touch all
|
264
|
+
</Button>,
|
265
|
+
<Button
|
266
|
+
key={2}
|
267
|
+
dropdown={true}
|
268
|
+
onClick={this.unTouchAll}
|
269
|
+
>
|
270
|
+
Un-touch all
|
271
|
+
</Button>,
|
272
|
+
]}
|
273
|
+
>
|
274
|
+
<InputHeader
|
275
|
+
className={''}
|
276
|
+
title={'Multiple'}
|
277
|
+
collapsible={true}
|
278
|
+
collapsedDefault={false}
|
279
|
+
>
|
280
|
+
{true && (
|
281
|
+
<Tags
|
282
|
+
title="Tags only email"
|
283
|
+
required={true}
|
284
|
+
validationName="Tags only email"
|
285
|
+
label="With label"
|
286
|
+
maxTags={1}
|
287
|
+
allowNew={true}
|
288
|
+
readOnly={this.state.multipleReadonly}
|
289
|
+
tags={this.state.tags}
|
290
|
+
onTagsChanged={this.tagsChanged}
|
291
|
+
suggestionsEmptyComponent={null}
|
292
|
+
validators={tagsValidators}
|
293
|
+
existingTags={[
|
294
|
+
{ id: 1, name: 'petokottas@gmail.com' },
|
295
|
+
]}
|
296
|
+
valueNotAddedError={'Email not added'}
|
297
|
+
/>
|
298
|
+
)}
|
299
|
+
{false && (
|
300
|
+
<Select
|
301
|
+
required={true}
|
302
|
+
label="One or more"
|
303
|
+
title="Multiselect"
|
304
|
+
validationName="Multiselect"
|
305
|
+
multiple={true}
|
306
|
+
defaultEmpty={true}
|
307
|
+
readOnly={this.state.multipleReadonly}
|
308
|
+
selectedValues={this.state.selectedValues}
|
309
|
+
values={this.state.multipleValues}
|
310
|
+
onSelectedValuesChange={this.selectedValuesChanged}
|
311
|
+
/>
|
312
|
+
)}
|
313
|
+
<Checkbox
|
314
|
+
required={true}
|
315
|
+
label="Smart"
|
316
|
+
onChecked={this.checkbox1Checked}
|
317
|
+
checked={this.state.checkbox1}
|
318
|
+
title="Dress code"
|
319
|
+
/>
|
320
|
+
<Checkbox
|
321
|
+
label="Foreign context check"
|
322
|
+
onChecked={this.checkbox2Checked}
|
323
|
+
checked={this.state.checkbox2}
|
324
|
+
title="Custom context"
|
325
|
+
/>
|
326
|
+
</InputHeader>
|
327
|
+
<FormValidationSummary />
|
328
|
+
</InputHeader>
|
329
|
+
</Form>
|
330
|
+
)}
|
331
|
+
</div>
|
332
|
+
</div>
|
333
|
+
</div>
|
334
|
+
</div>
|
335
|
+
</div>
|
336
|
+
);
|
337
|
+
}
|
338
|
+
|
339
|
+
private checkbox1Checked = () =>
|
340
|
+
this.setState({ checkbox1: !this.state.checkbox1 });
|
341
|
+
|
342
|
+
private checkbox2Checked = () =>
|
343
|
+
this.setState({ checkbox2: !this.state.checkbox2 });
|
344
|
+
|
345
|
+
private formRef = (el: Form) => (this.form = el);
|
346
|
+
|
347
|
+
private selectedValuesChanged = (selectedValues: SelectValue[]) =>
|
348
|
+
this.setState({ selectedValues });
|
349
|
+
|
350
|
+
private tagsChanged = (tags: Tag[]) => this.setState({ tags });
|
351
|
+
|
352
|
+
private unTouchAll = (e: React.MouseEvent<HTMLButtonElement>) => {
|
353
|
+
e.preventDefault();
|
354
|
+
this.form.unTouchAll();
|
355
|
+
};
|
356
|
+
|
357
|
+
private simulateUnmountChecked = () =>
|
358
|
+
this.setState({ simulateUnmount: !this.state.simulateUnmount });
|
359
|
+
|
360
|
+
private disablesInputsChecked = () =>
|
361
|
+
this.setState({ submitDisablesInputs: !this.state.submitDisablesInputs });
|
362
|
+
|
363
|
+
private touchOnChecked = (value: 'blur' | 'focus') =>
|
364
|
+
this.setState({ touchOn: value });
|
365
|
+
|
366
|
+
private formValidationToggle = () =>
|
367
|
+
this.setState({ validateFormSubmit: !this.state.validateFormSubmit });
|
368
|
+
|
369
|
+
private touchAll = (e: React.MouseEvent<HTMLButtonElement>) => {
|
370
|
+
e.preventDefault();
|
371
|
+
this.form.touchAll();
|
372
|
+
};
|
373
|
+
|
374
|
+
private handleGenderChange(e: React.ChangeEvent<HTMLSelectElement>) {
|
375
|
+
const val = e.target.value;
|
376
|
+
if (val === 'M' || val === 'F') {
|
377
|
+
this.setState({ gender: val });
|
378
|
+
}
|
379
|
+
}
|
380
|
+
|
381
|
+
private submitForm(e?: React.MouseEvent<HTMLButtonElement>) {
|
382
|
+
e && e.preventDefault();
|
383
|
+
this.setState(this.initialState);
|
384
|
+
}
|
385
|
+
|
386
|
+
private dynamicSubmitSuccessForm(
|
387
|
+
e: React.MouseEvent<HTMLButtonElement>,
|
388
|
+
submitting: () => void,
|
389
|
+
error: () => void,
|
390
|
+
success: () => void,
|
391
|
+
reset: () => void
|
392
|
+
) {
|
393
|
+
e.preventDefault();
|
394
|
+
submitting();
|
395
|
+
setTimeout(() => {
|
396
|
+
error();
|
397
|
+
setTimeout(() => reset(), 3000);
|
398
|
+
}, 1000);
|
399
|
+
}
|
400
|
+
|
401
|
+
private dynamicSubmitErrorForm(
|
402
|
+
e: React.MouseEvent<HTMLButtonElement>,
|
403
|
+
submitting: () => void,
|
404
|
+
error: () => void,
|
405
|
+
success: () => void,
|
406
|
+
reset: () => void
|
407
|
+
) {
|
408
|
+
e.preventDefault();
|
409
|
+
submitting();
|
410
|
+
setTimeout(() => {
|
411
|
+
success();
|
412
|
+
setTimeout(() => reset(), 3000);
|
413
|
+
}, 1000);
|
414
|
+
}
|
415
|
+
}
|
416
|
+
|
417
|
+
export default Test;
|
package/tsconfig.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
-
"
|
4
|
-
"outDir": "
|
3
|
+
"rootDir": "./src/lib",
|
4
|
+
"outDir": "./dist",
|
5
|
+
"declarationDir": "./dist/dts",
|
5
6
|
"baseUrl": ".",
|
6
7
|
"moduleResolution": "node",
|
7
|
-
"target": "
|
8
|
-
"module": "
|
8
|
+
"target": "es2016",
|
9
|
+
"module": "es6",
|
9
10
|
"jsx": "react",
|
10
11
|
"experimentalDecorators": true,
|
11
12
|
"allowSyntheticDefaultImports": true,
|
@@ -15,23 +16,9 @@
|
|
15
16
|
"noUnusedLocals": true,
|
16
17
|
"declaration": true,
|
17
18
|
"lib": ["es7", "dom"],
|
18
|
-
"types": ["
|
19
|
-
"
|
20
|
-
|
21
|
-
"structure/*": ["./ClientApp/components/structure/*"],
|
22
|
-
"pages/*": ["./ClientApp/components/pages/*"],
|
23
|
-
"reduxStores/*": ["./ClientApp/redux/*"],
|
24
|
-
"styleVars/*": ["./ClientApp/scss/variables/*"],
|
25
|
-
"types/*": ["./ClientApp/types/*"],
|
26
|
-
"assets/*": ["./ClientApp/assets/*"],
|
27
|
-
// Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions.
|
28
|
-
// We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them).
|
29
|
-
"history": ["./node_modules/@types/history/index"],
|
30
|
-
"redux": ["./node_modules/@types/redux/index"],
|
31
|
-
"react-day-picker": [
|
32
|
-
"./src/demo/ClientApp/declartions/react-day-picker.d.ts"
|
33
|
-
]
|
34
|
-
}
|
19
|
+
"types": ["node"],
|
20
|
+
"esModuleInterop": true,
|
21
|
+
"forceConsistentCasingInFileNames": true
|
35
22
|
},
|
36
|
-
"
|
23
|
+
"include": ["src/**/*", ".storybook/theme.ts"]
|
37
24
|
}
|
package/typedoc.json
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const webpack = require('webpack');
|
3
|
+
var isLocalBuild =
|
4
|
+
process.env &&
|
5
|
+
process.env.NODE_ENV &&
|
6
|
+
process.env.NODE_ENV.trim().toString() == 'local';
|
7
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
target: 'web',
|
11
|
+
resolve: {
|
12
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
13
|
+
},
|
14
|
+
entry: {
|
15
|
+
'guestbell-forms': './src/lib/index.ts',
|
16
|
+
'guestbell-forms': './src/lib/scss/index.scss',
|
17
|
+
},
|
18
|
+
module: {
|
19
|
+
rules: [
|
20
|
+
{
|
21
|
+
test: /\.(j|t)sx?$/,
|
22
|
+
exclude: /node_modules/,
|
23
|
+
use: {
|
24
|
+
loader: 'babel-loader',
|
25
|
+
options: {
|
26
|
+
cacheDirectory: true,
|
27
|
+
babelrc: false,
|
28
|
+
presets: [
|
29
|
+
[
|
30
|
+
'@babel/preset-env',
|
31
|
+
{ targets: { browsers: 'last 2 versions' } }, // or whatever your project requires
|
32
|
+
],
|
33
|
+
'@babel/preset-typescript',
|
34
|
+
'@babel/preset-react',
|
35
|
+
],
|
36
|
+
plugins: [
|
37
|
+
// plugin-proposal-decorators is only needed if you're using experimental decorators in TypeScript
|
38
|
+
// ["@babel/plugin-proposal-decorators", { legacy: true }],
|
39
|
+
['@babel/plugin-proposal-class-properties', { loose: true }],
|
40
|
+
'react-hot-loader/babel',
|
41
|
+
],
|
42
|
+
},
|
43
|
+
},
|
44
|
+
},
|
45
|
+
/*{
|
46
|
+
test: /\.tsx?$/,
|
47
|
+
include: /src/,
|
48
|
+
use: {
|
49
|
+
loader: 'ts-loader',//'awesome-typescript-loader?silent=true',
|
50
|
+
options: {
|
51
|
+
// disable type checker - we will use it in fork plugin
|
52
|
+
transpileOnly: true,
|
53
|
+
experimentalWatchApi: true,
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},*/
|
57
|
+
{
|
58
|
+
test: /\.(scss|css)$/,
|
59
|
+
use: [
|
60
|
+
isLocalBuild
|
61
|
+
? {
|
62
|
+
loader: 'style-loader',
|
63
|
+
}
|
64
|
+
: {
|
65
|
+
loader: MiniCssExtractPlugin.loader,
|
66
|
+
},
|
67
|
+
{
|
68
|
+
loader: 'css-loader',
|
69
|
+
options: {
|
70
|
+
sourceMap: true,
|
71
|
+
},
|
72
|
+
},
|
73
|
+
{
|
74
|
+
loader: 'postcss-loader',
|
75
|
+
options: {
|
76
|
+
sourceMap: true,
|
77
|
+
postcssOptions: {
|
78
|
+
plugins: (loader) => [require('autoprefixer')()],
|
79
|
+
},
|
80
|
+
},
|
81
|
+
},
|
82
|
+
{
|
83
|
+
loader: 'sass-loader',
|
84
|
+
options: {
|
85
|
+
sourceMap: true,
|
86
|
+
},
|
87
|
+
},
|
88
|
+
],
|
89
|
+
},
|
90
|
+
{
|
91
|
+
test: /\.(svg)$/,
|
92
|
+
use: {
|
93
|
+
loader: 'svg-react-loader',
|
94
|
+
options: {
|
95
|
+
query: {
|
96
|
+
props: {
|
97
|
+
className: 'material-design-icon',
|
98
|
+
},
|
99
|
+
},
|
100
|
+
},
|
101
|
+
},
|
102
|
+
include: /material-design-icons/,
|
103
|
+
},
|
104
|
+
{
|
105
|
+
test: /\.(png|jpg|jpeg|gif|svg)$/,
|
106
|
+
use: 'url-loader?limit=8192&name=images/[name]-[hash].[ext]',
|
107
|
+
exclude: /material-design-icons/,
|
108
|
+
},
|
109
|
+
],
|
110
|
+
},
|
111
|
+
output: {
|
112
|
+
path: path.join(__dirname, '../build/dist'),
|
113
|
+
filename: '[name].js',
|
114
|
+
publicPath: '../build/', // Webpack dev middleware, if enabled, handles requests for this URL prefix
|
115
|
+
libraryTarget: 'umd',
|
116
|
+
},
|
117
|
+
plugins: [
|
118
|
+
new MiniCssExtractPlugin({
|
119
|
+
filename: '[name].css',
|
120
|
+
}),
|
121
|
+
// new ForkTsCheckerWebpackPlugin(),
|
122
|
+
//new DtsBundlePlugin()
|
123
|
+
],
|
124
|
+
};
|
125
|
+
|
126
|
+
function DtsBundlePlugin() {}
|
127
|
+
DtsBundlePlugin.prototype.apply = function (compiler) {
|
128
|
+
compiler.plugin('done', function () {
|
129
|
+
var dts = require('dts-bundle');
|
130
|
+
|
131
|
+
dts.bundle({
|
132
|
+
name: 'guestbell-forms',
|
133
|
+
main: 'src/lib/index.d.ts',
|
134
|
+
out: '../index.d.ts',
|
135
|
+
//removeSource: true,
|
136
|
+
outputAsModuleFolder: true, // to use npm in-package typings
|
137
|
+
});
|
138
|
+
});
|
139
|
+
};
|