@react-spectrum/datepicker 3.11.0 → 3.13.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 +7 -11
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +7 -11
- package/dist/DateField.module.js +7 -11
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +12 -14
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +12 -14
- package/dist/DatePicker.module.js +12 -14
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/DatePickerField.main.js +2 -2
- package/dist/DatePickerField.main.js.map +1 -1
- package/dist/DatePickerField.mjs +2 -2
- package/dist/DatePickerField.module.js +2 -2
- package/dist/DatePickerField.module.js.map +1 -1
- package/dist/DatePickerSegment.main.js +2 -2
- package/dist/DatePickerSegment.main.js.map +1 -1
- package/dist/DatePickerSegment.mjs +2 -2
- package/dist/DatePickerSegment.module.js +2 -2
- package/dist/DatePickerSegment.module.js.map +1 -1
- package/dist/DateRangePicker.main.js +18 -16
- package/dist/DateRangePicker.main.js.map +1 -1
- package/dist/DateRangePicker.mjs +18 -16
- package/dist/DateRangePicker.module.js +18 -16
- package/dist/DateRangePicker.module.js.map +1 -1
- package/dist/Input.main.js +4 -5
- package/dist/Input.main.js.map +1 -1
- package/dist/Input.mjs +4 -5
- package/dist/Input.module.js +4 -5
- package/dist/Input.module.js.map +1 -1
- package/dist/TimeField.main.js +6 -10
- package/dist/TimeField.main.js.map +1 -1
- package/dist/TimeField.mjs +6 -10
- package/dist/TimeField.module.js +6 -10
- package/dist/TimeField.module.js.map +1 -1
- package/dist/inputgroup_vars_css.main.js +26 -26
- package/dist/inputgroup_vars_css.mjs +26 -26
- package/dist/inputgroup_vars_css.module.js +26 -26
- package/dist/{styles.4bf108e6.css → styles.cec10db3.css} +47 -48
- package/dist/styles.cec10db3.css.map +1 -0
- package/dist/styles_css.main.js +23 -23
- package/dist/styles_css.main.js.map +1 -1
- package/dist/styles_css.mjs +23 -23
- package/dist/styles_css.module.js +23 -23
- package/dist/styles_css.module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js +44 -32
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +37 -29
- package/dist/utils.module.js +37 -29
- package/dist/utils.module.js.map +1 -1
- package/dist/{vars.61240e3b.css → vars.ba84240a.css} +3 -3
- package/dist/{vars.61240e3b.css.map → vars.ba84240a.css.map} +1 -1
- package/dist/{vars.6aae6db6.css → vars.fb8d1a6e.css} +133 -133
- package/dist/{vars.6aae6db6.css.map → vars.fb8d1a6e.css.map} +1 -1
- package/package.json +21 -21
- package/src/DateField.tsx +6 -9
- package/src/DatePicker.tsx +8 -9
- package/src/DatePickerField.tsx +2 -2
- package/src/DatePickerSegment.tsx +2 -2
- package/src/DateRangePicker.tsx +39 -38
- package/src/Input.tsx +2 -5
- package/src/TimeField.tsx +6 -9
- package/src/styles.css +3 -4
- package/src/{utils.ts → utils.tsx} +9 -7
- package/dist/styles.4bf108e6.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;;;AAWE;;;;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAaE;;;;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAaA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AASA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AASA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOJ;;;;AAMA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAMA;;;;;AAME;;;;;;;AAOE;;;;;;;AAQA;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASF;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKE;;;;AAMA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOJ;;;;;AAMA;;;;AAGE;;;;AASE;;;;;AAMF;;;;;;AAME;;;;;AAKA;;;;AAKA;;;;;;;AAQF;;;;;;;;AAME;;;;;;;;;;AAYA;;;;;;;AAYE;;;;;AAMA;;;;AAmBN;;;;;AAKI;;;;
|
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;;;AAWE;;;;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAAA;;;;;;;AAaE;;;;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAaA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AASA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AASA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOJ;;;;AAMA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAMA;;;;;AAME;;;;;;;AAOE;;;;;;;AAQA;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASF;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKE;;;;AAMA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOJ;;;;;AAMA;;;;AAGE;;;;AASE;;;;;AAMF;;;;;;AAME;;;;;AAKA;;;;AAKA;;;;;;;AAQF;;;;;;;;AAME;;;;;;;;;;AAYA;;;;;;;AAYE;;;;;AAMA;;;;AAmBN;;;;;AAKI;;;;AAWE;;;;AAcA;;;;AAWF;;;;AAOE;;;;AAOA;;;;AASA;;;;AAQJ;;;;AAgBA;;;;AAKF;;;;AAQM;;;;AAqBA;;;;AAgBA;;;;AAQA;;;;AAME;;;;AAOA;;;;AAQF;;;;AAgBF;;;;AAMA;;;;AAMF;;;;AAGE;;;;AAUA;;;;AAME;;;;AACE;;;;AAOF;;;;AAIE;;;;;AAQJ;;;;AAII;;;;AAEE;;;;AAIE;;;;AAKJ;;;;AAQR;EACE;;;;;;;;;;;;;;;;EAeE;;;;;;EAKA;;;;;;;;;;;;;;;;EAiBE;;;;EAeI;;;;EAQF;;;;EAQF;;;;EAIF;;;;EAuBE;;;;EAGA","sources":["packages/@adobe/spectrum-css-temp/components/inputgroup/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.fb8d1a6e.css.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/datepicker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@internationalized/date": "^3.
|
|
40
|
-
"@react-aria/datepicker": "^3.
|
|
41
|
-
"@react-aria/focus": "^3.
|
|
42
|
-
"@react-aria/i18n": "^3.12.
|
|
43
|
-
"@react-aria/interactions": "^3.
|
|
44
|
-
"@react-aria/utils": "^3.
|
|
45
|
-
"@react-spectrum/button": "^3.16.
|
|
46
|
-
"@react-spectrum/calendar": "^3.
|
|
47
|
-
"@react-spectrum/dialog": "^3.8.
|
|
48
|
-
"@react-spectrum/form": "^3.7.
|
|
49
|
-
"@react-spectrum/label": "^3.16.
|
|
50
|
-
"@react-spectrum/layout": "^3.6.
|
|
51
|
-
"@react-spectrum/utils": "^3.12.
|
|
52
|
-
"@react-spectrum/view": "^3.6.
|
|
53
|
-
"@react-stately/datepicker": "^3.
|
|
54
|
-
"@react-types/datepicker": "^3.
|
|
55
|
-
"@react-types/shared": "^3.
|
|
56
|
-
"@spectrum-icons/ui": "^3.6.
|
|
57
|
-
"@spectrum-icons/workflow": "^4.2.
|
|
39
|
+
"@internationalized/date": "^3.7.0",
|
|
40
|
+
"@react-aria/datepicker": "^3.14.0",
|
|
41
|
+
"@react-aria/focus": "^3.20.0",
|
|
42
|
+
"@react-aria/i18n": "^3.12.6",
|
|
43
|
+
"@react-aria/interactions": "^3.24.0",
|
|
44
|
+
"@react-aria/utils": "^3.28.0",
|
|
45
|
+
"@react-spectrum/button": "^3.16.11",
|
|
46
|
+
"@react-spectrum/calendar": "^3.6.1",
|
|
47
|
+
"@react-spectrum/dialog": "^3.8.18",
|
|
48
|
+
"@react-spectrum/form": "^3.7.12",
|
|
49
|
+
"@react-spectrum/label": "^3.16.12",
|
|
50
|
+
"@react-spectrum/layout": "^3.6.12",
|
|
51
|
+
"@react-spectrum/utils": "^3.12.2",
|
|
52
|
+
"@react-spectrum/view": "^3.6.16",
|
|
53
|
+
"@react-stately/datepicker": "^3.13.0",
|
|
54
|
+
"@react-types/datepicker": "^3.11.0",
|
|
55
|
+
"@react-types/shared": "^3.28.0",
|
|
56
|
+
"@spectrum-icons/ui": "^3.6.13",
|
|
57
|
+
"@spectrum-icons/workflow": "^4.2.18",
|
|
58
58
|
"@swc/helpers": "^0.5.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
|
|
73
73
|
}
|
package/src/DateField.tsx
CHANGED
|
@@ -26,7 +26,11 @@ import {useFormProps} from '@react-spectrum/form';
|
|
|
26
26
|
import {useLocale} from '@react-aria/i18n';
|
|
27
27
|
import {useProviderProps} from '@react-spectrum/provider';
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* DateFields allow users to enter and edit date and time values using a keyboard.
|
|
31
|
+
* Each part of a date value is displayed in an individually editable segment.
|
|
32
|
+
*/
|
|
33
|
+
export const DateField = React.forwardRef(function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {
|
|
30
34
|
props = useProviderProps(props);
|
|
31
35
|
props = useFormProps(props);
|
|
32
36
|
let {
|
|
@@ -99,11 +103,4 @@ function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: F
|
|
|
99
103
|
</Input>
|
|
100
104
|
</Field>
|
|
101
105
|
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* DateFields allow users to enter and edit date and time values using a keyboard.
|
|
106
|
-
* Each part of a date value is displayed in an individually editable segment.
|
|
107
|
-
*/
|
|
108
|
-
const _DateField = React.forwardRef(DateField) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
|
109
|
-
export {_DateField as DateField};
|
|
106
|
+
}) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
package/src/DatePicker.tsx
CHANGED
|
@@ -38,7 +38,10 @@ import {useHover} from '@react-aria/interactions';
|
|
|
38
38
|
import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
39
39
|
import {useProviderProps} from '@react-spectrum/provider';
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
|
|
43
|
+
*/
|
|
44
|
+
export const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {
|
|
42
45
|
props = useProviderProps(props);
|
|
43
46
|
props = useFormProps(props);
|
|
44
47
|
let {
|
|
@@ -47,7 +50,8 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
|
|
|
47
50
|
isDisabled,
|
|
48
51
|
placeholderValue,
|
|
49
52
|
maxVisibleMonths = 1,
|
|
50
|
-
pageBehavior
|
|
53
|
+
pageBehavior,
|
|
54
|
+
firstDayOfWeek
|
|
51
55
|
} = props;
|
|
52
56
|
let {hoverProps, isHovered} = useHover({isDisabled});
|
|
53
57
|
let targetRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -168,6 +172,7 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
|
|
|
168
172
|
{...calendarProps}
|
|
169
173
|
visibleMonths={visibleMonths}
|
|
170
174
|
pageBehavior={pageBehavior}
|
|
175
|
+
firstDayOfWeek={firstDayOfWeek}
|
|
171
176
|
UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />
|
|
172
177
|
{showTimeField &&
|
|
173
178
|
<div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>
|
|
@@ -191,10 +196,4 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
|
|
|
191
196
|
</div>
|
|
192
197
|
</Field>
|
|
193
198
|
);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
|
|
198
|
-
*/
|
|
199
|
-
const _DatePicker = React.forwardRef(DatePicker) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
|
200
|
-
export {_DatePicker as DatePicker};
|
|
199
|
+
}) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
package/src/DatePickerField.tsx
CHANGED
|
@@ -45,7 +45,7 @@ export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps
|
|
|
45
45
|
let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<
|
|
48
|
+
<span {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>
|
|
49
49
|
{state.segments.map((segment, i) =>
|
|
50
50
|
(<DatePickerSegment
|
|
51
51
|
key={i}
|
|
@@ -56,6 +56,6 @@ export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps
|
|
|
56
56
|
isRequired={isRequired} />)
|
|
57
57
|
)}
|
|
58
58
|
<input {...inputProps} ref={inputRef} />
|
|
59
|
-
</
|
|
59
|
+
</span>
|
|
60
60
|
);
|
|
61
61
|
}
|
|
@@ -54,7 +54,7 @@ function EditableSegment({segment, state}: DatePickerSegmentProps) {
|
|
|
54
54
|
let {segmentProps} = useDateSegment(segment, state, ref);
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<
|
|
57
|
+
<span
|
|
58
58
|
{...segmentProps}
|
|
59
59
|
ref={ref}
|
|
60
60
|
className={classNames(styles, 'react-spectrum-DatePicker-cell', {
|
|
@@ -64,6 +64,6 @@ function EditableSegment({segment, state}: DatePickerSegmentProps) {
|
|
|
64
64
|
style={segmentProps.style}
|
|
65
65
|
data-testid={segment.type}>
|
|
66
66
|
{segment.isPlaceholder ? <span aria-hidden="true" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span> : segment.text}
|
|
67
|
-
</
|
|
67
|
+
</span>
|
|
68
68
|
);
|
|
69
69
|
}
|
package/src/DateRangePicker.tsx
CHANGED
|
@@ -38,7 +38,11 @@ import {useHover} from '@react-aria/interactions';
|
|
|
38
38
|
import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
39
39
|
import {useProviderProps} from '@react-spectrum/provider';
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* DateRangePickers combine two DateFields and a RangeCalendar popover to allow users
|
|
43
|
+
* to enter or select a date and time range.
|
|
44
|
+
*/
|
|
45
|
+
export const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {
|
|
42
46
|
props = useProviderProps(props);
|
|
43
47
|
props = useFormProps(props);
|
|
44
48
|
let {
|
|
@@ -47,7 +51,8 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
|
|
|
47
51
|
autoFocus,
|
|
48
52
|
placeholderValue,
|
|
49
53
|
maxVisibleMonths = 1,
|
|
50
|
-
pageBehavior
|
|
54
|
+
pageBehavior,
|
|
55
|
+
firstDayOfWeek
|
|
51
56
|
} = props;
|
|
52
57
|
let {hoverProps, isHovered} = useHover({isDisabled});
|
|
53
58
|
let targetRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -133,33 +138,35 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
|
|
|
133
138
|
{...mergeProps(groupProps, hoverProps, focusProps)}
|
|
134
139
|
className={className}
|
|
135
140
|
ref={targetRef}>
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
141
|
+
<div style={{overflow: 'hidden', width: '100%'}}>
|
|
142
|
+
<Input
|
|
143
|
+
isDisabled={isDisabled}
|
|
144
|
+
isQuiet={isQuiet}
|
|
145
|
+
validationState={validationState}
|
|
146
|
+
className={classNames(styles, 'spectrum-InputGroup-field')}
|
|
147
|
+
inputClassName={fieldClassName}
|
|
148
|
+
disableFocusRing
|
|
149
|
+
minWidth={approximateWidth}>
|
|
150
|
+
<DatePickerField
|
|
151
|
+
{...startFieldProps}
|
|
152
|
+
data-testid="start-date"
|
|
153
|
+
isQuiet={props.isQuiet}
|
|
154
|
+
inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')} />
|
|
155
|
+
<DateRangeDash />
|
|
156
|
+
<DatePickerField
|
|
157
|
+
{...endFieldProps}
|
|
158
|
+
data-testid="end-date"
|
|
159
|
+
isQuiet={props.isQuiet}
|
|
160
|
+
inputClassName={classNames(
|
|
161
|
+
styles,
|
|
162
|
+
'spectrum-Datepicker-endField',
|
|
163
|
+
classNames(
|
|
164
|
+
datepickerStyles,
|
|
165
|
+
'react-spectrum-Datepicker-endField'
|
|
166
|
+
)
|
|
167
|
+
)} />
|
|
168
|
+
</Input>
|
|
169
|
+
</div>
|
|
163
170
|
<DialogTrigger
|
|
164
171
|
type="popover"
|
|
165
172
|
mobileType="tray"
|
|
@@ -183,6 +190,7 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
|
|
|
183
190
|
{...calendarProps}
|
|
184
191
|
visibleMonths={visibleMonths}
|
|
185
192
|
pageBehavior={pageBehavior}
|
|
193
|
+
firstDayOfWeek={firstDayOfWeek}
|
|
186
194
|
UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />
|
|
187
195
|
{showTimeField &&
|
|
188
196
|
<Flex gap="size-100" marginTop="size-100" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>
|
|
@@ -217,20 +225,13 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
|
|
|
217
225
|
</div>
|
|
218
226
|
</Field>
|
|
219
227
|
);
|
|
220
|
-
}
|
|
228
|
+
}) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
|
221
229
|
|
|
222
230
|
function DateRangeDash() {
|
|
223
231
|
return (
|
|
224
|
-
<
|
|
232
|
+
<span
|
|
225
233
|
aria-hidden="true"
|
|
226
234
|
data-testid="date-range-dash"
|
|
227
235
|
className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />
|
|
228
236
|
);
|
|
229
237
|
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* DateRangePickers combine two DateFields and a RangeCalendar popover to allow users
|
|
233
|
-
* to enter or select a date and time range.
|
|
234
|
-
*/
|
|
235
|
-
const _DateRangePicker = React.forwardRef(DateRangePicker) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
|
236
|
-
export {_DateRangePicker as DateRangePicker};
|
package/src/Input.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import React, {ReactElement, useCallback, useRef} from 'react';
|
|
|
19
19
|
import textfieldStyles from '@adobe/spectrum-css-temp/components/textfield/vars.css';
|
|
20
20
|
import {useFocusRing} from '@react-aria/focus';
|
|
21
21
|
|
|
22
|
-
function Input(props, ref) {
|
|
22
|
+
export const Input = React.forwardRef(function Input(props: any, ref: any) {
|
|
23
23
|
let inputRef = useRef<HTMLInputElement | null>(null);
|
|
24
24
|
let {
|
|
25
25
|
isDisabled,
|
|
@@ -139,7 +139,4 @@ function Input(props, ref) {
|
|
|
139
139
|
{validationIcon}
|
|
140
140
|
</div>
|
|
141
141
|
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const _Input = React.forwardRef(Input);
|
|
145
|
-
export {_Input as Input};
|
|
142
|
+
});
|
package/src/TimeField.tsx
CHANGED
|
@@ -25,7 +25,11 @@ import {useProviderProps} from '@react-spectrum/provider';
|
|
|
25
25
|
import {useTimeField} from '@react-aria/datepicker';
|
|
26
26
|
import {useTimeFieldState} from '@react-stately/datepicker';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* TimeFields allow users to enter and edit time values using a keyboard.
|
|
30
|
+
* Each part of the time is displayed in an individually editable segment.
|
|
31
|
+
*/
|
|
32
|
+
export const TimeField = React.forwardRef(function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: FocusableRef<HTMLElement>) {
|
|
29
33
|
props = useProviderProps(props);
|
|
30
34
|
props = useFormProps(props);
|
|
31
35
|
let {
|
|
@@ -89,11 +93,4 @@ function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: F
|
|
|
89
93
|
</Input>
|
|
90
94
|
</Field>
|
|
91
95
|
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* TimeFields allow users to enter and edit time values using a keyboard.
|
|
96
|
-
* Each part of the time is displayed in an individually editable segment.
|
|
97
|
-
*/
|
|
98
|
-
const _TimeField = React.forwardRef(TimeField) as <T extends TimeValue>(props: SpectrumTimeFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
|
99
|
-
export {_TimeField as TimeField};
|
|
96
|
+
}) as <T extends TimeValue>(props: SpectrumTimeFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|
package/src/styles.css
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.react-spectrum-Datepicker-field.react-spectrum-Datepicker-field {
|
|
37
|
-
width:
|
|
37
|
+
width: 100%;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.react-spectrum-Datepicker-field .react-spectrum-DateField-Input {
|
|
@@ -77,8 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.react-spectrum-Datepicker-inputSized {
|
|
80
|
-
display:
|
|
81
|
-
height: 100%;
|
|
80
|
+
display: inline;
|
|
82
81
|
align-items: center;
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -89,7 +88,7 @@
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
.react-spectrum-Datepicker-segments {
|
|
92
|
-
display:
|
|
91
|
+
display: inline-block;
|
|
93
92
|
align-items: center;
|
|
94
93
|
}
|
|
95
94
|
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
import {createDOMRef} from '@react-spectrum/utils';
|
|
13
13
|
import {createFocusManager} from '@react-aria/focus';
|
|
14
14
|
import {FocusableRef} from '@react-types/shared';
|
|
15
|
+
import React, {useImperativeHandle, useMemo, useRef, useState} from 'react';
|
|
15
16
|
import {SpectrumDatePickerBase} from '@react-types/datepicker';
|
|
16
17
|
import {useDateFormatter, useLocale} from '@react-aria/i18n';
|
|
17
18
|
import {useDisplayNames} from '@react-aria/datepicker';
|
|
18
|
-
import {useImperativeHandle, useMemo, useRef, useState} from 'react';
|
|
19
19
|
import {useLayoutEffect} from '@react-aria/utils';
|
|
20
20
|
import {useProvider} from '@react-spectrum/provider';
|
|
21
21
|
|
|
@@ -28,13 +28,15 @@ export function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'desc
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (props.showFormatHelpText) {
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return (
|
|
32
|
+
formatter.formatToParts(new Date()).map((s, i) => {
|
|
33
|
+
if (s.type === 'literal') {
|
|
34
|
+
return <span key={i}>{` ${s.value} `}</span>;
|
|
35
|
+
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(s.type)}</span>;
|
|
38
|
+
})
|
|
39
|
+
);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
return '';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAYA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAMA;;;;AAIA;;;;AAMA;;;;AAIA;;;;AAIA;;;;;AAKA;;;;;AAMA;;;;;;;;;AAQE;;;;;;AAOF;;;;;;AAOE;;;;AAKF;;;;;AAKA;;;;;;;AAMA;;;;;;;;;;;;AAWE;;;;AAOF;;;;AAGE;;;;;AAMF;;;;AAIA;;;;AAIA;;;;;;;AAOA;;;;AAIA;;;;;AAIE;;;;AAQA;;;;;AAQF;EACE;;;;EAGE;;;;;;AAOJ;;;;;;;;AAQA;EACE;;;;;;EAKA;;;;EAEE;;;;EAIF;;;;EAEE","sources":["packages/@react-spectrum/datepicker/src/styles.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n.react-spectrum-Datepicker-fieldWrapper.react-spectrum-Datepicker-fieldWrapper.react-spectrum-Datepicker-fieldWrapper {\n width: auto;\n min-width: var(--spectrum-global-dimension-size-2000);\n max-width: 100%;\n }\n\n.react-spectrum-Datepicker-startField {\n width: auto;\n padding-inline-end: var(--spectrum-global-dimension-size-100);\n}\n\n.react-spectrum-Datepicker-endField {\n width: auto;\n flex: 1;\n padding-inline-start: var(--spectrum-global-dimension-size-100);\n}\n\n.react-spectrum-Datepicker-field ~ .react-spectrum-Datepicker-endField > .react-spectrum-Datepicker-input {\n border-inline-start-width: 0;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n}\n\n.react-spectrum-Datepicker-field.react-spectrum-Datepicker-field {\n width: auto;\n}\n\n.react-spectrum-Datepicker-field .react-spectrum-DateField-Input {\n line-height: var(--spectrum-body-4-text-line-height);\n}\n\n/* specificity war with .spectrum-Field--positionSide etc. */\n.react-spectrum-DateField.react-spectrum-DateField.react-spectrum-DateField.react-spectrum-DateField {\n min-width: var(--spectrum-global-dimension-size-2000);\n}\n\n.react-spectrum-TimeField.react-spectrum-TimeField.react-spectrum-TimeField.react-spectrum-TimeField {\n min-width: var(--spectrum-global-dimension-size-1250);\n}\n\n.react-spectrum-TimeField-fieldWrapper.react-spectrum-TimeField-fieldWrapper.react-spectrum-TimeField-fieldWrapper {\n width: auto;\n min-width: var(--spectrum-global-dimension-size-1250);\n}\n\n.react-spectrum-Datepicker-input.react-spectrum-Datepicker-input.react-spectrum-Datepicker-input {\n /* always reserve space for the validation icon */\n padding-inline-end: calc(var(--spectrum-textfield-padding-x) + var(--spectrum-icon-alert-medium-width) + var(--spectrum-textfield-icon-margin-left));\n cursor: text;\n}\n\n.react-spectrum-Datepicker-inputContents {\n display: flex;\n align-items: center;\n height: 100%;\n overflow-x: auto;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* Internet Explorer 10+ */\n\n &::-webkit-scrollbar { /* WebKit */\n width: 0;\n height: 0;\n display: none;\n }\n}\n\n.react-spectrum-Datepicker-inputSized {\n display: flex;\n height: 100%;\n align-items: center;\n}\n\n.react-spectrum-Datepicker-rangeDash {\n &:before {\n content: '–';\n }\n}\n\n.react-spectrum-Datepicker-segments {\n display: flex;\n align-items: center;\n}\n\n.react-spectrum-Datepicker-literal {\n white-space: pre;\n user-select: none;\n color: var(--spectrum-textfield-text-color);\n}\n\n.react-spectrum-DatePicker-cell {\n border: none;\n background: none;\n padding: 0 2px;\n border-radius: var(--spectrum-alias-border-radius-small);\n font-variant-numeric: tabular-nums;\n text-align: end;\n box-sizing: content-box;\n white-space: nowrap;\n color: var(--spectrum-textfield-text-color);\n\n &::selection {\n /* hide the selection because there is no way to fully prevent it in Firefox */\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1742153 */\n background: transparent;\n }\n}\n\n.react-spectrum-DatePicker-cell.is-placeholder {\n color: var(--spectrum-gray-600);\n\n .react-spectrum-DatePicker-placeholder {\n text-align: center;\n pointer-events: none;\n }\n}\n\n.react-spectrum-DatePicker-cell.is-placeholder ~ .react-spectrum-Datepicker-literal {\n color: var(--spectrum-global-color-gray-600);\n}\n\n.react-spectrum-DatePicker-cell.is-read-only {\n color: var(--spectrum-global-color-gray-700);\n}\n\n.react-spectrum-DatePicker-cell:focus {\n background-color: var(--spectrum-accent-background-color-default);\n color: white;\n caret-color: transparent;\n outline: none;\n}\n\n.react-spectrum-Datepicker-dialog.react-spectrum-Datepicker-dialog {\n width: auto;\n}\n\n.react-spectrum-Datepicker-dialogContent {\n display: flex;\n flex-direction: column;\n\n .react-spectrum-Datepicker-calendar.is-invalid {\n /* Only apply display: contents when the calendar is invalid, which allows us to move the\n * error message below the time fields. Otherwise, don't do this because it breaks dragging\n * the selected range on Android. */\n display: contents;\n }\n\n /* Push the help text within the calendar down to the bottom of the dialog, below the time fields. */\n :global(.spectrum-Calendar-helpText) {\n order: 10;\n margin: var(--spectrum-global-dimension-size-200) var(--spectrum-calendar-day-padding) 0 var(--spectrum-calendar-day-padding);\n }\n}\n\n/* when displayed in a tray, reduce the padding of the dialog */\n@media (max-width: 700px) {\n .react-spectrum-Datepicker-dialog {\n --spectrum-dialog-padding-x: 8px;\n\n .react-spectrum-Datepicker-dialogContent {\n margin: 0 auto;\n max-width: calc((var(--spectrum-calendar-day-width) * 7) + (var(--spectrum-calendar-day-padding) * 12));\n }\n }\n}\n\n.react-spectrum-Datepicker-timeFields {\n width: 100%;\n min-width: calc(var(--spectrum-calendar-day-width) * 7);\n max-width: calc((var(--spectrum-calendar-day-width) * 7) + (var(--spectrum-calendar-day-padding) * 12));\n padding: 0 var(--spectrum-calendar-day-padding);\n box-sizing: border-box;\n}\n\n@media (forced-colors:active) {\n .react-spectrum-DatePicker-cell:focus {\n forced-color-adjust: none;\n background-color: Highlight;\n color: HighlightText;\n }\n .react-spectrum-DatePicker-cell.is-read-only {\n color: ButtonText;\n &:focus {\n color: HighlightText;\n }\n }\n .react-spectrum-DatePicker-cell.is-placeholder {\n color: ButtonText;\n &:focus {\n color: HighlightText;\n }\n }\n}\n"],"names":[],"version":3,"file":"styles.4bf108e6.css.map"}
|