@react-spectrum/datepicker 3.13.0 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DateField.main.js +1 -1
- package/dist/DateField.mjs +1 -1
- package/dist/DateField.module.js +1 -1
- package/dist/DatePicker.main.js +4 -3
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +4 -3
- package/dist/DatePicker.module.js +4 -3
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/DatePickerField.main.js +1 -1
- package/dist/DatePickerField.main.js.map +1 -1
- package/dist/DatePickerField.mjs +1 -1
- package/dist/DatePickerField.module.js +1 -1
- package/dist/DatePickerField.module.js.map +1 -1
- package/dist/DatePickerSegment.main.js +1 -1
- package/dist/DatePickerSegment.main.js.map +1 -1
- package/dist/DatePickerSegment.mjs +1 -1
- package/dist/DatePickerSegment.module.js +1 -1
- package/dist/DatePickerSegment.module.js.map +1 -1
- package/dist/DateRangePicker.main.js +3 -2
- package/dist/DateRangePicker.main.js.map +1 -1
- package/dist/DateRangePicker.mjs +3 -2
- package/dist/DateRangePicker.module.js +3 -2
- package/dist/DateRangePicker.module.js.map +1 -1
- package/dist/Input.main.js +2 -2
- package/dist/Input.mjs +2 -2
- package/dist/Input.module.js +2 -2
- package/dist/TimeField.main.js +1 -1
- package/dist/TimeField.mjs +1 -1
- package/dist/TimeField.module.js +1 -1
- package/dist/{vars.ba84240a.css → datepicker.776a7787.css} +1 -1
- package/dist/{vars.ba84240a.css.map → datepicker.776a7787.css.map} +1 -1
- package/dist/{vars.fb8d1a6e.css → datepicker.c3193fb9.css} +1 -1
- package/dist/{vars.fb8d1a6e.css.map → datepicker.c3193fb9.css.map} +1 -1
- package/dist/{styles.cec10db3.css → datepicker.e85992d8.css} +1 -1
- package/dist/{styles.cec10db3.css.map → datepicker.e85992d8.css.map} +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js +2 -2
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +2 -2
- package/dist/utils.module.js +2 -2
- package/dist/utils.module.js.map +1 -1
- package/package.json +21 -21
- package/src/DatePicker.tsx +1 -0
- package/src/DatePickerField.tsx +2 -2
- package/src/DatePickerSegment.tsx +2 -2
- package/src/DateRangePicker.tsx +1 -0
- package/src/utils.tsx +8 -7
package/dist/DateField.main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var $edac158d20ebe4a9$exports = require("./DatePickerSegment.main.js");
|
|
2
|
-
require("./
|
|
2
|
+
require("./datepicker.e85992d8.css");
|
|
3
3
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
4
|
var $c3ebc4931d9b9977$exports = require("./Input.main.js");
|
|
5
5
|
var $9d3b96715dbbb2b7$exports = require("./utils.main.js");
|
package/dist/DateField.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.mjs";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $6iHxC$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
5
5
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormatHelpText as $ea94a5cfe92db3c2$export$322f4580ccd8dde6, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056} from "./utils.mjs";
|
package/dist/DateField.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.module.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $6iHxC$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.module.js";
|
|
5
5
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormatHelpText as $ea94a5cfe92db3c2$export$322f4580ccd8dde6, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056} from "./utils.module.js";
|
package/dist/DatePicker.main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var $bd22dc8dad9522bc$exports = require("./DatePickerField.main.js");
|
|
2
|
-
require("./
|
|
2
|
+
require("./datepicker.e85992d8.css");
|
|
3
3
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
4
|
var $c3ebc4931d9b9977$exports = require("./Input.main.js");
|
|
5
5
|
var $0045b32a117743a7$exports = require("./intlStrings.main.js");
|
|
6
|
-
require("./
|
|
6
|
+
require("./datepicker.776a7787.css");
|
|
7
7
|
require("./textfield_vars_css.main.js");
|
|
8
|
-
require("./
|
|
8
|
+
require("./datepicker.c3193fb9.css");
|
|
9
9
|
var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
|
|
10
10
|
var $740ff83729a8f317$exports = require("./TimeField.main.js");
|
|
11
11
|
var $9d3b96715dbbb2b7$exports = require("./utils.main.js");
|
|
@@ -175,6 +175,7 @@ const $5c1ddf85d7c27889$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
175
175
|
visibleMonths: visibleMonths,
|
|
176
176
|
pageBehavior: pageBehavior,
|
|
177
177
|
firstDayOfWeek: firstDayOfWeek,
|
|
178
|
+
createCalendar: props.createCalendar,
|
|
178
179
|
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-calendar', {
|
|
179
180
|
'is-invalid': isInvalid
|
|
180
181
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;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,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS;QACtB,UAAU,MAAM,YAAY;QAC5B,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,WAAU;;AAUhC","sources":["packages/@react-spectrum/datepicker/src/DatePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Calendar} from '@react-spectrum/calendar';\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useRef} from 'react';\nimport '@adobe/spectrum-css-temp/components/textfield/vars.css'; // HACK: must be included BEFORE inputgroup\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDatePicker} from '@react-aria/datepicker';\nimport {useDatePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isQuiet,\n isDisabled,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDatePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {groupProps, labelProps, fieldProps, descriptionProps, errorMessageProps, buttonProps, dialogProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDatePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n let approximateWidth = useFormattedDateWidth(state) + 'ch';\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...fieldProps}\n data-testid=\"date-field\"\n isQuiet={isQuiet} />\n </Input>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <Calendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />\n {showTimeField &&\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('time')}\n value={state.timeValue}\n onChange={state.setTimeValue}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n marginTop=\"size-100\" />\n </div>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"DatePicker.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AAiCM,MAAM,0DAAa,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,WAAgC,KAAiC,EAAE,GAA8B;IACnJ,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,aACF,SAAS,WACT,OAAO,cACP,UAAU,oBACV,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,kBACZ,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAyB;IAC9C,IAAI,QAAQ,CAAA,GAAA,gDAAiB,EAAE;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0DAAC,CAAA,GAAA,sCAAU;QACR,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,iBAAiB;QAC7C,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QACrC,SAAS;QACT,iBAAiB;qBACjB,0DAAC,CAAA,GAAA,8DAAW,yBAEd,0DAAC,CAAA,GAAA,iCAAK;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;QAAsC,GAAG,WAAW;qBACzG,0DAAC,CAAA,GAAA,gCAAM,uBACL,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC3C,0DAAC,CAAA,GAAA,qCAAO;QACL,GAAG,aAAa;QACjB,eAAe;QACf,cAAc;QACd,gBAAgB;QAChB,gBAAgB,MAAM,cAAc;QACpC,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;YAAC,cAAc;QAAS;QAC9G,+BACC,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC3C,0DAAC,CAAA,GAAA,mCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS;QACtB,UAAU,MAAM,YAAY;QAC5B,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,WAAU;;AAUhC","sources":["packages/@react-spectrum/datepicker/src/DatePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Calendar} from '@react-spectrum/calendar';\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useRef} from 'react';\nimport '@adobe/spectrum-css-temp/components/textfield/vars.css'; // HACK: must be included BEFORE inputgroup\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDatePicker} from '@react-aria/datepicker';\nimport {useDatePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isQuiet,\n isDisabled,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDatePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {groupProps, labelProps, fieldProps, descriptionProps, errorMessageProps, buttonProps, dialogProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDatePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n let approximateWidth = useFormattedDateWidth(state) + 'ch';\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...fieldProps}\n data-testid=\"date-field\"\n isQuiet={isQuiet} />\n </Input>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <Calendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n createCalendar={props.createCalendar}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />\n {showTimeField &&\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('time')}\n value={state.timeValue}\n onChange={state.setTimeValue}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n marginTop=\"size-100\" />\n </div>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"DatePicker.main.js.map"}
|
package/dist/DatePicker.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.mjs";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $8czI1$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
5
5
|
import $8czI1$intlStringsmodulejs from "./intlStrings.mjs";
|
|
6
|
-
import "./
|
|
6
|
+
import "./datepicker.776a7787.css";
|
|
7
7
|
import "./textfield_vars_css.mjs";
|
|
8
|
-
import "./
|
|
8
|
+
import "./datepicker.c3193fb9.css";
|
|
9
9
|
import $8czI1$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
|
|
10
10
|
import {TimeField as $f0a04554754386b6$export$5eaee2322dd727eb} from "./TimeField.mjs";
|
|
11
11
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormatHelpText as $ea94a5cfe92db3c2$export$322f4580ccd8dde6, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056, useVisibleMonths as $ea94a5cfe92db3c2$export$12ce2869ce471b1f} from "./utils.mjs";
|
|
@@ -169,6 +169,7 @@ const $beaeefa091999363$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8czI1$react
|
|
|
169
169
|
visibleMonths: visibleMonths,
|
|
170
170
|
pageBehavior: pageBehavior,
|
|
171
171
|
firstDayOfWeek: firstDayOfWeek,
|
|
172
|
+
createCalendar: props.createCalendar,
|
|
172
173
|
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-calendar', {
|
|
173
174
|
'is-invalid': isInvalid
|
|
174
175
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.module.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $8czI1$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.module.js";
|
|
5
5
|
import $8czI1$intlStringsmodulejs from "./intlStrings.module.js";
|
|
6
|
-
import "./
|
|
6
|
+
import "./datepicker.776a7787.css";
|
|
7
7
|
import "./textfield_vars_css.module.js";
|
|
8
|
-
import "./
|
|
8
|
+
import "./datepicker.c3193fb9.css";
|
|
9
9
|
import $8czI1$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.module.js";
|
|
10
10
|
import {TimeField as $f0a04554754386b6$export$5eaee2322dd727eb} from "./TimeField.module.js";
|
|
11
11
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormatHelpText as $ea94a5cfe92db3c2$export$322f4580ccd8dde6, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056, useVisibleMonths as $ea94a5cfe92db3c2$export$12ce2869ce471b1f} from "./utils.module.js";
|
|
@@ -169,6 +169,7 @@ const $beaeefa091999363$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8czI1$react
|
|
|
169
169
|
visibleMonths: visibleMonths,
|
|
170
170
|
pageBehavior: pageBehavior,
|
|
171
171
|
firstDayOfWeek: firstDayOfWeek,
|
|
172
|
+
createCalendar: props.createCalendar,
|
|
172
173
|
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepic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Ac;QAAS;QAC9G,+BACC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC3C,gCAAC,CAAA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS;QACtB,UAAU,MAAM,YAAY;QAC5B,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,WAAU;;AAUhC","sources":["packages/@react-spectrum/datepicker/src/DatePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Calendar} from '@react-spectrum/calendar';\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useRef} from 'react';\nimport '@adobe/spectrum-css-temp/components/textfield/vars.css'; // HACK: must be included BEFORE inputgroup\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDatePicker} from '@react-aria/datepicker';\nimport {useDatePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isQuiet,\n isDisabled,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDatePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {groupProps, labelProps, fieldProps, descriptionProps, errorMessageProps, buttonProps, dialogProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDatePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n let approximateWidth = useFormattedDateWidth(state) + 'ch';\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...fieldProps}\n data-testid=\"date-field\"\n isQuiet={isQuiet} />\n </Input>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <Calendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />\n {showTimeField &&\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('time')}\n value={state.timeValue}\n onChange={state.setTimeValue}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n marginTop=\"size-100\" />\n </div>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"DatePicker.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AAiCM,MAAM,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,WAAgC,KAAiC,EAAE,GAA8B;IACnJ,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,IAAI,aACF,SAAS,WACT,OAAO,cACP,UAAU,oBACV,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,kBACZ,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAA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AY;QACX,MAAK;QACL,YAAW;QACX,WAAW,cAAc,QAAQ,iBAAiB;QAClD,WAAW;QACX,WAAA;QACA,QAAQ;QACR,cAAc;QACd,YAAY,MAAM,UAAU;qBAC5B,gCAAC,CAAA,GAAA,kBAAU;QACR,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,iBAAiB;QAC7C,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAK,GAAG;QACrC,SAAS;QACT,iBAAiB;qBACjB,gCAAC,CAAA,GAAA,oCAAW,yBAEd,gCAAC,CAAA,GAAA,aAAK;QAAE,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;QAAsC,GAAG,WAAW;qBACzG,gCAAC,CAAA,GAAA,cAAM,uBACL,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC3C,gCAAC,CAAA,GAAA,eAAO;QACL,GAAG,aAAa;QACjB,eAAe;QACf,cAAc;QACd,gBAAgB;QAChB,gBAAgB,MAAM,cAAc;QACpC,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;YAAC,cAAc;QAAS;QAC9G,+BACC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC3C,gCAAC,CAAA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS;QACtB,UAAU,MAAM,YAAY;QAC5B,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,WAAU;;AAUhC","sources":["packages/@react-spectrum/datepicker/src/DatePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Calendar} from '@react-spectrum/calendar';\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useRef} from 'react';\nimport '@adobe/spectrum-css-temp/components/textfield/vars.css'; // HACK: must be included BEFORE inputgroup\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDatePicker} from '@react-aria/datepicker';\nimport {useDatePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isQuiet,\n isDisabled,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDatePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {groupProps, labelProps, fieldProps, descriptionProps, errorMessageProps, buttonProps, dialogProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDatePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n let approximateWidth = useFormattedDateWidth(state) + 'ch';\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...fieldProps}\n data-testid=\"date-field\"\n isQuiet={isQuiet} />\n </Input>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <Calendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n createCalendar={props.createCalendar}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />\n {showTimeField &&\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('time')}\n value={state.timeValue}\n onChange={state.setTimeValue}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n marginTop=\"size-100\" />\n </div>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"DatePicker.module.js.map"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var $edac158d20ebe4a9$exports = require("./DatePickerSegment.main.js");
|
|
2
|
-
require("./
|
|
2
|
+
require("./datepicker.e85992d8.css");
|
|
3
3
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
4
|
var $g7Fnj$reactspectrumutils = require("@react-spectrum/utils");
|
|
5
5
|
var $g7Fnj$internationalizeddate = require("@internationalized/date");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAkBM,SAAS,wCAAqC,KAA8B;IACjF,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,kBACV,cAAc,EACf,GAAG;IACJ,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAyB;IACxC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,+CAAgB,EAAE;QAC5B,GAAG,KAAK;gBACR;wBACA;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA2B;IAC/C,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAW,EAAE;QAAC,GAAG,KAAK;kBAAE;IAAQ,GAAG,OAAO;IAEzE,qBACE,0DAAC;QAAM,GAAG,UAAU;QAAE,eAAa,KAAK,CAAC,cAAc;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;QAAiB,KAAK;OAC1J,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,kBAC3B,0DAAC,CAAA,GAAA,2CAAgB;YAChB,KAAK;YACL,SAAS;YACT,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,YAAY;2BAEhB,0DAAC;QAAO,GAAG,UAAU;QAAE,KAAK;;AAGlC","sources":["packages/@react-spectrum/datepicker/src/DatePickerField.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {createCalendar} from '@internationalized/date';\nimport {DatePickerSegment} from './DatePickerSegment';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport React, {useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface DatePickerFieldProps<T extends DateValue> extends SpectrumDatePickerProps<T> {\n inputClassName?: string,\n hideValidationIcon?: boolean,\n maxGranularity?: SpectrumDatePickerProps<T>['granularity']\n}\n\nexport function DatePickerField<T extends DateValue>(props: DatePickerFieldProps<T>) {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n inputClassName\n } = props;\n let ref = useRef<HTMLDivElement | null>(null);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let inputRef = useRef<HTMLInputElement | null>(null);\n let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);\n\n return (\n <span {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>\n {state.segments.map((segment, i) =>\n (<DatePickerSegment\n key={i}\n segment={segment}\n state={state}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />)\n )}\n <input {...inputProps} ref={inputRef} />\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerField.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAkBM,SAAS,wCAAqC,KAA8B;IACjF,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,kBACV,cAAc,EACf,GAAG;IACJ,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAyB;IACxC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,+CAAgB,EAAE;QAC5B,GAAG,KAAK;gBACR;wBACA;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA2B;IAC/C,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAW,EAAE;QAAC,GAAG,KAAK;kBAAE;IAAQ,GAAG,OAAO;IAEzE,qBACE,0DAAC;QAAM,GAAG,UAAU;QAAE,eAAa,KAAK,CAAC,cAAc;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;QAAiB,KAAK;OAC1J,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,kBAC3B,0DAAC,CAAA,GAAA,2CAAgB;YAChB,KAAK;YACL,SAAS;YACT,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,YAAY;2BAEhB,0DAAC;QAAO,GAAG,UAAU;QAAE,KAAK;;AAGlC","sources":["packages/@react-spectrum/datepicker/src/DatePickerField.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {createCalendar} from '@internationalized/date';\nimport {DatePickerSegment} from './DatePickerSegment';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport React, {ReactNode, useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface DatePickerFieldProps<T extends DateValue> extends SpectrumDatePickerProps<T> {\n inputClassName?: string,\n hideValidationIcon?: boolean,\n maxGranularity?: SpectrumDatePickerProps<T>['granularity']\n}\n\nexport function DatePickerField<T extends DateValue>(props: DatePickerFieldProps<T>): ReactNode {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n inputClassName\n } = props;\n let ref = useRef<HTMLDivElement | null>(null);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let inputRef = useRef<HTMLInputElement | null>(null);\n let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);\n\n return (\n <span {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>\n {state.segments.map((segment, i) =>\n (<DatePickerSegment\n key={i}\n segment={segment}\n state={state}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />)\n )}\n <input {...inputProps} ref={inputRef} />\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerField.main.js.map"}
|
package/dist/DatePickerField.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.mjs";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $332Ed$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
4
|
import {classNames as $332Ed$classNames} from "@react-spectrum/utils";
|
|
5
5
|
import {createCalendar as $332Ed$createCalendar} from "@internationalized/date";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.module.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $332Ed$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
4
|
import {classNames as $332Ed$classNames} from "@react-spectrum/utils";
|
|
5
5
|
import {createCalendar as $332Ed$createCalendar} from "@internationalized/date";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAkBM,SAAS,wCAAqC,KAA8B;IACjF,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,kBACV,cAAc,EACf,GAAG;IACJ,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,wBAAgB,EAAE;QAC5B,GAAG,KAAK;gBACR;wBACA;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,aAAK,EAA2B;IAC/C,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,GAAG,KAAK;kBAAE;IAAQ,GAAG,OAAO;IAEzE,qBACE,gCAAC;QAAM,GAAG,UAAU;QAAE,eAAa,KAAK,CAAC,cAAc;QAAE,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;QAAiB,KAAK;OAC1J,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,kBAC3B,gCAAC,CAAA,GAAA,yCAAgB;YAChB,KAAK;YACL,SAAS;YACT,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,YAAY;2BAEhB,gCAAC;QAAO,GAAG,UAAU;QAAE,KAAK;;AAGlC","sources":["packages/@react-spectrum/datepicker/src/DatePickerField.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {createCalendar} from '@internationalized/date';\nimport {DatePickerSegment} from './DatePickerSegment';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport React, {useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface DatePickerFieldProps<T extends DateValue> extends SpectrumDatePickerProps<T> {\n inputClassName?: string,\n hideValidationIcon?: boolean,\n maxGranularity?: SpectrumDatePickerProps<T>['granularity']\n}\n\nexport function DatePickerField<T extends DateValue>(props: DatePickerFieldProps<T>) {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n inputClassName\n } = props;\n let ref = useRef<HTMLDivElement | null>(null);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let inputRef = useRef<HTMLInputElement | null>(null);\n let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);\n\n return (\n <span {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>\n {state.segments.map((segment, i) =>\n (<DatePickerSegment\n key={i}\n segment={segment}\n state={state}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />)\n )}\n <input {...inputProps} ref={inputRef} />\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerField.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAkBM,SAAS,wCAAqC,KAA8B;IACjF,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,kBACV,cAAc,EACf,GAAG;IACJ,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,wBAAgB,EAAE;QAC5B,GAAG,KAAK;gBACR;wBACA;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,aAAK,EAA2B;IAC/C,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,GAAG,KAAK;kBAAE;IAAQ,GAAG,OAAO;IAEzE,qBACE,gCAAC;QAAM,GAAG,UAAU;QAAE,eAAa,KAAK,CAAC,cAAc;QAAE,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;QAAiB,KAAK;OAC1J,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,kBAC3B,gCAAC,CAAA,GAAA,yCAAgB;YAChB,KAAK;YACL,SAAS;YACT,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,YAAY;2BAEhB,gCAAC;QAAO,GAAG,UAAU;QAAE,KAAK;;AAGlC","sources":["packages/@react-spectrum/datepicker/src/DatePickerField.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {createCalendar} from '@internationalized/date';\nimport {DatePickerSegment} from './DatePickerSegment';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';\nimport React, {ReactNode, useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface DatePickerFieldProps<T extends DateValue> extends SpectrumDatePickerProps<T> {\n inputClassName?: string,\n hideValidationIcon?: boolean,\n maxGranularity?: SpectrumDatePickerProps<T>['granularity']\n}\n\nexport function DatePickerField<T extends DateValue>(props: DatePickerFieldProps<T>): ReactNode {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n inputClassName\n } = props;\n let ref = useRef<HTMLDivElement | null>(null);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let inputRef = useRef<HTMLInputElement | null>(null);\n let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);\n\n return (\n <span {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>\n {state.segments.map((segment, i) =>\n (<DatePickerSegment\n key={i}\n segment={segment}\n state={state}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />)\n )}\n <input {...inputProps} ref={inputRef} />\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerField.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkBM,SAAS,0CAAkB,WAAC,OAAO,SAAE,KAAK,EAAE,GAAG,YAAmC;IACvF,OAAQ,QAAQ,IAAI;QAClB,gCAAgC;QAChC,KAAK;YACH,qBAAO,0DAAC;gBAAe,SAAS;;QAElC,mBAAmB;QACnB;YACE,qBAAO,0DAAC;gBAAgB,SAAS;gBAAS,OAAO;gBAAQ,GAAG,UAAU;;IAC1E;AACF;AAEA,SAAS,qCAAe,WAAC,OAAO,EAAsB;IACpD,qBACE,0DAAC;QACC,eAAY;QACZ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,eAAa,QAAQ,IAAI,KAAK,YAAY,YAAY,QAAQ,IAAI;OACjE,QAAQ,IAAI;AAGnB;AAEA,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,EAAyB;IAC/D,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAyB;IACxC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE,SAAS,OAAO;IAEpD,qBACE,0DAAC;QACE,GAAG,YAAY;QAChB,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,kCAAkC;YAC9D,kBAAkB,QAAQ,aAAa;YACvC,gBAAgB,CAAC,QAAQ,UAAU;QACrC;QACA,OAAO,aAAa,KAAK;QACzB,eAAa,QAAQ,IAAI;OACxB,QAAQ,aAAa,iBAAG,0DAAC;QAAK,eAAY;QAAO,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2C,QAAQ,WAAW,IAAW,QAAQ,IAAI;AAG3K","sources":["packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {DateFieldState, DateSegment} from '@react-stately/datepicker';\nimport {DatePickerBase, DateValue} from '@react-types/datepicker';\nimport React, {useRef} from 'react';\nimport styles from './styles.css';\nimport {useDateSegment} from '@react-aria/datepicker';\n\ninterface DatePickerSegmentProps extends DatePickerBase<DateValue> {\n segment: DateSegment,\n state: DateFieldState\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment\n}\n\nexport function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps) {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return <EditableSegment segment={segment} state={state} {...otherProps} />;\n }\n}\n\nfunction LiteralSegment({segment}: LiteralSegmentProps) {\n return (\n <span\n aria-hidden=\"true\"\n className={classNames(styles, 'react-spectrum-Datepicker-literal')}\n data-testid={segment.type === 'literal' ? undefined : segment.type}>\n {segment.text}\n </span>\n );\n}\n\nfunction EditableSegment({segment, state}: DatePickerSegmentProps) {\n let ref = useRef<HTMLDivElement | null>(null);\n let {segmentProps} = useDateSegment(segment, state, ref);\n\n return (\n <span\n {...segmentProps}\n ref={ref}\n className={classNames(styles, 'react-spectrum-DatePicker-cell', {\n 'is-placeholder': segment.isPlaceholder,\n 'is-read-only': !segment.isEditable\n })}\n style={segmentProps.style}\n data-testid={segment.type}>\n {segment.isPlaceholder ? <span aria-hidden=\"true\" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span> : segment.text}\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerSegment.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkBM,SAAS,0CAAkB,WAAC,OAAO,SAAE,KAAK,EAAE,GAAG,YAAmC;IACvF,OAAQ,QAAQ,IAAI;QAClB,gCAAgC;QAChC,KAAK;YACH,qBAAO,0DAAC;gBAAe,SAAS;;QAElC,mBAAmB;QACnB;YACE,qBAAO,0DAAC;gBAAgB,SAAS;gBAAS,OAAO;gBAAQ,GAAG,UAAU;;IAC1E;AACF;AAEA,SAAS,qCAAe,WAAC,OAAO,EAAsB;IACpD,qBACE,0DAAC;QACC,eAAY;QACZ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,eAAa,QAAQ,IAAI,KAAK,YAAY,YAAY,QAAQ,IAAI;OACjE,QAAQ,IAAI;AAGnB;AAEA,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,EAAyB;IAC/D,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAyB;IACxC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE,SAAS,OAAO;IAEpD,qBACE,0DAAC;QACE,GAAG,YAAY;QAChB,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,kCAAkC;YAC9D,kBAAkB,QAAQ,aAAa;YACvC,gBAAgB,CAAC,QAAQ,UAAU;QACrC;QACA,OAAO,aAAa,KAAK;QACzB,eAAa,QAAQ,IAAI;OACxB,QAAQ,aAAa,iBAAG,0DAAC;QAAK,eAAY;QAAO,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2C,QAAQ,WAAW,IAAW,QAAQ,IAAI;AAG3K","sources":["packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {DateFieldState, DateSegment} from '@react-stately/datepicker';\nimport {DatePickerBase, DateValue} from '@react-types/datepicker';\nimport React, {ReactNode, useRef} from 'react';\nimport styles from './styles.css';\nimport {useDateSegment} from '@react-aria/datepicker';\n\ninterface DatePickerSegmentProps extends DatePickerBase<DateValue> {\n segment: DateSegment,\n state: DateFieldState\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment\n}\n\nexport function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps): ReactNode {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return <EditableSegment segment={segment} state={state} {...otherProps} />;\n }\n}\n\nfunction LiteralSegment({segment}: LiteralSegmentProps) {\n return (\n <span\n aria-hidden=\"true\"\n className={classNames(styles, 'react-spectrum-Datepicker-literal')}\n data-testid={segment.type === 'literal' ? undefined : segment.type}>\n {segment.text}\n </span>\n );\n}\n\nfunction EditableSegment({segment, state}: DatePickerSegmentProps) {\n let ref = useRef<HTMLDivElement | null>(null);\n let {segmentProps} = useDateSegment(segment, state, ref);\n\n return (\n <span\n {...segmentProps}\n ref={ref}\n className={classNames(styles, 'react-spectrum-DatePicker-cell', {\n 'is-placeholder': segment.isPlaceholder,\n 'is-read-only': !segment.isEditable\n })}\n style={segmentProps.style}\n data-testid={segment.type}>\n {segment.isPlaceholder ? <span aria-hidden=\"true\" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span> : segment.text}\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerSegment.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkBM,SAAS,0CAAkB,WAAC,OAAO,SAAE,KAAK,EAAE,GAAG,YAAmC;IACvF,OAAQ,QAAQ,IAAI;QAClB,gCAAgC;QAChC,KAAK;YACH,qBAAO,gCAAC;gBAAe,SAAS;;QAElC,mBAAmB;QACnB;YACE,qBAAO,gCAAC;gBAAgB,SAAS;gBAAS,OAAO;gBAAQ,GAAG,UAAU;;IAC1E;AACF;AAEA,SAAS,qCAAe,WAAC,OAAO,EAAsB;IACpD,qBACE,gCAAC;QACC,eAAY;QACZ,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,eAAa,QAAQ,IAAI,KAAK,YAAY,YAAY,QAAQ,IAAI;OACjE,QAAQ,IAAI;AAGnB;AAEA,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,EAAyB;IAC/D,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE,SAAS,OAAO;IAEpD,qBACE,gCAAC;QACE,GAAG,YAAY;QAChB,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,kCAAkC;YAC9D,kBAAkB,QAAQ,aAAa;YACvC,gBAAgB,CAAC,QAAQ,UAAU;QACrC;QACA,OAAO,aAAa,KAAK;QACzB,eAAa,QAAQ,IAAI;OACxB,QAAQ,aAAa,iBAAG,gCAAC;QAAK,eAAY;QAAO,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2C,QAAQ,WAAW,IAAW,QAAQ,IAAI;AAG3K","sources":["packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {DateFieldState, DateSegment} from '@react-stately/datepicker';\nimport {DatePickerBase, DateValue} from '@react-types/datepicker';\nimport React, {useRef} from 'react';\nimport styles from './styles.css';\nimport {useDateSegment} from '@react-aria/datepicker';\n\ninterface DatePickerSegmentProps extends DatePickerBase<DateValue> {\n segment: DateSegment,\n state: DateFieldState\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment\n}\n\nexport function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps) {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return <EditableSegment segment={segment} state={state} {...otherProps} />;\n }\n}\n\nfunction LiteralSegment({segment}: LiteralSegmentProps) {\n return (\n <span\n aria-hidden=\"true\"\n className={classNames(styles, 'react-spectrum-Datepicker-literal')}\n data-testid={segment.type === 'literal' ? undefined : segment.type}>\n {segment.text}\n </span>\n );\n}\n\nfunction EditableSegment({segment, state}: DatePickerSegmentProps) {\n let ref = useRef<HTMLDivElement | null>(null);\n let {segmentProps} = useDateSegment(segment, state, ref);\n\n return (\n <span\n {...segmentProps}\n ref={ref}\n className={classNames(styles, 'react-spectrum-DatePicker-cell', {\n 'is-placeholder': segment.isPlaceholder,\n 'is-read-only': !segment.isEditable\n })}\n style={segmentProps.style}\n data-testid={segment.type}>\n {segment.isPlaceholder ? <span aria-hidden=\"true\" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span> : segment.text}\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerSegment.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkBM,SAAS,0CAAkB,WAAC,OAAO,SAAE,KAAK,EAAE,GAAG,YAAmC;IACvF,OAAQ,QAAQ,IAAI;QAClB,gCAAgC;QAChC,KAAK;YACH,qBAAO,gCAAC;gBAAe,SAAS;;QAElC,mBAAmB;QACnB;YACE,qBAAO,gCAAC;gBAAgB,SAAS;gBAAS,OAAO;gBAAQ,GAAG,UAAU;;IAC1E;AACF;AAEA,SAAS,qCAAe,WAAC,OAAO,EAAsB;IACpD,qBACE,gCAAC;QACC,eAAY;QACZ,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,eAAa,QAAQ,IAAI,KAAK,YAAY,YAAY,QAAQ,IAAI;OACjE,QAAQ,IAAI;AAGnB;AAEA,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,EAAyB;IAC/D,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE,SAAS,OAAO;IAEpD,qBACE,gCAAC;QACE,GAAG,YAAY;QAChB,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,kCAAkC;YAC9D,kBAAkB,QAAQ,aAAa;YACvC,gBAAgB,CAAC,QAAQ,UAAU;QACrC;QACA,OAAO,aAAa,KAAK;QACzB,eAAa,QAAQ,IAAI;OACxB,QAAQ,aAAa,iBAAG,gCAAC;QAAK,eAAY;QAAO,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2C,QAAQ,WAAW,IAAW,QAAQ,IAAI;AAG3K","sources":["packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {DateFieldState, DateSegment} from '@react-stately/datepicker';\nimport {DatePickerBase, DateValue} from '@react-types/datepicker';\nimport React, {ReactNode, useRef} from 'react';\nimport styles from './styles.css';\nimport {useDateSegment} from '@react-aria/datepicker';\n\ninterface DatePickerSegmentProps extends DatePickerBase<DateValue> {\n segment: DateSegment,\n state: DateFieldState\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment\n}\n\nexport function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps): ReactNode {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return <EditableSegment segment={segment} state={state} {...otherProps} />;\n }\n}\n\nfunction LiteralSegment({segment}: LiteralSegmentProps) {\n return (\n <span\n aria-hidden=\"true\"\n className={classNames(styles, 'react-spectrum-Datepicker-literal')}\n data-testid={segment.type === 'literal' ? undefined : segment.type}>\n {segment.text}\n </span>\n );\n}\n\nfunction EditableSegment({segment, state}: DatePickerSegmentProps) {\n let ref = useRef<HTMLDivElement | null>(null);\n let {segmentProps} = useDateSegment(segment, state, ref);\n\n return (\n <span\n {...segmentProps}\n ref={ref}\n className={classNames(styles, 'react-spectrum-DatePicker-cell', {\n 'is-placeholder': segment.isPlaceholder,\n 'is-read-only': !segment.isEditable\n })}\n style={segmentProps.style}\n data-testid={segment.type}>\n {segment.isPlaceholder ? <span aria-hidden=\"true\" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span> : segment.text}\n </span>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerSegment.module.js.map"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $bd22dc8dad9522bc$exports = require("./DatePickerField.main.js");
|
|
2
|
-
require("./
|
|
2
|
+
require("./datepicker.e85992d8.css");
|
|
3
3
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
4
|
var $c3ebc4931d9b9977$exports = require("./Input.main.js");
|
|
5
5
|
var $0045b32a117743a7$exports = require("./intlStrings.main.js");
|
|
6
|
-
require("./
|
|
6
|
+
require("./datepicker.c3193fb9.css");
|
|
7
7
|
var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
|
|
8
8
|
var $740ff83729a8f317$exports = require("./TimeField.main.js");
|
|
9
9
|
var $9d3b96715dbbb2b7$exports = require("./utils.main.js");
|
|
@@ -187,6 +187,7 @@ const $16cafb71dac155a4$export$17334619f3ac2224 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
187
187
|
visibleMonths: visibleMonths,
|
|
188
188
|
pageBehavior: pageBehavior,
|
|
189
189
|
firstDayOfWeek: firstDayOfWeek,
|
|
190
|
+
createCalendar: props.createCalendar,
|
|
190
191
|
UNSAFE_className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-calendar', {
|
|
191
192
|
'is-invalid': validationState === 'invalid'
|
|
192
193
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AAkCM,MAAM,0DAAkB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,gBAAqC,KAAsC,EAAE,GAA8B;QA0JvI,kBAWA;IApK3B,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,WACF,OAAO,cACP,UAAU,aACV,SAAS,oBACT,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,kBACZ,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,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GAAA,+BAAG;QAAE,KAAI;QAAW,WAAU;QAAW,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBACvF,0DAAC,CAAA,GAAA,mCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,mBAAA,MAAM,SAAS,cAAf,uCAAA,iBAAiB,KAAK,KAAI;QACjC,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,SAAS;QACtC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;sBACF,0DAAC,CAAA,GAAA,mCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,oBAAA,MAAM,SAAS,cAAf,wCAAA,kBAAiB,GAAG,KAAI;QAC/B,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,OAAO;QACpC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;;AAUtB;AAEA,SAAS;IACP,qBACE,0DAAC;QACC,eAAY;QACZ,eAAY;QACZ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;;AAE9C","sources":["packages/@react-spectrum/datepicker/src/DateRangePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDateRangePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {Flex} from '@react-spectrum/layout';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {RangeCalendar} from '@react-spectrum/calendar';\nimport React, {ReactElement, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDateRangePicker} from '@react-aria/datepicker';\nimport {useDateRangePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users\n * to enter or select a date and time range.\n */\nexport const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isQuiet,\n isDisabled,\n autoFocus,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDateRangePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {labelProps, groupProps, buttonProps, dialogProps, startFieldProps, endFieldProps, descriptionProps, errorMessageProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDateRangePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n // Multiplying by two for the two dates, adding one character for the dash, and then the padding around the dash\n let approximateWidth = `calc(${useFormattedDateWidth(state) * 2 + 1}ch + 2 * var(--spectrum-global-dimension-size-100))`;\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <div style={{overflow: 'hidden', width: '100%'}}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...startFieldProps}\n data-testid=\"start-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')} />\n <DateRangeDash />\n <DatePickerField\n {...endFieldProps}\n data-testid=\"end-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(\n styles,\n 'spectrum-Datepicker-endField',\n classNames(\n datepickerStyles,\n 'react-spectrum-Datepicker-endField'\n )\n )} />\n </Input>\n </div>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <RangeCalendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />\n {showTimeField &&\n <Flex gap=\"size-100\" marginTop=\"size-100\" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('startTime')}\n value={state.timeRange?.start || null}\n onChange={v => state.setTime('start', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n <TimeField\n label={stringFormatter.format('endTime')}\n value={state.timeRange?.end || null}\n onChange={v => state.setTime('end', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n </Flex>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n\nfunction DateRangeDash() {\n return (\n <span\n aria-hidden=\"true\"\n data-testid=\"date-range-dash\"\n className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />\n );\n}\n"],"names":[],"version":3,"file":"DateRangePicker.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AAkCM,MAAM,0DAAkB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,gBAAqC,KAAsC,EAAE,GAA8B;QA2JvI,kBAWA;IArK3B,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,WACF,OAAO,cACP,UAAU,aACV,SAAS,oBACT,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,kBACZ,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SA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DAAC,CAAA,GAAA,+BAAG;QAAE,KAAI;QAAW,WAAU;QAAW,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBACvF,0DAAC,CAAA,GAAA,mCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,mBAAA,MAAM,SAAS,cAAf,uCAAA,iBAAiB,KAAK,KAAI;QACjC,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,SAAS;QACtC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;sBACF,0DAAC,CAAA,GAAA,mCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,oBAAA,MAAM,SAAS,cAAf,wCAAA,kBAAiB,GAAG,KAAI;QAC/B,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,OAAO;QACpC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;;AAUtB;AAEA,SAAS;IACP,qBACE,0DAAC;QACC,eAAY;QACZ,eAAY;QACZ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;;AAE9C","sources":["packages/@react-spectrum/datepicker/src/DateRangePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDateRangePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {Flex} from '@react-spectrum/layout';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {RangeCalendar} from '@react-spectrum/calendar';\nimport React, {ReactElement, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDateRangePicker} from '@react-aria/datepicker';\nimport {useDateRangePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users\n * to enter or select a date and time range.\n */\nexport const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isQuiet,\n isDisabled,\n autoFocus,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDateRangePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {labelProps, groupProps, buttonProps, dialogProps, startFieldProps, endFieldProps, descriptionProps, errorMessageProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDateRangePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n // Multiplying by two for the two dates, adding one character for the dash, and then the padding around the dash\n let approximateWidth = `calc(${useFormattedDateWidth(state) * 2 + 1}ch + 2 * var(--spectrum-global-dimension-size-100))`;\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <div style={{overflow: 'hidden', width: '100%'}}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...startFieldProps}\n data-testid=\"start-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')} />\n <DateRangeDash />\n <DatePickerField\n {...endFieldProps}\n data-testid=\"end-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(\n styles,\n 'spectrum-Datepicker-endField',\n classNames(\n datepickerStyles,\n 'react-spectrum-Datepicker-endField'\n )\n )} />\n </Input>\n </div>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <RangeCalendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n createCalendar={props.createCalendar}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />\n {showTimeField &&\n <Flex gap=\"size-100\" marginTop=\"size-100\" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('startTime')}\n value={state.timeRange?.start || null}\n onChange={v => state.setTime('start', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n <TimeField\n label={stringFormatter.format('endTime')}\n value={state.timeRange?.end || null}\n onChange={v => state.setTime('end', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n </Flex>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n\nfunction DateRangeDash() {\n return (\n <span\n aria-hidden=\"true\"\n data-testid=\"date-range-dash\"\n className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />\n );\n}\n"],"names":[],"version":3,"file":"DateRangePicker.main.js.map"}
|
package/dist/DateRangePicker.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.mjs";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $dUbU7$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
5
5
|
import $dUbU7$intlStringsmodulejs from "./intlStrings.mjs";
|
|
6
|
-
import "./
|
|
6
|
+
import "./datepicker.c3193fb9.css";
|
|
7
7
|
import $dUbU7$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
|
|
8
8
|
import {TimeField as $f0a04554754386b6$export$5eaee2322dd727eb} from "./TimeField.mjs";
|
|
9
9
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormatHelpText as $ea94a5cfe92db3c2$export$322f4580ccd8dde6, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056, useVisibleMonths as $ea94a5cfe92db3c2$export$12ce2869ce471b1f} from "./utils.mjs";
|
|
@@ -181,6 +181,7 @@ const $cb301300011a98f7$export$17334619f3ac2224 = /*#__PURE__*/ (0, $dUbU7$react
|
|
|
181
181
|
visibleMonths: visibleMonths,
|
|
182
182
|
pageBehavior: pageBehavior,
|
|
183
183
|
firstDayOfWeek: firstDayOfWeek,
|
|
184
|
+
createCalendar: props.createCalendar,
|
|
184
185
|
UNSAFE_className: (0, $dUbU7$classNames)((0, ($parcel$interopDefault($dUbU7$styles_cssmodulejs))), 'react-spectrum-Datepicker-calendar', {
|
|
185
186
|
'is-invalid': validationState === 'invalid'
|
|
186
187
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.module.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $dUbU7$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.module.js";
|
|
5
5
|
import $dUbU7$intlStringsmodulejs from "./intlStrings.module.js";
|
|
6
|
-
import "./
|
|
6
|
+
import "./datepicker.c3193fb9.css";
|
|
7
7
|
import $dUbU7$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.module.js";
|
|
8
8
|
import {TimeField as $f0a04554754386b6$export$5eaee2322dd727eb} from "./TimeField.module.js";
|
|
9
9
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormatHelpText as $ea94a5cfe92db3c2$export$322f4580ccd8dde6, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056, useVisibleMonths as $ea94a5cfe92db3c2$export$12ce2869ce471b1f} from "./utils.module.js";
|
|
@@ -181,6 +181,7 @@ const $cb301300011a98f7$export$17334619f3ac2224 = /*#__PURE__*/ (0, $dUbU7$react
|
|
|
181
181
|
visibleMonths: visibleMonths,
|
|
182
182
|
pageBehavior: pageBehavior,
|
|
183
183
|
firstDayOfWeek: firstDayOfWeek,
|
|
184
|
+
createCalendar: props.createCalendar,
|
|
184
185
|
UNSAFE_className: (0, $dUbU7$classNames)((0, ($parcel$interopDefault($dUbU7$styles_cssmodulejs))), 'react-spectrum-Datepicker-calendar', {
|
|
185
186
|
'is-invalid': validationState === 'invalid'
|
|
186
187
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AAkCM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,gBAAqC,KAAsC,EAAE,GAA8B;QA0JvI,kBAWA;IApK3B,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,IAAI,WACF,OAAO,cACP,UAAU,aACV,SAAS,oBACT,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,kBACZ,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,YAAY,CAAA,GAAA,aAAK,EAAyB;IAC9C,IAAI,QAAQ,CAAA,GAAA,8BAAsB,EAAE;QAClC,GAAG,KAAK;QACR,qBAAqB,IAAM,CAAC,MAAM,OAAO;IAC3C;IACA,IAAI,cAAC,UAAU,cAAE,UAAU,eAAE,WAAW,eAAE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AC,SAAS;QACtC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;sBACF,gCAAC,CAAA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,oBAAA,MAAM,SAAS,cAAf,wCAAA,kBAAiB,GAAG,KAAI;QAC/B,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,OAAO;QACpC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;;AAUtB;AAEA,SAAS;IACP,qBACE,gCAAC;QACC,eAAY;QACZ,eAAY;QACZ,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;;AAE9C","sources":["packages/@react-spectrum/datepicker/src/DateRangePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDateRangePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {Flex} from '@react-spectrum/layout';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {RangeCalendar} from '@react-spectrum/calendar';\nimport React, {ReactElement, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDateRangePicker} from '@react-aria/datepicker';\nimport {useDateRangePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users\n * to enter or select a date and time range.\n */\nexport const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isQuiet,\n isDisabled,\n autoFocus,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDateRangePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {labelProps, groupProps, buttonProps, dialogProps, startFieldProps, endFieldProps, descriptionProps, errorMessageProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDateRangePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n // Multiplying by two for the two dates, adding one character for the dash, and then the padding around the dash\n let approximateWidth = `calc(${useFormattedDateWidth(state) * 2 + 1}ch + 2 * var(--spectrum-global-dimension-size-100))`;\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <div style={{overflow: 'hidden', width: '100%'}}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...startFieldProps}\n data-testid=\"start-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')} />\n <DateRangeDash />\n <DatePickerField\n {...endFieldProps}\n data-testid=\"end-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(\n styles,\n 'spectrum-Datepicker-endField',\n classNames(\n datepickerStyles,\n 'react-spectrum-Datepicker-endField'\n )\n )} />\n </Input>\n </div>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <RangeCalendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />\n {showTimeField &&\n <Flex gap=\"size-100\" marginTop=\"size-100\" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('startTime')}\n value={state.timeRange?.start || null}\n onChange={v => state.setTime('start', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n <TimeField\n label={stringFormatter.format('endTime')}\n value={state.timeRange?.end || null}\n onChange={v => state.setTime('end', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n </Flex>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n\nfunction DateRangeDash() {\n return (\n <span\n aria-hidden=\"true\"\n data-testid=\"date-range-dash\"\n className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />\n );\n}\n"],"names":[],"version":3,"file":"DateRangePicker.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AAkCM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,gBAAqC,KAAsC,EAAE,GAA8B;QA2JvI,kBAWA;IArK3B,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,IAAI,WACF,OAAO,cACP,UAAU,aACV,SAAS,oBACT,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,kBACZ,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,YAAY,CAAA,GAAA,aAAK,EAAyB;IAC9C,IAAI,QAAQ,CAAA,GAAA,8BAAsB,EAAE;QAClC,GAAG,KAAK;QACR,qBAAqB,IAAM,CAAC,MAAM,OAAO;IAC3C;IACA,IAAI,cAAC,UAAU,cAAE,UAAU,eAAE,WAAW,eAAE,WAAW,mBAAE,eAAe,iBAAE,aA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SAAS;QACtC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;sBACF,gCAAC,CAAA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,oBAAA,MAAM,SAAS,cAAf,wCAAA,kBAAiB,GAAG,KAAI;QAC/B,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,OAAO;QACpC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;;AAUtB;AAEA,SAAS;IACP,qBACE,gCAAC;QACC,eAAY;QACZ,eAAY;QACZ,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;;AAE9C","sources":["packages/@react-spectrum/datepicker/src/DateRangePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDateRangePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {Flex} from '@react-spectrum/layout';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {RangeCalendar} from '@react-spectrum/calendar';\nimport React, {ReactElement, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDateRangePicker} from '@react-aria/datepicker';\nimport {useDateRangePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users\n * to enter or select a date and time range.\n */\nexport const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isQuiet,\n isDisabled,\n autoFocus,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior,\n firstDayOfWeek\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement | null>(null);\n let state = useDateRangePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {labelProps, groupProps, buttonProps, dialogProps, startFieldProps, endFieldProps, descriptionProps, errorMessageProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDateRangePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = undefined;\n }\n\n let placeholder: DateValue | null | undefined = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n // Multiplying by two for the two dates, adding one character for the dash, and then the padding around the dash\n let approximateWidth = `calc(${useFormattedDateWidth(state) * 2 + 1}ch + 2 * var(--spectrum-global-dimension-size-100))`;\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <div style={{overflow: 'hidden', width: '100%'}}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing\n minWidth={approximateWidth}>\n <DatePickerField\n {...startFieldProps}\n data-testid=\"start-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')} />\n <DateRangeDash />\n <DatePickerField\n {...endFieldProps}\n data-testid=\"end-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(\n styles,\n 'spectrum-Datepicker-endField',\n classNames(\n datepickerStyles,\n 'react-spectrum-Datepicker-endField'\n )\n )} />\n </Input>\n </div>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <RangeCalendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n firstDayOfWeek={firstDayOfWeek}\n createCalendar={props.createCalendar}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />\n {showTimeField &&\n <Flex gap=\"size-100\" marginTop=\"size-100\" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('startTime')}\n value={state.timeRange?.start || null}\n onChange={v => state.setTime('start', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n <TimeField\n label={stringFormatter.format('endTime')}\n value={state.timeRange?.end || null}\n onChange={v => state.setTime('end', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n </Flex>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n\nfunction DateRangeDash() {\n return (\n <span\n aria-hidden=\"true\"\n data-testid=\"date-range-dash\"\n className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />\n );\n}\n"],"names":[],"version":3,"file":"DateRangePicker.module.js.map"}
|
package/dist/Input.main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require("./
|
|
1
|
+
require("./datepicker.e85992d8.css");
|
|
2
2
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
3
|
-
require("./
|
|
3
|
+
require("./datepicker.776a7787.css");
|
|
4
4
|
var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
|
|
5
5
|
var $9cini$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
|
|
6
6
|
var $9cini$spectrumiconsuiCheckmarkMedium = require("@spectrum-icons/ui/CheckmarkMedium");
|
package/dist/Input.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./datepicker.e85992d8.css";
|
|
2
2
|
import $fVzF9$styles_cssmodulejs from "./styles_css.mjs";
|
|
3
|
-
import "./
|
|
3
|
+
import "./datepicker.776a7787.css";
|
|
4
4
|
import $fVzF9$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
|
|
5
5
|
import $fVzF9$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
|
6
6
|
import $fVzF9$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
package/dist/Input.module.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./datepicker.e85992d8.css";
|
|
2
2
|
import $fVzF9$styles_cssmodulejs from "./styles_css.module.js";
|
|
3
|
-
import "./
|
|
3
|
+
import "./datepicker.776a7787.css";
|
|
4
4
|
import $fVzF9$textfield_vars_cssmodulejs from "./textfield_vars_css.module.js";
|
|
5
5
|
import $fVzF9$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
|
6
6
|
import $fVzF9$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
package/dist/TimeField.main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var $edac158d20ebe4a9$exports = require("./DatePickerSegment.main.js");
|
|
2
|
-
require("./
|
|
2
|
+
require("./datepicker.e85992d8.css");
|
|
3
3
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
4
|
var $c3ebc4931d9b9977$exports = require("./Input.main.js");
|
|
5
5
|
var $9d3b96715dbbb2b7$exports = require("./utils.main.js");
|
package/dist/TimeField.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.mjs";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $immgY$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
5
5
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056} from "./utils.mjs";
|
package/dist/TimeField.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.module.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./datepicker.e85992d8.css";
|
|
3
3
|
import $immgY$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.module.js";
|
|
5
5
|
import {useFocusManagerRef as $ea94a5cfe92db3c2$export$71a23a36270e4bf0, useFormattedDateWidth as $ea94a5cfe92db3c2$export$31e22e3c931fc056} from "./utils.module.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;AAQE;;;;;;AAWF;;;;;;;;;;;;;;;;;;;;AA4CE;;;;;;;;AAYA;;;;;;;AAWE;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAMA;;;;AAKF;;;;;AAME;;;;AAQF;;;;;AAOA;;;;;AAAA;;;;;AAOA;;;;AAIA;;;;;;;;AAUA;;;;;;;AASA;;;;AAIA;;;;AASF;;;;AAIA;;;;;AAKE;;;;AAIA;;;;;AAME;;;;AAOJ;;;;;;;;AAUE;;;;AAKF;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOA;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASA;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAaA;;;;AASE;;;;AAIE;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKF;;;;;AAQF;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAME;;;;AAiBF;;;;;;AAKE;;;;AAKA;;;;;AAIE;;;;AAMF;;;;;;AAKE;;;;AAMF;;;;AAME;;;;;AAMF;;;;;;;AASE;;;;AAKA;;;;AAdF;;;;;;;AASE;;;;AAKA;;;;AAKF;;;;AAGE;;;;AAcE;;;;;AAOJ;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AAMF;;;;;AAOF;;;;AAGE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AASA;;;;AASJ;;;;AAIA;;;;AAKF;EACE;;;;;;;;;;;;EAUE;;;;;EAKE;;;;;;EAKE","sources":["packages/@adobe/spectrum-css-temp/components/textfield/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"
|
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;AAQE;;;;;;AAWF;;;;;;;;;;;;;;;;;;;;AA4CE;;;;;;;;AAYA;;;;;;;AAWE;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAMA;;;;AAKF;;;;;AAME;;;;AAQF;;;;;AAOA;;;;;AAAA;;;;;AAOA;;;;AAIA;;;;;;;;AAUA;;;;;;;AASA;;;;AAIA;;;;AASF;;;;AAIA;;;;;AAKE;;;;AAIA;;;;;AAME;;;;AAOJ;;;;;;;;AAUE;;;;AAKF;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOA;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASA;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAaA;;;;AASE;;;;AAIE;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKF;;;;;AAQF;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAME;;;;AAiBF;;;;;;AAKE;;;;AAKA;;;;;AAIE;;;;AAMF;;;;;;AAKE;;;;AAMF;;;;AAME;;;;;AAMF;;;;;;;AASE;;;;AAKA;;;;AAdF;;;;;;;AASE;;;;AAKA;;;;AAKF;;;;AAGE;;;;AAcE;;;;;AAOJ;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AAMF;;;;;AAOF;;;;AAGE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AASA;;;;AASJ;;;;AAIA;;;;AAKF;EACE;;;;;;;;;;;;EAUE;;;;;EAKE;;;;;;EAKE","sources":["packages/@adobe/spectrum-css-temp/components/textfield/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"datepicker.776a7787.css.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;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eE;;;;;;EAKA;;;;;;;;;;;;;;;;EAiBE;;;;EAeI;;;;EAQF;;;;EAQF;;;;EAIF;;;;EAuBE;;;;EAGA","sources":["packages/@adobe/spectrum-css-temp/components/inputgroup/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"
|
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;;;AAWE;;;;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAaE;;;;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAaA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AASA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AASA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOJ;;;;AAMA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAMA;;;;;AAME;;;;;;;AAOE;;;;;;;AAQA;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASF;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKE;;;;AAMA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOJ;;;;;AAMA;;;;AAGE;;;;AASE;;;;;AAMF;;;;;;AAME;;;;;AAKA;;;;AAKA;;;;;;;AAQF;;;;;;;;AAME;;;;;;;;;;AAYA;;;;;;;AAYE;;;;;AAMA;;;;AAmBN;;;;;AAKI;;;;AAWE;;;;AAcA;;;;AAWF;;;;AAOE;;;;AAOA;;;;AASA;;;;AAQJ;;;;AAgBA;;;;AAKF;;;;AAQM;;;;AAqBA;;;;AAgBA;;;;AAQA;;;;AAME;;;;AAOA;;;;AAQF;;;;AAgBF;;;;AAMA;;;;AAMF;;;;AAGE;;;;AAUA;;;;AAME;;;;AACE;;;;AAOF;;;;AAIE;;;;;AAQJ;;;;AAII;;;;AAEE;;;;AAIE;;;;AAKJ;;;;AAQR;EACE;;;;;;;;;;;;;;;;EAeE;;;;;;EAKA;;;;;;;;;;;;;;;;EAiBE;;;;EAeI;;;;EAQF;;;;EAQF;;;;EAIF;;;;EAuBE;;;;EAGA","sources":["packages/@adobe/spectrum-css-temp/components/inputgroup/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"datepicker.c3193fb9.css.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAYA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAMA;;;;AAIA;;;;AAMA;;;;AAIA;;;;AAIA;;;;;AAKA;;;;;AAMA;;;;;;;;;AAQE;;;;;;AAOF;;;;;AAME;;;;AAKF;;;;;AAKA;;;;;;;AAMA;;;;;;;;;;;;AAWE;;;;AAOF;;;;AAGE;;;;;AAMF;;;;AAIA;;;;AAIA;;;;;;;AAOA;;;;AAIA;;;;;AAIE;;;;AAQA;;;;;AAQF;EACE;;;;EAGE;;;;;;AAOJ;;;;;;;;AAQA;EACE;;;;;;EAKA;;;;EAEE;;;;EAIF;;;;EAEE","sources":["packages/@react-spectrum/datepicker/src/styles.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n.react-spectrum-Datepicker-fieldWrapper.react-spectrum-Datepicker-fieldWrapper.react-spectrum-Datepicker-fieldWrapper {\n width: auto;\n min-width: var(--spectrum-global-dimension-size-2000);\n max-width: 100%;\n }\n\n.react-spectrum-Datepicker-startField {\n width: auto;\n padding-inline-end: var(--spectrum-global-dimension-size-100);\n}\n\n.react-spectrum-Datepicker-endField {\n width: auto;\n flex: 1;\n padding-inline-start: var(--spectrum-global-dimension-size-100);\n}\n\n.react-spectrum-Datepicker-field ~ .react-spectrum-Datepicker-endField > .react-spectrum-Datepicker-input {\n border-inline-start-width: 0;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n}\n\n.react-spectrum-Datepicker-field.react-spectrum-Datepicker-field {\n width: 100%;\n}\n\n.react-spectrum-Datepicker-field .react-spectrum-DateField-Input {\n line-height: var(--spectrum-body-4-text-line-height);\n}\n\n/* specificity war with .spectrum-Field--positionSide etc. */\n.react-spectrum-DateField.react-spectrum-DateField.react-spectrum-DateField.react-spectrum-DateField {\n min-width: var(--spectrum-global-dimension-size-2000);\n}\n\n.react-spectrum-TimeField.react-spectrum-TimeField.react-spectrum-TimeField.react-spectrum-TimeField {\n min-width: var(--spectrum-global-dimension-size-1250);\n}\n\n.react-spectrum-TimeField-fieldWrapper.react-spectrum-TimeField-fieldWrapper.react-spectrum-TimeField-fieldWrapper {\n width: auto;\n min-width: var(--spectrum-global-dimension-size-1250);\n}\n\n.react-spectrum-Datepicker-input.react-spectrum-Datepicker-input.react-spectrum-Datepicker-input {\n /* always reserve space for the validation icon */\n padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));\n cursor: text;\n}\n\n.react-spectrum-Datepicker-inputContents {\n display: flex;\n align-items: center;\n height: 100%;\n overflow-x: auto;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* Internet Explorer 10+ */\n\n &::-webkit-scrollbar { /* WebKit */\n width: 0;\n height: 0;\n display: none;\n }\n}\n\n.react-spectrum-Datepicker-inputSized {\n display: inline;\n align-items: center;\n}\n\n.react-spectrum-Datepicker-rangeDash {\n &:before {\n content: '–';\n }\n}\n\n.react-spectrum-Datepicker-segments {\n display: inline-block;\n align-items: center;\n}\n\n.react-spectrum-Datepicker-literal {\n white-space: pre;\n user-select: none;\n color: var(--spectrum-textfield-text-color);\n}\n\n.react-spectrum-DatePicker-cell {\n border: none;\n background: none;\n padding: 0 2px;\n border-radius: var(--spectrum-alias-border-radius-small);\n font-variant-numeric: tabular-nums;\n text-align: end;\n box-sizing: content-box;\n white-space: nowrap;\n color: var(--spectrum-textfield-text-color);\n\n &::selection {\n /* hide the selection because there is no way to fully prevent it in Firefox */\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1742153 */\n background: transparent;\n }\n}\n\n.react-spectrum-DatePicker-cell.is-placeholder {\n color: var(--spectrum-gray-600);\n\n .react-spectrum-DatePicker-placeholder {\n text-align: center;\n pointer-events: none;\n }\n}\n\n.react-spectrum-DatePicker-cell.is-placeholder ~ .react-spectrum-Datepicker-literal {\n color: var(--spectrum-global-color-gray-600);\n}\n\n.react-spectrum-DatePicker-cell.is-read-only {\n color: var(--spectrum-global-color-gray-700);\n}\n\n.react-spectrum-DatePicker-cell:focus {\n background-color: var(--spectrum-accent-background-color-default);\n color: white;\n caret-color: transparent;\n outline: none;\n}\n\n.react-spectrum-Datepicker-dialog.react-spectrum-Datepicker-dialog {\n width: auto;\n}\n\n.react-spectrum-Datepicker-dialogContent {\n display: flex;\n flex-direction: column;\n\n .react-spectrum-Datepicker-calendar.is-invalid {\n /* Only apply display: contents when the calendar is invalid, which allows us to move the\n * error message below the time fields. Otherwise, don't do this because it breaks dragging\n * the selected range on Android. */\n display: contents;\n }\n\n /* Push the help text within the calendar down to the bottom of the dialog, below the time fields. */\n :global(.spectrum-Calendar-helpText) {\n order: 10;\n margin: var(--spectrum-global-dimension-size-200) var(--spectrum-calendar-day-padding) 0 var(--spectrum-calendar-day-padding);\n }\n}\n\n/* when displayed in a tray, reduce the padding of the dialog */\n@media (max-width: 700px) {\n .react-spectrum-Datepicker-dialog {\n --spectrum-dialog-padding-x: 8px;\n\n .react-spectrum-Datepicker-dialogContent {\n margin: 0 auto;\n max-width: calc((var(--spectrum-calendar-day-width) * 7) + (var(--spectrum-calendar-day-padding) * 12));\n }\n }\n}\n\n.react-spectrum-Datepicker-timeFields {\n width: 100%;\n min-width: calc(var(--spectrum-calendar-day-width) * 7);\n max-width: calc((var(--spectrum-calendar-day-width) * 7) + (var(--spectrum-calendar-day-padding) * 12));\n padding: 0 var(--spectrum-calendar-day-padding);\n box-sizing: border-box;\n}\n\n@media (forced-colors:active) {\n .react-spectrum-DatePicker-cell:focus {\n forced-color-adjust: none;\n background-color: Highlight;\n color: HighlightText;\n }\n .react-spectrum-DatePicker-cell.is-read-only {\n color: ButtonText;\n &:focus {\n color: HighlightText;\n }\n }\n .react-spectrum-DatePicker-cell.is-placeholder {\n color: ButtonText;\n &:focus {\n color: HighlightText;\n }\n }\n}\n"],"names":[],"version":3,"file":"
|
|
1
|
+
{"mappings":"AAYA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAMA;;;;AAIA;;;;AAMA;;;;AAIA;;;;AAIA;;;;;AAKA;;;;;AAMA;;;;;;;;;AAQE;;;;;;AAOF;;;;;AAME;;;;AAKF;;;;;AAKA;;;;;;;AAMA;;;;;;;;;;;;AAWE;;;;AAOF;;;;AAGE;;;;;AAMF;;;;AAIA;;;;AAIA;;;;;;;AAOA;;;;AAIA;;;;;AAIE;;;;AAQA;;;;;AAQF;EACE;;;;EAGE;;;;;;AAOJ;;;;;;;;AAQA;EACE;;;;;;EAKA;;;;EAEE;;;;EAIF;;;;EAEE","sources":["packages/@react-spectrum/datepicker/src/styles.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n.react-spectrum-Datepicker-fieldWrapper.react-spectrum-Datepicker-fieldWrapper.react-spectrum-Datepicker-fieldWrapper {\n width: auto;\n min-width: var(--spectrum-global-dimension-size-2000);\n max-width: 100%;\n }\n\n.react-spectrum-Datepicker-startField {\n width: auto;\n padding-inline-end: var(--spectrum-global-dimension-size-100);\n}\n\n.react-spectrum-Datepicker-endField {\n width: auto;\n flex: 1;\n padding-inline-start: var(--spectrum-global-dimension-size-100);\n}\n\n.react-spectrum-Datepicker-field ~ .react-spectrum-Datepicker-endField > .react-spectrum-Datepicker-input {\n border-inline-start-width: 0;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n}\n\n.react-spectrum-Datepicker-field.react-spectrum-Datepicker-field {\n width: 100%;\n}\n\n.react-spectrum-Datepicker-field .react-spectrum-DateField-Input {\n line-height: var(--spectrum-body-4-text-line-height);\n}\n\n/* specificity war with .spectrum-Field--positionSide etc. */\n.react-spectrum-DateField.react-spectrum-DateField.react-spectrum-DateField.react-spectrum-DateField {\n min-width: var(--spectrum-global-dimension-size-2000);\n}\n\n.react-spectrum-TimeField.react-spectrum-TimeField.react-spectrum-TimeField.react-spectrum-TimeField {\n min-width: var(--spectrum-global-dimension-size-1250);\n}\n\n.react-spectrum-TimeField-fieldWrapper.react-spectrum-TimeField-fieldWrapper.react-spectrum-TimeField-fieldWrapper {\n width: auto;\n min-width: var(--spectrum-global-dimension-size-1250);\n}\n\n.react-spectrum-Datepicker-input.react-spectrum-Datepicker-input.react-spectrum-Datepicker-input {\n /* always reserve space for the validation icon */\n padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));\n cursor: text;\n}\n\n.react-spectrum-Datepicker-inputContents {\n display: flex;\n align-items: center;\n height: 100%;\n overflow-x: auto;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* Internet Explorer 10+ */\n\n &::-webkit-scrollbar { /* WebKit */\n width: 0;\n height: 0;\n display: none;\n }\n}\n\n.react-spectrum-Datepicker-inputSized {\n display: inline;\n align-items: center;\n}\n\n.react-spectrum-Datepicker-rangeDash {\n &:before {\n content: '–';\n }\n}\n\n.react-spectrum-Datepicker-segments {\n display: inline-block;\n align-items: center;\n}\n\n.react-spectrum-Datepicker-literal {\n white-space: pre;\n user-select: none;\n color: var(--spectrum-textfield-text-color);\n}\n\n.react-spectrum-DatePicker-cell {\n border: none;\n background: none;\n padding: 0 2px;\n border-radius: var(--spectrum-alias-border-radius-small);\n font-variant-numeric: tabular-nums;\n text-align: end;\n box-sizing: content-box;\n white-space: nowrap;\n color: var(--spectrum-textfield-text-color);\n\n &::selection {\n /* hide the selection because there is no way to fully prevent it in Firefox */\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1742153 */\n background: transparent;\n }\n}\n\n.react-spectrum-DatePicker-cell.is-placeholder {\n color: var(--spectrum-gray-600);\n\n .react-spectrum-DatePicker-placeholder {\n text-align: center;\n pointer-events: none;\n }\n}\n\n.react-spectrum-DatePicker-cell.is-placeholder ~ .react-spectrum-Datepicker-literal {\n color: var(--spectrum-global-color-gray-600);\n}\n\n.react-spectrum-DatePicker-cell.is-read-only {\n color: var(--spectrum-global-color-gray-700);\n}\n\n.react-spectrum-DatePicker-cell:focus {\n background-color: var(--spectrum-accent-background-color-default);\n color: white;\n caret-color: transparent;\n outline: none;\n}\n\n.react-spectrum-Datepicker-dialog.react-spectrum-Datepicker-dialog {\n width: auto;\n}\n\n.react-spectrum-Datepicker-dialogContent {\n display: flex;\n flex-direction: column;\n\n .react-spectrum-Datepicker-calendar.is-invalid {\n /* Only apply display: contents when the calendar is invalid, which allows us to move the\n * error message below the time fields. Otherwise, don't do this because it breaks dragging\n * the selected range on Android. */\n display: contents;\n }\n\n /* Push the help text within the calendar down to the bottom of the dialog, below the time fields. */\n :global(.spectrum-Calendar-helpText) {\n order: 10;\n margin: var(--spectrum-global-dimension-size-200) var(--spectrum-calendar-day-padding) 0 var(--spectrum-calendar-day-padding);\n }\n}\n\n/* when displayed in a tray, reduce the padding of the dialog */\n@media (max-width: 700px) {\n .react-spectrum-Datepicker-dialog {\n --spectrum-dialog-padding-x: 8px;\n\n .react-spectrum-Datepicker-dialogContent {\n margin: 0 auto;\n max-width: calc((var(--spectrum-calendar-day-width) * 7) + (var(--spectrum-calendar-day-padding) * 12));\n }\n }\n}\n\n.react-spectrum-Datepicker-timeFields {\n width: 100%;\n min-width: calc(var(--spectrum-calendar-day-width) * 7);\n max-width: calc((var(--spectrum-calendar-day-width) * 7) + (var(--spectrum-calendar-day-padding) * 12));\n padding: 0 var(--spectrum-calendar-day-padding);\n box-sizing: border-box;\n}\n\n@media (forced-colors:active) {\n .react-spectrum-DatePicker-cell:focus {\n forced-color-adjust: none;\n background-color: Highlight;\n color: HighlightText;\n }\n .react-spectrum-DatePicker-cell.is-read-only {\n color: ButtonText;\n &:focus {\n color: HighlightText;\n }\n }\n .react-spectrum-DatePicker-cell.is-placeholder {\n color: ButtonText;\n &:focus {\n color: HighlightText;\n }\n }\n}\n"],"names":[],"version":3,"file":"datepicker.e85992d8.css.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AI2BA;;;GAGG;AACH,OAAO,MAAM,WAgEP,CAAC,CAAmB,SAAT,SAAS,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACvDlH;;GAEG;AACH,OAAO,MAAM,
|
|
1
|
+
{"mappings":";;;AI2BA;;;GAGG;AACH,OAAO,MAAM,WAgEP,CAAC,CAAmB,SAAT,SAAS,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACvDlH;;GAEG;AACH,OAAO,MAAM,YA4JP,CAAC,CAAmB,SAAT,SAAS,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;AC/JnH;;;GAGG;AACH,OAAO,MAAM,iBAwLP,CAAC,CAAmB,SAAT,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACxMxH;;;GAGG;AACH,OAAO,MAAM,WAyEP,CAAC,CAAmB,SAAT,SAAS,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACvFlH,YAAY,EAAC,sBAAsB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,sBAAsB,EAAC,MAAM,yBAAyB,CAAC","sources":["packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DatePickerField.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/Input.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/utils.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/TimeField.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DatePicker.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DateRangePicker.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DateField.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/index.ts","packages/@react-spectrum/datepicker/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {DatePicker} from './DatePicker';\nexport {DateRangePicker} from './DateRangePicker';\nexport {TimeField} from './TimeField';\nexport {DateField} from './DateField';\nexport type {SpectrumDateFieldProps, SpectrumDatePickerProps, SpectrumDateRangePickerProps, SpectrumTimeFieldProps} from '@react-types/datepicker';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/utils.main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var $6Arg9$reactspectrumutils = require("@react-spectrum/utils");
|
|
2
2
|
var $6Arg9$reactariafocus = require("@react-aria/focus");
|
|
3
|
-
var $6Arg9$react = require("react");
|
|
4
3
|
var $6Arg9$reactariai18n = require("@react-aria/i18n");
|
|
4
|
+
var $6Arg9$react = require("react");
|
|
5
5
|
var $6Arg9$reactariadatepicker = require("@react-aria/datepicker");
|
|
6
6
|
var $6Arg9$reactariautils = require("@react-aria/utils");
|
|
7
7
|
var $6Arg9$reactspectrumprovider = require("@react-spectrum/provider");
|
|
@@ -103,7 +103,7 @@ function $9d3b96715dbbb2b7$export$31e22e3c931fc056(state) {
|
|
|
103
103
|
let currentDate = new Date();
|
|
104
104
|
let formatedDate = state.getDateFormatter(locale, {
|
|
105
105
|
shouldForceLeadingZeros: true
|
|
106
|
-
}).format(currentDate
|
|
106
|
+
}).format(currentDate);
|
|
107
107
|
let totalCharacters = formatedDate.length;
|
|
108
108
|
// The max of two is for times with only hours.
|
|
109
109
|
// As the length of a date grows we need to proportionally increase the width.
|
package/dist/utils.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAYM,SAAS,0CAAkB,KAA8E;IAC9G,IAAI,YAAY,CAAA,GAAA,qCAAe,EAAE;QAAC,WAAW;IAAO;IACpD,IAAI,eAAe,CAAA,GAAA,0CAAc;IACjC,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,IAAI,MAAM,WAAW,EACnB,OAAO,MAAM,WAAW;QAG1B,IAAI,MAAM,kBAAkB,EAC1B,OACE,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CAAW,EAAE,OAAO;YACvB;gBACE,CAAA,GAAA,wCAAiB,EAAE,QAAQ,UAAU,CAAC;oBAAC,UAAU;gBAAI;YACvD;QACF,CAAA;IACA,OAAO;AACT;AAEO,SAAS,0CAAsB,KAA6F;QACpH;IAAb,IAAI,UAAS,aAAA,CAAA,GAAA,8BAAQ,iBAAR,iCAAA,WAAa,MAAM;IAChC,IAAI,cAAc,IAAI;IACtB,IAAI,eAAe,MAAM,gBAAgB,CAAC,QAAQ;QAAC,yBAAyB;IAAI,GAAG,MAAM,CAAC;IAC1F,IAAI,kBAAmB,aAAa,MAAM;IAE1C,+CAA+C;IAC/C,8EAA8E;IAC9E,mFAAmF;IACnF,iEAAiE;IACjE,OAAQ,kBAAkB,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,kBAAkB,IAAI;AACtE","sources":["packages/@react-spectrum/datepicker/src/utils.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {createDOMRef} from '@react-spectrum/utils';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DateFormatter, useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {FocusableRef} from '@react-types/shared';\nimport {FormatterOptions} from '@react-stately/datepicker';\nimport React, {ReactNode, useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDisplayNames} from '@react-aria/datepicker';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider} from '@react-spectrum/provider';\n\nexport function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>): ReactNode {\n let formatter = useDateFormatter({dateStyle: 'short'});\n let displayNames = useDisplayNames();\n return useMemo(() => {\n if (props.description) {\n return props.description;\n }\n\n if (props.showFormatHelpText) {\n return (\n formatter.formatToParts(new Date()).map((s, i) => {\n if (s.type === 'literal') {\n return <span key={i}>{` ${s.value} `}</span>;\n }\n\n return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(s.type)}</span>;\n })\n );\n }\n\n return '';\n }, [props.description, props.showFormatHelpText, formatter, displayNames]);\n}\n\nexport function useVisibleMonths(maxVisibleMonths: number): number {\n let {scale} = useProvider()!;\n let [visibleMonths, setVisibleMonths] = useState(getVisibleMonths(scale));\n useLayoutEffect(() => {\n let onResize = () => setVisibleMonths(getVisibleMonths(scale));\n onResize();\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [scale]);\n\n return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));\n}\n\nfunction getVisibleMonths(scale) {\n if (typeof window === 'undefined') {\n return 1;\n }\n let monthWidth = scale === 'large' ? 336 : 280;\n let gap = scale === 'large' ? 30 : 24;\n let popoverPadding = scale === 'large' ? 32 : 48;\n return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));\n}\n\nexport function useFocusManagerRef(ref: FocusableRef<HTMLElement>): React.RefObject<HTMLElement | null> {\n let domRef = useRef<HTMLElement | null>(null);\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n createFocusManager(domRef).focusFirst({tabbable: true});\n }\n }));\n return domRef;\n}\n\nexport function useFormattedDateWidth(state: {getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter}): number {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate);\n let totalCharacters = formatedDate.length;\n\n // The max of two is for times with only hours.\n // As the length of a date grows we need to proportionally increase the width.\n // We use the character count with 'ch' units and add extra padding to accomate for\n // dates with months and time dashes, which are wider characters.\n return (totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2));\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {createDOMRef as $kDnTZ$createDOMRef} from "@react-spectrum/utils";
|
|
2
2
|
import {createFocusManager as $kDnTZ$createFocusManager} from "@react-aria/focus";
|
|
3
|
-
import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
|
|
4
3
|
import {useDateFormatter as $kDnTZ$useDateFormatter, useLocale as $kDnTZ$useLocale} from "@react-aria/i18n";
|
|
4
|
+
import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
|
|
5
5
|
import {useDisplayNames as $kDnTZ$useDisplayNames} from "@react-aria/datepicker";
|
|
6
6
|
import {useLayoutEffect as $kDnTZ$useLayoutEffect} from "@react-aria/utils";
|
|
7
7
|
import {useProvider as $kDnTZ$useProvider} from "@react-spectrum/provider";
|
|
@@ -90,7 +90,7 @@ function $ea94a5cfe92db3c2$export$31e22e3c931fc056(state) {
|
|
|
90
90
|
let currentDate = new Date();
|
|
91
91
|
let formatedDate = state.getDateFormatter(locale, {
|
|
92
92
|
shouldForceLeadingZeros: true
|
|
93
|
-
}).format(currentDate
|
|
93
|
+
}).format(currentDate);
|
|
94
94
|
let totalCharacters = formatedDate.length;
|
|
95
95
|
// The max of two is for times with only hours.
|
|
96
96
|
// As the length of a date grows we need to proportionally increase the width.
|
package/dist/utils.module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {createDOMRef as $kDnTZ$createDOMRef} from "@react-spectrum/utils";
|
|
2
2
|
import {createFocusManager as $kDnTZ$createFocusManager} from "@react-aria/focus";
|
|
3
|
-
import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
|
|
4
3
|
import {useDateFormatter as $kDnTZ$useDateFormatter, useLocale as $kDnTZ$useLocale} from "@react-aria/i18n";
|
|
4
|
+
import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
|
|
5
5
|
import {useDisplayNames as $kDnTZ$useDisplayNames} from "@react-aria/datepicker";
|
|
6
6
|
import {useLayoutEffect as $kDnTZ$useLayoutEffect} from "@react-aria/utils";
|
|
7
7
|
import {useProvider as $kDnTZ$useProvider} from "@react-spectrum/provider";
|
|
@@ -90,7 +90,7 @@ function $ea94a5cfe92db3c2$export$31e22e3c931fc056(state) {
|
|
|
90
90
|
let currentDate = new Date();
|
|
91
91
|
let formatedDate = state.getDateFormatter(locale, {
|
|
92
92
|
shouldForceLeadingZeros: true
|
|
93
|
-
}).format(currentDate
|
|
93
|
+
}).format(currentDate);
|
|
94
94
|
let totalCharacters = formatedDate.length;
|
|
95
95
|
// The max of two is for times with only hours.
|
|
96
96
|
// As the length of a date grows we need to proportionally increase the width.
|
package/dist/utils.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAYM,SAAS,0CAAkB,KAA8E;IAC9G,IAAI,YAAY,CAAA,GAAA,uBAAe,EAAE;QAAC,WAAW;IAAO;IACpD,IAAI,eAAe,CAAA,GAAA,sBAAc;IACjC,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI,MAAM,WAAW,EACnB,OAAO,MAAM,WAAW;QAG1B,IAAI,MAAM,kBAAkB,EAC1B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A,mBAAW,EAAE,OAAO;YACvB;gBACE,CAAA,GAAA,yBAAiB,EAAE,QAAQ,UAAU,CAAC;oBAAC,UAAU;gBAAI;YACvD;QACF,CAAA;IACA,OAAO;AACT;AAEO,SAAS,0CAAsB,KAA6F;QACpH;IAAb,IAAI,UAAS,aAAA,CAAA,GAAA,gBAAQ,iBAAR,iCAAA,WAAa,MAAM;IAChC,IAAI,cAAc,IAAI;IACtB,IAAI,eAAe,MAAM,gBAAgB,CAAC,QAAQ;QAAC,yBAAyB;IAAI,GAAG,MAAM,CAAC;IAC1F,IAAI,kBAAmB,aAAa,MAAM;IAE1C,+CAA+C;IAC/C,8EAA8E;IAC9E,mFAAmF;IACnF,iEAAiE;IACjE,OAAQ,kBAAkB,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,kBAAkB,IAAI;AACtE","sources":["packages/@react-spectrum/datepicker/src/utils.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {createDOMRef} from '@react-spectrum/utils';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DateFormatter, useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {FocusableRef} from '@react-types/shared';\nimport {FormatterOptions} from '@react-stately/datepicker';\nimport React, {ReactNode, useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDisplayNames} from '@react-aria/datepicker';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider} from '@react-spectrum/provider';\n\nexport function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>): ReactNode {\n let formatter = useDateFormatter({dateStyle: 'short'});\n let displayNames = useDisplayNames();\n return useMemo(() => {\n if (props.description) {\n return props.description;\n }\n\n if (props.showFormatHelpText) {\n return (\n formatter.formatToParts(new Date()).map((s, i) => {\n if (s.type === 'literal') {\n return <span key={i}>{` ${s.value} `}</span>;\n }\n\n return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(s.type)}</span>;\n })\n );\n }\n\n return '';\n }, [props.description, props.showFormatHelpText, formatter, displayNames]);\n}\n\nexport function useVisibleMonths(maxVisibleMonths: number): number {\n let {scale} = useProvider()!;\n let [visibleMonths, setVisibleMonths] = useState(getVisibleMonths(scale));\n useLayoutEffect(() => {\n let onResize = () => setVisibleMonths(getVisibleMonths(scale));\n onResize();\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [scale]);\n\n return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));\n}\n\nfunction getVisibleMonths(scale) {\n if (typeof window === 'undefined') {\n return 1;\n }\n let monthWidth = scale === 'large' ? 336 : 280;\n let gap = scale === 'large' ? 30 : 24;\n let popoverPadding = scale === 'large' ? 32 : 48;\n return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));\n}\n\nexport function useFocusManagerRef(ref: FocusableRef<HTMLElement>): React.RefObject<HTMLElement | null> {\n let domRef = useRef<HTMLElement | null>(null);\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n createFocusManager(domRef).focusFirst({tabbable: true});\n }\n }));\n return domRef;\n}\n\nexport function useFormattedDateWidth(state: {getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter}): number {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate);\n let totalCharacters = formatedDate.length;\n\n // The max of two is for times with only hours.\n // As the length of a date grows we need to proportionally increase the width.\n // We use the character count with 'ch' units and add extra padding to accomate for\n // dates with months and time dashes, which are wider characters.\n return (totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2));\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/datepicker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@internationalized/date": "^3.
|
|
40
|
-
"@react-aria/datepicker": "^3.14.
|
|
41
|
-
"@react-aria/focus": "^3.20.
|
|
42
|
-
"@react-aria/i18n": "^3.12.
|
|
43
|
-
"@react-aria/interactions": "^3.
|
|
44
|
-
"@react-aria/utils": "^3.28.
|
|
45
|
-
"@react-spectrum/button": "^3.16.
|
|
46
|
-
"@react-spectrum/calendar": "^3.
|
|
47
|
-
"@react-spectrum/dialog": "^3.8.
|
|
48
|
-
"@react-spectrum/form": "^3.7.
|
|
49
|
-
"@react-spectrum/label": "^3.16.
|
|
50
|
-
"@react-spectrum/layout": "^3.6.
|
|
51
|
-
"@react-spectrum/utils": "^3.12.
|
|
52
|
-
"@react-spectrum/view": "^3.6.
|
|
53
|
-
"@react-stately/datepicker": "^3.
|
|
54
|
-
"@react-types/datepicker": "^3.
|
|
55
|
-
"@react-types/shared": "^3.
|
|
56
|
-
"@spectrum-icons/ui": "^3.6.
|
|
57
|
-
"@spectrum-icons/workflow": "^4.2.
|
|
39
|
+
"@internationalized/date": "^3.8.0",
|
|
40
|
+
"@react-aria/datepicker": "^3.14.2",
|
|
41
|
+
"@react-aria/focus": "^3.20.2",
|
|
42
|
+
"@react-aria/i18n": "^3.12.8",
|
|
43
|
+
"@react-aria/interactions": "^3.25.0",
|
|
44
|
+
"@react-aria/utils": "^3.28.2",
|
|
45
|
+
"@react-spectrum/button": "^3.16.13",
|
|
46
|
+
"@react-spectrum/calendar": "^3.7.0",
|
|
47
|
+
"@react-spectrum/dialog": "^3.8.20",
|
|
48
|
+
"@react-spectrum/form": "^3.7.14",
|
|
49
|
+
"@react-spectrum/label": "^3.16.14",
|
|
50
|
+
"@react-spectrum/layout": "^3.6.14",
|
|
51
|
+
"@react-spectrum/utils": "^3.12.4",
|
|
52
|
+
"@react-spectrum/view": "^3.6.18",
|
|
53
|
+
"@react-stately/datepicker": "^3.14.0",
|
|
54
|
+
"@react-types/datepicker": "^3.12.0",
|
|
55
|
+
"@react-types/shared": "^3.29.0",
|
|
56
|
+
"@spectrum-icons/ui": "^3.6.15",
|
|
57
|
+
"@spectrum-icons/workflow": "^4.2.20",
|
|
58
58
|
"@swc/helpers": "^0.5.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
|
|
73
73
|
}
|
package/src/DatePicker.tsx
CHANGED
|
@@ -173,6 +173,7 @@ export const DatePicker = React.forwardRef(function DatePicker<T extends DateVal
|
|
|
173
173
|
visibleMonths={visibleMonths}
|
|
174
174
|
pageBehavior={pageBehavior}
|
|
175
175
|
firstDayOfWeek={firstDayOfWeek}
|
|
176
|
+
createCalendar={props.createCalendar}
|
|
176
177
|
UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />
|
|
177
178
|
{showTimeField &&
|
|
178
179
|
<div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>
|
package/src/DatePickerField.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {createCalendar} from '@internationalized/date';
|
|
|
15
15
|
import {DatePickerSegment} from './DatePickerSegment';
|
|
16
16
|
import datepickerStyles from './styles.css';
|
|
17
17
|
import {DateValue, SpectrumDatePickerProps} from '@react-types/datepicker';
|
|
18
|
-
import React, {useRef} from 'react';
|
|
18
|
+
import React, {ReactNode, useRef} from 'react';
|
|
19
19
|
import {useDateField} from '@react-aria/datepicker';
|
|
20
20
|
import {useDateFieldState} from '@react-stately/datepicker';
|
|
21
21
|
import {useLocale} from '@react-aria/i18n';
|
|
@@ -26,7 +26,7 @@ interface DatePickerFieldProps<T extends DateValue> extends SpectrumDatePickerPr
|
|
|
26
26
|
maxGranularity?: SpectrumDatePickerProps<T>['granularity']
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps<T>) {
|
|
29
|
+
export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps<T>): ReactNode {
|
|
30
30
|
let {
|
|
31
31
|
isDisabled,
|
|
32
32
|
isReadOnly,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import {classNames} from '@react-spectrum/utils';
|
|
14
14
|
import {DateFieldState, DateSegment} from '@react-stately/datepicker';
|
|
15
15
|
import {DatePickerBase, DateValue} from '@react-types/datepicker';
|
|
16
|
-
import React, {useRef} from 'react';
|
|
16
|
+
import React, {ReactNode, useRef} from 'react';
|
|
17
17
|
import styles from './styles.css';
|
|
18
18
|
import {useDateSegment} from '@react-aria/datepicker';
|
|
19
19
|
|
|
@@ -26,7 +26,7 @@ interface LiteralSegmentProps {
|
|
|
26
26
|
segment: DateSegment
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps) {
|
|
29
|
+
export function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps): ReactNode {
|
|
30
30
|
switch (segment.type) {
|
|
31
31
|
// A separator, e.g. punctuation
|
|
32
32
|
case 'literal':
|
package/src/DateRangePicker.tsx
CHANGED
|
@@ -191,6 +191,7 @@ export const DateRangePicker = React.forwardRef(function DateRangePicker<T exten
|
|
|
191
191
|
visibleMonths={visibleMonths}
|
|
192
192
|
pageBehavior={pageBehavior}
|
|
193
193
|
firstDayOfWeek={firstDayOfWeek}
|
|
194
|
+
createCalendar={props.createCalendar}
|
|
194
195
|
UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />
|
|
195
196
|
{showTimeField &&
|
|
196
197
|
<Flex gap="size-100" marginTop="size-100" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>
|
package/src/utils.tsx
CHANGED
|
@@ -11,15 +11,16 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import {createDOMRef} from '@react-spectrum/utils';
|
|
13
13
|
import {createFocusManager} from '@react-aria/focus';
|
|
14
|
+
import {DateFormatter, useDateFormatter, useLocale} from '@react-aria/i18n';
|
|
14
15
|
import {FocusableRef} from '@react-types/shared';
|
|
15
|
-
import
|
|
16
|
+
import {FormatterOptions} from '@react-stately/datepicker';
|
|
17
|
+
import React, {ReactNode, useImperativeHandle, useMemo, useRef, useState} from 'react';
|
|
16
18
|
import {SpectrumDatePickerBase} from '@react-types/datepicker';
|
|
17
|
-
import {useDateFormatter, useLocale} from '@react-aria/i18n';
|
|
18
19
|
import {useDisplayNames} from '@react-aria/datepicker';
|
|
19
20
|
import {useLayoutEffect} from '@react-aria/utils';
|
|
20
21
|
import {useProvider} from '@react-spectrum/provider';
|
|
21
22
|
|
|
22
|
-
export function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>) {
|
|
23
|
+
export function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>): ReactNode {
|
|
23
24
|
let formatter = useDateFormatter({dateStyle: 'short'});
|
|
24
25
|
let displayNames = useDisplayNames();
|
|
25
26
|
return useMemo(() => {
|
|
@@ -43,7 +44,7 @@ export function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'desc
|
|
|
43
44
|
}, [props.description, props.showFormatHelpText, formatter, displayNames]);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export function useVisibleMonths(maxVisibleMonths: number) {
|
|
47
|
+
export function useVisibleMonths(maxVisibleMonths: number): number {
|
|
47
48
|
let {scale} = useProvider()!;
|
|
48
49
|
let [visibleMonths, setVisibleMonths] = useState(getVisibleMonths(scale));
|
|
49
50
|
useLayoutEffect(() => {
|
|
@@ -69,7 +70,7 @@ function getVisibleMonths(scale) {
|
|
|
69
70
|
return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
export function useFocusManagerRef(ref: FocusableRef<HTMLElement>) {
|
|
73
|
+
export function useFocusManagerRef(ref: FocusableRef<HTMLElement>): React.RefObject<HTMLElement | null> {
|
|
73
74
|
let domRef = useRef<HTMLElement | null>(null);
|
|
74
75
|
useImperativeHandle(ref, () => ({
|
|
75
76
|
...createDOMRef(domRef),
|
|
@@ -80,10 +81,10 @@ export function useFocusManagerRef(ref: FocusableRef<HTMLElement>) {
|
|
|
80
81
|
return domRef;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
export function useFormattedDateWidth(state) {
|
|
84
|
+
export function useFormattedDateWidth(state: {getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter}): number {
|
|
84
85
|
let locale = useLocale()?.locale;
|
|
85
86
|
let currentDate = new Date();
|
|
86
|
-
let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate
|
|
87
|
+
let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate);
|
|
87
88
|
let totalCharacters = formatedDate.length;
|
|
88
89
|
|
|
89
90
|
// The max of two is for times with only hours.
|