@react-spectrum/datepicker 3.9.4 → 3.9.6
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 +110 -0
- package/dist/DateField.main.js.map +1 -0
- package/dist/DateField.mjs +105 -0
- package/dist/DateField.module.js +105 -0
- package/dist/DateField.module.js.map +1 -0
- package/dist/DatePicker.main.js +198 -0
- package/dist/DatePicker.main.js.map +1 -0
- package/dist/DatePicker.mjs +193 -0
- package/dist/DatePicker.module.js +193 -0
- package/dist/DatePicker.module.js.map +1 -0
- package/dist/DatePickerField.main.js +72 -0
- package/dist/DatePickerField.main.js.map +1 -0
- package/dist/DatePickerField.mjs +67 -0
- package/dist/DatePickerField.module.js +67 -0
- package/dist/DatePickerField.module.js.map +1 -0
- package/dist/DatePickerSegment.main.js +76 -0
- package/dist/DatePickerSegment.main.js.map +1 -0
- package/dist/DatePickerSegment.mjs +71 -0
- package/dist/DatePickerSegment.module.js +71 -0
- package/dist/DatePickerSegment.module.js.map +1 -0
- package/dist/DateRangePicker.main.js +225 -0
- package/dist/DateRangePicker.main.js.map +1 -0
- package/dist/DateRangePicker.mjs +220 -0
- package/dist/DateRangePicker.module.js +220 -0
- package/dist/DateRangePicker.module.js.map +1 -0
- package/dist/Input.main.js +123 -0
- package/dist/Input.main.js.map +1 -0
- package/dist/Input.mjs +118 -0
- package/dist/Input.module.js +118 -0
- package/dist/Input.module.js.map +1 -0
- package/dist/TimeField.main.js +102 -0
- package/dist/TimeField.main.js.map +1 -0
- package/dist/TimeField.mjs +97 -0
- package/dist/TimeField.module.js +97 -0
- package/dist/TimeField.module.js.map +1 -0
- package/dist/import.mjs +4 -1136
- package/dist/inputgroup_vars_css.main.js +86 -0
- package/dist/inputgroup_vars_css.main.js.map +1 -0
- package/dist/inputgroup_vars_css.mjs +88 -0
- package/dist/inputgroup_vars_css.module.js +88 -0
- package/dist/inputgroup_vars_css.module.js.map +1 -0
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/main.js +8 -1136
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -1136
- package/dist/module.js.map +1 -1
- package/dist/styles.36ea4632.css +209 -0
- package/dist/styles.36ea4632.css.map +1 -0
- package/dist/styles_css.main.js +74 -0
- package/dist/styles_css.main.js.map +1 -0
- package/dist/styles_css.mjs +76 -0
- package/dist/styles_css.module.js +76 -0
- package/dist/styles_css.module.js.map +1 -0
- package/dist/textfield_vars_css.main.js +74 -0
- package/dist/textfield_vars_css.main.js.map +1 -0
- package/dist/textfield_vars_css.mjs +76 -0
- package/dist/textfield_vars_css.module.js +76 -0
- package/dist/textfield_vars_css.module.js.map +1 -0
- package/dist/utils.main.js +89 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +82 -0
- package/dist/utils.module.js +82 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/vars.3692148b.css +549 -0
- package/dist/vars.3692148b.css.map +1 -0
- package/dist/vars.ccbd2e3f.css +649 -0
- package/dist/vars.ccbd2e3f.css.map +1 -0
- package/package.json +22 -22
- package/dist/main.css +0 -1626
- package/dist/main.css.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.mjs";
|
|
2
|
+
import "./styles.36ea4632.css";
|
|
3
|
+
import $8czI1$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
|
+
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
5
|
+
import $8czI1$intlStringsmodulejs from "./intlStrings.mjs";
|
|
6
|
+
import "./vars.3692148b.css";
|
|
7
|
+
import "./textfield_vars_css.mjs";
|
|
8
|
+
import "./vars.ccbd2e3f.css";
|
|
9
|
+
import $8czI1$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
|
|
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";
|
|
12
|
+
import {Calendar as $8czI1$Calendar} from "@react-spectrum/calendar";
|
|
13
|
+
import $8czI1$spectrumiconsworkflowCalendar from "@spectrum-icons/workflow/Calendar";
|
|
14
|
+
import {classNames as $8czI1$classNames} from "@react-spectrum/utils";
|
|
15
|
+
import {Content as $8czI1$Content} from "@react-spectrum/view";
|
|
16
|
+
import {DialogTrigger as $8czI1$DialogTrigger, Dialog as $8czI1$Dialog} from "@react-spectrum/dialog";
|
|
17
|
+
import {Field as $8czI1$Field} from "@react-spectrum/label";
|
|
18
|
+
import {FieldButton as $8czI1$FieldButton} from "@react-spectrum/button";
|
|
19
|
+
import {mergeProps as $8czI1$mergeProps} from "@react-aria/utils";
|
|
20
|
+
import $8czI1$react, {useRef as $8czI1$useRef} from "react";
|
|
21
|
+
import {useDatePicker as $8czI1$useDatePicker} from "@react-aria/datepicker";
|
|
22
|
+
import {useDatePickerState as $8czI1$useDatePickerState} from "@react-stately/datepicker";
|
|
23
|
+
import {useFocusRing as $8czI1$useFocusRing} from "@react-aria/focus";
|
|
24
|
+
import {useFormProps as $8czI1$useFormProps} from "@react-spectrum/form";
|
|
25
|
+
import {useHover as $8czI1$useHover} from "@react-aria/interactions";
|
|
26
|
+
import {useLocale as $8czI1$useLocale, useLocalizedStringFormatter as $8czI1$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
27
|
+
import {useProviderProps as $8czI1$useProviderProps} from "@react-spectrum/provider";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function $parcel$interopDefault(a) {
|
|
31
|
+
return a && a.__esModule ? a.default : a;
|
|
32
|
+
}
|
|
33
|
+
/*
|
|
34
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
35
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
37
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
40
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
41
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
42
|
+
* governing permissions and limitations under the License.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
68
|
+
props = (0, $8czI1$useProviderProps)(props);
|
|
69
|
+
props = (0, $8czI1$useFormProps)(props);
|
|
70
|
+
let { autoFocus: autoFocus, isQuiet: isQuiet, isDisabled: isDisabled, placeholderValue: placeholderValue, maxVisibleMonths: maxVisibleMonths = 1, pageBehavior: pageBehavior } = props;
|
|
71
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8czI1$useHover)({
|
|
72
|
+
isDisabled: isDisabled
|
|
73
|
+
});
|
|
74
|
+
let targetRef = (0, $8czI1$useRef)();
|
|
75
|
+
let state = (0, $8czI1$useDatePickerState)({
|
|
76
|
+
...props,
|
|
77
|
+
shouldCloseOnSelect: ()=>!state.hasTime
|
|
78
|
+
});
|
|
79
|
+
let { groupProps: groupProps, labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, buttonProps: buttonProps, dialogProps: dialogProps, calendarProps: calendarProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $8czI1$useDatePicker)(props, state, targetRef);
|
|
80
|
+
let { isOpen: isOpen, setOpen: setOpen } = state;
|
|
81
|
+
let { direction: direction } = (0, $8czI1$useLocale)();
|
|
82
|
+
let domRef = (0, $04e96200274b03de$export$71a23a36270e4bf0)(ref);
|
|
83
|
+
let stringFormatter = (0, $8czI1$useLocalizedStringFormatter)((0, ($parcel$interopDefault($8czI1$intlStringsmodulejs))), '@react-spectrum/datepicker');
|
|
84
|
+
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $8czI1$useFocusRing)({
|
|
85
|
+
within: true,
|
|
86
|
+
isTextInput: true,
|
|
87
|
+
autoFocus: autoFocus
|
|
88
|
+
});
|
|
89
|
+
let { isFocused: isFocusedButton, focusProps: focusPropsButton } = (0, $8czI1$useFocusRing)({
|
|
90
|
+
within: false,
|
|
91
|
+
isTextInput: false,
|
|
92
|
+
autoFocus: autoFocus
|
|
93
|
+
});
|
|
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
|
+
});
|
|
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
|
+
});
|
|
106
|
+
// Note: this description is intentionally not passed to useDatePicker.
|
|
107
|
+
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
108
|
+
let description = (0, $04e96200274b03de$export$322f4580ccd8dde6)(props);
|
|
109
|
+
if (description && !props.description) descriptionProps.id = null;
|
|
110
|
+
let placeholder = placeholderValue;
|
|
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
|
+
let showTimeField = !!timeGranularity;
|
|
116
|
+
let visibleMonths = (0, $04e96200274b03de$export$12ce2869ce471b1f)(maxVisibleMonths);
|
|
117
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
118
|
+
return /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Field), {
|
|
119
|
+
...props,
|
|
120
|
+
ref: domRef,
|
|
121
|
+
elementType: "span",
|
|
122
|
+
description: description,
|
|
123
|
+
labelProps: labelProps,
|
|
124
|
+
descriptionProps: descriptionProps,
|
|
125
|
+
errorMessageProps: errorMessageProps,
|
|
126
|
+
validationState: validationState,
|
|
127
|
+
isInvalid: isInvalid,
|
|
128
|
+
validationErrors: validationErrors,
|
|
129
|
+
validationDetails: validationDetails,
|
|
130
|
+
wrapperClassName: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
131
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
132
|
+
...(0, $8czI1$mergeProps)(groupProps, hoverProps, focusProps),
|
|
133
|
+
className: className,
|
|
134
|
+
ref: targetRef
|
|
135
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $79348162c55d687f$export$f5b8910cec6cf069), {
|
|
136
|
+
isDisabled: isDisabled,
|
|
137
|
+
isQuiet: isQuiet,
|
|
138
|
+
validationState: validationState,
|
|
139
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'),
|
|
140
|
+
inputClassName: fieldClassName,
|
|
141
|
+
disableFocusRing: true
|
|
142
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $d2bb88c82604b25f$export$34dc4cfa15ead1), {
|
|
143
|
+
...fieldProps,
|
|
144
|
+
"data-testid": "date-field",
|
|
145
|
+
isQuiet: isQuiet
|
|
146
|
+
})), /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$DialogTrigger), {
|
|
147
|
+
type: "popover",
|
|
148
|
+
mobileType: "tray",
|
|
149
|
+
placement: direction === 'rtl' ? 'bottom right' : 'bottom left',
|
|
150
|
+
targetRef: targetRef,
|
|
151
|
+
hideArrow: true,
|
|
152
|
+
isOpen: isOpen,
|
|
153
|
+
onOpenChange: setOpen,
|
|
154
|
+
shouldFlip: props.shouldFlip
|
|
155
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$FieldButton), {
|
|
156
|
+
...(0, $8czI1$mergeProps)(buttonProps, focusPropsButton),
|
|
157
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'),
|
|
158
|
+
isQuiet: isQuiet,
|
|
159
|
+
validationState: validationState
|
|
160
|
+
}, /*#__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))), 'react-spectrum-Datepicker-dialog'),
|
|
162
|
+
...dialogProps
|
|
163
|
+
}, /*#__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))), 'react-spectrum-Datepicker-dialogContent')
|
|
165
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Calendar), {
|
|
166
|
+
...calendarProps,
|
|
167
|
+
visibleMonths: visibleMonths,
|
|
168
|
+
pageBehavior: pageBehavior,
|
|
169
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-calendar', {
|
|
170
|
+
'is-invalid': isInvalid
|
|
171
|
+
})
|
|
172
|
+
}), showTimeField && /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
173
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-timeFields')
|
|
174
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $f0a04554754386b6$export$5eaee2322dd727eb), {
|
|
175
|
+
label: stringFormatter.format('time'),
|
|
176
|
+
value: state.timeValue,
|
|
177
|
+
onChange: state.setTimeValue,
|
|
178
|
+
placeholderValue: timePlaceholder,
|
|
179
|
+
granularity: timeGranularity,
|
|
180
|
+
minValue: timeMinValue,
|
|
181
|
+
maxValue: timeMaxValue,
|
|
182
|
+
hourCycle: props.hourCycle,
|
|
183
|
+
hideTimeZone: props.hideTimeZone,
|
|
184
|
+
marginTop: "size-100"
|
|
185
|
+
}))))))));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
|
|
189
|
+
*/ const $beaeefa091999363$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8czI1$react).forwardRef($beaeefa091999363$var$DatePicker);
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
export {$beaeefa091999363$export$5109c6dd95d8fb00 as DatePicker};
|
|
193
|
+
//# sourceMappingURL=DatePicker.module.js.map
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import {DatePickerField as $d2bb88c82604b25f$export$34dc4cfa15ead1} from "./DatePickerField.module.js";
|
|
2
|
+
import "./styles.36ea4632.css";
|
|
3
|
+
import $8czI1$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
|
+
import {Input as $79348162c55d687f$export$f5b8910cec6cf069} from "./Input.module.js";
|
|
5
|
+
import $8czI1$intlStringsmodulejs from "./intlStrings.module.js";
|
|
6
|
+
import "./vars.3692148b.css";
|
|
7
|
+
import "./textfield_vars_css.module.js";
|
|
8
|
+
import "./vars.ccbd2e3f.css";
|
|
9
|
+
import $8czI1$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.module.js";
|
|
10
|
+
import {TimeField as $f0a04554754386b6$export$5eaee2322dd727eb} from "./TimeField.module.js";
|
|
11
|
+
import {useFocusManagerRef as $04e96200274b03de$export$71a23a36270e4bf0, useFormatHelpText as $04e96200274b03de$export$322f4580ccd8dde6, useVisibleMonths as $04e96200274b03de$export$12ce2869ce471b1f} from "./utils.module.js";
|
|
12
|
+
import {Calendar as $8czI1$Calendar} from "@react-spectrum/calendar";
|
|
13
|
+
import $8czI1$spectrumiconsworkflowCalendar from "@spectrum-icons/workflow/Calendar";
|
|
14
|
+
import {classNames as $8czI1$classNames} from "@react-spectrum/utils";
|
|
15
|
+
import {Content as $8czI1$Content} from "@react-spectrum/view";
|
|
16
|
+
import {DialogTrigger as $8czI1$DialogTrigger, Dialog as $8czI1$Dialog} from "@react-spectrum/dialog";
|
|
17
|
+
import {Field as $8czI1$Field} from "@react-spectrum/label";
|
|
18
|
+
import {FieldButton as $8czI1$FieldButton} from "@react-spectrum/button";
|
|
19
|
+
import {mergeProps as $8czI1$mergeProps} from "@react-aria/utils";
|
|
20
|
+
import $8czI1$react, {useRef as $8czI1$useRef} from "react";
|
|
21
|
+
import {useDatePicker as $8czI1$useDatePicker} from "@react-aria/datepicker";
|
|
22
|
+
import {useDatePickerState as $8czI1$useDatePickerState} from "@react-stately/datepicker";
|
|
23
|
+
import {useFocusRing as $8czI1$useFocusRing} from "@react-aria/focus";
|
|
24
|
+
import {useFormProps as $8czI1$useFormProps} from "@react-spectrum/form";
|
|
25
|
+
import {useHover as $8czI1$useHover} from "@react-aria/interactions";
|
|
26
|
+
import {useLocale as $8czI1$useLocale, useLocalizedStringFormatter as $8czI1$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
27
|
+
import {useProviderProps as $8czI1$useProviderProps} from "@react-spectrum/provider";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function $parcel$interopDefault(a) {
|
|
31
|
+
return a && a.__esModule ? a.default : a;
|
|
32
|
+
}
|
|
33
|
+
/*
|
|
34
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
35
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
37
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
40
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
41
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
42
|
+
* governing permissions and limitations under the License.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function $beaeefa091999363$var$DatePicker(props, ref) {
|
|
68
|
+
props = (0, $8czI1$useProviderProps)(props);
|
|
69
|
+
props = (0, $8czI1$useFormProps)(props);
|
|
70
|
+
let { autoFocus: autoFocus, isQuiet: isQuiet, isDisabled: isDisabled, placeholderValue: placeholderValue, maxVisibleMonths: maxVisibleMonths = 1, pageBehavior: pageBehavior } = props;
|
|
71
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8czI1$useHover)({
|
|
72
|
+
isDisabled: isDisabled
|
|
73
|
+
});
|
|
74
|
+
let targetRef = (0, $8czI1$useRef)();
|
|
75
|
+
let state = (0, $8czI1$useDatePickerState)({
|
|
76
|
+
...props,
|
|
77
|
+
shouldCloseOnSelect: ()=>!state.hasTime
|
|
78
|
+
});
|
|
79
|
+
let { groupProps: groupProps, labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, buttonProps: buttonProps, dialogProps: dialogProps, calendarProps: calendarProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $8czI1$useDatePicker)(props, state, targetRef);
|
|
80
|
+
let { isOpen: isOpen, setOpen: setOpen } = state;
|
|
81
|
+
let { direction: direction } = (0, $8czI1$useLocale)();
|
|
82
|
+
let domRef = (0, $04e96200274b03de$export$71a23a36270e4bf0)(ref);
|
|
83
|
+
let stringFormatter = (0, $8czI1$useLocalizedStringFormatter)((0, ($parcel$interopDefault($8czI1$intlStringsmodulejs))), '@react-spectrum/datepicker');
|
|
84
|
+
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $8czI1$useFocusRing)({
|
|
85
|
+
within: true,
|
|
86
|
+
isTextInput: true,
|
|
87
|
+
autoFocus: autoFocus
|
|
88
|
+
});
|
|
89
|
+
let { isFocused: isFocusedButton, focusProps: focusPropsButton } = (0, $8czI1$useFocusRing)({
|
|
90
|
+
within: false,
|
|
91
|
+
isTextInput: false,
|
|
92
|
+
autoFocus: autoFocus
|
|
93
|
+
});
|
|
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
|
+
});
|
|
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
|
+
});
|
|
106
|
+
// Note: this description is intentionally not passed to useDatePicker.
|
|
107
|
+
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
108
|
+
let description = (0, $04e96200274b03de$export$322f4580ccd8dde6)(props);
|
|
109
|
+
if (description && !props.description) descriptionProps.id = null;
|
|
110
|
+
let placeholder = placeholderValue;
|
|
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
|
+
let showTimeField = !!timeGranularity;
|
|
116
|
+
let visibleMonths = (0, $04e96200274b03de$export$12ce2869ce471b1f)(maxVisibleMonths);
|
|
117
|
+
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
118
|
+
return /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Field), {
|
|
119
|
+
...props,
|
|
120
|
+
ref: domRef,
|
|
121
|
+
elementType: "span",
|
|
122
|
+
description: description,
|
|
123
|
+
labelProps: labelProps,
|
|
124
|
+
descriptionProps: descriptionProps,
|
|
125
|
+
errorMessageProps: errorMessageProps,
|
|
126
|
+
validationState: validationState,
|
|
127
|
+
isInvalid: isInvalid,
|
|
128
|
+
validationErrors: validationErrors,
|
|
129
|
+
validationDetails: validationDetails,
|
|
130
|
+
wrapperClassName: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-fieldWrapper')
|
|
131
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
132
|
+
...(0, $8czI1$mergeProps)(groupProps, hoverProps, focusProps),
|
|
133
|
+
className: className,
|
|
134
|
+
ref: targetRef
|
|
135
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $79348162c55d687f$export$f5b8910cec6cf069), {
|
|
136
|
+
isDisabled: isDisabled,
|
|
137
|
+
isQuiet: isQuiet,
|
|
138
|
+
validationState: validationState,
|
|
139
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'),
|
|
140
|
+
inputClassName: fieldClassName,
|
|
141
|
+
disableFocusRing: true
|
|
142
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $d2bb88c82604b25f$export$34dc4cfa15ead1), {
|
|
143
|
+
...fieldProps,
|
|
144
|
+
"data-testid": "date-field",
|
|
145
|
+
isQuiet: isQuiet
|
|
146
|
+
})), /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$DialogTrigger), {
|
|
147
|
+
type: "popover",
|
|
148
|
+
mobileType: "tray",
|
|
149
|
+
placement: direction === 'rtl' ? 'bottom right' : 'bottom left',
|
|
150
|
+
targetRef: targetRef,
|
|
151
|
+
hideArrow: true,
|
|
152
|
+
isOpen: isOpen,
|
|
153
|
+
onOpenChange: setOpen,
|
|
154
|
+
shouldFlip: props.shouldFlip
|
|
155
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$FieldButton), {
|
|
156
|
+
...(0, $8czI1$mergeProps)(buttonProps, focusPropsButton),
|
|
157
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'),
|
|
158
|
+
isQuiet: isQuiet,
|
|
159
|
+
validationState: validationState
|
|
160
|
+
}, /*#__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))), 'react-spectrum-Datepicker-dialog'),
|
|
162
|
+
...dialogProps
|
|
163
|
+
}, /*#__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))), 'react-spectrum-Datepicker-dialogContent')
|
|
165
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $8czI1$Calendar), {
|
|
166
|
+
...calendarProps,
|
|
167
|
+
visibleMonths: visibleMonths,
|
|
168
|
+
pageBehavior: pageBehavior,
|
|
169
|
+
UNSAFE_className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-calendar', {
|
|
170
|
+
'is-invalid': isInvalid
|
|
171
|
+
})
|
|
172
|
+
}), showTimeField && /*#__PURE__*/ (0, $8czI1$react).createElement("div", {
|
|
173
|
+
className: (0, $8czI1$classNames)((0, ($parcel$interopDefault($8czI1$styles_cssmodulejs))), 'react-spectrum-Datepicker-timeFields')
|
|
174
|
+
}, /*#__PURE__*/ (0, $8czI1$react).createElement((0, $f0a04554754386b6$export$5eaee2322dd727eb), {
|
|
175
|
+
label: stringFormatter.format('time'),
|
|
176
|
+
value: state.timeValue,
|
|
177
|
+
onChange: state.setTimeValue,
|
|
178
|
+
placeholderValue: timePlaceholder,
|
|
179
|
+
granularity: timeGranularity,
|
|
180
|
+
minValue: timeMinValue,
|
|
181
|
+
maxValue: timeMaxValue,
|
|
182
|
+
hourCycle: props.hourCycle,
|
|
183
|
+
hideTimeZone: props.hideTimeZone,
|
|
184
|
+
marginTop: "size-100"
|
|
185
|
+
}))))))));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
|
|
189
|
+
*/ const $beaeefa091999363$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8czI1$react).forwardRef($beaeefa091999363$var$DatePicker);
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
export {$beaeefa091999363$export$5109c6dd95d8fb00 as DatePicker};
|
|
193
|
+
//# sourceMappingURL=DatePicker.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","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 {_DatePicker as DatePicker};\n"],"names":[],"version":3,"file":"DatePicker.module.js.map"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var $edac158d20ebe4a9$exports = require("./DatePickerSegment.main.js");
|
|
2
|
+
require("./styles.36ea4632.css");
|
|
3
|
+
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
|
+
var $g7Fnj$reactspectrumutils = require("@react-spectrum/utils");
|
|
5
|
+
var $g7Fnj$internationalizeddate = require("@internationalized/date");
|
|
6
|
+
var $g7Fnj$react = require("react");
|
|
7
|
+
var $g7Fnj$reactariadatepicker = require("@react-aria/datepicker");
|
|
8
|
+
var $g7Fnj$reactstatelydatepicker = require("@react-stately/datepicker");
|
|
9
|
+
var $g7Fnj$reactariai18n = require("@react-aria/i18n");
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function $parcel$export(e, n, v, s) {
|
|
17
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
$parcel$export(module.exports, "DatePickerField", () => $bd22dc8dad9522bc$export$34dc4cfa15ead1);
|
|
21
|
+
/*
|
|
22
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
23
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
+
* governing permissions and limitations under the License.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
function $bd22dc8dad9522bc$export$34dc4cfa15ead1(props) {
|
|
40
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, inputClassName: inputClassName } = props;
|
|
41
|
+
let ref = (0, $g7Fnj$react.useRef)();
|
|
42
|
+
let { locale: locale } = (0, $g7Fnj$reactariai18n.useLocale)();
|
|
43
|
+
let state = (0, $g7Fnj$reactstatelydatepicker.useDateFieldState)({
|
|
44
|
+
...props,
|
|
45
|
+
locale: locale,
|
|
46
|
+
createCalendar: $g7Fnj$internationalizeddate.createCalendar
|
|
47
|
+
});
|
|
48
|
+
let inputRef = (0, $g7Fnj$react.useRef)();
|
|
49
|
+
let { fieldProps: fieldProps, inputProps: inputProps } = (0, $g7Fnj$reactariadatepicker.useDateField)({
|
|
50
|
+
...props,
|
|
51
|
+
inputRef: inputRef
|
|
52
|
+
}, state, ref);
|
|
53
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($g7Fnj$react))).createElement("div", {
|
|
54
|
+
...fieldProps,
|
|
55
|
+
"data-testid": props['data-testid'],
|
|
56
|
+
className: (0, $g7Fnj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), 'react-spectrum-Datepicker-segments', inputClassName),
|
|
57
|
+
ref: ref
|
|
58
|
+
}, state.segments.map((segment, i)=>/*#__PURE__*/ (0, ($parcel$interopDefault($g7Fnj$react))).createElement((0, $edac158d20ebe4a9$exports.DatePickerSegment), {
|
|
59
|
+
key: i,
|
|
60
|
+
segment: segment,
|
|
61
|
+
state: state,
|
|
62
|
+
isDisabled: isDisabled,
|
|
63
|
+
isReadOnly: isReadOnly,
|
|
64
|
+
isRequired: isRequired
|
|
65
|
+
})), /*#__PURE__*/ (0, ($parcel$interopDefault($g7Fnj$react))).createElement("input", {
|
|
66
|
+
...inputProps,
|
|
67
|
+
ref: inputRef
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=DatePickerField.main.js.map
|
|
@@ -0,0 +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;IACf,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;IACpB,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAW,EAAE;QAAC,GAAG,KAAK;kBAAE;IAAQ,GAAG,OAAO;IAEzE,qBACE,0DAAC;QAAK,GAAG,UAAU;QAAE,eAAa,KAAK,CAAC,cAAc;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;QAAiB,KAAK;OACzJ,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();\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let inputRef = useRef();\n let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);\n\n return (\n <div {...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 </div>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerField.main.js.map"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.mjs";
|
|
2
|
+
import "./styles.36ea4632.css";
|
|
3
|
+
import $332Ed$styles_cssmodulejs from "./styles_css.mjs";
|
|
4
|
+
import {classNames as $332Ed$classNames} from "@react-spectrum/utils";
|
|
5
|
+
import {createCalendar as $332Ed$createCalendar} from "@internationalized/date";
|
|
6
|
+
import $332Ed$react, {useRef as $332Ed$useRef} from "react";
|
|
7
|
+
import {useDateField as $332Ed$useDateField} from "@react-aria/datepicker";
|
|
8
|
+
import {useDateFieldState as $332Ed$useDateFieldState} from "@react-stately/datepicker";
|
|
9
|
+
import {useLocale as $332Ed$useLocale} from "@react-aria/i18n";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
function $d2bb88c82604b25f$export$34dc4cfa15ead1(props) {
|
|
34
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, inputClassName: inputClassName } = props;
|
|
35
|
+
let ref = (0, $332Ed$useRef)();
|
|
36
|
+
let { locale: locale } = (0, $332Ed$useLocale)();
|
|
37
|
+
let state = (0, $332Ed$useDateFieldState)({
|
|
38
|
+
...props,
|
|
39
|
+
locale: locale,
|
|
40
|
+
createCalendar: $332Ed$createCalendar
|
|
41
|
+
});
|
|
42
|
+
let inputRef = (0, $332Ed$useRef)();
|
|
43
|
+
let { fieldProps: fieldProps, inputProps: inputProps } = (0, $332Ed$useDateField)({
|
|
44
|
+
...props,
|
|
45
|
+
inputRef: inputRef
|
|
46
|
+
}, state, ref);
|
|
47
|
+
return /*#__PURE__*/ (0, $332Ed$react).createElement("div", {
|
|
48
|
+
...fieldProps,
|
|
49
|
+
"data-testid": props['data-testid'],
|
|
50
|
+
className: (0, $332Ed$classNames)((0, ($parcel$interopDefault($332Ed$styles_cssmodulejs))), 'react-spectrum-Datepicker-segments', inputClassName),
|
|
51
|
+
ref: ref
|
|
52
|
+
}, state.segments.map((segment, i)=>/*#__PURE__*/ (0, $332Ed$react).createElement((0, $cfa347761f172638$export$6388987c5223b54e), {
|
|
53
|
+
key: i,
|
|
54
|
+
segment: segment,
|
|
55
|
+
state: state,
|
|
56
|
+
isDisabled: isDisabled,
|
|
57
|
+
isReadOnly: isReadOnly,
|
|
58
|
+
isRequired: isRequired
|
|
59
|
+
})), /*#__PURE__*/ (0, $332Ed$react).createElement("input", {
|
|
60
|
+
...inputProps,
|
|
61
|
+
ref: inputRef
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export {$d2bb88c82604b25f$export$34dc4cfa15ead1 as DatePickerField};
|
|
67
|
+
//# sourceMappingURL=DatePickerField.module.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {DatePickerSegment as $cfa347761f172638$export$6388987c5223b54e} from "./DatePickerSegment.module.js";
|
|
2
|
+
import "./styles.36ea4632.css";
|
|
3
|
+
import $332Ed$styles_cssmodulejs from "./styles_css.module.js";
|
|
4
|
+
import {classNames as $332Ed$classNames} from "@react-spectrum/utils";
|
|
5
|
+
import {createCalendar as $332Ed$createCalendar} from "@internationalized/date";
|
|
6
|
+
import $332Ed$react, {useRef as $332Ed$useRef} from "react";
|
|
7
|
+
import {useDateField as $332Ed$useDateField} from "@react-aria/datepicker";
|
|
8
|
+
import {useDateFieldState as $332Ed$useDateFieldState} from "@react-stately/datepicker";
|
|
9
|
+
import {useLocale as $332Ed$useLocale} from "@react-aria/i18n";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
function $d2bb88c82604b25f$export$34dc4cfa15ead1(props) {
|
|
34
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, inputClassName: inputClassName } = props;
|
|
35
|
+
let ref = (0, $332Ed$useRef)();
|
|
36
|
+
let { locale: locale } = (0, $332Ed$useLocale)();
|
|
37
|
+
let state = (0, $332Ed$useDateFieldState)({
|
|
38
|
+
...props,
|
|
39
|
+
locale: locale,
|
|
40
|
+
createCalendar: $332Ed$createCalendar
|
|
41
|
+
});
|
|
42
|
+
let inputRef = (0, $332Ed$useRef)();
|
|
43
|
+
let { fieldProps: fieldProps, inputProps: inputProps } = (0, $332Ed$useDateField)({
|
|
44
|
+
...props,
|
|
45
|
+
inputRef: inputRef
|
|
46
|
+
}, state, ref);
|
|
47
|
+
return /*#__PURE__*/ (0, $332Ed$react).createElement("div", {
|
|
48
|
+
...fieldProps,
|
|
49
|
+
"data-testid": props['data-testid'],
|
|
50
|
+
className: (0, $332Ed$classNames)((0, ($parcel$interopDefault($332Ed$styles_cssmodulejs))), 'react-spectrum-Datepicker-segments', inputClassName),
|
|
51
|
+
ref: ref
|
|
52
|
+
}, state.segments.map((segment, i)=>/*#__PURE__*/ (0, $332Ed$react).createElement((0, $cfa347761f172638$export$6388987c5223b54e), {
|
|
53
|
+
key: i,
|
|
54
|
+
segment: segment,
|
|
55
|
+
state: state,
|
|
56
|
+
isDisabled: isDisabled,
|
|
57
|
+
isReadOnly: isReadOnly,
|
|
58
|
+
isRequired: isRequired
|
|
59
|
+
})), /*#__PURE__*/ (0, $332Ed$react).createElement("input", {
|
|
60
|
+
...inputProps,
|
|
61
|
+
ref: inputRef
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export {$d2bb88c82604b25f$export$34dc4cfa15ead1 as DatePickerField};
|
|
67
|
+
//# sourceMappingURL=DatePickerField.module.js.map
|
|
@@ -0,0 +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;IACf,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;IACpB,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,GAAG,KAAK;kBAAE;IAAQ,GAAG,OAAO;IAEzE,qBACE,gCAAC;QAAK,GAAG,UAAU;QAAE,eAAa,KAAK,CAAC,cAAc;QAAE,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAe,GAAG,sCAAsC;QAAiB,KAAK;OACzJ,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();\n let {locale} = useLocale();\n let state = useDateFieldState({\n ...props,\n locale,\n createCalendar\n });\n\n let inputRef = useRef();\n let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);\n\n return (\n <div {...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 </div>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerField.module.js.map"}
|