@laerdal/life-react-components 1.11.0-dev.13.full → 1.11.0-dev.16

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.
Files changed (35) hide show
  1. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs +24 -2
  2. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
  3. package/dist/GlobalNavigationBar/mobile/CommonStyles.d.ts +5 -0
  4. package/dist/GlobalNavigationBar/mobile/CommonStyles.js +8 -2
  5. package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
  6. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.cjs +55 -0
  7. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.cjs.map +1 -0
  8. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.d.ts +6 -0
  9. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.js +36 -0
  10. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.js.map +1 -0
  11. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs +28 -57
  12. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +1 -1
  13. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js +28 -53
  14. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +1 -1
  15. package/dist/GlobalNavigationBar/types.d.ts +3 -1
  16. package/dist/InputFields/DatepickerField.cjs +2 -2
  17. package/dist/InputFields/DatepickerField.cjs.map +1 -1
  18. package/dist/InputFields/DatepickerField.js +2 -2
  19. package/dist/InputFields/DatepickerField.js.map +1 -1
  20. package/dist/Switcher/MobileCustomMenuContent.cjs +56 -0
  21. package/dist/Switcher/MobileCustomMenuContent.cjs.map +1 -0
  22. package/dist/Switcher/MobileCustomMenuContent.d.ts +8 -0
  23. package/dist/Switcher/MobileCustomMenuContent.js +39 -0
  24. package/dist/Switcher/MobileCustomMenuContent.js.map +1 -0
  25. package/dist/Switcher/MobileSwitcherMenu.cjs +17 -4
  26. package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
  27. package/dist/Switcher/MobileSwitcherMenu.d.ts +5 -2
  28. package/dist/Switcher/MobileSwitcherMenu.js +16 -4
  29. package/dist/Switcher/MobileSwitcherMenu.js.map +1 -1
  30. package/dist/common/ScrollableContainer.cjs +44 -0
  31. package/dist/common/ScrollableContainer.cjs.map +1 -0
  32. package/dist/common/ScrollableContainer.d.ts +1 -0
  33. package/dist/common/ScrollableContainer.js +28 -0
  34. package/dist/common/ScrollableContainer.js.map +1 -0
  35. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/InputFields/DatepickerField.tsx"],"names":["React","styled","DatePicker","en","moment","COLORS","Calendar","TechnicalWarning","DatepickerFieldHeader","ComponentTextStyle","focusStyles","scrollBarStyling","ErrorMessage","InputFieldStyling","InputWrapper","ComponentMStyling","ComponentSStyling","Z_INDEXES","useFocusVisibleRef","Size","DatePickerContainer","div","dropdown","props","margin","primary_20","neutral_20","neutral_200","yearPicker","Bold","neutral_600","Small","Regular","white","primary_700","primary_500","neutral_700","neutral_100","IconWrapper","focus","DatepickerRow","StyledInputFieldStyling","neutral_500","primary_300","primary_200","primary_100","primary_800","neutral_300","DatepickerField","forwardRef","ref","disabled","readOnly","onChange","invalid","value","validationMessage","dateFormat","autoComplete","placeholder","required","yearsBeforeCurrentDate","yearsAfterCurrentDate","onBlur","rest","inputRef","datepickerRef","useRef","useState","activeMonthPage","setActiveMonthPage","yearPickerMode","setYearPickerMode","openAt","setOpenAt","open","setOpen","useEffect","current","format","selectedDate","document","getElementsByClassName","dropdownParent","parentElement","scrollTop","offsetTop","offsetHeight","useImperativeHandle","handleCalendarClose","blur","handleCalendarOpen","maxDate","Date","setFullYear","getFullYear","minDate","itemsNumber","Math","round","handleKeyDown","e","key","handleBlur","currentTarget","contains","relatedTarget","newDate","setMonth","undefined","params","createElement","customHeaderCount","display","setSelectionRange","critical_400"],"mappings":";;;;;;;;;;;;;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from 'react';\n\n/**\n * Import third-party libraries.\n */\nimport styled from 'styled-components';\nimport DatePicker from 'react-datepicker';\nimport en from 'date-fns/locale/en-GB';\nimport moment from 'moment';\n\n/**\n * Import custom components.\n */\nimport COLORS from '../styles/colors';\nimport {Calendar, TechnicalWarning} from '../icons/systemicons/SystemIcons';\nimport {DatepickerFieldHeader, DatepickerFieldHeaderParams} from './DatepickerFieldHeader';\nimport {ComponentTextStyle, focusStyles, scrollBarStyling} from '../styles';\n\n/**\n * Import custom styles.\n */\nimport {ErrorMessage, InputFieldStyling, InputWrapper} from './styling';\nimport 'react-datepicker/dist/react-datepicker.css';\nimport {ComponentMStyling, ComponentSStyling} from '../styles';\nimport {Z_INDEXES} from '../styles';\nimport {useFocusVisibleRef} from '../common';\nimport {Size} from '../types';\n\n/**\n * Add custom types.\n */\ntype DatepickerFieldProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'size' | 'onBlur'> & {\n value?: Date;\n onChange?: (date: Date) => void;\n onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;\n\n invalid?: boolean;\n dateFormat?: string;\n validationMessage?: string;\n autoComplete?: string;\n placeholder?: string;\n yearPicker?: boolean;\n yearsBeforeCurrentDate?: number;\n yearsAfterCurrentDate?: number;\n margin?: string;\n};\n\n/**\n * Add custom styles.\n */\nconst DatePickerContainer = styled.div<{ yearPicker: boolean; margin: string }>`\n .react-datepicker-popper {\n z-index: ${Z_INDEXES.dropdown};\n }\n\n > div {\n display: block;\n\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n .react-datepicker {\n box-sizing: border-box;\n box-shadow: 0px 2px 4px rgb(0 0 0 / 15%);\n border: 1px solid #e5e5e5;\n }\n .react-datepicker__input-container{\n z-index: 0;\n }\n\n .react-datepicker__navigation {\n line-height: normal;\n text-indent: inherit;\n border: none;\n border-radius: 4px;\n height: 32px;\n width: 32px;\n outline: none;\n margin: 0px;\n color: transparent;\n\n &:hover {\n background: ${COLORS.primary_20};\n\n &.react-datepicker__navigation--previous::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M15.1975 4.46474C15.5885 4.85478 15.5893 5.48794 15.1993 5.87895L8.92124 12.1727L15.1993 18.4665C15.5893 18.8575 15.5885 19.4907 15.1975 19.8807C14.8065 20.2708 14.1734 20.27 13.7833 19.879L6.8008 12.879C6.41145 12.4886 6.41145 11.8568 6.8008 11.4665L13.7833 4.46651C14.1734 4.0755 14.8065 4.0747 15.1975 4.46474Z' fill='%23215369' /%3E%3C/svg%3E\");\n }\n\n &.react-datepicker__navigation--next::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M9.24214 19.8807C8.85113 19.4907 8.85034 18.8575 9.24038 18.4665L15.5184 12.1727L9.24037 5.87895C8.85034 5.48794 8.85113 4.85478 9.24214 4.46474C9.63315 4.0747 10.2663 4.07549 10.6564 4.46651L17.6389 11.4665C18.0282 11.8568 18.0282 12.4886 17.6389 12.879L10.6564 19.879C10.2663 20.27 9.63316 20.2708 9.24214 19.8807Z' fill='%23215369' /%3E%3C/svg%3E\");\n }\n }\n\n &:focus {\n ${focusStyles}\n &.react-datepicker__navigation--next::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M9.24214 19.8807C8.85113 19.4907 8.85034 18.8575 9.24038 18.4665L15.5184 12.1727L9.24037 5.87895C8.85034 5.48794 8.85113 4.85478 9.24214 4.46474C9.63315 4.0747 10.2663 4.07549 10.6564 4.46651L17.6389 11.4665C18.0282 11.8568 18.0282 12.4886 17.6389 12.879L10.6564 19.879C10.2663 20.27 9.63316 20.2708 9.24214 19.8807Z' fill='%23163746' /%3E%3C/svg%3E\");\n }\n\n &.react-datepicker__navigation--previous::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M15.1975 4.46474C15.5885 4.85478 15.5893 5.48794 15.1993 5.87895L8.92124 12.1727L15.1993 18.4665C15.5893 18.8575 15.5885 19.4907 15.1975 19.8807C14.8065 20.2708 14.1734 20.27 13.7833 19.879L6.8008 12.879C6.41145 12.4886 6.41145 11.8568 6.8008 11.4665L13.7833 4.46651C14.1734 4.0755 14.8065 4.0747 15.1975 4.46474Z' fill='%23163746' /%3E%3C/svg%3E\");\n }\n }\n\n &::before {\n text-align: center;\n display: inline-block;\n content: '';\n height: 32px;\n width: 32px;\n vertical-align: middle;\n }\n\n &.react-datepicker__navigation--next::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M9.24214 19.8807C8.85113 19.4907 8.85034 18.8575 9.24038 18.4665L15.5184 12.1727L9.24037 5.87895C8.85034 5.48794 8.85113 4.85478 9.24214 4.46474C9.63315 4.0747 10.2663 4.07549 10.6564 4.46651L17.6389 11.4665C18.0282 11.8568 18.0282 12.4886 17.6389 12.879L10.6564 19.879C10.2663 20.27 9.63316 20.2708 9.24214 19.8807Z' fill='%23666666' /%3E%3C/svg%3E\");\n }\n\n &.react-datepicker__navigation--previous::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M15.1975 4.46474C15.5885 4.85478 15.5893 5.48794 15.1993 5.87895L8.92124 12.1727L15.1993 18.4665C15.5893 18.8575 15.5885 19.4907 15.1975 19.8807C14.8065 20.2708 14.1734 20.27 13.7833 19.879L6.8008 12.879C6.41145 12.4886 6.41145 11.8568 6.8008 11.4665L13.7833 4.46651C14.1734 4.0755 14.8065 4.0747 15.1975 4.46474Z' fill='%23666666' /%3E%3C/svg%3E\");\n }\n }\n\n .react-datepicker__month-container,\n .react-datepicker__year--container {\n width: 336px;\n }\n\n .react-datepicker__month {\n margin: 0px;\n }\n\n .react-datepicker__triangle {\n left: 50% !important;\n display: none;\n }\n\n .react-datepicker-popper[data-placement^='bottom'] {\n margin-top: 0;\n }\n\n .react-datepicker-popper[data-placement^='bottom'] .react-datepicker__triangle {\n border-bottom-color: ${COLORS.neutral_20};\n }\n\n .react-datepicker__header {\n border-bottom: 1px solid ${COLORS.neutral_200};\n background: ${COLORS.neutral_20};\n height: ${(props) => (!props.yearPicker ? '96px' : '54px')};\n padding-top: 0px;\n }\n\n .react-datepicker__current-month {\n height: 48px;\n display: inline-flex;\n align-items: center;\n margin-right: 5px;\n\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n\n .react-datepicker__year {\n max-height: 300px;\n overflow-y: scroll;\n\n ${scrollBarStyling(Size.Small)}\n }\n\n .react-datepicker__year-wrapper {\n max-width: 100%;\n justify-content: space-around;\n }\n\n .react-datepicker__day-name {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n height: 48px;\n margin: 0px;\n width: 48px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n }\n\n .react-datepicker__year-text {\n background: ${COLORS.white};\n border: none;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n margin-top: 20px;\n padding-top: 10px;\n padding-bottom: 10px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n &.react-datepicker__year-text--disabled {\n display: none;\n }\n\n &.react-datepicker__day--keyboard-selected {\n color: ${COLORS.neutral_600};\n background: ${COLORS.white};\n font-weight: 400;\n border: none;\n }\n\n &:hover {\n color: ${COLORS.primary_700};\n background: ${COLORS.primary_20};\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &.react-datepicker__year-text--selected {\n color: ${COLORS.white} !important;\n background: ${COLORS.primary_500} !important;\n }\n }\n\n .react-datepicker__day {\n background: ${COLORS.white};\n border: none;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n height: 40px;\n width: 40px;\n margin: 4px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n &.react-datepicker__day--keyboard-selected {\n color: ${COLORS.neutral_600};\n background: ${COLORS.white};\n font-weight: 400;\n border: none;\n }\n\n &:hover {\n color: ${COLORS.primary_700};\n background: ${COLORS.primary_20};\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &.react-datepicker__day--selected {\n color: ${COLORS.white} !important;\n background: ${COLORS.primary_500} !important;\n }\n\n &.react-datepicker__day--today {\n border-radius: 0.3rem;\n color: ${COLORS.neutral_700};\n background: ${COLORS.neutral_100};\n\n &:hover {\n color: ${COLORS.primary_700};\n background: ${COLORS.primary_20};\n }\n\n &:focus {\n ${focusStyles}\n }\n }\n }\n }\n`;\n\nconst IconWrapper = styled.div`\n pointer-events: none;\n position: absolute;\n right: 16px;\n width: 24px;\n height: 24px;\n z-index: ${+Z_INDEXES.focus + 1};\n color: ${COLORS.neutral_600};\n`;\n\nconst DatepickerRow = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nconst StyledInputFieldStyling = styled(InputFieldStyling)`\n &::placeholder {\n color: ${COLORS.neutral_500};\n }\n\n &:focus:not(.focus-visible) {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_300};\n }\n\n &:hover {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_200};\n\n ::placeholder {\n color: ${COLORS.primary_700};\n }\n\n cursor: pointer;\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n\n &:active,\n &.open {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_300};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n background-color: ${COLORS.white};\n }\n\n &:hover ~ ${IconWrapper} {\n color: ${COLORS.primary_700};\n }\n\n &:active ~ ${IconWrapper}, &.open ~ ${IconWrapper} {\n color: ${COLORS.primary_800};\n }\n\n &:disabled ~ ${IconWrapper}, &:read-only ~ ${IconWrapper} {\n color: ${COLORS.neutral_300};\n }\n`;\n\nconst DatepickerField = React.forwardRef(({\n disabled,\n readOnly,\n onChange,\n invalid,\n value,\n validationMessage,\n dateFormat,\n autoComplete,\n placeholder,\n required,\n yearPicker,\n yearsBeforeCurrentDate,\n yearsAfterCurrentDate,\n margin,\n onBlur,\n ...rest\n }: DatepickerFieldProps, ref) => {\n // Globally used variables within the component\n const inputRef = useFocusVisibleRef();\n const datepickerRef = React.useRef<any>(null);\n const [activeMonthPage, setActiveMonthPage] = React.useState<number>(-1);\n const [yearPickerMode, setYearPickerMode] = React.useState<boolean>(false);\n const [openAt, setOpenAt] = React.useState<Date | null>(null);\n // 'open' flag is used only for tracking current state of the dropdown,\n // for explicitly opening/closing the picker we are using 'datepickerRef.current.setOpen'\n const [open, setOpen] = React.useState<boolean>(false);\n\n /**\n * Format the date in a specific way.\n */\n React.useEffect(() => {\n if (value) inputRef.current.value = moment(value).format(dateFormat ? dateFormat : 'MMMM Do, YYYY');\n }, [value]);\n\n React.useEffect(() => {\n if (yearPickerMode) {\n //unfortunately, since there are no refs, and year pickers is rendered not by our code, but by 'react-datepicker'\n //we have to touch DOM directly\n const selectedDate = document.getElementsByClassName('react-datepicker__year-text--selected')[0] as HTMLElement;\n const dropdownParent = selectedDate?.parentElement?.parentElement;\n if (selectedDate && dropdownParent) dropdownParent.scrollTop = selectedDate.offsetTop - 2 * selectedDate.offsetHeight;\n }\n }, [yearPickerMode]);\n\n //we have to manually reopen the calendar when needed, to guarantee that datepicker will show selected date after year selection\n //otherwise after year selection datepicker will show January month of the selected year\n React.useEffect(() => {\n if (openAt) {\n datepickerRef.current.setOpen(true);\n //setOpenAt(null);\n }\n }, [openAt]);\n\n React.useImperativeHandle(ref, () => inputRef.current, [inputRef]);\n\n const handleCalendarClose = () => {\n inputRef.current?.blur();\n setOpen(false);\n };\n\n const handleCalendarOpen = () => {\n if (openAt) setOpenAt(null);\n setOpen(true);\n };\n\n let maxDate = new Date(value && new Date(value) > new Date() ? new Date(value) : new Date());\n maxDate.setFullYear(maxDate.getFullYear() + (yearsAfterCurrentDate ?? 50));\n\n //itemsNumber - controls number of year select options generated in the dropdown\n //items related to dates higher than 'maxDate' will be hidden, thus to avoid creating hundreds of invisible divs, we divide by 5\n let minDate = new Date(value && new Date(value) < new Date() ? new Date(value) : new Date());\n const itemsNumber = Math.round((minDate.getFullYear() - (yearsBeforeCurrentDate ?? 15)) / 5);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape' || e.key === 'Esc')\n datepickerRef.current.setOpen(false);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n // @ts-ignore\n if (!e.currentTarget.contains(e.relatedTarget)) {\n onBlur && onBlur(e);\n }\n };\n\n return (\n <>\n {/* Let's render the input itself */}\n <DatePickerContainer yearPicker={yearPickerMode} margin={margin || ''} onBlur={handleBlur}>\n <DatePicker\n ref={datepickerRef}\n onCalendarOpen={handleCalendarOpen}\n onCalendarClose={handleCalendarClose}\n onKeyDown={handleKeyDown}\n\n onClickOutside={() => datepickerRef.current.setOpen(false)}\n\n onChange={(e: any) => {\n if (onChange) {\n if (yearPickerMode) {\n const newDate = new Date();\n newDate.setFullYear(e.getFullYear());\n newDate.setMonth(activeMonthPage);\n setOpenAt(newDate);\n } else onChange(e);\n }\n if (yearPickerMode) setYearPickerMode(false);\n }}\n disabled={disabled || readOnly}\n locale={en}\n showYearPicker={yearPickerMode}\n //we manipulate 'yearItemNumber' and 'maxDate' to guarantee number of year select options shown before and after selected year\n yearItemNumber={yearPickerMode ? itemsNumber : undefined}\n maxDate={yearPickerMode ? maxDate : undefined}\n selected={value}\n openToDate={openAt ?? undefined}\n preventOpenOnFocus={true}\n shouldCloseOnSelect={true}\n renderCustomHeader={\n yearPicker\n ? (params: DatepickerFieldHeaderParams) =>\n React.createElement(\n DatepickerFieldHeader,\n {\n ...params,\n setActiveMonthPage,\n customHeaderCount: 0,\n yearPickerMode: yearPickerMode,\n setYearPickerMode: setYearPickerMode,\n },\n null,\n )\n : undefined\n }\n customInput={\n <InputWrapper disabled={disabled} readOnly={readOnly}>\n <div style={{display: 'block', margin: '4px 0px'}}>\n <DatepickerRow>\n <StyledInputFieldStyling\n ref={inputRef}\n type=\"text\"\n name=\"datepicker\"\n onKeyDown={(e) => e.key === 'Enter' && datepickerRef.current.setOpen(true)}\n className={(invalid ? 'invalid' : '' + (open ? ' open' : ''))}\n tabIndex={disabled || readOnly ? -1 : 0}\n onFocus={(e) => inputRef.current?.setSelectionRange(0, 0)}\n autoComplete={autoComplete}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={true}\n suppressReadOnlyStyles={!readOnly}\n required={required}\n {...rest}\n />\n <IconWrapper>\n <Calendar size=\"24\"/>\n </IconWrapper>\n </DatepickerRow>\n </div>\n </InputWrapper>\n }\n />\n </DatePickerContainer>\n\n {/* If there is an error, let's render the error */}\n {validationMessage && (\n <ErrorMessage>\n <TechnicalWarning color={COLORS.critical_400}/>\n <span>{validationMessage}</span>\n </ErrorMessage>\n )}\n </>\n );\n});\n\nexport default DatepickerField;\n"],"file":"DatepickerField.js"}
1
+ {"version":3,"sources":["../../src/InputFields/DatepickerField.tsx"],"names":["React","styled","DatePicker","en","moment","COLORS","Calendar","TechnicalWarning","DatepickerFieldHeader","ComponentTextStyle","focusStyles","scrollBarStyling","ErrorMessage","InputFieldStyling","InputWrapper","ComponentMStyling","ComponentSStyling","Z_INDEXES","useFocusVisibleRef","Size","DatePickerContainer","div","dropdown","props","margin","primary_20","neutral_20","neutral_200","yearPicker","Bold","neutral_600","Small","Regular","white","primary_700","primary_500","neutral_700","neutral_100","IconWrapper","focus","DatepickerRow","StyledInputFieldStyling","neutral_500","primary_300","primary_200","primary_100","primary_800","neutral_300","DatepickerField","forwardRef","ref","disabled","readOnly","onChange","invalid","value","validationMessage","dateFormat","autoComplete","placeholder","required","yearsBeforeCurrentDate","yearsAfterCurrentDate","onBlur","rest","inputRef","datepickerRef","useRef","useState","activeMonthPage","setActiveMonthPage","yearPickerMode","setYearPickerMode","openAt","setOpenAt","open","setOpen","useEffect","current","format","selectedDate","document","getElementsByClassName","dropdownParent","parentElement","scrollTop","offsetTop","offsetHeight","useImperativeHandle","handleCalendarClose","blur","handleCalendarOpen","maxDate","Date","setFullYear","getFullYear","minDate","itemsNumber","Math","round","handleKeyDown","e","key","handleBlur","currentTarget","contains","relatedTarget","newDate","setMonth","undefined","params","createElement","customHeaderCount","display","setSelectionRange","critical_400"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,EAAP,MAAe,uBAAf;AACA,OAAOC,MAAP,MAAmB,QAAnB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,SAAQC,QAAR,EAAkBC,gBAAlB,QAAyC,kCAAzC;AACA,SAAQC,qBAAR,QAAiE,yBAAjE;AACA,SAAQC,kBAAR,EAA4BC,WAA5B,EAAyCC,gBAAzC,QAAgE,WAAhE;AAEA;AACA;AACA;;AACA,SAAQC,YAAR,EAAsBC,iBAAtB,EAAyCC,YAAzC,QAA4D,WAA5D;AACA,OAAO,4CAAP;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,QAAmD,WAAnD;AACA,SAAQC,SAAR,QAAwB,WAAxB;AACA,SAAQC,kBAAR,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B;AAaE,gBAAA,QAAQ,EAAEQ;AAbZ,iBAcMI,IAdN,EADF,eAiBE,KAAC,WAAD;AAAA,uCACE,KAAC,QAAD;AAAU,kBAAA,IAAI,EAAC;AAAf;AADF,gBAjBF;AAAA;AADF;AADF;AA9CJ;AADF,MAFF,EA+EGR,iBAAiB,iBAChB,MAAC,YAAD;AAAA,8BACE,KAAC,gBAAD;AAAkB,QAAA,KAAK,EAAEnD,MAAM,CAAC8G;AAAhC,QADF,eAEE;AAAA,kBAAO3D;AAAP,QAFF;AAAA,MAhFJ;AAAA,IADF;AAwFD,CA9KuB,CAAxB;;AA1SED,EAAAA,K;AACAF,EAAAA,Q;AACAU,EAAAA,M;AAEAT,EAAAA,O;AACAG,EAAAA,U;AACAD,EAAAA,iB;AACAE,EAAAA,Y;AACAC,EAAAA,W;AACA/B,EAAAA,U;AACAiC,EAAAA,sB;AACAC,EAAAA,qB;AACAtC,EAAAA,M;;AA8cF,eAAewB,eAAf","sourcesContent":["/**\n * Import react libraries.\n */\nimport React from 'react';\n\n/**\n * Import third-party libraries.\n */\nimport styled from 'styled-components';\nimport DatePicker from 'react-datepicker';\nimport en from 'date-fns/locale/en-GB';\nimport moment from 'moment';\n\n/**\n * Import custom components.\n */\nimport COLORS from '../styles/colors';\nimport {Calendar, TechnicalWarning} from '../icons/systemicons/SystemIcons';\nimport {DatepickerFieldHeader, DatepickerFieldHeaderParams} from './DatepickerFieldHeader';\nimport {ComponentTextStyle, focusStyles, scrollBarStyling} from '../styles';\n\n/**\n * Import custom styles.\n */\nimport {ErrorMessage, InputFieldStyling, InputWrapper} from './styling';\nimport 'react-datepicker/dist/react-datepicker.css';\nimport {ComponentMStyling, ComponentSStyling} from '../styles';\nimport {Z_INDEXES} from '../styles';\nimport {useFocusVisibleRef} from '../common';\nimport {Size} from '../types';\n\n/**\n * Add custom types.\n */\ntype DatepickerFieldProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'size' | 'onBlur'> & {\n value?: Date;\n onChange?: (date: Date) => void;\n onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;\n\n invalid?: boolean;\n dateFormat?: string;\n validationMessage?: string;\n autoComplete?: string;\n placeholder?: string;\n yearPicker?: boolean;\n yearsBeforeCurrentDate?: number;\n yearsAfterCurrentDate?: number;\n margin?: string;\n};\n\n/**\n * Add custom styles.\n */\nconst DatePickerContainer = styled.div<{ yearPicker: boolean; margin: string }>`\n .react-datepicker-popper {\n z-index: ${Z_INDEXES.dropdown};\n }\n\n > div {\n display: block;\n\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n .react-datepicker {\n box-sizing: border-box;\n box-shadow: 0px 2px 4px rgb(0 0 0 / 15%);\n border: 1px solid #e5e5e5;\n }\n\n .react-datepicker__navigation {\n line-height: normal;\n text-indent: inherit;\n border: none;\n border-radius: 4px;\n height: 32px;\n width: 32px;\n outline: none;\n margin: 0px;\n color: transparent;\n\n &:hover {\n background: ${COLORS.primary_20};\n\n &.react-datepicker__navigation--previous::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M15.1975 4.46474C15.5885 4.85478 15.5893 5.48794 15.1993 5.87895L8.92124 12.1727L15.1993 18.4665C15.5893 18.8575 15.5885 19.4907 15.1975 19.8807C14.8065 20.2708 14.1734 20.27 13.7833 19.879L6.8008 12.879C6.41145 12.4886 6.41145 11.8568 6.8008 11.4665L13.7833 4.46651C14.1734 4.0755 14.8065 4.0747 15.1975 4.46474Z' fill='%23215369' /%3E%3C/svg%3E\");\n }\n\n &.react-datepicker__navigation--next::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M9.24214 19.8807C8.85113 19.4907 8.85034 18.8575 9.24038 18.4665L15.5184 12.1727L9.24037 5.87895C8.85034 5.48794 8.85113 4.85478 9.24214 4.46474C9.63315 4.0747 10.2663 4.07549 10.6564 4.46651L17.6389 11.4665C18.0282 11.8568 18.0282 12.4886 17.6389 12.879L10.6564 19.879C10.2663 20.27 9.63316 20.2708 9.24214 19.8807Z' fill='%23215369' /%3E%3C/svg%3E\");\n }\n }\n\n &:focus {\n ${focusStyles}\n &.react-datepicker__navigation--next::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M9.24214 19.8807C8.85113 19.4907 8.85034 18.8575 9.24038 18.4665L15.5184 12.1727L9.24037 5.87895C8.85034 5.48794 8.85113 4.85478 9.24214 4.46474C9.63315 4.0747 10.2663 4.07549 10.6564 4.46651L17.6389 11.4665C18.0282 11.8568 18.0282 12.4886 17.6389 12.879L10.6564 19.879C10.2663 20.27 9.63316 20.2708 9.24214 19.8807Z' fill='%23163746' /%3E%3C/svg%3E\");\n }\n\n &.react-datepicker__navigation--previous::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M15.1975 4.46474C15.5885 4.85478 15.5893 5.48794 15.1993 5.87895L8.92124 12.1727L15.1993 18.4665C15.5893 18.8575 15.5885 19.4907 15.1975 19.8807C14.8065 20.2708 14.1734 20.27 13.7833 19.879L6.8008 12.879C6.41145 12.4886 6.41145 11.8568 6.8008 11.4665L13.7833 4.46651C14.1734 4.0755 14.8065 4.0747 15.1975 4.46474Z' fill='%23163746' /%3E%3C/svg%3E\");\n }\n }\n\n &::before {\n text-align: center;\n display: inline-block;\n content: '';\n height: 32px;\n width: 32px;\n vertical-align: middle;\n }\n\n &.react-datepicker__navigation--next::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M9.24214 19.8807C8.85113 19.4907 8.85034 18.8575 9.24038 18.4665L15.5184 12.1727L9.24037 5.87895C8.85034 5.48794 8.85113 4.85478 9.24214 4.46474C9.63315 4.0747 10.2663 4.07549 10.6564 4.46651L17.6389 11.4665C18.0282 11.8568 18.0282 12.4886 17.6389 12.879L10.6564 19.879C10.2663 20.27 9.63316 20.2708 9.24214 19.8807Z' fill='%23666666' /%3E%3C/svg%3E\");\n }\n\n &.react-datepicker__navigation--previous::before {\n background-image: url(\"data:image/svg+xml,%3Csvg style='width: 32px; height: 32px;' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M15.1975 4.46474C15.5885 4.85478 15.5893 5.48794 15.1993 5.87895L8.92124 12.1727L15.1993 18.4665C15.5893 18.8575 15.5885 19.4907 15.1975 19.8807C14.8065 20.2708 14.1734 20.27 13.7833 19.879L6.8008 12.879C6.41145 12.4886 6.41145 11.8568 6.8008 11.4665L13.7833 4.46651C14.1734 4.0755 14.8065 4.0747 15.1975 4.46474Z' fill='%23666666' /%3E%3C/svg%3E\");\n }\n }\n\n .react-datepicker__month-container,\n .react-datepicker__year--container {\n width: 336px;\n }\n\n .react-datepicker__month {\n margin: 0px;\n }\n\n .react-datepicker__triangle {\n left: 50% !important;\n display: none;\n }\n\n .react-datepicker-popper[data-placement^='bottom'] {\n margin-top: 0;\n }\n\n .react-datepicker-popper[data-placement^='bottom'] .react-datepicker__triangle {\n border-bottom-color: ${COLORS.neutral_20};\n }\n\n .react-datepicker__header {\n border-bottom: 1px solid ${COLORS.neutral_200};\n background: ${COLORS.neutral_20};\n height: ${(props) => (!props.yearPicker ? '96px' : '54px')};\n padding-top: 0px;\n }\n\n .react-datepicker__current-month {\n height: 48px;\n display: inline-flex;\n align-items: center;\n margin-right: 5px;\n\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n\n .react-datepicker__year {\n max-height: 300px;\n overflow-y: scroll;\n\n ${scrollBarStyling(Size.Small)}\n }\n\n .react-datepicker__year-wrapper {\n max-width: 100%;\n justify-content: space-around;\n }\n\n .react-datepicker__day-name {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n height: 48px;\n margin: 0px;\n width: 48px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n }\n\n .react-datepicker__year-text {\n background: ${COLORS.white};\n border: none;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n margin-top: 20px;\n padding-top: 10px;\n padding-bottom: 10px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n &.react-datepicker__year-text--disabled {\n display: none;\n }\n\n &.react-datepicker__day--keyboard-selected {\n color: ${COLORS.neutral_600};\n background: ${COLORS.white};\n font-weight: 400;\n border: none;\n }\n\n &:hover {\n color: ${COLORS.primary_700};\n background: ${COLORS.primary_20};\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &.react-datepicker__year-text--selected {\n color: ${COLORS.white} !important;\n background: ${COLORS.primary_500} !important;\n }\n }\n\n .react-datepicker__day {\n background: ${COLORS.white};\n border: none;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n height: 40px;\n width: 40px;\n margin: 4px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n &.react-datepicker__day--keyboard-selected {\n color: ${COLORS.neutral_600};\n background: ${COLORS.white};\n font-weight: 400;\n border: none;\n }\n\n &:hover {\n color: ${COLORS.primary_700};\n background: ${COLORS.primary_20};\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &.react-datepicker__day--selected {\n color: ${COLORS.white} !important;\n background: ${COLORS.primary_500} !important;\n }\n\n &.react-datepicker__day--today {\n border-radius: 0.3rem;\n color: ${COLORS.neutral_700};\n background: ${COLORS.neutral_100};\n\n &:hover {\n color: ${COLORS.primary_700};\n background: ${COLORS.primary_20};\n }\n\n &:focus {\n ${focusStyles}\n }\n }\n }\n }\n`;\n\nconst IconWrapper = styled.div`\n pointer-events: none;\n position: absolute;\n right: 16px;\n width: 24px;\n height: 24px;\n z-index: ${Z_INDEXES.focus + 1};\n color: ${COLORS.neutral_600};\n`;\n\nconst DatepickerRow = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nconst StyledInputFieldStyling = styled(InputFieldStyling)`\n &::placeholder {\n color: ${COLORS.neutral_500};\n }\n\n &:focus:not(.focus-visible) {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_300};\n }\n\n &:hover {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_200};\n\n ::placeholder {\n color: ${COLORS.primary_700};\n }\n\n cursor: pointer;\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n\n &:active,\n &.open {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_300};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n background-color: ${COLORS.white};\n }\n\n &:hover ~ ${IconWrapper} {\n color: ${COLORS.primary_700};\n }\n\n &:active ~ ${IconWrapper}, &.open ~ ${IconWrapper} {\n color: ${COLORS.primary_800};\n }\n\n &:disabled ~ ${IconWrapper}, &:read-only ~ ${IconWrapper} {\n color: ${COLORS.neutral_300};\n }\n`;\n\nconst DatepickerField = React.forwardRef(({\n disabled,\n readOnly,\n onChange,\n invalid,\n value,\n validationMessage,\n dateFormat,\n autoComplete,\n placeholder,\n required,\n yearPicker,\n yearsBeforeCurrentDate,\n yearsAfterCurrentDate,\n margin,\n onBlur,\n ...rest\n }: DatepickerFieldProps, ref) => {\n // Globally used variables within the component\n const inputRef = useFocusVisibleRef();\n const datepickerRef = React.useRef<any>(null);\n const [activeMonthPage, setActiveMonthPage] = React.useState<number>(-1);\n const [yearPickerMode, setYearPickerMode] = React.useState<boolean>(false);\n const [openAt, setOpenAt] = React.useState<Date | null>(null);\n // 'open' flag is used only for tracking current state of the dropdown,\n // for explicitly opening/closing the picker we are using 'datepickerRef.current.setOpen'\n const [open, setOpen] = React.useState<boolean>(false);\n\n /**\n * Format the date in a specific way.\n */\n React.useEffect(() => {\n if (value) inputRef.current.value = moment(value).format(dateFormat ? dateFormat : 'MMMM Do, YYYY');\n }, [value]);\n\n React.useEffect(() => {\n if (yearPickerMode) {\n //unfortunately, since there are no refs, and year pickers is rendered not by our code, but by 'react-datepicker'\n //we have to touch DOM directly\n const selectedDate = document.getElementsByClassName('react-datepicker__year-text--selected')[0] as HTMLElement;\n const dropdownParent = selectedDate?.parentElement?.parentElement;\n if (selectedDate && dropdownParent) dropdownParent.scrollTop = selectedDate.offsetTop - 2 * selectedDate.offsetHeight;\n }\n }, [yearPickerMode]);\n\n //we have to manually reopen the calendar when needed, to guarantee that datepicker will show selected date after year selection\n //otherwise after year selection datepicker will show January month of the selected year\n React.useEffect(() => {\n if (openAt) {\n datepickerRef.current.setOpen(true);\n //setOpenAt(null);\n }\n }, [openAt]);\n\n React.useImperativeHandle(ref, () => inputRef.current, [inputRef]);\n\n const handleCalendarClose = () => {\n inputRef.current?.blur();\n setOpen(false);\n };\n\n const handleCalendarOpen = () => {\n if (openAt) setOpenAt(null);\n setOpen(true);\n };\n\n let maxDate = new Date(value && new Date(value) > new Date() ? new Date(value) : new Date());\n maxDate.setFullYear(maxDate.getFullYear() + (yearsAfterCurrentDate ?? 50));\n\n //itemsNumber - controls number of year select options generated in the dropdown\n //items related to dates higher than 'maxDate' will be hidden, thus to avoid creating hundreds of invisible divs, we divide by 5\n let minDate = new Date(value && new Date(value) < new Date() ? new Date(value) : new Date());\n const itemsNumber = Math.round((minDate.getFullYear() - (yearsBeforeCurrentDate ?? 15)) / 5);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape' || e.key === 'Esc')\n datepickerRef.current.setOpen(false);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n // @ts-ignore\n if (!e.currentTarget.contains(e.relatedTarget)) {\n onBlur && onBlur(e);\n }\n };\n\n return (\n <>\n {/* Let's render the input itself */}\n <DatePickerContainer yearPicker={yearPickerMode} margin={margin || ''} onBlur={handleBlur}>\n <DatePicker\n ref={datepickerRef}\n onCalendarOpen={handleCalendarOpen}\n onCalendarClose={handleCalendarClose}\n onKeyDown={handleKeyDown}\n\n onClickOutside={() => datepickerRef.current.setOpen(false)}\n\n onChange={(e: any) => {\n if (onChange) {\n if (yearPickerMode) {\n const newDate = new Date();\n newDate.setFullYear(e.getFullYear());\n newDate.setMonth(activeMonthPage);\n setOpenAt(newDate);\n } else onChange(e);\n }\n if (yearPickerMode) setYearPickerMode(false);\n }}\n disabled={disabled || readOnly}\n locale={en}\n showYearPicker={yearPickerMode}\n //we manipulate 'yearItemNumber' and 'maxDate' to guarantee number of year select options shown before and after selected year\n yearItemNumber={yearPickerMode ? itemsNumber : undefined}\n maxDate={yearPickerMode ? maxDate : undefined}\n selected={value}\n openToDate={openAt ?? undefined}\n preventOpenOnFocus={true}\n shouldCloseOnSelect={true}\n renderCustomHeader={\n yearPicker\n ? (params: DatepickerFieldHeaderParams) =>\n React.createElement(\n DatepickerFieldHeader,\n {\n ...params,\n setActiveMonthPage,\n customHeaderCount: 0,\n yearPickerMode: yearPickerMode,\n setYearPickerMode: setYearPickerMode,\n },\n null,\n )\n : undefined\n }\n customInput={\n <InputWrapper disabled={disabled} readOnly={readOnly}>\n <div style={{display: 'block', margin: '4px 0px'}}>\n <DatepickerRow>\n <StyledInputFieldStyling\n ref={inputRef}\n type=\"text\"\n name=\"datepicker\"\n onKeyDown={(e) => e.key === 'Enter' && datepickerRef.current.setOpen(true)}\n className={(invalid ? 'invalid' : '' + (open ? ' open' : ''))}\n tabIndex={disabled || readOnly ? -1 : 0}\n onFocus={(e) => inputRef.current?.setSelectionRange(0, 0)}\n autoComplete={autoComplete}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={true}\n suppressReadOnlyStyles={!readOnly}\n required={required}\n {...rest}\n />\n <IconWrapper>\n <Calendar size=\"24\"/>\n </IconWrapper>\n </DatepickerRow>\n </div>\n </InputWrapper>\n }\n />\n </DatePickerContainer>\n\n {/* If there is an error, let's render the error */}\n {validationMessage && (\n <ErrorMessage>\n <TechnicalWarning color={COLORS.critical_400}/>\n <span>{validationMessage}</span>\n </ErrorMessage>\n )}\n </>\n );\n});\n\nexport default DatepickerField;\n"],"file":"DatepickerField.js"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.MobileCustomMenuContent = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+
16
+ var _react = _interopRequireDefault(require("react"));
17
+
18
+ var _ScrollableContainer = require("../common/ScrollableContainer");
19
+
20
+ var _CommonStyles = require("../GlobalNavigationBar/mobile/CommonStyles");
21
+
22
+ var _MobileActionContainer = require("../GlobalNavigationBar/mobile/MobileActionContainer");
23
+
24
+ var _jsxRuntime = require("react/jsx-runtime");
25
+
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
27
+
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
29
+
30
+ var MobileCustomMenuContent = function MobileCustomMenuContent(_ref) {
31
+ var children = _ref.children,
32
+ header = _ref.header,
33
+ action = _ref.action;
34
+
35
+ var _useScrollableContain = (0, _ScrollableContainer.useScrollableContainer)([children]),
36
+ _useScrollableContain2 = (0, _slicedToArray2.default)(_useScrollableContain, 2),
37
+ scrollContainerRef = _useScrollableContain2[0],
38
+ scrollable = _useScrollableContain2[1];
39
+
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CommonStyles.MobileMenuWrapper, {
41
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_CommonStyles.ScrollableContainer, {
42
+ ref: scrollContainerRef,
43
+ className: scrollable ? 'scrollable' : '',
44
+ children: [!!header && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CommonStyles.MobileHeaderContainer, {
45
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CommonStyles.MobileHeaderText, {
46
+ children: header.header
47
+ }), header.note && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CommonStyles.MobileHeaderNote, {
48
+ children: header.note
49
+ })]
50
+ }), children]
51
+ }), action && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileActionContainer.MobileActionContainer, _objectSpread({}, action))]
52
+ });
53
+ };
54
+
55
+ exports.MobileCustomMenuContent = MobileCustomMenuContent;
56
+ //# sourceMappingURL=MobileCustomMenuContent.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Switcher/MobileCustomMenuContent.tsx"],"names":["MobileCustomMenuContent","children","header","action","scrollContainerRef","scrollable","note"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAOO,IAAMA,uBAA8E,GAAG,SAAjFA,uBAAiF,OAAkC;AAAA,MAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,MAArBC,MAAqB,QAArBA,MAAqB;AAAA,MAAbC,MAAa,QAAbA,MAAa;;AAC9H,8BAAyC,iDAAuB,CAACF,QAAD,CAAvB,CAAzC;AAAA;AAAA,MAAOG,kBAAP;AAAA,MAA2BC,UAA3B;;AAEA,sBACE,sBAAC,+BAAD;AAAA,4BACE,sBAAC,iCAAD;AAAqB,MAAA,GAAG,EAAED,kBAA1B;AAAqD,MAAA,SAAS,EAAEC,UAAU,GAAG,YAAH,GAAkB,EAA5F;AAAA,iBACG,CAAC,CAACH,MAAF,iBACC,sBAAC,mCAAD;AAAA,gCACE,qBAAC,8BAAD;AAAA,oBAAmBA,MAAM,CAACA;AAA1B,UADF,EAEGA,MAAM,CAACI,IAAP,iBAAe,qBAAC,8BAAD;AAAA,oBAAmBJ,MAAM,CAACI;AAA1B,UAFlB;AAAA,QAFJ,EAOGL,QAPH;AAAA,MADF,EAUGE,MAAM,iBAAI,qBAAC,4CAAD,oBAA2BA,MAA3B,EAVb;AAAA,IADF;AAcD,CAjBM","sourcesContent":["import React from 'react';\nimport { useScrollableContainer } from '../common/ScrollableContainer';\nimport { MenuButton, MenuGroupHeader } from '../GlobalNavigationBar';\nimport { MobileHeaderContainer, MobileHeaderNote, MobileHeaderText, MobileMenuWrapper, ScrollableContainer } from '../GlobalNavigationBar/mobile/CommonStyles';\nimport { MobileActionContainer } from '../GlobalNavigationBar/mobile/MobileActionContainer';\n\ninterface MobileCustomMenuContentProps {\n header?: MenuGroupHeader;\n action?: MenuButton;\n}\n\nexport const MobileCustomMenuContent: React.FunctionComponent<MobileCustomMenuContentProps> = ({ children, header, action }) => {\n const [scrollContainerRef, scrollable] = useScrollableContainer([children]);\n\n return (\n <MobileMenuWrapper>\n <ScrollableContainer ref={scrollContainerRef as any} className={scrollable ? 'scrollable' : ''}>\n {!!header && (\n <MobileHeaderContainer>\n <MobileHeaderText>{header.header}</MobileHeaderText>\n {header.note && <MobileHeaderNote>{header.note}</MobileHeaderNote>}\n </MobileHeaderContainer>\n )}\n {children}\n </ScrollableContainer>\n {action && <MobileActionContainer {...action} />}\n </MobileMenuWrapper>\n );\n};\n"],"file":"MobileCustomMenuContent.cjs"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { MenuButton, MenuGroupHeader } from '../GlobalNavigationBar';
3
+ interface MobileCustomMenuContentProps {
4
+ header?: MenuGroupHeader;
5
+ action?: MenuButton;
6
+ }
7
+ export declare const MobileCustomMenuContent: React.FunctionComponent<MobileCustomMenuContentProps>;
8
+ export {};
@@ -0,0 +1,39 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _pt from "prop-types";
4
+
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
+
9
+ import React from 'react';
10
+ import { useScrollableContainer } from '../common/ScrollableContainer';
11
+ import { MobileHeaderContainer, MobileHeaderNote, MobileHeaderText, MobileMenuWrapper, ScrollableContainer } from '../GlobalNavigationBar/mobile/CommonStyles';
12
+ import { MobileActionContainer } from '../GlobalNavigationBar/mobile/MobileActionContainer';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ export var MobileCustomMenuContent = function MobileCustomMenuContent(_ref) {
16
+ var children = _ref.children,
17
+ header = _ref.header,
18
+ action = _ref.action;
19
+
20
+ var _useScrollableContain = useScrollableContainer([children]),
21
+ _useScrollableContain2 = _slicedToArray(_useScrollableContain, 2),
22
+ scrollContainerRef = _useScrollableContain2[0],
23
+ scrollable = _useScrollableContain2[1];
24
+
25
+ return /*#__PURE__*/_jsxs(MobileMenuWrapper, {
26
+ children: [/*#__PURE__*/_jsxs(ScrollableContainer, {
27
+ ref: scrollContainerRef,
28
+ className: scrollable ? 'scrollable' : '',
29
+ children: [!!header && /*#__PURE__*/_jsxs(MobileHeaderContainer, {
30
+ children: [/*#__PURE__*/_jsx(MobileHeaderText, {
31
+ children: header.header
32
+ }), header.note && /*#__PURE__*/_jsx(MobileHeaderNote, {
33
+ children: header.note
34
+ })]
35
+ }), children]
36
+ }), action && /*#__PURE__*/_jsx(MobileActionContainer, _objectSpread({}, action))]
37
+ });
38
+ };
39
+ //# sourceMappingURL=MobileCustomMenuContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Switcher/MobileCustomMenuContent.tsx"],"names":["React","useScrollableContainer","MobileHeaderContainer","MobileHeaderNote","MobileHeaderText","MobileMenuWrapper","ScrollableContainer","MobileActionContainer","MobileCustomMenuContent","children","header","action","scrollContainerRef","scrollable","note"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,sBAAT,QAAuC,+BAAvC;AAEA,SAASC,qBAAT,EAAgCC,gBAAhC,EAAkDC,gBAAlD,EAAoEC,iBAApE,EAAuFC,mBAAvF,QAAkH,4CAAlH;AACA,SAASC,qBAAT,QAAsC,qDAAtC;;;AAOA,OAAO,IAAMC,uBAA8E,GAAG,SAAjFA,uBAAiF,OAAkC;AAAA,MAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,MAArBC,MAAqB,QAArBA,MAAqB;AAAA,MAAbC,MAAa,QAAbA,MAAa;;AAC9H,8BAAyCV,sBAAsB,CAAC,CAACQ,QAAD,CAAD,CAA/D;AAAA;AAAA,MAAOG,kBAAP;AAAA,MAA2BC,UAA3B;;AAEA,sBACE,MAAC,iBAAD;AAAA,4BACE,MAAC,mBAAD;AAAqB,MAAA,GAAG,EAAED,kBAA1B;AAAqD,MAAA,SAAS,EAAEC,UAAU,GAAG,YAAH,GAAkB,EAA5F;AAAA,iBACG,CAAC,CAACH,MAAF,iBACC,MAAC,qBAAD;AAAA,gCACE,KAAC,gBAAD;AAAA,oBAAmBA,MAAM,CAACA;AAA1B,UADF,EAEGA,MAAM,CAACI,IAAP,iBAAe,KAAC,gBAAD;AAAA,oBAAmBJ,MAAM,CAACI;AAA1B,UAFlB;AAAA,QAFJ,EAOGL,QAPH;AAAA,MADF,EAUGE,MAAM,iBAAI,KAAC,qBAAD,oBAA2BA,MAA3B,EAVb;AAAA,IADF;AAcD,CAjBM","sourcesContent":["import React from 'react';\nimport { useScrollableContainer } from '../common/ScrollableContainer';\nimport { MenuButton, MenuGroupHeader } from '../GlobalNavigationBar';\nimport { MobileHeaderContainer, MobileHeaderNote, MobileHeaderText, MobileMenuWrapper, ScrollableContainer } from '../GlobalNavigationBar/mobile/CommonStyles';\nimport { MobileActionContainer } from '../GlobalNavigationBar/mobile/MobileActionContainer';\n\ninterface MobileCustomMenuContentProps {\n header?: MenuGroupHeader;\n action?: MenuButton;\n}\n\nexport const MobileCustomMenuContent: React.FunctionComponent<MobileCustomMenuContentProps> = ({ children, header, action }) => {\n const [scrollContainerRef, scrollable] = useScrollableContainer([children]);\n\n return (\n <MobileMenuWrapper>\n <ScrollableContainer ref={scrollContainerRef as any} className={scrollable ? 'scrollable' : ''}>\n {!!header && (\n <MobileHeaderContainer>\n <MobileHeaderText>{header.header}</MobileHeaderText>\n {header.note && <MobileHeaderNote>{header.note}</MobileHeaderNote>}\n </MobileHeaderContainer>\n )}\n {children}\n </ScrollableContainer>\n {action && <MobileActionContainer {...action} />}\n </MobileMenuWrapper>\n );\n};\n"],"file":"MobileCustomMenuContent.js"}
@@ -23,6 +23,8 @@ var _MobileMenuHeader = _interopRequireDefault(require("../GlobalNavigationBar/m
23
23
 
24
24
  var _MobileMenuContent = _interopRequireDefault(require("../GlobalNavigationBar/mobile/MobileMenuContent"));
25
25
 
26
+ var _MobileCustomMenuContent = require("./MobileCustomMenuContent");
27
+
26
28
  var _jsxRuntime = require("react/jsx-runtime");
27
29
 
28
30
  var _templateObject;
@@ -38,7 +40,9 @@ var MobileSwitcherMenu = function MobileSwitcherMenu(_ref) {
38
40
  header = _ref.header,
39
41
  note = _ref.note,
40
42
  onMenuClose = _ref.onMenuClose,
41
- items = _ref.items;
43
+ customContent = _ref.customContent,
44
+ items = _ref.items,
45
+ footerAction = _ref.footerAction;
42
46
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
43
47
  role: "menu",
44
48
  "aria-labelledby": "UserMenuButton",
@@ -46,12 +50,20 @@ var MobileSwitcherMenu = function MobileSwitcherMenu(_ref) {
46
50
  onGoBack: onMenuClose,
47
51
  label: label,
48
52
  onClose: onMenuClose
49
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileMenuContent.default, {
53
+ }), items && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileMenuContent.default, {
54
+ header: {
55
+ header: header,
56
+ note: note
57
+ },
58
+ items: items,
59
+ action: footerAction
60
+ }), customContent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileCustomMenuContent.MobileCustomMenuContent, {
50
61
  header: {
51
62
  header: header,
52
63
  note: note
53
64
  },
54
- items: items
65
+ action: footerAction,
66
+ children: customContent
55
67
  })]
