@rio-cloud/rio-uikit 2.5.0-beta.1 → 2.5.0
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/CountedInput.d.ts +2 -0
- package/CountedInput.js +5 -0
- package/CountedInput.js.map +1 -0
- package/TabbedPanel.d.ts +2 -0
- package/TabbedPanel.js +5 -0
- package/TabbedPanel.js.map +1 -0
- package/components/applicationHeader/NavItems.js +58 -46
- package/components/applicationHeader/NavItems.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutBody.d.ts +1 -1
- package/components/applicationLayout/ApplicationLayoutBody.js +29 -29
- package/components/applicationLayout/ApplicationLayoutBody.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutHeader.js +22 -7
- package/components/applicationLayout/ApplicationLayoutHeader.js.map +1 -1
- package/components/assetTree/useTreeHeight.js.map +1 -1
- package/components/button/Button.d.ts +11 -3
- package/components/button/Button.js.map +1 -1
- package/components/clearableInput/ClearableInput.d.ts +4 -0
- package/components/clearableInput/ClearableInput.js.map +1 -1
- package/components/countedInput/CountedInput.d.ts +91 -0
- package/components/countedInput/CountedInput.js +65 -0
- package/components/countedInput/CountedInput.js.map +1 -0
- package/components/datepicker/DatePicker.d.ts +1 -1
- package/components/datepicker/DatePicker.js +1 -1
- package/components/datepicker/DatePicker.js.map +1 -1
- package/components/datepicker/DayPicker.js +3 -2
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/datepicker/DayPickerInput.d.ts +1 -1
- package/components/datepicker/DayPickerInput.js.map +1 -1
- package/components/datepicker/dayPickerTypes.d.ts +3 -2
- package/components/datepicker/dayPickerTypes.js.map +1 -1
- package/components/datepicker/dayPickerUtils.d.ts +1 -1
- package/components/datepicker/dayPickerUtils.js +45 -22
- package/components/datepicker/dayPickerUtils.js.map +1 -1
- package/components/datepicker/useDayPickerInputState.d.ts +1 -1
- package/components/dialog/ConfirmationDialog.d.ts +17 -0
- package/components/dialog/ConfirmationDialog.js +43 -19
- package/components/dialog/ConfirmationDialog.js.map +1 -1
- package/components/dialog/DialogHeader.js +20 -19
- package/components/dialog/DialogHeader.js.map +1 -1
- package/components/dropdown/ButtonDropdown.d.ts +5 -0
- package/components/dropdown/ButtonDropdown.js +63 -61
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/dropdown/DropdownToggleButton.d.ts +2 -0
- package/components/dropdown/DropdownToggleButton.js +39 -35
- package/components/dropdown/DropdownToggleButton.js.map +1 -1
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +103 -105
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
- package/components/map/utils/eventHandling.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +7 -0
- package/components/map/utils/mapTypes.js.map +1 -1
- package/components/map/utils/rendering.js +5 -5
- package/components/numberControl/NumberControl.js.map +1 -1
- package/components/page/Page.d.ts +2 -0
- package/components/page/Page.js.map +1 -1
- package/components/rioglyph/Rioglyph.d.ts +8 -2
- package/components/rioglyph/Rioglyph.js.map +1 -1
- package/components/rioglyph/RioglyphIconType.d.ts +1 -1
- package/components/selects/BaseSelectDropdown.d.ts +8 -0
- package/components/selects/BaseSelectDropdown.js +76 -60
- package/components/selects/BaseSelectDropdown.js.map +1 -1
- package/components/selects/Multiselect.d.ts +5 -0
- package/components/selects/Multiselect.js +60 -58
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/Select.d.ts +5 -0
- package/components/selects/Select.js +60 -58
- package/components/selects/Select.js.map +1 -1
- package/components/sidebars/Sidebar.js +40 -40
- package/components/sidebars/Sidebar.js.map +1 -1
- package/components/sidebars/SidebarCloseButton.d.ts +3 -1
- package/components/sidebars/SidebarCloseButton.js +19 -5
- package/components/sidebars/SidebarCloseButton.js.map +1 -1
- package/components/states/CustomState.d.ts +7 -1
- package/components/states/CustomState.js.map +1 -1
- package/components/states/StateButton.d.ts +11 -1
- package/components/states/StateButton.js +46 -10
- package/components/states/StateButton.js.map +1 -1
- package/components/statsWidget/StatsWidgetNumber.d.ts +16 -1
- package/components/statsWidget/StatsWidgetNumber.js +29 -12
- package/components/statsWidget/StatsWidgetNumber.js.map +1 -1
- package/components/tabbedPanel/TabbedPanel.d.ts +99 -0
- package/components/tabbedPanel/TabbedPanel.js +119 -0
- package/components/tabbedPanel/TabbedPanel.js.map +1 -0
- package/components/table/Table.types.d.ts +9 -1
- package/components/table/TableColumn.js +20 -19
- package/components/table/TableColumn.js.map +1 -1
- package/components/table/TableHeaderColumn.d.ts +4 -0
- package/components/table/TableHeaderColumn.js +50 -53
- package/components/table/TableHeaderColumn.js.map +1 -1
- package/components/table/TableToolbar.d.ts +4 -0
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableToolbarColumn.d.ts +3 -0
- package/components/table/TableToolbarColumn.js.map +1 -1
- package/components/table/render/header/resolveHeaderCellStyle.d.ts +87 -55
- package/components/timepicker/TimePicker.d.ts +6 -0
- package/components/timepicker/TimePicker.js +57 -56
- package/components/timepicker/TimePicker.js.map +1 -1
- package/hooks/useClickOutside.js +3 -3
- package/hooks/useClipboard.js.map +1 -1
- package/hooks/useScrollPosition.js.map +1 -1
- package/package.json +2 -4
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +23 -22
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js.map +1 -1
- package/utils/analytics/getTrackingLabelFromNode.d.ts +2 -0
- package/utils/analytics/getTrackingLabelFromNode.js +24 -0
- package/utils/analytics/getTrackingLabelFromNode.js.map +1 -0
- package/utils/analytics/googleAnalyticsUtils.js +21 -28
- package/utils/analytics/googleAnalyticsUtils.js.map +1 -1
- package/utils/getNodeTextContent.d.ts +2 -0
- package/utils/getNodeTextContent.js +22 -0
- package/utils/getNodeTextContent.js.map +1 -0
- package/utils/init/initCSS.js +5 -5
- package/utils/init/initCSS.js.map +1 -1
- package/utils/init/initConfig.js +4 -7
- package/utils/init/initConfig.js.map +1 -1
- package/utils/init/initDocumentBootstrapping.js +14 -14
- package/utils/init/initDocumentBootstrapping.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayPickerTypes.js","sources":["../../../src/components/datepicker/dayPickerTypes.ts"],"sourcesContent":["import type { FocusEventHandler, InputHTMLAttributes, ReactNode } from 'react';\nimport type { DateRange as ReactDayPickerDateRange } from 'react-day-picker';\nimport type { RioglyphIconType } from '../rioglyph/RioglyphIconType';\n\nexport type DateRange = ReactDayPickerDateRange;\nexport type Modifiers = Record<string, boolean>;\nexport type DayPickerMode = 'single' | 'multiple' | 'range';\nexport type DayPickerSelection = Date | Date[] | DateRange | undefined;\nexport type DayPickerRangeSelectionVariant = 'default' | 'week' | 'month' | 'rolling';\nexport type DayPickerDateBefore = { before: Date };\nexport type DayPickerDateAfter = { after: Date };\nexport type DayPickerDateInterval = { before: Date; after: Date };\nexport type DayPickerDayOfWeek = { dayOfWeek: number | number[] };\nexport type DayPickerDateMatcher =\n | boolean\n | Date\n | Date[]\n | DateRange\n | DayPickerDateBefore\n | DayPickerDateAfter\n | DayPickerDateInterval\n | DayPickerDayOfWeek\n | ((date: Date) => boolean);\nexport type DayPickerDisabledDays = DayPickerDateMatcher | DayPickerDateMatcher[];\nexport type DayPickerHiddenDays = DayPickerDateMatcher | DayPickerDateMatcher[];\nexport type DayPickerCustomModifiers = Record<string, DayPickerDateMatcher | DayPickerDateMatcher[]>;\n\ntype CommonCalendarProps = {\n /**\n * Locale used for calendar labels and default input formatting.\n *\n * @default 'en-GB'\n */\n locale?: string;\n\n /**\n * Optional size variant for the rendered calendar density.\n *\n * Changes the size and spacing of the individual day cells instead of the outer wrapper.\n *\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * Additional classes for the calendar root element.\n */\n className?: string;\n\n /**\n * Number of visible calendar months.\n *\n * @default 1\n */\n numberOfMonths?: 1 | 2;\n\n /**\n * Shows the days from adjacent months inside the current month grid.\n *\n * @default true\n */\n showOutsideDays?: boolean;\n\n /**\n * Keeps the calendar height stable by always rendering full weeks.\n *\n * @default true\n */\n fixedWeeks?: boolean;\n\n /**\n * Shows the calendar week number column.\n *\n * @default false\n */\n showWeekNumber?: boolean;\n\n /**\n * Overrides the first day of the week.\n *\n * `0` is Sunday, `1` is Monday, up to `6` for Saturday.\n */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n /**\n * Initial month shown when the calendar is first rendered.\n */\n defaultMonth?: Date;\n\n /**\n * Controlled currently visible month.\n */\n month?: Date;\n\n /**\n * Called when the visible month changes.\n */\n onMonthChange?: (month: Date) => void;\n\n /**\n * Lower month boundary for month navigation.\n */\n startMonth?: Date;\n\n /**\n * Upper month boundary for month navigation.\n */\n endMonth?: Date;\n\n /**\n * Days that cannot be selected.\n */\n disabledDays?: DayPickerDisabledDays;\n\n /**\n * Days that should not be rendered in the calendar grid.\n */\n hiddenDays?: DayPickerHiddenDays;\n\n /**\n * Custom day modifiers forwarded to the underlying calendar.\n */\n modifiers?: DayPickerCustomModifiers;\n\n /**\n * Additional CSS classes attached to custom modifiers.\n */\n modifiersClassNames?: Record<string, string>;\n\n /**\n * Renders optional custom content inside a day cell.\n *\n * Useful for icons, dots, tooltips or other domain-specific markers.\n */\n renderDayContent?: (date: Date, modifiers: Modifiers) => ReactNode;\n};\n\nexport type SingleDayPickerCalendarProps = CommonCalendarProps & {\n /**\n * Enables single-date selection.\n *\n * @default 'single'\n */\n mode?: 'single';\n\n /**\n * Controlled single selected date.\n */\n value?: Date;\n\n /**\n * Initial single selected date for uncontrolled usage.\n */\n defaultValue?: Date;\n\n /**\n * Called when the selected date changes.\n */\n onChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n};\n\nexport type MultipleDayPickerCalendarProps = CommonCalendarProps & {\n /**\n * Enables multiple independent date selection.\n */\n mode: 'multiple';\n\n /**\n * Controlled list of selected dates.\n */\n value?: Date[];\n\n /**\n * Initial selected dates for uncontrolled usage.\n */\n defaultValue?: Date[];\n\n /**\n * Called when the selected dates change.\n */\n onChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n};\n\nexport type RangeDayPickerCalendarProps = CommonCalendarProps & {\n /**\n * Enables date-range selection.\n */\n mode: 'range';\n\n /**\n * Controlled selected date range.\n */\n value?: DateRange;\n\n /**\n * Initial selected date range for uncontrolled usage.\n */\n defaultValue?: DateRange;\n\n /**\n * Called when the selected range changes.\n */\n onChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n\n /**\n * Selects how a range is created when clicking a day.\n *\n * `default` uses the built-in range behavior.\n * `week` selects the whole week of the clicked day.\n * `month` selects the whole month of the clicked day.\n * `rolling` selects a fixed-length range starting at the clicked day.\n *\n * @default 'default'\n */\n selectionVariant?: 'default' | 'week' | 'month' | 'rolling';\n\n /**\n * Fixed number of days used when `selectionVariant='rolling'`.\n *\n * @default 7\n */\n rollingDays?: number;\n};\n\nexport type DayPickerCalendarProps =\n | SingleDayPickerCalendarProps\n | MultipleDayPickerCalendarProps\n | RangeDayPickerCalendarProps;\n\nexport type DayPickerSlotRenderProps<TValue> = {\n /**\n * Currently committed value of the picker.\n */\n value: TValue | undefined;\n\n /**\n * Current draft value while the dropdown is open.\n *\n * In deferred mode, this can differ from `value` until `apply()` is called.\n */\n draftValue: TValue | undefined;\n\n /**\n * Updates the current draft value from custom slot content.\n */\n setDraftValue: (value: TValue | undefined) => void;\n\n /**\n * Commits the current draft value and closes the dropdown.\n */\n apply: () => void;\n\n /**\n * Clears the current selection.\n */\n clear: () => void;\n\n /**\n * Closes the dropdown without necessarily committing the current draft value.\n */\n close: () => void;\n\n /**\n * Active selection mode of the picker.\n */\n mode: DayPickerMode;\n\n /**\n * Active locale used for formatting and calendar labels.\n */\n locale: string;\n};\n\nexport type DayPickerTriggerRenderProps<TValue> = DayPickerSlotRenderProps<TValue> & {\n /**\n * Optional id forwarded from the DayPicker props.\n */\n id?: string;\n\n /**\n * Optional form field name forwarded from the DayPicker props.\n */\n name?: string;\n\n /**\n * String currently shown by the default trigger input.\n */\n displayValue: string;\n\n /**\n * Whether the dropdown is currently open.\n */\n isOpen: boolean;\n\n /**\n * Opens the dropdown.\n */\n open: () => void;\n\n /**\n * Toggles the dropdown open state.\n */\n toggle: () => void;\n};\n\ntype CommonDayPickerProps = Omit<CommonCalendarProps, 'size'> & {\n /**\n * Optional id forwarded to the default input trigger.\n */\n id?: string;\n\n /**\n * Optional form field name forwarded to the default input trigger.\n */\n name?: string;\n\n /**\n * Placeholder text shown in the default input trigger.\n */\n placeholder?: string;\n\n /**\n * Rioglyph icon shown in the default input trigger addon.\n *\n * @default 'rioglyph-calendar'\n */\n iconName?: RioglyphIconType;\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 /**\n * Called when the internal input loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n\n /**\n * Additional props forwarded to the default input element.\n *\n * Useful for attributes like `readOnly`, `disabled`, `required`, `autoFocus`, or custom ARIA labels.\n */\n inputProps?: Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'children' | 'value' | 'defaultValue' | 'onChange' | 'size'\n >;\n\n /**\n * Shows the built-in error styling and help block below the input.\n */\n errorMessage?: string | ReactNode;\n\n /**\n * Shows the built-in warning styling and help block below the input.\n */\n warningMessage?: string | ReactNode;\n\n /**\n * Controls white-space handling inside the built-in help block.\n *\n * @default 'normal'\n */\n messageWhiteSpace?: 'normal' | 'nowrap' | 'pre-line';\n\n /**\n * Additional classes for the text input element.\n */\n inputClassName?: string;\n\n /**\n * Additional classes for the dropdown container.\n */\n dropdownClassName?: string;\n\n /**\n * Additional classes for the left sidebar container.\n */\n leftSidebarClassName?: string;\n\n /**\n * Additional classes for the right sidebar container.\n */\n rightSidebarClassName?: string;\n\n /**\n * Additional classes for the footer container.\n */\n footerClassName?: string;\n\n /**\n * Renders the dropdown into a dedicated react portal.\n *\n * @default false\n */\n usePortal?: boolean;\n\n /**\n * Aligns the dropdown to the right edge of the input.\n *\n * @default false\n */\n alignRight?: boolean;\n\n /**\n * Shows a clear button inside the input.\n *\n * @default false\n */\n isClearable?: boolean;\n\n /**\n * Closes the dropdown after selecting a complete value.\n *\n * Range mode closes only after both dates are selected.\n *\n * @default true for `selectionBehavior='immediate'`, otherwise false\n */\n closeOnSelect?: boolean;\n\n /**\n * Closes the dropdown when clicking outside of the trigger and dropdown.\n *\n * @default true\n */\n closeOnOutsideClick?: boolean;\n\n /**\n * Defines whether the value is committed immediately or only when applied explicitly.\n *\n * @default 'immediate'\n */\n selectionBehavior?: 'immediate' | 'deferred';\n};\n\n/**\n * Props for a `DayPicker` with single-date selection.\n */\nexport type SingleDayPickerProps = CommonDayPickerProps & {\n /**\n * Enables single-date selection.\n *\n * @default 'single'\n */\n mode?: 'single';\n\n /**\n * Controlled single selected date.\n */\n value?: Date;\n\n /**\n * Initial single selected date for uncontrolled usage.\n */\n defaultValue?: Date;\n\n /**\n * Called when the selected date changes.\n */\n onChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n\n /**\n * Called whenever the user changes the raw input value.\n * Useful for custom validation and form-library integration.\n */\n onInputChange?: (rawValue: string, parsedDate: Date | undefined, isValid: boolean) => void;\n\n /**\n * Custom parser for manual single-date input.\n * Overrides the built-in locale/dateFormat parsing.\n */\n parseInput?: (rawValue: string, locale: string) => Date | undefined;\n\n /**\n * Custom renderer for the value shown in the input.\n */\n renderValue?: (value: Date | undefined, locale: string) => string;\n\n /**\n * Replaces the default input trigger with custom trigger content.\n */\n trigger?: ReactNode | ((props: DayPickerTriggerRenderProps<Date>) => ReactNode);\n\n /**\n * Optional content rendered on the left side of the dropdown.\n */\n leftSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date>) => ReactNode);\n\n /**\n * Optional content rendered on the right side of the dropdown.\n */\n rightSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date>) => ReactNode);\n\n /**\n * Optional content rendered below the calendar inside the dropdown.\n */\n footer?: ReactNode | ((props: DayPickerSlotRenderProps<Date>) => ReactNode);\n};\n\n/**\n * Props for a `DayPicker` with multiple independent dates.\n */\nexport type MultipleDayPickerProps = CommonDayPickerProps & {\n /**\n * Enables multiple independent date selection.\n */\n mode: 'multiple';\n\n /**\n * Controlled list of selected dates.\n */\n value?: Date[];\n\n /**\n * Initial selected dates for uncontrolled usage.\n */\n defaultValue?: Date[];\n\n /**\n * Called when the selected dates change.\n */\n onChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n\n /**\n * Custom renderer for the value shown in the input.\n */\n renderValue?: (value: Date[] | undefined, locale: string) => string;\n\n /**\n * Replaces the default input trigger with custom trigger content.\n */\n trigger?: ReactNode | ((props: DayPickerTriggerRenderProps<Date[]>) => ReactNode);\n\n /**\n * Optional content rendered on the left side of the dropdown.\n */\n leftSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date[]>) => ReactNode);\n\n /**\n * Optional content rendered on the right side of the dropdown.\n */\n rightSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date[]>) => ReactNode);\n\n /**\n * Optional content rendered below the calendar inside the dropdown.\n */\n footer?: ReactNode | ((props: DayPickerSlotRenderProps<Date[]>) => ReactNode);\n};\n\n/**\n * Props for a `DayPicker` with date-range selection.\n */\nexport type RangeDayPickerProps = CommonDayPickerProps & {\n /**\n * Enables date-range selection.\n */\n mode: 'range';\n\n /**\n * Controlled selected date range.\n */\n value?: DateRange;\n\n /**\n * Initial selected date range for uncontrolled usage.\n */\n defaultValue?: DateRange;\n\n /**\n * Called when the selected range changes.\n */\n onChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n\n /**\n * Custom renderer for the value shown in the input.\n */\n renderValue?: (value: DateRange | undefined, locale: string) => string;\n\n /**\n * Selects how a range is created when clicking a day.\n *\n * `default` uses the built-in range behavior.\n * `week` selects the whole week of the clicked day.\n * `month` selects the whole month of the clicked day.\n * `rolling` selects a fixed-length range starting at the clicked day.\n *\n * @default 'default'\n */\n selectionVariant?: 'default' | 'week' | 'month' | 'rolling';\n\n /**\n * Fixed number of days used when `selectionVariant='rolling'`.\n *\n * @default 7\n */\n rollingDays?: number;\n\n /**\n * Replaces the default input trigger with custom trigger content.\n */\n trigger?: ReactNode | ((props: DayPickerTriggerRenderProps<DateRange>) => ReactNode);\n\n /**\n * Optional content rendered on the left side of the dropdown.\n */\n leftSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<DateRange>) => ReactNode);\n\n /**\n * Optional content rendered on the right side of the dropdown.\n */\n rightSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<DateRange>) => ReactNode);\n\n /**\n * Optional content rendered below the calendar inside the dropdown.\n */\n footer?: ReactNode | ((props: DayPickerSlotRenderProps<DateRange>) => ReactNode);\n};\n\nexport type DayPickerProps = SingleDayPickerProps | MultipleDayPickerProps | RangeDayPickerProps;\n\nexport const isSingleDayPickerProps = (\n props: DayPickerProps | DayPickerCalendarProps\n): props is SingleDayPickerProps | SingleDayPickerCalendarProps => !props.mode || props.mode === 'single';\n\nexport const isMultipleDayPickerProps = (\n props: DayPickerProps | DayPickerCalendarProps\n): props is MultipleDayPickerProps | MultipleDayPickerCalendarProps => props.mode === 'multiple';\n\nexport const isRangeDayPickerProps = (\n props: DayPickerProps | DayPickerCalendarProps\n): props is RangeDayPickerProps | RangeDayPickerCalendarProps => props.mode === 'range';\n"],"names":["isSingleDayPickerProps","props","isMultipleDayPickerProps","isRangeDayPickerProps"],"mappings":"AA6mBO,MAAMA,IAAyB,CAClCC,MAC+D,CAACA,EAAM,QAAQA,EAAM,SAAS,UAEpFC,IAA2B,CACpCD,MACmEA,EAAM,SAAS,YAEzEE,IAAwB,CACjCF,MAC6DA,EAAM,SAAS;"}
|
|
1
|
+
{"version":3,"file":"dayPickerTypes.js","sources":["../../../src/components/datepicker/dayPickerTypes.ts"],"sourcesContent":["import type { FocusEventHandler, InputHTMLAttributes, ReactNode } from 'react';\nimport type { DateRange as ReactDayPickerDateRange } from 'react-day-picker';\nimport type { RioglyphIconType } from '../rioglyph/RioglyphIconType';\n\nexport type DateRange = ReactDayPickerDateRange;\nexport type Modifiers = Record<string, boolean>;\nexport type DayPickerMode = 'single' | 'multiple' | 'range';\nexport type DayPickerSelection = Date | Date[] | DateRange | undefined;\nexport type DayPickerRangeSelectionVariant = 'default' | 'week' | 'month' | 'rolling';\nexport type DayPickerDateBefore = { before: Date };\nexport type DayPickerDateAfter = { after: Date };\nexport type DayPickerDateInterval = { before: Date; after: Date };\nexport type DayPickerDayOfWeek = { dayOfWeek: number | number[] };\nexport type DayPickerDateMatcher =\n | boolean\n | Date\n | Date[]\n | DateRange\n | DayPickerDateBefore\n | DayPickerDateAfter\n | DayPickerDateInterval\n | DayPickerDayOfWeek\n | ((date: Date) => boolean);\nexport type DayPickerDisabledDays = DayPickerDateMatcher | DayPickerDateMatcher[];\nexport type DayPickerHiddenDays = DayPickerDateMatcher | DayPickerDateMatcher[];\nexport type DayPickerCustomModifiers = Record<string, DayPickerDateMatcher | DayPickerDateMatcher[]>;\n\ntype CommonCalendarProps = {\n /**\n * Locale used for calendar labels and default input formatting.\n *\n * @default 'en-GB'\n */\n locale?: string;\n\n /**\n * Optional size variant for the rendered calendar density.\n *\n * Changes the size and spacing of the individual day cells instead of the outer wrapper.\n *\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * Additional classes for the calendar root element.\n */\n className?: string;\n\n /**\n * Number of visible calendar months.\n *\n * @default 1\n */\n numberOfMonths?: 1 | 2;\n\n /**\n * Shows the days from adjacent months inside the current month grid.\n *\n * @default true\n */\n showOutsideDays?: boolean;\n\n /**\n * Keeps the calendar height stable by always rendering full weeks.\n *\n * @default true\n */\n fixedWeeks?: boolean;\n\n /**\n * Shows the calendar week number column.\n *\n * @default false\n */\n showWeekNumber?: boolean;\n\n /**\n * Overrides the first day of the week.\n *\n * `0` is Sunday, `1` is Monday, up to `6` for Saturday.\n */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n /**\n * Initial month shown when the calendar is first rendered.\n */\n defaultMonth?: Date;\n\n /**\n * Controlled currently visible month.\n */\n month?: Date;\n\n /**\n * Called when the visible month changes.\n */\n onMonthChange?: (month: Date) => void;\n\n /**\n * Lower month boundary for month navigation.\n */\n startMonth?: Date;\n\n /**\n * Upper month boundary for month navigation.\n */\n endMonth?: Date;\n\n /**\n * Days that cannot be selected.\n */\n disabledDays?: DayPickerDisabledDays;\n\n /**\n * Days that should not be rendered in the calendar grid.\n */\n hiddenDays?: DayPickerHiddenDays;\n\n /**\n * Custom day modifiers forwarded to the underlying calendar.\n */\n modifiers?: DayPickerCustomModifiers;\n\n /**\n * Additional CSS classes attached to custom modifiers.\n */\n modifiersClassNames?: Record<string, string>;\n\n /**\n * Renders optional custom content inside a day cell.\n *\n * Useful for icons, dots, tooltips or other domain-specific markers.\n */\n renderDayContent?: (date: Date, modifiers: Modifiers) => ReactNode;\n};\n\nexport type SingleDayPickerCalendarProps = CommonCalendarProps & {\n /**\n * Enables single-date selection.\n *\n * @default 'single'\n */\n mode?: 'single';\n\n /**\n * Controlled single selected date.\n */\n value?: Date;\n\n /**\n * Initial single selected date for uncontrolled usage.\n */\n defaultValue?: Date;\n\n /**\n * Called when the selected date changes.\n */\n onChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n};\n\nexport type MultipleDayPickerCalendarProps = CommonCalendarProps & {\n /**\n * Enables multiple independent date selection.\n */\n mode: 'multiple';\n\n /**\n * Controlled list of selected dates.\n */\n value?: Date[];\n\n /**\n * Initial selected dates for uncontrolled usage.\n */\n defaultValue?: Date[];\n\n /**\n * Called when the selected dates change.\n */\n onChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n};\n\nexport type RangeDayPickerCalendarProps = CommonCalendarProps & {\n /**\n * Enables date-range selection.\n */\n mode: 'range';\n\n /**\n * Controlled selected date range.\n */\n value?: DateRange;\n\n /**\n * Initial selected date range for uncontrolled usage.\n */\n defaultValue?: DateRange;\n\n /**\n * Called when the selected range changes.\n */\n onChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n\n /**\n * Selects how a range is created when clicking a day.\n *\n * `default` uses the built-in range behavior.\n * `week` selects the whole week of the clicked day.\n * `month` selects the whole month of the clicked day.\n * `rolling` selects a fixed-length range starting at the clicked day.\n *\n * @default 'default'\n */\n selectionVariant?: 'default' | 'week' | 'month' | 'rolling';\n\n /**\n * Fixed number of days used when `selectionVariant='rolling'`.\n *\n * @default 7\n */\n rollingDays?: number;\n};\n\nexport type DayPickerCalendarProps =\n | SingleDayPickerCalendarProps\n | MultipleDayPickerCalendarProps\n | RangeDayPickerCalendarProps;\n\nexport type DayPickerSlotRenderProps<TValue> = {\n /**\n * Currently committed value of the picker.\n */\n value: TValue | undefined;\n\n /**\n * Current draft value while the dropdown is open.\n *\n * In deferred mode, this can differ from `value` until `apply()` is called.\n */\n draftValue: TValue | undefined;\n\n /**\n * Updates the current draft value from custom slot content.\n */\n setDraftValue: (value: TValue | undefined) => void;\n\n /**\n * Commits the current draft value and closes the dropdown.\n */\n apply: () => void;\n\n /**\n * Clears the current selection.\n */\n clear: () => void;\n\n /**\n * Closes the dropdown without necessarily committing the current draft value.\n */\n close: () => void;\n\n /**\n * Active selection mode of the picker.\n */\n mode: DayPickerMode;\n\n /**\n * Active locale used for formatting and calendar labels.\n */\n locale: string;\n};\n\nexport type DayPickerTriggerRenderProps<TValue> = DayPickerSlotRenderProps<TValue> & {\n /**\n * Optional id forwarded from the DayPicker props.\n */\n id?: string;\n\n /**\n * Optional form field name forwarded from the DayPicker props.\n */\n name?: string;\n\n /**\n * String currently shown by the default trigger input.\n */\n displayValue: string;\n\n /**\n * Whether the dropdown is currently open.\n */\n isOpen: boolean;\n\n /**\n * Opens the dropdown.\n */\n open: () => void;\n\n /**\n * Toggles the dropdown open state.\n */\n toggle: () => void;\n};\n\ntype CommonDayPickerProps = Omit<CommonCalendarProps, 'size'> & {\n /**\n * Optional id forwarded to the default input trigger.\n */\n id?: string;\n\n /**\n * Optional form field name forwarded to the default input trigger.\n */\n name?: string;\n\n /**\n * Placeholder text shown in the default input trigger.\n */\n placeholder?: string;\n\n /**\n * Rioglyph icon shown in the default input trigger addon.\n *\n * @default 'rioglyph-calendar'\n */\n iconName?: RioglyphIconType;\n\n /**\n * Custom date-fns format string (e.g., 'yyyy-MM-dd' or 'dd.MM.yyyy HH:mm') to override locale-based formatting.\n * The built-in input mask supports numeric `dd`, `MM`, `yyyy`, `HH` and `mm` tokens with separators.\n * If omitted, locale-based date-only display is used for the input.\n */\n dateFormat?: string;\n\n /**\n * Called when the internal input loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n\n /**\n * Additional props forwarded to the default input element.\n *\n * Useful for attributes like `readOnly`, `disabled`, `required`, `autoFocus`, or custom ARIA labels.\n */\n inputProps?: Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'children' | 'value' | 'defaultValue' | 'onChange' | 'size'\n >;\n\n /**\n * Shows the built-in error styling and help block below the input.\n */\n errorMessage?: string | ReactNode;\n\n /**\n * Shows the built-in warning styling and help block below the input.\n */\n warningMessage?: string | ReactNode;\n\n /**\n * Controls white-space handling inside the built-in help block.\n *\n * @default 'normal'\n */\n messageWhiteSpace?: 'normal' | 'nowrap' | 'pre-line';\n\n /**\n * Additional classes for the text input element.\n */\n inputClassName?: string;\n\n /**\n * Additional classes for the dropdown container.\n */\n dropdownClassName?: string;\n\n /**\n * Additional classes for the left sidebar container.\n */\n leftSidebarClassName?: string;\n\n /**\n * Additional classes for the right sidebar container.\n */\n rightSidebarClassName?: string;\n\n /**\n * Additional classes for the footer container.\n */\n footerClassName?: string;\n\n /**\n * Renders the dropdown into a dedicated react portal.\n *\n * @default false\n */\n usePortal?: boolean;\n\n /**\n * Aligns the dropdown to the right edge of the input.\n *\n * @default false\n */\n alignRight?: boolean;\n\n /**\n * Shows a clear button inside the input.\n *\n * @default false\n */\n isClearable?: boolean;\n\n /**\n * Closes the dropdown after selecting a complete value.\n *\n * Range mode closes only after both dates are selected.\n *\n * @default true for `selectionBehavior='immediate'`, otherwise false\n */\n closeOnSelect?: boolean;\n\n /**\n * Closes the dropdown when clicking outside of the trigger and dropdown.\n *\n * @default true\n */\n closeOnOutsideClick?: boolean;\n\n /**\n * Defines whether the value is committed immediately or only when applied explicitly.\n *\n * @default 'immediate'\n */\n selectionBehavior?: 'immediate' | 'deferred';\n};\n\n/**\n * Props for a `DayPicker` with single-date selection.\n */\nexport type SingleDayPickerProps = CommonDayPickerProps & {\n /**\n * Enables single-date selection.\n *\n * @default 'single'\n */\n mode?: 'single';\n\n /**\n * Controlled single selected date.\n */\n value?: Date;\n\n /**\n * Initial single selected date for uncontrolled usage.\n */\n defaultValue?: Date;\n\n /**\n * Called when the selected date changes.\n */\n onChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n\n /**\n * Called whenever the user changes the raw input value.\n * Useful for custom validation and form-library integration.\n */\n onInputChange?: (rawValue: string, parsedDate: Date | undefined, isValid: boolean) => void;\n\n /**\n * Custom parser for manual single-date input.\n * Overrides the built-in locale/dateFormat parsing.\n */\n parseInput?: (rawValue: string, locale: string) => Date | undefined;\n\n /**\n * Custom renderer for the value shown in the input.\n */\n renderValue?: (value: Date | undefined, locale: string) => string;\n\n /**\n * Replaces the default input trigger with custom trigger content.\n */\n trigger?: ReactNode | ((props: DayPickerTriggerRenderProps<Date>) => ReactNode);\n\n /**\n * Optional content rendered on the left side of the dropdown.\n */\n leftSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date>) => ReactNode);\n\n /**\n * Optional content rendered on the right side of the dropdown.\n */\n rightSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date>) => ReactNode);\n\n /**\n * Optional content rendered below the calendar inside the dropdown.\n */\n footer?: ReactNode | ((props: DayPickerSlotRenderProps<Date>) => ReactNode);\n};\n\n/**\n * Props for a `DayPicker` with multiple independent dates.\n */\nexport type MultipleDayPickerProps = CommonDayPickerProps & {\n /**\n * Enables multiple independent date selection.\n */\n mode: 'multiple';\n\n /**\n * Controlled list of selected dates.\n */\n value?: Date[];\n\n /**\n * Initial selected dates for uncontrolled usage.\n */\n defaultValue?: Date[];\n\n /**\n * Called when the selected dates change.\n */\n onChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n\n /**\n * Custom renderer for the value shown in the input.\n */\n renderValue?: (value: Date[] | undefined, locale: string) => string;\n\n /**\n * Replaces the default input trigger with custom trigger content.\n */\n trigger?: ReactNode | ((props: DayPickerTriggerRenderProps<Date[]>) => ReactNode);\n\n /**\n * Optional content rendered on the left side of the dropdown.\n */\n leftSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date[]>) => ReactNode);\n\n /**\n * Optional content rendered on the right side of the dropdown.\n */\n rightSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<Date[]>) => ReactNode);\n\n /**\n * Optional content rendered below the calendar inside the dropdown.\n */\n footer?: ReactNode | ((props: DayPickerSlotRenderProps<Date[]>) => ReactNode);\n};\n\n/**\n * Props for a `DayPicker` with date-range selection.\n */\nexport type RangeDayPickerProps = CommonDayPickerProps & {\n /**\n * Enables date-range selection.\n */\n mode: 'range';\n\n /**\n * Controlled selected date range.\n */\n value?: DateRange;\n\n /**\n * Initial selected date range for uncontrolled usage.\n */\n defaultValue?: DateRange;\n\n /**\n * Called when the selected range changes.\n */\n onChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n\n /**\n * Custom renderer for the value shown in the input.\n */\n renderValue?: (value: DateRange | undefined, locale: string) => string;\n\n /**\n * Selects how a range is created when clicking a day.\n *\n * `default` uses the built-in range behavior.\n * `week` selects the whole week of the clicked day.\n * `month` selects the whole month of the clicked day.\n * `rolling` selects a fixed-length range starting at the clicked day.\n *\n * @default 'default'\n */\n selectionVariant?: 'default' | 'week' | 'month' | 'rolling';\n\n /**\n * Fixed number of days used when `selectionVariant='rolling'`.\n *\n * @default 7\n */\n rollingDays?: number;\n\n /**\n * Replaces the default input trigger with custom trigger content.\n */\n trigger?: ReactNode | ((props: DayPickerTriggerRenderProps<DateRange>) => ReactNode);\n\n /**\n * Optional content rendered on the left side of the dropdown.\n */\n leftSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<DateRange>) => ReactNode);\n\n /**\n * Optional content rendered on the right side of the dropdown.\n */\n rightSidebar?: ReactNode | ((props: DayPickerSlotRenderProps<DateRange>) => ReactNode);\n\n /**\n * Optional content rendered below the calendar inside the dropdown.\n */\n footer?: ReactNode | ((props: DayPickerSlotRenderProps<DateRange>) => ReactNode);\n};\n\nexport type DayPickerProps = SingleDayPickerProps | MultipleDayPickerProps | RangeDayPickerProps;\n\nexport const isSingleDayPickerProps = (\n props: DayPickerProps | DayPickerCalendarProps\n): props is SingleDayPickerProps | SingleDayPickerCalendarProps => !props.mode || props.mode === 'single';\n\nexport const isMultipleDayPickerProps = (\n props: DayPickerProps | DayPickerCalendarProps\n): props is MultipleDayPickerProps | MultipleDayPickerCalendarProps => props.mode === 'multiple';\n\nexport const isRangeDayPickerProps = (\n props: DayPickerProps | DayPickerCalendarProps\n): props is RangeDayPickerProps | RangeDayPickerCalendarProps => props.mode === 'range';\n"],"names":["isSingleDayPickerProps","props","isMultipleDayPickerProps","isRangeDayPickerProps"],"mappings":"AA8mBO,MAAMA,IAAyB,CAClCC,MAC+D,CAACA,EAAM,QAAQA,EAAM,SAAS,UAEpFC,IAA2B,CACpCD,MACmEA,EAAM,SAAS,YAEzEE,IAAwB,CACjCF,MAC6DA,EAAM,SAAS;"}
|
|
@@ -6,5 +6,5 @@ export declare const resolveLocale: (localeCode: string) => Locale;
|
|
|
6
6
|
export declare const formatDate: (date: Date | undefined, localeCode: string, dateFormat?: string) => string;
|
|
7
7
|
export declare const formatSelectionForInput: (selected: Date | Date[] | DateRange | undefined, localeCode: string, mode: DayPickerMode, dateFormat?: string) => string;
|
|
8
8
|
export declare const getInputFormat: (localeCode: string, dateFormat?: string) => string;
|
|
9
|
-
export declare const getInputMaskProps: (localeCode: string, dateFormat?: string) => Pick<ClearableInputProps, "mask" | "pattern" | "format" | "parse"> | undefined;
|
|
9
|
+
export declare const getInputMaskProps: (localeCode: string, dateFormat?: string) => Pick<ClearableInputProps, "mask" | "pattern" | "format" | "parse" | "blocks"> | undefined;
|
|
10
10
|
export declare const parseDateString: (value: string | undefined, localeCode: string, dateFormat?: string) => Date | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { parse as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
1
|
+
import { parse as i, format as a, isValid as m } from "date-fns";
|
|
2
|
+
import * as e from "date-fns/locale";
|
|
3
|
+
import { IMask as d } from "react-imask";
|
|
4
|
+
const f = {
|
|
4
5
|
"bg-BG": "dd.MM.yyyy",
|
|
5
6
|
"cs-CZ": "dd.MM.yyyy",
|
|
6
7
|
"da-DK": "dd-MM-yyyy",
|
|
@@ -25,10 +26,10 @@ const i = {
|
|
|
25
26
|
"sk-SK": "dd.MM.yyyy",
|
|
26
27
|
"sl-SI": "dd.MM.yyyy",
|
|
27
28
|
"sv-SE": "yyyy-MM-dd"
|
|
28
|
-
},
|
|
29
|
+
}, k = Object.keys(f), h = (y) => {
|
|
29
30
|
const r = y.trim(), t = r.replace(/-([a-z])/gi, (n, M) => M.toUpperCase()), o = r.split("-")[0];
|
|
30
|
-
return
|
|
31
|
-
}, p = (y, r, t) => y ?
|
|
31
|
+
return e[t] || e[r] || e[o] || e.enGB;
|
|
32
|
+
}, p = (y, r, t) => y ? a(y, s(r, t)) : "", L = (y, r, t, o) => {
|
|
32
33
|
if (!y)
|
|
33
34
|
return "";
|
|
34
35
|
const n = (M) => p(M, r, o);
|
|
@@ -37,11 +38,11 @@ const i = {
|
|
|
37
38
|
if (t === "multiple" && Array.isArray(y))
|
|
38
39
|
return y.map(n).join(", ");
|
|
39
40
|
if (t === "range" && typeof y == "object" && "from" in y) {
|
|
40
|
-
const M = y.from ? n(y.from) : "...",
|
|
41
|
-
return `${M} - ${
|
|
41
|
+
const M = y.from ? n(y.from) : "...", c = y.to ? n(y.to) : "...";
|
|
42
|
+
return `${M} - ${c}`;
|
|
42
43
|
}
|
|
43
44
|
return "";
|
|
44
|
-
},
|
|
45
|
+
}, s = (y, r) => r || f[y] || "yyyy-MM-dd", u = (y) => {
|
|
45
46
|
let r = "";
|
|
46
47
|
for (let t = 0; t < y.length; ) {
|
|
47
48
|
if (y.startsWith("dd", t)) {
|
|
@@ -56,6 +57,14 @@ const i = {
|
|
|
56
57
|
r += "Y", t += 4;
|
|
57
58
|
continue;
|
|
58
59
|
}
|
|
60
|
+
if (y.startsWith("HH", t)) {
|
|
61
|
+
r += "H", t += 2;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (y.startsWith("mm", t)) {
|
|
65
|
+
r += "M", t += 2;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
59
68
|
const o = y[t];
|
|
60
69
|
if (!o)
|
|
61
70
|
break;
|
|
@@ -64,29 +73,43 @@ const i = {
|
|
|
64
73
|
r += o, t += 1;
|
|
65
74
|
}
|
|
66
75
|
return r;
|
|
67
|
-
},
|
|
68
|
-
const t =
|
|
76
|
+
}, D = (y, r) => {
|
|
77
|
+
const t = s(y, r), o = u(t);
|
|
69
78
|
if (o)
|
|
70
79
|
return {
|
|
71
80
|
mask: Date,
|
|
72
81
|
pattern: o,
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
blocks: {
|
|
83
|
+
H: {
|
|
84
|
+
mask: d.MaskedRange,
|
|
85
|
+
from: 0,
|
|
86
|
+
to: 23,
|
|
87
|
+
maxLength: 2
|
|
88
|
+
},
|
|
89
|
+
M: {
|
|
90
|
+
mask: d.MaskedRange,
|
|
91
|
+
from: 0,
|
|
92
|
+
to: 59,
|
|
93
|
+
maxLength: 2
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
format: (n) => n ? a(n, t) : "",
|
|
97
|
+
parse: (n) => i(n, t, /* @__PURE__ */ new Date())
|
|
75
98
|
};
|
|
76
|
-
},
|
|
99
|
+
}, I = (y, r, t) => {
|
|
77
100
|
if (!y)
|
|
78
101
|
return;
|
|
79
|
-
const o = t ||
|
|
80
|
-
if (
|
|
102
|
+
const o = t || s(r), n = i(y, o, /* @__PURE__ */ new Date());
|
|
103
|
+
if (m(n) && a(n, o) === y)
|
|
81
104
|
return n;
|
|
82
105
|
};
|
|
83
106
|
export {
|
|
84
107
|
p as formatDate,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
L as formatSelectionForInput,
|
|
109
|
+
s as getInputFormat,
|
|
110
|
+
D as getInputMaskProps,
|
|
111
|
+
I as parseDateString,
|
|
112
|
+
h as resolveLocale,
|
|
113
|
+
k as supportedDayPickerLocales
|
|
91
114
|
};
|
|
92
115
|
//# sourceMappingURL=dayPickerUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayPickerUtils.js","sources":["../../../src/components/datepicker/dayPickerUtils.ts"],"sourcesContent":["import { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\n\nimport type { ClearableInputProps } from '../clearableInput/ClearableInput';\nimport type { DateRange, DayPickerMode } from './dayPickerTypes';\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\nexport const supportedDayPickerLocales = Object.keys(localeFormatMap);\n\nexport const resolveLocale = (localeCode: string): Locale => {\n const normalizedLocaleCode = localeCode.trim();\n const dateFnsLocaleKey = normalizedLocaleCode.replace(/-([a-z])/gi, (_, segment: string) => segment.toUpperCase());\n const baseCode = normalizedLocaleCode.split('-')[0];\n\n return (\n (locales as Record<string, Locale>)[dateFnsLocaleKey] ||\n (locales as Record<string, Locale>)[normalizedLocaleCode] ||\n (locales as Record<string, Locale>)[baseCode] ||\n locales.enGB\n );\n};\n\nexport const formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n return format(date, getInputFormat(localeCode, dateFormat));\n};\n\nexport const formatSelectionForInput = (\n selected: Date | Date[] | DateRange | undefined,\n localeCode: string,\n mode: DayPickerMode,\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) => formatDate(date, localeCode, dateFormat);\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 = selected.from ? formatFn(selected.from) : '...';\n const to = selected.to ? formatFn(selected.to) : '...';\n return `${from} - ${to}`;\n }\n\n return '';\n};\n\nexport const getInputFormat = (localeCode: string, dateFormat?: string) =>\n dateFormat || localeFormatMap[localeCode] || 'yyyy-MM-dd';\n\nconst getInputMaskPattern = (inputFormat: string) => {\n let pattern = '';\n\n for (let index = 0; index < inputFormat.length; ) {\n if (inputFormat.startsWith('dd', index)) {\n pattern += 'd';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('MM', index)) {\n pattern += 'm';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('yyyy', index)) {\n pattern += 'Y';\n index += 4;\n continue;\n }\n\n const currentChar = inputFormat[index];\n if (!currentChar) {\n break;\n }\n\n if (/[a-zA-Z]/.test(currentChar)) {\n return;\n }\n\n pattern += currentChar;\n index += 1;\n }\n\n return pattern;\n};\n\nexport const getInputMaskProps = (\n localeCode: string,\n dateFormat?: string\n): Pick<ClearableInputProps, 'mask' | 'pattern' | 'format' | 'parse'> | undefined => {\n const inputFormat = getInputFormat(localeCode, dateFormat);\n const pattern = getInputMaskPattern(inputFormat);\n if (!pattern) {\n return;\n }\n\n return {\n mask: Date,\n pattern,\n format: (value: Date | null) => {\n if (!value) {\n return '';\n }\n\n return format(value, inputFormat);\n },\n parse: (value: string) => parse(value, inputFormat, new Date()),\n };\n};\n\nexport const parseDateString = (\n value: string | undefined,\n localeCode: string,\n dateFormat?: string\n): Date | undefined => {\n if (!value) {\n return;\n }\n\n const expectedFormat = dateFormat || getInputFormat(localeCode);\n const parsed = parse(value, expectedFormat, new Date());\n if (!isValid(parsed)) {\n return;\n }\n\n if (format(parsed, expectedFormat) !== value) {\n return;\n }\n\n return parsed;\n};\n"],"names":["localeFormatMap","supportedDayPickerLocales","resolveLocale","localeCode","normalizedLocaleCode","dateFnsLocaleKey","_","segment","baseCode","locales","formatDate","date","dateFormat","format","getInputFormat","formatSelectionForInput","selected","mode","formatFn","from","to","getInputMaskPattern","inputFormat","pattern","index","currentChar","getInputMaskProps","value","parse","parseDateString","expectedFormat","parsed","isValid"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dayPickerUtils.js","sources":["../../../src/components/datepicker/dayPickerUtils.ts"],"sourcesContent":["import { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\nimport { IMask } from 'react-imask';\n\nimport type { ClearableInputProps } from '../clearableInput/ClearableInput';\nimport type { DateRange, DayPickerMode } from './dayPickerTypes';\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\nexport const supportedDayPickerLocales = Object.keys(localeFormatMap);\n\nexport const resolveLocale = (localeCode: string): Locale => {\n const normalizedLocaleCode = localeCode.trim();\n const dateFnsLocaleKey = normalizedLocaleCode.replace(/-([a-z])/gi, (_, segment: string) => segment.toUpperCase());\n const baseCode = normalizedLocaleCode.split('-')[0];\n\n return (\n (locales as Record<string, Locale>)[dateFnsLocaleKey] ||\n (locales as Record<string, Locale>)[normalizedLocaleCode] ||\n (locales as Record<string, Locale>)[baseCode] ||\n locales.enGB\n );\n};\n\nexport const formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n return format(date, getInputFormat(localeCode, dateFormat));\n};\n\nexport const formatSelectionForInput = (\n selected: Date | Date[] | DateRange | undefined,\n localeCode: string,\n mode: DayPickerMode,\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) => formatDate(date, localeCode, dateFormat);\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 = selected.from ? formatFn(selected.from) : '...';\n const to = selected.to ? formatFn(selected.to) : '...';\n return `${from} - ${to}`;\n }\n\n return '';\n};\n\nexport const getInputFormat = (localeCode: string, dateFormat?: string) =>\n dateFormat || localeFormatMap[localeCode] || 'yyyy-MM-dd';\n\nconst getInputMaskPattern = (inputFormat: string) => {\n let pattern = '';\n\n for (let index = 0; index < inputFormat.length; ) {\n if (inputFormat.startsWith('dd', index)) {\n pattern += 'd';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('MM', index)) {\n pattern += 'm';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('yyyy', index)) {\n pattern += 'Y';\n index += 4;\n continue;\n }\n\n if (inputFormat.startsWith('HH', index)) {\n pattern += 'H';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('mm', index)) {\n pattern += 'M';\n index += 2;\n continue;\n }\n\n const currentChar = inputFormat[index];\n if (!currentChar) {\n break;\n }\n\n if (/[a-zA-Z]/.test(currentChar)) {\n return;\n }\n\n pattern += currentChar;\n index += 1;\n }\n\n return pattern;\n};\n\nexport const getInputMaskProps = (\n localeCode: string,\n dateFormat?: string\n): Pick<ClearableInputProps, 'mask' | 'pattern' | 'format' | 'parse' | 'blocks'> | undefined => {\n const inputFormat = getInputFormat(localeCode, dateFormat);\n const pattern = getInputMaskPattern(inputFormat);\n if (!pattern) {\n return;\n }\n\n return {\n mask: Date,\n pattern,\n blocks: {\n H: {\n mask: IMask.MaskedRange,\n from: 0,\n to: 23,\n maxLength: 2,\n },\n M: {\n mask: IMask.MaskedRange,\n from: 0,\n to: 59,\n maxLength: 2,\n },\n },\n format: (value: Date | null) => {\n if (!value) {\n return '';\n }\n\n return format(value, inputFormat);\n },\n parse: (value: string) => parse(value, inputFormat, new Date()),\n };\n};\n\nexport const parseDateString = (\n value: string | undefined,\n localeCode: string,\n dateFormat?: string\n): Date | undefined => {\n if (!value) {\n return;\n }\n\n const expectedFormat = dateFormat || getInputFormat(localeCode);\n const parsed = parse(value, expectedFormat, new Date());\n if (!isValid(parsed)) {\n return;\n }\n\n if (format(parsed, expectedFormat) !== value) {\n return;\n }\n\n return parsed;\n};\n"],"names":["localeFormatMap","supportedDayPickerLocales","resolveLocale","localeCode","normalizedLocaleCode","dateFnsLocaleKey","_","segment","baseCode","locales","formatDate","date","dateFormat","format","getInputFormat","formatSelectionForInput","selected","mode","formatFn","from","to","getInputMaskPattern","inputFormat","pattern","index","currentChar","getInputMaskProps","IMask","value","parse","parseDateString","expectedFormat","parsed","isValid"],"mappings":";;;AAOA,MAAMA,IAA0C;AAAA,EAC5C,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;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,GAEaC,IAA4B,OAAO,KAAKD,CAAe,GAEvDE,IAAgB,CAACC,MAA+B;AACzD,QAAMC,IAAuBD,EAAW,KAAA,GAClCE,IAAmBD,EAAqB,QAAQ,cAAc,CAACE,GAAGC,MAAoBA,EAAQ,aAAa,GAC3GC,IAAWJ,EAAqB,MAAM,GAAG,EAAE,CAAC;AAElD,SACKK,EAAmCJ,CAAgB,KACnDI,EAAmCL,CAAoB,KACvDK,EAAmCD,CAAQ,KAC5CC,EAAQ;AAEhB,GAEaC,IAAa,CAACC,GAAwBR,GAAoBS,MAC9DD,IAIEE,EAAOF,GAAMG,EAAeX,GAAYS,CAAU,CAAC,IAH/C,IAMFG,IAA0B,CACnCC,GACAb,GACAc,GACAL,MACS;AACT,MAAI,CAACI;AACD,WAAO;AAGX,QAAME,IAAW,CAACP,MAAeD,EAAWC,GAAMR,GAAYS,CAAU;AAExE,MAAIK,MAAS,YAAYD,aAAoB;AACzC,WAAOE,EAASF,CAAQ;AAG5B,MAAIC,MAAS,cAAc,MAAM,QAAQD,CAAQ;AAC7C,WAAOA,EAAS,IAAIE,CAAQ,EAAE,KAAK,IAAI;AAG3C,MAAID,MAAS,WAAW,OAAOD,KAAa,YAAY,UAAUA,GAAU;AACxE,UAAMG,IAAOH,EAAS,OAAOE,EAASF,EAAS,IAAI,IAAI,OACjDI,IAAKJ,EAAS,KAAKE,EAASF,EAAS,EAAE,IAAI;AACjD,WAAO,GAAGG,CAAI,MAAMC,CAAE;AAAA,EAC1B;AAEA,SAAO;AACX,GAEaN,IAAiB,CAACX,GAAoBS,MAC/CA,KAAcZ,EAAgBG,CAAU,KAAK,cAE3CkB,IAAsB,CAACC,MAAwB;AACjD,MAAIC,IAAU;AAEd,WAASC,IAAQ,GAAGA,IAAQF,EAAY,UAAU;AAC9C,QAAIA,EAAY,WAAW,MAAME,CAAK,GAAG;AACrC,MAAAD,KAAW,KACXC,KAAS;AACT;AAAA,IACJ;AAEA,QAAIF,EAAY,WAAW,MAAME,CAAK,GAAG;AACrC,MAAAD,KAAW,KACXC,KAAS;AACT;AAAA,IACJ;AAEA,QAAIF,EAAY,WAAW,QAAQE,CAAK,GAAG;AACvC,MAAAD,KAAW,KACXC,KAAS;AACT;AAAA,IACJ;AAEA,QAAIF,EAAY,WAAW,MAAME,CAAK,GAAG;AACrC,MAAAD,KAAW,KACXC,KAAS;AACT;AAAA,IACJ;AAEA,QAAIF,EAAY,WAAW,MAAME,CAAK,GAAG;AACrC,MAAAD,KAAW,KACXC,KAAS;AACT;AAAA,IACJ;AAEA,UAAMC,IAAcH,EAAYE,CAAK;AACrC,QAAI,CAACC;AACD;AAGJ,QAAI,WAAW,KAAKA,CAAW;AAC3B;AAGJ,IAAAF,KAAWE,GACXD,KAAS;AAAA,EACb;AAEA,SAAOD;AACX,GAEaG,IAAoB,CAC7BvB,GACAS,MAC4F;AAC5F,QAAMU,IAAcR,EAAeX,GAAYS,CAAU,GACnDW,IAAUF,EAAoBC,CAAW;AAC/C,MAAKC;AAIL,WAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAAA;AAAA,MACA,QAAQ;AAAA,QACJ,GAAG;AAAA,UACC,MAAMI,EAAM;AAAA,UACZ,MAAM;AAAA,UACN,IAAI;AAAA,UACJ,WAAW;AAAA,QAAA;AAAA,QAEf,GAAG;AAAA,UACC,MAAMA,EAAM;AAAA,UACZ,MAAM;AAAA,UACN,IAAI;AAAA,UACJ,WAAW;AAAA,QAAA;AAAA,MACf;AAAA,MAEJ,QAAQ,CAACC,MACAA,IAIEf,EAAOe,GAAON,CAAW,IAHrB;AAAA,MAKf,OAAO,CAACM,MAAkBC,EAAMD,GAAON,GAAa,oBAAI,MAAM;AAAA,IAAA;AAEtE,GAEaQ,IAAkB,CAC3BF,GACAzB,GACAS,MACmB;AACnB,MAAI,CAACgB;AACD;AAGJ,QAAMG,IAAiBnB,KAAcE,EAAeX,CAAU,GACxD6B,IAASH,EAAMD,GAAOG,GAAgB,oBAAI,MAAM;AACtD,MAAKE,EAAQD,CAAM,KAIfnB,EAAOmB,GAAQD,CAAc,MAAMH;AAIvC,WAAOI;AACX;"}
|
|
@@ -27,6 +27,6 @@ declare const useDayPickerInputState: ({ props, locale, dateFormat, inputProps,
|
|
|
27
27
|
handleClearInput: () => void;
|
|
28
28
|
handleInputFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
29
29
|
handleInputKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
30
|
-
inputMaskProps: Pick<import('../clearableInput/ClearableInput').ClearableInputProps, "
|
|
30
|
+
inputMaskProps: Pick<import('../clearableInput/ClearableInput').ClearableInputProps, "mask" | "pattern" | "format" | "parse" | "blocks"> | undefined;
|
|
31
31
|
};
|
|
32
32
|
export default useDayPickerInputState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { AutoTrackingAttributes } from '../../utils/analytics/autoTracking';
|
|
2
3
|
import { BaseDialogProps } from './Dialog';
|
|
3
4
|
export type ConfirmationDialogProps = BaseDialogProps & {
|
|
4
5
|
/**
|
|
@@ -21,10 +22,26 @@ export type ConfirmationDialogProps = BaseDialogProps & {
|
|
|
21
22
|
* The content of the cancel button. (Usually a text, can also be a FormattedMessage component).
|
|
22
23
|
*/
|
|
23
24
|
cancelButtonText?: string | React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Optional key used to generate automatic GA tracking attributes for the cancel button.
|
|
27
|
+
*/
|
|
28
|
+
cancelButtonAutoTrackingKey?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the cancel button.
|
|
31
|
+
*/
|
|
32
|
+
cancelButtonTrackingAttributes?: AutoTrackingAttributes;
|
|
24
33
|
/**
|
|
25
34
|
* The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.
|
|
26
35
|
*/
|
|
27
36
|
confirmButtonText?: string | React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Optional key used to generate automatic GA tracking attributes for the confirmation button.
|
|
39
|
+
*/
|
|
40
|
+
confirmButtonAutoTrackingKey?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the confirmation button.
|
|
43
|
+
*/
|
|
44
|
+
confirmButtonTrackingAttributes?: AutoTrackingAttributes;
|
|
28
45
|
/**
|
|
29
46
|
* When set to `true` the confirmation button will be disabled.
|
|
30
47
|
*/
|
|
@@ -1,27 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { noop as
|
|
1
|
+
import { jsxs as k, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { noop as n } from "es-toolkit/function";
|
|
3
3
|
import i from "../button/Button.js";
|
|
4
|
-
import
|
|
4
|
+
import B from "./Dialog.js";
|
|
5
5
|
const x = (r) => {
|
|
6
6
|
const {
|
|
7
|
-
content:
|
|
8
|
-
onClickCancel:
|
|
9
|
-
cancelButtonText:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
content: a,
|
|
8
|
+
onClickCancel: t = n,
|
|
9
|
+
cancelButtonText: c,
|
|
10
|
+
cancelButtonAutoTrackingKey: e,
|
|
11
|
+
cancelButtonTrackingAttributes: l,
|
|
12
|
+
onClickConfirm: s = n,
|
|
13
|
+
confirmButtonText: m,
|
|
14
|
+
confirmButtonAutoTrackingKey: u,
|
|
15
|
+
confirmButtonTrackingAttributes: f,
|
|
16
|
+
disableConfirm: C,
|
|
17
|
+
...d
|
|
18
|
+
} = r, g = /* @__PURE__ */ k("div", { className: "btn-toolbar", children: [
|
|
19
|
+
/* @__PURE__ */ o(
|
|
20
|
+
i,
|
|
21
|
+
{
|
|
22
|
+
className: "CancelButton",
|
|
23
|
+
onClick: t,
|
|
24
|
+
autoTrackingKey: e,
|
|
25
|
+
...l,
|
|
26
|
+
children: c
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ o(
|
|
30
|
+
i,
|
|
31
|
+
{
|
|
32
|
+
bsStyle: "primary",
|
|
33
|
+
className: "ConfirmationButton",
|
|
34
|
+
onClick: s,
|
|
35
|
+
disabled: C,
|
|
36
|
+
autoTrackingKey: u,
|
|
37
|
+
...f,
|
|
38
|
+
children: m
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
15
42
|
return /* @__PURE__ */ o(
|
|
16
|
-
|
|
43
|
+
B,
|
|
17
44
|
{
|
|
18
|
-
...
|
|
19
|
-
body:
|
|
20
|
-
footer:
|
|
21
|
-
|
|
22
|
-
/* @__PURE__ */ o(i, { bsStyle: "primary", className: "ConfirmationButton", onClick: l, disabled: c, children: s })
|
|
23
|
-
] }),
|
|
24
|
-
onClose: n,
|
|
45
|
+
...d,
|
|
46
|
+
body: a,
|
|
47
|
+
footer: g,
|
|
48
|
+
onClose: t,
|
|
25
49
|
showCloseButton: !1,
|
|
26
50
|
className: "confirmation-dialog",
|
|
27
51
|
disableEsc: !0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationDialog.js","sources":["../../../src/components/dialog/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport Dialog, { type BaseDialogProps } from './Dialog';\n\nexport type ConfirmationDialogProps = BaseDialogProps & {\n /**\n * The content of the dialog body itself\n */\n content?: string | React.ReactNode;\n\n /**\n * A callback fired when the confirmation button is clicked.\n *\n * @default () => {}\n */\n onClickConfirm?: VoidFunction;\n\n /**\n * A callback fired when the cancel button is clicked or the dialog is closed.\n *\n * @default () => {}\n */\n onClickCancel?: VoidFunction;\n\n /**\n * The content of the cancel button. (Usually a text, can also be a FormattedMessage component).\n */\n cancelButtonText?: string | React.ReactNode;\n\n /**\n * The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.\n */\n confirmButtonText?: string | React.ReactNode;\n\n /**\n * When set to `true` the confirmation button will be disabled.\n */\n disableConfirm?: boolean;\n};\n\nconst ConfirmationDialog = (props: ConfirmationDialogProps) => {\n const {\n content,\n onClickCancel = noop,\n cancelButtonText,\n onClickConfirm = noop,\n confirmButtonText,\n disableConfirm,\n ...remainingProps\n } = props;\n\n const footer = (\n <div className='btn-toolbar'>\n <Button
|
|
1
|
+
{"version":3,"file":"ConfirmationDialog.js","sources":["../../../src/components/dialog/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport type { AutoTrackingAttributes } from '../../utils/analytics/autoTracking';\nimport Dialog, { type BaseDialogProps } from './Dialog';\n\nexport type ConfirmationDialogProps = BaseDialogProps & {\n /**\n * The content of the dialog body itself\n */\n content?: string | React.ReactNode;\n\n /**\n * A callback fired when the confirmation button is clicked.\n *\n * @default () => {}\n */\n onClickConfirm?: VoidFunction;\n\n /**\n * A callback fired when the cancel button is clicked or the dialog is closed.\n *\n * @default () => {}\n */\n onClickCancel?: VoidFunction;\n\n /**\n * The content of the cancel button. (Usually a text, can also be a FormattedMessage component).\n */\n cancelButtonText?: string | React.ReactNode;\n\n /**\n * Optional key used to generate automatic GA tracking attributes for the cancel button.\n */\n cancelButtonAutoTrackingKey?: string;\n\n /**\n * Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the cancel button.\n */\n cancelButtonTrackingAttributes?: AutoTrackingAttributes;\n\n /**\n * The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.\n */\n confirmButtonText?: string | React.ReactNode;\n\n /**\n * Optional key used to generate automatic GA tracking attributes for the confirmation button.\n */\n confirmButtonAutoTrackingKey?: string;\n\n /**\n * Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the confirmation button.\n */\n confirmButtonTrackingAttributes?: AutoTrackingAttributes;\n\n /**\n * When set to `true` the confirmation button will be disabled.\n */\n disableConfirm?: boolean;\n};\n\nconst ConfirmationDialog = (props: ConfirmationDialogProps) => {\n const {\n content,\n onClickCancel = noop,\n cancelButtonText,\n cancelButtonAutoTrackingKey,\n cancelButtonTrackingAttributes,\n onClickConfirm = noop,\n confirmButtonText,\n confirmButtonAutoTrackingKey,\n confirmButtonTrackingAttributes,\n disableConfirm,\n ...remainingProps\n } = props;\n\n const footer = (\n <div className='btn-toolbar'>\n <Button\n className='CancelButton'\n onClick={onClickCancel}\n autoTrackingKey={cancelButtonAutoTrackingKey}\n {...cancelButtonTrackingAttributes}\n >\n {cancelButtonText}\n </Button>\n <Button\n bsStyle='primary'\n className='ConfirmationButton'\n onClick={onClickConfirm}\n disabled={disableConfirm}\n autoTrackingKey={confirmButtonAutoTrackingKey}\n {...confirmButtonTrackingAttributes}\n >\n {confirmButtonText}\n </Button>\n </div>\n );\n\n return (\n <Dialog\n {...remainingProps}\n body={content}\n footer={footer}\n onClose={onClickCancel}\n showCloseButton={false}\n className='confirmation-dialog'\n disableEsc\n />\n );\n};\n\nexport default ConfirmationDialog;\n"],"names":["ConfirmationDialog","props","content","onClickCancel","noop","cancelButtonText","cancelButtonAutoTrackingKey","cancelButtonTrackingAttributes","onClickConfirm","confirmButtonText","confirmButtonAutoTrackingKey","confirmButtonTrackingAttributes","disableConfirm","remainingProps","footer","jsxs","jsx","Button","Dialog"],"mappings":";;;;AA+DA,MAAMA,IAAqB,CAACC,MAAmC;AAC3D,QAAM;AAAA,IACF,SAAAC;AAAA,IACA,eAAAC,IAAgBC;AAAA,IAChB,kBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gCAAAC;AAAA,IACA,gBAAAC,IAAiBJ;AAAA,IACjB,mBAAAK;AAAA,IACA,8BAAAC;AAAA,IACA,iCAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHZ,GAEEa,IACF,gBAAAC,EAAC,OAAA,EAAI,WAAU,eACX,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,WAAU;AAAA,QACV,SAASd;AAAA,QACT,iBAAiBG;AAAA,QAChB,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEL,gBAAAW;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAAQ;AAAA,QACR,WAAU;AAAA,QACV,SAAST;AAAA,QACT,UAAUI;AAAA,QACV,iBAAiBF;AAAA,QAChB,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAGJ,SACI,gBAAAO;AAAA,IAACE;AAAA,IAAA;AAAA,MACI,GAAGL;AAAA,MACJ,MAAMX;AAAA,MACN,QAAAY;AAAA,MACA,SAASX;AAAA,MACT,iBAAiB;AAAA,MACjB,WAAU;AAAA,MACV,YAAU;AAAA,IAAA;AAAA,EAAA;AAGtB;"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { noop as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import v from "react";
|
|
3
|
+
import { noop as B } from "es-toolkit/function";
|
|
4
|
+
import x from "../button/Button.js";
|
|
5
|
+
import { getTrackingLabelFromNode as k } from "../../utils/analytics/getTrackingLabelFromNode.js";
|
|
6
|
+
import i from "../../utils/classNames.js";
|
|
7
|
+
import { useDialogContext as w } from "./dialogContext.js";
|
|
8
|
+
const H = (n) => {
|
|
9
|
+
const { title: t, subtitle: s, headerButtons: l, onCloseButtonClick: c = B, ...m } = n, { onClose: h, isSmallestDialog: a, showXsDialogBorders: u, showCloseButton: g } = w(), r = a ? u : !0, p = a ? !1 : g, b = i("modal-header", !r && "border-bottom-none"), C = i(
|
|
9
10
|
"modal-header-text",
|
|
10
11
|
!r && "padding-bottom-0 width-100pct"
|
|
11
|
-
),
|
|
12
|
-
|
|
12
|
+
), d = k(t), N = (f) => {
|
|
13
|
+
c(), h(f);
|
|
13
14
|
};
|
|
14
|
-
return /* @__PURE__ */ e("div", { ...
|
|
15
|
-
/* @__PURE__ */ e("div", { className:
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */ o("div", { className: "modal-header-title", children:
|
|
15
|
+
return /* @__PURE__ */ e("div", { ...m, className: b, "aria-label": "dialog header", children: [
|
|
16
|
+
/* @__PURE__ */ e("div", { className: C, children: [
|
|
17
|
+
s && /* @__PURE__ */ o("div", { className: "modal-header-subtitle", children: s }),
|
|
18
|
+
/* @__PURE__ */ o("div", { className: "modal-header-title", children: t })
|
|
18
19
|
] }),
|
|
19
20
|
/* @__PURE__ */ e("div", { className: "modal-header-buttons", children: [
|
|
20
|
-
l && !a && /* @__PURE__ */ e(
|
|
21
|
+
l && !a && /* @__PURE__ */ e(v.Fragment, { children: [
|
|
21
22
|
l,
|
|
22
23
|
/* @__PURE__ */ o("div", { className: "modal-header-buttons-spacer" })
|
|
23
24
|
] }),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
p && /* @__PURE__ */ o(
|
|
26
|
+
x,
|
|
26
27
|
{
|
|
27
28
|
bsStyle: "muted",
|
|
28
29
|
iconOnly: !0,
|
|
29
30
|
iconName: "rioglyph-remove",
|
|
30
|
-
autoTrackingKey: `dialog::closed::${
|
|
31
|
+
autoTrackingKey: d && `dialog::closed::${d}`,
|
|
31
32
|
className: "modal-header-close close",
|
|
32
|
-
onClick:
|
|
33
|
+
onClick: N,
|
|
33
34
|
"data-testid": "close",
|
|
34
35
|
"aria-label": "dialog close button"
|
|
35
36
|
}
|
|
@@ -38,6 +39,6 @@ const T = (i) => {
|
|
|
38
39
|
] });
|
|
39
40
|
};
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
H as default
|
|
42
43
|
};
|
|
43
44
|
//# sourceMappingURL=DialogHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogHeader.js","sources":["../../../src/components/dialog/DialogHeader.tsx"],"sourcesContent":["import React, { type ComponentProps } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport classNames from '../../utils/classNames';\nimport { useDialogContext } from './dialogContext';\n\nexport type DialogHeaderProps = Omit<ComponentProps<'div'>, 'title'> & {\n /**\n * The dialog title (can also be a FormattedMessage component).\n */\n title: string | React.ReactNode;\n\n /**\n * The dialog header subtitle content.\n */\n subtitle?: string | React.ReactNode;\n\n /**\n * Allows to add additional buttons to the dialog header.\n */\n headerButtons?: React.ReactNode;\n\n onCloseButtonClick?: () => void;\n};\n\nconst DialogHeader = (props: DialogHeaderProps) => {\n const { title, subtitle, headerButtons, onCloseButtonClick = noop, ...remainingProps } = props;\n\n const { onClose, isSmallestDialog, showXsDialogBorders, showCloseButton } = useDialogContext();\n\n const doShowXsDialogBorders = isSmallestDialog ? showXsDialogBorders : true;\n\n const doShowCloseButton = isSmallestDialog ? false : showCloseButton;\n\n const headerClasses = classNames('modal-header', !doShowXsDialogBorders && 'border-bottom-none');\n const headerTextClasses = classNames(\n 'modal-header-text',\n !doShowXsDialogBorders && 'padding-bottom-0 width-100pct'\n );\n\n const handleClose = (event: React.MouseEvent<HTMLButtonElement>) => {\n onCloseButtonClick();\n onClose(event);\n };\n\n return (\n <div {...remainingProps} className={headerClasses} aria-label='dialog header'>\n <div className={headerTextClasses}>\n {subtitle && <div className='modal-header-subtitle'>{subtitle}</div>}\n <div className='modal-header-title'>{title}</div>\n </div>\n <div className='modal-header-buttons'>\n {headerButtons && !isSmallestDialog && (\n <React.Fragment>\n {headerButtons}\n <div className='modal-header-buttons-spacer' />\n </React.Fragment>\n )}\n {doShowCloseButton && (\n <Button\n bsStyle='muted'\n iconOnly\n iconName='rioglyph-remove'\n autoTrackingKey={`dialog::closed::${
|
|
1
|
+
{"version":3,"file":"DialogHeader.js","sources":["../../../src/components/dialog/DialogHeader.tsx"],"sourcesContent":["import React, { type ComponentProps } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport { getTrackingLabelFromNode } from '../../utils/analytics/getTrackingLabelFromNode';\nimport classNames from '../../utils/classNames';\nimport { useDialogContext } from './dialogContext';\n\nexport type DialogHeaderProps = Omit<ComponentProps<'div'>, 'title'> & {\n /**\n * The dialog title (can also be a FormattedMessage component).\n */\n title: string | React.ReactNode;\n\n /**\n * The dialog header subtitle content.\n */\n subtitle?: string | React.ReactNode;\n\n /**\n * Allows to add additional buttons to the dialog header.\n */\n headerButtons?: React.ReactNode;\n\n onCloseButtonClick?: () => void;\n};\n\nconst DialogHeader = (props: DialogHeaderProps) => {\n const { title, subtitle, headerButtons, onCloseButtonClick = noop, ...remainingProps } = props;\n\n const { onClose, isSmallestDialog, showXsDialogBorders, showCloseButton } = useDialogContext();\n\n const doShowXsDialogBorders = isSmallestDialog ? showXsDialogBorders : true;\n\n const doShowCloseButton = isSmallestDialog ? false : showCloseButton;\n\n const headerClasses = classNames('modal-header', !doShowXsDialogBorders && 'border-bottom-none');\n const headerTextClasses = classNames(\n 'modal-header-text',\n !doShowXsDialogBorders && 'padding-bottom-0 width-100pct'\n );\n const titleTrackingValue = getTrackingLabelFromNode(title);\n\n const handleClose = (event: React.MouseEvent<HTMLButtonElement>) => {\n onCloseButtonClick();\n onClose(event);\n };\n\n return (\n <div {...remainingProps} className={headerClasses} aria-label='dialog header'>\n <div className={headerTextClasses}>\n {subtitle && <div className='modal-header-subtitle'>{subtitle}</div>}\n <div className='modal-header-title'>{title}</div>\n </div>\n <div className='modal-header-buttons'>\n {headerButtons && !isSmallestDialog && (\n <React.Fragment>\n {headerButtons}\n <div className='modal-header-buttons-spacer' />\n </React.Fragment>\n )}\n {doShowCloseButton && (\n <Button\n bsStyle='muted'\n iconOnly\n iconName='rioglyph-remove'\n autoTrackingKey={titleTrackingValue && `dialog::closed::${titleTrackingValue}`}\n className='modal-header-close close'\n onClick={handleClose}\n data-testid='close'\n aria-label='dialog close button'\n />\n )}\n </div>\n </div>\n );\n};\n\nexport default DialogHeader;\n"],"names":["DialogHeader","props","title","subtitle","headerButtons","onCloseButtonClick","noop","remainingProps","onClose","isSmallestDialog","showXsDialogBorders","showCloseButton","useDialogContext","doShowXsDialogBorders","doShowCloseButton","headerClasses","classNames","headerTextClasses","titleTrackingValue","getTrackingLabelFromNode","handleClose","event","jsxs","jsx","React","Button"],"mappings":";;;;;;;AA2BA,MAAMA,IAAe,CAACC,MAA6B;AAC/C,QAAM,EAAE,OAAAC,GAAO,UAAAC,GAAU,eAAAC,GAAe,oBAAAC,IAAqBC,GAAM,GAAGC,MAAmBN,GAEnF,EAAE,SAAAO,GAAS,kBAAAC,GAAkB,qBAAAC,GAAqB,iBAAAC,EAAA,IAAoBC,EAAA,GAEtEC,IAAwBJ,IAAmBC,IAAsB,IAEjEI,IAAoBL,IAAmB,KAAQE,GAE/CI,IAAgBC,EAAW,gBAAgB,CAACH,KAAyB,oBAAoB,GACzFI,IAAoBD;AAAA,IACtB;AAAA,IACA,CAACH,KAAyB;AAAA,EAAA,GAExBK,IAAqBC,EAAyBjB,CAAK,GAEnDkB,IAAc,CAACC,MAA+C;AAChE,IAAAhB,EAAA,GACAG,EAAQa,CAAK;AAAA,EACjB;AAEA,2BACK,OAAA,EAAK,GAAGd,GAAgB,WAAWQ,GAAe,cAAW,iBAC1D,UAAA;AAAA,IAAA,gBAAAO,EAAC,OAAA,EAAI,WAAWL,GACX,UAAA;AAAA,MAAAd,KAAY,gBAAAoB,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAApB,GAAS;AAAA,MAC9D,gBAAAoB,EAAC,OAAA,EAAI,WAAU,sBAAsB,UAAArB,EAAA,CAAM;AAAA,IAAA,GAC/C;AAAA,IACA,gBAAAoB,EAAC,OAAA,EAAI,WAAU,wBACV,UAAA;AAAA,MAAAlB,KAAiB,CAACK,KACf,gBAAAa,EAACE,EAAM,UAAN,EACI,UAAA;AAAA,QAAApB;AAAA,QACD,gBAAAmB,EAAC,OAAA,EAAI,WAAU,8BAAA,CAA8B;AAAA,MAAA,GACjD;AAAA,MAEHT,KACG,gBAAAS;AAAA,QAACE;AAAA,QAAA;AAAA,UACG,SAAQ;AAAA,UACR,UAAQ;AAAA,UACR,UAAS;AAAA,UACT,iBAAiBP,KAAsB,mBAAmBA,CAAkB;AAAA,UAC5E,WAAU;AAAA,UACV,SAASE;AAAA,UACT,eAAY;AAAA,UACZ,cAAW;AAAA,QAAA;AAAA,MAAA;AAAA,IACf,EAAA,CAER;AAAA,EAAA,GACJ;AAER;"}
|
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { DropdownToggleEvent, DropdownToggleButtonType } from './DropdownToggleButton';
|
|
3
3
|
import { MenuItemProps as MenuItem } from '../menuItems/MenuItem';
|
|
4
4
|
import { BUTTON_SIZE, BUTTON_STYLE, BUTTON_VARIANT } from '../button/Button';
|
|
5
|
+
import { TrackingAttributes } from '../../utils/analytics/googleAnalyticsUtils';
|
|
5
6
|
export type ButtonDropdownProps<T extends DropdownToggleButtonType = 'button'> = {
|
|
6
7
|
/**
|
|
7
8
|
* Unique button id. If not present a random id is generated.
|
|
@@ -128,6 +129,10 @@ export type ButtonDropdownProps<T extends DropdownToggleButtonType = 'button'> =
|
|
|
128
129
|
* Additional classes to be set on the dropdown-toggle button.
|
|
129
130
|
*/
|
|
130
131
|
toggleClassName?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Optional tracking attributes added to the dropdown toggle button.
|
|
134
|
+
*/
|
|
135
|
+
trackingAttributes?: TrackingAttributes;
|
|
131
136
|
/**
|
|
132
137
|
* Additional classes to be set on the dropdown.
|
|
133
138
|
*/
|