@elliemae/ds-form-date-time-picker 3.52.0-rc.9 → 3.52.1
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/dist/cjs/config/useGetPropsWithDefault.js +17 -1
- package/dist/cjs/config/useGetPropsWithDefault.js.map +2 -2
- package/dist/cjs/parts/ControlledDateTimePickerContent.js +6 -3
- package/dist/cjs/parts/ControlledDateTimePickerContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js +5 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js +16 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarHead.js +1 -0
- package/dist/cjs/parts/Pickers/Calendar/CalendarHead.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js +2 -4
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js +1 -0
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/Day.js +6 -2
- package/dist/cjs/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/Styleds.js +40 -7
- package/dist/cjs/parts/Pickers/Calendar/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useConfigCalendarCTX.js +2 -1
- package/dist/cjs/parts/Pickers/Calendar/useConfigCalendarCTX.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +8 -2
- package/dist/cjs/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useFocusLogic.js +5 -9
- package/dist/cjs/parts/Pickers/Calendar/useFocusLogic.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useKeyboardHandlers.js +6 -3
- package/dist/cjs/parts/Pickers/Calendar/useKeyboardHandlers.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/usePopperTriggerLogic.js +4 -2
- package/dist/cjs/parts/Pickers/Calendar/usePopperTriggerLogic.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +5 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +16 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -5
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +1 -0
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/Styleds.js +4 -11
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js +7 -3
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js +6 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js +5 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js +37 -9
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js +9 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js +16 -3
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +2 -6
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelWrapper.js +2 -0
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelWrapper.js.map +2 -2
- package/dist/cjs/parts/Styleds.js +13 -1
- package/dist/cjs/parts/Styleds.js.map +2 -2
- package/dist/cjs/utils/dateHelpers.js +6 -0
- package/dist/cjs/utils/dateHelpers.js.map +2 -2
- package/dist/cjs/utils/hooks/useGetStartingFocusedDay.js +5 -1
- package/dist/cjs/utils/hooks/useGetStartingFocusedDay.js.map +2 -2
- package/dist/esm/config/useGetPropsWithDefault.js +17 -1
- package/dist/esm/config/useGetPropsWithDefault.js.map +2 -2
- package/dist/esm/parts/ControlledDateTimePickerContent.js +5 -2
- package/dist/esm/parts/ControlledDateTimePickerContent.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js +5 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js +17 -4
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarHead.js +1 -0
- package/dist/esm/parts/Pickers/Calendar/CalendarHead.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js +2 -4
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js +1 -0
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/Day.js +6 -2
- package/dist/esm/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/Styleds.js +40 -7
- package/dist/esm/parts/Pickers/Calendar/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useConfigCalendarCTX.js +2 -1
- package/dist/esm/parts/Pickers/Calendar/useConfigCalendarCTX.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +8 -2
- package/dist/esm/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useFocusLogic.js +5 -9
- package/dist/esm/parts/Pickers/Calendar/useFocusLogic.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useKeyboardHandlers.js +6 -3
- package/dist/esm/parts/Pickers/Calendar/useKeyboardHandlers.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/usePopperTriggerLogic.js +4 -2
- package/dist/esm/parts/Pickers/Calendar/usePopperTriggerLogic.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +5 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +17 -4
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -5
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +1 -0
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/Styleds.js +4 -11
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js +7 -3
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js +6 -2
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js +5 -2
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js +37 -9
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js +9 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js +17 -4
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +2 -6
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelWrapper.js +2 -0
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelWrapper.js.map +2 -2
- package/dist/esm/parts/Styleds.js +13 -1
- package/dist/esm/parts/Styleds.js.map +2 -2
- package/dist/esm/utils/dateHelpers.js +6 -0
- package/dist/esm/utils/dateHelpers.js.map +2 -2
- package/dist/esm/utils/hooks/useGetStartingFocusedDay.js +5 -1
- package/dist/esm/utils/hooks/useGetStartingFocusedDay.js.map +2 -2
- package/dist/types/parts/Pickers/Calendar/Styleds.d.ts +9 -3
- package/dist/types/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.d.ts +1 -0
- package/dist/types/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +2 -1
- package/dist/types/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +6 -2
- package/dist/types/parts/Pickers/TimeWheel/Styleds.d.ts +6 -2
- package/dist/types/parts/Styleds.d.ts +2 -0
- package/dist/types/tests/DSControlledDateTimePicker.PUI-16014.test.d.ts +1 -0
- package/dist/types/utils/dateHelpers.d.ts +1 -0
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/Styleds.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { css, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport {\n DSControlledDateTimePickerName,\n DSControlledDateTimePickerSlots,\n} from '../../../ControlledDateTimePickerDefinitions.js';\n\nconst diagonalLine = css`\n &:before {\n position: absolute;\n content: '';\n top: 48%;\n left: -2px;\n height: 1px;\n width: calc(100% + 4px);\n transform: rotate(45deg);\n background-color: ${({ theme }) => theme.colors.neutral[500]};\n }\n`;\n\nconst focusBorder = css`\n &:after {\n position: absolute;\n content: '';\n top: -4px;\n left: -4px;\n width: calc(100% + 8px);\n height: calc(100% + 8px);\n border-radius: 50%;\n }\n`;\n\nconst backgroundDateRange = {\n inRange: css`\n background-color: ${({ theme }) => theme.colors.brand[200]};\n box-shadow: 4px 0 0 0 ${({ theme }) => theme.colors.brand[200]};\n `,\n startRange: css`\n background-color: ${({ theme }) => theme.colors.brand[200]};\n border-radius: 50% 0 0 50%;\n box-shadow: 4px 0 0 0 ${({ theme }) => theme.colors.brand[200]};\n `,\n endRange: css`\n background-color: ${({ theme }) => theme.colors.brand[200]};\n border-radius: 0 50% 50% 0;\n `,\n};\n\nexport const StyledIconTriggerButton = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.PICKER_ICONS.CALENDAR,\n})`\n color: ${({ theme }) => theme.colors.brand['600']};\n width: 2rem;\n height: 2rem;\n`;\n\nexport const StyledShadowWrapper = styled('div', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CONTROLLER_COMPONENT.CALENDAR,\n})``;\n\nexport const StyledCalendarWrapper = styled.div`\n display: grid;\n min-width: 260px;\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n grid-template-rows: auto auto;\n`;\n\nexport const StyledHeader = styled.section`\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n display: grid;\n padding: ${({ theme }) => theme.space.xxxs};\n grid-template-columns: min-content min-content 1fr min-content min-content;\n grid-template-rows: 1fr;\n align-items: center;\n justify-content: center;\n text-align: center;\n background: ${({ theme }) => theme.colors.neutral['050']};\n`;\n\nexport const StyledHeaderLabel = styled('h3', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.HEADER_LABEL,\n})`\n font-size: 1rem;\n`;\n\nexport const StyledHeaderButton = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.HEADER_BUTTON,\n})`\n position: relative;\n width: 2.1538rem;\n height: 2.1538rem;\n &:focus {\n &:after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n border-radius: 2px;\n pointer-events: none;\n }\n }\n &:hover {\n background: ${({ theme }) => theme.colors.brand[200]};\n }\n`;\n\nexport const StyledBody = styled.section`\n padding: ${({ theme }) => theme.space.xxxs};\n`;\n\nexport const StyledDayBtn = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.DAY_BUTTON,\n})`\n height: 2.4615rem;\n width: 2.4615rem;\n border-radius: 50%;\n position: relative;\n border-width: 2px;\n border-style: solid;\n border-color: transparent;\n line-height: 1;\n color: ${({ theme }) => theme.colors.neutral[800]};\n &:hover {\n cursor: pointer;\n color: ${({ theme }) => theme.colors.brand[700]};\n background-color: ${({ theme }) => theme.colors.brand[200]};\n }\n &:focus {\n ${focusBorder}\n }\n display: flex;\n justify-content: center;\n align-items: center;\n`;\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const StyledWeekDaysListWrapper = styled(Grid, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.HEADER_WEEKLY_DAY_LIST,\n})<{ isHeader?: boolean }>`\n font-size: ${({ theme }) => theme.fontSizes.label[400]};\n text-align: center;\n justify-items: center;\n ${({ isHeader, theme }) => (isHeader ? `background: ${theme.colors.neutral['050']}` : '')};\n ${({ isHeader }) => (isHeader ? 'text-transform: capitalize' : '')};\n\n .dayWrapper.selectedDay,\n .dayWrapper.startRangeDay,\n .dayWrapper.endRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n }\n\n &:not(.disabledDay),\n &:not(.outOfRangeDay) {\n ${StyledDayBtn} {\n background-color: ${({ theme }) => theme.colors.brand[700]};\n }\n }\n\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n background-color: ${({ theme }) => theme.colors.danger[900]};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n border-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n\n &.outOfRangeDay.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.disabledDay,\n .dayWrapper.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n ${diagonalLine}\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n &.focusedDay {\n ${StyledDayBtn} {\n &:after {\n border: 2px solid ${({ theme }) => theme.colors.danger[900]};\n }\n }\n }\n }\n\n .dayWrapper.focusedDay {\n ${StyledDayBtn} {\n ${focusBorder}\n color: ${({ theme }) => theme.colors.brand[600]};\n &:after {\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n }\n\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.danger[900]};\n &:before {\n background-color: ${({ theme }) => theme.colors.danger[900]};\n }\n }\n }\n }\n\n .dayWrapper.selectedDay.disabledDay.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n .dayWrapper.notCurrentMonth {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n }\n\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.brand[600]};\n }\n\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.danger[900]};\n }\n\n &.inRangeDay,\n &.startRangeDay,\n &.endRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n &.selectedDay,\n &.startRangeDay,\n &.endRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n .dayWrapper.inRangeDay {\n ${backgroundDateRange.inRange}\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n background-color: ${({ theme }) => theme.colors.danger[900]};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n &.focusedDay {\n ${StyledDayBtn} {\n border-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.startRangeDay {\n &.inRangeImproperDay {\n ${backgroundDateRange.startRange}\n }\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.endRangeDay {\n &.inRangeImproperDay {\n ${backgroundDateRange.endRange}\n }\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.endRangeDay.startRangeDay {\n background-color: transparent;\n box-shadow: none;\n }\n`;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nexport const StyledWeekDaysHeaderItem = styled.div`\n min-width: 2.4615rem;\n display: flex;\n justify-content: center;\n align-items: center;\n`;\n\nexport const CalendarFooterMessage = styled('div', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.FOOTERS.CALENDAR,\n})`\n border-top: solid 1px ${({ theme }) => theme.colors.neutral[300]};\n margin: 0 ${({ theme }) => theme.space.xxs2};\n padding: ${({ theme }) => theme.space.xxs2} 0;\n color: ${({ theme }) => theme.colors.danger[900]};\n font-style: italic;\n font-weight: ${({ theme }) => theme.fontWeights.thin};\n font-size: ${({ theme }) => theme.fontSizes.microText[200]};\n text-align: right;\n background-color: white;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAA4B;AAC5B,qBAAqB;AACrB,0BAA2B;AAC3B,iDAGO;AAEP,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASG,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAIhE,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYpB,MAAM,sBAAsB;AAAA,EAC1B,SAAS;AAAA,wBACa,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,4BAClC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA,EAEhE,YAAY;AAAA,wBACU,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA,4BAElC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA,EAEhE,UAAU;AAAA,wBACY,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAG9D;AAEO,MAAM,8BAA0B,yBAAO,gCAAY;AAAA,EACxD,MAAM;AAAA,EACN,MAAM,2EAAgC,aAAa;AACrD,CAAC;AAAA,WACU,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;AAAA;AAAA;AAK5C,MAAM,0BAAsB,yBAAO,OAAO;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,2EAAgC,qBAAqB;AAC7D,CAAC;AAEM,MAAM,wBAAwB,wBAAO;AAAA;AAAA;AAAA,sBAGtB,CAAC,EAAE,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { css, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport {\n DSControlledDateTimePickerName,\n DSControlledDateTimePickerSlots,\n} from '../../../ControlledDateTimePickerDefinitions.js';\n\nconst diagonalLine = css`\n &:before {\n position: absolute;\n content: '';\n top: 48%;\n left: -2px;\n height: 1px;\n width: calc(100% + 4px);\n transform: rotate(45deg);\n background-color: ${({ theme }) => theme.colors.neutral[500]};\n }\n`;\n\nconst focusBorder = css`\n &:after {\n position: absolute;\n content: '';\n top: -4px;\n left: -4px;\n width: calc(100% + 8px);\n height: calc(100% + 8px);\n border-radius: 50%;\n }\n`;\n\nconst backgroundDateRange = {\n inRange: css`\n background-color: ${({ theme }) => theme.colors.brand[200]};\n box-shadow: 4px 0 0 0 ${({ theme }) => theme.colors.brand[200]};\n `,\n startRange: css`\n background-color: ${({ theme }) => theme.colors.brand[200]};\n border-radius: 50% 0 0 50%;\n box-shadow: 4px 0 0 0 ${({ theme }) => theme.colors.brand[200]};\n `,\n endRange: css`\n background-color: ${({ theme }) => theme.colors.brand[200]};\n border-radius: 0 50% 50% 0;\n `,\n};\n\nexport const StyledIconTriggerButton = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.PICKER_ICONS.CALENDAR,\n})`\n color: ${({ theme }) => theme.colors.brand['800']};\n width: 2rem;\n height: 2rem;\n`;\n\nexport const StyledShadowWrapper = styled('div', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CONTROLLER_COMPONENT.CALENDAR,\n})``;\n\nexport const StyledCalendarWrapper = styled.div<{ readOnlyStyles?: boolean }>`\n display: grid;\n min-width: 260px;\n background-color: ${({ theme, readOnlyStyles }) =>\n readOnlyStyles ? theme.colors.neutral['050'] : theme.colors.neutral['000']};\n grid-template-rows: auto auto;\n`;\n\nexport const StyledHeader = styled.section`\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n display: grid;\n padding: ${({ theme }) => theme.space.xxxs};\n grid-template-columns: min-content min-content 1fr min-content min-content;\n grid-template-rows: 1fr;\n align-items: center;\n justify-content: center;\n text-align: center;\n background: ${({ theme }) => theme.colors.neutral['050']};\n`;\n\nexport const StyledHeaderLabel = styled('h3', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.HEADER_LABEL,\n})`\n font-size: 1rem;\n`;\n\nexport const StyledHeaderButton = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.HEADER_BUTTON,\n})`\n position: relative;\n width: 2.1538rem;\n height: 2.1538rem;\n &:focus {\n &:after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n border-radius: 2px;\n pointer-events: none;\n }\n }\n &:hover {\n background: ${({ theme }) => theme.colors.brand[200]};\n }\n`;\n\nexport const StyledBody = styled.section`\n padding: ${({ theme }) => theme.space.xxxs};\n`;\n\nexport const StyledDayBtn = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.DAY_BUTTON,\n})<{ readOnlyStyles?: boolean }>`\n height: 2.4615rem;\n width: 2.4615rem;\n border-radius: 50%;\n position: relative;\n border-width: 2px;\n border-style: solid;\n border-color: transparent;\n line-height: 1;\n color: ${({ theme }) => theme.colors.neutral[800]};\n &:hover {\n cursor: pointer;\n color: ${({ theme }) => theme.colors.brand[700]};\n background-color: ${({ theme }) => theme.colors.brand[200]};\n }\n &:focus {\n ${focusBorder}\n }\n display: flex;\n justify-content: center;\n align-items: center;\n`;\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const StyledWeekDaysListWrapper = styled(Grid, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CALENDAR.HEADER_WEEKLY_DAY_LIST,\n})<{ isHeader?: boolean }>`\n font-size: ${({ theme }) => theme.fontSizes.label[400]};\n text-align: center;\n justify-items: center;\n ${({ isHeader, theme }) => (isHeader ? `background: ${theme.colors.neutral['050']}` : '')};\n ${({ isHeader }) => (isHeader ? 'text-transform: capitalize' : '')};\n\n .dayWrapper.selectedDay,\n .dayWrapper.startRangeDay,\n .dayWrapper.endRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n }\n &:not(.disabledDay),\n &:not(.outOfRangeDay) {\n ${StyledDayBtn} {\n background-color: ${({ theme }) => theme.colors.brand[700]};\n }\n }\n\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n background-color: ${({ theme }) => theme.colors.danger[900]};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n border-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n\n &.outOfRangeDay.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.disabledDay,\n .dayWrapper.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n ${diagonalLine}\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n &.focusedDay {\n ${StyledDayBtn} {\n &:after {\n border: 2px solid ${({ theme }) => theme.colors.danger[900]};\n }\n }\n }\n }\n\n .dayWrapper.focusedDay {\n ${StyledDayBtn} {\n ${focusBorder}\n &:after {\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n }\n\n &:not(.readOnly) {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.brand[600]};\n }\n }\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.danger[900]};\n &:before {\n background-color: ${({ theme }) => theme.colors.danger[900]};\n }\n }\n }\n &.selectedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n .dayWrapper.selectedDay.disabledDay.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n .dayWrapper.readOnly {\n ${StyledDayBtn} {\n :hover {\n cursor: not-allowed;\n background-color: ${({ theme }) => theme.colors.neutral['100']};\n color: ${({ theme }) => theme.colors.neutral['700']};\n }\n }\n }\n\n .dayWrapper.selectedDay.readOnly {\n ${StyledDayBtn} {\n background-color: ${({ theme }) => theme.colors.neutral['500']};\n font-weight: semibold;\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n :hover {\n background-color: ${({ theme }) => theme.colors.neutral['700']};\n }\n :focus {\n background-color: ${({ theme }) => theme.colors.neutral['700']};\n }\n }\n }\n\n .dayWrapper.notCurrentMonth {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n }\n\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.brand[600]};\n }\n\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.danger[900]};\n }\n\n &.inRangeDay,\n &.startRangeDay,\n &.endRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n &.selectedDay,\n &.startRangeDay,\n &.endRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n\n .dayWrapper.inRangeDay {\n ${backgroundDateRange.inRange}\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n background-color: ${({ theme }) => theme.colors.danger[900]};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n &.focusedDay {\n ${StyledDayBtn} {\n border-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.startRangeDay {\n &.inRangeImproperDay {\n ${backgroundDateRange.startRange}\n }\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.endRangeDay {\n &.inRangeImproperDay {\n ${backgroundDateRange.endRange}\n }\n &.focusedDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n &.disabledDay,\n &.outOfRangeDay {\n ${StyledDayBtn} {\n color: ${({ theme }) => theme.colors.neutral['000']};\n &:before {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n }\n }\n }\n\n .dayWrapper.endRangeDay.startRangeDay {\n background-color: transparent;\n box-shadow: none;\n }\n`;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nexport const StyledWeekDaysHeaderItem = styled.div`\n min-width: 2.4615rem;\n display: flex;\n justify-content: center;\n align-items: center;\n`;\n\nexport const CalendarFooterMessage = styled('div', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.FOOTERS.CALENDAR,\n})<{ readOnlyStyles?: boolean }>`\n border-top: solid 1px ${({ theme }) => theme.colors.neutral[300]};\n margin: 0 ${({ theme }) => theme.space.xxs2};\n padding: ${({ theme }) => theme.space.xxs2} 0;\n color: ${({ theme }) => theme.colors.danger[900]};\n font-size: ${({ theme }) => theme.fontSizes.microText[200]};\n text-align: right;\n background-color: ${({ theme, readOnlyStyles }) =>\n readOnlyStyles ? theme.colors.neutral['050'] : theme.colors.neutral['000']};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";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O,QAAQ,GAAG,CAAC;AAAA,cACpD,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,IAAI;AAAA,aAChC,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,IAAI;AAAA,WACjC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,eACnC,CAAC,EAAE,MAAM,MAAM,MAAM,UAAU,UAAU,GAAG,CAAC;AAAA;AAAA,sBAEtC,CAAC,EAAE,OAAO,eAAe,MAC3C,iBAAiB,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -63,7 +63,8 @@ const useConfigCalendarCTX = () => {
|
|
|
63
63
|
const popperTriggerLogic = (0, import_usePopperTriggerLogic.usePopperTriggerLogic)({
|
|
64
64
|
focusLogic,
|
|
65
65
|
showCalendar,
|
|
66
|
-
setShowCalendar
|
|
66
|
+
setShowCalendar,
|
|
67
|
+
resetMonthYear: currentDisplayedMonthLogic.resetMonthYear
|
|
67
68
|
});
|
|
68
69
|
const keyboardHandlers = (0, import_useKeyboardHandlers.useKeyboardHandlers)({
|
|
69
70
|
currentDisplayedMonthLogic,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/useConfigCalendarCTX.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useState, useMemo, useContext, useCallback } from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';\nimport { useFocusLogic } from './useFocusLogic.js';\nimport { usePopperTriggerLogic } from './usePopperTriggerLogic.js';\nimport { useKeyboardHandlers } from './useKeyboardHandlers.js';\n\nexport type CalendarContextT = ReturnType<typeof useCurrentDisplayedMonthYearLogic> &\n ReturnType<typeof useFocusLogic> &\n ReturnType<typeof usePopperTriggerLogic> &\n ReturnType<typeof useKeyboardHandlers> & {\n showCalendar: boolean;\n setShowCalendar: TypescriptHelpersT.StateSetter<boolean>;\n\n onPrevYearFocus: React.FocusEventHandler;\n onPrevMonthFocus: React.FocusEventHandler;\n onNextMonthFocus: React.FocusEventHandler;\n onNextYearFocus: React.FocusEventHandler;\n };\n\nexport const useConfigCalendarCTX = (): CalendarContextT => {\n const {\n trackFocusCalendarPrevYear,\n trackFocusCalendarNextYear,\n trackFocusCalendarPrevMonth,\n trackFocusCalendarNextMonth,\n } = useContext(ControlledDateTimePickerContext);\n const [showCalendar, setShowCalendar] = useState(false);\n\n const onPrevYearFocus = useCallback(() => {\n trackFocusCalendarPrevYear();\n }, [trackFocusCalendarPrevYear]);\n const onPrevMonthFocus = useCallback(() => {\n trackFocusCalendarPrevMonth();\n }, [trackFocusCalendarPrevMonth]);\n const onNextMonthFocus = useCallback(() => {\n trackFocusCalendarNextMonth();\n }, [trackFocusCalendarNextMonth]);\n const onNextYearFocus = useCallback(() => {\n trackFocusCalendarNextYear();\n }, [trackFocusCalendarNextYear]);\n\n const currentDisplayedMonthLogic = useCurrentDisplayedMonthYearLogic();\n const focusLogic = useFocusLogic({ currentDisplayedMonthLogic, showCalendar });\n const popperTriggerLogic = usePopperTriggerLogic({\n focusLogic,\n showCalendar,\n setShowCalendar,\n });\n const keyboardHandlers = useKeyboardHandlers({\n currentDisplayedMonthLogic,\n focusLogic,\n });\n\n return useMemo(\n () => ({\n showCalendar,\n setShowCalendar,\n\n onPrevYearFocus,\n onPrevMonthFocus,\n onNextMonthFocus,\n onNextYearFocus,\n\n ...currentDisplayedMonthLogic,\n ...focusLogic,\n ...popperTriggerLogic,\n ...keyboardHandlers,\n }),\n [\n showCalendar,\n onPrevYearFocus,\n onPrevMonthFocus,\n onNextMonthFocus,\n onNextYearFocus,\n currentDisplayedMonthLogic,\n focusLogic,\n popperTriggerLogic,\n keyboardHandlers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA2D;AAE3D,yCAAgD;AAChD,+CAAkD;AAClD,2BAA8B;AAC9B,mCAAsC;AACtC,iCAAoC;AAe7B,MAAM,uBAAuB,MAAwB;AAC1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,KAAK;AAEtD,QAAM,sBAAkB,0BAAY,MAAM;AACxC,+BAA2B;AAAA,EAC7B,GAAG,CAAC,0BAA0B,CAAC;AAC/B,QAAM,uBAAmB,0BAAY,MAAM;AACzC,gCAA4B;AAAA,EAC9B,GAAG,CAAC,2BAA2B,CAAC;AAChC,QAAM,uBAAmB,0BAAY,MAAM;AACzC,gCAA4B;AAAA,EAC9B,GAAG,CAAC,2BAA2B,CAAC;AAChC,QAAM,sBAAkB,0BAAY,MAAM;AACxC,+BAA2B;AAAA,EAC7B,GAAG,CAAC,0BAA0B,CAAC;AAE/B,QAAM,iCAA6B,4EAAkC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useState, useMemo, useContext, useCallback } from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';\nimport { useFocusLogic } from './useFocusLogic.js';\nimport { usePopperTriggerLogic } from './usePopperTriggerLogic.js';\nimport { useKeyboardHandlers } from './useKeyboardHandlers.js';\n\nexport type CalendarContextT = ReturnType<typeof useCurrentDisplayedMonthYearLogic> &\n ReturnType<typeof useFocusLogic> &\n ReturnType<typeof usePopperTriggerLogic> &\n ReturnType<typeof useKeyboardHandlers> & {\n showCalendar: boolean;\n setShowCalendar: TypescriptHelpersT.StateSetter<boolean>;\n\n onPrevYearFocus: React.FocusEventHandler;\n onPrevMonthFocus: React.FocusEventHandler;\n onNextMonthFocus: React.FocusEventHandler;\n onNextYearFocus: React.FocusEventHandler;\n };\n\nexport const useConfigCalendarCTX = (): CalendarContextT => {\n const {\n trackFocusCalendarPrevYear,\n trackFocusCalendarNextYear,\n trackFocusCalendarPrevMonth,\n trackFocusCalendarNextMonth,\n } = useContext(ControlledDateTimePickerContext);\n const [showCalendar, setShowCalendar] = useState(false);\n\n const onPrevYearFocus = useCallback(() => {\n trackFocusCalendarPrevYear();\n }, [trackFocusCalendarPrevYear]);\n const onPrevMonthFocus = useCallback(() => {\n trackFocusCalendarPrevMonth();\n }, [trackFocusCalendarPrevMonth]);\n const onNextMonthFocus = useCallback(() => {\n trackFocusCalendarNextMonth();\n }, [trackFocusCalendarNextMonth]);\n const onNextYearFocus = useCallback(() => {\n trackFocusCalendarNextYear();\n }, [trackFocusCalendarNextYear]);\n\n const currentDisplayedMonthLogic = useCurrentDisplayedMonthYearLogic();\n\n const focusLogic = useFocusLogic({ currentDisplayedMonthLogic, showCalendar });\n const popperTriggerLogic = usePopperTriggerLogic({\n focusLogic,\n showCalendar,\n setShowCalendar,\n resetMonthYear: currentDisplayedMonthLogic.resetMonthYear,\n });\n const keyboardHandlers = useKeyboardHandlers({\n currentDisplayedMonthLogic,\n focusLogic,\n });\n\n return useMemo(\n () => ({\n showCalendar,\n setShowCalendar,\n\n onPrevYearFocus,\n onPrevMonthFocus,\n onNextMonthFocus,\n onNextYearFocus,\n\n ...currentDisplayedMonthLogic,\n ...focusLogic,\n ...popperTriggerLogic,\n ...keyboardHandlers,\n }),\n [\n showCalendar,\n onPrevYearFocus,\n onPrevMonthFocus,\n onNextMonthFocus,\n onNextYearFocus,\n currentDisplayedMonthLogic,\n focusLogic,\n popperTriggerLogic,\n keyboardHandlers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA2D;AAE3D,yCAAgD;AAChD,+CAAkD;AAClD,2BAA8B;AAC9B,mCAAsC;AACtC,iCAAoC;AAe7B,MAAM,uBAAuB,MAAwB;AAC1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,KAAK;AAEtD,QAAM,sBAAkB,0BAAY,MAAM;AACxC,+BAA2B;AAAA,EAC7B,GAAG,CAAC,0BAA0B,CAAC;AAC/B,QAAM,uBAAmB,0BAAY,MAAM;AACzC,gCAA4B;AAAA,EAC9B,GAAG,CAAC,2BAA2B,CAAC;AAChC,QAAM,uBAAmB,0BAAY,MAAM;AACzC,gCAA4B;AAAA,EAC9B,GAAG,CAAC,2BAA2B,CAAC;AAChC,QAAM,sBAAkB,0BAAY,MAAM;AACxC,+BAA2B;AAAA,EAC7B,GAAG,CAAC,0BAA0B,CAAC;AAE/B,QAAM,iCAA6B,4EAAkC;AAErE,QAAM,iBAAa,oCAAc,EAAE,4BAA4B,aAAa,CAAC;AAC7E,QAAM,yBAAqB,oDAAsB;AAAA,IAC/C;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,2BAA2B;AAAA,EAC7C,CAAC;AACD,QAAM,uBAAmB,gDAAoB;AAAA,IAC3C;AAAA,IACA;AAAA,EACF,CAAC;AAED,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -76,6 +76,10 @@ const useCurrentDisplayedMonthYearLogic = () => {
|
|
|
76
76
|
const [currentMonth, setCurrentMonth] = (0, import_react.useState)(monthFromDateString);
|
|
77
77
|
const [currentYear, setCurrentYear] = (0, import_react.useState)(yearFromDateString);
|
|
78
78
|
const daysArraysRef = (0, import_react.useRef)([]);
|
|
79
|
+
const resetMonthYear = (0, import_react.useCallback)(() => {
|
|
80
|
+
setCurrentMonth(monthFromDateString);
|
|
81
|
+
setCurrentYear(yearFromDateString);
|
|
82
|
+
}, [monthFromDateString, yearFromDateString]);
|
|
79
83
|
(0, import_react.useEffect)(() => {
|
|
80
84
|
setCurrentMonth(monthFromDateString);
|
|
81
85
|
}, [monthFromDateString]);
|
|
@@ -131,7 +135,8 @@ const useCurrentDisplayedMonthYearLogic = () => {
|
|
|
131
135
|
handlePrevMonth,
|
|
132
136
|
handleNextMonth,
|
|
133
137
|
handleNextYear,
|
|
134
|
-
daysArraysRef
|
|
138
|
+
daysArraysRef,
|
|
139
|
+
resetMonthYear
|
|
135
140
|
}),
|
|
136
141
|
[
|
|
137
142
|
currentMonth,
|
|
@@ -143,7 +148,8 @@ const useCurrentDisplayedMonthYearLogic = () => {
|
|
|
143
148
|
handlePrevMonth,
|
|
144
149
|
handlePrevYear,
|
|
145
150
|
invisibleFirstDay,
|
|
146
|
-
invisibleLastDay
|
|
151
|
+
invisibleLastDay,
|
|
152
|
+
resetMonthYear
|
|
147
153
|
]
|
|
148
154
|
);
|
|
149
155
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState, useEffect, createRef, useRef } from 'react';\n// eslint-disable-next-line max-len\nimport { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';\nimport {\n getSixBySevenCurrentMonthDaysMatrix,\n sumFromDateValues,\n sumValuesToDate,\n getDateStringFromDay,\n} from '../../../utils/dateHelpers.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction sliceIntoChunks<T = any>(arr: Array<T>, chunkSize: number): Array<Array<T>> {\n const res = [];\n for (let i = 0; i < arr.length; i += chunkSize) {\n const chunk = arr.slice(i, i + chunkSize);\n res.push(chunk);\n }\n return res;\n}\ninterface UseCurrentDisplayedMonthYearLogicT {\n currentMonth: DSControlledDateTimePickerInternalsT.DateMonth;\n currentYear: number;\n daysArray: DSControlledDateTimePickerInternalsT.MetaMonthDay[];\n invisibleFirstDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n daysMatrixByWeekday: DSControlledDateTimePickerInternalsT.MetaMonthDay[][];\n invisibleLastDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n handlePrevMonth: () => void;\n handlePrevYear: () => void;\n handleNextMonth: () => void;\n handleNextYear: () => void;\n daysArraysRef: React.MutableRefObject<DSControlledDateTimePickerInternalsT.MetaMonthDay[]>;\n}\n\nconst getDaysArrays = (currentMonth: DSControlledDateTimePickerInternalsT.DateMonth, currentYear: number) => {\n const newDaysArray = getSixBySevenCurrentMonthDaysMatrix(currentMonth, currentYear);\n const hiddenPrevDay = sumValuesToDate(newDaysArray[0].day, {\n daysToSum: -1,\n });\n const hiddenPrevMetaday = {\n day: hiddenPrevDay,\n dayAsString: getDateStringFromDay(hiddenPrevDay),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n const hiddenNextDay = sumValuesToDate(newDaysArray[newDaysArray.length - 1].day, {\n daysToSum: 1,\n });\n const hiddenNextMetaday = {\n day: hiddenNextDay,\n dayAsString: getDateStringFromDay(hiddenNextDay),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n return [hiddenPrevMetaday, ...newDaysArray, hiddenNextMetaday];\n};\nexport const useCurrentDisplayedMonthYearLogic = (): UseCurrentDisplayedMonthYearLogicT => {\n const { month: monthFromDateString, year: yearFromDateString } = useGetMonthYearFromDateStringOrEmptyStartingMonth();\n const [currentMonth, setCurrentMonth] = useState(monthFromDateString);\n const [currentYear, setCurrentYear] = useState(yearFromDateString);\n const daysArraysRef = useRef<DSControlledDateTimePickerInternalsT.MetaMonthDay[]>([]);\n // side-effects are really really controlled in this case so use-effect should be fine\n // don't add 200 side-effects to those or else Chaos would hunt us for the years to come\n useEffect(() => {\n setCurrentMonth(monthFromDateString);\n }, [monthFromDateString]);\n useEffect(() => {\n setCurrentYear(yearFromDateString);\n }, [yearFromDateString]);\n\n const daysArray = useMemo(() => getDaysArrays(currentMonth, currentYear), [currentMonth, currentYear]);\n\n daysArraysRef.current = daysArray;\n\n const handlePrevYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: -1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handlePrevMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: -1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n daysArraysRef.current = getDaysArrays(newMonth, newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: 1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n daysArraysRef.current = getDaysArrays(newMonth, newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: 1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const { invisibleFirstDay, daysMatrixByWeekday, invisibleLastDay } = useMemo(() => {\n const [invisible1stDay, ...otherDays] = [...daysArray];\n const invisibleDayLast = otherDays.pop();\n return {\n invisibleFirstDay: invisible1stDay,\n daysMatrixByWeekday: sliceIntoChunks<DSControlledDateTimePickerInternalsT.MetaMonthDay>(otherDays, 7),\n invisibleLastDay: invisibleDayLast,\n };\n }, [daysArray]);\n\n return useMemo(\n () => ({\n currentMonth,\n currentYear,\n daysArray,\n invisibleFirstDay,\n daysMatrixByWeekday,\n invisibleLastDay,\n handlePrevYear,\n handlePrevMonth,\n handleNextMonth,\n handleNextYear,\n daysArraysRef,\n }),\n [\n currentMonth,\n currentYear,\n daysArray,\n daysMatrixByWeekday,\n handleNextMonth,\n handleNextYear,\n handlePrevMonth,\n handlePrevYear,\n invisibleFirstDay,\n invisibleLastDay,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA6E;AAE7E,+DAAkE;AAClE,yBAKO;AAIP,SAAS,gBAAyB,KAAe,WAAoC;AACnF,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,WAAW;AAC9C,UAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,SAAS;AACxC,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState, useEffect, createRef, useRef } from 'react';\n// eslint-disable-next-line max-len\nimport { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';\nimport {\n getSixBySevenCurrentMonthDaysMatrix,\n sumFromDateValues,\n sumValuesToDate,\n getDateStringFromDay,\n} from '../../../utils/dateHelpers.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction sliceIntoChunks<T = any>(arr: Array<T>, chunkSize: number): Array<Array<T>> {\n const res = [];\n for (let i = 0; i < arr.length; i += chunkSize) {\n const chunk = arr.slice(i, i + chunkSize);\n res.push(chunk);\n }\n return res;\n}\ninterface UseCurrentDisplayedMonthYearLogicT {\n currentMonth: DSControlledDateTimePickerInternalsT.DateMonth;\n currentYear: number;\n daysArray: DSControlledDateTimePickerInternalsT.MetaMonthDay[];\n invisibleFirstDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n daysMatrixByWeekday: DSControlledDateTimePickerInternalsT.MetaMonthDay[][];\n invisibleLastDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n handlePrevMonth: () => void;\n handlePrevYear: () => void;\n handleNextMonth: () => void;\n handleNextYear: () => void;\n daysArraysRef: React.MutableRefObject<DSControlledDateTimePickerInternalsT.MetaMonthDay[]>;\n resetMonthYear: () => void;\n}\n\nconst getDaysArrays = (currentMonth: DSControlledDateTimePickerInternalsT.DateMonth, currentYear: number) => {\n const newDaysArray = getSixBySevenCurrentMonthDaysMatrix(currentMonth, currentYear);\n const hiddenPrevDay = sumValuesToDate(newDaysArray[0].day, {\n daysToSum: -1,\n });\n const hiddenPrevMetaday = {\n day: hiddenPrevDay,\n dayAsString: getDateStringFromDay(hiddenPrevDay),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n const hiddenNextDay = sumValuesToDate(newDaysArray[newDaysArray.length - 1].day, {\n daysToSum: 1,\n });\n const hiddenNextMetaday = {\n day: hiddenNextDay,\n dayAsString: getDateStringFromDay(hiddenNextDay),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n return [hiddenPrevMetaday, ...newDaysArray, hiddenNextMetaday];\n};\nexport const useCurrentDisplayedMonthYearLogic = (): UseCurrentDisplayedMonthYearLogicT => {\n const { month: monthFromDateString, year: yearFromDateString } = useGetMonthYearFromDateStringOrEmptyStartingMonth();\n const [currentMonth, setCurrentMonth] = useState(monthFromDateString);\n const [currentYear, setCurrentYear] = useState(yearFromDateString);\n\n const daysArraysRef = useRef<DSControlledDateTimePickerInternalsT.MetaMonthDay[]>([]);\n\n const resetMonthYear = useCallback(() => {\n setCurrentMonth(monthFromDateString);\n setCurrentYear(yearFromDateString);\n }, [monthFromDateString, yearFromDateString]);\n // side-effects are really really controlled in this case so use-effect should be fine\n // don't add 200 side-effects to those or else Chaos would hunt us for the years to come\n useEffect(() => {\n setCurrentMonth(monthFromDateString);\n }, [monthFromDateString]);\n useEffect(() => {\n setCurrentYear(yearFromDateString);\n }, [yearFromDateString]);\n\n const daysArray = useMemo(() => getDaysArrays(currentMonth, currentYear), [currentMonth, currentYear]);\n\n daysArraysRef.current = daysArray;\n\n const handlePrevYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: -1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handlePrevMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: -1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n daysArraysRef.current = getDaysArrays(newMonth, newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: 1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n daysArraysRef.current = getDaysArrays(newMonth, newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: 1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const { invisibleFirstDay, daysMatrixByWeekday, invisibleLastDay } = useMemo(() => {\n const [invisible1stDay, ...otherDays] = [...daysArray];\n const invisibleDayLast = otherDays.pop();\n return {\n invisibleFirstDay: invisible1stDay,\n daysMatrixByWeekday: sliceIntoChunks<DSControlledDateTimePickerInternalsT.MetaMonthDay>(otherDays, 7),\n invisibleLastDay: invisibleDayLast,\n };\n }, [daysArray]);\n\n return useMemo(\n () => ({\n currentMonth,\n currentYear,\n daysArray,\n invisibleFirstDay,\n daysMatrixByWeekday,\n invisibleLastDay,\n handlePrevYear,\n handlePrevMonth,\n handleNextMonth,\n handleNextYear,\n daysArraysRef,\n resetMonthYear,\n }),\n [\n currentMonth,\n currentYear,\n daysArray,\n daysMatrixByWeekday,\n handleNextMonth,\n handleNextYear,\n handlePrevMonth,\n handlePrevYear,\n invisibleFirstDay,\n invisibleLastDay,\n resetMonthYear,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA6E;AAE7E,+DAAkE;AA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C;AACzG,mBAAe,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,WAAW,CAAC;AAE9B,QAAM,EAAE,mBAAmB,qBAAqB,iBAAiB,QAAI,sBAAQ,MAAM;AACjF,UAAM,CAAC,iBAAiB,GAAG,SAAS,IAAI,CAAC,GAAG,SAAS;AACrD,UAAM,mBAAmB,UAAU,IAAI;AACvC,WAAO;AAAA,MACL,mBAAmB;AAAA,MACnB,qBAAqB,gBAAmE,WAAW,CAAC;AAAA,MACpG,kBAAkB;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,23 +36,19 @@ var import_react = require("react");
|
|
|
36
36
|
var import_dateHelpers = require("../../../utils/dateHelpers.js");
|
|
37
37
|
var import_useGetStartingFocusedDay = require("../../../utils/hooks/useGetStartingFocusedDay.js");
|
|
38
38
|
const useFocusLogic = ({ currentDisplayedMonthLogic }) => {
|
|
39
|
-
const { daysArraysRef } = currentDisplayedMonthLogic;
|
|
39
|
+
const { daysArraysRef, daysArray } = currentDisplayedMonthLogic;
|
|
40
40
|
const { startFocusedDate } = (0, import_useGetStartingFocusedDay.useGetStartingFocusedDay)();
|
|
41
41
|
const [metadayToFocus, setMetadayToFocus] = (0, import_react.useState)(
|
|
42
|
-
|
|
42
|
+
void 0
|
|
43
43
|
);
|
|
44
44
|
const focusedDay = (0, import_react.useMemo)(() => {
|
|
45
45
|
let newFocusedDay;
|
|
46
46
|
if (metadayToFocus)
|
|
47
|
-
newFocusedDay =
|
|
48
|
-
({ day: currDay }) => (0, import_dateHelpers.compareTwoDatesDayEquality)(currDay, metadayToFocus.day)
|
|
49
|
-
);
|
|
47
|
+
newFocusedDay = daysArray.find(({ day: currDay }) => (0, import_dateHelpers.compareTwoDatesDayEquality)(currDay, metadayToFocus.day));
|
|
50
48
|
else if (startFocusedDate)
|
|
51
|
-
newFocusedDay =
|
|
52
|
-
({ day: currDay }) => (0, import_dateHelpers.compareTwoDatesDayEquality)(currDay, startFocusedDate)
|
|
53
|
-
);
|
|
49
|
+
newFocusedDay = daysArray.find(({ day: currDay }) => (0, import_dateHelpers.compareTwoDatesDayEquality)(currDay, startFocusedDate));
|
|
54
50
|
return newFocusedDay;
|
|
55
|
-
}, [
|
|
51
|
+
}, [daysArray, startFocusedDate, metadayToFocus]);
|
|
56
52
|
const handleFocusMetaDay = (0, import_react.useCallback)(
|
|
57
53
|
(metaDayToFocus) => {
|
|
58
54
|
const newFocusedMetaDay = daysArraysRef.current.find(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/useFocusLogic.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState } from 'react';\nimport { compareTwoDatesDayEquality } from '../../../utils/dateHelpers.js';\nimport { useGetStartingFocusedDay } from '../../../utils/hooks/useGetStartingFocusedDay.js';\nimport type { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\n\ninterface UseFocusLogicArgsT {\n currentDisplayedMonthLogic: ReturnType<typeof useCurrentDisplayedMonthYearLogic>;\n showCalendar: boolean;\n}\ninterface FocusLogicT {\n focusedDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n resetFocusedDayToStartDate: () => void;\n handleFocusMetaDay: (metaDayToFocus: DSControlledDateTimePickerInternalsT.MetaMonthDay) => void;\n handleFocusMetaDayByDay: (day: Date) => void;\n}\n\nexport const useFocusLogic = ({ currentDisplayedMonthLogic }: UseFocusLogicArgsT): FocusLogicT => {\n const { daysArraysRef } = currentDisplayedMonthLogic;\n const { startFocusedDate } = useGetStartingFocusedDay();\n const [metadayToFocus, setMetadayToFocus] = useState<DSControlledDateTimePickerInternalsT.MetaMonthDay | undefined>(\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA+C;AAC/C,yBAA2C;AAC3C,sCAAyC;AAelC,MAAM,gBAAgB,CAAC,EAAE,2BAA2B,MAAuC;AAChG,QAAM,EAAE,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState } from 'react';\nimport { compareTwoDatesDayEquality } from '../../../utils/dateHelpers.js';\nimport { useGetStartingFocusedDay } from '../../../utils/hooks/useGetStartingFocusedDay.js';\nimport type { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\n\ninterface UseFocusLogicArgsT {\n currentDisplayedMonthLogic: ReturnType<typeof useCurrentDisplayedMonthYearLogic>;\n showCalendar: boolean;\n}\ninterface FocusLogicT {\n focusedDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n resetFocusedDayToStartDate: () => void;\n handleFocusMetaDay: (metaDayToFocus: DSControlledDateTimePickerInternalsT.MetaMonthDay) => void;\n handleFocusMetaDayByDay: (day: Date) => void;\n}\n\nexport const useFocusLogic = ({ currentDisplayedMonthLogic }: UseFocusLogicArgsT): FocusLogicT => {\n const { daysArraysRef, daysArray } = currentDisplayedMonthLogic;\n const { startFocusedDate } = useGetStartingFocusedDay();\n const [metadayToFocus, setMetadayToFocus] = useState<DSControlledDateTimePickerInternalsT.MetaMonthDay | undefined>(\n undefined,\n );\n\n // this is required because we have to focus based on the inputs values too,\n // useGetStartingFocusedDay does this already,\n // this \"useMemo\" is here just to trigger it functionally by changing the metadayToFocus state\n // which is required for arrow key navigation in the calendar\n const focusedDay = useMemo(() => {\n let newFocusedDay;\n\n if (metadayToFocus)\n newFocusedDay = daysArray.find(({ day: currDay }) => compareTwoDatesDayEquality(currDay, metadayToFocus.day));\n else if (startFocusedDate)\n newFocusedDay = daysArray.find(({ day: currDay }) => compareTwoDatesDayEquality(currDay, startFocusedDate));\n return newFocusedDay;\n }, [daysArray, startFocusedDate, metadayToFocus]);\n\n const handleFocusMetaDay = useCallback(\n (metaDayToFocus: DSControlledDateTimePickerInternalsT.MetaMonthDay) => {\n // if focusedDay is inside current daysArray we set Focused day\n const newFocusedMetaDay = daysArraysRef.current.find(({ day: currDay }) =>\n compareTwoDatesDayEquality(currDay, metaDayToFocus.day),\n );\n if (focusedDay !== newFocusedMetaDay) setMetadayToFocus(newFocusedMetaDay);\n },\n [daysArraysRef, focusedDay],\n );\n\n const handleFocusMetaDayByDay = useCallback(\n (dayDate: Date) => {\n // if focusedDay is inside current daysArray we set Focused day\n const newFocusedMetaDay = daysArraysRef.current.find(({ day: currDay }) =>\n compareTwoDatesDayEquality(currDay, dayDate),\n );\n if (focusedDay !== newFocusedMetaDay) setMetadayToFocus(newFocusedMetaDay);\n },\n [daysArraysRef, focusedDay],\n );\n\n const resetFocusedDayToStartDate = useCallback(() => {\n setMetadayToFocus(undefined);\n }, []);\n\n return useMemo(\n () => ({\n focusedDay,\n resetFocusedDayToStartDate,\n handleFocusMetaDay,\n handleFocusMetaDayByDay,\n }),\n [focusedDay, resetFocusedDayToStartDate, handleFocusMetaDay, handleFocusMetaDayByDay],\n );\n};\n", "import * as React from 'react';\nexport { React };\n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AAG,CAAC,CAAC;AAEL,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,YAAY,4BAA4B,oBAAoB,uBAAuB;AAAA,EACtF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -63,9 +63,12 @@ const useKeyboardHandlers = ({
|
|
|
63
63
|
} = focusLogic;
|
|
64
64
|
const { daysArray, handlePrevMonth, handleNextMonth } = currentDisplayedMonthLogic;
|
|
65
65
|
const tryToFocusDayRegion = (0, import_react.useCallback)(() => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const isFocusedStillVisible = focusedDay ? daysArray.some(({ day }) => (0, import_dateHelpers.compareTwoDateAreInSameMonth)(day, focusedDay.day)) : false;
|
|
67
|
+
if (!focusedDay || !isFocusedStillVisible) {
|
|
68
|
+
const firstCurrMonth = daysArray.find((d) => d.isCurrMonthDay);
|
|
69
|
+
if (firstCurrMonth) {
|
|
70
|
+
handleFocusMetaDay(firstCurrMonth);
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
trackFocusCalendarMetafocusedDay();
|
|
71
74
|
}, [daysArray, focusedDay, handleFocusMetaDay, trackFocusCalendarMetafocusedDay]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/useKeyboardHandlers.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useCallback, useContext, useMemo } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\nimport {\n compareTwoDateAreInSameMonth,\n isSecondDateInNextMonth,\n isSecondDateInPreviousMonth,\n sumValuesToDate,\n} from '../../../utils/dateHelpers.js';\nimport type { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';\nimport type { useFocusLogic } from './useFocusLogic.js';\n\ninterface UseKeyboardHandlersArgsT {\n currentDisplayedMonthLogic: ReturnType<typeof useCurrentDisplayedMonthYearLogic>;\n focusLogic: ReturnType<typeof useFocusLogic>;\n}\ntype HandleDayOnKeyDownT = (e: React.KeyboardEvent, day: DSControlledDateTimePickerInternalsT.MetaMonthDay) => void;\ninterface KeyboardHandlersT {\n handleDayOnKeyDown: HandleDayOnKeyDownT;\n handlePrevYearKeyDown: (e: React.KeyboardEvent) => void;\n handlePrevMonthKeyDown: (e: React.KeyboardEvent) => void;\n handleNextMonthKeyDown: (e: React.KeyboardEvent) => void;\n handleNextYearKeyDown: (e: React.KeyboardEvent) => void;\n handlePickerIconKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n}\nexport const useKeyboardHandlers = ({\n currentDisplayedMonthLogic,\n focusLogic,\n}: UseKeyboardHandlersArgsT): KeyboardHandlersT => {\n const {\n isControllerOnly,\n isWithTimeWheelToo,\n withAnyInputs,\n isWithTimeInputs,\n isWithDateInputs,\n trackFocusFirstSegment,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n trackFocusCalendarPrevMonth,\n trackFocusCalendarNextMonth,\n trackFocusCalendarNextYear,\n trackFocusCalendarPrevYear,\n trackFocusTimewheelCurrMeridiem,\n trackFocusCalendarMetafocusedDay,\n } = useContext(ControlledDateTimePickerContext);\n const {\n focusedDay,\n handleFocusMetaDay,\n handleFocusMetaDayByDay,\n // tryToFocusCurrentlyDataIsFocusedDay\n } = focusLogic;\n const { daysArray, handlePrevMonth, handleNextMonth } = currentDisplayedMonthLogic;\n\n const tryToFocusDayRegion = useCallback(() => {\n if (!focusedDay) {\n const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAiD;AACjD,yCAAgD;AAEhD,yBAKO;AAiBA,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA;AAAA,EAEF,IAAI;AACJ,QAAM,EAAE,WAAW,iBAAiB,gBAAgB,IAAI;AAExD,QAAM,0BAAsB,0BAAY,MAAM;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useCallback, useContext, useMemo } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\nimport {\n compareTwoDateAreInSameMonth,\n isSecondDateInNextMonth,\n isSecondDateInPreviousMonth,\n sumValuesToDate,\n} from '../../../utils/dateHelpers.js';\nimport type { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';\nimport type { useFocusLogic } from './useFocusLogic.js';\n\ninterface UseKeyboardHandlersArgsT {\n currentDisplayedMonthLogic: ReturnType<typeof useCurrentDisplayedMonthYearLogic>;\n focusLogic: ReturnType<typeof useFocusLogic>;\n}\ntype HandleDayOnKeyDownT = (e: React.KeyboardEvent, day: DSControlledDateTimePickerInternalsT.MetaMonthDay) => void;\ninterface KeyboardHandlersT {\n handleDayOnKeyDown: HandleDayOnKeyDownT;\n handlePrevYearKeyDown: (e: React.KeyboardEvent) => void;\n handlePrevMonthKeyDown: (e: React.KeyboardEvent) => void;\n handleNextMonthKeyDown: (e: React.KeyboardEvent) => void;\n handleNextYearKeyDown: (e: React.KeyboardEvent) => void;\n handlePickerIconKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n}\nexport const useKeyboardHandlers = ({\n currentDisplayedMonthLogic,\n focusLogic,\n}: UseKeyboardHandlersArgsT): KeyboardHandlersT => {\n const {\n isControllerOnly,\n isWithTimeWheelToo,\n withAnyInputs,\n isWithTimeInputs,\n isWithDateInputs,\n trackFocusFirstSegment,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n trackFocusCalendarPrevMonth,\n trackFocusCalendarNextMonth,\n trackFocusCalendarNextYear,\n trackFocusCalendarPrevYear,\n trackFocusTimewheelCurrMeridiem,\n trackFocusCalendarMetafocusedDay,\n } = useContext(ControlledDateTimePickerContext);\n const {\n focusedDay,\n handleFocusMetaDay,\n handleFocusMetaDayByDay,\n // tryToFocusCurrentlyDataIsFocusedDay\n } = focusLogic;\n const { daysArray, handlePrevMonth, handleNextMonth } = currentDisplayedMonthLogic;\n\n const tryToFocusDayRegion = useCallback(() => {\n // If there\u2019s a focusedDay, check if it\u2019s still visible\n const isFocusedStillVisible = focusedDay\n ? daysArray.some(({ day }) => compareTwoDateAreInSameMonth(day, focusedDay.day))\n : false;\n\n // If no focusedDay or the existing one went off-screen, pick the first current-month day\n if (!focusedDay || !isFocusedStillVisible) {\n const firstCurrMonth = daysArray.find((d) => d.isCurrMonthDay);\n if (firstCurrMonth) {\n handleFocusMetaDay(firstCurrMonth);\n }\n }\n\n trackFocusCalendarMetafocusedDay();\n }, [daysArray, focusedDay, handleFocusMetaDay, trackFocusCalendarMetafocusedDay]);\n\n const onHomeKeyDownInsideCalendar = useCallback(() => {\n trackFocusCalendarPrevMonth();\n }, [trackFocusCalendarPrevMonth]);\n const onEndKeyDownInsideCalendar = useCallback(() => {\n if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();\n else tryToFocusDayRegion();\n }, [isWithTimeWheelToo, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);\n\n const onHomeKeyDownTriggerIcon = useCallback(() => {\n trackFocusFirstSegment();\n }, [trackFocusFirstSegment]);\n const handlePickerIconKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown<HTMLButtonElement> = useCallback(\n (e) => {\n const { key } = e;\n if (['Home', 'End'].includes(key)) e.preventDefault();\n if (['Home', 'End'].includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDownTriggerIcon();\n if (key === 'Backspace' && withAnyInputs) {\n if (isWithTimeInputs) trackFocusMeridiemInput();\n else if (isWithDateInputs) trackFocusYearInput();\n }\n },\n [\n isWithDateInputs,\n isWithTimeInputs,\n onHomeKeyDownTriggerIcon,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n withAnyInputs,\n ],\n );\n // pending ux deciding what's going to happen, should we prevent changing month?\n // as a strict \"picker\" interpretation we should prevent it if disabled/readonly/ariaDisabled\n // as a more general \"calendar\" interpretation we can choose to allow it.\n const shouldPreventMonthChange = false;\n\n const handleDayOnKeyDown = useCallback(\n (e: React.KeyboardEvent, metaDay: DSControlledDateTimePickerInternalsT.MetaMonthDay) => {\n let newFocusedDayDate: Date | undefined;\n const { day } = metaDay;\n const { key, shiftKey } = e;\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();\n\n if (key === 'ArrowUp') newFocusedDayDate = sumValuesToDate(day, { daysToSum: -7 });\n if (key === 'ArrowDown') newFocusedDayDate = sumValuesToDate(day, { daysToSum: 7 });\n if (key === 'ArrowLeft') newFocusedDayDate = sumValuesToDate(day, { daysToSum: -1 });\n if (key === 'ArrowRight') newFocusedDayDate = sumValuesToDate(day, { daysToSum: 1 });\n\n if (newFocusedDayDate) {\n const newDayShareTheSameMonth = compareTwoDateAreInSameMonth(day, newFocusedDayDate);\n if (!newDayShareTheSameMonth && shouldPreventMonthChange) return;\n if (isSecondDateInPreviousMonth(day, newFocusedDayDate)) handlePrevMonth();\n if (isSecondDateInNextMonth(day, newFocusedDayDate)) handleNextMonth();\n handleFocusMetaDayByDay(newFocusedDayDate);\n }\n if (key === 'Home') onHomeKeyDownInsideCalendar();\n if (key === 'End') onEndKeyDownInsideCalendar();\n // TAB CYCLE IMPLEMENTATION\n if (key === 'Tab' && !shiftKey && isControllerOnly === false && !isWithTimeWheelToo) {\n // MUST prevent default since this is a custom focus switch\n // NOT preventing the default event will cause unexpected result\n e.preventDefault();\n trackFocusCalendarPrevMonth();\n }\n },\n [\n handleFocusMetaDayByDay,\n handleNextMonth,\n handlePrevMonth,\n isControllerOnly,\n isWithTimeWheelToo,\n onEndKeyDownInsideCalendar,\n onHomeKeyDownInsideCalendar,\n shouldPreventMonthChange,\n trackFocusCalendarPrevMonth,\n ],\n );\n const handlePrevYearKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { key, shiftKey } = e;\n if (key === 'Tab') {\n e.preventDefault();\n if (shiftKey) {\n trackFocusCalendarNextMonth();\n } else {\n trackFocusCalendarNextYear();\n }\n }\n if (key === 'Home') {\n onHomeKeyDownInsideCalendar();\n e.preventDefault();\n }\n if (key === 'End') {\n onEndKeyDownInsideCalendar();\n e.preventDefault();\n }\n },\n [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusCalendarNextYear],\n );\n const handlePrevMonthKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { key, shiftKey } = e;\n if (key === 'Tab') {\n if (shiftKey) {\n // TAB CYCLE IMPLEMENTATION\n if (!isControllerOnly) {\n e.preventDefault();\n if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();\n else tryToFocusDayRegion();\n }\n } else {\n e.preventDefault();\n trackFocusCalendarNextMonth();\n }\n }\n if (key === 'Home') {\n onHomeKeyDownInsideCalendar();\n e.preventDefault();\n }\n if (key === 'End') {\n onEndKeyDownInsideCalendar();\n e.preventDefault();\n }\n },\n [\n isControllerOnly,\n isWithTimeWheelToo,\n onEndKeyDownInsideCalendar,\n onHomeKeyDownInsideCalendar,\n trackFocusCalendarNextMonth,\n trackFocusTimewheelCurrMeridiem,\n tryToFocusDayRegion,\n ],\n );\n const handleNextMonthKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { key, shiftKey } = e;\n if (key === 'Tab') {\n e.preventDefault();\n if (shiftKey) {\n trackFocusCalendarPrevMonth();\n } else {\n trackFocusCalendarPrevYear();\n }\n }\n if (key === 'Home') {\n onHomeKeyDownInsideCalendar();\n e.preventDefault();\n }\n if (key === 'End') {\n onEndKeyDownInsideCalendar();\n e.preventDefault();\n }\n },\n [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth, trackFocusCalendarPrevYear],\n );\n const handleNextYearKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { key, shiftKey } = e;\n if (key === 'Tab') {\n e.preventDefault();\n if (shiftKey) {\n trackFocusCalendarPrevYear();\n }\n if (!shiftKey) tryToFocusDayRegion();\n }\n if (key === 'Home') {\n onHomeKeyDownInsideCalendar();\n e.preventDefault();\n }\n if (key === 'End') {\n onEndKeyDownInsideCalendar();\n e.preventDefault();\n }\n },\n [tryToFocusDayRegion, trackFocusCalendarPrevYear, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar],\n );\n\n return useMemo(\n () => ({\n handleDayOnKeyDown,\n handlePrevYearKeyDown,\n handlePrevMonthKeyDown,\n handleNextMonthKeyDown,\n handleNextYearKeyDown,\n handlePickerIconKeyDown,\n }),\n [\n handleDayOnKeyDown,\n handlePrevYearKeyDown,\n handlePrevMonthKeyDown,\n handleNextMonthKeyDown,\n handleNextYearKeyDown,\n handlePickerIconKeyDown,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAiD;AACjD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AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,6BAAyB;AAAA,IAC7B,CAAC,MAA2B;AAC1B,YAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,UAAI,QAAQ,OAAO;AACjB,UAAE,eAAe;AACjB,YAAI,UAAU;AACZ,sCAA4B;AAAA,QAC9B,OAAO;AACL,qCAA2B;AAAA,QAC7B;AAAA,MACF;AACA,UAAI,QAAQ,QAAQ;AAClB,oCAA4B;AAC5B,UAAE,eAAe;AAAA,MACnB;AACA,UAAI,QAAQ,OAAO;AACjB,mCAA2B;AAC3B,UAAE,eAAe;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,4BAA4B,6BAA6B,6BAA6B,0BAA0B;AAAA,EACnH;AACA,QAAM,4BAAwB;AAAA,IAC5B,CAAC,MAA2B;AAC1B,YAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,UAAI,QAAQ,OAAO;AACjB,UAAE,eAAe;AACjB,YAAI,UAAU;AACZ,qCAA2B;AAAA,QAC7B;AACA,YAAI,CAAC,SAAU,qBAAoB;AAAA,MACrC;AACA,UAAI,QAAQ,QAAQ;AAClB,oCAA4B;AAC5B,UAAE,eAAe;AAAA,MACnB;AACA,UAAI,QAAQ,OAAO;AACjB,mCAA2B;AAC3B,UAAE,eAAe;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,4BAA4B,6BAA6B,0BAA0B;AAAA,EAC3G;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,7 +37,8 @@ var import_ControlledDateTimePickerCTX = require("../../../ControlledDateTimePic
|
|
|
37
37
|
const usePopperTriggerLogic = ({
|
|
38
38
|
focusLogic,
|
|
39
39
|
showCalendar,
|
|
40
|
-
setShowCalendar
|
|
40
|
+
setShowCalendar,
|
|
41
|
+
resetMonthYear
|
|
41
42
|
}) => {
|
|
42
43
|
const { focusedDay, resetFocusedDayToStartDate } = focusLogic;
|
|
43
44
|
const {
|
|
@@ -72,7 +73,8 @@ const usePopperTriggerLogic = ({
|
|
|
72
73
|
onPickerClose();
|
|
73
74
|
resetFocusedDayToStartDate();
|
|
74
75
|
trackFocusPicker();
|
|
75
|
-
|
|
76
|
+
resetMonthYear();
|
|
77
|
+
}, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker, resetMonthYear]);
|
|
76
78
|
const handleToggleCalendar = (0, import_react.useCallback)(() => {
|
|
77
79
|
const isOpening = !showCalendar;
|
|
78
80
|
if (isOpening) openCalendar();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/usePopperTriggerLogic.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport type React from 'react';\nimport { useMemo, useCallback, useState, useContext } from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport type { useFocusLogic } from './useFocusLogic.js';\n\ninterface UsePopperTriggerLogic {\n focusLogic: ReturnType<typeof useFocusLogic>;\n showCalendar: boolean;\n setShowCalendar: TypescriptHelpersT.StateSetter<boolean>;\n}\ninterface PopperTriggerLogicT {\n referenceElement: HTMLButtonElement | null;\n closeCalendar: () => void;\n handleToggleCalendar: () => void;\n handleSetTriggerRef: (instance: HTMLButtonElement) => void;\n handleMenuWrapperKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\nexport const usePopperTriggerLogic = ({\n focusLogic,\n showCalendar,\n setShowCalendar,\n}: UsePopperTriggerLogic): PopperTriggerLogicT => {\n const { focusedDay, resetFocusedDayToStartDate } = focusLogic;\n const {\n props: { onPickerOpen, onPickerClose, disabled },\n\n pickerButtonRef,\n trackFocusCalendarMetafocusedDay,\n trackFocusCalendarPrevMonth,\n trackFocusPicker,\n latestInteractionRegion,\n currFocusDescriber,\n } = useContext(ControlledDateTimePickerContext);\n const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null);\n // onOpen we try to focus the day we should focus, if we should focus one\n const handleOnPickerOpen = useCallback(() => {\n onPickerOpen();\n }, [onPickerOpen]);\n const openCalendar = useCallback(() => {\n if (disabled) return;\n if (focusedDay) trackFocusCalendarMetafocusedDay();\n else setTimeout(() => trackFocusCalendarPrevMonth());\n setShowCalendar(true);\n handleOnPickerOpen();\n }, [\n disabled,\n focusedDay,\n handleOnPickerOpen,\n setShowCalendar,\n trackFocusCalendarMetafocusedDay,\n trackFocusCalendarPrevMonth,\n ]);\n\n const closeCalendar = useCallback(() => {\n setShowCalendar(false);\n onPickerClose();\n resetFocusedDayToStartDate();\n trackFocusPicker();\n }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker]);\n\n const handleToggleCalendar = useCallback(() => {\n const isOpening = !showCalendar;\n if (isOpening) openCalendar();\n else closeCalendar();\n }, [closeCalendar, openCalendar, showCalendar]);\n\n const handleSetTriggerRef = useCallback(\n (newRef: HTMLButtonElement) => {\n pickerButtonRef.current = newRef;\n setReferenceElement(newRef);\n if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef?.focus();\n },\n [currFocusDescriber, latestInteractionRegion, pickerButtonRef],\n );\n const handleMenuWrapperKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n const { key } = e;\n if (key === 'Escape') {\n closeCalendar();\n trackFocusPicker();\n }\n },\n [closeCalendar, trackFocusPicker],\n );\n\n return useMemo(\n () => ({\n referenceElement,\n closeCalendar,\n handleSetTriggerRef,\n handleToggleCalendar,\n handleMenuWrapperKeyDown,\n }),\n [closeCalendar, handleMenuWrapperKeyDown, handleSetTriggerRef, handleToggleCalendar, referenceElement],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAA2D;AAE3D,yCAAgD;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport type React from 'react';\nimport { useMemo, useCallback, useState, useContext } from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport type { useFocusLogic } from './useFocusLogic.js';\n\ninterface UsePopperTriggerLogic {\n focusLogic: ReturnType<typeof useFocusLogic>;\n showCalendar: boolean;\n setShowCalendar: TypescriptHelpersT.StateSetter<boolean>;\n resetMonthYear: () => void;\n}\ninterface PopperTriggerLogicT {\n referenceElement: HTMLButtonElement | null;\n closeCalendar: () => void;\n handleToggleCalendar: () => void;\n handleSetTriggerRef: (instance: HTMLButtonElement) => void;\n handleMenuWrapperKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\nexport const usePopperTriggerLogic = ({\n focusLogic,\n showCalendar,\n setShowCalendar,\n resetMonthYear,\n}: UsePopperTriggerLogic): PopperTriggerLogicT => {\n const { focusedDay, resetFocusedDayToStartDate } = focusLogic;\n const {\n props: { onPickerOpen, onPickerClose, disabled },\n\n pickerButtonRef,\n trackFocusCalendarMetafocusedDay,\n trackFocusCalendarPrevMonth,\n trackFocusPicker,\n latestInteractionRegion,\n currFocusDescriber,\n } = useContext(ControlledDateTimePickerContext);\n const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null);\n // onOpen we try to focus the day we should focus, if we should focus one\n const handleOnPickerOpen = useCallback(() => {\n onPickerOpen();\n }, [onPickerOpen]);\n const openCalendar = useCallback(() => {\n if (disabled) return;\n if (focusedDay) trackFocusCalendarMetafocusedDay();\n else setTimeout(() => trackFocusCalendarPrevMonth());\n setShowCalendar(true);\n handleOnPickerOpen();\n }, [\n disabled,\n focusedDay,\n handleOnPickerOpen,\n setShowCalendar,\n trackFocusCalendarMetafocusedDay,\n trackFocusCalendarPrevMonth,\n ]);\n\n const closeCalendar = useCallback(() => {\n setShowCalendar(false);\n onPickerClose();\n resetFocusedDayToStartDate();\n trackFocusPicker();\n resetMonthYear();\n }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker, resetMonthYear]);\n\n const handleToggleCalendar = useCallback(() => {\n const isOpening = !showCalendar;\n if (isOpening) openCalendar();\n else closeCalendar();\n }, [closeCalendar, openCalendar, showCalendar]);\n\n const handleSetTriggerRef = useCallback(\n (newRef: HTMLButtonElement) => {\n pickerButtonRef.current = newRef;\n setReferenceElement(newRef);\n if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef?.focus();\n },\n [currFocusDescriber, latestInteractionRegion, pickerButtonRef],\n );\n const handleMenuWrapperKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n const { key } = e;\n if (key === 'Escape') {\n closeCalendar();\n trackFocusPicker();\n }\n },\n [closeCalendar, trackFocusPicker],\n );\n\n return useMemo(\n () => ({\n referenceElement,\n closeCalendar,\n handleSetTriggerRef,\n handleToggleCalendar,\n handleMenuWrapperKeyDown,\n }),\n [closeCalendar, handleMenuWrapperKeyDown, handleSetTriggerRef, handleToggleCalendar, referenceElement],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAA2D;AAE3D,yCAAgD;AAgBzC,MAAM,wBAAwB,CAAC;AAAA,E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M,EAAE,IAAI,IAAI;AAChB,UAAI,QAAQ,UAAU;AACpB,sBAAc;AACd,yBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,eAAe,gBAAgB;AAAA,EAClC;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,eAAe,0BAA0B,qBAAqB,sBAAsB,gBAAgB;AAAA,EACvG;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -40,12 +40,16 @@ var import_CalendarWithTimeWheelFooter = require("./CalendarWithTimeWheelFooter.
|
|
|
40
40
|
var import_TimeWheelContent = require("../TimeWheel/TimeWheelContent.js");
|
|
41
41
|
var import_ControlledDateTimePickerCTX = require("../../../ControlledDateTimePickerCTX.js");
|
|
42
42
|
const CalendarWithTimeWheelContent = () => {
|
|
43
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
getProps,
|
|
45
|
+
props: { readOnly, applyAriaDisabled }
|
|
46
|
+
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
44
47
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
45
48
|
import_Styleds.StyledCalendarWithTimeWheelWrapper,
|
|
46
49
|
{
|
|
47
50
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR_TIMEWHEEL,
|
|
48
51
|
getOwnerProps: getProps,
|
|
52
|
+
readOnlyStyles: readOnly || applyAriaDisabled,
|
|
49
53
|
children: [
|
|
50
54
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledCalendar, {}),
|
|
51
55
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TimeWheelContent.TimeWheelContent, {}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { StyledCalendarWithTimeWheelWrapper, StyledCalendar } from './Styleds.js';\nimport { CalendarWithTimeWheelFooter } from './CalendarWithTimeWheelFooter.js';\nimport { TimeWheelContent } from '../TimeWheel/TimeWheelContent.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\n\nexport const CalendarWithTimeWheelContent = (): JSX.Element => {\n const {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { StyledCalendarWithTimeWheelWrapper, StyledCalendar } from './Styleds.js';\nimport { CalendarWithTimeWheelFooter } from './CalendarWithTimeWheelFooter.js';\nimport { TimeWheelContent } from '../TimeWheel/TimeWheelContent.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\n\nexport const CalendarWithTimeWheelContent = (): JSX.Element => {\n const {\n getProps,\n props: { readOnly, applyAriaDisabled },\n } = useContext(ControlledDateTimePickerContext);\n return (\n <StyledCalendarWithTimeWheelWrapper\n data-testid={ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR_TIMEWHEEL}\n getOwnerProps={getProps}\n readOnlyStyles={readOnly || applyAriaDisabled}\n >\n <StyledCalendar />\n <TimeWheelContent />\n <CalendarWithTimeWheelFooter />\n </StyledCalendarWithTimeWheelWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADanB;AAbJ,mBAAkC;AAClC,gDAAmD;AACnD,qBAAmE;AACnE,yCAA4C;AAC5C,8BAAiC;AACjC,yCAAgD;AAEzC,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,kBAAkB;AAAA,EACvC,QAAI,yBAAW,kEAA+B;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,6EAAmC,qBAAqB;AAAA,MACrE,eAAe;AAAA,MACf,gBAAgB,YAAY;AAAA,MAE5B;AAAA,oDAAC,iCAAe;AAAA,QAChB,4CAAC,4CAAiB;AAAA,QAClB,4CAAC,kEAA4B;AAAA;AAAA;AAAA,EAC/B;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,21 +34,34 @@ module.exports = __toCommonJS(CalendarWithTimeWheelFooter_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
37
38
|
var import_ControlledDateTimePickerCTX = require("../../../ControlledDateTimePickerCTX.js");
|
|
38
39
|
var import_Styleds = require("./Styleds.js");
|
|
39
40
|
var import_ControlledDateTimePickerDatatestid = require("../../../ControlledDateTimePickerDatatestid.js");
|
|
40
41
|
const CalendarWithTimeWheelFooter = () => {
|
|
41
42
|
const {
|
|
42
|
-
props: { pickerFooterMsg, hasError },
|
|
43
|
+
props: { pickerFooterMsg, hasError, readOnly, applyAriaDisabled },
|
|
43
44
|
getProps
|
|
44
45
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
45
|
-
return pickerFooterMsg !== void 0 && hasError ? /* @__PURE__ */ (0, import_jsx_runtime.
|
|
46
|
+
return pickerFooterMsg !== void 0 && hasError ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
46
47
|
import_Styleds.CalendarWithTimeWheelFooterMessage,
|
|
47
48
|
{
|
|
48
49
|
role: "alert",
|
|
49
50
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR_TIMEWHEEL,
|
|
50
51
|
getOwnerProps: getProps,
|
|
51
|
-
|
|
52
|
+
readOnlyStyles: readOnly || applyAriaDisabled,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
import_ds_icons.AlertsSmallFill,
|
|
56
|
+
{
|
|
57
|
+
width: 8,
|
|
58
|
+
height: 8,
|
|
59
|
+
color: ["danger", "900"],
|
|
60
|
+
style: { marginRight: "0.5rem", marginBottom: "2px" }
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
pickerFooterMsg
|
|
64
|
+
]
|
|
52
65
|
}
|
|
53
66
|
) : null;
|
|
54
67
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarWithTimeWheelFooterMessage } from './Styleds.js';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\n\nexport const CalendarWithTimeWheelFooter: React.ComponentType = () => {\n const {\n props: { pickerFooterMsg, hasError },\n getProps,\n } = useContext(ControlledDateTimePickerContext);\n return pickerFooterMsg !== undefined && hasError ? (\n <CalendarWithTimeWheelFooterMessage\n role=\"alert\"\n data-testid={ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR_TIMEWHEEL}\n getOwnerProps={getProps}\n >\n {pickerFooterMsg}\n </CalendarWithTimeWheelFooterMessage>\n ) : null;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { AlertsSmallFill } from '@elliemae/ds-icons';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarWithTimeWheelFooterMessage } from './Styleds.js';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\n\nexport const CalendarWithTimeWheelFooter: React.ComponentType = () => {\n const {\n props: { pickerFooterMsg, hasError, readOnly, applyAriaDisabled },\n getProps,\n } = useContext(ControlledDateTimePickerContext);\n return pickerFooterMsg !== undefined && hasError ? (\n <CalendarWithTimeWheelFooterMessage\n role=\"alert\"\n data-testid={ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR_TIMEWHEEL}\n getOwnerProps={getProps}\n readOnlyStyles={readOnly || applyAriaDisabled}\n >\n <AlertsSmallFill\n width={8}\n height={8}\n color={['danger', '900']}\n style={{ marginRight: '0.5rem', marginBottom: '2px' }}\n />\n {pickerFooterMsg}\n </CalendarWithTimeWheelFooterMessage>\n ) : null;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADYnB;AAZJ,mBAAkC;AAClC,sBAAgC;AAChC,yCAAgD;AAChD,qBAAmD;AACnD,gDAAmD;AAE5C,MAAM,8BAAmD,MAAM;AACpE,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB,UAAU,UAAU,kBAAkB;AAAA,IAChE;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,SAAO,oBAAoB,UAAa,WACtC;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAa,6EAAmC,QAAQ;AAAA,MACxD,eAAe;AAAA,MACf,gBAAgB,YAAY;AAAA,MAE5B;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,OAAO,CAAC,UAAU,KAAK;AAAA,YACvB,OAAO,EAAE,aAAa,UAAU,cAAc,MAAM;AAAA;AAAA,QACtD;AAAA,QACC;AAAA;AAAA;AAAA,EACH,IACE;AACN;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -46,8 +46,7 @@ const CalendarWithTimeWheelIconTrigger = () => {
|
|
|
46
46
|
handleToggleCalendarWithTimeWheel,
|
|
47
47
|
handlePickerIconKeyDown,
|
|
48
48
|
ariaCurrentValueForInputs,
|
|
49
|
-
disabled
|
|
50
|
-
applyAriaDisabled
|
|
49
|
+
disabled
|
|
51
50
|
} = (0, import_react.useContext)(import_CalendarWithTimeWheelContext.CalendarWithTimeWheelContext);
|
|
52
51
|
const {
|
|
53
52
|
getProps,
|
|
@@ -67,13 +66,11 @@ const CalendarWithTimeWheelIconTrigger = () => {
|
|
|
67
66
|
onKeyDown: handlePickerIconKeyDown,
|
|
68
67
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR_TIMEWHEEL,
|
|
69
68
|
disabled,
|
|
70
|
-
applyAriaDisabled,
|
|
71
69
|
getOwnerProps: getProps,
|
|
72
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.DatePicker, {})
|
|
70
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.DatePicker, { color: disabled ? ["neutral", "500"] : ["brand-primary", "800"] })
|
|
73
71
|
}
|
|
74
72
|
),
|
|
75
73
|
[
|
|
76
|
-
applyAriaDisabled,
|
|
77
74
|
ariaCurrentValueForInputs,
|
|
78
75
|
disabled,
|
|
79
76
|
getProps,
|
package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { BUTTON_SIZES } from '@elliemae/ds-button-v2';\nimport { DatePicker } from '@elliemae/ds-icons';\nimport { CalendarWithTimeWheelContext } from './CalendarWithTimeWheelContext.js';\nimport { StyledIconTriggerButton } from './Styleds.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\n\n// we memoize the Icon for maximum optimization\n// this is particularly useful due to how usePopper needs to check the references\n// since references are saved in a immutable way, we make sure to shortcircuit useless-re-renders\nexport const CalendarWithTimeWheelIconTrigger = (): JSX.Element => {\n const {\n handleSetTriggerRef,\n handleToggleCalendarWithTimeWheel,\n handlePickerIconKeyDown,\n ariaCurrentValueForInputs,\n disabled,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { BUTTON_SIZES } from '@elliemae/ds-button-v2';\nimport { DatePicker } from '@elliemae/ds-icons';\nimport { CalendarWithTimeWheelContext } from './CalendarWithTimeWheelContext.js';\nimport { StyledIconTriggerButton } from './Styleds.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\n\n// we memoize the Icon for maximum optimization\n// this is particularly useful due to how usePopper needs to check the references\n// since references are saved in a immutable way, we make sure to shortcircuit useless-re-renders\nexport const CalendarWithTimeWheelIconTrigger = (): JSX.Element => {\n const {\n handleSetTriggerRef,\n handleToggleCalendarWithTimeWheel,\n handlePickerIconKeyDown,\n ariaCurrentValueForInputs,\n disabled,\n } = useContext(CalendarWithTimeWheelContext);\n const {\n getProps,\n props: { tabIndex },\n } = useContext(ControlledDateTimePickerContext);\n return useMemo(\n () => (\n <StyledIconTriggerButton\n aria-label={`date time picker context menu trigger, ${ariaCurrentValueForInputs}`}\n buttonType=\"icon\"\n type=\"button\"\n size={BUTTON_SIZES.M}\n innerRef={handleSetTriggerRef}\n tabIndex={tabIndex}\n onClick={handleToggleCalendarWithTimeWheel}\n onKeyDown={handlePickerIconKeyDown}\n data-testid={ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR_TIMEWHEEL}\n disabled={disabled}\n getOwnerProps={getProps}\n >\n <DatePicker color={disabled ? ['neutral', '500'] : ['brand-primary', '800']} />\n </StyledIconTriggerButton>\n ),\n [\n ariaCurrentValueForInputs,\n disabled,\n getProps,\n handlePickerIconKeyDown,\n handleSetTriggerRef,\n handleToggleCalendarWithTimeWheel,\n tabIndex,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsCf;AAtCR,mBAA2C;AAC3C,0BAA6B;AAC7B,sBAA2B;AAC3B,0CAA6C;AAC7C,qBAAwC;AACxC,yCAAgD;AAChD,gDAAmD;AAK5C,MAAM,mCAAmC,MAAmB;AACjE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gEAA4B;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,SAAS;AAAA,EACpB,QAAI,yBAAW,kEAA+B;AAC9C,aAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,cAAY,0CAA0C,yBAAyB;AAAA,QAC/E,YAAW;AAAA,QACX,MAAK;AAAA,QACL,MAAM,iCAAa;AAAA,QACnB,UAAU;AAAA,QACV;AAAA,QACA,SAAS;AAAA,QACT,WAAW;AAAA,QACX,eAAa,6EAAmC,aAAa;AAAA,QAC7D;AAAA,QACA,eAAe;AAAA,QAEf,sDAAC,8BAAW,OAAO,WAAW,CAAC,WAAW,KAAK,IAAI,CAAC,iBAAiB,KAAK,GAAG;AAAA;AAAA,IAC/E;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -60,6 +60,7 @@ const CalendarWithTimeWheelWrapper = () => {
|
|
|
60
60
|
onClickOutside: closeCalendar,
|
|
61
61
|
getOwnerProps: getProps,
|
|
62
62
|
"aria-label": "calendar header",
|
|
63
|
+
role: "dialog",
|
|
63
64
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CalendarWithTimeWheelContent.CalendarWithTimeWheelContent, {})
|
|
64
65
|
}
|
|
65
66
|
);
|