56
68
  });
57
69
  };
@@ -61,7 +73,8 @@ MobileSwitcherMenu.propTypes = {
61
73
  header: _propTypes.default.string.isRequired,
62
74
  note: _propTypes.default.string,
63
75
  onMenuClose: _propTypes.default.func.isRequired,
64
- items: _propTypes.default.array
76
+ items: _propTypes.default.array,
77
+ customContent: _propTypes.default.node
65
78
  };
66
79
  var _default = MobileSwitcherMenu;
67
80
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["Wrapper","styled","div","Z_INDEXES","off_canvas","BREAKPOINTS","SMALL","MobileSwitcherMenu","label","header","note","onMenuClose","items"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAGC,0BAAOC,GAAV,qQAEAC,kBAAUC,UAFV,EAUTC,oBAAYC,KAVH,CAAb;;AAwBA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAsD;AAAA,MAApDC,KAAoD,QAApDA,KAAoD;AAAA,MAA7CC,MAA6C,QAA7CA,MAA6C;AAAA,MAArCC,IAAqC,QAArCA,IAAqC;AAAA,MAA/BC,WAA+B,QAA/BA,WAA+B;AAAA,MAAlBC,KAAkB,QAAlBA,KAAkB;AAC/E,sBACE,sBAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,uBAAgB,gBAArC;AAAA,4BACE,qBAAC,yBAAD;AAAkB,MAAA,QAAQ,EAAED,WAA5B;AACkB,MAAA,KAAK,EAAEH,KADzB;AAEkB,MAAA,OAAO,EAAEG;AAF3B,MADF,eAIE,qBAAC,0BAAD;AAAmB,MAAA,MAAM,EAAE;AAACF,QAAAA,MAAM,EAANA,MAAD;AAASC,QAAAA,IAAI,EAAJA;AAAT,OAA3B;AACmB,MAAA,KAAK,EAAEE;AAD1B,MAJF;AAAA,IADF;AASD,CAVD;;;AAPEJ,EAAAA,K;AACAC,EAAAA,M;AACAC,EAAAA,I;AACAC,EAAAA,W;AACAC,EAAAA,K;;eAeaL,kB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS} from '../styles';\nimport {Z_INDEXES} from '../styles';\nimport {MenuNavigationItemTypeItem} from '../GlobalNavigationBar';\nimport MobileMenuHeader from '../GlobalNavigationBar/mobile/MobileMenuHeader';\nimport MobileMenuContent from '../GlobalNavigationBar/mobile/MobileMenuContent';\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\n\ninterface Props {\n label: string;\n header: string;\n note?: string;\n onMenuClose: () => void;\n items?: MenuNavigationItemTypeItem[];\n}\n\nconst MobileSwitcherMenu = ({label, header, note, onMenuClose, items}: Props) => {\n return (\n <Wrapper role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MobileMenuHeader onGoBack={onMenuClose}\n label={label}\n onClose={onMenuClose}/>\n <MobileMenuContent header={{header, note}}\n items={items}/>\n </Wrapper>\n );\n};\n\nexport default MobileSwitcherMenu;\n"],"file":"MobileSwitcherMenu.cjs"}
1
+ {"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["Wrapper","styled","div","Z_INDEXES","off_canvas","BREAKPOINTS","SMALL","MobileSwitcherMenu","label","header","note","onMenuClose","customContent","items","footerAction"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAGA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAGC,0BAAOC,GAAV,qQAEAC,kBAAUC,UAFV,EAUTC,oBAAYC,KAVH,CAAb;;AAyBA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAqF;AAAA,MAAlFC,KAAkF,QAAlFA,KAAkF;AAAA,MAA3EC,MAA2E,QAA3EA,MAA2E;AAAA,MAAnEC,IAAmE,QAAnEA,IAAmE;AAAA,MAA7DC,WAA6D,QAA7DA,WAA6D;AAAA,MAAhDC,aAAgD,QAAhDA,aAAgD;AAAA,MAAjCC,KAAiC,QAAjCA,KAAiC;AAAA,MAA1BC,YAA0B,QAA1BA,YAA0B;AAC9G,sBACE,sBAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,uBAAgB,gBAArC;AAAA,4BACE,qBAAC,yBAAD;AAAkB,MAAA,QAAQ,EAAEH,WAA5B;AAAyC,MAAA,KAAK,EAAEH,KAAhD;AAAuD,MAAA,OAAO,EAAEG;AAAhE,MADF,EAEGE,KAAK,iBAAI,qBAAC,0BAAD;AAAmB,MAAA,MAAM,EAAE;AAAEJ,QAAAA,MAAM,EAANA,MAAF;AAAUC,QAAAA,IAAI,EAAJA;AAAV,OAA3B;AAA6C,MAAA,KAAK,EAAEG,KAApD;AAA2D,MAAA,MAAM,EAAEC;AAAnE,MAFZ,EAGGF,aAAa,iBACZ,qBAAC,gDAAD;AAAyB,MAAA,MAAM,EAAE;AAAEH,QAAAA,MAAM,EAANA,MAAF;AAAUC,QAAAA,IAAI,EAAJA;AAAV,OAAjC;AAAmD,MAAA,MAAM,EAAEI,YAA3D;AAAA,gBACGF;AADH,MAJJ;AAAA,IADF;AAWD,CAZD;;;AATEJ,EAAAA,K;AACAC,EAAAA,M;AACAC,EAAAA,I;AACAC,EAAAA,W;AACAE,EAAAA,K;AAEAD,EAAAA,a;;eAiBaL,kB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { BREAKPOINTS } from '../styles';\nimport { Z_INDEXES } from '../styles';\nimport { MenuButton, MenuNavigationItemTypeItem } from '../GlobalNavigationBar';\nimport MobileMenuHeader from '../GlobalNavigationBar/mobile/MobileMenuHeader';\nimport MobileMenuContent from '../GlobalNavigationBar/mobile/MobileMenuContent';\nimport { MobileCustomMenuContent } from './MobileCustomMenuContent';\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\ninterface Props {\n label: string;\n header: string;\n note?: string;\n onMenuClose: () => void;\n items?: MenuNavigationItemTypeItem[];\n footerAction?: MenuButton;\n customContent?: React.ReactNode;\n}\n\nconst MobileSwitcherMenu = ({ label, header, note, onMenuClose, customContent, items, footerAction }: Props) => {\n return (\n <Wrapper role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MobileMenuHeader onGoBack={onMenuClose} label={label} onClose={onMenuClose} />\n {items && <MobileMenuContent header={{ header, note }} items={items} action={footerAction} />}\n {customContent && (\n <MobileCustomMenuContent header={{ header, note }} action={footerAction}>\n {customContent}\n </MobileCustomMenuContent>\n )}\n </Wrapper>\n );\n};\n\nexport default MobileSwitcherMenu;\n"],"file":"MobileSwitcherMenu.cjs"}
@@ -1,10 +1,13 @@
1
- import { MenuNavigationItemTypeItem } from '../GlobalNavigationBar';
1
+ import * as React from 'react';
2
+ import { MenuButton, MenuNavigationItemTypeItem } from '../GlobalNavigationBar';
2
3
  interface Props {
3
4
  label: string;
4
5
  header: string;
5
6
  note?: string;
6
7
  onMenuClose: () => void;
7
8
  items?: MenuNavigationItemTypeItem[];
9
+ footerAction?: MenuButton;
10
+ customContent?: React.ReactNode;
8
11
  }
