@rio-cloud/rio-uikit 2.3.0-beta.1 → 2.3.0-beta.3
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/DayPicker.js +6 -2
- package/DayPicker.js.map +1 -1
- package/DayPickerCalendar.d.ts +2 -0
- package/DayPickerCalendar.js +5 -0
- package/DayPickerCalendar.js.map +1 -0
- package/DayPickerPrototype.d.ts +2 -0
- package/DayPickerPrototype.js +5 -0
- package/DayPickerPrototype.js.map +1 -0
- package/Marker.js +9 -5
- package/TableNext.d.ts +2 -0
- package/TableNext.js +23 -0
- package/TableNext.js.map +1 -0
- package/TableToolbar.js +3 -2
- package/TableToolbar.js.map +1 -1
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +38 -3
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +104 -109
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -1
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +24 -5
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +60 -56
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -1
- package/components/assetTree/Tree.js +13 -13
- package/components/charts/Area.d.ts +5 -3
- package/components/charts/Area.js +4 -3
- package/components/charts/Area.js.map +1 -1
- package/components/charts/AreaChart.js.map +1 -1
- package/components/charts/ComposedChart.js.map +1 -1
- package/components/clearableInput/ClearableInput.d.ts +30 -0
- package/components/clearableInput/ClearableInput.js +81 -78
- package/components/clearableInput/ClearableInput.js.map +1 -1
- package/components/datepicker/DayPicker.d.ts +4 -51
- package/components/datepicker/DayPicker.js +267 -257
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/datepicker/DayPickerCalendar.d.ts +4 -0
- package/components/datepicker/DayPickerCalendar.js +129 -0
- package/components/datepicker/DayPickerCalendar.js.map +1 -0
- package/components/datepicker/DayPickerDropdown.d.ts +19 -0
- package/components/datepicker/DayPickerDropdown.js +88 -0
- package/components/datepicker/DayPickerDropdown.js.map +1 -0
- package/components/datepicker/DayPickerDropdownFooter.d.ts +7 -0
- package/components/datepicker/DayPickerDropdownFooter.js +7 -0
- package/components/datepicker/DayPickerDropdownFooter.js.map +1 -0
- package/components/datepicker/DayPickerDropdownSidebar.d.ts +8 -0
- package/components/datepicker/DayPickerDropdownSidebar.js +7 -0
- package/components/datepicker/DayPickerDropdownSidebar.js.map +1 -0
- package/components/datepicker/DayPickerInput.d.ts +28 -0
- package/components/datepicker/DayPickerInput.js +65 -0
- package/components/datepicker/DayPickerInput.js.map +1 -0
- package/components/datepicker/DayPickerPrototype.d.ts +53 -0
- package/components/datepicker/DayPickerPrototype.js +285 -0
- package/components/datepicker/DayPickerPrototype.js.map +1 -0
- package/components/datepicker/dayPickerRangeSelectionUtils.d.ts +15 -0
- package/components/datepicker/dayPickerRangeSelectionUtils.js +31 -0
- package/components/datepicker/dayPickerRangeSelectionUtils.js.map +1 -0
- package/components/datepicker/dayPickerTypes.d.ts +517 -0
- package/components/datepicker/dayPickerTypes.js +7 -0
- package/components/datepicker/dayPickerTypes.js.map +1 -0
- package/components/datepicker/dayPickerUtils.d.ts +10 -0
- package/components/datepicker/dayPickerUtils.js +92 -0
- package/components/datepicker/dayPickerUtils.js.map +1 -0
- package/components/datepicker/useDayPickerInputState.d.ts +32 -0
- package/components/datepicker/useDayPickerInputState.js +85 -0
- package/components/datepicker/useDayPickerInputState.js.map +1 -0
- package/components/datepicker/useStackedDayPickerCalendars.d.ts +5 -0
- package/components/datepicker/useStackedDayPickerCalendars.js +39 -0
- package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -0
- package/components/divider/Divider.js +6 -6
- package/components/dropdown/ButtonDropdown.d.ts +4 -0
- package/components/dropdown/ButtonDropdown.js +70 -68
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/dropdown/DropdownToggleButton.d.ts +1 -0
- package/components/dropdown/DropdownToggleButton.js +17 -15
- package/components/dropdown/DropdownToggleButton.js.map +1 -1
- package/components/fade/FadeExpander.js +17 -20
- package/components/fade/FadeExpander.js.map +1 -1
- package/components/listMenu/ListMenu.d.ts +8 -0
- package/components/listMenu/ListMenu.js +74 -66
- package/components/listMenu/ListMenu.js.map +1 -1
- package/components/loadMore/LoadMoreProgress.js +6 -7
- package/components/map/components/Map.js +189 -157
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/MapContext.d.ts +1 -0
- package/components/map/components/MapContext.js +8 -7
- package/components/map/components/MapContext.js.map +1 -1
- package/components/map/components/features/Route.d.ts +65 -1
- package/components/map/components/features/Route.js +184 -98
- package/components/map/components/features/Route.js.map +1 -1
- package/components/map/components/features/basics/Marker.d.ts +21 -1
- package/components/map/components/features/basics/Marker.js +99 -40
- package/components/map/components/features/basics/Marker.js.map +1 -1
- package/components/map/components/features/basics/Polygon.d.ts +24 -1
- package/components/map/components/features/basics/Polygon.js +72 -19
- package/components/map/components/features/basics/Polygon.js.map +1 -1
- package/components/map/components/features/basics/Polyline.d.ts +29 -0
- package/components/map/components/features/basics/Polyline.js +69 -39
- package/components/map/components/features/basics/Polyline.js.map +1 -1
- package/components/map/components/features/layers/MarkerLayer.js +8 -8
- package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js +13 -6
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
- package/components/map/utils/clustering.d.ts +1 -1
- package/components/map/utils/clustering.js +30 -30
- package/components/map/utils/clustering.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +135 -0
- package/components/map/utils/mapTypes.js.map +1 -1
- package/components/map/utils/rendering.js +5 -5
- package/components/mapMarker/ClusterMapMarker.d.ts +2 -0
- package/components/mapMarker/ClusterMapMarker.js.map +1 -1
- package/components/mapMarker/SingleMapMarker.d.ts +2 -0
- package/components/mapMarker/SingleMapMarker.js.map +1 -1
- package/components/popover/Popover.js +4 -4
- package/components/radiobutton/RadioCardGroup.js +3 -3
- package/components/rioglyph/RioglyphIconType.d.ts +1 -1
- package/components/selects/ClearButton.js +9 -7
- package/components/selects/ClearButton.js.map +1 -1
- package/components/selects/Multiselect.d.ts +6 -0
- package/components/selects/Multiselect.js +164 -150
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/Select.js +39 -37
- package/components/selects/Select.js.map +1 -1
- package/components/table/Table.d.ts +27 -248
- package/components/table/Table.js +240 -214
- package/components/table/Table.js.map +1 -1
- package/components/table/Table.types.d.ts +302 -121
- package/components/table/TableBody.d.ts +65 -5
- package/components/table/TableBody.js +132 -2
- package/components/table/TableBody.js.map +1 -1
- package/components/table/TableCardsSorting.js +25 -32
- package/components/table/TableCardsSorting.js.map +1 -1
- package/components/table/TableColumn.d.ts +21 -6
- package/components/table/TableColumn.js +114 -2
- package/components/table/TableColumn.js.map +1 -1
- package/components/table/TableExpandedContentRow.d.ts +7 -7
- package/components/table/TableExpandedContentRow.js +107 -2
- package/components/table/TableExpandedContentRow.js.map +1 -1
- package/components/table/TableExpandedRow.d.ts +9 -4
- package/components/table/TableExpandedRow.js +147 -2
- package/components/table/TableExpandedRow.js.map +1 -1
- package/components/table/TableExpanderButton.js +13 -11
- package/components/table/TableExpanderButton.js.map +1 -1
- package/components/table/TableFooter.d.ts +10 -6
- package/components/table/TableFooter.js +49 -2
- package/components/table/TableFooter.js.map +1 -1
- package/components/table/TableGroupFooterRow.d.ts +7 -7
- package/components/table/TableGroupFooterRow.js +27 -2
- package/components/table/TableGroupFooterRow.js.map +1 -1
- package/components/table/TableGroupRow.d.ts +7 -7
- package/components/table/TableGroupRow.js +33 -2
- package/components/table/TableGroupRow.js.map +1 -1
- package/components/table/TableHeader.d.ts +26 -4
- package/components/table/TableHeader.js +117 -2
- package/components/table/TableHeader.js.map +1 -1
- package/components/table/TableHeaderColumn.d.ts +25 -9
- package/components/table/TableHeaderColumn.js +83 -2
- package/components/table/TableHeaderColumn.js.map +1 -1
- package/components/table/TableHeaderRow.d.ts +1 -1
- package/components/table/TableHeaderRow.js +11 -2
- package/components/table/TableHeaderRow.js.map +1 -1
- package/components/table/TableRow.d.ts +15 -4
- package/components/table/TableRow.js +109 -2
- package/components/table/TableRow.js.map +1 -1
- package/components/table/TableSpacerRow.d.ts +3 -2
- package/components/table/TableSpacerRow.js +26 -2
- package/components/table/TableSpacerRow.js.map +1 -1
- package/components/table/TableToolbar.d.ts +4 -23
- package/components/table/TableToolbar.js +39 -28
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableToolbarColumn.d.ts +31 -0
- package/components/table/TableToolbarColumn.js +33 -0
- package/components/table/TableToolbarColumn.js.map +1 -0
- package/components/table/TableViewToggles.d.ts +3 -3
- package/components/table/TableViewToggles.js.map +1 -1
- package/components/table/context/TableInteractionContext.d.ts +26 -0
- package/components/table/context/TableInteractionContext.js +7 -0
- package/components/table/context/TableInteractionContext.js.map +1 -0
- package/components/table/context/TableLayoutContext.d.ts +26 -0
- package/components/table/context/TableLayoutContext.js +7 -0
- package/components/table/context/TableLayoutContext.js.map +1 -0
- package/components/table/context/TableRenderConfigContext.d.ts +27 -0
- package/components/table/context/TableRenderConfigContext.js +7 -0
- package/components/table/context/TableRenderConfigContext.js.map +1 -0
- package/components/table/context/TableRenderContext.d.ts +85 -0
- package/components/table/context/TableRenderContext.js +7 -0
- package/components/table/context/TableRenderContext.js.map +1 -0
- package/components/table/context/TableStructureContext.d.ts +31 -0
- package/components/table/context/TableStructureContext.js +17 -0
- package/components/table/context/TableStructureContext.js.map +1 -0
- package/components/table/layout/columnSizing.d.ts +2 -2
- package/components/table/layout/columnSizing.js.map +1 -1
- package/components/table/layout/useDraggableColumns.d.ts +3 -3
- package/components/table/layout/useDraggableColumns.js +17 -17
- package/components/table/layout/useDraggableColumns.js.map +1 -1
- package/components/table/layout/useHorizontalSectionSync.d.ts +4 -1
- package/components/table/layout/useHorizontalSectionSync.js +36 -31
- package/components/table/layout/useHorizontalSectionSync.js.map +1 -1
- package/components/table/layout/useMeasuredColumnMaxWidths.d.ts +3 -3
- package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
- package/components/table/layout/useResizableColumns.d.ts +5 -4
- package/components/table/layout/useResizableColumns.js +108 -67
- package/components/table/layout/useResizableColumns.js.map +1 -1
- package/components/table/layout/useTableBodyScrollBottom.d.ts +12 -0
- package/components/table/layout/useTableBodyScrollBottom.js +37 -0
- package/components/table/layout/useTableBodyScrollBottom.js.map +1 -0
- package/components/table/layout/useTableLayout.d.ts +18 -6
- package/components/table/layout/useTableLayout.js +51 -41
- package/components/table/layout/useTableLayout.js.map +1 -1
- package/components/table/layout/useTableVirtualization.d.ts +6 -6
- package/components/table/layout/useTableVirtualization.js +22 -22
- package/components/table/layout/useTableVirtualization.js.map +1 -1
- package/components/table/model/resolveRowMeta.d.ts +3 -2
- package/components/table/model/resolveRowMeta.js.map +1 -1
- package/components/table/model/resolveTableClassConfig.d.ts +2 -3
- package/components/table/model/resolveTableClassConfig.js.map +1 -1
- package/components/table/model/tableView.types.d.ts +41 -0
- package/components/table/native/TableSettingsListItem.js +1 -1
- package/components/table/native/TableSettingsListItem.js.map +1 -1
- package/components/table/render/body/TableBodyContent.d.ts +21 -0
- package/components/table/render/body/TableBodyContent.js +52 -0
- package/components/table/render/body/TableBodyContent.js.map +1 -0
- package/components/table/render/body/TableEmptyRow.js +2 -2
- package/components/table/render/body/TableEmptyRow.js.map +1 -1
- package/components/table/render/header/TableBatchDropdown.d.ts +5 -1
- package/components/table/render/header/TableBatchDropdown.js +17 -15
- package/components/table/render/header/TableBatchDropdown.js.map +1 -1
- package/components/table/render/header/TableColumnFilter.d.ts +2 -2
- package/components/table/render/header/TableColumnFilter.js +16 -14
- package/components/table/render/header/TableColumnFilter.js.map +1 -1
- package/components/table/render/header/TableDraggableHeaderCell.d.ts +2 -1
- package/components/table/render/header/TableDraggableHeaderCell.js +45 -33
- package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -1
- package/components/table/render/header/TableHeader.types.d.ts +13 -9
- package/components/table/render/header/TableHeaderCellContent.d.ts +2 -1
- package/components/table/render/header/TableHeaderCellContent.js +16 -16
- package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
- package/components/table/render/header/TableHeaderCellResizeHandle.d.ts +2 -1
- package/components/table/render/header/TableHeaderCellResizeHandle.js +8 -8
- package/components/table/render/header/TableHeaderCellResizeHandle.js.map +1 -1
- package/components/table/render/header/TableHeaderDragOverlay.d.ts +5 -4
- package/components/table/render/header/TableHeaderDragOverlay.js.map +1 -1
- package/components/table/render/header/TableStaticHeaderCell.d.ts +2 -1
- package/components/table/render/header/TableStaticHeaderCell.js +34 -20
- package/components/table/render/header/TableStaticHeaderCell.js.map +1 -1
- package/components/table/render/header/resolveAriaSort.d.ts +2 -1
- package/components/table/render/header/resolveAriaSort.js.map +1 -1
- package/components/table/render/header/resolveHeaderCellClassName.d.ts +5 -2
- package/components/table/render/header/resolveHeaderCellClassName.js +14 -12
- package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -1
- package/components/table/render/header/resolveHeaderCellStyle.d.ts +2 -1
- package/components/table/render/header/resolveHeaderCellStyle.js.map +1 -1
- package/components/table/runtime/shouldAnimateBodyRows.d.ts +17 -0
- package/components/table/runtime/shouldAnimateBodyRows.js +5 -0
- package/components/table/runtime/shouldAnimateBodyRows.js.map +1 -0
- package/components/table/runtime/useRenderDraftState.d.ts +14 -0
- package/components/table/runtime/useRenderDraftState.js +80 -0
- package/components/table/runtime/useRenderDraftState.js.map +1 -0
- package/components/table/runtime/useResolvedRenderColumns.d.ts +43 -0
- package/components/table/runtime/useResolvedRenderColumns.js +113 -0
- package/components/table/runtime/useResolvedRenderColumns.js.map +1 -0
- package/components/table/runtime/useResolvedRenderHeader.d.ts +27 -0
- package/components/table/runtime/useResolvedRenderHeader.js +67 -0
- package/components/table/runtime/useResolvedRenderHeader.js.map +1 -0
- package/components/table/selection/useInternalTableSelectionState.d.ts +17 -0
- package/components/table/selection/useInternalTableSelectionState.js +28 -0
- package/components/table/selection/useInternalTableSelectionState.js.map +1 -0
- package/components/table/selection/useTableSelection.d.ts +3 -3
- package/components/table/selection/useTableSelection.js.map +1 -1
- package/components/table/shared/getCellContentOverflowClassName.d.ts +3 -0
- package/components/table/shared/getCellContentOverflowClassName.js +18 -0
- package/components/table/shared/getCellContentOverflowClassName.js.map +1 -0
- package/components/table/shared/getInteractiveRowProps.d.ts +3 -2
- package/components/table/shared/getInteractiveRowProps.js.map +1 -1
- package/hooks/useDraggableElement.d.ts +27 -5
- package/hooks/useDraggableElement.js +100 -23
- package/hooks/useDraggableElement.js.map +1 -1
- package/hooks/usePopperDropdown.d.ts +1 -0
- package/hooks/usePopperDropdown.js +15 -12
- package/hooks/usePopperDropdown.js.map +1 -1
- package/hooks/useUrlState.js +3 -3
- package/package.json +16 -17
- package/utils/analytics/createAnalyticsOverlayTooltip.js +57 -57
- package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -1
- package/utils/analytics/useAnalyticsOverlayDom.js +3 -3
- package/utils/init/initConfig.js +5 -5
- package/utils/init/initConfig.js.map +1 -1
- package/utils/routeUtils.d.ts +5 -2
- package/utils/routeUtils.js +17 -17
- package/utils/routeUtils.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/components/table/TableCard.d.ts +0 -63
- package/components/table/TableCard.js +0 -150
- package/components/table/TableCard.js.map +0 -1
- package/components/table/model/buildTableViewModel.d.ts +0 -28
- package/components/table/model/buildTableViewModel.js +0 -221
- package/components/table/model/buildTableViewModel.js.map +0 -1
- package/components/table/model/resolveCellContent.d.ts +0 -2
- package/components/table/model/resolveCellContent.js +0 -5
- package/components/table/model/resolveCellContent.js.map +0 -1
- package/components/table/model/tableViewModel.types.d.ts +0 -153
- package/components/table/parse/parseBody.d.ts +0 -3
- package/components/table/parse/parseBody.js +0 -13
- package/components/table/parse/parseBody.js.map +0 -1
- package/components/table/parse/parseColumns.d.ts +0 -3
- package/components/table/parse/parseColumns.js +0 -81
- package/components/table/parse/parseColumns.js.map +0 -1
- package/components/table/parse/parseFooter.d.ts +0 -3
- package/components/table/parse/parseFooter.js +0 -39
- package/components/table/parse/parseFooter.js.map +0 -1
- package/components/table/parse/parseHeaders.d.ts +0 -4
- package/components/table/parse/parseHeaders.js +0 -89
- package/components/table/parse/parseHeaders.js.map +0 -1
- package/components/table/parse/parseRows.d.ts +0 -3
- package/components/table/parse/parseRows.js +0 -93
- package/components/table/parse/parseRows.js.map +0 -1
- package/components/table/parse/tableChildGuards.d.ts +0 -25
- package/components/table/parse/tableChildGuards.js +0 -29
- package/components/table/parse/tableChildGuards.js.map +0 -1
- package/components/table/render/body/TableBodyRow.d.ts +0 -16
- package/components/table/render/body/TableBodyRow.js +0 -84
- package/components/table/render/body/TableBodyRow.js.map +0 -1
- package/components/table/render/body/TableBodySection.d.ts +0 -20
- package/components/table/render/body/TableBodySection.js +0 -68
- package/components/table/render/body/TableBodySection.js.map +0 -1
- package/components/table/render/body/TableDataRow.d.ts +0 -15
- package/components/table/render/body/TableDataRow.js +0 -143
- package/components/table/render/body/TableDataRow.js.map +0 -1
- package/components/table/render/body/TableExpandedRow.d.ts +0 -8
- package/components/table/render/body/TableExpandedRow.js +0 -84
- package/components/table/render/body/TableExpandedRow.js.map +0 -1
- package/components/table/render/body/TableGroupRow.d.ts +0 -8
- package/components/table/render/body/TableGroupRow.js +0 -21
- package/components/table/render/body/TableGroupRow.js.map +0 -1
- package/components/table/render/body/TableSpacerRow.d.ts +0 -7
- package/components/table/render/body/TableSpacerRow.js +0 -15
- package/components/table/render/body/TableSpacerRow.js.map +0 -1
- package/components/table/render/footer/TableFooterCell.d.ts +0 -8
- package/components/table/render/footer/TableFooterCell.js +0 -31
- package/components/table/render/footer/TableFooterCell.js.map +0 -1
- package/components/table/render/footer/TableFooterSection.d.ts +0 -10
- package/components/table/render/footer/TableFooterSection.js +0 -28
- package/components/table/render/footer/TableFooterSection.js.map +0 -1
- package/components/table/render/header/TableHeaderSection.d.ts +0 -3
- package/components/table/render/header/TableHeaderSection.js +0 -104
- package/components/table/render/header/TableHeaderSection.js.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DateRange as ReactDayPickerDateRange, DayPickerProps as ReactDayPickerProps } from 'react-day-picker';
|
|
2
|
+
export type DateRange = ReactDayPickerDateRange;
|
|
3
|
+
export type Modifiers = Record<string, boolean>;
|
|
4
|
+
export type OnSelectHandler<T> = (selected: T, triggerDate: Date, modifiers: Modifiers, event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
5
|
+
type CommonProps = Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'value' | 'selected'> & {
|
|
6
|
+
id?: string;
|
|
7
|
+
locale?: string;
|
|
8
|
+
closeOnSelect?: boolean;
|
|
9
|
+
initialValue?: Date;
|
|
10
|
+
inputProps?: Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'defaultValue' | 'children'>;
|
|
11
|
+
/**
|
|
12
|
+
* Custom format string (e.g., 'yyyy-MM-dd') to override locale-based formatting.
|
|
13
|
+
* If omitted, locale-based display is used for the input.
|
|
14
|
+
*/
|
|
15
|
+
dateFormat?: string;
|
|
16
|
+
alignRight?: boolean;
|
|
17
|
+
isClearable?: boolean;
|
|
18
|
+
minWidth?: number;
|
|
19
|
+
mandatory?: boolean;
|
|
20
|
+
bsSize?: 'sm' | 'md' | 'lg';
|
|
21
|
+
footer?: React.ReactNode;
|
|
22
|
+
inline?: boolean;
|
|
23
|
+
placeholder?: string | React.ReactElement;
|
|
24
|
+
inputClassName?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
showOutsideDays?: boolean;
|
|
27
|
+
fixedWeeks?: boolean;
|
|
28
|
+
defaultMonth?: Date;
|
|
29
|
+
startMonth?: Date;
|
|
30
|
+
endMonth?: Date;
|
|
31
|
+
modifiers?: ReactDayPickerProps['modifiers'];
|
|
32
|
+
modifiersStyles?: ReactDayPickerProps['modifiersStyles'];
|
|
33
|
+
};
|
|
34
|
+
type SingleModeProps = CommonProps & {
|
|
35
|
+
mode?: 'single';
|
|
36
|
+
selected?: Date;
|
|
37
|
+
onInputChange?: (rawValue: string, parsedDate: Date | undefined, isValid: boolean) => void;
|
|
38
|
+
onSelectChange?: (value: Date | undefined, modifiers: Modifiers) => void;
|
|
39
|
+
};
|
|
40
|
+
type MultipleModeProps = CommonProps & {
|
|
41
|
+
mode: 'multiple';
|
|
42
|
+
selected?: Date[];
|
|
43
|
+
onSelectChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;
|
|
44
|
+
};
|
|
45
|
+
type RangeModeProps = CommonProps & {
|
|
46
|
+
mode: 'range';
|
|
47
|
+
selected?: DateRange;
|
|
48
|
+
onChange?: (value: DateRange | undefined) => void;
|
|
49
|
+
onSelectChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;
|
|
50
|
+
};
|
|
51
|
+
type DayPickerProps = SingleModeProps | MultipleModeProps | RangeModeProps;
|
|
52
|
+
declare const DayPickerPrototype: (props: DayPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export default DayPickerPrototype;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { jsxs as N, jsx as i, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
+
import { useState as ee, useEffect as ne, useRef as R } from "react";
|
|
3
|
+
import { DayPicker as F } from "react-day-picker";
|
|
4
|
+
import { format as te, parse as ke, isValid as oe } from "date-fns";
|
|
5
|
+
import * as L from "date-fns/locale";
|
|
6
|
+
import { debounce as Ne } from "es-toolkit/function";
|
|
7
|
+
import Re from "../../hooks/useClickOutside.js";
|
|
8
|
+
import we from "../../hooks/usePopperDropdown.js";
|
|
9
|
+
import Ee from "../../hooks/useKey.js";
|
|
10
|
+
import xe from "../clearableInput/ClearableInput.js";
|
|
11
|
+
import Fe from "../../utils/classNames.js";
|
|
12
|
+
const Le = (e) => !e.mode || e.mode === "single", Te = (e) => e.mode === "multiple", Be = (e) => e.mode === "range", Qe = (e) => {
|
|
13
|
+
const {
|
|
14
|
+
id: r,
|
|
15
|
+
selected: o,
|
|
16
|
+
inputProps: s = {},
|
|
17
|
+
alignRight: u,
|
|
18
|
+
bsSize: f = "",
|
|
19
|
+
locale: a = "en-GB",
|
|
20
|
+
footer: S,
|
|
21
|
+
inline: re,
|
|
22
|
+
showOutsideDays: ie = !0,
|
|
23
|
+
fixedWeeks: ae = !0,
|
|
24
|
+
mode: b = "single",
|
|
25
|
+
dateFormat: m,
|
|
26
|
+
placeholder: O,
|
|
27
|
+
isClearable: j = !1,
|
|
28
|
+
closeOnSelect: K = !0,
|
|
29
|
+
defaultMonth: se,
|
|
30
|
+
startMonth: ce,
|
|
31
|
+
endMonth: de,
|
|
32
|
+
modifiers: le,
|
|
33
|
+
modifiersStyles: ye,
|
|
34
|
+
inputClassName: V,
|
|
35
|
+
className: A
|
|
36
|
+
} = e, c = b === "single", G = b === "multiple", ue = b === "range", p = o !== void 0, [fe, D] = ee(), M = p ? o : fe, C = c ? M instanceof Date ? M : void 0 : G ? Array.isArray(M) ? M : void 0 : Oe(M) ? M : void 0, me = je(a), [$, I] = ee(""), z = p && !c ? Ke(C, a, b, m) : $;
|
|
37
|
+
ne(() => {
|
|
38
|
+
c && p && o instanceof Date && I(T(o, a, m));
|
|
39
|
+
}, [o, c, p, a, m]);
|
|
40
|
+
const v = (n, t) => {
|
|
41
|
+
if (Le(e) && e.onSelectChange) {
|
|
42
|
+
e.onSelectChange(n, t);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (Te(e) && e.onSelectChange) {
|
|
46
|
+
e.onSelectChange(n, t);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
Be(e) && e.onSelectChange && e.onSelectChange(n, t);
|
|
50
|
+
}, H = (n) => U(n), pe = (n) => U(n.currentTarget.value), ge = R(
|
|
51
|
+
Ne((n) => {
|
|
52
|
+
const t = B(n, a);
|
|
53
|
+
console.log(t);
|
|
54
|
+
const l = !!t;
|
|
55
|
+
if (D(t), c && "onInputChange" in e && e.onInputChange && e.onInputChange(n, t, l), t !== void 0 || n === "") {
|
|
56
|
+
const De = m ? B(n, a, m) : t;
|
|
57
|
+
v(De, {});
|
|
58
|
+
}
|
|
59
|
+
}, 300)
|
|
60
|
+
).current, U = (n) => {
|
|
61
|
+
I(n), ge(n);
|
|
62
|
+
}, P = R(!1), W = (n) => {
|
|
63
|
+
const t = n.relatedTarget, l = t && X.current?.contains(t);
|
|
64
|
+
if (d && !l && h(), !c)
|
|
65
|
+
return;
|
|
66
|
+
const y = B($, a, m);
|
|
67
|
+
y && oe(y) && (D(y), v(y, {}), I(T(y, a, m)));
|
|
68
|
+
}, _ = () => {
|
|
69
|
+
d || J();
|
|
70
|
+
}, Z = (n) => {
|
|
71
|
+
if (n.key === "Tab" && (P.current = !0), n.key === "Enter") {
|
|
72
|
+
if (!d) {
|
|
73
|
+
k();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
d && K && (v(C, {}), h());
|
|
77
|
+
}
|
|
78
|
+
}, q = (n) => {
|
|
79
|
+
p || D(n);
|
|
80
|
+
}, Me = () => {
|
|
81
|
+
H(""), q(void 0), I(""), p && D(void 0), ue && "onChange" in e && e.onChange && e.onChange(void 0), v(void 0, {});
|
|
82
|
+
}, w = (n, t, l, y) => {
|
|
83
|
+
q(n), v(n, l), c && !p && I(T(n, a, m)), P.current && g?.current?.focus(), K && (h(), P.current = !1);
|
|
84
|
+
}, {
|
|
85
|
+
isOpen: d,
|
|
86
|
+
open: J,
|
|
87
|
+
close: h,
|
|
88
|
+
referenceRef: Q,
|
|
89
|
+
popperElementRef: he,
|
|
90
|
+
popperStyles: Ce,
|
|
91
|
+
popperAttributes: Ie
|
|
92
|
+
} = we({ placement: u ? "bottom-end" : "bottom-start" }), g = R(null), X = R(null), ve = (n) => {
|
|
93
|
+
X.current = n, he(n);
|
|
94
|
+
}, E = Re(
|
|
95
|
+
(n) => {
|
|
96
|
+
const t = n.target;
|
|
97
|
+
if (!t) {
|
|
98
|
+
h();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const l = Q.current?.contains(t), y = g.current?.contains(t);
|
|
102
|
+
l || y || h();
|
|
103
|
+
},
|
|
104
|
+
void 0,
|
|
105
|
+
d
|
|
106
|
+
), k = () => {
|
|
107
|
+
J(), g.current?.focus();
|
|
108
|
+
};
|
|
109
|
+
Ee("Escape", (n) => {
|
|
110
|
+
const t = n.target;
|
|
111
|
+
g.current && g.current === t && d && h();
|
|
112
|
+
}), ne(() => {
|
|
113
|
+
const n = (t) => {
|
|
114
|
+
!d || !E.current || t.key === "Tab" && E.current.contains(document.activeElement) && (P.current = !0, console.log("User tabbed into dropdown"));
|
|
115
|
+
};
|
|
116
|
+
return document.addEventListener("keydown", n), () => {
|
|
117
|
+
document.removeEventListener("keydown", n);
|
|
118
|
+
};
|
|
119
|
+
}, [d]);
|
|
120
|
+
const Se = `DayPicker ${f === "sm" ? "margin-10" : "margin-15"} ${f}`, x = {
|
|
121
|
+
defaultMonth: se,
|
|
122
|
+
locale: me,
|
|
123
|
+
captionLayout: "dropdown",
|
|
124
|
+
animate: !0,
|
|
125
|
+
navLayout: "around",
|
|
126
|
+
startMonth: ce,
|
|
127
|
+
endMonth: de,
|
|
128
|
+
modifiers: le,
|
|
129
|
+
modifiersStyles: ye,
|
|
130
|
+
showOutsideDays: ie,
|
|
131
|
+
fixedWeeks: ae,
|
|
132
|
+
className: Se
|
|
133
|
+
}, Y = () => c ? /* @__PURE__ */ i(
|
|
134
|
+
F,
|
|
135
|
+
{
|
|
136
|
+
...x,
|
|
137
|
+
mode: "single",
|
|
138
|
+
selected: C,
|
|
139
|
+
onSelect: w
|
|
140
|
+
}
|
|
141
|
+
) : G ? /* @__PURE__ */ i(
|
|
142
|
+
F,
|
|
143
|
+
{
|
|
144
|
+
...x,
|
|
145
|
+
mode: "multiple",
|
|
146
|
+
selected: C,
|
|
147
|
+
onSelect: w
|
|
148
|
+
}
|
|
149
|
+
) : /* @__PURE__ */ i(
|
|
150
|
+
F,
|
|
151
|
+
{
|
|
152
|
+
...x,
|
|
153
|
+
mode: "range",
|
|
154
|
+
selected: C,
|
|
155
|
+
onSelect: w
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
if (re)
|
|
159
|
+
return /* @__PURE__ */ N("div", { className: `display-flex flex-column justify-content-between ${A}`, children: [
|
|
160
|
+
Y(),
|
|
161
|
+
S ? /* @__PURE__ */ i("div", { className: "padding-15", children: S }) : /* @__PURE__ */ i("div", {})
|
|
162
|
+
] });
|
|
163
|
+
const be = {
|
|
164
|
+
...s,
|
|
165
|
+
readOnly: !c,
|
|
166
|
+
style: {
|
|
167
|
+
background: "var(--color-white)",
|
|
168
|
+
...s?.style ?? {}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
return /* @__PURE__ */ N(Pe, { children: [
|
|
172
|
+
/* @__PURE__ */ i("div", { ref: Q, className: `form-group ${A}`, children: /* @__PURE__ */ N("div", { className: "input-group", children: [
|
|
173
|
+
/* @__PURE__ */ i("span", { className: "input-group-addon", onClick: k, children: /* @__PURE__ */ i("span", { className: "rioglyph rioglyph-calendar", "aria-hidden": "true" }) }),
|
|
174
|
+
j && /* @__PURE__ */ i(
|
|
175
|
+
xe,
|
|
176
|
+
{
|
|
177
|
+
id: r,
|
|
178
|
+
autoComplete: "off",
|
|
179
|
+
placeholder: O,
|
|
180
|
+
...be,
|
|
181
|
+
type: "text",
|
|
182
|
+
value: z,
|
|
183
|
+
onChange: H,
|
|
184
|
+
onClick: k,
|
|
185
|
+
onClear: Me,
|
|
186
|
+
onBlur: W,
|
|
187
|
+
onFocus: _,
|
|
188
|
+
onKeyPress: Z,
|
|
189
|
+
ref: g,
|
|
190
|
+
inputClassName: V
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
!j && /* @__PURE__ */ i(
|
|
194
|
+
"input",
|
|
195
|
+
{
|
|
196
|
+
id: r,
|
|
197
|
+
size: 12,
|
|
198
|
+
type: "text",
|
|
199
|
+
autoComplete: "off",
|
|
200
|
+
placeholder: O,
|
|
201
|
+
...s,
|
|
202
|
+
value: z,
|
|
203
|
+
onChange: pe,
|
|
204
|
+
onClick: k,
|
|
205
|
+
onBlur: W,
|
|
206
|
+
onFocus: _,
|
|
207
|
+
onKeyDown: Z,
|
|
208
|
+
ref: g,
|
|
209
|
+
readOnly: !c,
|
|
210
|
+
className: Fe("ClearableInput form-control bg-white", V)
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] }) }),
|
|
214
|
+
d && /* @__PURE__ */ i(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
style: Ce,
|
|
218
|
+
className: "DayPickerPopover z-index-max bg-white shadow-default rounded margin-y-3 border",
|
|
219
|
+
...Ie,
|
|
220
|
+
ref: ve,
|
|
221
|
+
role: "dialog",
|
|
222
|
+
"aria-label": "DayPicker calendar",
|
|
223
|
+
children: /* @__PURE__ */ N("div", { ref: E, className: "display-flex flex-column justify-content-between", children: [
|
|
224
|
+
Y(),
|
|
225
|
+
S ? /* @__PURE__ */ i("div", { className: "padding-15", children: S }) : /* @__PURE__ */ i("div", {})
|
|
226
|
+
] })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] });
|
|
230
|
+
}, Oe = (e) => {
|
|
231
|
+
if (!e || typeof e != "object")
|
|
232
|
+
return !1;
|
|
233
|
+
const r = e, o = r.from instanceof Date, s = r.to === void 0 || r.to instanceof Date;
|
|
234
|
+
return o && s;
|
|
235
|
+
}, je = (e) => {
|
|
236
|
+
const r = e.split("-")[0];
|
|
237
|
+
return L[r] || L[e] || L.enGB;
|
|
238
|
+
}, T = (e, r, o) => e ? o ? te(e, o) : new Intl.DateTimeFormat(r).format(e) : "", Ke = (e, r, o, s) => {
|
|
239
|
+
if (!e)
|
|
240
|
+
return "";
|
|
241
|
+
const u = (f) => s ? te(f, s) : new Intl.DateTimeFormat(r).format(f);
|
|
242
|
+
if (o === "single" && e instanceof Date)
|
|
243
|
+
return u(e);
|
|
244
|
+
if (o === "multiple" && Array.isArray(e))
|
|
245
|
+
return e.map(u).join(", ");
|
|
246
|
+
if (o === "range" && typeof e == "object" && "from" in e) {
|
|
247
|
+
const { from: f, to: a } = e;
|
|
248
|
+
return !f || !a ? "" : [f, a].filter(Boolean).map(u).join(" – ");
|
|
249
|
+
}
|
|
250
|
+
return "";
|
|
251
|
+
}, Ve = {
|
|
252
|
+
"bg-BG": "dd.MM.yyyy",
|
|
253
|
+
"cs-CZ": "dd.MM.yyyy",
|
|
254
|
+
"da-DK": "dd-MM-yyyy",
|
|
255
|
+
"de-DE": "dd.MM.yyyy",
|
|
256
|
+
"el-GR": "dd/MM/yyyy",
|
|
257
|
+
"en-GB": "dd/MM/yyyy",
|
|
258
|
+
"es-ES": "dd/MM/yyyy",
|
|
259
|
+
"et-EE": "dd.MM.yyyy",
|
|
260
|
+
"fi-FI": "dd.MM.yyyy",
|
|
261
|
+
"fr-FR": "dd/MM/yyyy",
|
|
262
|
+
"hr-HR": "dd.MM.yyyy",
|
|
263
|
+
"hu-HU": "yyyy. MM. dd.",
|
|
264
|
+
"it-IT": "dd/MM/yyyy",
|
|
265
|
+
"lt-LT": "dd-MM-yyyy",
|
|
266
|
+
"lv-LV": "dd.MM.yyyy",
|
|
267
|
+
"nb-NO": "dd.MM.yyyy",
|
|
268
|
+
"nl-NL": "dd-MM-yyyy",
|
|
269
|
+
"pl-PL": "dd.MM.yyyy",
|
|
270
|
+
"pt-BR": "dd/MM/yyyy",
|
|
271
|
+
"pt-PT": "dd/MM/yyyy",
|
|
272
|
+
"ro-RO": "dd.MM.yyyy",
|
|
273
|
+
"sk-SK": "dd.MM.yyyy",
|
|
274
|
+
"sl-SI": "dd.MM.yyyy",
|
|
275
|
+
"sv-SE": "yyyy-MM-dd"
|
|
276
|
+
}, Ae = (e, r = "yyyy-MM-dd") => Ve[e] || r, B = (e, r, o) => {
|
|
277
|
+
if (!e)
|
|
278
|
+
return;
|
|
279
|
+
const s = o || Ae(r, o), u = ke(e, s, /* @__PURE__ */ new Date());
|
|
280
|
+
return oe(u) ? u : void 0;
|
|
281
|
+
};
|
|
282
|
+
export {
|
|
283
|
+
Qe as default
|
|
284
|
+
};
|
|
285
|
+
//# sourceMappingURL=DayPickerPrototype.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayPickerPrototype.js","sources":["../../../src/components/datepicker/DayPickerPrototype.tsx"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport {\n DayPicker as ReactDayPicker,\n type DateRange as ReactDayPickerDateRange,\n type DayPickerProps as ReactDayPickerProps,\n type OnSelectHandler as ReactDayPickerOnSelectHandler,\n} from 'react-day-picker';\nimport { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\nimport { debounce } from 'es-toolkit/function';\n\nimport useClickOutside from '../../hooks/useClickOutside';\nimport usePopperDropdown from '../../hooks/usePopperDropdown';\nimport useKey from '../../hooks/useKey';\nimport ClearableInput from '../clearableInput/ClearableInput';\nimport classNames from '../../utils/classNames';\n\n// Features\n// [ ] input parsing and error handling\n// [-] time picker -> use a dedicated time picker input next to the day picker\n// [-] time range callback + validation\n// [ ] wrap all react-day-picker callbacks to avoid exposing internals and types\n// [x] start/end month\n// [ ] reserved days / unselectable days\n// [ ] disable editable input - use selected date only\n// [x] disallow editing input for mode: \"multi\" and \"range\" since input contains custom value\n// [ ] modifier and modifiersStyles\n// [x] closeOnSelect\n// [x] enter confirms the manual input and closes the dropdown\n// [x] esc closed the dropdown\n// [ ] support different sizes\n// [ ] mandatory value\n// [x] avoid opening dropdown again when clicking inside the input\n// [x] clear inputs\n// [ ] tab should select elements inside the dropdown, select should close but keep focus on input\n\nexport type DateRange = ReactDayPickerDateRange;\n\nexport type Modifiers = Record<string, boolean>;\n\nexport type OnSelectHandler<T> = (\n selected: T,\n triggerDate: Date,\n modifiers: Modifiers,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\n// - By default, don't show a time picker\n// - Handle given formats like \"2020-04-04\" or ISO dates \"2020-03-12T16:20:44.193Z\" as initialValue - really?\n\ntype CommonProps = Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'value' | 'selected'> & {\n id?: string;\n locale?: string;\n closeOnSelect?: boolean;\n initialValue?: Date;\n inputProps?: Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'defaultValue' | 'children'>;\n\n /**\n * Custom format string (e.g., 'yyyy-MM-dd') to override locale-based formatting.\n * If omitted, locale-based display is used for the input.\n */\n dateFormat?: string;\n\n alignRight?: boolean;\n isClearable?: boolean;\n minWidth?: number;\n mandatory?: boolean;\n bsSize?: 'sm' | 'md' | 'lg';\n footer?: React.ReactNode;\n inline?: boolean;\n placeholder?: string | React.ReactElement;\n\n inputClassName?: string;\n className?: string;\n\n // react-day-picker props\n showOutsideDays?: boolean;\n fixedWeeks?: boolean;\n defaultMonth?: Date;\n startMonth?: Date;\n endMonth?: Date;\n modifiers?: ReactDayPickerProps['modifiers'];\n modifiersStyles?: ReactDayPickerProps['modifiersStyles'];\n};\n\ntype SingleModeProps = CommonProps & {\n mode?: 'single';\n selected?: Date;\n onInputChange?: (rawValue: string, parsedDate: Date | undefined, isValid: boolean) => void;\n onSelectChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n};\n\ntype MultipleModeProps = CommonProps & {\n mode: 'multiple';\n selected?: Date[];\n onSelectChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n};\n\ntype RangeModeProps = CommonProps & {\n mode: 'range';\n selected?: DateRange;\n onChange?: (value: DateRange | undefined) => void;\n onSelectChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n};\n\ntype DayPickerProps = SingleModeProps | MultipleModeProps | RangeModeProps;\n\nconst isSingleProps = (props: DayPickerProps): props is SingleModeProps => !props.mode || props.mode === 'single';\nconst isMultipleProps = (props: DayPickerProps): props is MultipleModeProps => props.mode === 'multiple';\nconst isRangeProps = (props: DayPickerProps): props is RangeModeProps => props.mode === 'range';\n\nconst DayPickerPrototype = (props: DayPickerProps) => {\n const {\n id,\n selected,\n inputProps = {},\n alignRight,\n bsSize = '',\n locale = 'en-GB',\n footer,\n inline,\n showOutsideDays = true,\n fixedWeeks = true,\n mode = 'single',\n dateFormat,\n placeholder,\n isClearable = false,\n closeOnSelect = true,\n defaultMonth,\n startMonth,\n endMonth,\n modifiers,\n modifiersStyles,\n inputClassName,\n className,\n } = props;\n\n const isSingleMode = mode === 'single';\n const isMultipleMode = mode === 'multiple';\n const isRangeMode = mode === 'range';\n\n const isControlled = selected !== undefined;\n const [internalSelected, setInternalSelected] = useState<typeof selected>();\n\n const selectedValue = isControlled ? selected : internalSelected;\n\n const narrowedSelected = (() => {\n if (isSingleMode) {\n return selectedValue instanceof Date ? selectedValue : undefined;\n }\n if (isMultipleMode) {\n return Array.isArray(selectedValue) ? selectedValue : undefined;\n }\n return isDateRange(selectedValue) ? selectedValue : undefined;\n })();\n\n const resolvedLocale = resolveLocale(locale);\n\n const [internalInputValue, setInternalInputValue] = useState<string>('');\n\n const inputValue =\n isControlled && !isSingleMode\n ? formatSelectedForInput(narrowedSelected, locale, mode, dateFormat)\n : internalInputValue;\n\n // const inputValue = isSingleMode\n // ? internalInputValue\n // : formatSelectedForInput(narrowedSelected, locale, mode, dateFormat);\n\n // const inputValue = internalInputValue;\n\n // This ensures that whenever the external selected prop changes, the input field gets updated accordingly\n useEffect(() => {\n if (isSingleMode && isControlled && selected instanceof Date) {\n setInternalInputValue(formatDate(selected, locale, dateFormat));\n }\n }, [selected, isSingleMode, isControlled, locale, dateFormat]);\n\n const notifySelectChange = (value: typeof selected, modifiers: Modifiers) => {\n if (isSingleProps(props) && props.onSelectChange) {\n props.onSelectChange(value as SingleModeProps['selected'], modifiers);\n return;\n }\n\n if (isMultipleProps(props) && props.onSelectChange) {\n props.onSelectChange(value as MultipleModeProps['selected'], modifiers);\n return;\n }\n\n if (isRangeProps(props) && props.onSelectChange) {\n props.onSelectChange(value as RangeModeProps['selected'], modifiers);\n }\n };\n\n const handleInputChange = (newValue: string) => doHandleInputValue(newValue);\n const handleInputChangeNative = (event: React.ChangeEvent<HTMLInputElement>) =>\n doHandleInputValue(event.currentTarget.value);\n\n const debouncedParseInput = useRef(\n debounce((rawValue: string) => {\n const parsed = parseDateString(rawValue, locale);\n console.log(parsed);\n const isValid = !!parsed;\n\n setInternalSelected(parsed as typeof props.selected);\n\n if (isSingleMode && 'onInputChange' in props && props.onInputChange) {\n props.onInputChange(rawValue, parsed, isValid);\n }\n\n const shouldNotify = parsed !== undefined || rawValue === '';\n if (shouldNotify) {\n // parse to desired dateFormat for use on outside\n const formattedSelected = dateFormat ? parseDateString(rawValue, locale, dateFormat) : parsed;\n notifySelectChange(formattedSelected as typeof selected, {});\n }\n }, 300)\n ).current;\n\n const doHandleInputValue = (rawValue: string) => {\n // const parsed = parseDateString(rawValue, locale, dateFormat);\n\n // const isValid = !!parsed;\n\n // if (!isControlled) {\n // // && isValidDate(parsed); // TODO: optional second validation\n\n // setInternalInputValue(rawValue);\n // setInternalSelected(parsed as typeof props.selected);\n // } else if (isSingleMode) {\n // setInternalInputValue(rawValue);\n // }\n\n // if (isSingleMode && 'onInputChange' in props && props.onInputChange) {\n // props.onInputChange(rawValue, parsed, isValid);\n // }\n\n // const shouldNotify = parsed !== undefined || rawValue === '';\n // if (shouldNotify) {\n // onSelectChange(parsed as typeof selected, {});\n // }\n\n setInternalInputValue(rawValue); // always update input state\n debouncedParseInput(rawValue); // defer parsing & callback execution\n };\n\n const keyboardRef = useRef(false);\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // Do not close the dropdown on input blur when the user selects something inside the dropdown itself\n const nextFocused = event.relatedTarget as Node | null;\n const focusInsideDropdown = nextFocused && popperElementRef.current?.contains(nextFocused);\n if (isDropdownOpen && !focusInsideDropdown) {\n closePopper();\n }\n\n if (!isSingleMode) {\n return;\n }\n\n const parsed = parseDateString(internalInputValue, locale, dateFormat);\n\n if (parsed && isValid(parsed)) {\n setInternalSelected(parsed as typeof selected);\n notifySelectChange(parsed as typeof selected, {});\n setInternalInputValue(formatDate(parsed, locale, dateFormat));\n }\n };\n\n const handleOnInputFocus = () => {\n if (!isDropdownOpen) {\n openPopper();\n }\n };\n\n const handleInputKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // Workaround to figure out if the user navigates via keyboard\n if (event.key === 'Tab') {\n keyboardRef.current = true;\n }\n\n if (event.key !== 'Enter') {\n return;\n }\n // In case the dropdown is not open but the input is focused, open the dropdown on enter\n if (!isDropdownOpen) {\n handleInputClick();\n return;\n }\n // In case the dropdown is open, the input is focused and the prop allows it, close the dropdown\n if (isDropdownOpen && closeOnSelect) {\n notifySelectChange(narrowedSelected as typeof selected, {});\n closePopper();\n }\n };\n\n const handleSelectedChange = (newValue: typeof selected) => {\n if (!isControlled) {\n setInternalSelected(newValue);\n }\n };\n\n const handleClearSelection = () => {\n handleInputChange('');\n handleSelectedChange(undefined as typeof selected);\n setInternalInputValue('');\n\n if (isControlled) {\n setInternalSelected(undefined);\n }\n\n if (isRangeMode && 'onChange' in props && props.onChange) {\n props.onChange(undefined);\n }\n\n notifySelectChange(undefined as typeof selected, {});\n };\n\n const handleDaySelect: OnSelectHandler<typeof selected> = (selected, _triggerDate, modifiers, _event) => {\n // safe because of discriminated union\n handleSelectedChange(selected as typeof selected);\n\n // trigger callback\n notifySelectChange(selected, modifiers);\n\n if (isSingleMode && !isControlled) {\n // should be the only place formatting is applied to the input\n setInternalInputValue(formatDate(selected as Date, locale, dateFormat));\n }\n\n if (keyboardRef.current) {\n // Note: When the date is selected via enter key, assume the user uses keyboard navigation.\n // In this case the input should be focused to allow to tab to another element in his form.\n // However, it is not possible to detect according to the event since the event.type is alway \"click\".\n // Instead we check if the user used the tab key to focus the day picker.\n inputRef?.current?.focus();\n }\n\n if (closeOnSelect) {\n closePopper();\n keyboardRef.current = false;\n }\n };\n\n const {\n isOpen: isDropdownOpen,\n open: openPopper,\n close: closePopper,\n referenceRef: popperRef,\n popperElementRef: setPopperElement,\n popperStyles,\n popperAttributes,\n } = usePopperDropdown({ placement: alignRight ? 'bottom-end' : 'bottom-start' });\n\n const inputRef = useRef<HTMLInputElement>(null);\n const popperElementRef = useRef<HTMLElement | null>(null);\n\n const assignPopperElement = (element: HTMLElement | null) => {\n popperElementRef.current = element;\n setPopperElement(element);\n };\n\n // Close the dropdown when clicking outside the dropdown wrapper.\n // It also checks if the click happened into the input, in which case the\n // dropdown will remain open.\n const outsideRef = useClickOutside(\n event => {\n const target = event.target as Node | null;\n if (!target) {\n closePopper();\n return;\n }\n\n const clickedWithinTrigger = popperRef.current?.contains(target);\n const clickedWithinInput = inputRef.current?.contains(target);\n\n if (clickedWithinTrigger || clickedWithinInput) {\n return;\n }\n\n closePopper();\n },\n undefined,\n isDropdownOpen\n );\n\n const handleInputClick = () => {\n openPopper();\n inputRef.current?.focus();\n };\n\n // Needed to select all tabbable elements inside the dropdown calendar and to disable the\n // focus on tab for all of these. This allows the user to tab between multiple inputs on the page\n // or when having two day pickers side by side. Tabbing from one day picker input to the other will\n // open and close the dropdown respectively and achieving the same usability as the old DatePicker.\n // useEffect(() => {\n // if (isDropdownOpen && outsideRef.current) {\n // // get all buttons to disable the tab on them\n // const tabbableElements = (outsideRef.current as HTMLElement).querySelectorAll<HTMLElement>(\n // 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n // );\n\n // tabbableElements.forEach((element: Element) => {\n // element.setAttribute('tabindex', '-1');\n // });\n // }\n // }, [isDropdownOpen, outsideRef]);\n\n // Close the dropdown when it is open and when the user presses the \"escape\" key\n useKey('Escape', event => {\n const target = event.target;\n const isInput = inputRef.current && inputRef.current === target;\n\n if (isInput && isDropdownOpen) {\n closePopper();\n }\n });\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (!isDropdownOpen || !outsideRef.current) {\n return;\n }\n\n if (event.key === 'Tab') {\n const focusedInside = outsideRef.current.contains(document.activeElement);\n if (focusedInside) {\n keyboardRef.current = true;\n console.log('User tabbed into dropdown');\n // Optional: closePopper(); or focus inputRef.current\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isDropdownOpen]);\n\n const dayPickerClassName = `DayPicker ${bsSize === 'sm' ? 'margin-10' : 'margin-15'} ${bsSize}`;\n const dayPickerBaseProps = {\n defaultMonth,\n locale: resolvedLocale,\n captionLayout: 'dropdown' as const,\n animate: true,\n navLayout: 'around' as const,\n startMonth,\n endMonth,\n modifiers,\n modifiersStyles,\n showOutsideDays,\n fixedWeeks,\n className: dayPickerClassName,\n };\n\n const renderDayPicker = () => {\n if (isSingleMode) {\n return (\n <ReactDayPicker\n {...dayPickerBaseProps}\n mode='single'\n selected={narrowedSelected as Date | undefined}\n onSelect={handleDaySelect as ReactDayPickerOnSelectHandler<Date | undefined>}\n />\n );\n }\n\n if (isMultipleMode) {\n return (\n <ReactDayPicker\n {...dayPickerBaseProps}\n mode='multiple'\n selected={narrowedSelected as Date[] | undefined}\n onSelect={handleDaySelect as ReactDayPickerOnSelectHandler<Date[] | undefined>}\n />\n );\n }\n\n return (\n <ReactDayPicker\n {...dayPickerBaseProps}\n mode='range'\n selected={narrowedSelected as DateRange | undefined}\n onSelect={handleDaySelect as ReactDayPickerOnSelectHandler<DateRange | undefined>}\n />\n );\n };\n\n if (inline) {\n // Render day picker inline without a dropdown and an input\n return (\n <div className={`display-flex flex-column justify-content-between ${className}`}>\n {renderDayPicker()}\n {footer ? <div className='padding-15'>{footer}</div> : <div />}\n </div>\n );\n }\n\n const clearableInputProps = {\n ...inputProps,\n readOnly: !isSingleMode,\n style: {\n background: 'var(--color-white)',\n ...(inputProps?.style ?? {}),\n },\n };\n\n return (\n <>\n <div ref={popperRef} className={`form-group ${className}`}>\n <div className='input-group'>\n <span className='input-group-addon' onClick={handleInputClick}>\n <span className='rioglyph rioglyph-calendar' aria-hidden='true' />\n </span>\n {isClearable && (\n <ClearableInput\n id={id}\n autoComplete='off'\n placeholder={placeholder}\n {...clearableInputProps}\n type='text'\n value={inputValue}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onClear={handleClearSelection}\n onBlur={handleInputBlur}\n onFocus={handleOnInputFocus}\n onKeyPress={handleInputKeyPress}\n // hasError={hasError}\n ref={inputRef}\n inputClassName={inputClassName}\n />\n )}\n {!isClearable && (\n <input\n id={id}\n size={12}\n type='text'\n autoComplete='off'\n placeholder={placeholder}\n {...inputProps}\n value={inputValue}\n onChange={handleInputChangeNative}\n onClick={handleInputClick}\n onBlur={handleInputBlur}\n onFocus={handleOnInputFocus}\n onKeyDown={handleInputKeyPress}\n ref={inputRef}\n readOnly={!isSingleMode}\n className={classNames('ClearableInput form-control bg-white', inputClassName)}\n />\n )}\n </div>\n </div>\n {isDropdownOpen && (\n <div\n style={popperStyles}\n className='DayPickerPopover z-index-max bg-white shadow-default rounded margin-y-3 border'\n {...popperAttributes}\n ref={assignPopperElement}\n role='dialog'\n aria-label='DayPicker calendar'\n >\n <div ref={outsideRef} className='display-flex flex-column justify-content-between'>\n {renderDayPicker()}\n {footer ? <div className='padding-15'>{footer}</div> : <div />}\n </div>\n </div>\n )}\n </>\n );\n};\n\nconst isDateRange = (value: unknown): value is DateRange => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const range = value as Partial<DateRange>;\n\n const fromIsValid = range.from instanceof Date;\n const toIsValid = range.to === undefined || range.to instanceof Date;\n\n return fromIsValid && toIsValid;\n};\n\nconst resolveLocale = (localeCode: string): Locale => {\n const baseCode = localeCode.split('-')[0]; // 'de-DE' → 'de'\n return (\n (locales as Record<string, Locale>)[baseCode] || (locales as Record<string, Locale>)[localeCode] || locales.enGB\n );\n};\n\nconst formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n if (dateFormat) {\n return format(date, dateFormat); // use override\n }\n\n // fallback to locale-based formatting\n return new Intl.DateTimeFormat(localeCode).format(date);\n};\n\nconst formatSelectedForInput = (\n selected: unknown,\n localeCode: string,\n mode: 'single' | 'multiple' | 'range',\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) =>\n dateFormat ? format(date, dateFormat) : new Intl.DateTimeFormat(localeCode).format(date);\n\n if (mode === 'single' && selected instanceof Date) {\n return formatFn(selected);\n }\n\n if (mode === 'multiple' && Array.isArray(selected)) {\n return selected.map(formatFn).join(', ');\n }\n\n if (mode === 'range' && typeof selected === 'object' && 'from' in selected) {\n const { from, to } = selected as { from?: Date; to?: Date };\n if (!from || !to) {\n return '';\n }\n return [from, to].filter(Boolean).map(formatFn).join(' – ');\n }\n\n return '';\n};\n\nconst localeFormatMap: Record<string, string> = {\n 'bg-BG': 'dd.MM.yyyy',\n 'cs-CZ': 'dd.MM.yyyy',\n 'da-DK': 'dd-MM-yyyy',\n 'de-DE': 'dd.MM.yyyy',\n 'el-GR': 'dd/MM/yyyy',\n 'en-GB': 'dd/MM/yyyy',\n 'es-ES': 'dd/MM/yyyy',\n 'et-EE': 'dd.MM.yyyy',\n 'fi-FI': 'dd.MM.yyyy',\n 'fr-FR': 'dd/MM/yyyy',\n 'hr-HR': 'dd.MM.yyyy',\n 'hu-HU': 'yyyy. MM. dd.',\n 'it-IT': 'dd/MM/yyyy',\n 'lt-LT': 'dd-MM-yyyy',\n 'lv-LV': 'dd.MM.yyyy',\n 'nb-NO': 'dd.MM.yyyy',\n 'nl-NL': 'dd-MM-yyyy',\n 'pl-PL': 'dd.MM.yyyy',\n 'pt-BR': 'dd/MM/yyyy',\n 'pt-PT': 'dd/MM/yyyy',\n 'ro-RO': 'dd.MM.yyyy',\n 'sk-SK': 'dd.MM.yyyy',\n 'sl-SI': 'dd.MM.yyyy',\n 'sv-SE': 'yyyy-MM-dd',\n};\n\nconst getFormatForLocale = (localeCode: string, fallback = 'yyyy-MM-dd'): string =>\n localeFormatMap[localeCode] || fallback;\n\nconst parseDateString = (value: string | undefined, localeCode: string, dateFormat?: string): Date | undefined => {\n if (!value) {\n return;\n }\n\n const formatToUse = dateFormat || getFormatForLocale(localeCode, dateFormat);\n const parsed = parse(value, formatToUse, new Date());\n\n return isValid(parsed) ? parsed : undefined;\n};\n\nexport default DayPickerPrototype;\n"],"names":["isSingleProps","props","isMultipleProps","isRangeProps","DayPickerPrototype","id","selected","inputProps","alignRight","bsSize","locale","footer","inline","showOutsideDays","fixedWeeks","mode","dateFormat","placeholder","isClearable","closeOnSelect","defaultMonth","startMonth","endMonth","modifiers","modifiersStyles","inputClassName","className","isSingleMode","isMultipleMode","isRangeMode","isControlled","internalSelected","setInternalSelected","useState","selectedValue","narrowedSelected","isDateRange","resolvedLocale","resolveLocale","internalInputValue","setInternalInputValue","inputValue","formatSelectedForInput","useEffect","formatDate","notifySelectChange","value","handleInputChange","newValue","doHandleInputValue","handleInputChangeNative","event","debouncedParseInput","useRef","debounce","rawValue","parsed","parseDateString","isValid","formattedSelected","keyboardRef","handleInputBlur","nextFocused","focusInsideDropdown","popperElementRef","isDropdownOpen","closePopper","handleOnInputFocus","openPopper","handleInputKeyPress","handleInputClick","handleSelectedChange","handleClearSelection","handleDaySelect","_triggerDate","_event","inputRef","popperRef","setPopperElement","popperStyles","popperAttributes","usePopperDropdown","assignPopperElement","element","outsideRef","useClickOutside","target","clickedWithinTrigger","clickedWithinInput","useKey","handleKeyDown","dayPickerClassName","dayPickerBaseProps","renderDayPicker","jsx","ReactDayPicker","jsxs","clearableInputProps","Fragment","ClearableInput","classNames","range","fromIsValid","toIsValid","localeCode","baseCode","locales","date","format","formatFn","from","to","localeFormatMap","getFormatForLocale","fallback","formatToUse","parse"],"mappings":";;;;;;;;;;;AA2GA,MAAMA,KAAgB,CAACC,MAAoD,CAACA,EAAM,QAAQA,EAAM,SAAS,UACnGC,KAAkB,CAACD,MAAsDA,EAAM,SAAS,YACxFE,KAAe,CAACF,MAAmDA,EAAM,SAAS,SAElFG,KAAqB,CAACH,MAA0B;AAClD,QAAM;AAAA,IACF,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AS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AACb,GAEMC,KAAqB,CAACT,GAAoBU,IAAW,iBACvDF,GAAgBR,CAAU,KAAKU,GAE7BzD,IAAkB,CAACX,GAA2B0D,GAAoBxF,MAA0C;AAC9G,MAAI,CAAC8B;AACD;AAGJ,QAAMqE,IAAcnG,KAAciG,GAAmBT,GAAYxF,CAAU,GACrEwC,IAAS4D,GAAMtE,GAAOqE,GAAa,oBAAI,MAAM;AAEnD,SAAOzD,GAAQF,CAAM,IAAIA,IAAS;AACtC;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Locale } from 'date-fns';
|
|
2
|
+
import { DateRange, DayPickerRangeSelectionVariant } from './dayPickerTypes';
|
|
3
|
+
export declare const createCustomRangeModifiers: (value: DateRange | undefined) => {
|
|
4
|
+
selected: import('react-day-picker').DateRange | undefined;
|
|
5
|
+
range_start: Date | undefined;
|
|
6
|
+
range_end: Date | undefined;
|
|
7
|
+
range_middle: import('react-day-picker').DateRange | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare const getCustomRangeValue: ({ day, selectionVariant, rollingDays, locale, currentValue, }: {
|
|
10
|
+
day: Date;
|
|
11
|
+
selectionVariant: Exclude<DayPickerRangeSelectionVariant, "default">;
|
|
12
|
+
rollingDays: number;
|
|
13
|
+
locale: Locale;
|
|
14
|
+
currentValue: DateRange | undefined;
|
|
15
|
+
}) => DateRange | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { endOfWeek as f, startOfWeek as s, endOfMonth as g, startOfMonth as i, addDays as u } from "date-fns";
|
|
2
|
+
const O = (e) => ({
|
|
3
|
+
selected: e,
|
|
4
|
+
range_start: e?.from,
|
|
5
|
+
range_end: e?.to,
|
|
6
|
+
range_middle: e
|
|
7
|
+
}), R = ({
|
|
8
|
+
day: e,
|
|
9
|
+
selectionVariant: t,
|
|
10
|
+
rollingDays: r,
|
|
11
|
+
locale: o,
|
|
12
|
+
currentValue: m
|
|
13
|
+
}) => {
|
|
14
|
+
const n = a(e, t, r, o);
|
|
15
|
+
if (!c(m, n))
|
|
16
|
+
return n;
|
|
17
|
+
}, a = (e, t, r, o) => t === "week" ? {
|
|
18
|
+
from: s(e, { locale: o }),
|
|
19
|
+
to: f(e, { locale: o })
|
|
20
|
+
} : t === "month" ? {
|
|
21
|
+
from: i(e),
|
|
22
|
+
to: g(e)
|
|
23
|
+
} : {
|
|
24
|
+
from: e,
|
|
25
|
+
to: u(e, r - 1)
|
|
26
|
+
}, c = (e, t) => e?.from?.getTime() === t?.from?.getTime() && e?.to?.getTime() === t?.to?.getTime();
|
|
27
|
+
export {
|
|
28
|
+
O as createCustomRangeModifiers,
|
|
29
|
+
R as getCustomRangeValue
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=dayPickerRangeSelectionUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dayPickerRangeSelectionUtils.js","sources":["../../../src/components/datepicker/dayPickerRangeSelectionUtils.ts"],"sourcesContent":["import { addDays, endOfMonth, endOfWeek, startOfMonth, startOfWeek } from 'date-fns';\nimport type { Locale } from 'date-fns';\n\nimport type { DateRange, DayPickerRangeSelectionVariant } from './dayPickerTypes';\n\nexport const createCustomRangeModifiers = (value: DateRange | undefined) => ({\n selected: value,\n range_start: value?.from,\n range_end: value?.to,\n range_middle: value,\n});\n\nexport const getCustomRangeValue = ({\n day,\n selectionVariant,\n rollingDays,\n locale,\n currentValue,\n}: {\n day: Date;\n selectionVariant: Exclude<DayPickerRangeSelectionVariant, 'default'>;\n rollingDays: number;\n locale: Locale;\n currentValue: DateRange | undefined;\n}): DateRange | undefined => {\n const nextValue = toCustomRange(day, selectionVariant, rollingDays, locale);\n\n if (isSameRange(currentValue, nextValue)) {\n return;\n }\n\n return nextValue;\n};\n\nconst toCustomRange = (\n day: Date,\n selectionVariant: Exclude<DayPickerRangeSelectionVariant, 'default'>,\n rollingDays: number,\n locale: Locale\n): DateRange => {\n if (selectionVariant === 'week') {\n return {\n from: startOfWeek(day, { locale }),\n to: endOfWeek(day, { locale }),\n };\n }\n\n if (selectionVariant === 'month') {\n return {\n from: startOfMonth(day),\n to: endOfMonth(day),\n };\n }\n\n return {\n from: day,\n to: addDays(day, rollingDays - 1),\n };\n};\n\nconst isSameRange = (left: DateRange | undefined, right: DateRange | undefined) =>\n left?.from?.getTime() === right?.from?.getTime() && left?.to?.getTime() === right?.to?.getTime();\n"],"names":["createCustomRangeModifiers","value","getCustomRangeValue","day","selectionVariant","rollingDays","locale","currentValue","nextValue","toCustomRange","isSameRange","startOfWeek","endOfWeek","startOfMonth","endOfMonth","addDays","left","right"],"mappings":";AAKO,MAAMA,IAA6B,CAACC,OAAkC;AAAA,EACzE,UAAUA;AAAA,EACV,aAAaA,GAAO;AAAA,EACpB,WAAWA,GAAO;AAAA,EAClB,cAAcA;AAClB,IAEaC,IAAsB,CAAC;AAAA,EAChC,KAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AACJ,MAM6B;AACzB,QAAMC,IAAYC,EAAcN,GAAKC,GAAkBC,GAAaC,CAAM;AAE1E,MAAI,CAAAI,EAAYH,GAAcC,CAAS;AAIvC,WAAOA;AACX,GAEMC,IAAgB,CAClBN,GACAC,GACAC,GACAC,MAEIF,MAAqB,SACd;AAAA,EACH,MAAMO,EAAYR,GAAK,EAAE,QAAAG,GAAQ;AAAA,EACjC,IAAIM,EAAUT,GAAK,EAAE,QAAAG,GAAQ;AAAA,IAIjCF,MAAqB,UACd;AAAA,EACH,MAAMS,EAAaV,CAAG;AAAA,EACtB,IAAIW,EAAWX,CAAG;AAAA,IAInB;AAAA,EACH,MAAMA;AAAA,EACN,IAAIY,EAAQZ,GAAKE,IAAc,CAAC;AAAA,GAIlCK,IAAc,CAACM,GAA6BC,MAC9CD,GAAM,MAAM,cAAcC,GAAO,MAAM,QAAA,KAAaD,GAAM,IAAI,cAAcC,GAAO,IAAI,QAAA;"}
|