pixel-react 1.10.3 → 1.10.4
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/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
- package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
- package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
- package/lib/components/Button/Button.stories.d.ts +12 -0
- package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
- package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/lib/components/Chip/Chip.stories.d.ts +14 -0
- package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
- package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
- package/lib/components/Drawer/Drawer.stories.d.ts +7 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
- package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
- package/lib/components/Form/Form.stories.d.ts +6 -0
- package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
- package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
- package/lib/components/Icon/Icon.stories.d.ts +7 -0
- package/lib/components/IconButton/IconButton.stories.d.ts +6 -0
- package/lib/components/Input/Input.stories.d.ts +9 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
- package/lib/components/InputWithDropdown/types.d.ts +3 -0
- package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
- package/lib/components/MenuOption/MenuOption.stories.d.ts +15 -0
- package/lib/components/MiniModal/MiniModal.stories.d.ts +9 -0
- package/lib/components/Modal/Modal.stories.d.ts +7 -0
- package/lib/components/MultiSelect/MultiSelect.stories.d.ts +9 -0
- package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +8 -0
- package/lib/components/Search/Search.stories.d.ts +6 -0
- package/lib/components/Select/Select.stories.d.ts +13 -0
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +15 -0
- package/lib/components/SequentialConnectingBranch/components/AddBrowserModal/AddBrowserModal.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/components/AddBrowserModal/types.d.ts +3 -0
- package/lib/components/SequentialConnectingBranch/components/DatasetListModal/DatasetListModal.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/components/DatasetListModal/types.d.ts +3 -0
- package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
- package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
- package/lib/components/Table/Table.stories.d.ts +11 -0
- package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
- package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
- package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
- package/lib/components/ThemeProvider/CustomThemeProvider.d.ts +8 -0
- package/lib/components/Toast/Toast.stories.d.ts +6 -0
- package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
- package/lib/components/Typography/Typography.stories.d.ts +10 -0
- package/lib/hooks/useCustomThemeProvider.d.ts +11 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.esm.js +225 -379
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +225 -379
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
- package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
- package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
- package/lib/utils/debounce/debounce.stories.d.ts +6 -0
- package/lib/utils/ffID/ffID.stories.d.ts +6 -0
- package/lib/utils/find/findAndInsert.d.ts +7 -0
- package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
- package/lib/utils/throttle/throttle.stories.d.ts +6 -0
- package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
- package/package.json +1 -1
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +6 -0
- package/src/components/InputWithDropdown/types.ts +7 -1
package/lib/index.esm.js
CHANGED
@@ -3930,8 +3930,6 @@ function LiveRegion(_ref) {
|
|
3930
3930
|
// Hide element visually but keep it readable by screen readers
|
3931
3931
|
const visuallyHidden = {
|
3932
3932
|
position: 'fixed',
|
3933
|
-
top: 0,
|
3934
|
-
left: 0,
|
3935
3933
|
width: 1,
|
3936
3934
|
height: 1,
|
3937
3935
|
margin: -1,
|
@@ -4921,12 +4919,11 @@ var KeyboardCode;
|
|
4921
4919
|
KeyboardCode["Up"] = "ArrowUp";
|
4922
4920
|
KeyboardCode["Esc"] = "Escape";
|
4923
4921
|
KeyboardCode["Enter"] = "Enter";
|
4924
|
-
KeyboardCode["Tab"] = "Tab";
|
4925
4922
|
})(KeyboardCode || (KeyboardCode = {}));
|
4926
4923
|
const defaultKeyboardCodes = {
|
4927
4924
|
start: [KeyboardCode.Space, KeyboardCode.Enter],
|
4928
4925
|
cancel: [KeyboardCode.Esc],
|
4929
|
-
end: [KeyboardCode.Space, KeyboardCode.Enter
|
4926
|
+
end: [KeyboardCode.Space, KeyboardCode.Enter]
|
4930
4927
|
};
|
4931
4928
|
const defaultKeyboardCoordinateGetter = (event, _ref) => {
|
4932
4929
|
let {
|
@@ -5225,9 +5222,6 @@ class AbstractPointerSensor {
|
|
5225
5222
|
passive: false
|
5226
5223
|
});
|
5227
5224
|
this.listeners.add(events.end.name, this.handleEnd);
|
5228
|
-
if (events.cancel) {
|
5229
|
-
this.listeners.add(events.cancel.name, this.handleCancel);
|
5230
|
-
}
|
5231
5225
|
this.windowListeners.add(EventName.Resize, this.handleCancel);
|
5232
5226
|
this.windowListeners.add(EventName.DragStart, preventDefault);
|
5233
5227
|
this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
|
@@ -5243,11 +5237,9 @@ class AbstractPointerSensor {
|
|
5243
5237
|
}
|
5244
5238
|
if (isDelayConstraint(activationConstraint)) {
|
5245
5239
|
this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
|
5246
|
-
this.handlePending(activationConstraint);
|
5247
5240
|
return;
|
5248
5241
|
}
|
5249
5242
|
if (isDistanceConstraint(activationConstraint)) {
|
5250
|
-
this.handlePending(activationConstraint);
|
5251
5243
|
return;
|
5252
5244
|
}
|
5253
5245
|
}
|
@@ -5264,13 +5256,6 @@ class AbstractPointerSensor {
|
|
5264
5256
|
this.timeoutId = null;
|
5265
5257
|
}
|
5266
5258
|
}
|
5267
|
-
handlePending(constraint, offset) {
|
5268
|
-
const {
|
5269
|
-
active,
|
5270
|
-
onPending
|
5271
|
-
} = this.props;
|
5272
|
-
onPending(active, constraint, this.initialCoordinates, offset);
|
5273
|
-
}
|
5274
5259
|
handleStart() {
|
5275
5260
|
const {
|
5276
5261
|
initialCoordinates
|
@@ -5324,7 +5309,6 @@ class AbstractPointerSensor {
|
|
5324
5309
|
return this.handleCancel();
|
5325
5310
|
}
|
5326
5311
|
}
|
5327
|
-
this.handlePending(activationConstraint, delta);
|
5328
5312
|
return;
|
5329
5313
|
}
|
5330
5314
|
if (event.cancelable) {
|
@@ -5334,24 +5318,16 @@ class AbstractPointerSensor {
|
|
5334
5318
|
}
|
5335
5319
|
handleEnd() {
|
5336
5320
|
const {
|
5337
|
-
onAbort,
|
5338
5321
|
onEnd
|
5339
5322
|
} = this.props;
|
5340
5323
|
this.detach();
|
5341
|
-
if (!this.activated) {
|
5342
|
-
onAbort(this.props.active);
|
5343
|
-
}
|
5344
5324
|
onEnd();
|
5345
5325
|
}
|
5346
5326
|
handleCancel() {
|
5347
5327
|
const {
|
5348
|
-
onAbort,
|
5349
5328
|
onCancel
|
5350
5329
|
} = this.props;
|
5351
5330
|
this.detach();
|
5352
|
-
if (!this.activated) {
|
5353
|
-
onAbort(this.props.active);
|
5354
|
-
}
|
5355
5331
|
onCancel();
|
5356
5332
|
}
|
5357
5333
|
handleKeydown(event) {
|
@@ -5365,9 +5341,6 @@ class AbstractPointerSensor {
|
|
5365
5341
|
}
|
5366
5342
|
}
|
5367
5343
|
const events = {
|
5368
|
-
cancel: {
|
5369
|
-
name: 'pointercancel'
|
5370
|
-
},
|
5371
5344
|
move: {
|
5372
5345
|
name: 'pointermove'
|
5373
5346
|
},
|
@@ -5440,9 +5413,6 @@ MouseSensor.activators = [{
|
|
5440
5413
|
}
|
5441
5414
|
}];
|
5442
5415
|
const events$2 = {
|
5443
|
-
cancel: {
|
5444
|
-
name: 'touchcancel'
|
5445
|
-
},
|
5446
5416
|
move: {
|
5447
5417
|
name: 'touchmove'
|
5448
5418
|
},
|
@@ -5644,11 +5614,11 @@ function useScrollIntent(_ref2) {
|
|
5644
5614
|
}, [disabled, delta, previousDelta]);
|
5645
5615
|
}
|
5646
5616
|
function useCachedNode(draggableNodes, id) {
|
5647
|
-
const draggableNode = id
|
5617
|
+
const draggableNode = id !== null ? draggableNodes.get(id) : undefined;
|
5648
5618
|
const node = draggableNode ? draggableNode.node.current : null;
|
5649
5619
|
return useLazyMemo(cachedNode => {
|
5650
5620
|
var _ref;
|
5651
|
-
if (id
|
5621
|
+
if (id === null) {
|
5652
5622
|
return null;
|
5653
5623
|
} // In some cases, the draggable node can unmount while dragging
|
5654
5624
|
// This is the case for virtualized lists. In those situations,
|
@@ -5856,26 +5826,7 @@ function useRect(element, measure, fallbackRect) {
|
|
5856
5826
|
if (measure === void 0) {
|
5857
5827
|
measure = defaultMeasure;
|
5858
5828
|
}
|
5859
|
-
const [rect,
|
5860
|
-
function measureRect() {
|
5861
|
-
setRect(currentRect => {
|
5862
|
-
if (!element) {
|
5863
|
-
return null;
|
5864
|
-
}
|
5865
|
-
if (element.isConnected === false) {
|
5866
|
-
var _ref;
|
5867
|
-
|
5868
|
-
// Fall back to last rect we measured if the element is
|
5869
|
-
// no longer connected to the DOM.
|
5870
|
-
return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
|
5871
|
-
}
|
5872
|
-
const newRect = measure(element);
|
5873
|
-
if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
|
5874
|
-
return currentRect;
|
5875
|
-
}
|
5876
|
-
return newRect;
|
5877
|
-
});
|
5878
|
-
}
|
5829
|
+
const [rect, measureRect] = useReducer(reducer, null);
|
5879
5830
|
const mutationObserver = useMutationObserver({
|
5880
5831
|
callback(records) {
|
5881
5832
|
if (!element) {
|
@@ -5910,6 +5861,23 @@ function useRect(element, measure, fallbackRect) {
|
|
5910
5861
|
}
|
5911
5862
|
}, [element]);
|
5912
5863
|
return rect;
|
5864
|
+
function reducer(currentRect) {
|
5865
|
+
if (!element) {
|
5866
|
+
return null;
|
5867
|
+
}
|
5868
|
+
if (element.isConnected === false) {
|
5869
|
+
var _ref;
|
5870
|
+
|
5871
|
+
// Fall back to last rect we measured if the element is
|
5872
|
+
// no longer connected to the DOM.
|
5873
|
+
return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
|
5874
|
+
}
|
5875
|
+
const newRect = measure(element);
|
5876
|
+
if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
|
5877
|
+
return currentRect;
|
5878
|
+
}
|
5879
|
+
return newRect;
|
5880
|
+
}
|
5913
5881
|
}
|
5914
5882
|
function useRectDelta(rect) {
|
5915
5883
|
const initialRect = useInitialValue(rect);
|
@@ -6055,24 +6023,28 @@ function useRects(elements, measure) {
|
|
6055
6023
|
}
|
6056
6024
|
const [firstElement] = elements;
|
6057
6025
|
const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
|
6058
|
-
const [rects,
|
6059
|
-
function measureRects() {
|
6060
|
-
setRects(() => {
|
6061
|
-
if (!elements.length) {
|
6062
|
-
return defaultValue$2;
|
6063
|
-
}
|
6064
|
-
return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
|
6065
|
-
});
|
6066
|
-
}
|
6026
|
+
const [rects, measureRects] = useReducer(reducer, defaultValue$2);
|
6067
6027
|
const resizeObserver = useResizeObserver({
|
6068
6028
|
callback: measureRects
|
6069
6029
|
});
|
6070
|
-
|
6071
|
-
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
6030
|
+
if (elements.length > 0 && rects === defaultValue$2) {
|
6072
6031
|
measureRects();
|
6073
|
-
|
6032
|
+
}
|
6033
|
+
useIsomorphicLayoutEffect$1(() => {
|
6034
|
+
if (elements.length) {
|
6035
|
+
elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
6036
|
+
} else {
|
6037
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
6038
|
+
measureRects();
|
6039
|
+
}
|
6074
6040
|
}, [elements]);
|
6075
6041
|
return rects;
|
6042
|
+
function reducer() {
|
6043
|
+
if (!elements.length) {
|
6044
|
+
return defaultValue$2;
|
6045
|
+
}
|
6046
|
+
return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
|
6047
|
+
}
|
6076
6048
|
}
|
6077
6049
|
function getMeasurableNode(node) {
|
6078
6050
|
if (!node) {
|
@@ -6239,7 +6211,7 @@ function reducer$1(state, action) {
|
|
6239
6211
|
}
|
6240
6212
|
};
|
6241
6213
|
case Action.DragMove:
|
6242
|
-
if (state.draggable.active
|
6214
|
+
if (!state.draggable.active) {
|
6243
6215
|
return state;
|
6244
6216
|
}
|
6245
6217
|
return {
|
@@ -6511,7 +6483,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6511
6483
|
containers: droppableContainers
|
6512
6484
|
}
|
6513
6485
|
} = state;
|
6514
|
-
const node = activeId
|
6486
|
+
const node = activeId ? draggableNodes.get(activeId) : null;
|
6515
6487
|
const activeRects = useRef({
|
6516
6488
|
initial: null,
|
6517
6489
|
translated: null
|
@@ -6546,7 +6518,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6546
6518
|
const autoScrollOptions = getAutoScrollerOptions();
|
6547
6519
|
const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
|
6548
6520
|
useLayoutShiftScrollCompensation({
|
6549
|
-
activeNode: activeId
|
6521
|
+
activeNode: activeId ? draggableNodes.get(activeId) : null,
|
6550
6522
|
config: autoScrollOptions.layoutShiftCompensation,
|
6551
6523
|
initialRect: initialActiveNodeRect,
|
6552
6524
|
measure: measuringConfiguration.draggable.measure
|
@@ -6624,7 +6596,6 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6624
6596
|
|
6625
6597
|
const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
|
6626
6598
|
const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
|
6627
|
-
const activeSensorRef = useRef(null);
|
6628
6599
|
const instantiateSensor = useCallback((event, _ref2) => {
|
6629
6600
|
let {
|
6630
6601
|
sensor: Sensor,
|
@@ -6646,43 +6617,6 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6646
6617
|
// Sensors need to be instantiated with refs for arguments that change over time
|
6647
6618
|
// otherwise they are frozen in time with the stale arguments
|
6648
6619
|
context: sensorContext,
|
6649
|
-
onAbort(id) {
|
6650
|
-
const draggableNode = draggableNodes.get(id);
|
6651
|
-
if (!draggableNode) {
|
6652
|
-
return;
|
6653
|
-
}
|
6654
|
-
const {
|
6655
|
-
onDragAbort
|
6656
|
-
} = latestProps.current;
|
6657
|
-
const event = {
|
6658
|
-
id
|
6659
|
-
};
|
6660
|
-
onDragAbort == null ? void 0 : onDragAbort(event);
|
6661
|
-
dispatchMonitorEvent({
|
6662
|
-
type: 'onDragAbort',
|
6663
|
-
event
|
6664
|
-
});
|
6665
|
-
},
|
6666
|
-
onPending(id, constraint, initialCoordinates, offset) {
|
6667
|
-
const draggableNode = draggableNodes.get(id);
|
6668
|
-
if (!draggableNode) {
|
6669
|
-
return;
|
6670
|
-
}
|
6671
|
-
const {
|
6672
|
-
onDragPending
|
6673
|
-
} = latestProps.current;
|
6674
|
-
const event = {
|
6675
|
-
id,
|
6676
|
-
constraint,
|
6677
|
-
initialCoordinates,
|
6678
|
-
offset
|
6679
|
-
};
|
6680
|
-
onDragPending == null ? void 0 : onDragPending(event);
|
6681
|
-
dispatchMonitorEvent({
|
6682
|
-
type: 'onDragPending',
|
6683
|
-
event
|
6684
|
-
});
|
6685
|
-
},
|
6686
6620
|
onStart(initialCoordinates) {
|
6687
6621
|
const id = activeRef.current;
|
6688
6622
|
if (id == null) {
|
@@ -6696,7 +6630,6 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6696
6630
|
onDragStart
|
6697
6631
|
} = latestProps.current;
|
6698
6632
|
const event = {
|
6699
|
-
activatorEvent,
|
6700
6633
|
active: {
|
6701
6634
|
id,
|
6702
6635
|
data: draggableNode.data,
|
@@ -6715,8 +6648,6 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6715
6648
|
type: 'onDragStart',
|
6716
6649
|
event
|
6717
6650
|
});
|
6718
|
-
setActiveSensor(activeSensorRef.current);
|
6719
|
-
setActivatorEvent(activatorEvent);
|
6720
6651
|
});
|
6721
6652
|
},
|
6722
6653
|
onMove(coordinates) {
|
@@ -6728,7 +6659,10 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6728
6659
|
onEnd: createHandler(Action.DragEnd),
|
6729
6660
|
onCancel: createHandler(Action.DragCancel)
|
6730
6661
|
});
|
6731
|
-
|
6662
|
+
unstable_batchedUpdates(() => {
|
6663
|
+
setActiveSensor(sensorInstance);
|
6664
|
+
setActivatorEvent(event.nativeEvent);
|
6665
|
+
});
|
6732
6666
|
function createHandler(type) {
|
6733
6667
|
return async function handler() {
|
6734
6668
|
const {
|
@@ -6765,7 +6699,6 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6765
6699
|
setOver(null);
|
6766
6700
|
setActiveSensor(null);
|
6767
6701
|
setActivatorEvent(null);
|
6768
|
-
activeSensorRef.current = null;
|
6769
6702
|
const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';
|
6770
6703
|
if (event) {
|
6771
6704
|
const handler = latestProps.current[eventName];
|
@@ -6987,7 +6920,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
|
|
6987
6920
|
});
|
6988
6921
|
const NullContext = /*#__PURE__*/createContext$1(null);
|
6989
6922
|
const defaultRole = 'button';
|
6990
|
-
const ID_PREFIX$1 = '
|
6923
|
+
const ID_PREFIX$1 = 'Droppable';
|
6991
6924
|
function useDraggable(_ref) {
|
6992
6925
|
let {
|
6993
6926
|
id,
|
@@ -7134,7 +7067,7 @@ function useDroppable(_ref) {
|
|
7134
7067
|
resizeObserverConnected.current = false;
|
7135
7068
|
resizeObserver.observe(nodeRef.current);
|
7136
7069
|
}, [nodeRef, resizeObserver]);
|
7137
|
-
|
7070
|
+
useIsomorphicLayoutEffect$1(() => {
|
7138
7071
|
dispatch({
|
7139
7072
|
type: Action.RegisterDroppable,
|
7140
7073
|
element: {
|
@@ -7549,7 +7482,6 @@ var DNDCore = /*#__PURE__*/Object.freeze({
|
|
7549
7482
|
defaultCoordinates: defaultCoordinates,
|
7550
7483
|
defaultDropAnimation: defaultDropAnimationConfiguration,
|
7551
7484
|
defaultDropAnimationSideEffects: defaultDropAnimationSideEffects,
|
7552
|
-
defaultKeyboardCoordinateGetter: defaultKeyboardCoordinateGetter,
|
7553
7485
|
defaultScreenReaderInstructions: defaultScreenReaderInstructions,
|
7554
7486
|
getClientRect: getClientRect,
|
7555
7487
|
getFirstCollision: getFirstCollision,
|
@@ -11330,14 +11262,13 @@ var isWeb = typeof window !== 'undefined' &&
|
|
11330
11262
|
function cloneObject(data) {
|
11331
11263
|
let copy;
|
11332
11264
|
const isArray = Array.isArray(data);
|
11333
|
-
const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
|
11334
11265
|
if (data instanceof Date) {
|
11335
11266
|
copy = new Date(data);
|
11336
11267
|
}
|
11337
11268
|
else if (data instanceof Set) {
|
11338
11269
|
copy = new Set(data);
|
11339
11270
|
}
|
11340
|
-
else if (!(isWeb && (data instanceof Blob ||
|
11271
|
+
else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
|
11341
11272
|
(isArray || isObject$2(data))) {
|
11342
11273
|
copy = isArray ? [] : {};
|
11343
11274
|
if (!isArray && !isPlainObject(data)) {
|
@@ -11396,7 +11327,7 @@ var set$1 = (object, path, value) => {
|
|
11396
11327
|
? []
|
11397
11328
|
: {};
|
11398
11329
|
}
|
11399
|
-
if (key === '__proto__'
|
11330
|
+
if (key === '__proto__') {
|
11400
11331
|
return;
|
11401
11332
|
}
|
11402
11333
|
object[key] = newValue;
|
@@ -11615,7 +11546,7 @@ function useFormState(props) {
|
|
11615
11546
|
_mounted.current = false;
|
11616
11547
|
};
|
11617
11548
|
}, [control]);
|
11618
|
-
return
|
11549
|
+
return getProxyFormState(formState, control, _localProxyFormState.current, false);
|
11619
11550
|
}
|
11620
11551
|
|
11621
11552
|
var isString = (value) => typeof value === 'string';
|
@@ -11711,67 +11642,6 @@ function useController(props) {
|
|
11711
11642
|
value,
|
11712
11643
|
...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
|
11713
11644
|
}));
|
11714
|
-
const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
|
11715
|
-
invalid: {
|
11716
|
-
enumerable: true,
|
11717
|
-
get: () => !!get$1(formState.errors, name),
|
11718
|
-
},
|
11719
|
-
isDirty: {
|
11720
|
-
enumerable: true,
|
11721
|
-
get: () => !!get$1(formState.dirtyFields, name),
|
11722
|
-
},
|
11723
|
-
isTouched: {
|
11724
|
-
enumerable: true,
|
11725
|
-
get: () => !!get$1(formState.touchedFields, name),
|
11726
|
-
},
|
11727
|
-
isValidating: {
|
11728
|
-
enumerable: true,
|
11729
|
-
get: () => !!get$1(formState.validatingFields, name),
|
11730
|
-
},
|
11731
|
-
error: {
|
11732
|
-
enumerable: true,
|
11733
|
-
get: () => get$1(formState.errors, name),
|
11734
|
-
},
|
11735
|
-
}), [formState, name]);
|
11736
|
-
const field = React__default.useMemo(() => ({
|
11737
|
-
name,
|
11738
|
-
value,
|
11739
|
-
...(isBoolean(disabled) || formState.disabled
|
11740
|
-
? { disabled: formState.disabled || disabled }
|
11741
|
-
: {}),
|
11742
|
-
onChange: (event) => _registerProps.current.onChange({
|
11743
|
-
target: {
|
11744
|
-
value: getEventValue(event),
|
11745
|
-
name: name,
|
11746
|
-
},
|
11747
|
-
type: EVENTS.CHANGE,
|
11748
|
-
}),
|
11749
|
-
onBlur: () => _registerProps.current.onBlur({
|
11750
|
-
target: {
|
11751
|
-
value: get$1(control._formValues, name),
|
11752
|
-
name: name,
|
11753
|
-
},
|
11754
|
-
type: EVENTS.BLUR,
|
11755
|
-
}),
|
11756
|
-
ref: (elm) => {
|
11757
|
-
const field = get$1(control._fields, name);
|
11758
|
-
if (field && elm) {
|
11759
|
-
field._f.ref = {
|
11760
|
-
focus: () => elm.focus(),
|
11761
|
-
select: () => elm.select(),
|
11762
|
-
setCustomValidity: (message) => elm.setCustomValidity(message),
|
11763
|
-
reportValidity: () => elm.reportValidity(),
|
11764
|
-
};
|
11765
|
-
}
|
11766
|
-
},
|
11767
|
-
}), [
|
11768
|
-
name,
|
11769
|
-
control._formValues,
|
11770
|
-
disabled,
|
11771
|
-
formState.disabled,
|
11772
|
-
value,
|
11773
|
-
control._fields,
|
11774
|
-
]);
|
11775
11645
|
React__default.useEffect(() => {
|
11776
11646
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
11777
11647
|
const updateMounted = (name, value) => {
|
@@ -11797,7 +11667,7 @@ function useController(props) {
|
|
11797
11667
|
};
|
11798
11668
|
}, [name, control, isArrayField, shouldUnregister]);
|
11799
11669
|
React__default.useEffect(() => {
|
11800
|
-
if (
|
11670
|
+
if (get$1(control._fields, name)) {
|
11801
11671
|
control._updateDisabledField({
|
11802
11672
|
disabled,
|
11803
11673
|
fields: control._fields,
|
@@ -11806,11 +11676,63 @@ function useController(props) {
|
|
11806
11676
|
});
|
11807
11677
|
}
|
11808
11678
|
}, [disabled, name, control]);
|
11809
|
-
return
|
11810
|
-
field
|
11679
|
+
return {
|
11680
|
+
field: {
|
11681
|
+
name,
|
11682
|
+
value,
|
11683
|
+
...(isBoolean(disabled) || formState.disabled
|
11684
|
+
? { disabled: formState.disabled || disabled }
|
11685
|
+
: {}),
|
11686
|
+
onChange: React__default.useCallback((event) => _registerProps.current.onChange({
|
11687
|
+
target: {
|
11688
|
+
value: getEventValue(event),
|
11689
|
+
name: name,
|
11690
|
+
},
|
11691
|
+
type: EVENTS.CHANGE,
|
11692
|
+
}), [name]),
|
11693
|
+
onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
|
11694
|
+
target: {
|
11695
|
+
value: get$1(control._formValues, name),
|
11696
|
+
name: name,
|
11697
|
+
},
|
11698
|
+
type: EVENTS.BLUR,
|
11699
|
+
}), [name, control]),
|
11700
|
+
ref: React__default.useCallback((elm) => {
|
11701
|
+
const field = get$1(control._fields, name);
|
11702
|
+
if (field && elm) {
|
11703
|
+
field._f.ref = {
|
11704
|
+
focus: () => elm.focus(),
|
11705
|
+
select: () => elm.select(),
|
11706
|
+
setCustomValidity: (message) => elm.setCustomValidity(message),
|
11707
|
+
reportValidity: () => elm.reportValidity(),
|
11708
|
+
};
|
11709
|
+
}
|
11710
|
+
}, [control._fields, name]),
|
11711
|
+
},
|
11811
11712
|
formState,
|
11812
|
-
fieldState,
|
11813
|
-
|
11713
|
+
fieldState: Object.defineProperties({}, {
|
11714
|
+
invalid: {
|
11715
|
+
enumerable: true,
|
11716
|
+
get: () => !!get$1(formState.errors, name),
|
11717
|
+
},
|
11718
|
+
isDirty: {
|
11719
|
+
enumerable: true,
|
11720
|
+
get: () => !!get$1(formState.dirtyFields, name),
|
11721
|
+
},
|
11722
|
+
isTouched: {
|
11723
|
+
enumerable: true,
|
11724
|
+
get: () => !!get$1(formState.touchedFields, name),
|
11725
|
+
},
|
11726
|
+
isValidating: {
|
11727
|
+
enumerable: true,
|
11728
|
+
get: () => !!get$1(formState.validatingFields, name),
|
11729
|
+
},
|
11730
|
+
error: {
|
11731
|
+
enumerable: true,
|
11732
|
+
get: () => get$1(formState.errors, name),
|
11733
|
+
},
|
11734
|
+
}),
|
11735
|
+
};
|
11814
11736
|
}
|
11815
11737
|
|
11816
11738
|
/**
|
@@ -11860,7 +11782,7 @@ const Controller = (props) => props.render(useController(props));
|
|
11860
11782
|
const flatten = (obj) => {
|
11861
11783
|
const output = {};
|
11862
11784
|
for (const key of Object.keys(obj)) {
|
11863
|
-
if (isObjectType(obj[key])
|
11785
|
+
if (isObjectType(obj[key])) {
|
11864
11786
|
const nested = flatten(obj[key]);
|
11865
11787
|
for (const nestedKey of Object.keys(nested)) {
|
11866
11788
|
output[`${key}.${nestedKey}`] = nested[nestedKey];
|
@@ -11929,7 +11851,7 @@ function Form(props) {
|
|
11929
11851
|
headers && headers['Content-Type'],
|
11930
11852
|
encType,
|
11931
11853
|
].some((value) => value && value.includes('json'));
|
11932
|
-
const response = await fetch(
|
11854
|
+
const response = await fetch(action, {
|
11933
11855
|
method,
|
11934
11856
|
headers: {
|
11935
11857
|
...headers,
|
@@ -12427,7 +12349,7 @@ var updateAt = (fieldValues, index, value) => {
|
|
12427
12349
|
*/
|
12428
12350
|
function useFieldArray(props) {
|
12429
12351
|
const methods = useFormContext();
|
12430
|
-
const { control = methods.control, name, keyName = 'id', shouldUnregister,
|
12352
|
+
const { control = methods.control, name, keyName = 'id', shouldUnregister, } = props;
|
12431
12353
|
const [fields, setFields] = React__default.useState(control._getFieldArray(name));
|
12432
12354
|
const ids = React__default.useRef(control._getFieldArray(name).map(generateId));
|
12433
12355
|
const _fieldIds = React__default.useRef(fields);
|
@@ -12436,8 +12358,8 @@ function useFieldArray(props) {
|
|
12436
12358
|
_name.current = name;
|
12437
12359
|
_fieldIds.current = fields;
|
12438
12360
|
control._names.array.add(name);
|
12439
|
-
rules &&
|
12440
|
-
control.register(name, rules);
|
12361
|
+
props.rules &&
|
12362
|
+
control.register(name, props.rules);
|
12441
12363
|
useSubscribe({
|
12442
12364
|
next: ({ values, name: fieldArrayName, }) => {
|
12443
12365
|
if (fieldArrayName === _name.current || !fieldArrayName) {
|
@@ -12481,8 +12403,6 @@ function useFieldArray(props) {
|
|
12481
12403
|
ids.current = removeArrayAt(ids.current, index);
|
12482
12404
|
updateValues(updatedFieldArrayValues);
|
12483
12405
|
setFields(updatedFieldArrayValues);
|
12484
|
-
!Array.isArray(get$1(control._fields, name)) &&
|
12485
|
-
set$1(control._fields, name, undefined);
|
12486
12406
|
control._updateFieldArray(name, updatedFieldArrayValues, removeArrayAt, {
|
12487
12407
|
argA: index,
|
12488
12408
|
});
|
@@ -12797,8 +12717,7 @@ var getRuleValue = (rule) => isUndefined(rule)
|
|
12797
12717
|
: rule;
|
12798
12718
|
|
12799
12719
|
const ASYNC_FUNCTION = 'AsyncFunction';
|
12800
|
-
var hasPromiseValidation = (fieldReference) =>
|
12801
|
-
!!fieldReference.validate &&
|
12720
|
+
var hasPromiseValidation = (fieldReference) => (!fieldReference || !fieldReference.validate) &&
|
12802
12721
|
!!((isFunction$1(fieldReference.validate) &&
|
12803
12722
|
fieldReference.validate.constructor.name === ASYNC_FUNCTION) ||
|
12804
12723
|
(isObject$2(fieldReference.validate) &&
|
@@ -12927,7 +12846,7 @@ function createFormControl(props = {}) {
|
|
12927
12846
|
timer = setTimeout(callback, wait);
|
12928
12847
|
};
|
12929
12848
|
const _updateValid = async (shouldUpdateValid) => {
|
12930
|
-
if (!
|
12849
|
+
if (!props.disabled && (_proxyFormState.isValid || shouldUpdateValid)) {
|
12931
12850
|
const isValid = _options.resolver
|
12932
12851
|
? isEmptyObject((await _executeSchema()).errors)
|
12933
12852
|
: await executeBuiltInValidation(_fields, true);
|
@@ -12939,7 +12858,7 @@ function createFormControl(props = {}) {
|
|
12939
12858
|
}
|
12940
12859
|
};
|
12941
12860
|
const _updateIsValidating = (names, isValidating) => {
|
12942
|
-
if (!
|
12861
|
+
if (!props.disabled &&
|
12943
12862
|
(_proxyFormState.isValidating || _proxyFormState.validatingFields)) {
|
12944
12863
|
(names || Array.from(_names.mount)).forEach((name) => {
|
12945
12864
|
if (name) {
|
@@ -12955,7 +12874,7 @@ function createFormControl(props = {}) {
|
|
12955
12874
|
}
|
12956
12875
|
};
|
12957
12876
|
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
12958
|
-
if (args && method && !
|
12877
|
+
if (args && method && !props.disabled) {
|
12959
12878
|
_state.action = true;
|
12960
12879
|
if (shouldUpdateFieldsAndState && Array.isArray(get$1(_fields, name))) {
|
12961
12880
|
const fieldValues = method(get$1(_fields, name), args.argA, args.argB);
|
@@ -13019,7 +12938,7 @@ function createFormControl(props = {}) {
|
|
13019
12938
|
const output = {
|
13020
12939
|
name,
|
13021
12940
|
};
|
13022
|
-
if (!
|
12941
|
+
if (!props.disabled) {
|
13023
12942
|
const disabledField = !!(get$1(_fields, name) &&
|
13024
12943
|
get$1(_fields, name)._f &&
|
13025
12944
|
get$1(_fields, name)._f.disabled);
|
@@ -13060,9 +12979,9 @@ function createFormControl(props = {}) {
|
|
13060
12979
|
const shouldUpdateValid = _proxyFormState.isValid &&
|
13061
12980
|
isBoolean(isValid) &&
|
13062
12981
|
_formState.isValid !== isValid;
|
13063
|
-
if (
|
12982
|
+
if (props.delayError && error) {
|
13064
12983
|
delayErrorCallback = debounce(() => updateErrors(name, error));
|
13065
|
-
delayErrorCallback(
|
12984
|
+
delayErrorCallback(props.delayError);
|
13066
12985
|
}
|
13067
12986
|
else {
|
13068
12987
|
clearTimeout(timer);
|
@@ -13155,7 +13074,7 @@ function createFormControl(props = {}) {
|
|
13155
13074
|
}
|
13156
13075
|
_names.unMount = new Set();
|
13157
13076
|
};
|
13158
|
-
const _getDirty = (name, data) => !
|
13077
|
+
const _getDirty = (name, data) => !props.disabled &&
|
13159
13078
|
(name && data && set$1(_formValues, name, data),
|
13160
13079
|
!deepEqual(getValues(), _defaultValues));
|
13161
13080
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
@@ -13167,7 +13086,7 @@ function createFormControl(props = {}) {
|
|
13167
13086
|
? { [names]: defaultValue }
|
13168
13087
|
: defaultValue),
|
13169
13088
|
}, isGlobal, defaultValue);
|
13170
|
-
const _getFieldArray = (name) => compact(get$1(_state.mount ? _formValues : _defaultValues, name,
|
13089
|
+
const _getFieldArray = (name) => compact(get$1(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get$1(_defaultValues, name, []) : []));
|
13171
13090
|
const setFieldValue = (name, value, options = {}) => {
|
13172
13091
|
const field = get$1(_fields, name);
|
13173
13092
|
let fieldValue = value;
|
@@ -13300,7 +13219,7 @@ function createFormControl(props = {}) {
|
|
13300
13219
|
});
|
13301
13220
|
if (shouldSkipValidation) {
|
13302
13221
|
if (_proxyFormState.isValid) {
|
13303
|
-
if (
|
13222
|
+
if (props.mode === 'onBlur') {
|
13304
13223
|
if (isBlurEvent) {
|
13305
13224
|
_updateValid();
|
13306
13225
|
}
|
@@ -13465,15 +13384,13 @@ function createFormControl(props = {}) {
|
|
13465
13384
|
: isUndefined(value)
|
13466
13385
|
? getFieldValue(field ? field._f : get$1(fields, name)._f)
|
13467
13386
|
: value;
|
13468
|
-
|
13469
|
-
set$1(_formValues, name, inputValue);
|
13470
|
-
}
|
13387
|
+
set$1(_formValues, name, inputValue);
|
13471
13388
|
updateTouchAndDirty(name, inputValue, false, false, true);
|
13472
13389
|
}
|
13473
13390
|
};
|
13474
13391
|
const register = (name, options = {}) => {
|
13475
13392
|
let field = get$1(_fields, name);
|
13476
|
-
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(
|
13393
|
+
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(props.disabled);
|
13477
13394
|
set$1(_fields, name, {
|
13478
13395
|
...(field || {}),
|
13479
13396
|
_f: {
|
@@ -13489,7 +13406,7 @@ function createFormControl(props = {}) {
|
|
13489
13406
|
field,
|
13490
13407
|
disabled: isBoolean(options.disabled)
|
13491
13408
|
? options.disabled
|
13492
|
-
:
|
13409
|
+
: props.disabled,
|
13493
13410
|
name,
|
13494
13411
|
value: options.value,
|
13495
13412
|
});
|
@@ -13499,7 +13416,7 @@ function createFormControl(props = {}) {
|
|
13499
13416
|
}
|
13500
13417
|
return {
|
13501
13418
|
...(disabledIsDefined
|
13502
|
-
? { disabled: options.disabled ||
|
13419
|
+
? { disabled: options.disabled || props.disabled }
|
13503
13420
|
: {}),
|
13504
13421
|
...(_options.progressive
|
13505
13422
|
? {
|
@@ -13583,12 +13500,6 @@ function createFormControl(props = {}) {
|
|
13583
13500
|
e.preventDefault && e.preventDefault();
|
13584
13501
|
e.persist && e.persist();
|
13585
13502
|
}
|
13586
|
-
if (_options.disabled) {
|
13587
|
-
if (onInvalid) {
|
13588
|
-
await onInvalid({ ..._formState.errors }, e);
|
13589
|
-
}
|
13590
|
-
return;
|
13591
|
-
}
|
13592
13503
|
let fieldValues = cloneObject(_formValues);
|
13593
13504
|
_subjects.state.next({
|
13594
13505
|
isSubmitting: true,
|
@@ -13696,7 +13607,7 @@ function createFormControl(props = {}) {
|
|
13696
13607
|
}
|
13697
13608
|
_fields = {};
|
13698
13609
|
}
|
13699
|
-
_formValues =
|
13610
|
+
_formValues = props.shouldUnregister
|
13700
13611
|
? keepStateOptions.keepDefaultValues
|
13701
13612
|
? cloneObject(_defaultValues)
|
13702
13613
|
: {}
|
@@ -13720,7 +13631,7 @@ function createFormControl(props = {}) {
|
|
13720
13631
|
!_proxyFormState.isValid ||
|
13721
13632
|
!!keepStateOptions.keepIsValid ||
|
13722
13633
|
!!keepStateOptions.keepDirtyValues;
|
13723
|
-
_state.watch = !!
|
13634
|
+
_state.watch = !!props.shouldUnregister;
|
13724
13635
|
_subjects.state.next({
|
13725
13636
|
submitCount: keepStateOptions.keepSubmitCount
|
13726
13637
|
? _formState.submitCount
|
@@ -13767,9 +13678,7 @@ function createFormControl(props = {}) {
|
|
13767
13678
|
: fieldReference.ref;
|
13768
13679
|
if (fieldRef.focus) {
|
13769
13680
|
fieldRef.focus();
|
13770
|
-
options.shouldSelect &&
|
13771
|
-
isFunction$1(fieldRef.select) &&
|
13772
|
-
fieldRef.select();
|
13681
|
+
options.shouldSelect && fieldRef.select();
|
13773
13682
|
}
|
13774
13683
|
}
|
13775
13684
|
};
|
@@ -13891,8 +13800,8 @@ function createFormControl(props = {}) {
|
|
13891
13800
|
* ```
|
13892
13801
|
*/
|
13893
13802
|
function useForm(props = {}) {
|
13894
|
-
const _formControl = React__default.useRef(
|
13895
|
-
const _values = React__default.useRef(
|
13803
|
+
const _formControl = React__default.useRef();
|
13804
|
+
const _values = React__default.useRef();
|
13896
13805
|
const [formState, updateFormState] = React__default.useState({
|
13897
13806
|
isDirty: false,
|
13898
13807
|
isValidating: false,
|
@@ -13970,6 +13879,11 @@ function useForm(props = {}) {
|
|
13970
13879
|
values: control._getWatch(),
|
13971
13880
|
});
|
13972
13881
|
}, [props.shouldUnregister, control]);
|
13882
|
+
React__default.useEffect(() => {
|
13883
|
+
if (_formControl.current) {
|
13884
|
+
_formControl.current.watch = _formControl.current.watch.bind({});
|
13885
|
+
}
|
13886
|
+
}, [formState]);
|
13973
13887
|
_formControl.current.formState = getProxyFormState(formState, control);
|
13974
13888
|
return _formControl.current;
|
13975
13889
|
}
|
@@ -14037,6 +13951,9 @@ const InputWithDropdown = /*#__PURE__*/forwardRef(({
|
|
14037
13951
|
onDropdownChangeHandler = () => {},
|
14038
13952
|
onInputChangeHandler,
|
14039
13953
|
onInputBlurHandler,
|
13954
|
+
onClick,
|
13955
|
+
onKeyUp,
|
13956
|
+
onFocus,
|
14040
13957
|
optionsRequired = true,
|
14041
13958
|
dropdownPosition = 'right',
|
14042
13959
|
type = 'text'
|
@@ -14098,6 +14015,9 @@ const InputWithDropdown = /*#__PURE__*/forwardRef(({
|
|
14098
14015
|
autoComplete: autoComplete,
|
14099
14016
|
required: required,
|
14100
14017
|
disabled: disabled,
|
14018
|
+
onClick: onClick,
|
14019
|
+
onKeyUp: onKeyUp,
|
14020
|
+
onFocus: onFocus,
|
14101
14021
|
className: classNames('ff-floating-input', {
|
14102
14022
|
'ff-floating-input--filled': isValueFilled,
|
14103
14023
|
'ff-floating-input--disabled': !!disabled,
|
@@ -18291,53 +18211,6 @@ function setYear(date, year, options) {
|
|
18291
18211
|
return date_;
|
18292
18212
|
}
|
18293
18213
|
|
18294
|
-
const FIVE_WEEKS = 5;
|
18295
|
-
const FOUR_WEEKS = 4;
|
18296
|
-
/**
|
18297
|
-
* Return the number of weeks to display in the broadcast calendar.
|
18298
|
-
*
|
18299
|
-
* @since 9.4.0
|
18300
|
-
*/
|
18301
|
-
function getBroadcastWeeksInMonth(month, dateLib) {
|
18302
|
-
// Get the first day of the month
|
18303
|
-
const firstDayOfMonth = dateLib.startOfMonth(month);
|
18304
|
-
// Get the day of the week for the first day of the month (1-7, where 1 is Monday)
|
18305
|
-
const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
|
18306
|
-
const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
|
18307
|
-
const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
|
18308
|
-
const numberOfWeeks = month.getMonth() === lastDateOfLastWeek.getMonth() ? FIVE_WEEKS : FOUR_WEEKS;
|
18309
|
-
return numberOfWeeks;
|
18310
|
-
}
|
18311
|
-
|
18312
|
-
/**
|
18313
|
-
* Return the start date of the week in the broadcast calendar.
|
18314
|
-
*
|
18315
|
-
* @since 9.4.0
|
18316
|
-
*/
|
18317
|
-
function startOfBroadcastWeek(date, dateLib) {
|
18318
|
-
const firstOfMonth = dateLib.startOfMonth(date);
|
18319
|
-
const dayOfWeek = firstOfMonth.getDay();
|
18320
|
-
if (dayOfWeek === 1) {
|
18321
|
-
return firstOfMonth;
|
18322
|
-
} else if (dayOfWeek === 0) {
|
18323
|
-
return dateLib.addDays(firstOfMonth, -1 * 6);
|
18324
|
-
} else {
|
18325
|
-
return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
|
18326
|
-
}
|
18327
|
-
}
|
18328
|
-
|
18329
|
-
/**
|
18330
|
-
* Return the end date of the week in the broadcast calendar.
|
18331
|
-
*
|
18332
|
-
* @since 9.4.0
|
18333
|
-
*/
|
18334
|
-
function endOfBroadcastWeek(date, dateLib) {
|
18335
|
-
const startDate = startOfBroadcastWeek(date, dateLib);
|
18336
|
-
const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
|
18337
|
-
const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
|
18338
|
-
return endDate;
|
18339
|
-
}
|
18340
|
-
|
18341
18214
|
/**
|
18342
18215
|
* A wrapper class around [date-fns](http://date-fns.org) sharing the same
|
18343
18216
|
* options. Methods of this class can be overridden using the
|
@@ -18418,15 +18291,6 @@ class DateLib {
|
|
18418
18291
|
this.differenceInCalendarMonths = (dateLeft, dateRight) => {
|
18419
18292
|
return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
|
18420
18293
|
};
|
18421
|
-
/**
|
18422
|
-
* Returns the end of the broadcast week for the given date.
|
18423
|
-
*
|
18424
|
-
* @param date The original date.
|
18425
|
-
* @returns The end of the broadcast week.
|
18426
|
-
*/
|
18427
|
-
this.endOfBroadcastWeek = date => {
|
18428
|
-
return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date, this) : endOfBroadcastWeek(date, this);
|
18429
|
-
};
|
18430
18294
|
/**
|
18431
18295
|
* Returns the end of the ISO week for the given date.
|
18432
18296
|
*
|
@@ -18588,15 +18452,6 @@ class DateLib {
|
|
18588
18452
|
this.setYear = (date, year) => {
|
18589
18453
|
return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
|
18590
18454
|
};
|
18591
|
-
/**
|
18592
|
-
* Returns the start of the broadcast week for the given date.
|
18593
|
-
*
|
18594
|
-
* @param date The original date.
|
18595
|
-
* @returns The start of the broadcast week.
|
18596
|
-
*/
|
18597
|
-
this.startOfBroadcastWeek = date => {
|
18598
|
-
return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
|
18599
|
-
};
|
18600
18455
|
/**
|
18601
18456
|
* Returns the start of the day for the given date.
|
18602
18457
|
*
|
@@ -19079,9 +18934,7 @@ function Weekday(props) {
|
|
19079
18934
|
* @see https://daypicker.dev/guides/custom-components
|
19080
18935
|
*/
|
19081
18936
|
function Weekdays(props) {
|
19082
|
-
return /*#__PURE__*/React__default.createElement("thead", {
|
19083
|
-
"aria-hidden": true
|
19084
|
-
}, /*#__PURE__*/React__default.createElement("tr", {
|
18937
|
+
return /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", {
|
19085
18938
|
...props
|
19086
18939
|
}));
|
19087
18940
|
}
|
@@ -19184,8 +19037,7 @@ function getDataAttributes(props) {
|
|
19184
19037
|
"data-mode": props.mode ?? undefined,
|
19185
19038
|
"data-required": "required" in props ? props.required : undefined,
|
19186
19039
|
"data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || undefined,
|
19187
|
-
"data-week-numbers": props.showWeekNumber || undefined
|
19188
|
-
"data-broadcast-calendar": props.broadcastCalendar || undefined
|
19040
|
+
"data-week-numbers": props.showWeekNumber || undefined
|
19189
19041
|
};
|
19190
19042
|
Object.entries(props).forEach(([key, val]) => {
|
19191
19043
|
if (key.startsWith("data-")) {
|
@@ -19251,7 +19103,7 @@ function formatDay(date, options, dateLib) {
|
|
19251
19103
|
*/
|
19252
19104
|
function formatMonthDropdown(/** The month number to format. */
|
19253
19105
|
monthNumber, /** The locale to use for formatting. */
|
19254
|
-
locale) {
|
19106
|
+
locale = enUS$1) {
|
19255
19107
|
return locale.localize?.month(monthNumber);
|
19256
19108
|
}
|
19257
19109
|
|
@@ -19341,12 +19193,13 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
19341
19193
|
if (!navEnd) return undefined;
|
19342
19194
|
const {
|
19343
19195
|
addMonths,
|
19344
|
-
startOfMonth
|
19196
|
+
startOfMonth,
|
19197
|
+
isBefore
|
19345
19198
|
} = dateLib;
|
19346
19199
|
const year = displayMonth.getFullYear();
|
19347
19200
|
const months = [];
|
19348
19201
|
let month = navStart;
|
19349
|
-
while (months.length < 12) {
|
19202
|
+
while (months.length < 12 && isBefore(month, addMonths(navEnd, 1))) {
|
19350
19203
|
months.push(month.getMonth());
|
19351
19204
|
month = addMonths(month, 1);
|
19352
19205
|
}
|
@@ -19354,7 +19207,7 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
19354
19207
|
return a - b;
|
19355
19208
|
});
|
19356
19209
|
const options = sortedMonths.map(value => {
|
19357
|
-
const label = formatters.formatMonthDropdown(value, dateLib.options.locale
|
19210
|
+
const label = formatters.formatMonthDropdown(value, dateLib.options.locale);
|
19358
19211
|
const month = dateLib.Date ? new dateLib.Date(year, value) : new Date(year, value);
|
19359
19212
|
const disabled = navStart && month < startOfMonth(navStart) || navEnd && month > startOfMonth(navEnd) || false;
|
19360
19213
|
return {
|
@@ -19729,8 +19582,7 @@ function tzName(tz, date) {
|
|
19729
19582
|
*/
|
19730
19583
|
function getWeekdays(/** The date library. */
|
19731
19584
|
dateLib, /** Use ISOWeek instead of locale/ */
|
19732
|
-
ISOWeek, timeZone
|
19733
|
-
broadcastCalendar) {
|
19585
|
+
ISOWeek, timeZone) {
|
19734
19586
|
const date = timeZone ? TZDate.tz(timeZone) : dateLib.Date ? new dateLib.Date() : new Date();
|
19735
19587
|
const start = ISOWeek ? dateLib.startOfISOWeek(date) : dateLib.startOfWeek(date);
|
19736
19588
|
const days = [];
|
@@ -19742,18 +19594,20 @@ broadcastCalendar) {
|
|
19742
19594
|
}
|
19743
19595
|
|
19744
19596
|
/** Return the years to show in the dropdown. */
|
19745
|
-
function getYearOptions(
|
19746
|
-
if (!
|
19747
|
-
if (!
|
19597
|
+
function getYearOptions(displayMonth, calendarStart, calendarEnd, formatters, dateLib) {
|
19598
|
+
if (!calendarStart) return undefined;
|
19599
|
+
if (!calendarEnd) return undefined;
|
19748
19600
|
const {
|
19601
|
+
startOfMonth,
|
19749
19602
|
startOfYear,
|
19750
19603
|
endOfYear,
|
19751
19604
|
addYears,
|
19752
19605
|
isBefore,
|
19753
19606
|
isSameYear
|
19754
19607
|
} = dateLib;
|
19755
|
-
const
|
19756
|
-
const
|
19608
|
+
const month = displayMonth.getMonth();
|
19609
|
+
const firstNavYear = startOfYear(calendarStart);
|
19610
|
+
const lastNavYear = endOfYear(calendarEnd);
|
19757
19611
|
const years = [];
|
19758
19612
|
let year = firstNavYear;
|
19759
19613
|
while (isBefore(year, lastNavYear) || isSameYear(year, lastNavYear)) {
|
@@ -19761,11 +19615,13 @@ function getYearOptions(navStart, navEnd, formatters, dateLib) {
|
|
19761
19615
|
year = addYears(year, 1);
|
19762
19616
|
}
|
19763
19617
|
return years.map(value => {
|
19618
|
+
const year = dateLib.Date ? new dateLib.Date(value, month) : new Date(value, month);
|
19619
|
+
const disabled = calendarStart && year < startOfMonth(calendarStart) || month && calendarEnd && year > startOfMonth(calendarEnd) || false;
|
19764
19620
|
const label = formatters.formatYearDropdown(value);
|
19765
19621
|
return {
|
19766
19622
|
value,
|
19767
19623
|
label,
|
19768
|
-
disabled
|
19624
|
+
disabled
|
19769
19625
|
};
|
19770
19626
|
});
|
19771
19627
|
}
|
@@ -19929,30 +19785,29 @@ var defaultLabels = /*#__PURE__*/Object.freeze({
|
|
19929
19785
|
labelYearDropdown: labelYearDropdown
|
19930
19786
|
});
|
19931
19787
|
|
19788
|
+
/** The number of days in a month when having 6 weeks. */
|
19789
|
+
const NrOfDaysWithFixedWeeks = 42;
|
19932
19790
|
/** Return all the dates to display in the calendar. */
|
19933
19791
|
function getDates(displayMonths, maxDate, props, dateLib) {
|
19934
19792
|
const firstMonth = displayMonths[0];
|
19935
19793
|
const lastMonth = displayMonths[displayMonths.length - 1];
|
19936
19794
|
const {
|
19937
19795
|
ISOWeek,
|
19938
|
-
fixedWeeks
|
19939
|
-
broadcastCalendar
|
19796
|
+
fixedWeeks
|
19940
19797
|
} = props ?? {};
|
19941
19798
|
const {
|
19799
|
+
startOfWeek,
|
19800
|
+
endOfWeek,
|
19801
|
+
startOfISOWeek,
|
19802
|
+
endOfISOWeek,
|
19942
19803
|
addDays,
|
19943
19804
|
differenceInCalendarDays,
|
19944
19805
|
differenceInCalendarMonths,
|
19945
|
-
endOfBroadcastWeek,
|
19946
|
-
endOfISOWeek,
|
19947
|
-
endOfMonth,
|
19948
|
-
endOfWeek,
|
19949
19806
|
isAfter,
|
19950
|
-
|
19951
|
-
startOfISOWeek,
|
19952
|
-
startOfWeek
|
19807
|
+
endOfMonth
|
19953
19808
|
} = dateLib;
|
19954
|
-
const startWeekFirstDate =
|
19955
|
-
const endWeekLastDate =
|
19809
|
+
const startWeekFirstDate = ISOWeek ? startOfISOWeek(firstMonth) : startOfWeek(firstMonth);
|
19810
|
+
const endWeekLastDate = ISOWeek ? endOfISOWeek(endOfMonth(lastMonth)) : endOfWeek(endOfMonth(lastMonth));
|
19956
19811
|
const nOfDays = differenceInCalendarDays(endWeekLastDate, startWeekFirstDate);
|
19957
19812
|
const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;
|
19958
19813
|
const dates = [];
|
@@ -19964,11 +19819,9 @@ function getDates(displayMonths, maxDate, props, dateLib) {
|
|
19964
19819
|
dates.push(date);
|
19965
19820
|
}
|
19966
19821
|
// If fixed weeks is enabled, add the extra dates to the array
|
19967
|
-
const
|
19968
|
-
const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
|
19822
|
+
const extraDates = NrOfDaysWithFixedWeeks * nOfMonths;
|
19969
19823
|
if (fixedWeeks && dates.length < extraDates) {
|
19970
|
-
|
19971
|
-
for (let i = 0; i < daysToAdd; i++) {
|
19824
|
+
for (let i = 0; i < 7; i++) {
|
19972
19825
|
const date = addDays(dates[dates.length - 1], 1);
|
19973
19826
|
dates.push(date);
|
19974
19827
|
}
|
@@ -20079,29 +19932,25 @@ displayMonths, /** The dates to display in the calendar. */
|
|
20079
19932
|
dates, /** Options from the props context. */
|
20080
19933
|
props, dateLib) {
|
20081
19934
|
const {
|
20082
|
-
|
20083
|
-
|
19935
|
+
startOfWeek,
|
19936
|
+
endOfWeek,
|
19937
|
+
startOfISOWeek,
|
20084
19938
|
endOfISOWeek,
|
20085
19939
|
endOfMonth,
|
20086
|
-
|
20087
|
-
getISOWeek,
|
19940
|
+
addDays,
|
20088
19941
|
getWeek,
|
20089
|
-
|
20090
|
-
startOfISOWeek,
|
20091
|
-
startOfWeek
|
19942
|
+
getISOWeek
|
20092
19943
|
} = dateLib;
|
20093
19944
|
const dayPickerMonths = displayMonths.reduce((months, month) => {
|
20094
|
-
const firstDateOfFirstWeek = props.
|
20095
|
-
const lastDateOfLastWeek = props.
|
19945
|
+
const firstDateOfFirstWeek = props.ISOWeek ? startOfISOWeek(month) : startOfWeek(month);
|
19946
|
+
const lastDateOfLastWeek = props.ISOWeek ? endOfISOWeek(endOfMonth(month)) : endOfWeek(endOfMonth(month));
|
20096
19947
|
/** The dates to display in the month. */
|
20097
19948
|
const monthDates = dates.filter(date => {
|
20098
19949
|
return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
|
20099
19950
|
});
|
20100
|
-
|
20101
|
-
if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
|
19951
|
+
if (props.fixedWeeks && monthDates.length < 42) {
|
20102
19952
|
const extraDates = dates.filter(date => {
|
20103
|
-
|
20104
|
-
return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, daysToAdd);
|
19953
|
+
return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, 7);
|
20105
19954
|
});
|
20106
19955
|
monthDates.push(...extraDates);
|
20107
19956
|
}
|
@@ -20539,30 +20388,27 @@ function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
|
|
20539
20388
|
/** Return the next date that should be focused. */
|
20540
20389
|
function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
|
20541
20390
|
const {
|
20542
|
-
ISOWeek
|
20543
|
-
broadcastCalendar
|
20391
|
+
ISOWeek
|
20544
20392
|
} = props;
|
20545
20393
|
const {
|
20546
20394
|
addDays,
|
20547
20395
|
addMonths,
|
20548
|
-
addWeeks,
|
20549
20396
|
addYears,
|
20550
|
-
|
20397
|
+
addWeeks,
|
20398
|
+
startOfISOWeek,
|
20551
20399
|
endOfISOWeek,
|
20400
|
+
startOfWeek,
|
20552
20401
|
endOfWeek,
|
20553
20402
|
max,
|
20554
|
-
min
|
20555
|
-
startOfBroadcastWeek,
|
20556
|
-
startOfISOWeek,
|
20557
|
-
startOfWeek
|
20403
|
+
min
|
20558
20404
|
} = dateLib;
|
20559
20405
|
const moveFns = {
|
20560
20406
|
day: addDays,
|
20561
20407
|
week: addWeeks,
|
20562
20408
|
month: addMonths,
|
20563
20409
|
year: addYears,
|
20564
|
-
startOfWeek: date =>
|
20565
|
-
endOfWeek: date =>
|
20410
|
+
startOfWeek: date => ISOWeek ? startOfISOWeek(date) : startOfWeek(date),
|
20411
|
+
endOfWeek: date => ISOWeek ? endOfISOWeek(date) : endOfWeek(date)
|
20566
20412
|
};
|
20567
20413
|
let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
|
20568
20414
|
if (moveDir === "before" && navStart) {
|
@@ -20628,8 +20474,6 @@ function useFocus(props, calendar, getModifiers, isSelected, dateLib) {
|
|
20628
20474
|
/**
|
20629
20475
|
* Return a function to get the modifiers for a given day.
|
20630
20476
|
*
|
20631
|
-
* NOTE: this is not an hook, but a factory for `getModifiers`.
|
20632
|
-
*
|
20633
20477
|
* @private
|
20634
20478
|
*/
|
20635
20479
|
function useGetModifiers(days, props, dateLib) {
|
@@ -20638,19 +20482,12 @@ function useGetModifiers(days, props, dateLib) {
|
|
20638
20482
|
hidden,
|
20639
20483
|
modifiers,
|
20640
20484
|
showOutsideDays,
|
20641
|
-
broadcastCalendar,
|
20642
20485
|
today
|
20643
20486
|
} = props;
|
20644
20487
|
const {
|
20645
20488
|
isSameDay,
|
20646
|
-
isSameMonth
|
20647
|
-
startOfMonth,
|
20648
|
-
isBefore,
|
20649
|
-
endOfMonth,
|
20650
|
-
isAfter
|
20489
|
+
isSameMonth
|
20651
20490
|
} = dateLib;
|
20652
|
-
const startMonth = props.startMonth && startOfMonth(props.startMonth);
|
20653
|
-
const endMonth = props.endMonth && endOfMonth(props.endMonth);
|
20654
20491
|
const internalModifiersMap = {
|
20655
20492
|
[DayFlag.focused]: [],
|
20656
20493
|
[DayFlag.outside]: [],
|
@@ -20659,18 +20496,20 @@ function useGetModifiers(days, props, dateLib) {
|
|
20659
20496
|
[DayFlag.today]: []
|
20660
20497
|
};
|
20661
20498
|
const customModifiersMap = {};
|
20499
|
+
const selectionModifiersMap = {
|
20500
|
+
[SelectionState.range_end]: [],
|
20501
|
+
[SelectionState.range_middle]: [],
|
20502
|
+
[SelectionState.range_start]: [],
|
20503
|
+
[SelectionState.selected]: []
|
20504
|
+
};
|
20662
20505
|
for (const day of days) {
|
20663
20506
|
const {
|
20664
20507
|
date,
|
20665
20508
|
displayMonth
|
20666
20509
|
} = day;
|
20667
20510
|
const isOutside = Boolean(displayMonth && !isSameMonth(date, displayMonth));
|
20668
|
-
const isBeforeStartMonth = Boolean(startMonth && isBefore(date, startMonth));
|
20669
|
-
const isAfterEndMonth = Boolean(endMonth && isAfter(date, endMonth));
|
20670
20511
|
const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));
|
20671
|
-
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) ||
|
20672
|
-
// Broadcast calendar will show outside days as default
|
20673
|
-
!broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
|
20512
|
+
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || !showOutsideDays && isOutside;
|
20674
20513
|
const isToday = isSameDay(date, today ?? (props.timeZone ? TZDate.tz(props.timeZone) : dateLib.Date ? new dateLib.Date() : new Date()));
|
20675
20514
|
if (isOutside) internalModifiersMap.outside.push(day);
|
20676
20515
|
if (isDisabled) internalModifiersMap.disabled.push(day);
|
@@ -20699,16 +20538,27 @@ function useGetModifiers(days, props, dateLib) {
|
|
20699
20538
|
[DayFlag.outside]: false,
|
20700
20539
|
[DayFlag.today]: false
|
20701
20540
|
};
|
20541
|
+
const selectionStates = {
|
20542
|
+
[SelectionState.range_end]: false,
|
20543
|
+
[SelectionState.range_middle]: false,
|
20544
|
+
[SelectionState.range_start]: false,
|
20545
|
+
[SelectionState.selected]: false
|
20546
|
+
};
|
20702
20547
|
const customModifiers = {};
|
20703
20548
|
// Find the modifiers for the given day
|
20704
20549
|
for (const name in internalModifiersMap) {
|
20705
20550
|
const days = internalModifiersMap[name];
|
20706
20551
|
dayFlags[name] = days.some(d => d === day);
|
20707
20552
|
}
|
20553
|
+
for (const name in selectionModifiersMap) {
|
20554
|
+
const days = selectionModifiersMap[name];
|
20555
|
+
selectionStates[name] = days.some(d => d === day);
|
20556
|
+
}
|
20708
20557
|
for (const name in customModifiersMap) {
|
20709
20558
|
customModifiers[name] = customModifiersMap[name].some(d => d === day);
|
20710
20559
|
}
|
20711
20560
|
return {
|
20561
|
+
...selectionStates,
|
20712
20562
|
...dayFlags,
|
20713
20563
|
// custom modifiers should override all the previous ones
|
20714
20564
|
...customModifiers
|
@@ -21113,7 +20963,7 @@ function DayPicker(props) {
|
|
21113
20963
|
};
|
21114
20964
|
const dateLib = new DateLib({
|
21115
20965
|
locale,
|
21116
|
-
weekStartsOn: props.
|
20966
|
+
weekStartsOn: props.weekStartsOn,
|
21117
20967
|
firstWeekContainsDate: props.firstWeekContainsDate,
|
21118
20968
|
useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
|
21119
20969
|
useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens
|
@@ -21132,7 +20982,7 @@ function DayPicker(props) {
|
|
21132
20982
|
...props.classNames
|
21133
20983
|
}
|
21134
20984
|
};
|
21135
|
-
}, [props.classNames, props.components, props.dateLib, props.firstWeekContainsDate, props.formatters, props.labels, props.locale, props.useAdditionalDayOfYearTokens, props.useAdditionalWeekYearTokens, props.weekStartsOn
|
20985
|
+
}, [props.classNames, props.components, props.dateLib, props.firstWeekContainsDate, props.formatters, props.labels, props.locale, props.useAdditionalDayOfYearTokens, props.useAdditionalWeekYearTokens, props.weekStartsOn]);
|
21136
20986
|
const {
|
21137
20987
|
captionLayout,
|
21138
20988
|
mode,
|
@@ -21242,16 +21092,6 @@ function DayPicker(props) {
|
|
21242
21092
|
const handleDayMouseLeave = useCallback((day, modifiers) => e => {
|
21243
21093
|
onDayMouseLeave?.(day.date, modifiers, e);
|
21244
21094
|
}, [onDayMouseLeave]);
|
21245
|
-
const handleMonthChange = useCallback(date => e => {
|
21246
|
-
const selectedMonth = Number(e.target.value);
|
21247
|
-
const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
|
21248
|
-
goToMonth(month);
|
21249
|
-
}, [dateLib, goToMonth]);
|
21250
|
-
const handleYearChange = useCallback(date => e => {
|
21251
|
-
const selectedYear = Number(e.target.value);
|
21252
|
-
const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
|
21253
|
-
goToMonth(month);
|
21254
|
-
}, [dateLib, goToMonth]);
|
21255
21095
|
const {
|
21256
21096
|
className,
|
21257
21097
|
style
|
@@ -21289,8 +21129,6 @@ function DayPicker(props) {
|
|
21289
21129
|
lang: props.lang,
|
21290
21130
|
nonce: props.nonce,
|
21291
21131
|
title: props.title,
|
21292
|
-
role: props.role,
|
21293
|
-
"aria-label": props["aria-label"],
|
21294
21132
|
...dataAttributes
|
21295
21133
|
}, /*#__PURE__*/React__default.createElement(components.Months, {
|
21296
21134
|
className: classNames[UI.Months],
|
@@ -21304,8 +21142,17 @@ function DayPicker(props) {
|
|
21304
21142
|
previousMonth: previousMonth,
|
21305
21143
|
nextMonth: nextMonth
|
21306
21144
|
})), months.map((calendarMonth, displayIndex) => {
|
21145
|
+
const handleMonthChange = e => {
|
21146
|
+
const selectedMonth = Number(e.target.value);
|
21147
|
+
const month = dateLib.setMonth(dateLib.startOfMonth(calendarMonth.date), selectedMonth);
|
21148
|
+
goToMonth(month);
|
21149
|
+
};
|
21150
|
+
const handleYearChange = e => {
|
21151
|
+
const month = dateLib.setYear(dateLib.startOfMonth(calendarMonth.date), Number(e.target.value));
|
21152
|
+
goToMonth(month);
|
21153
|
+
};
|
21307
21154
|
const dropdownMonths = getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib);
|
21308
|
-
const dropdownYears = getYearOptions(navStart, navEnd, formatters, dateLib);
|
21155
|
+
const dropdownYears = getYearOptions(months[0].date, navStart, navEnd, formatters, dateLib);
|
21309
21156
|
return /*#__PURE__*/React__default.createElement(components.Month, {
|
21310
21157
|
className: classNames[UI.Month],
|
21311
21158
|
style: styles?.[UI.Month],
|
@@ -21326,7 +21173,7 @@ function DayPicker(props) {
|
|
21326
21173
|
classNames: classNames,
|
21327
21174
|
components: components,
|
21328
21175
|
disabled: Boolean(props.disableNavigation),
|
21329
|
-
onChange: handleMonthChange
|
21176
|
+
onChange: handleMonthChange,
|
21330
21177
|
options: dropdownMonths,
|
21331
21178
|
style: styles?.[UI.Dropdown],
|
21332
21179
|
value: calendarMonth.date.getMonth()
|
@@ -21339,7 +21186,7 @@ function DayPicker(props) {
|
|
21339
21186
|
classNames: classNames,
|
21340
21187
|
components: components,
|
21341
21188
|
disabled: Boolean(props.disableNavigation),
|
21342
|
-
onChange: handleYearChange
|
21189
|
+
onChange: handleYearChange,
|
21343
21190
|
options: dropdownYears,
|
21344
21191
|
style: styles?.[UI.Dropdown],
|
21345
21192
|
value: calendarMonth.date.getFullYear()
|
@@ -21386,8 +21233,7 @@ function DayPicker(props) {
|
|
21386
21233
|
locale
|
21387
21234
|
}),
|
21388
21235
|
className: classNames[UI.WeekNumber],
|
21389
|
-
scope: "row"
|
21390
|
-
role: "rowheader"
|
21236
|
+
scope: "row"
|
21391
21237
|
}, formatWeekNumber(week.weekNumber))), week.days.map(day => {
|
21392
21238
|
const {
|
21393
21239
|
date
|
@@ -21407,14 +21253,14 @@ function DayPicker(props) {
|
|
21407
21253
|
}
|
21408
21254
|
const style = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
21409
21255
|
const className = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
21410
|
-
const ariaLabel = !isInteractive
|
21256
|
+
const ariaLabel = !isInteractive ? labelGridcell(date, modifiers, dateLib.options, dateLib) : undefined;
|
21411
21257
|
return /*#__PURE__*/React__default.createElement(components.Day, {
|
21412
21258
|
key: `${dateLib.format(date, "yyyy-MM-dd")}_${dateLib.format(day.displayMonth, "yyyy-MM")}`,
|
21413
21259
|
day: day,
|
21414
21260
|
modifiers: modifiers,
|
21415
21261
|
className: className.join(" "),
|
21416
21262
|
style: style,
|
21417
|
-
|
21263
|
+
"aria-hidden": modifiers.hidden || undefined,
|
21418
21264
|
"aria-selected": modifiers.selected || undefined,
|
21419
21265
|
"aria-label": ariaLabel,
|
21420
21266
|
"data-day": dateLib.format(date, "yyyy-MM-dd"),
|
@@ -21425,7 +21271,7 @@ function DayPicker(props) {
|
|
21425
21271
|
"data-outside": day.outside || undefined,
|
21426
21272
|
"data-focused": modifiers.focused || undefined,
|
21427
21273
|
"data-today": modifiers.today || undefined
|
21428
|
-
},
|
21274
|
+
}, isInteractive ? (/*#__PURE__*/React__default.createElement(components.DayButton, {
|
21429
21275
|
className: classNames[UI.DayButton],
|
21430
21276
|
style: styles?.[UI.DayButton],
|
21431
21277
|
type: "button",
|
@@ -21440,7 +21286,7 @@ function DayPicker(props) {
|
|
21440
21286
|
onKeyDown: handleDayKeyDown(day, modifiers),
|
21441
21287
|
onMouseEnter: handleDayMouseEnter(day, modifiers),
|
21442
21288
|
onMouseLeave: handleDayMouseLeave(day, modifiers)
|
21443
|
-
}, formatDay(date, dateLib.options, dateLib))) :
|
21289
|
+
}, formatDay(date, dateLib.options, dateLib))) : formatDay(day.date, dateLib.options, dateLib));
|
21444
21290
|
}));
|
21445
21291
|
}))));
|
21446
21292
|
})), props.footer && (/*#__PURE__*/React__default.createElement(components.Footer, {
|