9
- declare const MobileSwitcherMenu: ({ label, header, note, onMenuClose, items }: Props) => JSX.Element;
12
+ declare const MobileSwitcherMenu: ({ label, header, note, onMenuClose, customContent, items, footerAction }: Props) => JSX.Element;
10
13
  export default MobileSwitcherMenu;
@@ -9,6 +9,7 @@ import { BREAKPOINTS } from '../styles';
9
9
  import { Z_INDEXES } from '../styles';
10
10
  import MobileMenuHeader from '../GlobalNavigationBar/mobile/MobileMenuHeader';
11
11
  import MobileMenuContent from '../GlobalNavigationBar/mobile/MobileMenuContent';
12
+ import { MobileCustomMenuContent } from './MobileCustomMenuContent';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 320px;\n z-index: ", ";\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ", " {\n width: 400px;\n }\n"])), Z_INDEXES.off_canvas, BREAKPOINTS.SMALL);
@@ -18,7 +19,9 @@ var MobileSwitcherMenu = function MobileSwitcherMenu(_ref) {
18
19
  header = _ref.header,
19
20
  note = _ref.note,
20
21
  onMenuClose = _ref.onMenuClose,
21
- items = _ref.items;
22
+ customContent = _ref.customContent,
23
+ items = _ref.items,
24
+ footerAction = _ref.footerAction;
22
25
  return /*#__PURE__*/_jsxs(Wrapper, {
23
26
  role: "menu",
24
27
  "aria-labelledby": "UserMenuButton",
@@ -26,12 +29,20 @@ var MobileSwitcherMenu = function MobileSwitcherMenu(_ref) {
26
29
  onGoBack: onMenuClose,
27
30
  label: label,
28
31
  onClose: onMenuClose
29
- }), /*#__PURE__*/_jsx(MobileMenuContent, {
32
+ }), items && /*#__PURE__*/_jsx(MobileMenuContent, {
30
33
  header: {
31
34
  header: header,
32
35
  note: note
33
36
  },
34
- items: items
37
+ items: items,
38
+ action: footerAction
39
+ }), customContent && /*#__PURE__*/_jsx(MobileCustomMenuContent, {
40
+ header: {
41
+ header: header,
42
+ note: note
43
+ },
44
+ action: footerAction,
45
+ children: customContent
35
46
  })]
36
47
  });
