@cloudscape-design/components 3.0.963 → 3.0.965
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/annotation-context/index.js +2 -2
- package/annotation-context/index.js.map +1 -1
- package/app-layout/runtime-drawer/index.js +1 -1
- package/app-layout/runtime-drawer/index.js.map +1 -1
- package/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts +6 -0
- package/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts.map +1 -0
- package/app-layout/runtime-drawer/use-runtime-drawer-context.js +29 -0
- package/app-layout/runtime-drawer/use-runtime-drawer-context.js.map +1 -0
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/grids/interfaces.d.ts +3 -4
- package/date-range-picker/calendar/grids/interfaces.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/interfaces.js.map +1 -1
- package/date-range-picker/calendar/header/header-button.d.ts +0 -2
- package/date-range-picker/calendar/header/header-button.d.ts.map +1 -1
- package/date-range-picker/calendar/header/header-button.js.map +1 -1
- package/date-range-picker/calendar/header/index.d.ts +2 -3
- package/date-range-picker/calendar/header/index.d.ts.map +1 -1
- package/date-range-picker/calendar/header/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts +2 -2
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/calendar/range-inputs.d.ts +3 -3
- package/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
- package/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/date-range-picker/dropdown.d.ts +2 -2
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +2 -7
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/relative-range/index.d.ts +2 -2
- package/date-range-picker/relative-range/index.d.ts.map +1 -1
- package/date-range-picker/relative-range/index.js.map +1 -1
- package/i18n/provider.js +2 -2
- package/i18n/provider.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/internal/hooks/use-base-component/index.js +8 -5
- package/internal/hooks/use-base-component/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/alert-flash-content.d.ts +2 -0
- package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.js.map +1 -1
- package/internal/plugins/controllers/drawers.d.ts +6 -0
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js +17 -1
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/internal/plugins/helpers/use-discovered-content.d.ts +7 -7
- package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
- package/internal/plugins/helpers/use-discovered-content.js +5 -2
- package/internal/plugins/helpers/use-discovered-content.js.map +1 -1
- package/package.json +1 -1
- package/popover/container.d.ts.map +1 -1
- package/popover/container.js +20 -7
- package/popover/container.js.map +1 -1
- package/table/body-cell/inline-editor.d.ts.map +1 -1
- package/table/body-cell/inline-editor.js +2 -1
- package/table/body-cell/inline-editor.js.map +1 -1
- package/internal/hooks/use-telemetry/index.d.ts +0 -3
- package/internal/hooks/use-telemetry/index.d.ts.map +0 -1
- package/internal/hooks/use-telemetry/index.js +0 -12
- package/internal/hooks/use-telemetry/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-inputs.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/range-inputs.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"range-inputs.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/range-inputs.tsx"],"names":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,CACT,aAAa,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,0BAA0B,EACxE,aAAa,CAAC,CAAC,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,aAAa,CAAC,CAAC,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,CACvE;oBAED,oBAAC,iBAAiB,IAChB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,aAAa,IAAI,cAAc,CAAC,kBAAkB,CAAC,CAAC,EACtG,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,WAAW,EAAE,oBAAoB,EACjC,WAAW,EAAE,WAAW,GACxB,CACgB;gBACnB,aAAa,IAAI,CAChB,oBAAC,iBAAiB,IAAC,KAAK,EAAE,IAAI,CAAC,0BAA0B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI;oBAClG,oBAAC,iBAAiB,IAChB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,cAAc,CAAC,gBAAgB,CAAC,GAC3C,CACgB,CACrB,CACG,CACF,CACY,CACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { CalendarProps } from '../../calendar/interfaces';\nimport InternalDateInput from '../../date-input/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { useInternalI18n } from '../../i18n/context.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport { RangeCalendarI18nStrings } from '../interfaces';\n\nimport styles from '../styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\n\ntype I18nStrings = Pick<\n RangeCalendarI18nStrings,\n | 'dateConstraintText'\n | 'dateTimeConstraintText'\n | 'monthConstraintText'\n | 'startMonthLabel'\n | 'startDateLabel'\n | 'startTimeLabel'\n | 'endMonthLabel'\n | 'endDateLabel'\n | 'endTimeLabel'\n>;\n\ninterface RangeInputsProps extends BaseComponentProps, Pick<CalendarProps, 'granularity'> {\n startDate: string;\n onChangeStartDate: (value: string) => void;\n startTime: string;\n onChangeStartTime: (value: string) => void;\n endDate: string;\n onChangeEndDate: (value: string) => void;\n endTime: string;\n onChangeEndTime: (value: string) => void;\n i18nStrings?: I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n}\n\nexport default function RangeInputs({\n startDate,\n onChangeStartDate,\n startTime,\n onChangeStartTime,\n endDate,\n onChangeEndDate,\n endTime,\n onChangeEndTime,\n i18nStrings,\n dateOnly,\n timeInputFormat,\n granularity = 'day',\n}: RangeInputsProps) {\n const i18n = useInternalI18n('date-range-picker');\n const isMonthPicker = granularity === 'month';\n const dateInputPlaceholder = isMonthPicker ? 'YYYY/MM' : 'YYYY/MM/DD';\n const showTimeInput = !dateOnly && !isMonthPicker;\n\n return (\n <InternalFormField\n constraintText={i18n(\n isMonthPicker\n ? 'i18nStrings.monthConstraintText'\n : dateOnly\n ? 'i18nStrings.dateConstraintText'\n : 'i18nStrings.dateTimeConstraintText',\n isMonthPicker\n ? i18nStrings?.monthConstraintText\n : dateOnly\n ? i18nStrings?.dateConstraintText\n : i18nStrings?.dateTimeConstraintText\n )}\n >\n <div className={styles['date-and-time-container']}>\n <div className={styles['date-and-time-wrapper']}>\n <InternalFormField\n stretch={true}\n label={i18n(\n isMonthPicker ? 'i18nStrings.startMonthLabel' : 'i18nStrings.startDateLabel',\n isMonthPicker ? i18nStrings?.startMonthLabel : i18nStrings?.startDateLabel\n )}\n >\n <InternalDateInput\n value={startDate}\n className={clsx(testutilStyles['start-date-input'], isMonthPicker && testutilStyles['start-month-input'])}\n onChange={event => onChangeStartDate(event.detail.value)}\n placeholder={dateInputPlaceholder}\n granularity={granularity}\n />\n </InternalFormField>\n {showTimeInput && (\n <InternalFormField stretch={true} label={i18n('i18nStrings.startTimeLabel', i18nStrings?.startTimeLabel)}>\n <InternalTimeInput\n value={startTime}\n onChange={event => onChangeStartTime(event.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={testutilStyles['start-time-input']}\n />\n </InternalFormField>\n )}\n </div>\n\n <div className={styles['date-and-time-wrapper']}>\n <InternalFormField\n stretch={true}\n label={i18n(\n isMonthPicker ? 'i18nStrings.endMonthLabel' : 'i18nStrings.endDateLabel',\n isMonthPicker ? i18nStrings?.endMonthLabel : i18nStrings?.endDateLabel\n )}\n >\n <InternalDateInput\n value={endDate}\n className={clsx(testutilStyles['end-date-input'], isMonthPicker && testutilStyles['end-month-picker'])}\n onChange={event => onChangeEndDate(event.detail.value)}\n placeholder={dateInputPlaceholder}\n granularity={granularity}\n />\n </InternalFormField>\n {showTimeInput && (\n <InternalFormField label={i18n('i18nStrings.endTimeLabel', i18nStrings?.endTimeLabel)} stretch={true}>\n <InternalTimeInput\n value={endTime}\n onChange={event => onChangeEndTime(event.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={testutilStyles['end-time-input']}\n />\n </InternalFormField>\n )}\n </div>\n </div>\n </InternalFormField>\n );\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { CalendarProps } from '../calendar/interfaces';
|
|
2
3
|
import { DateRangePickerProps } from './interfaces';
|
|
3
|
-
interface DateRangePickerDropdownProps extends Pick<Required<DateRangePickerProps>, 'locale' | 'isDateEnabled' | 'isValidRange' | 'value' | 'relativeOptions' | 'showClearButton' | 'dateOnly' | 'rangeSelectorMode'>, Pick<DateRangePickerProps, 'startOfWeek' | 'getTimeOffset' | 'timeInputFormat' | 'timeOffset' | 'ariaLabelledby' | 'ariaDescribedby' | 'i18nStrings' | 'customRelativeRangeUnits' | 'dateDisabledReason'> {
|
|
4
|
+
interface DateRangePickerDropdownProps extends Pick<Required<DateRangePickerProps>, 'locale' | 'isDateEnabled' | 'isValidRange' | 'value' | 'relativeOptions' | 'showClearButton' | 'dateOnly' | 'rangeSelectorMode'>, Pick<DateRangePickerProps, 'startOfWeek' | 'getTimeOffset' | 'timeInputFormat' | 'timeOffset' | 'ariaLabelledby' | 'ariaDescribedby' | 'i18nStrings' | 'customRelativeRangeUnits' | 'dateDisabledReason'>, Pick<CalendarProps, 'granularity'> {
|
|
4
5
|
onClear: () => void;
|
|
5
6
|
onApply: (value: null | DateRangePickerProps.Value) => DateRangePickerProps.ValidationResult;
|
|
6
7
|
onDropdownClose: () => void;
|
|
7
8
|
isSingleGrid: boolean;
|
|
8
9
|
customAbsoluteRangeControl: DateRangePickerProps.AbsoluteRangeControl | undefined;
|
|
9
|
-
granularity?: DateRangePickerProps.Granularity;
|
|
10
10
|
}
|
|
11
11
|
export declare function DateRangePickerDropdown({ locale, startOfWeek, isDateEnabled, dateDisabledReason, isValidRange, value, onClear: clearValue, onApply: applyValue, getTimeOffset, timeOffset, onDropdownClose, relativeOptions, showClearButton, isSingleGrid, i18nStrings, dateOnly, timeInputFormat, rangeSelectorMode, ariaLabelledby, ariaDescribedby, customAbsoluteRangeControl, customRelativeRangeUnits, granularity, }: DateRangePickerDropdownProps): JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/dropdown.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/dropdown.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAWpD,UAAU,4BACR,SAAQ,IAAI,CACR,QAAQ,CAAC,oBAAoB,CAAC,EAC5B,QAAQ,GACR,eAAe,GACf,cAAc,GACd,OAAO,GACP,iBAAiB,GACjB,iBAAiB,GACjB,UAAU,GACV,mBAAmB,CACtB,EACD,IAAI,CACF,oBAAoB,EAClB,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,GACb,0BAA0B,GAC1B,oBAAoB,CACvB,EACD,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,KAAK,KAAK,oBAAoB,CAAC,gBAAgB,CAAC;IAC7F,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,0BAA0B,EAAE,oBAAoB,CAAC,oBAAoB,GAAG,SAAS,CAAC;CACnF;AAED,wBAAgB,uBAAuB,CAAC,EACtC,MAAW,EACX,WAAW,EACX,aAAa,EACb,kBAA6B,EAC7B,YAAY,EACZ,KAAK,EACL,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,UAAU,EACnB,aAAa,EACb,UAAU,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,WAAmB,GACpB,EAAE,4BAA4B,eA8M9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/date-range-picker/dropdown.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,E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Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalAlert from '../alert/internal';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport FocusLock from '../internal/components/focus-lock';\nimport InternalLiveRegion, { InternalLiveRegionRef } from '../live-region/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport Calendar from './calendar';\nimport { DateRangePickerProps } from './interfaces';\nimport ModeSwitcher from './mode-switcher';\nimport RelativeRangePicker from './relative-range';\nimport { normalizeTimeOffset } from './time-offset';\nimport { formatValue, getDefaultMode, joinAbsoluteValue, splitAbsoluteValue } from './utils';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\nconst VALID_RANGE: DateRangePickerProps.ValidRangeResult = { valid: true };\n\ninterface DateRangePickerDropdownProps\n extends Pick<\n Required<DateRangePickerProps>,\n | 'locale'\n | 'isDateEnabled'\n | 'isValidRange'\n | 'value'\n | 'relativeOptions'\n | 'showClearButton'\n | 'dateOnly'\n | 'rangeSelectorMode'\n >,\n Pick<\n DateRangePickerProps,\n | 'startOfWeek'\n | 'getTimeOffset'\n | 'timeInputFormat'\n | 'timeOffset'\n | 'ariaLabelledby'\n | 'ariaDescribedby'\n | 'i18nStrings'\n | 'customRelativeRangeUnits'\n | 'dateDisabledReason'\n > {\n onClear: () => void;\n onApply: (value: null | DateRangePickerProps.Value) => DateRangePickerProps.ValidationResult;\n onDropdownClose: () => void;\n isSingleGrid: boolean;\n customAbsoluteRangeControl: DateRangePickerProps.AbsoluteRangeControl | undefined;\n granularity?: DateRangePickerProps.Granularity;\n}\n\nexport function DateRangePickerDropdown({\n locale = '',\n startOfWeek,\n isDateEnabled,\n dateDisabledReason = () => '',\n isValidRange,\n value,\n onClear: clearValue,\n onApply: applyValue,\n getTimeOffset,\n timeOffset,\n onDropdownClose,\n relativeOptions,\n showClearButton,\n isSingleGrid,\n i18nStrings,\n dateOnly,\n timeInputFormat,\n rangeSelectorMode,\n ariaLabelledby,\n ariaDescribedby,\n customAbsoluteRangeControl,\n customRelativeRangeUnits,\n granularity = 'day',\n}: DateRangePickerDropdownProps) {\n const i18n = useInternalI18n('date-range-picker');\n const isMonthPicker = granularity === 'month';\n const hideTime = dateOnly || isMonthPicker;\n const liveRegionRef = useRef<InternalLiveRegionRef>(null);\n\n const [rangeSelectionMode, setRangeSelectionMode] = useState<'absolute' | 'relative'>(\n getDefaultMode(value, relativeOptions, rangeSelectorMode)\n );\n\n const [selectedAbsoluteRange, setSelectedAbsoluteRange] = useState<DateRangePickerProps.PendingAbsoluteValue>(() =>\n splitAbsoluteValue(value?.type === 'absolute' ? value : null, hideTime)\n );\n\n const [selectedRelativeRange, setSelectedRelativeRange] = useState<DateRangePickerProps.RelativeValue | null>(\n value?.type === 'relative' ? value : null\n );\n\n const scrollableContainerRef = useRef<HTMLDivElement | null>(null);\n const applyButtonRef = useRef<ButtonProps.Ref>(null);\n\n const [applyClicked, setApplyClicked] = useState<boolean>(false);\n\n const [validationResult, setValidationResult] = useState<\n DateRangePickerProps.ValidRangeResult | DateRangePickerProps.InvalidRangeResult\n >(VALID_RANGE);\n\n const closeDropdown = () => {\n setApplyClicked(false);\n onDropdownClose();\n };\n\n const onClear = () => {\n closeDropdown();\n clearValue();\n };\n\n const onApply = () => {\n const newValue =\n rangeSelectionMode === 'relative' ? selectedRelativeRange : joinAbsoluteValue(selectedAbsoluteRange, hideTime);\n const newValidationResult = applyValue(newValue);\n if (newValidationResult.valid === false) {\n setApplyClicked(true);\n setValidationResult(newValidationResult);\n liveRegionRef.current?.reannounce();\n } else {\n setApplyClicked(false);\n closeDropdown();\n }\n };\n\n useEffect(() => {\n if (applyClicked) {\n const visibleRange =\n rangeSelectionMode === 'relative' ? selectedRelativeRange : joinAbsoluteValue(selectedAbsoluteRange);\n const formattedRange = formatValue(visibleRange, {\n dateOnly,\n monthOnly: isMonthPicker,\n timeOffset: dateOnly || isMonthPicker ? null : normalizeTimeOffset(visibleRange, getTimeOffset, timeOffset),\n });\n const newValidationResult = isValidRange(formattedRange);\n setValidationResult(newValidationResult || VALID_RANGE);\n }\n }, [\n applyClicked,\n isValidRange,\n rangeSelectionMode,\n selectedRelativeRange,\n selectedAbsoluteRange,\n setValidationResult,\n dateOnly,\n isMonthPicker,\n getTimeOffset,\n timeOffset,\n ]);\n\n useEffect(() => scrollableContainerRef.current?.focus(), [scrollableContainerRef]);\n\n return (\n <>\n <FocusLock className={styles['focus-lock']} autoFocus={true}>\n <div\n ref={scrollableContainerRef}\n className={clsx(styles.dropdown, testutilStyles.dropdown)}\n tabIndex={0}\n role=\"dialog\"\n aria-label={i18nStrings?.ariaLabel}\n aria-labelledby={ariaLabelledby ?? i18nStrings?.ariaLabelledby}\n aria-describedby={ariaDescribedby ?? i18nStrings?.ariaDescribedby}\n >\n <div\n className={clsx(styles['dropdown-content'], {\n [styles['one-grid']]: isSingleGrid,\n })}\n >\n <InternalSpaceBetween size=\"l\">\n <InternalBox padding={{ top: 'm', horizontal: 'l' }}>\n <InternalSpaceBetween direction=\"vertical\" size=\"s\">\n {rangeSelectorMode === 'default' && (\n <ModeSwitcher\n mode={rangeSelectionMode}\n onChange={(mode: 'absolute' | 'relative') => {\n setRangeSelectionMode(mode);\n setApplyClicked(false);\n setValidationResult(VALID_RANGE);\n }}\n i18nStrings={i18nStrings}\n />\n )}\n\n {rangeSelectionMode === 'absolute' && (\n <Calendar\n value={selectedAbsoluteRange}\n setValue={setSelectedAbsoluteRange}\n locale={locale}\n startOfWeek={startOfWeek}\n isDateEnabled={isDateEnabled}\n dateDisabledReason={dateDisabledReason}\n i18nStrings={i18nStrings}\n dateOnly={dateOnly}\n timeInputFormat={timeInputFormat}\n customAbsoluteRangeControl={customAbsoluteRangeControl}\n granularity={granularity}\n />\n )}\n\n {rangeSelectionMode === 'relative' && (\n <RelativeRangePicker\n isSingleGrid={isSingleGrid}\n options={relativeOptions}\n dateOnly={dateOnly}\n initialSelection={selectedRelativeRange}\n onChange={range => setSelectedRelativeRange(range)}\n i18nStrings={i18nStrings}\n customUnits={customRelativeRangeUnits}\n granularity={granularity}\n />\n )}\n </InternalSpaceBetween>\n\n <InternalBox\n className={testutilStyles['validation-section']}\n margin={!validationResult.valid ? { top: 's' } : undefined}\n >\n {!validationResult.valid && (\n <>\n <InternalAlert\n type=\"error\"\n statusIconAriaLabel={i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel)}\n >\n <span className={testutilStyles['validation-error']}>{validationResult.errorMessage}</span>\n </InternalAlert>\n <InternalLiveRegion hidden={true} tagName=\"span\" ref={liveRegionRef}>\n {validationResult.errorMessage}\n </InternalLiveRegion>\n </>\n )}\n </InternalBox>\n </InternalBox>\n\n <div\n className={clsx(styles.footer, {\n [styles['one-grid']]: isSingleGrid,\n [styles['has-clear-button']]: showClearButton,\n })}\n >\n {showClearButton && (\n <div className={styles['footer-button-wrapper']}>\n <InternalButton\n onClick={onClear}\n className={testutilStyles['clear-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18n('i18nStrings.clearButtonLabel', i18nStrings?.clearButtonLabel)}\n </InternalButton>\n </div>\n )}\n <div className={styles['footer-button-wrapper']}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n <InternalButton\n onClick={closeDropdown}\n className={testutilStyles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18n('i18nStrings.cancelButtonLabel', i18nStrings?.cancelButtonLabel)}\n </InternalButton>\n\n <InternalButton\n onClick={onApply}\n className={testutilStyles['apply-button']}\n ref={applyButtonRef}\n formAction=\"none\"\n >\n {i18n('i18nStrings.applyButtonLabel', i18nStrings?.applyButtonLabel)}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n </div>\n </InternalSpaceBetween>\n </div>\n </div>\n </FocusLock>\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"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B,CAAC,CACrD,CACI,CACnB,CACF,CACe,CACnB,CACF,CACI,CACX,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalAlert from '../alert/internal';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { CalendarProps } from '../calendar/interfaces';\nimport { useInternalI18n } from '../i18n/context';\nimport FocusLock from '../internal/components/focus-lock';\nimport InternalLiveRegion, { InternalLiveRegionRef } from '../live-region/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport Calendar from './calendar';\nimport { DateRangePickerProps } from './interfaces';\nimport ModeSwitcher from './mode-switcher';\nimport RelativeRangePicker from './relative-range';\nimport { normalizeTimeOffset } from './time-offset';\nimport { formatValue, getDefaultMode, joinAbsoluteValue, splitAbsoluteValue } from './utils';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\nconst VALID_RANGE: DateRangePickerProps.ValidRangeResult = { valid: true };\n\ninterface DateRangePickerDropdownProps\n extends Pick<\n Required<DateRangePickerProps>,\n | 'locale'\n | 'isDateEnabled'\n | 'isValidRange'\n | 'value'\n | 'relativeOptions'\n | 'showClearButton'\n | 'dateOnly'\n | 'rangeSelectorMode'\n >,\n Pick<\n DateRangePickerProps,\n | 'startOfWeek'\n | 'getTimeOffset'\n | 'timeInputFormat'\n | 'timeOffset'\n | 'ariaLabelledby'\n | 'ariaDescribedby'\n | 'i18nStrings'\n | 'customRelativeRangeUnits'\n | 'dateDisabledReason'\n >,\n Pick<CalendarProps, 'granularity'> {\n onClear: () => void;\n onApply: (value: null | DateRangePickerProps.Value) => DateRangePickerProps.ValidationResult;\n onDropdownClose: () => void;\n isSingleGrid: boolean;\n customAbsoluteRangeControl: DateRangePickerProps.AbsoluteRangeControl | undefined;\n}\n\nexport function DateRangePickerDropdown({\n locale = '',\n startOfWeek,\n isDateEnabled,\n dateDisabledReason = () => '',\n isValidRange,\n value,\n onClear: clearValue,\n onApply: applyValue,\n getTimeOffset,\n timeOffset,\n onDropdownClose,\n relativeOptions,\n showClearButton,\n isSingleGrid,\n i18nStrings,\n dateOnly,\n timeInputFormat,\n rangeSelectorMode,\n ariaLabelledby,\n ariaDescribedby,\n customAbsoluteRangeControl,\n customRelativeRangeUnits,\n granularity = 'day',\n}: DateRangePickerDropdownProps) {\n const i18n = useInternalI18n('date-range-picker');\n const isMonthPicker = granularity === 'month';\n const hideTime = dateOnly || isMonthPicker;\n const liveRegionRef = useRef<InternalLiveRegionRef>(null);\n\n const [rangeSelectionMode, setRangeSelectionMode] = useState<'absolute' | 'relative'>(\n getDefaultMode(value, relativeOptions, rangeSelectorMode)\n );\n\n const [selectedAbsoluteRange, setSelectedAbsoluteRange] = useState<DateRangePickerProps.PendingAbsoluteValue>(() =>\n splitAbsoluteValue(value?.type === 'absolute' ? value : null, hideTime)\n );\n\n const [selectedRelativeRange, setSelectedRelativeRange] = useState<DateRangePickerProps.RelativeValue | null>(\n value?.type === 'relative' ? value : null\n );\n\n const scrollableContainerRef = useRef<HTMLDivElement | null>(null);\n const applyButtonRef = useRef<ButtonProps.Ref>(null);\n\n const [applyClicked, setApplyClicked] = useState<boolean>(false);\n\n const [validationResult, setValidationResult] = useState<\n DateRangePickerProps.ValidRangeResult | DateRangePickerProps.InvalidRangeResult\n >(VALID_RANGE);\n\n const closeDropdown = () => {\n setApplyClicked(false);\n onDropdownClose();\n };\n\n const onClear = () => {\n closeDropdown();\n clearValue();\n };\n\n const onApply = () => {\n const newValue =\n rangeSelectionMode === 'relative' ? selectedRelativeRange : joinAbsoluteValue(selectedAbsoluteRange, hideTime);\n const newValidationResult = applyValue(newValue);\n if (newValidationResult.valid === false) {\n setApplyClicked(true);\n setValidationResult(newValidationResult);\n liveRegionRef.current?.reannounce();\n } else {\n setApplyClicked(false);\n closeDropdown();\n }\n };\n\n useEffect(() => {\n if (applyClicked) {\n const visibleRange =\n rangeSelectionMode === 'relative' ? selectedRelativeRange : joinAbsoluteValue(selectedAbsoluteRange);\n const formattedRange = formatValue(visibleRange, {\n dateOnly,\n monthOnly: isMonthPicker,\n timeOffset: dateOnly || isMonthPicker ? null : normalizeTimeOffset(visibleRange, getTimeOffset, timeOffset),\n });\n const newValidationResult = isValidRange(formattedRange);\n setValidationResult(newValidationResult || VALID_RANGE);\n }\n }, [\n applyClicked,\n isValidRange,\n rangeSelectionMode,\n selectedRelativeRange,\n selectedAbsoluteRange,\n setValidationResult,\n dateOnly,\n isMonthPicker,\n getTimeOffset,\n timeOffset,\n ]);\n\n useEffect(() => scrollableContainerRef.current?.focus(), [scrollableContainerRef]);\n\n return (\n <>\n <FocusLock className={styles['focus-lock']} autoFocus={true}>\n <div\n ref={scrollableContainerRef}\n className={clsx(styles.dropdown, testutilStyles.dropdown)}\n tabIndex={0}\n role=\"dialog\"\n aria-label={i18nStrings?.ariaLabel}\n aria-labelledby={ariaLabelledby ?? i18nStrings?.ariaLabelledby}\n aria-describedby={ariaDescribedby ?? i18nStrings?.ariaDescribedby}\n >\n <div\n className={clsx(styles['dropdown-content'], {\n [styles['one-grid']]: isSingleGrid,\n })}\n >\n <InternalSpaceBetween size=\"l\">\n <InternalBox padding={{ top: 'm', horizontal: 'l' }}>\n <InternalSpaceBetween direction=\"vertical\" size=\"s\">\n {rangeSelectorMode === 'default' && (\n <ModeSwitcher\n mode={rangeSelectionMode}\n onChange={(mode: 'absolute' | 'relative') => {\n setRangeSelectionMode(mode);\n setApplyClicked(false);\n setValidationResult(VALID_RANGE);\n }}\n i18nStrings={i18nStrings}\n />\n )}\n\n {rangeSelectionMode === 'absolute' && (\n <Calendar\n value={selectedAbsoluteRange}\n setValue={setSelectedAbsoluteRange}\n locale={locale}\n startOfWeek={startOfWeek}\n isDateEnabled={isDateEnabled}\n dateDisabledReason={dateDisabledReason}\n i18nStrings={i18nStrings}\n dateOnly={dateOnly}\n timeInputFormat={timeInputFormat}\n customAbsoluteRangeControl={customAbsoluteRangeControl}\n granularity={granularity}\n />\n )}\n\n {rangeSelectionMode === 'relative' && (\n <RelativeRangePicker\n isSingleGrid={isSingleGrid}\n options={relativeOptions}\n dateOnly={dateOnly}\n initialSelection={selectedRelativeRange}\n onChange={range => setSelectedRelativeRange(range)}\n i18nStrings={i18nStrings}\n customUnits={customRelativeRangeUnits}\n granularity={granularity}\n />\n )}\n </InternalSpaceBetween>\n\n <InternalBox\n className={testutilStyles['validation-section']}\n margin={!validationResult.valid ? { top: 's' } : undefined}\n >\n {!validationResult.valid && (\n <>\n <InternalAlert\n type=\"error\"\n statusIconAriaLabel={i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel)}\n >\n <span className={testutilStyles['validation-error']}>{validationResult.errorMessage}</span>\n </InternalAlert>\n <InternalLiveRegion hidden={true} tagName=\"span\" ref={liveRegionRef}>\n {validationResult.errorMessage}\n </InternalLiveRegion>\n </>\n )}\n </InternalBox>\n </InternalBox>\n\n <div\n className={clsx(styles.footer, {\n [styles['one-grid']]: isSingleGrid,\n [styles['has-clear-button']]: showClearButton,\n })}\n >\n {showClearButton && (\n <div className={styles['footer-button-wrapper']}>\n <InternalButton\n onClick={onClear}\n className={testutilStyles['clear-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18n('i18nStrings.clearButtonLabel', i18nStrings?.clearButtonLabel)}\n </InternalButton>\n </div>\n )}\n <div className={styles['footer-button-wrapper']}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n <InternalButton\n onClick={closeDropdown}\n className={testutilStyles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18n('i18nStrings.cancelButtonLabel', i18nStrings?.cancelButtonLabel)}\n </InternalButton>\n\n <InternalButton\n onClick={onApply}\n className={testutilStyles['apply-button']}\n ref={applyButtonRef}\n formAction=\"none\"\n >\n {i18n('i18nStrings.applyButtonLabel', i18nStrings?.applyButtonLabel)}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n </div>\n </InternalSpaceBetween>\n </div>\n </div>\n </FocusLock>\n </>\n );\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CalendarProps } from '../calendar/interfaces';
|
|
2
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
4
|
import { ExpandToViewport } from '../internal/components/dropdown/interfaces';
|
|
4
5
|
import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
|
|
@@ -103,13 +104,8 @@ export interface DateRangePickerBaseProps {
|
|
|
103
104
|
* Default: the user's current time offset as provided by the browser.
|
|
104
105
|
*/
|
|
105
106
|
getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;
|
|
106
|
-
/**
|
|
107
|
-
* Specifies the granularity at which users will be able to select a date range.
|
|
108
|
-
* Defaults to `day`.
|
|
109
|
-
*/
|
|
110
|
-
granularity?: DateRangePickerProps.Granularity;
|
|
111
107
|
}
|
|
112
|
-
export interface DateRangePickerProps extends BaseComponentProps, FormFieldValidationControlProps, ExpandToViewport, DateRangePickerBaseProps {
|
|
108
|
+
export interface DateRangePickerProps extends BaseComponentProps, FormFieldValidationControlProps, ExpandToViewport, DateRangePickerBaseProps, Pick<CalendarProps, 'granularity'> {
|
|
113
109
|
/**
|
|
114
110
|
* Specifies the placeholder text that is rendered when the value is empty.
|
|
115
111
|
*/
|
|
@@ -432,7 +428,6 @@ export declare namespace DateRangePickerProps {
|
|
|
432
428
|
previousYearAriaLabel?: string;
|
|
433
429
|
}
|
|
434
430
|
type AbsoluteFormat = 'iso' | 'long-localized';
|
|
435
|
-
type Granularity = 'day' | 'month';
|
|
436
431
|
}
|
|
437
432
|
export type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
438
433
|
export type QuarterIndex = 0 | 1 | 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.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AAoB,CAAC,WAAW,EAC9B,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,uBAAuB,GACvB,mBAAmB,GACnB,uBAAuB,GACvB,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,cAAc,GACd,cAAc,GACd,oBAAoB,GACpB,wBAAwB,GACxB,qBAAqB,GACrB,qCAAqC,CACxC,CAAC"}
|
|
@@ -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 { 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 { 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 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?: TimeInputProps.Format;\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 /**\n * Specifies the granularity at which users will be able to select a date range.\n * Defaults to `day`.\n */\n granularity?: DateRangePickerProps.Granularity;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps {\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 *\n * Defaults to `iso`.\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\n * absolute range.\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\n * absolute range.\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the\n * absolute range.\n * @i18n\n */\n monthConstraintText?: 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 = 'iso' | 'long-localized';\n\n export type Granularity = 'day' | 'month';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n\nexport type RangeCalendarI18nStrings = Pick<\n DateRangePickerProps.I18nStrings,\n | 'todayAriaLabel'\n | 'nextMonthAriaLabel'\n | 'previousMonthAriaLabel'\n | 'currentMonthAriaLabel'\n | 'nextYearAriaLabel'\n | 'previousYearAriaLabel'\n | 'startMonthLabel'\n | 'startDateLabel'\n | 'startTimeLabel'\n | 'endMonthLabel'\n | 'endDateLabel'\n | 'endTimeLabel'\n | 'dateConstraintText'\n | 'dateTimeConstraintText'\n | 'monthConstraintText'\n | 'renderSelectedAbsoluteRangeAriaLive'\n>;\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 { 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 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?: TimeInputProps.Format;\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 *\n * Defaults to `iso`.\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\n * absolute range.\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\n * absolute range.\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the\n * absolute range.\n * @i18n\n */\n monthConstraintText?: 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 = 'iso' | 'long-localized';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n\nexport type RangeCalendarI18nStrings = Pick<\n DateRangePickerProps.I18nStrings,\n | 'todayAriaLabel'\n | 'nextMonthAriaLabel'\n | 'previousMonthAriaLabel'\n | 'currentMonthAriaLabel'\n | 'nextYearAriaLabel'\n | 'previousYearAriaLabel'\n | 'startMonthLabel'\n | 'startDateLabel'\n | 'startTimeLabel'\n | 'endMonthLabel'\n | 'endDateLabel'\n | 'endTimeLabel'\n | 'dateConstraintText'\n | 'dateTimeConstraintText'\n | 'monthConstraintText'\n | 'renderSelectedAbsoluteRangeAriaLive'\n>;\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { CalendarProps } from '../../calendar/interfaces';
|
|
2
3
|
import { DateRangePickerProps } from '../interfaces';
|
|
3
|
-
interface RelativeRangePickerProps {
|
|
4
|
+
interface RelativeRangePickerProps extends Pick<CalendarProps, 'granularity'> {
|
|
4
5
|
dateOnly: boolean;
|
|
5
6
|
options: ReadonlyArray<DateRangePickerProps.RelativeOption>;
|
|
6
7
|
initialSelection: DateRangePickerProps.RelativeValue | null;
|
|
@@ -8,7 +9,6 @@ interface RelativeRangePickerProps {
|
|
|
8
9
|
i18nStrings?: DateRangePickerProps.I18nStrings;
|
|
9
10
|
isSingleGrid: boolean;
|
|
10
11
|
customUnits?: DateRangePickerProps.TimeUnit[];
|
|
11
|
-
granularity?: DateRangePickerProps.Granularity;
|
|
12
12
|
}
|
|
13
13
|
export default function RelativeRangePicker({ dateOnly, options: clientOptions, initialSelection: initialRange, onChange: onChangeRangeSize, i18nStrings, isSingleGrid, customUnits, granularity, }: RelativeRangePickerProps): JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/relative-range/index.tsx"],"names":[],"mappings":";
|
|
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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,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 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 {\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 granularity?: DateRangePickerProps.Granularity;\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;AA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CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,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}\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"]}
|
package/i18n/provider.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import IntlMessageFormat from 'intl-messageformat';
|
|
5
5
|
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
6
|
-
import
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
7
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
8
8
|
import { InternalI18nContext } from './context';
|
|
9
9
|
import { getMatchableLocales } from './get-matchable-locales';
|
|
@@ -14,7 +14,7 @@ import { getMatchableLocales } from './get-matchable-locales';
|
|
|
14
14
|
*/
|
|
15
15
|
const I18nMessagesContext = React.createContext({});
|
|
16
16
|
export function I18nProvider({ messages: messagesArray, locale: providedLocale, children }) {
|
|
17
|
-
|
|
17
|
+
useBaseComponent('I18nProvider');
|
|
18
18
|
if (typeof document === 'undefined' && !providedLocale) {
|
|
19
19
|
warnOnce('I18nProvider', 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.');
|
|
20
20
|
}
|
package/i18n/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/i18n/provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/i18n/provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAiC,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAoB9D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right Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useContext } from 'react';\nimport { MessageFormatElement } from '@formatjs/icu-messageformat-parser';\nimport IntlMessageFormat from 'intl-messageformat';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { CustomHandler, FormatFunction, InternalI18nContext } from './context';\nimport { getMatchableLocales } from './get-matchable-locales';\n\nexport interface I18nProviderProps {\n messages: ReadonlyArray<I18nProviderProps.Messages>;\n locale?: string;\n children: React.ReactNode;\n}\n\nexport namespace I18nProviderProps {\n export interface Messages {\n [namespace: string]: {\n [locale: string]: {\n [component: string]: {\n [key: string]: string | MessageFormatElement[];\n };\n };\n };\n }\n}\n\n/**\n * Context to send parent messages down to child I18nProviders. This isn't\n * included in the InternalI18nContext to avoid components from depending on\n * MessageFormatElement types.\n */\nconst I18nMessagesContext = React.createContext<I18nProviderProps.Messages>({});\n\nexport function I18nProvider({ messages: messagesArray, locale: providedLocale, children }: I18nProviderProps) {\n useBaseComponent('I18nProvider');\n\n if (typeof document === 'undefined' && !providedLocale) {\n warnOnce(\n 'I18nProvider',\n 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.'\n );\n }\n\n // The provider accepts an array of configs. We merge parent messages and\n // flatten the tree early on so that accesses by key are simpler and faster.\n const parentMessages = useContext(I18nMessagesContext);\n const messages = mergeMessages([parentMessages, ...messagesArray]);\n\n let locale: string;\n if (providedLocale) {\n // If a locale is explicitly provided, use the string directly.\n // Locales have a recommended case, but are matched case-insensitively,\n // so we lowercase it internally.\n locale = providedLocale.toLowerCase();\n } else if (typeof document !== 'undefined' && document.documentElement.lang) {\n // Otherwise, use the value provided in the HTML tag.\n locale = document.documentElement.lang.toLowerCase();\n } else {\n // Lastly, fall back to English.\n locale = 'en';\n }\n\n // Create a per-render cache of messages and IntlMessageFormat instances.\n // Not memoizing it allows us to reset the cache when the component rerenders\n // with potentially different locale or messages. We expect this component to\n // be placed above AppLayout and therefore rerender very infrequently.\n const localeFormatterCache = new Map<string, IntlMessageFormat>();\n\n const format: FormatFunction = <ReturnValue, FormatFnArgs extends Record<string, string | number>>(\n namespace: string,\n component: string,\n key: string,\n provided: ReturnValue,\n customHandler?: CustomHandler<ReturnValue, FormatFnArgs>\n ): ReturnValue => {\n // A general rule in this library is that undefined is basically\n // treated as \"not provided\". So even if a user explicitly provides an\n // undefined value, it will default to i18n provider values.\n if (provided !== undefined) {\n return provided;\n }\n\n const cacheKey = `${namespace}.${component}.${key}`;\n let intlMessageFormat: IntlMessageFormat;\n\n const cachedFormatter = localeFormatterCache.get(cacheKey);\n if (cachedFormatter) {\n // If an IntlMessageFormat instance was cached for this locale, just use that.\n intlMessageFormat = cachedFormatter;\n } else {\n // Widen the locale string (e.g. en-GB -> en) until we find a locale\n // that contains the message we need.\n let message: string | MessageFormatElement[] | undefined;\n const matchableLocales = getMatchableLocales(locale);\n for (const matchableLocale of matchableLocales) {\n message = messages?.[namespace]?.[matchableLocale]?.[component]?.[key];\n if (message !== undefined) {\n break;\n }\n }\n\n // If a message wasn't found, exit early.\n if (message === undefined) {\n return provided;\n }\n\n // Lazily create an IntlMessageFormat object for this key.\n intlMessageFormat = new IntlMessageFormat(message, locale);\n localeFormatterCache.set(cacheKey, intlMessageFormat);\n }\n\n if (customHandler) {\n return customHandler(args => intlMessageFormat.format(args) as string);\n }\n // Assuming `T extends string` since a customHandler wasn't provided.\n return intlMessageFormat.format() as ReturnValue;\n };\n\n return (\n <InternalI18nContext.Provider value={{ locale, format }}>\n <I18nMessagesContext.Provider value={messages}>{children}</I18nMessagesContext.Provider>\n </InternalI18nContext.Provider>\n );\n}\n\napplyDisplayName(I18nProvider, 'I18nProvider');\n\nfunction mergeMessages(sources: ReadonlyArray<I18nProviderProps.Messages>): I18nProviderProps.Messages {\n const result: I18nProviderProps.Messages = {};\n for (const messages of sources) {\n for (const namespace in messages) {\n if (!(namespace in result)) {\n result[namespace] = {};\n }\n for (const casedLocale in messages[namespace]) {\n const locale = casedLocale.toLowerCase();\n if (!(locale in result[namespace])) {\n result[namespace][locale] = {};\n }\n for (const component in messages[namespace][casedLocale]) {\n if (!(component in result[namespace][locale])) {\n result[namespace][locale][component] = {};\n }\n for (const key in messages[namespace][casedLocale][component]) {\n result[namespace][locale][component][key] = messages[namespace][casedLocale][component][key];\n }\n }\n }\n }\n }\n return result;\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAYtC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { useComponentMetadata, useFocusVisible, } from '@cloudscape-design/component-toolkit/internal';
|
|
2
|
-
import { PACKAGE_VERSION } from '../../environment';
|
|
3
|
-
import {
|
|
1
|
+
import { useComponentMetadata, useComponentMetrics, useFocusVisible, } from '@cloudscape-design/component-toolkit/internal';
|
|
2
|
+
import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';
|
|
3
|
+
import { getVisualTheme } from '../../utils/get-visual-theme';
|
|
4
|
+
import { useVisualRefresh } from '../use-visual-mode';
|
|
4
5
|
/**
|
|
5
6
|
* This hook is used for components which are exported to customers. The returned __internalRootRef needs to be
|
|
6
7
|
* attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this
|
|
7
8
|
* root DOM node and emits the telemetry for this component.
|
|
8
9
|
*/
|
|
9
10
|
export default function useBaseComponent(componentName, config, analyticsMetadata) {
|
|
10
|
-
|
|
11
|
+
const isVisualRefresh = useVisualRefresh();
|
|
12
|
+
const theme = getVisualTheme(THEME, isVisualRefresh);
|
|
13
|
+
useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);
|
|
11
14
|
useFocusVisible();
|
|
12
|
-
const elementRef = useComponentMetadata(componentName, PACKAGE_VERSION,
|
|
15
|
+
const elementRef = useComponentMetadata(componentName, { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme }, analyticsMetadata);
|
|
13
16
|
return { __internalRootRef: elementRef };
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,aAAqB,EACrB,MAA+B,EAC/B,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IACtH,eAAe,EAAE,CAAC;IAClB,MAAM,UAAU,GAAG,oBAAoB,CACrC,aAAa,EACb,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAChE,iBAAwB,CACzB,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MutableRefObject } from 'react';\n\nimport {\n ComponentConfiguration,\n useComponentMetadata,\n useComponentMetrics,\n useFocusVisible,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../analytics/interfaces';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';\nimport { getVisualTheme } from '../../utils/get-visual-theme';\nimport { useVisualRefresh } from '../use-visual-mode';\n\nexport interface InternalBaseComponentProps<T = any> {\n __internalRootRef?: MutableRefObject<T | null> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(\n componentName: string,\n config?: ComponentConfiguration,\n analyticsMetadata?: AnalyticsMetadata\n) {\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n useFocusVisible();\n const elementRef = useComponentMetadata<T>(\n componentName,\n { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },\n analyticsMetadata as any\n );\n return { __internalRootRef: elementRef };\n}\n"]}
|
package/internal/manifest.json
CHANGED
|
@@ -3,11 +3,13 @@ interface RefShim<T> {
|
|
|
3
3
|
current: T | null;
|
|
4
4
|
}
|
|
5
5
|
interface AlertFlashContentContext {
|
|
6
|
+
instanceId: string;
|
|
6
7
|
type: string;
|
|
7
8
|
headerRef: RefShim<HTMLElement>;
|
|
8
9
|
contentRef: RefShim<HTMLElement>;
|
|
9
10
|
}
|
|
10
11
|
interface AlertFlashContentInitialContext {
|
|
12
|
+
instanceId: string;
|
|
11
13
|
type: string;
|
|
12
14
|
header?: ReactNode;
|
|
13
15
|
content?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EA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AgBtC,uBAAuB,YAAa,uBAAuB,UAYzD;IAEF,uBAAuB,aAErB;IAEF,YAAY,YAAa,+BAA+B,KAAG,OAAO,CAKhE;IAEF,mBAAmB,aAAc,qCAAqC,gBAapE;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAAG,0BAA0B;IAKxF,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,4BAA4B,CAAM,GAAG,4BAA4B;CAMvG"}
|
|
1
|
+
{"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,UAAU,+BAA+B;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,UAAU,cAAc;IACtB,UAAU,IAAI,IAAI,CAAC;IACnB,aAAa,IAAI,IAAI,CAAC;IACtB,aAAa,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;IAChE,WAAW,IAAI,IAAI,CAAC;IACpB,cAAc,IAAI,IAAI,CAAC;IACvB,cAAc,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,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