@cloudscape-design/components-themeable 3.0.1127 → 3.0.1129
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/input/styles.scss +62 -9
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +99 -87
- package/lib/internal/scss/internal/styles/forms/mixins.scss +42 -19
- package/lib/internal/template/alert/styles.css.js +27 -27
- package/lib/internal/template/alert/styles.scoped.css +50 -50
- package/lib/internal/template/alert/styles.selectors.js +27 -27
- package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +32 -32
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
- package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
- package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
- package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js +5 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +27 -27
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +84 -84
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +27 -27
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.js +3 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/skeleton-parts.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/skeleton-parts.js +4 -5
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/skeleton-parts.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/slots.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/slots.js +8 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/slots.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +27 -27
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +54 -54
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +27 -27
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.d.ts +20 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.d.ts.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.js +19 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.js.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.js +0 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +7 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/lib/internal/template/attribute-editor/styles.css.js +15 -15
- package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
- package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
- package/lib/internal/template/autosuggest/index.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/index.js +3 -2
- package/lib/internal/template/autosuggest/index.js.map +1 -1
- package/lib/internal/template/autosuggest/interfaces.d.ts +4 -0
- package/lib/internal/template/autosuggest/interfaces.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/interfaces.js.map +1 -1
- package/lib/internal/template/autosuggest/internal.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/internal.js +3 -3
- package/lib/internal/template/autosuggest/internal.js.map +1 -1
- package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
- package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
- package/lib/internal/template/button/styles.css.js +22 -22
- package/lib/internal/template/button/styles.scoped.css +256 -256
- package/lib/internal/template/button/styles.selectors.js +22 -22
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +16 -16
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +27 -27
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +16 -16
- package/lib/internal/template/button-group/icon-toggle-button-item.d.ts +2 -2
- package/lib/internal/template/button-group/icon-toggle-button-item.d.ts.map +1 -1
- package/lib/internal/template/button-group/icon-toggle-button-item.js +1 -1
- package/lib/internal/template/button-group/icon-toggle-button-item.js.map +1 -1
- package/lib/internal/template/button-group/interfaces.d.ts +4 -1
- package/lib/internal/template/button-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-group/interfaces.js.map +1 -1
- package/lib/internal/template/checkbox/styles.css.js +3 -3
- package/lib/internal/template/checkbox/styles.scoped.css +11 -11
- package/lib/internal/template/checkbox/styles.selectors.js +3 -3
- package/lib/internal/template/content-layout/styles.css.js +14 -14
- package/lib/internal/template/content-layout/styles.scoped.css +27 -27
- package/lib/internal/template/content-layout/styles.selectors.js +14 -14
- package/lib/internal/template/copy-to-clipboard/internal.d.ts.map +1 -1
- package/lib/internal/template/copy-to-clipboard/internal.js +18 -5
- package/lib/internal/template/copy-to-clipboard/internal.js.map +1 -1
- package/lib/internal/template/date-range-picker/dropdown.d.ts +2 -1
- package/lib/internal/template/date-range-picker/dropdown.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/dropdown.js +2 -2
- package/lib/internal/template/date-range-picker/dropdown.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +2 -2
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.d.ts +6 -0
- package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
- package/lib/internal/template/date-range-picker/relative-range/index.d.ts +2 -1
- package/lib/internal/template/date-range-picker/relative-range/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/relative-range/index.js +4 -1
- package/lib/internal/template/date-range-picker/relative-range/index.js.map +1 -1
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +187 -187
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/help-panel/styles.css.js +6 -6
- package/lib/internal/template/help-panel/styles.scoped.css +73 -73
- package/lib/internal/template/help-panel/styles.selectors.js +6 -6
- package/lib/internal/template/input/index.d.ts.map +1 -1
- package/lib/internal/template/input/index.js +3 -2
- package/lib/internal/template/input/index.js.map +1 -1
- package/lib/internal/template/input/interfaces.d.ts +48 -0
- package/lib/internal/template/input/interfaces.d.ts.map +1 -1
- package/lib/internal/template/input/interfaces.js.map +1 -1
- package/lib/internal/template/input/internal.d.ts.map +1 -1
- package/lib/internal/template/input/internal.js +3 -2
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/input/styles.css.js +13 -13
- package/lib/internal/template/input/styles.d.ts +3 -0
- package/lib/internal/template/input/styles.d.ts.map +1 -0
- package/lib/internal/template/input/styles.js +42 -0
- package/lib/internal/template/input/styles.js.map +1 -0
- package/lib/internal/template/input/styles.scoped.css +66 -49
- package/lib/internal/template/input/styles.selectors.js +13 -13
- package/lib/internal/template/internal/analytics/components/analytics-funnel.d.ts +1 -0
- package/lib/internal/template/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/components/analytics-funnel.js +5 -2
- package/lib/internal/template/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/lib/internal/template/internal/analytics/interfaces.d.ts +1 -0
- package/lib/internal/template/internal/analytics/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +20 -20
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +48 -48
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +38 -38
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +12 -0
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/lib/internal/template/internal/generated/custom-css-properties/index.js +98 -86
- package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +0 -4
- package/lib/internal/template/internal/generated/styles/tokens.js +0 -4
- package/lib/internal/template/internal/generated/theming/index.cjs +0 -84
- package/lib/internal/template/internal/generated/theming/index.js +0 -84
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +103 -103
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/package.json +2 -0
- package/lib/internal/template/popover/container.d.ts.map +1 -1
- package/lib/internal/template/popover/container.js +2 -5
- package/lib/internal/template/popover/container.js.map +1 -1
- package/lib/internal/template/popover/use-position-observer.d.ts +1 -2
- package/lib/internal/template/popover/use-position-observer.d.ts.map +1 -1
- package/lib/internal/template/popover/use-position-observer.js +10 -8
- package/lib/internal/template/popover/use-position-observer.js.map +1 -1
- package/lib/internal/template/radio-group/styles.css.js +10 -10
- package/lib/internal/template/radio-group/styles.scoped.css +22 -22
- package/lib/internal/template/radio-group/styles.selectors.js +10 -10
- package/lib/internal/template/select/parts/filter.d.ts +1 -1
- package/lib/internal/template/select/parts/filter.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/interfaces.d.ts +4 -0
- package/lib/internal/template/side-navigation/interfaces.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/interfaces.js.map +1 -1
- package/lib/internal/template/side-navigation/parts.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/parts.js +4 -1
- package/lib/internal/template/side-navigation/parts.js.map +1 -1
- package/lib/internal/template/slider/styles.css.js +26 -26
- package/lib/internal/template/slider/styles.scoped.css +86 -86
- package/lib/internal/template/slider/styles.selectors.js +26 -26
- package/lib/internal/template/spinner/styles.css.js +13 -13
- package/lib/internal/template/spinner/styles.scoped.css +39 -39
- package/lib/internal/template/spinner/styles.selectors.js +13 -13
- package/lib/internal/template/tag-editor/styles.css.js +3 -3
- package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
- package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
- package/lib/internal/template/test-utils/dom/multiselect/index.d.ts +8 -0
- package/lib/internal/template/test-utils/dom/multiselect/index.js +18 -4
- package/lib/internal/template/test-utils/dom/multiselect/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/multiselect/index.d.ts +8 -0
- package/lib/internal/template/test-utils/selectors/multiselect/index.js +18 -4
- package/lib/internal/template/test-utils/selectors/multiselect/index.js.map +1 -1
- package/lib/internal/template/text-content/styles.css.js +1 -1
- package/lib/internal/template/text-content/styles.scoped.css +66 -66
- package/lib/internal/template/text-content/styles.selectors.js +1 -1
- package/lib/internal/template/toggle/styles.css.js +10 -10
- package/lib/internal/template/toggle/styles.scoped.css +23 -23
- package/lib/internal/template/toggle/styles.selectors.js +10 -10
- package/lib/internal/template/toggle-button/internal.d.ts +1 -0
- package/lib/internal/template/toggle-button/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle-button/internal.js +2 -2
- package/lib/internal/template/toggle-button/internal.js.map +1 -1
- package/lib/internal/template/wizard/index.d.ts.map +1 -1
- package/lib/internal/template/wizard/index.js +2 -1
- package/lib/internal/template/wizard/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';\nimport { TimeInputProps } from '../time-input/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * Provides a reason why a particular date in the calendar is not enabled (only when `isDateEnabled` returns `false`).\n * If provided, the date becomes focusable.\n * @param date\n */\n dateDisabledReason?: DateRangePickerProps.DateDisabledReasonFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * This does not apply when the 'granularity' is set to 'month'\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the date format to use on the date inputs in the absolute dropdown.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n dateInputFormat?: DateRangePickerProps.DateInputFormat;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true or `granularity` is set to 'month'.\n */\n timeInputFormat?: DateRangePickerProps.TimeInputFormat;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps,\n Pick<CalendarProps, 'granularity'> {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies which time units to allow in the custom relative range control.\n */\n customRelativeRangeUnits?: DateRangePickerProps.TimeUnit[];\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface DateDisabledReasonFunction {\n (date: Date): string;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n * @i18n\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n * @i18n\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n * @i18n\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Description for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionMonthlyDescription?: string;\n\n /**\n * Visible label of the Cancel button\n * @i18n\n */\n cancelButtonLabel?: string;\n\n /**\n * Visible label of the Clear and dismiss button\n * @i18n\n */\n clearButtonLabel?: string;\n\n /**\n * Visible label of the Apply button\n * @i18n\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n * @i18n\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n * @i18n\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationLabel?: string;\n\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationPlaceholder?: string;\n\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n * @i18n\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Visible label for the Start Month input for the\n * absolute range.\n * @i18n\n */\n startMonthLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n * @i18n\n */\n startDateLabel?: string;\n\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n * @i18n\n */\n startTimeLabel?: string;\n\n /**\n * Visible label for the End Month input for the\n * absolute range.\n * @i18n\n */\n endMonthLabel?: string;\n\n /**\n * Visible label for the End Date input for the\n * absolute range.\n * @i18n\n */\n endDateLabel?: string;\n\n /**\n * Visible label for the End Time input for the absolute range.\n * This serves as a fallback if no format specific date constraint test is provided\n *\n * @i18n\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the date input field for the\n * absolute range with no time option.\n * @i18n\n */\n dateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'slashed' format with no time option.\n * @i18n\n */\n slashedDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'iso' format with no time option.\n * @i18n\n */\n isoDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range.\n * This serves as a fallback if no format specific datetime constraint test is provided\n *\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'iso' format with.\n * @i18n\n */\n isoDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range.\n * This serves as a fallback if no format specific month constraint test is provided.\n *\n * @i18n\n */\n monthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedMonthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'iso' format.\n * @i18n\n */\n isoMonthConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n * @i18n\n */\n todayAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n * @i18n\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n * @i18n\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Used as part of the `aria-label` for the current month in the calendar.\n * @i18n\n */\n currentMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next year' button.\n * @i18n\n */\n nextYearAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous year' button.\n * @i18n\n */\n previousYearAriaLabel?: string;\n }\n\n export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';\nimport { TimeInputProps } from '../time-input/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * Provides a reason why a particular date in the calendar is not enabled (only when `isDateEnabled` returns `false`).\n * If provided, the date becomes focusable.\n * @param date\n */\n dateDisabledReason?: DateRangePickerProps.DateDisabledReasonFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * This does not apply when the 'granularity' is set to 'month'\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the date format to use on the date inputs in the absolute dropdown.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n dateInputFormat?: DateRangePickerProps.DateInputFormat;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true or `granularity` is set to 'month'.\n */\n timeInputFormat?: DateRangePickerProps.TimeInputFormat;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps,\n Pick<CalendarProps, 'granularity'> {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies which time units to allow in the custom relative range control.\n */\n customRelativeRangeUnits?: DateRangePickerProps.TimeUnit[];\n\n /**\n * Specifies custom content to fully override the relative range tab.\n * When provided, all default relative range functionality is replaced.\n */\n renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface DateDisabledReasonFunction {\n (date: Date): string;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RelativeRangeControl = (\n selectedRange: RelativeValue | null,\n setSelectedRange: (value: RelativeValue) => void\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n * @i18n\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n * @i18n\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n * @i18n\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Description for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionMonthlyDescription?: string;\n\n /**\n * Visible label of the Cancel button\n * @i18n\n */\n cancelButtonLabel?: string;\n\n /**\n * Visible label of the Clear and dismiss button\n * @i18n\n */\n clearButtonLabel?: string;\n\n /**\n * Visible label of the Apply button\n * @i18n\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n * @i18n\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n * @i18n\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationLabel?: string;\n\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationPlaceholder?: string;\n\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n * @i18n\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Visible label for the Start Month input for the\n * absolute range.\n * @i18n\n */\n startMonthLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n * @i18n\n */\n startDateLabel?: string;\n\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n * @i18n\n */\n startTimeLabel?: string;\n\n /**\n * Visible label for the End Month input for the\n * absolute range.\n * @i18n\n */\n endMonthLabel?: string;\n\n /**\n * Visible label for the End Date input for the\n * absolute range.\n * @i18n\n */\n endDateLabel?: string;\n\n /**\n * Visible label for the End Time input for the absolute range.\n * This serves as a fallback if no format specific date constraint test is provided\n *\n * @i18n\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the date input field for the\n * absolute range with no time option.\n * @i18n\n */\n dateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'slashed' format with no time option.\n * @i18n\n */\n slashedDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'iso' format with no time option.\n * @i18n\n */\n isoDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range.\n * This serves as a fallback if no format specific datetime constraint test is provided\n *\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'iso' format with.\n * @i18n\n */\n isoDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range.\n * This serves as a fallback if no format specific month constraint test is provided.\n *\n * @i18n\n */\n monthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedMonthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'iso' format.\n * @i18n\n */\n isoMonthConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n * @i18n\n */\n todayAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n * @i18n\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n * @i18n\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Used as part of the `aria-label` for the current month in the calendar.\n * @i18n\n */\n currentMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next year' button.\n * @i18n\n */\n nextYearAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous year' button.\n * @i18n\n */\n previousYearAriaLabel?: string;\n }\n\n export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n"]}
|
|
@@ -9,7 +9,8 @@ interface RelativeRangePickerProps extends Pick<CalendarProps, 'granularity'> {
|
|
|
9
9
|
i18nStrings?: DateRangePickerProps.I18nStrings;
|
|
10
10
|
isSingleGrid: boolean;
|
|
11
11
|
customUnits?: DateRangePickerProps.TimeUnit[];
|
|
12
|
+
renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;
|
|
12
13
|
}
|
|
13
|
-
export default function RelativeRangePicker({ dateOnly, options: clientOptions, initialSelection: initialRange, onChange: onChangeRangeSize, i18nStrings, isSingleGrid, customUnits, granularity, }: RelativeRangePickerProps): JSX.Element;
|
|
14
|
+
export default function RelativeRangePicker({ dateOnly, options: clientOptions, initialSelection: initialRange, onChange: onChangeRangeSize, i18nStrings, isSingleGrid, customUnits, granularity, renderRelativeRangeContent, }: RelativeRangePickerProps): JSX.Element;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/relative-range/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAQ1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAKrD,UAAU,wBAAyB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAC5D,gBAAgB,EAAE,oBAAoB,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5D,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,aAAa,KAAK,IAAI,CAAC;IAC9D,WAAW,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC/C,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/relative-range/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAQ1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAKrD,UAAU,wBAAyB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAC5D,gBAAgB,EAAE,oBAAoB,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5D,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,aAAa,KAAK,IAAI,CAAC;IAC9D,WAAW,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC/C,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;IAC9C,0BAA0B,CAAC,EAAE,oBAAoB,CAAC,oBAAoB,CAAC;CACxE;AAaD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,QAAQ,EACR,OAAO,EAAE,aAAkB,EAC3B,gBAAgB,EAAE,YAAY,EAC9B,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAmB,EACnB,0BAA0B,GAC3B,EAAE,wBAAwB,eAgM1B"}
|
|
@@ -16,7 +16,7 @@ const monthUnits = ['month', 'year'];
|
|
|
16
16
|
const dayUnits = ['day', 'week', ...monthUnits];
|
|
17
17
|
const units = ['second', 'minute', 'hour', ...dayUnits];
|
|
18
18
|
const CUSTOM_OPTION_SELECT_KEY = 'awsui-internal-custom-duration-key';
|
|
19
|
-
export default function RelativeRangePicker({ dateOnly, options: clientOptions = [], initialSelection: initialRange, onChange: onChangeRangeSize, i18nStrings, isSingleGrid, customUnits, granularity = 'day', }) {
|
|
19
|
+
export default function RelativeRangePicker({ dateOnly, options: clientOptions = [], initialSelection: initialRange, onChange: onChangeRangeSize, i18nStrings, isSingleGrid, customUnits, granularity = 'day', renderRelativeRangeContent, }) {
|
|
20
20
|
var _a;
|
|
21
21
|
const i18n = useInternalI18n('date-range-picker');
|
|
22
22
|
const formatRelativeRange = i18n('i18nStrings.formatRelativeRange', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatRelativeRange, format => ({ amount, unit }) => format({ amount, unit }));
|
|
@@ -59,6 +59,9 @@ export default function RelativeRangePicker({ dateOnly, options: clientOptions =
|
|
|
59
59
|
initialCustomTimeUnit = finalUnits[0];
|
|
60
60
|
}
|
|
61
61
|
const [customUnitOfTime, setCustomUnitOfTime] = useState((_a = initialRange === null || initialRange === void 0 ? void 0 : initialRange.unit) !== null && _a !== void 0 ? _a : initialCustomTimeUnit);
|
|
62
|
+
if (renderRelativeRangeContent) {
|
|
63
|
+
return React.createElement(React.Fragment, null, renderRelativeRangeContent(initialRange, onChangeRangeSize));
|
|
64
|
+
}
|
|
62
65
|
const showRadioControl = clientOptions.length > 0;
|
|
63
66
|
const showCustomControls = clientOptions.length === 0 || selectedRadio === CUSTOM_OPTION_SELECT_KEY;
|
|
64
67
|
return (React.createElement("div", null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/relative-range/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAGhE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAiBrC,MAAM,UAAU,GAAiD,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACnF,MAAM,QAAQ,GAAiD,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC;AAC9F,MAAM,KAAK,GAAiD,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEtG,MAAM,wBAAwB,GAAG,oCAAoC,CA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CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../../box/internal';\nimport { CalendarProps } from '../../calendar/interfaces';\nimport InternalFormField from '../../form-field/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport InternalInput from '../../input/internal';\nimport { RadioGroupProps } from '../../radio-group/interfaces';\nimport InternalRadioGroup from '../../radio-group/internal';\nimport InternalSelect from '../../select/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport { DateRangePickerProps } from '../interfaces';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface RelativeRangePickerProps extends Pick<CalendarProps, 'granularity'> {\n dateOnly: boolean;\n options: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n initialSelection: DateRangePickerProps.RelativeValue | null;\n onChange: (range: DateRangePickerProps.RelativeValue) => void;\n i18nStrings?: DateRangePickerProps.I18nStrings;\n isSingleGrid: boolean;\n customUnits?: DateRangePickerProps.TimeUnit[];\n}\n\ninterface UnitSelectOption {\n value: DateRangePickerProps.TimeUnit;\n label: string;\n}\n\nconst monthUnits: ReadonlyArray<DateRangePickerProps.TimeUnit> = ['month', 'year'];\nconst dayUnits: ReadonlyArray<DateRangePickerProps.TimeUnit> = ['day', 'week', ...monthUnits];\nconst units: ReadonlyArray<DateRangePickerProps.TimeUnit> = ['second', 'minute', 'hour', ...dayUnits];\n\nconst CUSTOM_OPTION_SELECT_KEY = 'awsui-internal-custom-duration-key';\n\nexport default function RelativeRangePicker({\n dateOnly,\n options: clientOptions = [],\n initialSelection: initialRange,\n onChange: onChangeRangeSize,\n i18nStrings,\n isSingleGrid,\n customUnits,\n granularity = 'day',\n}: RelativeRangePickerProps) {\n const i18n = useInternalI18n('date-range-picker');\n const formatRelativeRange = i18n(\n 'i18nStrings.formatRelativeRange',\n i18nStrings?.formatRelativeRange,\n format =>\n ({ amount, unit }) =>\n format({ amount, unit })\n );\n const formatUnit = i18n(\n 'i18nStrings.formatUnit',\n i18nStrings?.formatUnit,\n format => (unit, amount) => format({ amount, unit })\n );\n\n const radioOptions: RadioGroupProps.RadioButtonDefinition[] = clientOptions.map(option => ({\n value: option.key,\n label: formatRelativeRange?.(option),\n }));\n radioOptions.push({\n value: CUSTOM_OPTION_SELECT_KEY,\n label: i18n('i18nStrings.customRelativeRangeOptionLabel', i18nStrings?.customRelativeRangeOptionLabel),\n description: i18n(\n 'i18nStrings.customRelativeRangeOptionDescription',\n i18nStrings?.customRelativeRangeOptionDescription\n ),\n });\n\n const [selectedRadio, setSelectedRadio] = useState(() => {\n if (initialRange && !initialRange.key) {\n return CUSTOM_OPTION_SELECT_KEY;\n }\n return initialRange?.key ?? null;\n });\n\n const [customDuration, setCustomDuration] = useState(() => {\n if (initialRange) {\n return initialRange.amount;\n }\n // NaN represents an empty duration\n return NaN;\n });\n\n let finalUnits = granularity === 'month' ? monthUnits : dateOnly ? dayUnits : units;\n if (customUnits) {\n finalUnits = customUnits.filter(unit => {\n if (units.includes(unit)) {\n return true;\n }\n warnOnce(\n 'DateRangePicker',\n `Invalid unit found in customRelativeRangeUnits: ${unit}. This entry will be ignored.`\n );\n return false;\n });\n }\n\n let initialCustomTimeUnit: DateRangePickerProps.TimeUnit =\n granularity === 'month' ? 'month' : dateOnly ? 'day' : 'minute';\n if (!finalUnits.includes(initialCustomTimeUnit)) {\n initialCustomTimeUnit = finalUnits[0];\n }\n const [customUnitOfTime, setCustomUnitOfTime] = useState<DateRangePickerProps.TimeUnit>(\n initialRange?.unit ?? initialCustomTimeUnit\n );\n\n const showRadioControl = clientOptions.length > 0;\n const showCustomControls = clientOptions.length === 0 || selectedRadio === CUSTOM_OPTION_SELECT_KEY;\n\n return (\n <div>\n <InternalSpaceBetween size=\"xs\" direction=\"vertical\">\n {showRadioControl && (\n <InternalFormField\n {...{\n label: i18n('i18nStrings.relativeRangeSelectionHeading', i18nStrings?.relativeRangeSelectionHeading),\n description:\n granularity === 'month' &&\n i18n(\n 'i18nStrings.relativeRangeSelectionMonthlyDescription',\n i18nStrings?.relativeRangeSelectionMonthlyDescription\n ),\n }}\n >\n <InternalRadioGroup\n className={testutilStyles['relative-range-radio-group']}\n onChange={({ detail }) => {\n setSelectedRadio(detail.value);\n\n if (detail.value === CUSTOM_OPTION_SELECT_KEY) {\n setCustomDuration(NaN);\n setCustomUnitOfTime(initialCustomTimeUnit);\n onChangeRangeSize({\n amount: NaN,\n unit: initialCustomTimeUnit,\n type: 'relative',\n });\n } else {\n const option = clientOptions.filter(o => o.key === detail.value)[0];\n onChangeRangeSize(option);\n }\n }}\n value={selectedRadio}\n items={radioOptions}\n />\n </InternalFormField>\n )}\n\n {showCustomControls && (\n <InternalSpaceBetween direction=\"vertical\" size=\"xs\">\n {!showRadioControl && (\n <InternalBox fontSize=\"body-m\" color=\"text-body-secondary\">\n {i18n(\n 'i18nStrings.customRelativeRangeOptionDescription',\n i18nStrings?.customRelativeRangeOptionDescription\n )}\n </InternalBox>\n )}\n\n <div\n className={clsx(styles['custom-range'], {\n [styles['custom-range--no-padding']]: !showRadioControl,\n })}\n >\n <div\n className={clsx(styles['custom-range-form-controls'], {\n [styles.vertical]: isSingleGrid,\n })}\n >\n <div className={styles['custom-range-duration']}>\n <InternalFormField\n label={i18n(\n 'i18nStrings.customRelativeRangeDurationLabel',\n i18nStrings?.customRelativeRangeDurationLabel\n )}\n >\n <InternalInput\n type=\"number\"\n className={testutilStyles['custom-range-duration-input']}\n value={isNaN(customDuration) || customDuration === 0 ? '' : customDuration?.toString()}\n onChange={e => {\n const amount = Number(e.detail.value);\n\n setCustomDuration(amount);\n onChangeRangeSize({ amount, unit: customUnitOfTime, type: 'relative' });\n }}\n placeholder={i18n(\n 'i18nStrings.customRelativeRangeDurationPlaceholder',\n i18nStrings?.customRelativeRangeDurationPlaceholder\n )}\n __inheritFormFieldProps={true}\n />\n </InternalFormField>\n </div>\n\n <div className={styles['custom-range-unit']}>\n <InternalFormField\n label={i18n('i18nStrings.customRelativeRangeUnitLabel', i18nStrings?.customRelativeRangeUnitLabel)}\n >\n <InternalSelect\n className={testutilStyles['custom-range-unit-select']}\n selectedOption={\n {\n value: customUnitOfTime,\n label: formatUnit?.(customUnitOfTime, customDuration),\n } as UnitSelectOption\n }\n onChange={e => {\n const { value: unit } = e.detail.selectedOption as UnitSelectOption;\n\n setCustomUnitOfTime(unit);\n onChangeRangeSize({ amount: customDuration, unit, type: 'relative' });\n }}\n options={finalUnits.map(unit => ({\n value: unit,\n label: formatUnit?.(unit, customDuration),\n }))}\n renderHighlightedAriaLive={option => option.label || option.value || ''}\n />\n </InternalFormField>\n </div>\n </div>\n </div>\n </InternalSpaceBetween>\n )}\n </InternalSpaceBetween>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/relative-range/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAGhE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAkBrC,MAAM,UAAU,G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,UAAU,EAAE,CAAC,CAAC;oCACxE,CAAC,EACD,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wCAC/B,KAAK,EAAE,IAAI;wCACX,KAAK,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,IAAI,EAAE,cAAc,CAAC;qCAC1C,CAAC,CAAC,EACH,yBAAyB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,EAAE,GACvE,CACgB,CAChB,CACF,CACF,CACe,CACxB,CACoB,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../../box/internal';\nimport { CalendarProps } from '../../calendar/interfaces';\nimport InternalFormField from '../../form-field/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport InternalInput from '../../input/internal';\nimport { RadioGroupProps } from '../../radio-group/interfaces';\nimport InternalRadioGroup from '../../radio-group/internal';\nimport InternalSelect from '../../select/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport { DateRangePickerProps } from '../interfaces';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface RelativeRangePickerProps extends Pick<CalendarProps, 'granularity'> {\n dateOnly: boolean;\n options: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n initialSelection: DateRangePickerProps.RelativeValue | null;\n onChange: (range: DateRangePickerProps.RelativeValue) => void;\n i18nStrings?: DateRangePickerProps.I18nStrings;\n isSingleGrid: boolean;\n customUnits?: DateRangePickerProps.TimeUnit[];\n renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;\n}\n\ninterface UnitSelectOption {\n value: DateRangePickerProps.TimeUnit;\n label: string;\n}\n\nconst monthUnits: ReadonlyArray<DateRangePickerProps.TimeUnit> = ['month', 'year'];\nconst dayUnits: ReadonlyArray<DateRangePickerProps.TimeUnit> = ['day', 'week', ...monthUnits];\nconst units: ReadonlyArray<DateRangePickerProps.TimeUnit> = ['second', 'minute', 'hour', ...dayUnits];\n\nconst CUSTOM_OPTION_SELECT_KEY = 'awsui-internal-custom-duration-key';\n\nexport default function RelativeRangePicker({\n dateOnly,\n options: clientOptions = [],\n initialSelection: initialRange,\n onChange: onChangeRangeSize,\n i18nStrings,\n isSingleGrid,\n customUnits,\n granularity = 'day',\n renderRelativeRangeContent,\n}: RelativeRangePickerProps) {\n const i18n = useInternalI18n('date-range-picker');\n const formatRelativeRange = i18n(\n 'i18nStrings.formatRelativeRange',\n i18nStrings?.formatRelativeRange,\n format =>\n ({ amount, unit }) =>\n format({ amount, unit })\n );\n const formatUnit = i18n(\n 'i18nStrings.formatUnit',\n i18nStrings?.formatUnit,\n format => (unit, amount) => format({ amount, unit })\n );\n\n const radioOptions: RadioGroupProps.RadioButtonDefinition[] = clientOptions.map(option => ({\n value: option.key,\n label: formatRelativeRange?.(option),\n }));\n radioOptions.push({\n value: CUSTOM_OPTION_SELECT_KEY,\n label: i18n('i18nStrings.customRelativeRangeOptionLabel', i18nStrings?.customRelativeRangeOptionLabel),\n description: i18n(\n 'i18nStrings.customRelativeRangeOptionDescription',\n i18nStrings?.customRelativeRangeOptionDescription\n ),\n });\n\n const [selectedRadio, setSelectedRadio] = useState(() => {\n if (initialRange && !initialRange.key) {\n return CUSTOM_OPTION_SELECT_KEY;\n }\n return initialRange?.key ?? null;\n });\n\n const [customDuration, setCustomDuration] = useState(() => {\n if (initialRange) {\n return initialRange.amount;\n }\n // NaN represents an empty duration\n return NaN;\n });\n\n let finalUnits = granularity === 'month' ? monthUnits : dateOnly ? dayUnits : units;\n if (customUnits) {\n finalUnits = customUnits.filter(unit => {\n if (units.includes(unit)) {\n return true;\n }\n warnOnce(\n 'DateRangePicker',\n `Invalid unit found in customRelativeRangeUnits: ${unit}. This entry will be ignored.`\n );\n return false;\n });\n }\n\n let initialCustomTimeUnit: DateRangePickerProps.TimeUnit =\n granularity === 'month' ? 'month' : dateOnly ? 'day' : 'minute';\n if (!finalUnits.includes(initialCustomTimeUnit)) {\n initialCustomTimeUnit = finalUnits[0];\n }\n const [customUnitOfTime, setCustomUnitOfTime] = useState<DateRangePickerProps.TimeUnit>(\n initialRange?.unit ?? initialCustomTimeUnit\n );\n\n if (renderRelativeRangeContent) {\n return <>{renderRelativeRangeContent(initialRange, onChangeRangeSize)}</>;\n }\n\n const showRadioControl = clientOptions.length > 0;\n const showCustomControls = clientOptions.length === 0 || selectedRadio === CUSTOM_OPTION_SELECT_KEY;\n\n return (\n <div>\n <InternalSpaceBetween size=\"xs\" direction=\"vertical\">\n {showRadioControl && (\n <InternalFormField\n {...{\n label: i18n('i18nStrings.relativeRangeSelectionHeading', i18nStrings?.relativeRangeSelectionHeading),\n description:\n granularity === 'month' &&\n i18n(\n 'i18nStrings.relativeRangeSelectionMonthlyDescription',\n i18nStrings?.relativeRangeSelectionMonthlyDescription\n ),\n }}\n >\n <InternalRadioGroup\n className={testutilStyles['relative-range-radio-group']}\n onChange={({ detail }) => {\n setSelectedRadio(detail.value);\n\n if (detail.value === CUSTOM_OPTION_SELECT_KEY) {\n setCustomDuration(NaN);\n setCustomUnitOfTime(initialCustomTimeUnit);\n onChangeRangeSize({\n amount: NaN,\n unit: initialCustomTimeUnit,\n type: 'relative',\n });\n } else {\n const option = clientOptions.filter(o => o.key === detail.value)[0];\n onChangeRangeSize(option);\n }\n }}\n value={selectedRadio}\n items={radioOptions}\n />\n </InternalFormField>\n )}\n\n {showCustomControls && (\n <InternalSpaceBetween direction=\"vertical\" size=\"xs\">\n {!showRadioControl && (\n <InternalBox fontSize=\"body-m\" color=\"text-body-secondary\">\n {i18n(\n 'i18nStrings.customRelativeRangeOptionDescription',\n i18nStrings?.customRelativeRangeOptionDescription\n )}\n </InternalBox>\n )}\n\n <div\n className={clsx(styles['custom-range'], {\n [styles['custom-range--no-padding']]: !showRadioControl,\n })}\n >\n <div\n className={clsx(styles['custom-range-form-controls'], {\n [styles.vertical]: isSingleGrid,\n })}\n >\n <div className={styles['custom-range-duration']}>\n <InternalFormField\n label={i18n(\n 'i18nStrings.customRelativeRangeDurationLabel',\n i18nStrings?.customRelativeRangeDurationLabel\n )}\n >\n <InternalInput\n type=\"number\"\n className={testutilStyles['custom-range-duration-input']}\n value={isNaN(customDuration) || customDuration === 0 ? '' : customDuration?.toString()}\n onChange={e => {\n const amount = Number(e.detail.value);\n\n setCustomDuration(amount);\n onChangeRangeSize({ amount, unit: customUnitOfTime, type: 'relative' });\n }}\n placeholder={i18n(\n 'i18nStrings.customRelativeRangeDurationPlaceholder',\n i18nStrings?.customRelativeRangeDurationPlaceholder\n )}\n __inheritFormFieldProps={true}\n />\n </InternalFormField>\n </div>\n\n <div className={styles['custom-range-unit']}>\n <InternalFormField\n label={i18n('i18nStrings.customRelativeRangeUnitLabel', i18nStrings?.customRelativeRangeUnitLabel)}\n >\n <InternalSelect\n className={testutilStyles['custom-range-unit-select']}\n selectedOption={\n {\n value: customUnitOfTime,\n label: formatUnit?.(customUnitOfTime, customDuration),\n } as UnitSelectOption\n }\n onChange={e => {\n const { value: unit } = e.detail.selectedOption as UnitSelectOption;\n\n setCustomUnitOfTime(unit);\n onChangeRangeSize({ amount: customDuration, unit, type: 'relative' });\n }}\n options={finalUnits.map(unit => ({\n value: unit,\n label: formatUnit?.(unit, customDuration),\n }))}\n renderHighlightedAriaLive={option => option.label || option.value || ''}\n />\n </InternalFormField>\n </div>\n </div>\n </div>\n </InternalSpaceBetween>\n )}\n </InternalSpaceBetween>\n </div>\n );\n}\n"]}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"flash-with-motion": "awsui_flash-with-
|
|
5
|
-
"enter": "
|
|
6
|
-
"flash-body": "awsui_flash-
|
|
7
|
-
"flash-message": "awsui_flash-
|
|
8
|
-
"flash-header": "awsui_flash-
|
|
9
|
-
"flash-content": "awsui_flash-
|
|
10
|
-
"action-button-wrapper": "awsui_action-button-
|
|
11
|
-
"dismiss-button-wrapper": "awsui_dismiss-button-
|
|
12
|
-
"flash-icon": "awsui_flash-
|
|
13
|
-
"entering": "
|
|
14
|
-
"entered": "
|
|
15
|
-
"exiting": "
|
|
16
|
-
"stack": "
|
|
17
|
-
"animation-running": "awsui_animation-
|
|
18
|
-
"item": "
|
|
19
|
-
"flash-list-item": "awsui_flash-list-
|
|
20
|
-
"notification-bar": "awsui_notification-
|
|
21
|
-
"collapsed": "
|
|
22
|
-
"animation-ready": "awsui_animation-
|
|
23
|
-
"expanded-only": "awsui_expanded-
|
|
24
|
-
"expanded": "
|
|
25
|
-
"flash": "
|
|
26
|
-
"collapsible": "
|
|
27
|
-
"short-list": "awsui_short-
|
|
28
|
-
"visual-refresh": "awsui_visual-
|
|
29
|
-
"status": "
|
|
30
|
-
"header": "
|
|
31
|
-
"item-count": "awsui_item-
|
|
32
|
-
"button": "
|
|
33
|
-
"type-count": "awsui_type-
|
|
34
|
-
"count-number": "awsui_count-
|
|
35
|
-
"icon": "
|
|
36
|
-
"floating": "
|
|
37
|
-
"flashbar": "
|
|
38
|
-
"initial-hidden": "awsui_initial-
|
|
39
|
-
"flash-list": "awsui_flash-
|
|
40
|
-
"flash-focus-container": "awsui_flash-focus-
|
|
41
|
-
"flash-text": "awsui_flash-
|
|
42
|
-
"hidden": "
|
|
43
|
-
"header-replacement": "awsui_header-
|
|
44
|
-
"content-replacement": "awsui_content-
|
|
45
|
-
"dismiss-button": "awsui_dismiss-
|
|
46
|
-
"action-wrapped": "awsui_action-
|
|
47
|
-
"action-button": "awsui_action-
|
|
48
|
-
"action-slot": "awsui_action-
|
|
49
|
-
"flash-type-success": "awsui_flash-type-
|
|
50
|
-
"flash-type-error": "awsui_flash-type-
|
|
51
|
-
"flash-type-info": "awsui_flash-type-
|
|
52
|
-
"flash-type-in-progress": "awsui_flash-type-in-
|
|
53
|
-
"flash-type-warning": "awsui_flash-type-
|
|
4
|
+
"flash-with-motion": "awsui_flash-with-motion_1q84n_tvi85_157",
|
|
5
|
+
"enter": "awsui_enter_1q84n_tvi85_157",
|
|
6
|
+
"flash-body": "awsui_flash-body_1q84n_tvi85_171",
|
|
7
|
+
"flash-message": "awsui_flash-message_1q84n_tvi85_171",
|
|
8
|
+
"flash-header": "awsui_flash-header_1q84n_tvi85_171",
|
|
9
|
+
"flash-content": "awsui_flash-content_1q84n_tvi85_172",
|
|
10
|
+
"action-button-wrapper": "awsui_action-button-wrapper_1q84n_tvi85_173",
|
|
11
|
+
"dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_tvi85_174",
|
|
12
|
+
"flash-icon": "awsui_flash-icon_1q84n_tvi85_197",
|
|
13
|
+
"entering": "awsui_entering_1q84n_tvi85_210",
|
|
14
|
+
"entered": "awsui_entered_1q84n_tvi85_231",
|
|
15
|
+
"exiting": "awsui_exiting_1q84n_tvi85_336",
|
|
16
|
+
"stack": "awsui_stack_1q84n_tvi85_370",
|
|
17
|
+
"animation-running": "awsui_animation-running_1q84n_tvi85_370",
|
|
18
|
+
"item": "awsui_item_1q84n_tvi85_370",
|
|
19
|
+
"flash-list-item": "awsui_flash-list-item_1q84n_tvi85_371",
|
|
20
|
+
"notification-bar": "awsui_notification-bar_1q84n_tvi85_372",
|
|
21
|
+
"collapsed": "awsui_collapsed_1q84n_tvi85_392",
|
|
22
|
+
"animation-ready": "awsui_animation-ready_1q84n_tvi85_392",
|
|
23
|
+
"expanded-only": "awsui_expanded-only_1q84n_tvi85_392",
|
|
24
|
+
"expanded": "awsui_expanded_1q84n_tvi85_392",
|
|
25
|
+
"flash": "awsui_flash_1q84n_tvi85_157",
|
|
26
|
+
"collapsible": "awsui_collapsible_1q84n_tvi85_448",
|
|
27
|
+
"short-list": "awsui_short-list_1q84n_tvi85_454",
|
|
28
|
+
"visual-refresh": "awsui_visual-refresh_1q84n_tvi85_454",
|
|
29
|
+
"status": "awsui_status_1q84n_tvi85_601",
|
|
30
|
+
"header": "awsui_header_1q84n_tvi85_601",
|
|
31
|
+
"item-count": "awsui_item-count_1q84n_tvi85_602",
|
|
32
|
+
"button": "awsui_button_1q84n_tvi85_603",
|
|
33
|
+
"type-count": "awsui_type-count_1q84n_tvi85_636",
|
|
34
|
+
"count-number": "awsui_count-number_1q84n_tvi85_636",
|
|
35
|
+
"icon": "awsui_icon_1q84n_tvi85_674",
|
|
36
|
+
"floating": "awsui_floating_1q84n_tvi85_715",
|
|
37
|
+
"flashbar": "awsui_flashbar_1q84n_tvi85_719",
|
|
38
|
+
"initial-hidden": "awsui_initial-hidden_1q84n_tvi85_778",
|
|
39
|
+
"flash-list": "awsui_flash-list_1q84n_tvi85_371",
|
|
40
|
+
"flash-focus-container": "awsui_flash-focus-container_1q84n_tvi85_802",
|
|
41
|
+
"flash-text": "awsui_flash-text_1q84n_tvi85_832",
|
|
42
|
+
"hidden": "awsui_hidden_1q84n_tvi85_851",
|
|
43
|
+
"header-replacement": "awsui_header-replacement_1q84n_tvi85_856",
|
|
44
|
+
"content-replacement": "awsui_content-replacement_1q84n_tvi85_861",
|
|
45
|
+
"dismiss-button": "awsui_dismiss-button_1q84n_tvi85_174",
|
|
46
|
+
"action-wrapped": "awsui_action-wrapped_1q84n_tvi85_879",
|
|
47
|
+
"action-button": "awsui_action-button_1q84n_tvi85_173",
|
|
48
|
+
"action-slot": "awsui_action-slot_1q84n_tvi85_886",
|
|
49
|
+
"flash-type-success": "awsui_flash-type-success_1q84n_tvi85_890",
|
|
50
|
+
"flash-type-error": "awsui_flash-type-error_1q84n_tvi85_894",
|
|
51
|
+
"flash-type-info": "awsui_flash-type-info_1q84n_tvi85_898",
|
|
52
|
+
"flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_tvi85_899",
|
|
53
|
+
"flash-type-warning": "awsui_flash-type-warning_1q84n_tvi85_903"
|
|
54
54
|
};
|
|
55
55
|
|