37
48
  };
@@ -41,7 +52,8 @@ MobileSwitcherMenu.propTypes = {
41
52
  header: _pt.string.isRequired,
42
53
  note: _pt.string,
43
54
  onMenuClose: _pt.func.isRequired,
44
- items: _pt.array
55
+ items: _pt.array,
56
+ customContent: _pt.node
45
57
  };
46
58
  export default MobileSwitcherMenu;
47
59
  //# sourceMappingURL=MobileSwitcherMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["React","styled","BREAKPOINTS","Z_INDEXES","MobileMenuHeader","MobileMenuContent","Wrapper","div","off_canvas","SMALL","MobileSwitcherMenu","label","header","note","onMenuClose","items"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,WAAR,QAA0B,WAA1B;AACA,SAAQC,SAAR,QAAwB,WAAxB;AAEA,OAAOC,gBAAP,MAA6B,gDAA7B;AACA,OAAOC,iBAAP,MAA8B,iDAA9B;;;AAEA,IAAMC,OAAO,GAAGL,MAAM,CAACM,GAAV,uPAEAJ,SAAS,CAACK,UAFV,EAUTN,WAAW,CAACO,KAVH,CAAb;;AAwBA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAsD;AAAA,MAApDC,KAAoD,QAApDA,KAAoD;AAAA,MAA7CC,MAA6C,QAA7CA,MAA6C;AAAA,MAArCC,IAAqC,QAArCA,IAAqC;AAAA,MAA/BC,WAA+B,QAA/BA,WAA+B;AAAA,MAAlBC,KAAkB,QAAlBA,KAAkB;AAC/E,sBACE,MAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,uBAAgB,gBAArC;AAAA,4BACE,KAAC,gBAAD;AAAkB,MAAA,QAAQ,EAAED,WAA5B;AACkB,MAAA,KAAK,EAAEH,KADzB;AAEkB,MAAA,OAAO,EAAEG;AAF3B,MADF,eAIE,KAAC,iBAAD;AAAmB,MAAA,MAAM,EAAE;AAACF,QAAAA,MAAM,EAANA,MAAD;AAASC,QAAAA,IAAI,EAAJA;AAAT,OAA3B;AACmB,MAAA,KAAK,EAAEE;AAD1B,MAJF;AAAA,IADF;AASD,CAVD;;;AAPEJ,EAAAA,K;AACAC,EAAAA,M;AACAC,EAAAA,I;AACAC,EAAAA,W;AACAC,EAAAA,K;;AAeF,eAAeL,kBAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS} from '../styles';\nimport {Z_INDEXES} from '../styles';\nimport {MenuNavigationItemTypeItem} from '../GlobalNavigationBar';\nimport MobileMenuHeader from '../GlobalNavigationBar/mobile/MobileMenuHeader';\nimport MobileMenuContent from '../GlobalNavigationBar/mobile/MobileMenuContent';\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\n\ninterface Props {\n label: string;\n header: string;\n note?: string;\n onMenuClose: () => void;\n items?: MenuNavigationItemTypeItem[];\n}\n\nconst MobileSwitcherMenu = ({label, header, note, onMenuClose, items}: Props) => {\n return (\n <Wrapper role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MobileMenuHeader onGoBack={onMenuClose}\n label={label}\n onClose={onMenuClose}/>\n <MobileMenuContent header={{header, note}}\n items={items}/>\n </Wrapper>\n );\n};\n\nexport default MobileSwitcherMenu;\n"],"file":"MobileSwitcherMenu.js"}
