react-day-picker 8.1.2 → 8.2.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/components/Button/Button.d.ts +1 -1
- package/dist/components/DayContent/DayContent.d.ts +1 -3
- package/dist/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/components/Head/Head.d.ts +1 -3
- package/dist/components/HeadRow/HeadRow.d.ts +4 -0
- package/dist/components/HeadRow/index.d.ts +1 -0
- package/dist/components/HeadRow/utils/getWeekdays.d.ts +8 -0
- package/{src/components/Head/utils/index.ts → dist/components/HeadRow/utils/index.d.ts} +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +37 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -26
- package/dist/index.js.map +1 -1
- package/dist/react-day-picker.min.js +1 -1
- package/dist/style.css +14 -7
- package/dist/style.module.css +14 -7
- package/dist/types/DayPickerBase.d.ts +5 -3
- package/dist/types/DayPickerMultiple.d.ts +1 -1
- package/dist/types/DayPickerRange.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Day/Day.test.tsx +2 -1
- package/src/components/Day/Day.tsx +1 -1
- package/src/components/DayContent/DayContent.test.tsx +1 -13
- package/src/components/DayContent/DayContent.tsx +2 -14
- package/src/components/Dropdown/Dropdown.test.tsx +1 -0
- package/src/components/Dropdown/Dropdown.tsx +5 -0
- package/src/components/Head/Head.test.tsx +13 -63
- package/src/components/Head/Head.tsx +5 -41
- package/src/components/HeadRow/HeadRow.test.tsx +109 -0
- package/src/components/HeadRow/HeadRow.tsx +49 -0
- package/src/components/HeadRow/index.ts +1 -0
- package/src/components/{Head → HeadRow}/utils/getWeekdays.test.ts +0 -0
- package/src/components/{Head → HeadRow}/utils/getWeekdays.ts +0 -0
- package/src/components/HeadRow/utils/index.ts +1 -0
- package/src/components/MonthsDropdown/MonthsDropdown.test.tsx +11 -1
- package/src/components/MonthsDropdown/MonthsDropdown.tsx +1 -0
- package/src/components/MonthsDropdown/__snapshots__/MonthsDropdown.test.tsx.snap +48 -0
- package/src/components/Navigation/Navigation.test.tsx +6 -0
- package/src/components/Navigation/Navigation.tsx +2 -0
- package/src/components/Table/Table.test.tsx +2 -2
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +122 -586
- package/src/components/WeekNumber/WeekNumber.test.tsx +9 -2
- package/src/components/WeekNumber/WeekNumber.tsx +1 -0
- package/src/components/WeekNumber/__snapshots__/WeekNumber.test.tsx.snap +10 -1
- package/src/components/YearsDropdown/YearsDropdown.test.tsx +11 -1
- package/src/components/YearsDropdown/YearsDropdown.tsx +1 -0
- package/src/components/YearsDropdown/__snapshots__/YearsDropdown.test.tsx.snap +43 -0
- package/src/hooks/useDayEventHandlers/useDayEventHandlers.test.tsx +6 -3
- package/src/hooks/useDayEventHandlers/useDayEventHandlers.tsx +2 -1
- package/src/hooks/useDayRender/useDayRender.tsx +6 -2
- package/src/hooks/useInput/useInput.ts +2 -2
- package/src/index.ts +1 -0
- package/src/style.css +14 -7
- package/src/types/DayPickerBase.ts +5 -3
- package/src/types/DayPickerMultiple.ts +1 -1
- package/src/types/DayPickerRange.ts +1 -1
|
@@ -4,4 +4,4 @@ export declare type ButtonProps = React.HTMLProps<HTMLButtonElement>;
|
|
|
4
4
|
/**
|
|
5
5
|
* Render a button HTML element applying the reset class name.
|
|
6
6
|
*/
|
|
7
|
-
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "multiple" | "default" | "className" | "style" | "disabled" | "hidden" | "selected" | "dir" | "onSelect" | "required" | "min" | "max" | "start" | "color" | "content" | "size" | "wrap" | "open" | "cite" | "data" | "form" | "label" | "slot" | "span" | "summary" | "title" | "pattern" | "children" | "value" | "id" | "aria-label" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "maxLength" | "media" | "mediaGroup" | "method" | "minLength" | "muted" | "
|
|
7
|
+
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "multiple" | "default" | "className" | "style" | "disabled" | "hidden" | "selected" | "dir" | "onSelect" | "required" | "min" | "max" | "start" | "color" | "content" | "size" | "wrap" | "open" | "cite" | "data" | "form" | "label" | "slot" | "span" | "summary" | "title" | "pattern" | "children" | "value" | "id" | "aria-label" | "onChange" | "name" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "maxLength" | "media" | "mediaGroup" | "method" | "minLength" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -8,7 +8,5 @@ export interface DayContentProps {
|
|
|
8
8
|
/** The active modifiers for the given date. */
|
|
9
9
|
activeModifiers: ActiveModifiers;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Render the content of the day cell.
|
|
13
|
-
*/
|
|
11
|
+
/** Render the content of the day cell. */
|
|
14
12
|
export declare function DayContent(props: DayContentProps): JSX.Element;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/** The props for the {@link Dropdown} component. */
|
|
3
3
|
export interface DropdownProps {
|
|
4
|
+
/** The name attribute of the element. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** The caption displayed to replace the hidden select. */
|
|
4
7
|
caption?: React.ReactNode;
|
|
5
8
|
children?: React.SelectHTMLAttributes<HTMLSelectElement>['children'];
|
|
6
9
|
className?: string;
|
|
7
10
|
['aria-label']?: string;
|
|
8
11
|
style?: React.CSSProperties;
|
|
12
|
+
/** The selected value. */
|
|
9
13
|
value?: string | number;
|
|
10
14
|
onChange?: React.ChangeEventHandler<HTMLSelectElement>;
|
|
11
15
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HeadRow';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Locale } from 'date-fns';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a series of 7 days, starting from the week, to use for formatting
|
|
4
|
+
* the weekday names (Monday, Tuesday, etc.).
|
|
5
|
+
*/
|
|
6
|
+
export declare function getWeekdays(locale?: Locale,
|
|
7
|
+
/** The index of the first day of the week (0 - Sunday) */
|
|
8
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date[];
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './components/DayContent';
|
|
|
9
9
|
export * from './components/Dropdown';
|
|
10
10
|
export * from './components/Footer';
|
|
11
11
|
export * from './components/Head';
|
|
12
|
+
export * from './components/HeadRow';
|
|
12
13
|
export * from './components/IconDropdown';
|
|
13
14
|
export * from './components/IconRight';
|
|
14
15
|
export * from './components/IconLeft';
|
package/dist/index.esm.js
CHANGED
|
@@ -422,7 +422,7 @@ function Dropdown(props) {
|
|
|
422
422
|
var IconDropdownComponent = (_b = (_a = dayPicker.components) === null || _a === void 0 ? void 0 : _a.IconDropdown) !== null && _b !== void 0 ? _b : IconDropdown;
|
|
423
423
|
return (React__default.createElement("div", { className: className, style: style },
|
|
424
424
|
React__default.createElement("span", { className: dayPicker.classNames.vhidden }, props['aria-label']),
|
|
425
|
-
React__default.createElement("select", { "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange }, children),
|
|
425
|
+
React__default.createElement("select", { name: props.name, "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange }, children),
|
|
426
426
|
React__default.createElement("div", { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true" },
|
|
427
427
|
caption,
|
|
428
428
|
React__default.createElement(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon }))));
|
|
@@ -458,7 +458,7 @@ function MonthsDropdown(props) {
|
|
|
458
458
|
props.onChange(newMonth);
|
|
459
459
|
};
|
|
460
460
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
461
|
-
return (React__default.createElement(DropdownComponent, { "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }) }, dropdownMonths.map(function (m) { return (React__default.createElement("option", { key: m.getMonth(), value: m.getMonth() }, formatMonthCaption(m, { locale: locale }))); })));
|
|
461
|
+
return (React__default.createElement(DropdownComponent, { name: "months", "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }) }, dropdownMonths.map(function (m) { return (React__default.createElement("option", { key: m.getMonth(), value: m.getMonth() }, formatMonthCaption(m, { locale: locale }))); })));
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
/**
|
|
@@ -485,7 +485,7 @@ function YearsDropdown(props) {
|
|
|
485
485
|
props.onChange(newMonth);
|
|
486
486
|
};
|
|
487
487
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
488
|
-
return (React__default.createElement(DropdownComponent, { "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }) }, years.map(function (year) { return (React__default.createElement("option", { key: year.getFullYear(), value: year.getFullYear() }, formatYearCaption(year, { locale: locale }))); })));
|
|
488
|
+
return (React__default.createElement(DropdownComponent, { name: "years", "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }) }, years.map(function (year) { return (React__default.createElement("option", { key: year.getFullYear(), value: year.getFullYear() }, formatYearCaption(year, { locale: locale }))); })));
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
/**
|
|
@@ -737,8 +737,8 @@ function Navigation(props) {
|
|
|
737
737
|
var IconRightComponent = (_a = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a !== void 0 ? _a : IconRight;
|
|
738
738
|
var IconLeftComponent = (_b = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b !== void 0 ? _b : IconLeft;
|
|
739
739
|
return (React__default.createElement("div", { className: classNames.nav, style: styles.nav },
|
|
740
|
-
!props.hidePrevious && (React__default.createElement(Button, { "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick }, dir === 'rtl' ? (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })))),
|
|
741
|
-
!props.hideNext && (React__default.createElement(Button, { "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick }, dir === 'rtl' ? (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon }))))));
|
|
740
|
+
!props.hidePrevious && (React__default.createElement(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick }, dir === 'rtl' ? (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })))),
|
|
741
|
+
!props.hideNext && (React__default.createElement(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick }, dir === 'rtl' ? (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon }))))));
|
|
742
742
|
}
|
|
743
743
|
|
|
744
744
|
/**
|
|
@@ -824,27 +824,31 @@ weekStartsOn) {
|
|
|
824
824
|
}
|
|
825
825
|
|
|
826
826
|
/**
|
|
827
|
-
* Render the
|
|
827
|
+
* Render the HeadRow component - i.e. the table head row with the weekday names.
|
|
828
828
|
*/
|
|
829
|
-
function
|
|
829
|
+
function HeadRow() {
|
|
830
830
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles, showWeekNumber = _a.showWeekNumber, locale = _a.locale, weekStartsOn = _a.weekStartsOn, formatWeekdayName = _a.formatters.formatWeekdayName, labelWeekday = _a.labels.labelWeekday;
|
|
831
831
|
var weekdays = getWeekdays(locale, weekStartsOn);
|
|
832
|
+
return (React__default.createElement("tr", { style: styles.head_row, className: classNames.head_row },
|
|
833
|
+
showWeekNumber && (React__default.createElement("th", { scope: "col", style: styles.head_cell, className: classNames.head_cell })),
|
|
834
|
+
weekdays.map(function (weekday, i) { return (React__default.createElement("th", { key: i, scope: "col", className: classNames.head_cell, style: styles.head_cell },
|
|
835
|
+
React__default.createElement("span", { "aria-hidden": true }, formatWeekdayName(weekday, { locale: locale })),
|
|
836
|
+
React__default.createElement("span", { className: classNames.vhidden }, labelWeekday(weekday, { locale: locale })))); })));
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/** Render the table head. */
|
|
840
|
+
function Head() {
|
|
841
|
+
var _a;
|
|
842
|
+
var _b = useDayPicker(), classNames = _b.classNames, styles = _b.styles, components = _b.components;
|
|
843
|
+
var HeadRowComponent = (_a = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a !== void 0 ? _a : HeadRow;
|
|
832
844
|
return (React__default.createElement("thead", { style: styles.head, className: classNames.head },
|
|
833
|
-
React__default.createElement(
|
|
834
|
-
showWeekNumber && (React__default.createElement("th", { scope: "col", style: styles.head_cell, className: classNames.head_cell })),
|
|
835
|
-
weekdays.map(function (weekday, i) { return (React__default.createElement("th", { key: i, scope: "col", className: classNames.head_cell, style: styles.head_cell },
|
|
836
|
-
React__default.createElement("span", { "aria-hidden": true }, formatWeekdayName(weekday, { locale: locale })),
|
|
837
|
-
React__default.createElement("span", { className: classNames.vhidden }, labelWeekday(weekday, { locale: locale })))); }))));
|
|
845
|
+
React__default.createElement(HeadRowComponent, null)));
|
|
838
846
|
}
|
|
839
847
|
|
|
840
|
-
/**
|
|
841
|
-
* Render the content of the day cell.
|
|
842
|
-
*/
|
|
848
|
+
/** Render the content of the day cell. */
|
|
843
849
|
function DayContent(props) {
|
|
844
|
-
var _a = useDayPicker(), locale = _a.locale,
|
|
845
|
-
return
|
|
846
|
-
React__default.createElement("span", { "aria-hidden": "true" }, formatDay(props.date, { locale: locale })),
|
|
847
|
-
React__default.createElement("span", { className: classNames.vhidden, style: styles.vhidden }, labelDay(props.date, props.activeModifiers, { locale: locale }))));
|
|
850
|
+
var _a = useDayPicker(), locale = _a.locale, formatDay = _a.formatters.formatDay;
|
|
851
|
+
return React__default.createElement(React__default.Fragment, null, formatDay(props.date, { locale: locale }));
|
|
848
852
|
}
|
|
849
853
|
|
|
850
854
|
/**
|
|
@@ -1523,7 +1527,9 @@ function useDayEventHandlers(date, activeModifiers) {
|
|
|
1523
1527
|
else if (isDayPickerRange(dayPicker)) {
|
|
1524
1528
|
(_c = range.onDayClick) === null || _c === void 0 ? void 0 : _c.call(range, date, activeModifiers, e);
|
|
1525
1529
|
}
|
|
1526
|
-
|
|
1530
|
+
else {
|
|
1531
|
+
(_d = dayPicker.onDayClick) === null || _d === void 0 ? void 0 : _d.call(dayPicker, date, activeModifiers, e);
|
|
1532
|
+
}
|
|
1527
1533
|
};
|
|
1528
1534
|
var onFocus = function (e) {
|
|
1529
1535
|
var _a;
|
|
@@ -1726,6 +1732,9 @@ buttonRef) {
|
|
|
1726
1732
|
]);
|
|
1727
1733
|
var className = getDayClassNames(dayPicker, activeModifiers).join(' ');
|
|
1728
1734
|
var style = getDayStyle(dayPicker, activeModifiers);
|
|
1735
|
+
var ariaLabel = dayPicker.labels.labelDay(day, activeModifiers, {
|
|
1736
|
+
locale: dayPicker.locale
|
|
1737
|
+
});
|
|
1729
1738
|
var isHidden = Boolean((activeModifiers.outside && !dayPicker.showOutsideDays) ||
|
|
1730
1739
|
activeModifiers.hidden);
|
|
1731
1740
|
var DayContentComponent = (_c = (_b = dayPicker.components) === null || _b === void 0 ? void 0 : _b.DayContent) !== null && _c !== void 0 ? _c : DayContent;
|
|
@@ -1733,10 +1742,11 @@ buttonRef) {
|
|
|
1733
1742
|
var divProps = {
|
|
1734
1743
|
style: style,
|
|
1735
1744
|
className: className,
|
|
1736
|
-
children: children
|
|
1745
|
+
children: children,
|
|
1746
|
+
'aria-label': ariaLabel
|
|
1737
1747
|
};
|
|
1738
1748
|
var isFocusTarget = Boolean(focusContext.focusTarget && isSameDay(focusContext.focusTarget, day));
|
|
1739
|
-
var buttonProps = __assign(__assign(__assign({}, divProps), (_a = { disabled: activeModifiers.disabled }, _a['aria-pressed'] = activeModifiers.selected, _a.tabIndex = isFocusTarget ? 0 : -1, _a)), eventHandlers);
|
|
1749
|
+
var buttonProps = __assign(__assign(__assign({}, divProps), (_a = { disabled: activeModifiers.disabled }, _a['aria-pressed'] = activeModifiers.selected, _a['aria-label'] = ariaLabel, _a.tabIndex = isFocusTarget ? 0 : -1, _a)), eventHandlers);
|
|
1740
1750
|
var dayRender = {
|
|
1741
1751
|
isButton: isButton,
|
|
1742
1752
|
isHidden: isHidden,
|
|
@@ -1761,7 +1771,7 @@ function Day(props) {
|
|
|
1761
1771
|
if (!dayRender.isButton) {
|
|
1762
1772
|
return React__default.createElement("div", __assign({}, dayRender.divProps));
|
|
1763
1773
|
}
|
|
1764
|
-
return React__default.createElement(Button, __assign({ ref: buttonRef }, dayRender.buttonProps));
|
|
1774
|
+
return React__default.createElement(Button, __assign({ name: "day", ref: buttonRef }, dayRender.buttonProps));
|
|
1765
1775
|
}
|
|
1766
1776
|
|
|
1767
1777
|
/**
|
|
@@ -1779,7 +1789,7 @@ function WeekNumber(props) {
|
|
|
1779
1789
|
var handleClick = function (e) {
|
|
1780
1790
|
onWeekNumberClick(weekNumber, dates, e);
|
|
1781
1791
|
};
|
|
1782
|
-
return (React__default.createElement(Button, { "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick }, content));
|
|
1792
|
+
return (React__default.createElement(Button, { name: "week-number", "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick }, content));
|
|
1783
1793
|
}
|
|
1784
1794
|
|
|
1785
1795
|
/** Render a row in the calendar, with the days and the week number. */
|
|
@@ -2198,8 +2208,8 @@ function useInput(options) {
|
|
|
2198
2208
|
onMonthChange: handleMonthChange,
|
|
2199
2209
|
selected: selectedDay,
|
|
2200
2210
|
locale: locale,
|
|
2201
|
-
fromDate:
|
|
2202
|
-
toDate:
|
|
2211
|
+
fromDate: fromDate,
|
|
2212
|
+
toDate: toDate,
|
|
2203
2213
|
today: today
|
|
2204
2214
|
};
|
|
2205
2215
|
var inputProps = {
|
|
@@ -2217,5 +2227,5 @@ function isDayPickerDefault(props) {
|
|
|
2217
2227
|
return props.mode === undefined || props.mode === 'default';
|
|
2218
2228
|
}
|
|
2219
2229
|
|
|
2220
|
-
export { Button, Caption, CaptionDropdowns, CaptionLabel, CaptionNavigation, Day, DayContent, DayPicker, DayPickerContext, DayPickerProvider, Dropdown, FocusContext, FocusProvider, Footer, Head, IconDropdown, IconLeft, IconRight, InternalModifier, NavigationContext, NavigationProvider, RootProvider, Row, SelectMultipleContext, SelectMultipleProvider, SelectMultipleProviderInternal, SelectRangeContext, SelectRangeProvider, SelectRangeProviderInternal, SelectSingleContext, SelectSingleProvider, SelectSingleProviderInternal, WeekNumber, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };
|
|
2230
|
+
export { Button, Caption, CaptionDropdowns, CaptionLabel, CaptionNavigation, Day, DayContent, DayPicker, DayPickerContext, DayPickerProvider, Dropdown, FocusContext, FocusProvider, Footer, Head, HeadRow, IconDropdown, IconLeft, IconRight, InternalModifier, NavigationContext, NavigationProvider, RootProvider, Row, SelectMultipleContext, SelectMultipleProvider, SelectMultipleProviderInternal, SelectRangeContext, SelectRangeProvider, SelectRangeProviderInternal, SelectSingleContext, SelectSingleProvider, SelectSingleProviderInternal, WeekNumber, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };
|
|
2221
2231
|
//# sourceMappingURL=index.esm.js.map
|