@react-spectrum/datepicker 3.9.5 → 3.10.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 +6 -4
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +8 -6
- package/dist/DateField.module.js +7 -5
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +32 -30
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +34 -32
- package/dist/DatePicker.module.js +33 -31
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/DatePickerField.main.js +5 -5
- package/dist/DatePickerField.main.js.map +1 -1
- package/dist/DatePickerField.mjs +6 -6
- package/dist/DatePickerField.module.js +5 -5
- package/dist/DatePickerField.module.js.map +1 -1
- package/dist/DatePickerSegment.main.js +12 -15
- package/dist/DatePickerSegment.main.js.map +1 -1
- package/dist/DatePickerSegment.mjs +13 -16
- package/dist/DatePickerSegment.module.js +12 -15
- package/dist/DatePickerSegment.module.js.map +1 -1
- package/dist/DateRangePicker.main.js +38 -35
- package/dist/DateRangePicker.main.js.map +1 -1
- package/dist/DateRangePicker.mjs +40 -37
- package/dist/DateRangePicker.module.js +39 -36
- package/dist/DateRangePicker.module.js.map +1 -1
- package/dist/Input.main.js +25 -19
- package/dist/Input.main.js.map +1 -1
- package/dist/Input.mjs +26 -20
- package/dist/Input.module.js +25 -19
- package/dist/Input.module.js.map +1 -1
- package/dist/TimeField.main.js +6 -4
- package/dist/TimeField.main.js.map +1 -1
- package/dist/TimeField.mjs +8 -6
- package/dist/TimeField.module.js +7 -5
- package/dist/TimeField.module.js.map +1 -1
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/inputgroup_vars_css.mjs +1 -1
- package/dist/intlStrings.mjs +1 -1
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/{styles.36ea4632.css → styles.b562cf4b.css} +9 -13
- package/dist/styles.b562cf4b.css.map +1 -0
- package/dist/styles_css.main.js +3 -0
- package/dist/styles_css.main.js.map +1 -1
- package/dist/styles_css.mjs +4 -1
- package/dist/styles_css.module.js +3 -0
- package/dist/styles_css.module.js.map +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/textfield_vars_css.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/utils.main.js +26 -11
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +28 -14
- package/dist/utils.module.js +27 -13
- package/dist/utils.module.js.map +1 -1
- package/dist/{vars.3692148b.css → vars.3d0e5be0.css} +2 -1
- package/dist/vars.3d0e5be0.css.map +1 -0
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +23 -23
- package/src/DateField.tsx +4 -1
- package/src/DatePicker.tsx +6 -3
- package/src/DatePickerField.tsx +2 -2
- package/src/DatePickerSegment.tsx +4 -7
- package/src/DateRangePicker.tsx +7 -3
- package/src/Input.tsx +10 -2
- package/src/TimeField.tsx +4 -1
- package/src/styles.css +8 -12
- package/src/utils.ts +15 -2
- package/dist/styles.36ea4632.css.map +0 -1
- package/dist/vars.3692148b.css.map +0 -1
package/dist/DateField.main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var $edac158d20ebe4a9$exports = require("./DatePickerSegment.main.js");
|
|
2
|
-
require("./styles.
|
|
2
|
+
require("./styles.b562cf4b.css");
|
|
3
3
|
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
4
|
var $c3ebc4931d9b9977$exports = require("./Input.main.js");
|
|
5
5
|
var $4d2e419f522adb48$exports = require("./utils.main.js");
|
|
@@ -67,7 +67,8 @@ function $1ab74d2cd1dc2e45$var$DateField(props, ref) {
|
|
|
67
67
|
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
68
68
|
let description = (0, $4d2e419f522adb48$exports.useFormatHelpText)(props);
|
|
69
69
|
if (description && !props.description) descriptionProps.id = null;
|
|
70
|
-
let validationState = state.validationState || (isInvalid ?
|
|
70
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
71
|
+
let approximateWidth = (0, $4d2e419f522adb48$exports.useFormattedDateWidth)(state) + 'ch';
|
|
71
72
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($2sBGl$react))).createElement((0, $2sBGl$reactspectrumlabel.Field), {
|
|
72
73
|
...props,
|
|
73
74
|
ref: domRef,
|
|
@@ -80,7 +81,7 @@ function $1ab74d2cd1dc2e45$var$DateField(props, ref) {
|
|
|
80
81
|
isInvalid: isInvalid,
|
|
81
82
|
validationErrors: validationErrors,
|
|
82
83
|
validationDetails: validationDetails,
|
|
83
|
-
wrapperClassName: (0, $2sBGl$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))),
|
|
84
|
+
wrapperClassName: (0, $2sBGl$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
84
85
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2sBGl$react))).createElement((0, $c3ebc4931d9b9977$exports.Input), {
|
|
85
86
|
ref: fieldRef,
|
|
86
87
|
fieldProps: fieldProps,
|
|
@@ -88,7 +89,8 @@ function $1ab74d2cd1dc2e45$var$DateField(props, ref) {
|
|
|
88
89
|
isQuiet: isQuiet,
|
|
89
90
|
autoFocus: autoFocus,
|
|
90
91
|
validationState: validationState,
|
|
91
|
-
|
|
92
|
+
minWidth: approximateWidth,
|
|
93
|
+
className: (0, $2sBGl$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-DateField')
|
|
92
94
|
}, state.segments.map((segment, i)=>/*#__PURE__*/ (0, ($parcel$interopDefault($2sBGl$react))).createElement((0, $edac158d20ebe4a9$exports.DatePickerSegment), {
|
|
93
95
|
key: i,
|
|
94
96
|
segment: segment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAkBD,SAAS,gCAA+B,KAAgC,EAAE,GAA8B;IACtG,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,aACF,SAAS,cACT,UAAU,cACV,UAAU,cACV,UAAU,WACV,OAAO,EACR,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,4CAAiB,EAAE;IAChC,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,EAAE;IACtB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAE;IACtB,IAAI,cAAC,UAAU,cAAE,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,aAAE,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,uCAAW,EAAE;QAC3I,GAAG,KAAK;kBACR;IACF,GAAG,OAAO;IAEV,uEAAuE;IACvE,wGAAwG;IACxG,IAAI,cAAc,CAAA,GAAA,2CAAgB,EAAE;IACpC,IAAI,eAAe,CAAC,MAAM,WAAW,EACnC,iBAAiB,EAAE,GAAG;IAGxB,IAAI,kBAAkB,MAAM,eAAe,IAAK,CAAA,YAAY,YAAY,IAAG;IAE3E,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACT,KAAK;QACL,aAAY;QACZ,aAAa;QACb,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,iBAAiB;QACjB,WAAW;QACX,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC/C,0DAAC,CAAA,GAAA,+BAAI;QACH,KAAK;QACL,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,iBAAiB;QACjB,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;OACvC,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;;AAIpC;AAEA;;;CAGC,GACD,MAAM,0DAAa,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/datepicker/src/DateField.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, SpectrumDateFieldProps} from '@react-types/datepicker';\nimport {Field} from '@react-spectrum/label';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\nimport React, {ReactElement, useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText} from './utils';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n isQuiet\n } = props;\n\n let domRef = useFocusManagerRef(ref);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let fieldRef = useRef(null);\n let inputRef = useRef(null);\n let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useDateField({\n ...props,\n inputRef\n }, state, fieldRef);\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 = null;\n }\n\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\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 <Input\n ref={fieldRef}\n fieldProps={fieldProps}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n autoFocus={autoFocus}\n validationState={validationState}\n className={classNames(datepickerStyles, 'react-spectrum-DateField')}>\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 </Input>\n </Field>\n );\n}\n\n/**\n * DateFields allow users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nconst _DateField = React.forwardRef(DateField) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DateField as DateField};\n"],"names":[],"version":3,"file":"DateField.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAkBD,SAAS,gCAA+B,KAAgC,EAAE,GAA8B;IACtG,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,aACF,SAAS,cACT,UAAU,cACV,UAAU,cACV,UAAU,WACV,OAAO,EACR,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,4CAAiB,EAAE;IAChC,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,EAAE;IACtB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAE;IACtB,IAAI,cAAC,UAAU,cAAE,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,aAAE,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,uCAAW,EAAE;QAC3I,GAAG,KAAK;kBACR;IACF,GAAG,OAAO;IAEV,uEAAuE;IACvE,wGAAwG;IACxG,IAAI,cAAc,CAAA,GAAA,2CAAgB,EAAE;IACpC,IAAI,eAAe,CAAC,MAAM,WAAW,EACnC,iBAAiB,EAAE,GAAG;IAGxB,IAAI,kBAAkB,MAAM,eAAe,IAAK,CAAA,YAAY,YAAY,IAAG;IAE3E,IAAI,mBAAmB,CAAA,GAAA,+CAAoB,EAAE,SAAS;IAEtD,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACT,KAAK;QACL,aAAY;QACZ,aAAa;QACb,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,iBAAiB;QACjB,WAAW;QACX,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;qBAC/C,0DAAC,CAAA,GAAA,+BAAI;QACH,KAAK;QACL,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,iBAAiB;QACjB,UAAU;QACV,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;OACvC,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;;AAIpC;AAEA;;;CAGC,GACD,MAAM,0DAAa,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/datepicker/src/DateField.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, SpectrumDateFieldProps} from '@react-types/datepicker';\nimport {Field} from '@react-spectrum/label';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\nimport React, {ReactElement, useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth} from './utils';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n isQuiet\n } = props;\n\n let domRef = useFocusManagerRef(ref);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let fieldRef = useRef(null);\n let inputRef = useRef(null);\n let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useDateField({\n ...props,\n inputRef\n }, state, fieldRef);\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 = null;\n }\n\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 <Input\n ref={fieldRef}\n fieldProps={fieldProps}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n autoFocus={autoFocus}\n validationState={validationState}\n minWidth={approximateWidth}\n className={classNames(datepickerStyles, 'react-spectrum-DateField')}>\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 </Input>\n </Field>\n );\n}\n\n/**\n * DateFields allow users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nconst _DateField = React.forwardRef(DateField) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DateField as DateField};\n"],"names":[],"version":3,"file":"DateField.main.js.map"}
|
package/dist/DateField.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.mjs";
|
|
2
|
-
import "./styles.
|
|
2
|
+
import "./styles.b562cf4b.css";
|
|
3
3
|
import $6iHxC$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
4
|
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
5
|
-
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6} from "./utils.mjs";
|
|
5
|
+
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6, useFormattedDateWidth as $04e96200274b03de$export$31e22e3c931fc056} from "./utils.mjs";
|
|
6
6
|
import {classNames as $6iHxC$classNames} from "@react-spectrum/utils";
|
|
7
7
|
import {createCalendar as $6iHxC$createCalendar} from "@internationalized/date";
|
|
8
8
|
import {Field as $6iHxC$Field} from "@react-spectrum/label";
|
|
@@ -61,7 +61,8 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
61
61
|
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
62
62
|
let description = (0, $04e96200274b03de$export$322f4580ccd8dde6)(props);
|
|
63
63
|
if (description && !props.description) descriptionProps.id = null;
|
|
64
|
-
let validationState = state.validationState || (isInvalid ?
|
|
64
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
65
|
+
let approximateWidth = (0, $04e96200274b03de$export$31e22e3c931fc056)(state) + 'ch';
|
|
65
66
|
return /*#__PURE__*/ (0, $6iHxC$react).createElement((0, $6iHxC$Field), {
|
|
66
67
|
...props,
|
|
67
68
|
ref: domRef,
|
|
@@ -74,7 +75,7 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
74
75
|
isInvalid: isInvalid,
|
|
75
76
|
validationErrors: validationErrors,
|
|
76
77
|
validationDetails: validationDetails,
|
|
77
|
-
wrapperClassName: (0, $6iHxC$classNames)((0, ($parcel$interopDefault($6iHxC$styles_cssmodulejs))),
|
|
78
|
+
wrapperClassName: (0, $6iHxC$classNames)((0, ($parcel$interopDefault($6iHxC$styles_cssmodulejs))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
78
79
|
}, /*#__PURE__*/ (0, $6iHxC$react).createElement((0, $79348162c55d687f$export$f5b8910cec6cf069), {
|
|
79
80
|
ref: fieldRef,
|
|
80
81
|
fieldProps: fieldProps,
|
|
@@ -82,7 +83,8 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
82
83
|
isQuiet: isQuiet,
|
|
83
84
|
autoFocus: autoFocus,
|
|
84
85
|
validationState: validationState,
|
|
85
|
-
|
|
86
|
+
minWidth: approximateWidth,
|
|
87
|
+
className: (0, $6iHxC$classNames)((0, ($parcel$interopDefault($6iHxC$styles_cssmodulejs))), 'react-spectrum-DateField')
|
|
86
88
|
}, state.segments.map((segment, i)=>/*#__PURE__*/ (0, $6iHxC$react).createElement((0, $cfa347761f172638$export$6388987c5223b54e), {
|
|
87
89
|
key: i,
|
|
88
90
|
segment: segment,
|
|
@@ -102,4 +104,4 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
102
104
|
|
|
103
105
|
|
|
104
106
|
export {$0129798af6791690$export$d9781c7894a82487 as DateField};
|
|
105
|
-
//# sourceMappingURL=DateField.
|
|
107
|
+
//# sourceMappingURL=DateField.module.js.map
|
package/dist/DateField.module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.module.js";
|
|
2
|
-
import "./styles.
|
|
2
|
+
import "./styles.b562cf4b.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
|
-
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6} from "./utils.module.js";
|
|
5
|
+
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6, useFormattedDateWidth as $04e96200274b03de$export$31e22e3c931fc056} from "./utils.module.js";
|
|
6
6
|
import {classNames as $6iHxC$classNames} from "@react-spectrum/utils";
|
|
7
7
|
import {createCalendar as $6iHxC$createCalendar} from "@internationalized/date";
|
|
8
8
|
import {Field as $6iHxC$Field} from "@react-spectrum/label";
|
|
@@ -61,7 +61,8 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
61
61
|
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
62
62
|
let description = (0, $04e96200274b03de$export$322f4580ccd8dde6)(props);
|
|
63
63
|
if (description && !props.description) descriptionProps.id = null;
|
|
64
|
-
let validationState = state.validationState || (isInvalid ?
|
|
64
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
65
|
+
let approximateWidth = (0, $04e96200274b03de$export$31e22e3c931fc056)(state) + 'ch';
|
|
65
66
|
return /*#__PURE__*/ (0, $6iHxC$react).createElement((0, $6iHxC$Field), {
|
|
66
67
|
...props,
|
|
67
68
|
ref: domRef,
|
|
@@ -74,7 +75,7 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
74
75
|
isInvalid: isInvalid,
|
|
75
76
|
validationErrors: validationErrors,
|
|
76
77
|
validationDetails: validationDetails,
|
|
77
|
-
wrapperClassName: (0, $6iHxC$classNames)((0, ($parcel$interopDefault($6iHxC$styles_cssmodulejs))),
|
|
78
|
+
wrapperClassName: (0, $6iHxC$classNames)((0, ($parcel$interopDefault($6iHxC$styles_cssmodulejs))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
78
79
|
}, /*#__PURE__*/ (0, $6iHxC$react).createElement((0, $79348162c55d687f$export$f5b8910cec6cf069), {
|
|
79
80
|
ref: fieldRef,
|
|
80
81
|
fieldProps: fieldProps,
|
|
@@ -82,7 +83,8 @@ function $0129798af6791690$var$DateField(props, ref) {
|
|
|
82
83
|
isQuiet: isQuiet,
|
|
83
84
|
autoFocus: autoFocus,
|
|
84
85
|
validationState: validationState,
|
|
85
|
-
|
|
86
|
+
minWidth: approximateWidth,
|
|
87
|
+
className: (0, $6iHxC$classNames)((0, ($parcel$interopDefault($6iHxC$styles_cssmodulejs))), 'react-spectrum-DateField')
|
|
86
88
|
}, state.segments.map((segment, i)=>/*#__PURE__*/ (0, $6iHxC$react).createElement((0, $cfa347761f172638$export$6388987c5223b54e), {
|
|
87
89
|
key: i,
|
|
88
90
|
segment: segment,
|
|
@@ -1 +1 @@
|
|
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AAK;QACL,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,iBAAiB;QACjB,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;OACvC,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;;AAIpC;AAEA;;;CAGC,GACD,MAAM,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/datepicker/src/DateField.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, SpectrumDateFieldProps} from '@react-types/datepicker';\nimport {Field} from '@react-spectrum/label';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\nimport React, {ReactElement, useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText} from './utils';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n isQuiet\n } = props;\n\n let domRef = useFocusManagerRef(ref);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let fieldRef = useRef(null);\n let inputRef = useRef(null);\n let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useDateField({\n ...props,\n inputRef\n }, state, fieldRef);\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 = null;\n }\n\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\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 <Input\n ref={fieldRef}\n fieldProps={fieldProps}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n autoFocus={autoFocus}\n validationState={validationState}\n className={classNames(datepickerStyles, 'react-spectrum-DateField')}>\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 </Input>\n </Field>\n );\n}\n\n/**\n * DateFields allow users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nconst _DateField = React.forwardRef(DateField) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DateField as DateField};\n"],"names":[],"version":3,"file":"DateField.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;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A,GAAA,yCAAI;QACH,KAAK;QACL,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,iBAAiB;QACjB,UAAU;QACV,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;OACvC,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;;AAIpC;AAEA;;;CAGC,GACD,MAAM,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/datepicker/src/DateField.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, SpectrumDateFieldProps} from '@react-types/datepicker';\nimport {Field} from '@react-spectrum/label';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\nimport React, {ReactElement, useRef} from 'react';\nimport {useDateField} from '@react-aria/datepicker';\nimport {useDateFieldState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth} from './utils';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n isQuiet\n } = props;\n\n let domRef = useFocusManagerRef(ref);\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let fieldRef = useRef(null);\n let inputRef = useRef(null);\n let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useDateField({\n ...props,\n inputRef\n }, state, fieldRef);\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 = null;\n }\n\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 <Input\n ref={fieldRef}\n fieldProps={fieldProps}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n autoFocus={autoFocus}\n validationState={validationState}\n minWidth={approximateWidth}\n className={classNames(datepickerStyles, 'react-spectrum-DateField')}>\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 </Input>\n </Field>\n );\n}\n\n/**\n * DateFields allow users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nconst _DateField = React.forwardRef(DateField) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DateField as DateField};\n"],"names":[],"version":3,"file":"DateField.module.js.map"}
|
package/dist/DatePicker.main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $bd22dc8dad9522bc$exports = require("./DatePickerField.main.js");
|
|
2
|
-
require("./styles.
|
|
2
|
+
require("./styles.b562cf4b.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("./vars.
|
|
6
|
+
require("./vars.3d0e5be0.css");
|
|
7
7
|
require("./textfield_vars_css.main.js");
|
|
8
8
|
require("./vars.ccbd2e3f.css");
|
|
9
9
|
var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
|
|
@@ -77,7 +77,7 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
77
77
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $2ni54$reactariainteractions.useHover)({
|
|
78
78
|
isDisabled: isDisabled
|
|
79
79
|
});
|
|
80
|
-
let targetRef = (0, $2ni54$react.useRef)();
|
|
80
|
+
let targetRef = (0, $2ni54$react.useRef)(undefined);
|
|
81
81
|
let state = (0, $2ni54$reactstatelydatepicker.useDatePickerState)({
|
|
82
82
|
...props,
|
|
83
83
|
shouldCloseOnSelect: ()=>!state.hasTime
|
|
@@ -86,7 +86,7 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
86
86
|
let { isOpen: isOpen, setOpen: setOpen } = state;
|
|
87
87
|
let { direction: direction } = (0, $2ni54$reactariai18n.useLocale)();
|
|
88
88
|
let domRef = (0, $4d2e419f522adb48$exports.useFocusManagerRef)(ref);
|
|
89
|
-
let stringFormatter = (0, $2ni54$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($0045b32a117743a7$exports))),
|
|
89
|
+
let stringFormatter = (0, $2ni54$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($0045b32a117743a7$exports))), '@react-spectrum/datepicker');
|
|
90
90
|
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $2ni54$reactariafocus.useFocusRing)({
|
|
91
91
|
within: true,
|
|
92
92
|
isTextInput: true,
|
|
@@ -97,30 +97,31 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
97
97
|
isTextInput: false,
|
|
98
98
|
autoFocus: autoFocus
|
|
99
99
|
});
|
|
100
|
-
let className = (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
let className = (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup', {
|
|
101
|
+
'spectrum-InputGroup--quiet': isQuiet,
|
|
102
|
+
'spectrum-InputGroup--invalid': isInvalid && !isDisabled,
|
|
103
|
+
'is-disabled': isDisabled,
|
|
104
|
+
'is-hovered': isHovered,
|
|
105
|
+
'is-focused': isFocused,
|
|
106
|
+
'focus-ring': isFocusVisible && !isFocusedButton
|
|
107
107
|
});
|
|
108
|
-
let fieldClassName = (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))),
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
let fieldClassName = (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input', {
|
|
109
|
+
'is-disabled': isDisabled,
|
|
110
|
+
'is-invalid': isInvalid && !isDisabled
|
|
111
111
|
});
|
|
112
112
|
// Note: this description is intentionally not passed to useDatePicker.
|
|
113
113
|
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
114
114
|
let description = (0, $4d2e419f522adb48$exports.useFormatHelpText)(props);
|
|
115
115
|
if (description && !props.description) descriptionProps.id = null;
|
|
116
116
|
let placeholder = placeholderValue;
|
|
117
|
-
let timePlaceholder = placeholder &&
|
|
118
|
-
let timeMinValue = props.minValue &&
|
|
119
|
-
let timeMaxValue = props.maxValue &&
|
|
120
|
-
let timeGranularity = state.granularity ===
|
|
117
|
+
let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;
|
|
118
|
+
let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;
|
|
119
|
+
let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;
|
|
120
|
+
let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;
|
|
121
121
|
let showTimeField = !!timeGranularity;
|
|
122
122
|
let visibleMonths = (0, $4d2e419f522adb48$exports.useVisibleMonths)(maxVisibleMonths);
|
|
123
|
-
let validationState = state.validationState || (isInvalid ?
|
|
123
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
124
|
+
let approximateWidth = (0, $4d2e419f522adb48$exports.useFormattedDateWidth)(state) + 'ch';
|
|
124
125
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $2ni54$reactspectrumlabel.Field), {
|
|
125
126
|
...props,
|
|
126
127
|
ref: domRef,
|
|
@@ -133,7 +134,7 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
133
134
|
isInvalid: isInvalid,
|
|
134
135
|
validationErrors: validationErrors,
|
|
135
136
|
validationDetails: validationDetails,
|
|
136
|
-
wrapperClassName: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))),
|
|
137
|
+
wrapperClassName: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
137
138
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement("div", {
|
|
138
139
|
...(0, $2ni54$reactariautils.mergeProps)(groupProps, hoverProps, focusProps),
|
|
139
140
|
className: className,
|
|
@@ -142,9 +143,10 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
142
143
|
isDisabled: isDisabled,
|
|
143
144
|
isQuiet: isQuiet,
|
|
144
145
|
validationState: validationState,
|
|
145
|
-
className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))),
|
|
146
|
+
className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-field'),
|
|
146
147
|
inputClassName: fieldClassName,
|
|
147
|
-
disableFocusRing: true
|
|
148
|
+
disableFocusRing: true,
|
|
149
|
+
minWidth: approximateWidth
|
|
148
150
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $bd22dc8dad9522bc$exports.DatePickerField), {
|
|
149
151
|
...fieldProps,
|
|
150
152
|
"data-testid": "date-field",
|
|
@@ -152,7 +154,7 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
152
154
|
})), /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $2ni54$reactspectrumdialog.DialogTrigger), {
|
|
153
155
|
type: "popover",
|
|
154
156
|
mobileType: "tray",
|
|
155
|
-
placement: direction ===
|
|
157
|
+
placement: direction === 'rtl' ? 'bottom right' : 'bottom left',
|
|
156
158
|
targetRef: targetRef,
|
|
157
159
|
hideArrow: true,
|
|
158
160
|
isOpen: isOpen,
|
|
@@ -160,25 +162,25 @@ function $5c1ddf85d7c27889$var$DatePicker(props, ref) {
|
|
|
160
162
|
shouldFlip: props.shouldFlip
|
|
161
163
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $2ni54$reactspectrumbutton.FieldButton), {
|
|
162
164
|
...(0, $2ni54$reactariautils.mergeProps)(buttonProps, focusPropsButton),
|
|
163
|
-
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))),
|
|
165
|
+
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-FieldButton'),
|
|
164
166
|
isQuiet: isQuiet,
|
|
165
167
|
validationState: validationState
|
|
166
168
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, ($parcel$interopDefault($2ni54$spectrumiconsworkflowCalendar))), null)), /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $2ni54$reactspectrumdialog.Dialog), {
|
|
167
|
-
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))),
|
|
169
|
+
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-dialog'),
|
|
168
170
|
...dialogProps
|
|
169
171
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $2ni54$reactspectrumview.Content), null, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement("div", {
|
|
170
|
-
className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))),
|
|
172
|
+
className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-dialogContent')
|
|
171
173
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $2ni54$reactspectrumcalendar.Calendar), {
|
|
172
174
|
...calendarProps,
|
|
173
175
|
visibleMonths: visibleMonths,
|
|
174
176
|
pageBehavior: pageBehavior,
|
|
175
|
-
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))),
|
|
176
|
-
|
|
177
|
+
UNSAFE_className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-calendar', {
|
|
178
|
+
'is-invalid': isInvalid
|
|
177
179
|
})
|
|
178
180
|
}), showTimeField && /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement("div", {
|
|
179
|
-
className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))),
|
|
181
|
+
className: (0, $2ni54$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-timeFields')
|
|
180
182
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2ni54$react))).createElement((0, $740ff83729a8f317$exports.TimeField), {
|
|
181
|
-
label: stringFormatter.format(
|
|
183
|
+
label: stringFormatter.format('time'),
|
|
182
184
|
value: state.timeValue,
|
|
183
185
|
onChange: state.setTimeValue,
|
|
184
186
|
placeholderValue: timePlaceholder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AA8BD,SAAS,iCAAgC,KAAiC,EAAE,GAA8B;IACxG,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,EACb,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,YAAY,CAAA,GAAA,mBAAK;IACrB,IAAI,QAAQ,CAAA,GAAA,gDAAiB,EAAE;QAC7B,GAAG,KAAK;QACR,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AkB,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,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;AAEA;;CAEC,GACD,MAAM,0DAAc,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","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, 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\nfunction 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 } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement>();\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 = null;\n }\n\n let placeholder: DateValue = 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 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 <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 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}\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nconst _DatePicker = React.forwardRef(DatePicker) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DateP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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;AAEA;;CAEC,GACD,MAAM,0DAAc,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","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\nfunction 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 } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement>(undefined);\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 = null;\n }\n\n let placeholder: DateValue = 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 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}\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nconst _DatePicker = React.forwardRef(DatePicker) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DatePicker as DatePicker};\n"],"names":[],"version":3,"file":"DatePicker.main.js.map"}
|
package/dist/DatePicker.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.mjs";
|
|
2
|
-
import "./styles.
|
|
2
|
+
import "./styles.b562cf4b.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 "./vars.
|
|
6
|
+
import "./vars.3d0e5be0.css";
|
|
7
7
|
import "./textfield_vars_css.mjs";
|
|
8
8
|
import "./vars.ccbd2e3f.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
|
-
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6, useVisibleMonths as $04e96200274b03de$export$12ce2869ce471b1f} from "./utils.mjs";
|
|
11
|
+
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6, useFormattedDateWidth as $04e96200274b03de$export$31e22e3c931fc056, useVisibleMonths as $04e96200274b03de$export$12ce2869ce471b1f} from "./utils.mjs";
|
|
12
12
|
import {Calendar as $8czI1$Calendar} from "@react-spectrum/calendar";
|
|
13
13
|
import $8czI1$spectrumiconsworkflowCalendar from "@spectrum-icons/workflow/Calendar";
|
|
14
14
|
import {classNames as $8czI1$classNames} from "@react-spectrum/utils";
|
|
@@ -71,7 +71,7 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
71
71
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8czI1$useHover)({
|
|
72
72
|
isDisabled: isDisabled
|
|
73
73
|
});
|
|
74
|
-
let targetRef = (0, $8czI1$useRef)();
|
|
74
|
+
let targetRef = (0, $8czI1$useRef)(undefined);
|
|
75
75
|
let state = (0, $8czI1$useDatePickerState)({
|
|
76
76
|
...props,
|
|
77
77
|
shouldCloseOnSelect: ()=>!state.hasTime
|
|
@@ -80,7 +80,7 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
80
80
|
let { isOpen: isOpen, setOpen: setOpen } = state;
|
|
81
81
|
let { direction: direction } = (0, $8czI1$useLocale)();
|
|
82
82
|
let domRef = (0, $04e96200274b03de$export$71a23a36270e4bf0)(ref);
|
|
83
|
-
let stringFormatter = (0, $8czI1$useLocalizedStringFormatter)((0, ($parcel$interopDefault($8czI1$intlStringsmodulejs))),
|
|
83
|
+
let stringFormatter = (0, $8czI1$useLocalizedStringFormatter)((0, ($parcel$interopDefault($8czI1$intlStringsmodulejs))), '@react-spectrum/datepicker');
|
|
84
84
|
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $8czI1$useFocusRing)({
|
|
85
85
|
within: true,
|
|
86
86
|
isTextInput: true,
|
|
@@ -91,30 +91,31 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
91
91
|
isTextInput: false,
|
|
92
92
|
autoFocus: autoFocus
|
|
93
93
|
});
|
|
94
|
-
let className = (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
let className = (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup', {
|
|
95
|
+
'spectrum-InputGroup--quiet': isQuiet,
|
|
96
|
+
'spectrum-InputGroup--invalid': isInvalid && !isDisabled,
|
|
97
|
+
'is-disabled': isDisabled,
|
|
98
|
+
'is-hovered': isHovered,
|
|
99
|
+
'is-focused': isFocused,
|
|
100
|
+
'focus-ring': isFocusVisible && !isFocusedButton
|
|
101
101
|
});
|
|
102
|
-
let fieldClassName = (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))),
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
let fieldClassName = (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input', {
|
|
103
|
+
'is-disabled': isDisabled,
|
|
104
|
+
'is-invalid': isInvalid && !isDisabled
|
|
105
105
|
});
|
|
106
106
|
// Note: this description is intentionally not passed to useDatePicker.
|
|
107
107
|
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
108
108
|
let description = (0, $04e96200274b03de$export$322f4580ccd8dde6)(props);
|
|
109
109
|
if (description && !props.description) descriptionProps.id = null;
|
|
110
110
|
let placeholder = placeholderValue;
|
|
111
|
-
let timePlaceholder = placeholder &&
|
|
112
|
-
let timeMinValue = props.minValue &&
|
|
113
|
-
let timeMaxValue = props.maxValue &&
|
|
114
|
-
let timeGranularity = state.granularity ===
|
|
111
|
+
let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;
|
|
112
|
+
let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;
|
|
113
|
+
let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;
|
|
114
|
+
let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;
|
|
115
115
|
let showTimeField = !!timeGranularity;
|
|
116
116
|
let visibleMonths = (0, $04e96200274b03de$export$12ce2869ce471b1f)(maxVisibleMonths);
|
|
117
|
-
let validationState = state.validationState || (isInvalid ?
|
|
117
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
118
|
+
let approximateWidth = (0, $04e96200274b03de$export$31e22e3c931fc056)(state) + 'ch';
|
|
118
119
|
return /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Field), {
|
|
119
120
|
...props,
|
|
120
121
|
ref: domRef,
|
|
@@ -127,7 +128,7 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
127
128
|
isInvalid: isInvalid,
|
|
128
129
|
validationErrors: validationErrors,
|
|
129
130
|
validationDetails: validationDetails,
|
|
130
|
-
wrapperClassName: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))),
|
|
131
|
+
wrapperClassName: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
131
132
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
132
133
|
...(0, $8czI1$mergeProps)(groupProps, hoverProps, focusProps),
|
|
133
134
|
className: className,
|
|
@@ -136,9 +137,10 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
136
137
|
isDisabled: isDisabled,
|
|
137
138
|
isQuiet: isQuiet,
|
|
138
139
|
validationState: validationState,
|
|
139
|
-
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))),
|
|
140
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'),
|
|
140
141
|
inputClassName: fieldClassName,
|
|
141
|
-
disableFocusRing: true
|
|
142
|
+
disableFocusRing: true,
|
|
143
|
+
minWidth: approximateWidth
|
|
142
144
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $d2bb88c82604b25f$export$34dc4cfa15ead1), {
|
|
143
145
|
...fieldProps,
|
|
144
146
|
"data-testid": "date-field",
|
|
@@ -146,7 +148,7 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
146
148
|
})), /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$DialogTrigger), {
|
|
147
149
|
type: "popover",
|
|
148
150
|
mobileType: "tray",
|
|
149
|
-
placement: direction ===
|
|
151
|
+
placement: direction === 'rtl' ? 'bottom right' : 'bottom left',
|
|
150
152
|
targetRef: targetRef,
|
|
151
153
|
hideArrow: true,
|
|
152
154
|
isOpen: isOpen,
|
|
@@ -154,25 +156,25 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
154
156
|
shouldFlip: props.shouldFlip
|
|
155
157
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$FieldButton), {
|
|
156
158
|
...(0, $8czI1$mergeProps)(buttonProps, focusPropsButton),
|
|
157
|
-
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))),
|
|
159
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'),
|
|
158
160
|
isQuiet: isQuiet,
|
|
159
161
|
validationState: validationState
|
|
160
162
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$spectrumiconsworkflowCalendar), null)), /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Dialog), {
|
|
161
|
-
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))),
|
|
163
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-dialog'),
|
|
162
164
|
...dialogProps
|
|
163
165
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Content), null, /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
164
|
-
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))),
|
|
166
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-dialogContent')
|
|
165
167
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Calendar), {
|
|
166
168
|
...calendarProps,
|
|
167
169
|
visibleMonths: visibleMonths,
|
|
168
170
|
pageBehavior: pageBehavior,
|
|
169
|
-
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))),
|
|
170
|
-
|
|
171
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-calendar', {
|
|
172
|
+
'is-invalid': isInvalid
|
|
171
173
|
})
|
|
172
174
|
}), showTimeField && /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
173
|
-
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))),
|
|
175
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-timeFields')
|
|
174
176
|
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $f0a04554754386b6$export$5eaee2322dd727eb), {
|
|
175
|
-
label: stringFormatter.format(
|
|
177
|
+
label: stringFormatter.format('time'),
|
|
176
178
|
value: state.timeValue,
|
|
177
179
|
onChange: state.setTimeValue,
|
|
178
180
|
placeholderValue: timePlaceholder,
|
|
@@ -190,4 +192,4 @@ function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
|
190
192
|
|
|
191
193
|
|
|
192
194
|
export {$beaeefa091999363$export$5109c6dd95d8fb00 as DatePicker};
|
|
193
|
-
//# sourceMappingURL=DatePicker.
|
|
195
|
+
//# sourceMappingURL=DatePicker.module.js.map
|