1
+ {"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["React","styled","BREAKPOINTS","Z_INDEXES","MobileMenuHeader","MobileMenuContent","MobileCustomMenuContent","Wrapper","div","off_canvas","SMALL","MobileSwitcherMenu","label","header","note","onMenuClose","customContent","items","footerAction"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,SAAT,QAA0B,WAA1B;AAEA,OAAOC,gBAAP,MAA6B,gDAA7B;AACA,OAAOC,iBAAP,MAA8B,iDAA9B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;;;AAEA,IAAMC,OAAO,GAAGN,MAAM,CAACO,GAAV,uPAEAL,SAAS,CAACM,UAFV,EAUTP,WAAW,CAACQ,KAVH,CAAb;;AAyBA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAqF;AAAA,MAAlFC,KAAkF,QAAlFA,KAAkF;AAAA,MAA3EC,MAA2E,QAA3EA,MAA2E;AAAA,MAAnEC,IAAmE,QAAnEA,IAAmE;AAAA,MAA7DC,WAA6D,QAA7DA,WAA6D;AAAA,MAAhDC,aAAgD,QAAhDA,aAAgD;AAAA,MAAjCC,KAAiC,QAAjCA,KAAiC;AAAA,MAA1BC,YAA0B,QAA1BA,YAA0B;AAC9G,sBACE,MAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,uBAAgB,gBAArC;AAAA,4BACE,KAAC,gBAAD;AAAkB,MAAA,QAAQ,EAAEH,WAA5B;AAAyC,MAAA,KAAK,EAAEH,KAAhD;AAAuD,MAAA,OAAO,EAAEG;AAAhE,MADF,EAEGE,KAAK,iBAAI,KAAC,iBAAD;AAAmB,MAAA,MAAM,EAAE;AAAEJ,QAAAA,MAAM,EAANA,MAAF;AAAUC,QAAAA,IAAI,EAAJA;AAAV,OAA3B;AAA6C,MAAA,KAAK,EAAEG,KAApD;AAA2D,MAAA,MAAM,EAAEC;AAAnE,MAFZ,EAGGF,aAAa,iBACZ,KAAC,uBAAD;AAAyB,MAAA,MAAM,EAAE;AAAEH,QAAAA,MAAM,EAANA,MAAF;AAAUC,QAAAA,IAAI,EAAJA;AAAV,OAAjC;AAAmD,MAAA,MAAM,EAAEI,YAA3D;AAAA,gBACGF;AADH,MAJJ;AAAA,IADF;AAWD,CAZD;;;AATEJ,EAAAA,K;AACAC,EAAAA,M;AACAC,EAAAA,I;AACAC,EAAAA,W;AACAE,EAAAA,K;AAEAD,EAAAA,a;;AAiBF,eAAeL,kBAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { BREAKPOINTS } from '../styles';\nimport { Z_INDEXES } from '../styles';\nimport { MenuButton, MenuNavigationItemTypeItem } from '../GlobalNavigationBar';\nimport MobileMenuHeader from '../GlobalNavigationBar/mobile/MobileMenuHeader';\nimport MobileMenuContent from '../GlobalNavigationBar/mobile/MobileMenuContent';\nimport { MobileCustomMenuContent } from './MobileCustomMenuContent';\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\ninterface Props {\n label: string;\n header: string;\n note?: string;\n onMenuClose: () => void;\n items?: MenuNavigationItemTypeItem[];\n footerAction?: MenuButton;\n customContent?: React.ReactNode;\n}\n\nconst MobileSwitcherMenu = ({ label, header, note, onMenuClose, customContent, items, footerAction }: Props) => {\n return (\n <Wrapper role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MobileMenuHeader onGoBack={onMenuClose} label={label} onClose={onMenuClose} />\n {items && <MobileMenuContent header={{ header, note }} items={items} action={footerAction} />}\n {customContent && (\n <MobileCustomMenuContent header={{ header, note }} action={footerAction}>\n {customContent}\n </MobileCustomMenuContent>\n )}\n </Wrapper>\n );\n};\n\nexport default MobileSwitcherMenu;\n"],"file":"MobileSwitcherMenu.js"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useScrollableContainer = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _rooks = require("rooks");
17
+
18
+ var useScrollableContainer = function useScrollableContainer(recalculateScrollDeps) {
19
+ var _React$useState = _react.default.useState(false),
20
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
21
+ scrollable = _React$useState2[0],
22
+ setScrollable = _React$useState2[1];
23
+
24
+ var _useDimensionsRef = (0, _rooks.useDimensionsRef)({
25
+ updateOnResize: true
26
+ }),
27
+ _useDimensionsRef2 = (0, _slicedToArray2.default)(_useDimensionsRef, 3),
28
+ scrollContainerRef = _useDimensionsRef2[0],
29
+ dimensions = _useDimensionsRef2[1],
30
+ node = _useDimensionsRef2[2];
31
+
32
+ _react.default.useEffect(function () {
33
+ var _node$clientHeight, _node$scrollHeight;
34
+
35
+ var clientHeight = (_node$clientHeight = node === null || node === void 0 ? void 0 : node.clientHeight) !== null && _node$clientHeight !== void 0 ? _node$clientHeight : 0;
36
+ var scrollHeight = (_node$scrollHeight = node === null || node === void 0 ? void 0 : node.scrollHeight) !== null && _node$scrollHeight !== void 0 ? _node$scrollHeight : 0;
37
+ setScrollable(scrollHeight > clientHeight);
38
+ }, [dimensions, node].concat((0, _toConsumableArray2.default)(recalculateScrollDeps)));
39
+
40
+ return [scrollContainerRef, scrollable];
41
+ };
42
+
43
+ exports.useScrollableContainer = useScrollableContainer;
44
+ //# sourceMappingURL=ScrollableContainer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/common/ScrollableContainer.ts"],"names":["useScrollableContainer","recalculateScrollDeps","React","useState","scrollable","setScrollable","updateOnResize","scrollContainerRef","dimensions","node","useEffect","clientHeight","scrollHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,qBAAD,EAAkC;AACtE,wBAAoCC,eAAMC,QAAN,CAAe,KAAf,CAApC;AAAA;AAAA,MAAOC,UAAP;AAAA,MAAmBC,aAAnB;;AACA,0BAA+C,6BAAiB;AAAEC,IAAAA,cAAc,EAAE;AAAlB,GAAjB,CAA/C;AAAA;AAAA,MAAOC,kBAAP;AAAA,MAA2BC,UAA3B;AAAA,MAAuCC,IAAvC;;AAEAP,iBAAMQ,SAAN,CAAgB,YAAM;AAAA;;AACpB,QAAMC,YAAY,yBAAGF,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEE,YAAT,mEAAyB,CAA3C;AACA,QAAMC,YAAY,yBAAGH,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEG,YAAT,mEAAyB,CAA3C;AACAP,IAAAA,aAAa,CAACO,YAAY,GAAGD,YAAhB,CAAb;AACD,GAJD,GAIIH,UAJJ,EAIgBC,IAJhB,0CAIyBR,qBAJzB;;AAMA,SAAO,CAACM,kBAAD,EAAqBH,UAArB,CAAP;AACD,CAXM","sourcesContent":["import React from 'react';\nimport { useDimensionsRef } from 'rooks';\n\nexport const useScrollableContainer = (recalculateScrollDeps: any[]) => {\n const [scrollable, setScrollable] = React.useState(false);\n const [scrollContainerRef, dimensions, node] = useDimensionsRef({ updateOnResize: true });\n\n React.useEffect(() => {\n const clientHeight = node?.clientHeight ?? 0;\n const scrollHeight = node?.scrollHeight ?? 0;\n setScrollable(scrollHeight > clientHeight);\n }, [dimensions, node, ...recalculateScrollDeps]);\n\n return [scrollContainerRef, scrollable];\n};\n"],"file":"ScrollableContainer.cjs"}
@@ -0,0 +1 @@
1
+ export declare const useScrollableContainer: (recalculateScrollDeps: any[]) => (boolean | import("react").LegacyRef<HTMLDivElement> | undefined)[];
@@ -0,0 +1,28 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import React from 'react';
4
+ import { useDimensionsRef } from 'rooks';
5
+ export var useScrollableContainer = function useScrollableContainer(recalculateScrollDeps) {
6
+ var _React$useState = React.useState(false),
7
+ _React$useState2 = _slicedToArray(_React$useState, 2),
8
+ scrollable = _React$useState2[0],
9
+ setScrollable = _React$useState2[1];
10
+
11
+ var _useDimensionsRef = useDimensionsRef({
12
+ updateOnResize: true
13
+ }),
14
+ _useDimensionsRef2 = _slicedToArray(_useDimensionsRef, 3),
15
+ scrollContainerRef = _useDimensionsRef2[0],
16
+ dimensions = _useDimensionsRef2[1],
17
+ node = _useDimensionsRef2[2];
18
+
19
+ React.useEffect(function () {
20
+ var _node$clientHeight, _node$scrollHeight;
21
+
22
+ var clientHeight = (_node$clientHeight = node === null || node === void 0 ? void 0 : node.clientHeight) !== null && _node$clientHeight !== void 0 ? _node$clientHeight : 0;
23
+ var scrollHeight = (_node$scrollHeight = node === null || node === void 0 ? void 0 : node.scrollHeight) !== null && _node$scrollHeight !== void 0 ? _node$scrollHeight : 0;
24
+ setScrollable(scrollHeight > clientHeight);
25
+ }, [dimensions, node].concat(_toConsumableArray(recalculateScrollDeps)));
26
+ return [scrollContainerRef, scrollable];
27
+ };
28
+ //# sourceMappingURL=ScrollableContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/common/ScrollableContainer.ts"],"names":["React","useDimensionsRef","useScrollableContainer","recalculateScrollDeps","useState","scrollable","setScrollable","updateOnResize","scrollContainerRef","dimensions","node","useEffect","clientHeight","scrollHeight"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,gBAAT,QAAiC,OAAjC;AAEA,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,qBAAD,EAAkC;AACtE,wBAAoCH,KAAK,CAACI,QAAN,CAAe,KAAf,CAApC;AAAA;AAAA,MAAOC,UAAP;AAAA,MAAmBC,aAAnB;;AACA,0BAA+CL,gBAAgB,CAAC;AAAEM,IAAAA,cAAc,EAAE;AAAlB,GAAD,CAA/D;AAAA;AAAA,MAAOC,kBAAP;AAAA,MAA2BC,UAA3B;AAAA,MAAuCC,IAAvC;;AAEAV,EAAAA,KAAK,CAACW,SAAN,CAAgB,YAAM;AAAA;;AACpB,QAAMC,YAAY,yBAAGF,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEE,YAAT,mEAAyB,CAA3C;AACA,QAAMC,YAAY,yBAAGH,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEG,YAAT,mEAAyB,CAA3C;AACAP,IAAAA,aAAa,CAACO,YAAY,GAAGD,YAAhB,CAAb;AACD,GAJD,GAIIH,UAJJ,EAIgBC,IAJhB,4BAIyBP,qBAJzB;AAMA,SAAO,CAACK,kBAAD,EAAqBH,UAArB,CAAP;AACD,CAXM","sourcesContent":["import React from 'react';\nimport { useDimensionsRef } from 'rooks';\n\nexport const useScrollableContainer = (recalculateScrollDeps: any[]) => {\n const [scrollable, setScrollable] = React.useState(false);\n const [scrollContainerRef, dimensions, node] = useDimensionsRef({ updateOnResize: true });\n\n React.useEffect(() => {\n const clientHeight = node?.clientHeight ?? 0;\n const scrollHeight = node?.scrollHeight ?? 0;\n setScrollable(scrollHeight > clientHeight);\n }, [dimensions, node, ...recalculateScrollDeps]);\n\n return [scrollContainerRef, scrollable];\n};\n"],"file":"ScrollableContainer.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laerdal/life-react-components",
3
- "version": "1.11.0-dev.13.full",
3
+ "version": "1.11.0-dev.16",
4
4
  "private": false,
5
5
  "author": "Thomas Kalve <thomas.kalve@laerdal.com>",
6
6
  "contributors": [