@cloudscape-design/components-themeable 3.0.24 → 3.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/scss/date-range-picker/styles.scss +0 -4
- package/lib/internal/template/alert/styles.scoped.css +0 -34
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +0 -18
- package/lib/internal/template/app-layout/content-wrapper/styles.scoped.css +0 -4
- package/lib/internal/template/app-layout/mobile-toolbar/styles.scoped.css +0 -9
- package/lib/internal/template/app-layout/styles.scoped.css +0 -20
- package/lib/internal/template/app-layout/toggles/styles.scoped.css +0 -16
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +0 -71
- package/lib/internal/template/area-chart/styles.scoped.css +0 -13
- package/lib/internal/template/attribute-editor/styles.scoped.css +0 -23
- package/lib/internal/template/badge/styles.scoped.css +0 -15
- package/lib/internal/template/bar-chart/interfaces.d.ts +1 -1
- package/lib/internal/template/bar-chart/interfaces.d.ts.map +1 -1
- package/lib/internal/template/bar-chart/interfaces.js.map +1 -1
- package/lib/internal/template/box/styles.scoped.css +0 -171
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +0 -11
- package/lib/internal/template/breadcrumb-group/styles.scoped.css +0 -10
- package/lib/internal/template/button/styles.scoped.css +0 -264
- package/lib/internal/template/button-dropdown/category-elements/styles.scoped.css +0 -26
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +0 -22
- package/lib/internal/template/button-dropdown/mobile-expandable-group/styles.scoped.css +0 -5
- package/lib/internal/template/button-dropdown/styles.scoped.css +0 -7
- package/lib/internal/template/cards/styles.scoped.css +0 -45
- package/lib/internal/template/checkbox/styles.scoped.css +0 -11
- package/lib/internal/template/code-editor/styles.scoped.css +0 -87
- package/lib/internal/template/collection-preferences/styles.scoped.css +0 -12
- package/lib/internal/template/column-layout/styles.scoped.css +0 -12
- package/lib/internal/template/container/styles.scoped.css +0 -27
- package/lib/internal/template/date-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-picker/index.js +3 -4
- package/lib/internal/template/date-picker/index.js.map +1 -1
- package/lib/internal/template/date-picker/styles.scoped.css +0 -45
- package/lib/internal/template/date-range-picker/calendar/grids/day/styles.scoped.css +0 -45
- package/lib/internal/template/date-range-picker/calendar/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.js +7 -9
- package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +13 -15
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/relative-range/styles.scoped.css +0 -3
- package/lib/internal/template/date-range-picker/styles.css.js +41 -42
- package/lib/internal/template/date-range-picker/styles.scoped.css +49 -92
- package/lib/internal/template/date-range-picker/styles.selectors.js +41 -42
- package/lib/internal/template/expandable-section/styles.scoped.css +0 -33
- package/lib/internal/template/flashbar/styles.scoped.css +0 -36
- package/lib/internal/template/form/styles.scoped.css +0 -12
- package/lib/internal/template/form-field/styles.scoped.css +0 -26
- package/lib/internal/template/grid/styles.scoped.css +0 -6
- package/lib/internal/template/header/styles.scoped.css +0 -51
- package/lib/internal/template/help-panel/styles.scoped.css +0 -73
- package/lib/internal/template/hotspot/styles.scoped.css +0 -3
- package/lib/internal/template/icon/styles.scoped.css +0 -33
- package/lib/internal/template/input/styles.scoped.css +0 -49
- package/lib/internal/template/internal/base-component/styles.scoped.css +0 -1
- package/lib/internal/template/internal/components/abstract-switch/styles.scoped.css +0 -7
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +0 -42
- package/lib/internal/template/internal/components/cartesian-chart/styles.scoped.css +0 -10
- package/lib/internal/template/internal/components/chart-filter/styles.scoped.css +0 -4
- package/lib/internal/template/internal/components/chart-legend/styles.scoped.css +0 -8
- package/lib/internal/template/internal/components/chart-plot/styles.scoped.css +0 -1
- package/lib/internal/template/internal/components/chart-popover/styles.scoped.css +0 -4
- package/lib/internal/template/internal/components/chart-series-details/styles.scoped.css +0 -12
- package/lib/internal/template/internal/components/chart-series-marker/styles.scoped.css +0 -7
- package/lib/internal/template/internal/components/chart-status-container/styles.scoped.css +0 -1
- package/lib/internal/template/internal/components/checkbox-icon/styles.scoped.css +0 -10
- package/lib/internal/template/internal/components/content-layout/styles.scoped.css +0 -5
- package/lib/internal/template/internal/components/dark-ribbon/styles.scoped.css +0 -1
- package/lib/internal/template/internal/components/date-input/index.d.ts +1 -1
- package/lib/internal/template/internal/components/date-input/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/date-input/index.js +4 -3
- package/lib/internal/template/internal/components/date-input/index.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +0 -17
- package/lib/internal/template/internal/components/dropdown-footer/styles.scoped.css +0 -6
- package/lib/internal/template/internal/components/dropdown-status/styles.scoped.css +0 -6
- package/lib/internal/template/internal/components/filtering-token/styles.scoped.css +0 -21
- package/lib/internal/template/internal/components/menu-dropdown/styles.scoped.css +0 -17
- package/lib/internal/template/internal/components/option/styles.scoped.css +0 -16
- package/lib/internal/template/internal/components/options-list/styles.scoped.css +0 -5
- package/lib/internal/template/internal/components/selectable-item/styles.scoped.css +0 -44
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/line-chart/interfaces.d.ts +1 -1
- package/lib/internal/template/line-chart/interfaces.d.ts.map +1 -1
- package/lib/internal/template/line-chart/interfaces.js.map +1 -1
- package/lib/internal/template/link/styles.scoped.css +0 -77
- package/lib/internal/template/mixed-line-bar-chart/bar-series.d.ts +1 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.js +9 -10
- package/lib/internal/template/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-filters.d.ts +2 -2
- package/lib/internal/template/mixed-line-bar-chart/chart-filters.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-filters.js +1 -2
- package/lib/internal/template/mixed-line-bar-chart/chart-filters.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.d.ts +2 -2
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.js +1 -2
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/domain.d.ts +4 -0
- package/lib/internal/template/mixed-line-bar-chart/domain.d.ts.map +1 -0
- package/lib/internal/template/mixed-line-bar-chart/domain.js +138 -0
- package/lib/internal/template/mixed-line-bar-chart/domain.js.map +1 -0
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.d.ts +2 -4
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.js +26 -15
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.js +3 -2
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-navigation.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-navigation.js +23 -35
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-navigation.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/interfaces.d.ts +12 -2
- package/lib/internal/template/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/interfaces.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/internal.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/internal.js +14 -6
- package/lib/internal/template/mixed-line-bar-chart/internal.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/line-series.d.ts +2 -2
- package/lib/internal/template/mixed-line-bar-chart/line-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/line-series.js +21 -9
- package/lib/internal/template/mixed-line-bar-chart/line-series.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-bar-groups.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-bar-groups.js +11 -4
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-bar-groups.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.d.ts +2 -4
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.js +89 -25
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/styles.scoped.css +0 -13
- package/lib/internal/template/mixed-line-bar-chart/utils.d.ts +5 -6
- package/lib/internal/template/mixed-line-bar-chart/utils.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/utils.js +11 -112
- package/lib/internal/template/mixed-line-bar-chart/utils.js.map +1 -1
- package/lib/internal/template/modal/styles.scoped.css +0 -31
- package/lib/internal/template/multiselect/styles.scoped.css +0 -4
- package/lib/internal/template/pagination/styles.scoped.css +0 -22
- package/lib/internal/template/pie-chart/styles.scoped.css +0 -25
- package/lib/internal/template/popover/styles.scoped.css +0 -35
- package/lib/internal/template/progress-bar/styles.scoped.css +0 -25
- package/lib/internal/template/property-filter/styles.scoped.css +0 -22
- package/lib/internal/template/radio-group/styles.scoped.css +0 -22
- package/lib/internal/template/s3-resource-selector/s3-in-context/styles.scoped.css +0 -6
- package/lib/internal/template/segmented-control/styles.scoped.css +0 -36
- package/lib/internal/template/select/parts/styles.scoped.css +0 -6
- package/lib/internal/template/select/styles.scoped.css +0 -4
- package/lib/internal/template/side-navigation/styles.scoped.css +0 -38
- package/lib/internal/template/space-between/styles.scoped.css +0 -40
- package/lib/internal/template/spinner/styles.scoped.css +0 -17
- package/lib/internal/template/split-panel/styles.scoped.css +0 -65
- package/lib/internal/template/status-indicator/styles.scoped.css +0 -20
- package/lib/internal/template/table/body-cell/styles.scoped.css +0 -29
- package/lib/internal/template/table/header-cell/styles.scoped.css +0 -32
- package/lib/internal/template/table/resizer/styles.scoped.css +0 -6
- package/lib/internal/template/table/selection-control/styles.scoped.css +0 -3
- package/lib/internal/template/table/styles.scoped.css +0 -39
- package/lib/internal/template/table/use-selection.d.ts.map +1 -1
- package/lib/internal/template/table/use-selection.js +5 -5
- package/lib/internal/template/table/use-selection.js.map +1 -1
- package/lib/internal/template/tabs/styles.scoped.css +0 -41
- package/lib/internal/template/tag-editor/styles.scoped.css +0 -12
- package/lib/internal/template/text-content/styles.scoped.css +0 -54
- package/lib/internal/template/text-filter/styles.scoped.css +0 -7
- package/lib/internal/template/textarea/styles.scoped.css +0 -30
- package/lib/internal/template/tiles/styles.scoped.css +0 -55
- package/lib/internal/template/toggle/styles.scoped.css +0 -14
- package/lib/internal/template/token-group/styles.scoped.css +0 -35
- package/lib/internal/template/top-navigation/1.0-beta/styles.scoped.css +0 -40
- package/lib/internal/template/top-navigation/styles.scoped.css +0 -75
- package/lib/internal/template/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +0 -22
- package/lib/internal/template/tutorial-panel/components/tutorial-list/styles.scoped.css +0 -24
- package/lib/internal/template/tutorial-panel/styles.scoped.css +0 -5
- package/lib/internal/template/wizard/styles.scoped.css +0 -54
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO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ACb,CACQ,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useCallback, useRef, useState } from 'react';\nimport styles from './styles.css.js';\nimport { DatePickerProps } from './interfaces';\nimport Calendar from './calendar';\nimport { normalizeLocale } from './calendar/utils/locales';\nimport { getDateLabel } from './calendar/utils/intl';\nimport { displayToIso, isoToDisplay, memoizedDate } from './calendar/utils/date';\nimport { InputProps } from '../input/interfaces';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Dropdown from '../internal/components/dropdown';\nimport DateInput from '../internal/components/date-input';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name.js';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker.js';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport FocusLock from '../internal/components/focus-lock';\nimport { useDatePicker } from './use-date-picker.js';\n\nexport { DatePickerProps };\n\nconst DatePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n todayAriaLabel,\n placeholder = '',\n value = '',\n readOnly = false,\n disabled = false,\n onBlur,\n autoFocus = false,\n onChange,\n onFocus,\n name,\n ariaLabel,\n ariaRequired,\n ariaLabelledby,\n ariaDescribedby,\n controlId,\n invalid,\n openCalendarAriaLabel,\n expandToViewport,\n ...rest\n }: DatePickerProps,\n ref: Ref<DatePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DatePicker');\n\n const {\n defaultDisplayedDate,\n displayedDate,\n setDisplayedDate,\n selectedDate,\n onChangeMonthHandler,\n onSelectDateHandler,\n } = useDatePicker({\n value,\n onChange,\n });\n\n const baseProps = getBaseProps(rest);\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n const normalizedLocale = normalizeLocale('DatePicker', locale ?? '');\n\n const internalInputRef = useRef<HTMLInputElement>(null);\n const buttonRef = useRef<ButtonProps.Ref>(null);\n useForwardFocus(ref, internalInputRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('calender');\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n useFocusTracker({ rootRef, onBlur, onFocus, viewportId: expandToViewport ? dropdownId : '' });\n\n const onDropdownCloseHandler = useCallback(() => {\n setDisplayedDate(defaultDisplayedDate);\n setIsDropDownOpen(false);\n }, [defaultDisplayedDate, setDisplayedDate, setIsDropDownOpen]);\n\n const onButtonClickHandler = () => {\n if (!isDropDownOpen) {\n setIsDropDownOpen(true);\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape && isDropDownOpen) {\n buttonRef.current?.focus();\n setIsDropDownOpen(false);\n }\n };\n\n const onInputChangeHandler: InputProps['onChange'] = event => {\n const isoDateString = displayToIso(event.detail.value);\n fireNonCancelableEvent(onChange, { value: isoDateString });\n };\n\n const onInputBlurHandler: InputProps['onBlur'] = () => {\n if (!isDropDownOpen) {\n setDisplayedDate(defaultDisplayedDate);\n setIsDropDownOpen(false);\n }\n };\n\n const DateInputElement = (\n <div className={styles['date-picker-trigger']}>\n <div className={styles['date-picker-input']}>\n <DateInput\n name={name}\n invalid={invalid}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n value={isoToDisplay(value)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={isDropDownOpen}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onInputChangeHandler}\n onBlur={onInputBlurHandler}\n placeholder={placeholder}\n ref={internalInputRef}\n autoFocus={autoFocus}\n />\n </div>\n <div>\n <InternalButton\n iconName=\"calendar\"\n className={styles['open-calendar-button']}\n onClick={onButtonClickHandler}\n ref={buttonRef}\n ariaLabel={\n openCalendarAriaLabel &&\n openCalendarAriaLabel(\n value.length === 10 ? getDateLabel(normalizedLocale, memoizedDate('value', value)) : null\n )\n }\n disabled={disabled || readOnly}\n formAction=\"none\"\n />\n </div>\n </div>\n );\n\n baseProps.className = clsx(baseProps.className, styles.root, styles['date-picker-container']);\n\n if (readOnly || disabled) {\n return <div {...baseProps}>{DateInputElement}</div>;\n }\n\n checkControlled('DatePicker', 'value', value, 'onChange', onChange);\n\n const handleMouseDown = (event: React.MouseEvent) => {\n // prevent currently focused element from losing it\n event.preventDefault();\n };\n\n return (\n <div {...baseProps} ref={mergedRef} onKeyDown={onWrapperKeyDownHandler}>\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={onDropdownCloseHandler}\n onMouseDown={handleMouseDown}\n trigger={DateInputElement}\n expandToViewport={expandToViewport}\n scrollable={false}\n dropdownId={dropdownId}\n >\n {isDropDownOpen && (\n <FocusLock autoFocus={true}>\n <Calendar\n selectedDate={memoizedDate('value', selectedDate)}\n displayedDate={memoizedDate('displayed', displayedDate)}\n locale={normalizedLocale}\n startOfWeek={startOfWeek}\n isDateEnabled={isDateEnabled ? isDateEnabled : () => true}\n nextMonthLabel={nextMonthAriaLabel}\n previousMonthLabel={previousMonthAriaLabel}\n todayAriaLabel={todayAriaLabel}\n onChangeMonth={onChangeMonthHandler}\n onSelectDate={e => {\n onSelectDateHandler(e);\n buttonRef?.current?.focus();\n setIsDropDownOpen(false);\n }}\n />\n </FocusLock>\n )}\n </Dropdown>\n </div>\n );\n }\n);\n\napplyDisplayName(DatePicker, 'DatePicker');\nexport default DatePicker;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAA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AAC,CAAC;oBACvB,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,0CAAE,KAAK,EAAE,CAAC;oBAC5B,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC,GACD,CACQ,CACb,CACQ,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useCallback, useRef, useState } from 'react';\nimport styles from './styles.css.js';\nimport { DatePickerProps } from './interfaces';\nimport Calendar from './calendar';\nimport { normalizeLocale } from './calendar/utils/locales';\nimport { getDateLabel } from './calendar/utils/intl';\nimport { memoizedDate } from './calendar/utils/date';\nimport { InputProps } from '../input/interfaces';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Dropdown from '../internal/components/dropdown';\nimport DateInput from '../internal/components/date-input';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name.js';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker.js';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport FocusLock from '../internal/components/focus-lock';\nimport { useDatePicker } from './use-date-picker.js';\n\nexport { DatePickerProps };\n\nconst DatePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n todayAriaLabel,\n placeholder = '',\n value = '',\n readOnly = false,\n disabled = false,\n onBlur,\n autoFocus = false,\n onChange,\n onFocus,\n name,\n ariaLabel,\n ariaRequired,\n ariaLabelledby,\n ariaDescribedby,\n controlId,\n invalid,\n openCalendarAriaLabel,\n expandToViewport,\n ...rest\n }: DatePickerProps,\n ref: Ref<DatePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DatePicker');\n\n const {\n defaultDisplayedDate,\n displayedDate,\n setDisplayedDate,\n selectedDate,\n onChangeMonthHandler,\n onSelectDateHandler,\n } = useDatePicker({\n value,\n onChange,\n });\n\n const baseProps = getBaseProps(rest);\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n const normalizedLocale = normalizeLocale('DatePicker', locale ?? '');\n\n const internalInputRef = useRef<HTMLInputElement>(null);\n const buttonRef = useRef<ButtonProps.Ref>(null);\n useForwardFocus(ref, internalInputRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('calender');\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n useFocusTracker({ rootRef, onBlur, onFocus, viewportId: expandToViewport ? dropdownId : '' });\n\n const onDropdownCloseHandler = useCallback(() => {\n setDisplayedDate(defaultDisplayedDate);\n setIsDropDownOpen(false);\n }, [defaultDisplayedDate, setDisplayedDate, setIsDropDownOpen]);\n\n const onButtonClickHandler = () => {\n if (!isDropDownOpen) {\n setIsDropDownOpen(true);\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape && isDropDownOpen) {\n buttonRef.current?.focus();\n setIsDropDownOpen(false);\n }\n };\n\n const onInputChangeHandler: InputProps['onChange'] = event => {\n fireNonCancelableEvent(onChange, { value: event.detail.value });\n };\n\n const onInputBlurHandler: InputProps['onBlur'] = () => {\n if (!isDropDownOpen) {\n setDisplayedDate(defaultDisplayedDate);\n setIsDropDownOpen(false);\n }\n };\n\n const DateInputElement = (\n <div className={styles['date-picker-trigger']}>\n <div className={styles['date-picker-input']}>\n <DateInput\n name={name}\n invalid={invalid}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n value={value}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={isDropDownOpen}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onInputChangeHandler}\n onBlur={onInputBlurHandler}\n placeholder={placeholder}\n ref={internalInputRef}\n autoFocus={autoFocus}\n />\n </div>\n <div>\n <InternalButton\n iconName=\"calendar\"\n className={styles['open-calendar-button']}\n onClick={onButtonClickHandler}\n ref={buttonRef}\n ariaLabel={\n openCalendarAriaLabel &&\n openCalendarAriaLabel(\n value.length === 10 ? getDateLabel(normalizedLocale, memoizedDate('value', value)) : null\n )\n }\n disabled={disabled || readOnly}\n formAction=\"none\"\n />\n </div>\n </div>\n );\n\n baseProps.className = clsx(baseProps.className, styles.root, styles['date-picker-container']);\n\n if (readOnly || disabled) {\n return <div {...baseProps}>{DateInputElement}</div>;\n }\n\n checkControlled('DatePicker', 'value', value, 'onChange', onChange);\n\n const handleMouseDown = (event: React.MouseEvent) => {\n // prevent currently focused element from losing it\n event.preventDefault();\n };\n\n return (\n <div {...baseProps} ref={mergedRef} onKeyDown={onWrapperKeyDownHandler}>\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={onDropdownCloseHandler}\n onMouseDown={handleMouseDown}\n trigger={DateInputElement}\n expandToViewport={expandToViewport}\n scrollable={false}\n dropdownId={dropdownId}\n >\n {isDropDownOpen && (\n <FocusLock autoFocus={true}>\n <Calendar\n selectedDate={memoizedDate('value', selectedDate)}\n displayedDate={memoizedDate('displayed', displayedDate)}\n locale={normalizedLocale}\n startOfWeek={startOfWeek}\n isDateEnabled={isDateEnabled ? isDateEnabled : () => true}\n nextMonthLabel={nextMonthAriaLabel}\n previousMonthLabel={previousMonthAriaLabel}\n todayAriaLabel={todayAriaLabel}\n onChangeMonth={onChangeMonthHandler}\n onSelectDate={e => {\n onSelectDateHandler(e);\n buttonRef?.current?.focus();\n setIsDropDownOpen(false);\n }}\n />\n </FocusLock>\n )}\n </Dropdown>\n </div>\n );\n }\n);\n\napplyDisplayName(DatePicker, 'DatePicker');\nexport default DatePicker;\n"]}
|
|
@@ -91,7 +91,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
93
|
.awsui_calendar_145pa_5nj72_93:not(#\9) {
|
|
94
|
-
animation: awsui_awsui-motion-fade-in-0_145pa_5nj72_1 135ms ease-out;
|
|
95
94
|
animation: awsui_awsui-motion-fade-in-0_145pa_5nj72_1 var(--motion-duration-show-quick-tyaalm, 135ms) var(--motion-easing-show-quick-1fcgbv, ease-out);
|
|
96
95
|
animation-fill-mode: both;
|
|
97
96
|
}
|
|
@@ -148,14 +147,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
148
147
|
widows: 2;
|
|
149
148
|
word-spacing: normal;
|
|
150
149
|
box-sizing: border-box;
|
|
151
|
-
font-size: 14px;
|
|
152
150
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
153
|
-
line-height: 22px;
|
|
154
151
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
155
|
-
color: #16191f;
|
|
156
152
|
color: var(--color-text-body-default-7m2b3r, #16191f);
|
|
157
153
|
font-weight: 400;
|
|
158
|
-
font-family: "Noto Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
|
|
159
154
|
font-family: var(--font-family-base-mylvzb, "Noto Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
|
|
160
155
|
}
|
|
161
156
|
|
|
@@ -169,7 +164,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
169
164
|
}
|
|
170
165
|
|
|
171
166
|
.awsui_date-picker-input_145pa_5nj72_140:not(#\9) {
|
|
172
|
-
padding-right: 8px;
|
|
173
167
|
padding-right: var(--space-xs-rsr2qu, 8px);
|
|
174
168
|
width: 100%;
|
|
175
169
|
}
|
|
@@ -211,21 +205,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
211
205
|
widows: 2;
|
|
212
206
|
word-spacing: normal;
|
|
213
207
|
box-sizing: border-box;
|
|
214
|
-
font-size: 14px;
|
|
215
208
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
216
|
-
line-height: 22px;
|
|
217
209
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
218
|
-
color: #16191f;
|
|
219
210
|
color: var(--color-text-body-default-7m2b3r, #16191f);
|
|
220
211
|
font-weight: 400;
|
|
221
|
-
font-family: "Noto Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
|
|
222
212
|
font-family: var(--font-family-base-mylvzb, "Noto Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
|
|
223
213
|
}
|
|
224
214
|
.awsui_calendar_145pa_5nj72_93:not(#\9):focus {
|
|
225
215
|
outline: none;
|
|
226
216
|
}
|
|
227
217
|
.awsui_calendar-inner_145pa_5nj72_165:not(#\9) {
|
|
228
|
-
margin: 8px;
|
|
229
218
|
margin: var(--space-xs-rsr2qu, 8px);
|
|
230
219
|
}
|
|
231
220
|
.awsui_calendar-header_145pa_5nj72_168:not(#\9) {
|
|
@@ -234,12 +223,9 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
234
223
|
align-items: center;
|
|
235
224
|
}
|
|
236
225
|
.awsui_calendar-header-month_145pa_5nj72_173:not(#\9) {
|
|
237
|
-
font-size: 14px;
|
|
238
226
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
239
|
-
line-height: 22px;
|
|
240
227
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
241
228
|
font-weight: 700;
|
|
242
|
-
color: #16191f;
|
|
243
229
|
color: var(--color-text-dropdown-item-default-ki8ao1, #16191f);
|
|
244
230
|
}
|
|
245
231
|
.awsui_calendar-next-month-btn_145pa_5nj72_179:not(#\9) {
|
|
@@ -257,19 +243,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
257
243
|
width: 0;
|
|
258
244
|
word-break: break-word;
|
|
259
245
|
text-align: center;
|
|
260
|
-
padding: 12px 0 4px;
|
|
261
246
|
padding: var(--space-s-hv8c1d, 12px) 0 var(--space-xxs-ynfts5, 4px);
|
|
262
|
-
color: #545b64;
|
|
263
247
|
color: var(--color-text-calendar-month-cx7jxx, #545b64);
|
|
264
|
-
font-size: 12px;
|
|
265
248
|
font-size: var(--font-body-s-size-ukw2p9, 12px);
|
|
266
|
-
line-height: 16px;
|
|
267
249
|
line-height: var(--font-body-s-line-height-kdsbrl, 16px);
|
|
268
|
-
letter-spacing: normal;
|
|
269
250
|
letter-spacing: var(--font-body-s-letter-spacing-p88gax, normal);
|
|
270
251
|
}
|
|
271
252
|
.awsui_calendar-dates_145pa_5nj72_200:not(#\9) {
|
|
272
|
-
border: 1px solid #eaeded;
|
|
273
253
|
border: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
274
254
|
}
|
|
275
255
|
.awsui_calendar-week_145pa_5nj72_203:not(#\9) {
|
|
@@ -281,15 +261,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
281
261
|
width: 0;
|
|
282
262
|
word-break: break-word;
|
|
283
263
|
text-align: center;
|
|
284
|
-
border-bottom: 1px solid #eaeded;
|
|
285
264
|
border-bottom: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
286
|
-
border-right: 1px solid #eaeded;
|
|
287
265
|
border-right: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
288
|
-
border-radius: 0px;
|
|
289
266
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
290
|
-
padding: 4px 0;
|
|
291
267
|
padding: var(--space-xxs-ynfts5, 4px) 0;
|
|
292
|
-
color: #aab7b8;
|
|
293
268
|
color: var(--color-text-dropdown-item-disabled-dgi2f4, #aab7b8);
|
|
294
269
|
position: relative;
|
|
295
270
|
}
|
|
@@ -304,27 +279,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
304
279
|
}
|
|
305
280
|
.awsui_calendar-day-enabled_145pa_5nj72_228:not(#\9) {
|
|
306
281
|
cursor: pointer;
|
|
307
|
-
color: #687078;
|
|
308
282
|
color: var(--color-text-dropdown-item-secondary-8hw5go, #687078);
|
|
309
283
|
}
|
|
310
284
|
.awsui_calendar-day-enabled_145pa_5nj72_228.awsui_calendar-day-current-month_145pa_5nj72_232:not(#\9) {
|
|
311
|
-
color: #16191f;
|
|
312
285
|
color: var(--color-text-dropdown-item-default-ki8ao1, #16191f);
|
|
313
286
|
}
|
|
314
287
|
.awsui_calendar-day-enabled_145pa_5nj72_228.awsui_calendar-day-current-month_145pa_5nj72_232:not(#\9):hover {
|
|
315
|
-
color: #16191f;
|
|
316
288
|
color: var(--color-text-calendar-day-hover-p7s945, #16191f);
|
|
317
|
-
background-color: #f2f3f3;
|
|
318
289
|
background-color: var(--color-background-dropdown-item-hover-hgdj8r, #f2f3f3);
|
|
319
290
|
}
|
|
320
291
|
.awsui_calendar-day-enabled_145pa_5nj72_228.awsui_calendar-day-current-month_145pa_5nj72_232:not(#\9):hover:not(.awsui_calendar-day-selected_145pa_5nj72_239)::after {
|
|
321
|
-
border: 1px solid #879596;
|
|
322
292
|
border: var(--border-item-width-yvnixs, 1px) solid var(--color-border-dropdown-item-hover-d32f3f, #879596);
|
|
323
|
-
border-radius: 0px;
|
|
324
293
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
325
294
|
}
|
|
326
295
|
.awsui_calendar-day-today_145pa_5nj72_243:not(#\9) {
|
|
327
|
-
background-color: #f2f3f3;
|
|
328
296
|
background-color: var(--color-background-calendar-today-wm2baz, #f2f3f3);
|
|
329
297
|
}
|
|
330
298
|
.awsui_calendar-day_145pa_5nj72_185:not(#\9)::after {
|
|
@@ -346,24 +314,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
346
314
|
}
|
|
347
315
|
.awsui_calendar-day_145pa_5nj72_185:not(#\9):focus {
|
|
348
316
|
outline: 2px dotted transparent;
|
|
349
|
-
outline-offset: calc(0px - 1px);
|
|
350
317
|
outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px) - 1px);
|
|
351
318
|
}
|
|
352
319
|
.awsui_calendar-day_145pa_5nj72_185:not(#\9):focus::before {
|
|
353
320
|
content: " ";
|
|
354
321
|
display: block;
|
|
355
322
|
position: absolute;
|
|
356
|
-
left: calc(-1 * 0px);
|
|
357
323
|
left: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
358
|
-
top: calc(-1 * 0px);
|
|
359
324
|
top: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
360
|
-
width: calc(100% + 2 * 0px);
|
|
361
325
|
width: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
362
|
-
height: calc(100% + 2 * 0px);
|
|
363
326
|
height: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
364
|
-
border-radius: 2px;
|
|
365
327
|
border-radius: var(--border-radius-calendar-day-focus-ring-16ha5s, 2px);
|
|
366
|
-
box-shadow: 0 0 0 2px #0073bb;
|
|
367
328
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-n5kd8g, #0073bb);
|
|
368
329
|
}
|
|
369
330
|
.awsui_calendar-day_145pa_5nj72_185:not(#\9):focus::before {
|
|
@@ -374,23 +335,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
374
335
|
position: relative;
|
|
375
336
|
}
|
|
376
337
|
.awsui_calendar-day-selected_145pa_5nj72_239:not(#\9)::after {
|
|
377
|
-
background-color: #f1faff;
|
|
378
338
|
background-color: var(--color-background-dropdown-item-selected-w7iegd, #f1faff);
|
|
379
|
-
border: 1px solid #00a1c9;
|
|
380
339
|
border: var(--border-item-width-yvnixs, 1px) solid var(--color-border-dropdown-item-selected-bzuxys, #00a1c9);
|
|
381
|
-
border-radius: 0px;
|
|
382
340
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
383
341
|
}
|
|
384
342
|
.awsui_calendar-day-selected_145pa_5nj72_239 > .awsui_day-inner_145pa_5nj72_255:not(#\9) {
|
|
385
|
-
color: #16191f;
|
|
386
343
|
color: var(--color-text-calendar-day-selected-fr68ny, #16191f);
|
|
387
344
|
position: relative;
|
|
388
345
|
}
|
|
389
346
|
.awsui_calendar_145pa_5nj72_93[data-awsui-focus-visible=true]:not(#\9):focus {
|
|
390
347
|
outline: 2px dotted transparent;
|
|
391
348
|
outline-offset: 2px;
|
|
392
|
-
border-radius: 0px;
|
|
393
349
|
border-radius: var(--border-radius-container-1aveko, 0px);
|
|
394
|
-
box-shadow: 0 0 0 2px #0073bb;
|
|
395
350
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-n5kd8g, #0073bb);
|
|
396
351
|
}
|
|
@@ -95,13 +95,9 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
95
95
|
width: 0;
|
|
96
96
|
word-break: break-word;
|
|
97
97
|
text-align: center;
|
|
98
|
-
border-bottom: 1px solid #eaeded;
|
|
99
98
|
border-bottom: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
100
|
-
border-right: 1px solid #eaeded;
|
|
101
99
|
border-right: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
102
|
-
padding: 4px 0;
|
|
103
100
|
padding: var(--space-xxs-ynfts5, 4px) 0;
|
|
104
|
-
color: #aab7b8;
|
|
105
101
|
color: var(--color-text-dropdown-item-disabled-dgi2f4, #aab7b8);
|
|
106
102
|
position: relative;
|
|
107
103
|
}
|
|
@@ -112,11 +108,9 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
112
108
|
content: "";
|
|
113
109
|
position: absolute;
|
|
114
110
|
z-index: 1;
|
|
115
|
-
top: calc(-1 * 1px);
|
|
116
111
|
top: calc(-1 * var(--border-item-width-yvnixs, 1px));
|
|
117
112
|
left: -1px;
|
|
118
113
|
bottom: -1px;
|
|
119
|
-
right: calc(-1 * 1px);
|
|
120
114
|
right: calc(-1 * var(--border-item-width-yvnixs, 1px));
|
|
121
115
|
background-color: transparent;
|
|
122
116
|
}
|
|
@@ -130,29 +124,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
130
124
|
}
|
|
131
125
|
.awsui_day_vci2l_14yn9_93[data-awsui-focus-visible=true]:not(#\9):focus {
|
|
132
126
|
outline: 2px dotted transparent;
|
|
133
|
-
outline-offset: calc(0px - 1px);
|
|
134
127
|
outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px) - 1px);
|
|
135
128
|
}
|
|
136
129
|
.awsui_day_vci2l_14yn9_93[data-awsui-focus-visible=true]:not(#\9):focus::before {
|
|
137
130
|
content: " ";
|
|
138
131
|
display: block;
|
|
139
132
|
position: absolute;
|
|
140
|
-
left: calc(-1 * 0px);
|
|
141
133
|
left: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
142
|
-
top: calc(-1 * 0px);
|
|
143
134
|
top: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
144
|
-
width: calc(100% + 2 * 0px);
|
|
145
135
|
width: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
146
|
-
height: calc(100% + 2 * 0px);
|
|
147
136
|
height: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
|
|
148
|
-
border-radius: 2px;
|
|
149
137
|
border-radius: var(--border-radius-calendar-day-focus-ring-16ha5s, 2px);
|
|
150
|
-
box-shadow: 0 0 0 2px #0073bb;
|
|
151
138
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-n5kd8g, #0073bb);
|
|
152
139
|
}
|
|
153
140
|
|
|
154
141
|
.awsui_in-first-row_vci2l_14yn9_141:not(#\9):not(.awsui_in-previous-month_vci2l_14yn9_141) {
|
|
155
|
-
border-top: 1px solid #eaeded;
|
|
156
142
|
border-top: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
157
143
|
}
|
|
158
144
|
|
|
@@ -168,7 +154,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
168
154
|
border-left: 1px solid transparent;
|
|
169
155
|
}
|
|
170
156
|
.awsui_in-first-column_vci2l_14yn9_153.awsui_in-current-month_vci2l_14yn9_156:not(#\9) {
|
|
171
|
-
border-left: 1px solid #eaeded;
|
|
172
157
|
border-left: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
|
|
173
158
|
}
|
|
174
159
|
|
|
@@ -176,28 +161,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
176
161
|
cursor: pointer;
|
|
177
162
|
}
|
|
178
163
|
.awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156:not(#\9) {
|
|
179
|
-
color: #16191f;
|
|
180
164
|
color: var(--color-text-dropdown-item-default-ki8ao1, #16191f);
|
|
181
165
|
}
|
|
182
166
|
.awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156:not(#\9):not(.awsui_in-range_vci2l_14yn9_166), .awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156:not(#\9):not(.awsui_in-range_vci2l_14yn9_166)::after, .awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156.awsui_end-date_vci2l_14yn9_166.awsui_start-date_vci2l_14yn9_166:not(#\9), .awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156.awsui_end-date_vci2l_14yn9_166.awsui_start-date_vci2l_14yn9_166:not(#\9)::after, .awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156.awsui_no-range_vci2l_14yn9_166:not(#\9), .awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156.awsui_no-range_vci2l_14yn9_166:not(#\9)::after {
|
|
183
|
-
border-radius: 0px;
|
|
184
167
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
185
168
|
}
|
|
186
169
|
.awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156:not(#\9):hover {
|
|
187
|
-
color: #16191f;
|
|
188
170
|
color: var(--color-text-calendar-day-hover-p7s945, #16191f);
|
|
189
|
-
background-color: #f2f3f3;
|
|
190
171
|
background-color: var(--color-background-dropdown-item-hover-hgdj8r, #f2f3f3);
|
|
191
172
|
}
|
|
192
173
|
.awsui_enabled_vci2l_14yn9_160.awsui_in-current-month_vci2l_14yn9_156:not(#\9):hover:not(.awsui_selected_vci2l_14yn9_173)::after {
|
|
193
|
-
border: 1px solid #879596;
|
|
194
174
|
border: var(--border-item-width-yvnixs, 1px) solid var(--color-border-dropdown-item-hover-d32f3f, #879596);
|
|
195
175
|
}
|
|
196
176
|
|
|
197
177
|
.awsui_today_vci2l_14yn9_177:not(#\9):not(.awsui_in-range_vci2l_14yn9_166) {
|
|
198
|
-
background-color: #f2f3f3;
|
|
199
178
|
background-color: var(--color-background-calendar-today-wm2baz, #f2f3f3);
|
|
200
|
-
border-radius: 0px;
|
|
201
179
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
202
180
|
}
|
|
203
181
|
|
|
@@ -211,92 +189,69 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
211
189
|
}
|
|
212
190
|
.awsui_selected_vci2l_14yn9_173[data-awsui-focus-visible=true]:not(#\9):focus {
|
|
213
191
|
outline: 2px dotted transparent;
|
|
214
|
-
outline-offset: calc(2px - 1px);
|
|
215
192
|
outline-offset: calc(var(--space-calendar-grid-selected-focus-outline-gutter-s5ollf, 2px) - 1px);
|
|
216
193
|
}
|
|
217
194
|
.awsui_selected_vci2l_14yn9_173[data-awsui-focus-visible=true]:not(#\9):focus::before {
|
|
218
195
|
content: " ";
|
|
219
196
|
display: block;
|
|
220
197
|
position: absolute;
|
|
221
|
-
left: calc(-1 * 2px);
|
|
222
198
|
left: calc(-1 * var(--space-calendar-grid-selected-focus-outline-gutter-s5ollf, 2px));
|
|
223
|
-
top: calc(-1 * 2px);
|
|
224
199
|
top: calc(-1 * var(--space-calendar-grid-selected-focus-outline-gutter-s5ollf, 2px));
|
|
225
|
-
width: calc(100% + 2 * 2px);
|
|
226
200
|
width: calc(100% + 2 * var(--space-calendar-grid-selected-focus-outline-gutter-s5ollf, 2px));
|
|
227
|
-
height: calc(100% + 2 * 2px);
|
|
228
201
|
height: calc(100% + 2 * var(--space-calendar-grid-selected-focus-outline-gutter-s5ollf, 2px));
|
|
229
|
-
border-radius: 2px;
|
|
230
202
|
border-radius: var(--border-radius-calendar-day-focus-ring-16ha5s, 2px);
|
|
231
|
-
box-shadow: 0 0 0 2px #0073bb;
|
|
232
203
|
box-shadow: 0 0 0 2px var(--color-border-calendar-grid-selected-focus-ring-vzbqhb, #0073bb);
|
|
233
204
|
}
|
|
234
205
|
.awsui_selected_vci2l_14yn9_173[data-awsui-focus-visible=true]:not(#\9):focus::before {
|
|
235
206
|
z-index: 1;
|
|
236
207
|
}
|
|
237
208
|
.awsui_selected_vci2l_14yn9_173:not(#\9)::after {
|
|
238
|
-
background-color: #0073bb;
|
|
239
209
|
background-color: var(--color-background-control-checked-dyuc53, #0073bb);
|
|
240
|
-
border: 1px solid #0073bb;
|
|
241
210
|
border: var(--border-item-width-yvnixs, 1px) solid var(--color-background-control-checked-dyuc53, #0073bb);
|
|
242
211
|
z-index: 0;
|
|
243
212
|
}
|
|
244
213
|
.awsui_selected_vci2l_14yn9_173.awsui_start-date_vci2l_14yn9_166:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_start-date_vci2l_14yn9_166:not(#\9)::after, .awsui_selected_vci2l_14yn9_173.awsui_range-start-date_vci2l_14yn9_213:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_range-start-date_vci2l_14yn9_213:not(#\9)::after {
|
|
245
|
-
border-top-left-radius: 0px;
|
|
246
214
|
border-top-left-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
247
215
|
}
|
|
248
216
|
.awsui_selected_vci2l_14yn9_173.awsui_start-date_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_start-date_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216:not(#\9)::after, .awsui_selected_vci2l_14yn9_173.awsui_range-start-date_vci2l_14yn9_213.awsui_in-range-border-bottom_vci2l_14yn9_216:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_range-start-date_vci2l_14yn9_213.awsui_in-range-border-bottom_vci2l_14yn9_216:not(#\9)::after {
|
|
249
|
-
border-bottom-left-radius: 0px;
|
|
250
217
|
border-bottom-left-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
251
218
|
}
|
|
252
219
|
.awsui_selected_vci2l_14yn9_173.awsui_end-date_vci2l_14yn9_166:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_end-date_vci2l_14yn9_166:not(#\9)::after, .awsui_selected_vci2l_14yn9_173.awsui_range-end-date_vci2l_14yn9_219:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_range-end-date_vci2l_14yn9_219:not(#\9)::after {
|
|
253
|
-
border-bottom-right-radius: 0px;
|
|
254
220
|
border-bottom-right-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
255
221
|
}
|
|
256
222
|
.awsui_selected_vci2l_14yn9_173.awsui_end-date_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_end-date_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222:not(#\9)::after, .awsui_selected_vci2l_14yn9_173.awsui_range-end-date_vci2l_14yn9_219.awsui_in-range-border-top_vci2l_14yn9_222:not(#\9), .awsui_selected_vci2l_14yn9_173.awsui_range-end-date_vci2l_14yn9_219.awsui_in-range-border-top_vci2l_14yn9_222:not(#\9)::after {
|
|
257
|
-
border-top-right-radius: 0px;
|
|
258
223
|
border-top-right-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
259
224
|
}
|
|
260
225
|
.awsui_selected_vci2l_14yn9_173 > .awsui_day-inner_vci2l_14yn9_117:not(#\9) {
|
|
261
|
-
color: #ffffff;
|
|
262
226
|
color: var(--color-background-control-default-8xmy94, #ffffff);
|
|
263
227
|
position: relative;
|
|
264
228
|
z-index: 2;
|
|
265
229
|
}
|
|
266
230
|
|
|
267
231
|
.awsui_in-range_vci2l_14yn9_166:not(#\9) {
|
|
268
|
-
background-color: #f1faff;
|
|
269
232
|
background-color: var(--color-background-dropdown-item-selected-w7iegd, #f1faff);
|
|
270
233
|
}
|
|
271
234
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222:not(#\9)::after {
|
|
272
|
-
border-top: 1px solid #0073bb;
|
|
273
235
|
border-top: var(--border-item-width-yvnixs, 1px) solid var(--color-background-control-checked-dyuc53, #0073bb);
|
|
274
236
|
}
|
|
275
237
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-right_vci2l_14yn9_237:not(#\9)::after {
|
|
276
|
-
border-right: 1px solid #0073bb;
|
|
277
238
|
border-right: var(--border-item-width-yvnixs, 1px) solid var(--color-background-control-checked-dyuc53, #0073bb);
|
|
278
239
|
}
|
|
279
240
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216:not(#\9)::after {
|
|
280
|
-
border-bottom: 1px solid #0073bb;
|
|
281
241
|
border-bottom: var(--border-item-width-yvnixs, 1px) solid var(--color-background-control-checked-dyuc53, #0073bb);
|
|
282
242
|
}
|
|
283
243
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-left_vci2l_14yn9_243:not(#\9)::after {
|
|
284
|
-
border-left: 1px solid #0073bb;
|
|
285
244
|
border-left: var(--border-item-width-yvnixs, 1px) solid var(--color-background-control-checked-dyuc53, #0073bb);
|
|
286
245
|
}
|
|
287
246
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222.awsui_in-range-border-right_vci2l_14yn9_237:not(#\9), .awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222.awsui_in-range-border-right_vci2l_14yn9_237:not(#\9)::after {
|
|
288
|
-
border-top-right-radius: 0px;
|
|
289
247
|
border-top-right-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
290
248
|
}
|
|
291
249
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216.awsui_in-range-border-right_vci2l_14yn9_237:not(#\9), .awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216.awsui_in-range-border-right_vci2l_14yn9_237:not(#\9)::after {
|
|
292
|
-
border-bottom-right-radius: 0px;
|
|
293
250
|
border-bottom-right-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
294
251
|
}
|
|
295
252
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216.awsui_in-range-border-left_vci2l_14yn9_243:not(#\9), .awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-bottom_vci2l_14yn9_216.awsui_in-range-border-left_vci2l_14yn9_243:not(#\9)::after {
|
|
296
|
-
border-bottom-left-radius: 0px;
|
|
297
253
|
border-bottom-left-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
298
254
|
}
|
|
299
255
|
.awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222.awsui_in-range-border-left_vci2l_14yn9_243:not(#\9), .awsui_in-range_vci2l_14yn9_166.awsui_in-range-border-top_vci2l_14yn9_222.awsui_in-range-border-left_vci2l_14yn9_243:not(#\9)::after {
|
|
300
|
-
border-top-left-radius: 0px;
|
|
301
256
|
border-top-left-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
302
257
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuE,MAAM,OAAO,CAAC;AAG5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuE,MAAM,OAAO,CAAC;AAG5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAchE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAS7D,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAMjD,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,oBAAoB,CAAC,qBAAqB,CAAC;IAC1D,iBAAiB,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,aAAa,KAAK,IAAI,CAAC;IACvE,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC;IACvC,YAAY,EAAE,OAAO,CAAC;CACvB;;AAED,wBAAoC"}
|
|
@@ -6,7 +6,7 @@ import styles from '../styles.css.js';
|
|
|
6
6
|
import CalendarHeader from './header';
|
|
7
7
|
import { Grids, selectFocusedDate } from './grids';
|
|
8
8
|
import moveFocusHandler from '../../date-picker/calendar/utils/move-focus-handler';
|
|
9
|
-
import {
|
|
9
|
+
import { formatDate, formatTime, formatISOStringWithoutTimezone, parseDate, } from '../../date-picker/calendar/utils/date';
|
|
10
10
|
import InternalSpaceBetween from '../../space-between/internal';
|
|
11
11
|
import InternalFormField from '../../form-field/internal';
|
|
12
12
|
import DateInput from '../../internal/components/date-input';
|
|
@@ -183,16 +183,14 @@ function Calendar(_a, ref) {
|
|
|
183
183
|
setFocusedDate(newBaseDate);
|
|
184
184
|
};
|
|
185
185
|
var onChangeStartDate = function (e) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
var newCurrentMonth = startOfMonth(parseDate(isoDateString));
|
|
186
|
+
setStartDateString(e.detail.value);
|
|
187
|
+
if (e.detail.value.length >= 8) {
|
|
188
|
+
var newCurrentMonth = startOfMonth(parseDate(e.detail.value));
|
|
190
189
|
setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));
|
|
191
190
|
}
|
|
192
191
|
};
|
|
193
192
|
var onChangeEndDate = function (e) {
|
|
194
|
-
|
|
195
|
-
setEndDateString(isoDateString);
|
|
193
|
+
setEndDateString(e.detail.value);
|
|
196
194
|
};
|
|
197
195
|
var constrainttextId = useUniqueId('awsui-area-date-range-picker');
|
|
198
196
|
constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';
|
|
@@ -208,14 +206,14 @@ function Calendar(_a, ref) {
|
|
|
208
206
|
React.createElement("div", { className: styles['date-and-time-wrapper'] },
|
|
209
207
|
React.createElement("div", { className: styles['date-and-time-wrapper__date'] },
|
|
210
208
|
React.createElement(InternalFormField, { label: i18nStrings.startDateLabel, stretch: true },
|
|
211
|
-
React.createElement(DateInput, { value:
|
|
209
|
+
React.createElement(DateInput, { value: startDateString, autoComplete: false, disableBrowserAutocorrect: true, disableAutocompleteOnBlur: false, className: styles['start-date-input'], onChange: onChangeStartDate, placeholder: "YYYY/MM/DD", ariaDescribedby: constrainttextId }))),
|
|
212
210
|
!dateOnly && (React.createElement("div", { className: styles['date-and-time-wrapper__time'] },
|
|
213
211
|
React.createElement(InternalFormField, { label: i18nStrings.startTimeLabel, stretch: true },
|
|
214
212
|
React.createElement(InternalTimeInput, { value: startTimeString, onChange: function (e) { return setStartTimeString(e.detail.value); }, format: timeInputFormat, placeholder: timeInputFormat, className: styles['start-time-input'], ariaDescribedby: constrainttextId }))))),
|
|
215
213
|
React.createElement("div", { className: styles['date-and-time-wrapper'] },
|
|
216
214
|
React.createElement("div", { className: styles['date-and-time-wrapper__date'] },
|
|
217
215
|
React.createElement(InternalFormField, { label: i18nStrings.endDateLabel, stretch: true },
|
|
218
|
-
React.createElement(DateInput, { value:
|
|
216
|
+
React.createElement(DateInput, { value: endDateString, autoComplete: false, disableBrowserAutocorrect: true, disableAutocompleteOnBlur: false, className: styles['end-date-input'], onChange: onChangeEndDate, placeholder: "YYYY/MM/DD", ariaDescribedby: constrainttextId }))),
|
|
219
217
|
!dateOnly && (React.createElement("div", { className: styles['date-and-time-wrapper__time'] },
|
|
220
218
|
React.createElement(InternalFormField, { label: i18nStrings.endTimeLabel, stretch: true },
|
|
221
219
|
React.createElement(InternalTimeInput, { value: endTimeString, onChange: function (e) { return setEndTimeString(e.detail.value); }, format: timeInputFormat, placeholder: timeInputFormat, className: styles['end-time-input'], ariaDescribedby: constrainttextId })))))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACzG,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAGtC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,gBAAgB,MAAM,qDAAqD,CAAC;AACnF,OAAO,EACL,YAAY,EACZ,UAAU,EACV,UAAU,EACV,8BAA8B,EAC9B,YAAY,EACZ,SAAS,GACV,MAAM,uCAAuC,CAAC;AAC/C,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAE1D,OAAO,SAAS,MAAM,sCAAsC,CAAC;AAE7D,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,U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;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSameMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { DateRangePickerProps, Focusable } from '../interfaces';\nimport CalendarHeader from './header';\nimport { Grids, selectFocusedDate } from './grids';\nimport moveFocusHandler from '../../date-picker/calendar/utils/move-focus-handler';\nimport {\n displayToIso,\n formatDate,\n formatTime,\n formatISOStringWithoutTimezone,\n isoToDisplay,\n parseDate,\n} from '../../date-picker/calendar/utils/date';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { InputProps } from '../../input/interfaces';\nimport DateInput from '../../internal/components/date-input';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport clsx from 'clsx';\nimport { getBaseDate } from './get-base-date.js';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { getDateLabel, renderTimeLabel } from '../../date-picker/calendar/utils/intl';\nimport LiveRegion from '../../internal/components/live-region';\nimport { normalizeStartOfWeek } from '../../date-picker/calendar/utils/locales';\n\nexport interface DateChangeHandler {\n (detail: Date): void;\n}\n\nexport interface MonthChangeHandler {\n (newMonth: Date): void;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface HeaderChangeMonthHandler {\n (isPreviousButtonClick?: boolean): void;\n}\n\nexport interface CalendarProps extends BaseComponentProps {\n locale: string;\n startOfWeek: number | undefined;\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n onSelectDateRange: (value: DateRangePickerProps.AbsoluteValue) => void;\n initialStartDate: string | undefined;\n initialEndDate: string | undefined;\n i18nStrings: DateRangePickerProps.I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n isSingleGrid: boolean;\n}\n\nexport default forwardRef(Calendar);\n\nfunction Calendar(\n {\n locale,\n startOfWeek,\n isDateEnabled,\n onSelectDateRange,\n initialEndDate = '',\n initialStartDate = '',\n i18nStrings,\n dateOnly,\n isSingleGrid,\n timeInputFormat,\n }: CalendarProps,\n ref: React.Ref<Focusable>\n) {\n const elementRef = useRef<HTMLDivElement>(null);\n\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n\n useImperativeHandle(ref, () => ({\n focus() {\n if (elementRef.current) {\n const prevButton = elementRef.current.getElementsByClassName(styles['calendar-prev-month-btn'])[0];\n (prevButton as undefined | HTMLButtonElement)?.focus();\n }\n },\n }));\n\n const [initialStartDateString = '', initialStartTimeString = ''] = initialStartDate.split('T');\n const [initialEndDateString = '', initialEndTimeString = ''] = initialEndDate.split('T');\n\n const [startDateString, setStartDateString] = useState(initialStartDateString);\n const [startTimeString, setStartTimeString] = useState(initialStartTimeString);\n\n const [endDateString, setEndDateString] = useState(initialEndDateString);\n const [endTimeString, setEndTimeString] = useState(initialEndTimeString);\n\n const selectedStartDate = parseDate(startDateString, true);\n const selectedEndDate = parseDate(endDateString, true);\n\n const [announcement, setAnnouncement] = useState('');\n\n const [currentMonth, setCurrentMonth] = useState(() => {\n if (startDateString) {\n const startDate = parseDate(startDateString);\n if (isSingleGrid) {\n return startOfMonth(startDate);\n }\n return startOfMonth(addMonths(startDate, 1));\n }\n if (endDateString) {\n return startOfMonth(parseDate(endDateString));\n }\n return startOfMonth(Date.now());\n });\n\n const [focusedDate, setFocusedDate] = useState<Date | null>(() => {\n if (selectedStartDate) {\n if (isSameMonth(selectedStartDate, currentMonth)) {\n return selectedStartDate;\n }\n if (!isSingleGrid && isSameMonth(selectedStartDate, addMonths(currentMonth, -1))) {\n return selectedStartDate;\n }\n }\n return selectFocusedDate(selectedStartDate, currentMonth, isDateEnabled);\n });\n\n useEffect(() => {\n // This effect \"synchronizes\" the local state update back up to the overall DateRangePicker component\n\n const startDate = formatISOStringWithoutTimezone(startDateString, startTimeString);\n const endDate = formatISOStringWithoutTimezone(endDateString, endTimeString);\n\n if (startDate !== initialStartDate || endDate !== initialEndDate) {\n onSelectDateRange({\n startDate,\n endDate,\n type: 'absolute',\n });\n }\n }, [\n startDateString,\n startTimeString,\n endDateString,\n endTimeString,\n onSelectDateRange,\n initialStartDate,\n initialEndDate,\n ]);\n\n const onSelectDateHandler = (selectedDate: Date) => {\n // recommended to include the start/end time announced with the selection\n // because the user is not aware of the fact that a start/end time is also set as soon as they select a date\n const announceStart = (startDate: Date) => {\n return (\n i18nStrings.startDateLabel +\n ', ' +\n getDateLabel(locale, startDate) +\n ', ' +\n i18nStrings.startTimeLabel +\n ', ' +\n renderTimeLabel(locale, startDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceEnd = (endDate: Date) => {\n return (\n i18nStrings.endDateLabel +\n ', ' +\n getDateLabel(locale, endDate) +\n ', ' +\n i18nStrings.endTimeLabel +\n ', ' +\n renderTimeLabel(locale, endDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceRange = (startDate: Date, endDate: Date) => {\n if (!i18nStrings.renderSelectedAbsoluteRangeAriaLive) {\n return `${getDateLabel(locale, startDate)} – ${getDateLabel(locale, endDate)}`;\n }\n return i18nStrings.renderSelectedAbsoluteRangeAriaLive(\n getDateLabel(locale, startDate),\n getDateLabel(locale, endDate)\n );\n };\n\n // If both fields are empty, we set the start date\n if (!startDateString && !endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If both fields are set, we start new\n if (startDateString && endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString('');\n setEndTimeString('');\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If only the END date is empty, we fill it (and swap dates if needed)\n if (startDateString && !endDateString) {\n const parsedStartDate = parseDate(startDateString);\n\n if (isBefore(selectedDate, parsedStartDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(selectedDate);\n const endDate = endOfDay(parsedStartDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, endDate));\n } else {\n const endDate = endOfDay(selectedDate);\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(parsedStartDate, endDate));\n }\n return;\n }\n\n // If only the START date is empty, we fill it (and swap dates if needed)\n if (!startDateString && endDateString) {\n const existingEndDate = parseDate(endDateString);\n\n if (isAfter(selectedDate, existingEndDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(existingEndDate);\n const endDate = endOfDay(selectedDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(startDate, endDate));\n } else {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, existingEndDate));\n }\n return;\n }\n // All possible conditions are covered above\n };\n\n const onHeaderChangeMonthHandler: HeaderChangeMonthHandler = isPrevious => {\n const newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);\n setCurrentMonth(newCurrentMonth);\n\n const newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);\n const newBaseDate = getBaseDate(newBaseDateMonth, 1, isDateEnabled);\n setFocusedDate(newBaseDate);\n };\n\n const onChangeStartDate: InputProps['onChange'] = e => {\n const isoDateString = displayToIso(e.detail.value);\n setStartDateString(isoDateString);\n\n if (isoDateString.length >= 8) {\n const newCurrentMonth = startOfMonth(parseDate(isoDateString));\n setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));\n }\n };\n\n const onChangeEndDate: InputProps['onChange'] = e => {\n const isoDateString = displayToIso(e.detail.value);\n setEndDateString(isoDateString);\n };\n\n let constrainttextId = useUniqueId('awsui-area-date-range-picker');\n constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';\n\n return (\n <>\n <InternalSpaceBetween size=\"m\">\n <div\n className={clsx(styles.calendar, {\n [styles['one-grid']]: isSingleGrid,\n })}\n role=\"application\"\n ref={elementRef}\n >\n <CalendarHeader\n baseDate={currentMonth}\n locale={locale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={i18nStrings.previousMonthAriaLabel}\n nextMonthLabel={i18nStrings.nextMonthAriaLabel}\n isSingleGrid={isSingleGrid}\n />\n\n <Grids\n isSingleGrid={isSingleGrid}\n locale={locale}\n baseDate={currentMonth}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n isDateEnabled={isDateEnabled}\n onSelectDate={onSelectDateHandler}\n onChangeMonth={setCurrentMonth}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={i18nStrings.todayAriaLabel}\n selectedStartDate={selectedStartDate}\n selectedEndDate={selectedEndDate}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxs\">\n <InternalSpaceBetween size=\"xs\" direction={isSingleGrid ? 'vertical' : 'horizontal'}>\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.startDateLabel} stretch={true}>\n <DateInput\n value={isoToDisplay(startDateString)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['start-date-input']}\n onChange={onChangeStartDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.startTimeLabel} stretch={true}>\n <InternalTimeInput\n value={startTimeString}\n onChange={e => setStartTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['start-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.endDateLabel} stretch={true}>\n <DateInput\n value={isoToDisplay(endDateString)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['end-date-input']}\n onChange={onChangeEndDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.endTimeLabel} stretch={true}>\n <InternalTimeInput\n value={endTimeString}\n onChange={e => setEndTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['end-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n </InternalSpaceBetween>\n {i18nStrings.dateTimeConstraintText && (\n <div className={styles['date-and-time-constrainttext']} id={constrainttextId}>\n {i18nStrings.dateTimeConstraintText}\n </div>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n <LiveRegion>\n <span className={styles['calendar-aria-live']}>{announcement}</span>\n </LiveRegion>\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,SAAS,EAA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AAC,KAAK,EAAE,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI;gCAC/D,oBAAC,iBAAiB,IAChB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,UAAA,CAAC,IAAI,OAAA,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAhC,CAAgC,EAC/C,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,eAAe,EAAE,gBAAgB,GACjC,CACgB,CAChB,CACP,CACG,CACe;gBACtB,WAAW,CAAC,sBAAsB,IAAI,CACrC,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,EAAE,EAAE,EAAE,gBAAgB,IACzE,WAAW,CAAC,sBAAsB,CAC/B,CACP,CACoB,CACF;QACvB,oBAAC,UAAU;YACT,8BAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,YAAY,CAAQ,CACzD,CACZ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSameMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { DateRangePickerProps, Focusable } from '../interfaces';\nimport CalendarHeader from './header';\nimport { Grids, selectFocusedDate } from './grids';\nimport moveFocusHandler from '../../date-picker/calendar/utils/move-focus-handler';\nimport {\n formatDate,\n formatTime,\n formatISOStringWithoutTimezone,\n parseDate,\n} from '../../date-picker/calendar/utils/date';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { InputProps } from '../../input/interfaces';\nimport DateInput from '../../internal/components/date-input';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport clsx from 'clsx';\nimport { getBaseDate } from './get-base-date.js';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { getDateLabel, renderTimeLabel } from '../../date-picker/calendar/utils/intl';\nimport LiveRegion from '../../internal/components/live-region';\nimport { normalizeStartOfWeek } from '../../date-picker/calendar/utils/locales';\n\nexport interface DateChangeHandler {\n (detail: Date): void;\n}\n\nexport interface MonthChangeHandler {\n (newMonth: Date): void;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface HeaderChangeMonthHandler {\n (isPreviousButtonClick?: boolean): void;\n}\n\nexport interface CalendarProps extends BaseComponentProps {\n locale: string;\n startOfWeek: number | undefined;\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n onSelectDateRange: (value: DateRangePickerProps.AbsoluteValue) => void;\n initialStartDate: string | undefined;\n initialEndDate: string | undefined;\n i18nStrings: DateRangePickerProps.I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n isSingleGrid: boolean;\n}\n\nexport default forwardRef(Calendar);\n\nfunction Calendar(\n {\n locale,\n startOfWeek,\n isDateEnabled,\n onSelectDateRange,\n initialEndDate = '',\n initialStartDate = '',\n i18nStrings,\n dateOnly,\n isSingleGrid,\n timeInputFormat,\n }: CalendarProps,\n ref: React.Ref<Focusable>\n) {\n const elementRef = useRef<HTMLDivElement>(null);\n\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n\n useImperativeHandle(ref, () => ({\n focus() {\n if (elementRef.current) {\n const prevButton = elementRef.current.getElementsByClassName(styles['calendar-prev-month-btn'])[0];\n (prevButton as undefined | HTMLButtonElement)?.focus();\n }\n },\n }));\n\n const [initialStartDateString = '', initialStartTimeString = ''] = initialStartDate.split('T');\n const [initialEndDateString = '', initialEndTimeString = ''] = initialEndDate.split('T');\n\n const [startDateString, setStartDateString] = useState(initialStartDateString);\n const [startTimeString, setStartTimeString] = useState(initialStartTimeString);\n\n const [endDateString, setEndDateString] = useState(initialEndDateString);\n const [endTimeString, setEndTimeString] = useState(initialEndTimeString);\n\n const selectedStartDate = parseDate(startDateString, true);\n const selectedEndDate = parseDate(endDateString, true);\n\n const [announcement, setAnnouncement] = useState('');\n\n const [currentMonth, setCurrentMonth] = useState(() => {\n if (startDateString) {\n const startDate = parseDate(startDateString);\n if (isSingleGrid) {\n return startOfMonth(startDate);\n }\n return startOfMonth(addMonths(startDate, 1));\n }\n if (endDateString) {\n return startOfMonth(parseDate(endDateString));\n }\n return startOfMonth(Date.now());\n });\n\n const [focusedDate, setFocusedDate] = useState<Date | null>(() => {\n if (selectedStartDate) {\n if (isSameMonth(selectedStartDate, currentMonth)) {\n return selectedStartDate;\n }\n if (!isSingleGrid && isSameMonth(selectedStartDate, addMonths(currentMonth, -1))) {\n return selectedStartDate;\n }\n }\n return selectFocusedDate(selectedStartDate, currentMonth, isDateEnabled);\n });\n\n useEffect(() => {\n // This effect \"synchronizes\" the local state update back up to the overall DateRangePicker component\n\n const startDate = formatISOStringWithoutTimezone(startDateString, startTimeString);\n const endDate = formatISOStringWithoutTimezone(endDateString, endTimeString);\n\n if (startDate !== initialStartDate || endDate !== initialEndDate) {\n onSelectDateRange({\n startDate,\n endDate,\n type: 'absolute',\n });\n }\n }, [\n startDateString,\n startTimeString,\n endDateString,\n endTimeString,\n onSelectDateRange,\n initialStartDate,\n initialEndDate,\n ]);\n\n const onSelectDateHandler = (selectedDate: Date) => {\n // recommended to include the start/end time announced with the selection\n // because the user is not aware of the fact that a start/end time is also set as soon as they select a date\n const announceStart = (startDate: Date) => {\n return (\n i18nStrings.startDateLabel +\n ', ' +\n getDateLabel(locale, startDate) +\n ', ' +\n i18nStrings.startTimeLabel +\n ', ' +\n renderTimeLabel(locale, startDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceEnd = (endDate: Date) => {\n return (\n i18nStrings.endDateLabel +\n ', ' +\n getDateLabel(locale, endDate) +\n ', ' +\n i18nStrings.endTimeLabel +\n ', ' +\n renderTimeLabel(locale, endDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceRange = (startDate: Date, endDate: Date) => {\n if (!i18nStrings.renderSelectedAbsoluteRangeAriaLive) {\n return `${getDateLabel(locale, startDate)} – ${getDateLabel(locale, endDate)}`;\n }\n return i18nStrings.renderSelectedAbsoluteRangeAriaLive(\n getDateLabel(locale, startDate),\n getDateLabel(locale, endDate)\n );\n };\n\n // If both fields are empty, we set the start date\n if (!startDateString && !endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If both fields are set, we start new\n if (startDateString && endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString('');\n setEndTimeString('');\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If only the END date is empty, we fill it (and swap dates if needed)\n if (startDateString && !endDateString) {\n const parsedStartDate = parseDate(startDateString);\n\n if (isBefore(selectedDate, parsedStartDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(selectedDate);\n const endDate = endOfDay(parsedStartDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, endDate));\n } else {\n const endDate = endOfDay(selectedDate);\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(parsedStartDate, endDate));\n }\n return;\n }\n\n // If only the START date is empty, we fill it (and swap dates if needed)\n if (!startDateString && endDateString) {\n const existingEndDate = parseDate(endDateString);\n\n if (isAfter(selectedDate, existingEndDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(existingEndDate);\n const endDate = endOfDay(selectedDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(startDate, endDate));\n } else {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, existingEndDate));\n }\n return;\n }\n // All possible conditions are covered above\n };\n\n const onHeaderChangeMonthHandler: HeaderChangeMonthHandler = isPrevious => {\n const newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);\n setCurrentMonth(newCurrentMonth);\n\n const newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);\n const newBaseDate = getBaseDate(newBaseDateMonth, 1, isDateEnabled);\n setFocusedDate(newBaseDate);\n };\n\n const onChangeStartDate: InputProps['onChange'] = e => {\n setStartDateString(e.detail.value);\n\n if (e.detail.value.length >= 8) {\n const newCurrentMonth = startOfMonth(parseDate(e.detail.value));\n setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));\n }\n };\n\n const onChangeEndDate: InputProps['onChange'] = e => {\n setEndDateString(e.detail.value);\n };\n\n let constrainttextId = useUniqueId('awsui-area-date-range-picker');\n constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';\n\n return (\n <>\n <InternalSpaceBetween size=\"m\">\n <div\n className={clsx(styles.calendar, {\n [styles['one-grid']]: isSingleGrid,\n })}\n role=\"application\"\n ref={elementRef}\n >\n <CalendarHeader\n baseDate={currentMonth}\n locale={locale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={i18nStrings.previousMonthAriaLabel}\n nextMonthLabel={i18nStrings.nextMonthAriaLabel}\n isSingleGrid={isSingleGrid}\n />\n\n <Grids\n isSingleGrid={isSingleGrid}\n locale={locale}\n baseDate={currentMonth}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n isDateEnabled={isDateEnabled}\n onSelectDate={onSelectDateHandler}\n onChangeMonth={setCurrentMonth}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={i18nStrings.todayAriaLabel}\n selectedStartDate={selectedStartDate}\n selectedEndDate={selectedEndDate}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxs\">\n <InternalSpaceBetween size=\"xs\" direction={isSingleGrid ? 'vertical' : 'horizontal'}>\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.startDateLabel} stretch={true}>\n <DateInput\n value={startDateString}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['start-date-input']}\n onChange={onChangeStartDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.startTimeLabel} stretch={true}>\n <InternalTimeInput\n value={startTimeString}\n onChange={e => setStartTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['start-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.endDateLabel} stretch={true}>\n <DateInput\n value={endDateString}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['end-date-input']}\n onChange={onChangeEndDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.endTimeLabel} stretch={true}>\n <InternalTimeInput\n value={endTimeString}\n onChange={e => setEndTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['end-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n </InternalSpaceBetween>\n {i18nStrings.dateTimeConstraintText && (\n <div className={styles['date-and-time-constrainttext']} id={constrainttextId}>\n {i18nStrings.dateTimeConstraintText}\n </div>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n <LiveRegion>\n <span className={styles['calendar-aria-live']}>{announcement}</span>\n </LiveRegion>\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAyBpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAyBpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AA0EhC,QAAA,MAAM,eAAe,uGAgMpB,CAAC;AAGF,eAAe,eAAe,CAAC"}
|