pixel-react 1.10.2 → 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/TableTree/Utils/addNewRow.d.ts +2 -0
- package/lib/components/TableTree/types.d.ts +4 -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 +5 -0
- package/lib/index.esm.js +244 -385
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +244 -385
- 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/src/components/TableTree/Components/AddModule/AddModule.tsx +3 -1
- package/src/components/TableTree/Components/TableCell.tsx +1 -0
- package/src/components/TableTree/TableTree.tsx +1 -1
- package/src/components/TableTree/Utils/addNewRow.ts +5 -1
- package/src/components/TableTree/types.ts +4 -0
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,
|
@@ -14448,6 +14368,7 @@ const AddModule = ({
|
|
14448
14368
|
error,
|
14449
14369
|
value = ''
|
14450
14370
|
}) => {
|
14371
|
+
console.log('🚀 ~ value:', value);
|
14451
14372
|
const [text, setText] = useState(value);
|
14452
14373
|
return jsxs(Fragment, {
|
14453
14374
|
children: [jsxs("div", {
|
@@ -14455,7 +14376,8 @@ const AddModule = ({
|
|
14455
14376
|
children: [jsx("input", {
|
14456
14377
|
type: "text",
|
14457
14378
|
className: "add-module-input",
|
14458
|
-
onChange: e => setText(e.target.value)
|
14379
|
+
onChange: e => setText(e.target.value),
|
14380
|
+
value: text
|
14459
14381
|
}), jsx(Icon, {
|
14460
14382
|
className: "icons",
|
14461
14383
|
name: "update_icon",
|
@@ -14465,7 +14387,9 @@ const AddModule = ({
|
|
14465
14387
|
name: "close",
|
14466
14388
|
onClick: onCancel
|
14467
14389
|
})]
|
14468
|
-
}),
|
14390
|
+
}), jsx("small", {
|
14391
|
+
children: error
|
14392
|
+
})]
|
14469
14393
|
});
|
14470
14394
|
};
|
14471
14395
|
|
@@ -14522,7 +14446,8 @@ const TableCell = /*#__PURE__*/React__default.memo(({
|
|
14522
14446
|
}), node.isNewNode && col.isTree ? jsx(AddModule, {
|
14523
14447
|
onCancel: onAddCancel,
|
14524
14448
|
onConfirm: onAddConfirm,
|
14525
|
-
error: node?.error || ''
|
14449
|
+
error: node?.error || '',
|
14450
|
+
value: node.value
|
14526
14451
|
}) : jsx("span", {
|
14527
14452
|
className: "tree-table-td-content-text",
|
14528
14453
|
children: prepareData(node, col)
|
@@ -14565,7 +14490,9 @@ const TableRow = /*#__PURE__*/React__default.memo(({
|
|
14565
14490
|
const addNewRow = (treeData, newNode) => {
|
14566
14491
|
const {
|
14567
14492
|
sourceId,
|
14568
|
-
action
|
14493
|
+
action,
|
14494
|
+
value = '',
|
14495
|
+
error = ''
|
14569
14496
|
} = newNode;
|
14570
14497
|
if (!sourceId || !action) return treeData;
|
14571
14498
|
const nodeMap = new Map(treeData.map(node => [node.key, node]));
|
@@ -14577,7 +14504,9 @@ const addNewRow = (treeData, newNode) => {
|
|
14577
14504
|
hierarchy: sourceNode.hierarchy,
|
14578
14505
|
sourceId: sourceNode.key,
|
14579
14506
|
isNewNode: true,
|
14580
|
-
key: 'new-node'
|
14507
|
+
key: 'new-node',
|
14508
|
+
value,
|
14509
|
+
error
|
14581
14510
|
};
|
14582
14511
|
switch (action) {
|
14583
14512
|
case 'addAbove':
|
@@ -14643,7 +14572,11 @@ const TreeTable = ({
|
|
14643
14572
|
loadMore = () => {},
|
14644
14573
|
tableBorder,
|
14645
14574
|
height = 'auto',
|
14646
|
-
newNode = {
|
14575
|
+
newNode = {
|
14576
|
+
action: 'addInside',
|
14577
|
+
sourceId: 'PAG1013',
|
14578
|
+
value: 'newNode'
|
14579
|
+
},
|
14647
14580
|
onAddConfirm = _name => {},
|
14648
14581
|
onAddCancel = () => {}
|
14649
14582
|
}) => {
|
@@ -18278,53 +18211,6 @@ function setYear(date, year, options) {
|
|
18278
18211
|
return date_;
|
18279
18212
|
}
|
18280
18213
|
|
18281
|
-
const FIVE_WEEKS = 5;
|
18282
|
-
const FOUR_WEEKS = 4;
|
18283
|
-
/**
|
18284
|
-
* Return the number of weeks to display in the broadcast calendar.
|
18285
|
-
*
|
18286
|
-
* @since 9.4.0
|
18287
|
-
*/
|
18288
|
-
function getBroadcastWeeksInMonth(month, dateLib) {
|
18289
|
-
// Get the first day of the month
|
18290
|
-
const firstDayOfMonth = dateLib.startOfMonth(month);
|
18291
|
-
// Get the day of the week for the first day of the month (1-7, where 1 is Monday)
|
18292
|
-
const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
|
18293
|
-
const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
|
18294
|
-
const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
|
18295
|
-
const numberOfWeeks = month.getMonth() === lastDateOfLastWeek.getMonth() ? FIVE_WEEKS : FOUR_WEEKS;
|
18296
|
-
return numberOfWeeks;
|
18297
|
-
}
|
18298
|
-
|
18299
|
-
/**
|
18300
|
-
* Return the start date of the week in the broadcast calendar.
|
18301
|
-
*
|
18302
|
-
* @since 9.4.0
|
18303
|
-
*/
|
18304
|
-
function startOfBroadcastWeek(date, dateLib) {
|
18305
|
-
const firstOfMonth = dateLib.startOfMonth(date);
|
18306
|
-
const dayOfWeek = firstOfMonth.getDay();
|
18307
|
-
if (dayOfWeek === 1) {
|
18308
|
-
return firstOfMonth;
|
18309
|
-
} else if (dayOfWeek === 0) {
|
18310
|
-
return dateLib.addDays(firstOfMonth, -1 * 6);
|
18311
|
-
} else {
|
18312
|
-
return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
|
18313
|
-
}
|
18314
|
-
}
|
18315
|
-
|
18316
|
-
/**
|
18317
|
-
* Return the end date of the week in the broadcast calendar.
|
18318
|
-
*
|
18319
|
-
* @since 9.4.0
|
18320
|
-
*/
|
18321
|
-
function endOfBroadcastWeek(date, dateLib) {
|
18322
|
-
const startDate = startOfBroadcastWeek(date, dateLib);
|
18323
|
-
const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
|
18324
|
-
const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
|
18325
|
-
return endDate;
|
18326
|
-
}
|
18327
|
-
|
18328
18214
|
/**
|
18329
18215
|
* A wrapper class around [date-fns](http://date-fns.org) sharing the same
|
18330
18216
|
* options. Methods of this class can be overridden using the
|
@@ -18405,15 +18291,6 @@ class DateLib {
|
|
18405
18291
|
this.differenceInCalendarMonths = (dateLeft, dateRight) => {
|
18406
18292
|
return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
|
18407
18293
|
};
|
18408
|
-
/**
|
18409
|
-
* Returns the end of the broadcast week for the given date.
|
18410
|
-
*
|
18411
|
-
* @param date The original date.
|
18412
|
-
* @returns The end of the broadcast week.
|
18413
|
-
*/
|
18414
|
-
this.endOfBroadcastWeek = date => {
|
18415
|
-
return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date, this) : endOfBroadcastWeek(date, this);
|
18416
|
-
};
|
18417
18294
|
/**
|
18418
18295
|
* Returns the end of the ISO week for the given date.
|
18419
18296
|
*
|
@@ -18575,15 +18452,6 @@ class DateLib {
|
|
18575
18452
|
this.setYear = (date, year) => {
|
18576
18453
|
return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
|
18577
18454
|
};
|
18578
|
-
/**
|
18579
|
-
* Returns the start of the broadcast week for the given date.
|
18580
|
-
*
|
18581
|
-
* @param date The original date.
|
18582
|
-
* @returns The start of the broadcast week.
|
18583
|
-
*/
|
18584
|
-
this.startOfBroadcastWeek = date => {
|
18585
|
-
return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
|
18586
|
-
};
|
18587
18455
|
/**
|
18588
18456
|
* Returns the start of the day for the given date.
|
18589
18457
|
*
|
@@ -19066,9 +18934,7 @@ function Weekday(props) {
|
|
19066
18934
|
* @see https://daypicker.dev/guides/custom-components
|
19067
18935
|
*/
|
19068
18936
|
function Weekdays(props) {
|
19069
|
-
return /*#__PURE__*/React__default.createElement("thead", {
|
19070
|
-
"aria-hidden": true
|
19071
|
-
}, /*#__PURE__*/React__default.createElement("tr", {
|
18937
|
+
return /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", {
|
19072
18938
|
...props
|
19073
18939
|
}));
|
19074
18940
|
}
|
@@ -19171,8 +19037,7 @@ function getDataAttributes(props) {
|
|
19171
19037
|
"data-mode": props.mode ?? undefined,
|
19172
19038
|
"data-required": "required" in props ? props.required : undefined,
|
19173
19039
|
"data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || undefined,
|
19174
|
-
"data-week-numbers": props.showWeekNumber || undefined
|
19175
|
-
"data-broadcast-calendar": props.broadcastCalendar || undefined
|
19040
|
+
"data-week-numbers": props.showWeekNumber || undefined
|
19176
19041
|
};
|
19177
19042
|
Object.entries(props).forEach(([key, val]) => {
|
19178
19043
|
if (key.startsWith("data-")) {
|
@@ -19238,7 +19103,7 @@ function formatDay(date, options, dateLib) {
|
|
19238
19103
|
*/
|
19239
19104
|
function formatMonthDropdown(/** The month number to format. */
|
19240
19105
|
monthNumber, /** The locale to use for formatting. */
|
19241
|
-
locale) {
|
19106
|
+
locale = enUS$1) {
|
19242
19107
|
return locale.localize?.month(monthNumber);
|
19243
19108
|
}
|
19244
19109
|
|
@@ -19328,12 +19193,13 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
19328
19193
|
if (!navEnd) return undefined;
|
19329
19194
|
const {
|
19330
19195
|
addMonths,
|
19331
|
-
startOfMonth
|
19196
|
+
startOfMonth,
|
19197
|
+
isBefore
|
19332
19198
|
} = dateLib;
|
19333
19199
|
const year = displayMonth.getFullYear();
|
19334
19200
|
const months = [];
|
19335
19201
|
let month = navStart;
|
19336
|
-
while (months.length < 12) {
|
19202
|
+
while (months.length < 12 && isBefore(month, addMonths(navEnd, 1))) {
|
19337
19203
|
months.push(month.getMonth());
|
19338
19204
|
month = addMonths(month, 1);
|
19339
19205
|
}
|
@@ -19341,7 +19207,7 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
19341
19207
|
return a - b;
|
19342
19208
|
});
|
19343
19209
|
const options = sortedMonths.map(value => {
|
19344
|
-
const label = formatters.formatMonthDropdown(value, dateLib.options.locale
|
19210
|
+
const label = formatters.formatMonthDropdown(value, dateLib.options.locale);
|
19345
19211
|
const month = dateLib.Date ? new dateLib.Date(year, value) : new Date(year, value);
|
19346
19212
|
const disabled = navStart && month < startOfMonth(navStart) || navEnd && month > startOfMonth(navEnd) || false;
|
19347
19213
|
return {
|
@@ -19716,8 +19582,7 @@ function tzName(tz, date) {
|
|
19716
19582
|
*/
|
19717
19583
|
function getWeekdays(/** The date library. */
|
19718
19584
|
dateLib, /** Use ISOWeek instead of locale/ */
|
19719
|
-
ISOWeek, timeZone
|
19720
|
-
broadcastCalendar) {
|
19585
|
+
ISOWeek, timeZone) {
|
19721
19586
|
const date = timeZone ? TZDate.tz(timeZone) : dateLib.Date ? new dateLib.Date() : new Date();
|
19722
19587
|
const start = ISOWeek ? dateLib.startOfISOWeek(date) : dateLib.startOfWeek(date);
|
19723
19588
|
const days = [];
|
@@ -19729,18 +19594,20 @@ broadcastCalendar) {
|
|
19729
19594
|
}
|
19730
19595
|
|
19731
19596
|
/** Return the years to show in the dropdown. */
|
19732
|
-
function getYearOptions(
|
19733
|
-
if (!
|
19734
|
-
if (!
|
19597
|
+
function getYearOptions(displayMonth, calendarStart, calendarEnd, formatters, dateLib) {
|
19598
|
+
if (!calendarStart) return undefined;
|
19599
|
+
if (!calendarEnd) return undefined;
|
19735
19600
|
const {
|
19601
|
+
startOfMonth,
|
19736
19602
|
startOfYear,
|
19737
19603
|
endOfYear,
|
19738
19604
|
addYears,
|
19739
19605
|
isBefore,
|
19740
19606
|
isSameYear
|
19741
19607
|
} = dateLib;
|
19742
|
-
const
|
19743
|
-
const
|
19608
|
+
const month = displayMonth.getMonth();
|
19609
|
+
const firstNavYear = startOfYear(calendarStart);
|
19610
|
+
const lastNavYear = endOfYear(calendarEnd);
|
19744
19611
|
const years = [];
|
19745
19612
|
let year = firstNavYear;
|
19746
19613
|
while (isBefore(year, lastNavYear) || isSameYear(year, lastNavYear)) {
|
@@ -19748,11 +19615,13 @@ function getYearOptions(navStart, navEnd, formatters, dateLib) {
|
|
19748
19615
|
year = addYears(year, 1);
|
19749
19616
|
}
|
19750
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;
|
19751
19620
|
const label = formatters.formatYearDropdown(value);
|
19752
19621
|
return {
|
19753
19622
|
value,
|
19754
19623
|
label,
|
19755
|
-
disabled
|
19624
|
+
disabled
|
19756
19625
|
};
|
19757
19626
|
});
|
19758
19627
|
}
|
@@ -19916,30 +19785,29 @@ var defaultLabels = /*#__PURE__*/Object.freeze({
|
|
19916
19785
|
labelYearDropdown: labelYearDropdown
|
19917
19786
|
});
|
19918
19787
|
|
19788
|
+
/** The number of days in a month when having 6 weeks. */
|
19789
|
+
const NrOfDaysWithFixedWeeks = 42;
|
19919
19790
|
/** Return all the dates to display in the calendar. */
|
19920
19791
|
function getDates(displayMonths, maxDate, props, dateLib) {
|
19921
19792
|
const firstMonth = displayMonths[0];
|
19922
19793
|
const lastMonth = displayMonths[displayMonths.length - 1];
|
19923
19794
|
const {
|
19924
19795
|
ISOWeek,
|
19925
|
-
fixedWeeks
|
19926
|
-
broadcastCalendar
|
19796
|
+
fixedWeeks
|
19927
19797
|
} = props ?? {};
|
19928
19798
|
const {
|
19799
|
+
startOfWeek,
|
19800
|
+
endOfWeek,
|
19801
|
+
startOfISOWeek,
|
19802
|
+
endOfISOWeek,
|
19929
19803
|
addDays,
|
19930
19804
|
differenceInCalendarDays,
|
19931
19805
|
differenceInCalendarMonths,
|
19932
|
-
endOfBroadcastWeek,
|
19933
|
-
endOfISOWeek,
|
19934
|
-
endOfMonth,
|
19935
|
-
endOfWeek,
|
19936
19806
|
isAfter,
|
19937
|
-
|
19938
|
-
startOfISOWeek,
|
19939
|
-
startOfWeek
|
19807
|
+
endOfMonth
|
19940
19808
|
} = dateLib;
|
19941
|
-
const startWeekFirstDate =
|
19942
|
-
const endWeekLastDate =
|
19809
|
+
const startWeekFirstDate = ISOWeek ? startOfISOWeek(firstMonth) : startOfWeek(firstMonth);
|
19810
|
+
const endWeekLastDate = ISOWeek ? endOfISOWeek(endOfMonth(lastMonth)) : endOfWeek(endOfMonth(lastMonth));
|
19943
19811
|
const nOfDays = differenceInCalendarDays(endWeekLastDate, startWeekFirstDate);
|
19944
19812
|
const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;
|
19945
19813
|
const dates = [];
|
@@ -19951,11 +19819,9 @@ function getDates(displayMonths, maxDate, props, dateLib) {
|
|
19951
19819
|
dates.push(date);
|
19952
19820
|
}
|
19953
19821
|
// If fixed weeks is enabled, add the extra dates to the array
|
19954
|
-
const
|
19955
|
-
const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
|
19822
|
+
const extraDates = NrOfDaysWithFixedWeeks * nOfMonths;
|
19956
19823
|
if (fixedWeeks && dates.length < extraDates) {
|
19957
|
-
|
19958
|
-
for (let i = 0; i < daysToAdd; i++) {
|
19824
|
+
for (let i = 0; i < 7; i++) {
|
19959
19825
|
const date = addDays(dates[dates.length - 1], 1);
|
19960
19826
|
dates.push(date);
|
19961
19827
|
}
|
@@ -20066,29 +19932,25 @@ displayMonths, /** The dates to display in the calendar. */
|
|
20066
19932
|
dates, /** Options from the props context. */
|
20067
19933
|
props, dateLib) {
|
20068
19934
|
const {
|
20069
|
-
|
20070
|
-
|
19935
|
+
startOfWeek,
|
19936
|
+
endOfWeek,
|
19937
|
+
startOfISOWeek,
|
20071
19938
|
endOfISOWeek,
|
20072
19939
|
endOfMonth,
|
20073
|
-
|
20074
|
-
getISOWeek,
|
19940
|
+
addDays,
|
20075
19941
|
getWeek,
|
20076
|
-
|
20077
|
-
startOfISOWeek,
|
20078
|
-
startOfWeek
|
19942
|
+
getISOWeek
|
20079
19943
|
} = dateLib;
|
20080
19944
|
const dayPickerMonths = displayMonths.reduce((months, month) => {
|
20081
|
-
const firstDateOfFirstWeek = props.
|
20082
|
-
const lastDateOfLastWeek = props.
|
19945
|
+
const firstDateOfFirstWeek = props.ISOWeek ? startOfISOWeek(month) : startOfWeek(month);
|
19946
|
+
const lastDateOfLastWeek = props.ISOWeek ? endOfISOWeek(endOfMonth(month)) : endOfWeek(endOfMonth(month));
|
20083
19947
|
/** The dates to display in the month. */
|
20084
19948
|
const monthDates = dates.filter(date => {
|
20085
19949
|
return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
|
20086
19950
|
});
|
20087
|
-
|
20088
|
-
if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
|
19951
|
+
if (props.fixedWeeks && monthDates.length < 42) {
|
20089
19952
|
const extraDates = dates.filter(date => {
|
20090
|
-
|
20091
|
-
return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, daysToAdd);
|
19953
|
+
return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, 7);
|
20092
19954
|
});
|
20093
19955
|
monthDates.push(...extraDates);
|
20094
19956
|
}
|
@@ -20526,30 +20388,27 @@ function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
|
|
20526
20388
|
/** Return the next date that should be focused. */
|
20527
20389
|
function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
|
20528
20390
|
const {
|
20529
|
-
ISOWeek
|
20530
|
-
broadcastCalendar
|
20391
|
+
ISOWeek
|
20531
20392
|
} = props;
|
20532
20393
|
const {
|
20533
20394
|
addDays,
|
20534
20395
|
addMonths,
|
20535
|
-
addWeeks,
|
20536
20396
|
addYears,
|
20537
|
-
|
20397
|
+
addWeeks,
|
20398
|
+
startOfISOWeek,
|
20538
20399
|
endOfISOWeek,
|
20400
|
+
startOfWeek,
|
20539
20401
|
endOfWeek,
|
20540
20402
|
max,
|
20541
|
-
min
|
20542
|
-
startOfBroadcastWeek,
|
20543
|
-
startOfISOWeek,
|
20544
|
-
startOfWeek
|
20403
|
+
min
|
20545
20404
|
} = dateLib;
|
20546
20405
|
const moveFns = {
|
20547
20406
|
day: addDays,
|
20548
20407
|
week: addWeeks,
|
20549
20408
|
month: addMonths,
|
20550
20409
|
year: addYears,
|
20551
|
-
startOfWeek: date =>
|
20552
|
-
endOfWeek: date =>
|
20410
|
+
startOfWeek: date => ISOWeek ? startOfISOWeek(date) : startOfWeek(date),
|
20411
|
+
endOfWeek: date => ISOWeek ? endOfISOWeek(date) : endOfWeek(date)
|
20553
20412
|
};
|
20554
20413
|
let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
|
20555
20414
|
if (moveDir === "before" && navStart) {
|
@@ -20615,8 +20474,6 @@ function useFocus(props, calendar, getModifiers, isSelected, dateLib) {
|
|
20615
20474
|
/**
|
20616
20475
|
* Return a function to get the modifiers for a given day.
|
20617
20476
|
*
|
20618
|
-
* NOTE: this is not an hook, but a factory for `getModifiers`.
|
20619
|
-
*
|
20620
20477
|
* @private
|
20621
20478
|
*/
|
20622
20479
|
function useGetModifiers(days, props, dateLib) {
|
@@ -20625,19 +20482,12 @@ function useGetModifiers(days, props, dateLib) {
|
|
20625
20482
|
hidden,
|
20626
20483
|
modifiers,
|
20627
20484
|
showOutsideDays,
|
20628
|
-
broadcastCalendar,
|
20629
20485
|
today
|
20630
20486
|
} = props;
|
20631
20487
|
const {
|
20632
20488
|
isSameDay,
|
20633
|
-
isSameMonth
|
20634
|
-
startOfMonth,
|
20635
|
-
isBefore,
|
20636
|
-
endOfMonth,
|
20637
|
-
isAfter
|
20489
|
+
isSameMonth
|
20638
20490
|
} = dateLib;
|
20639
|
-
const startMonth = props.startMonth && startOfMonth(props.startMonth);
|
20640
|
-
const endMonth = props.endMonth && endOfMonth(props.endMonth);
|
20641
20491
|
const internalModifiersMap = {
|
20642
20492
|
[DayFlag.focused]: [],
|
20643
20493
|
[DayFlag.outside]: [],
|
@@ -20646,18 +20496,20 @@ function useGetModifiers(days, props, dateLib) {
|
|
20646
20496
|
[DayFlag.today]: []
|
20647
20497
|
};
|
20648
20498
|
const customModifiersMap = {};
|
20499
|
+
const selectionModifiersMap = {
|
20500
|
+
[SelectionState.range_end]: [],
|
20501
|
+
[SelectionState.range_middle]: [],
|
20502
|
+
[SelectionState.range_start]: [],
|
20503
|
+
[SelectionState.selected]: []
|
20504
|
+
};
|
20649
20505
|
for (const day of days) {
|
20650
20506
|
const {
|
20651
20507
|
date,
|
20652
20508
|
displayMonth
|
20653
20509
|
} = day;
|
20654
20510
|
const isOutside = Boolean(displayMonth && !isSameMonth(date, displayMonth));
|
20655
|
-
const isBeforeStartMonth = Boolean(startMonth && isBefore(date, startMonth));
|
20656
|
-
const isAfterEndMonth = Boolean(endMonth && isAfter(date, endMonth));
|
20657
20511
|
const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));
|
20658
|
-
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) ||
|
20659
|
-
// Broadcast calendar will show outside days as default
|
20660
|
-
!broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
|
20512
|
+
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || !showOutsideDays && isOutside;
|
20661
20513
|
const isToday = isSameDay(date, today ?? (props.timeZone ? TZDate.tz(props.timeZone) : dateLib.Date ? new dateLib.Date() : new Date()));
|
20662
20514
|
if (isOutside) internalModifiersMap.outside.push(day);
|
20663
20515
|
if (isDisabled) internalModifiersMap.disabled.push(day);
|
@@ -20686,16 +20538,27 @@ function useGetModifiers(days, props, dateLib) {
|
|
20686
20538
|
[DayFlag.outside]: false,
|
20687
20539
|
[DayFlag.today]: false
|
20688
20540
|
};
|
20541
|
+
const selectionStates = {
|
20542
|
+
[SelectionState.range_end]: false,
|
20543
|
+
[SelectionState.range_middle]: false,
|
20544
|
+
[SelectionState.range_start]: false,
|
20545
|
+
[SelectionState.selected]: false
|
20546
|
+
};
|
20689
20547
|
const customModifiers = {};
|
20690
20548
|
// Find the modifiers for the given day
|
20691
20549
|
for (const name in internalModifiersMap) {
|
20692
20550
|
const days = internalModifiersMap[name];
|
20693
20551
|
dayFlags[name] = days.some(d => d === day);
|
20694
20552
|
}
|
20553
|
+
for (const name in selectionModifiersMap) {
|
20554
|
+
const days = selectionModifiersMap[name];
|
20555
|
+
selectionStates[name] = days.some(d => d === day);
|
20556
|
+
}
|
20695
20557
|
for (const name in customModifiersMap) {
|
20696
20558
|
customModifiers[name] = customModifiersMap[name].some(d => d === day);
|
20697
20559
|
}
|
20698
20560
|
return {
|
20561
|
+
...selectionStates,
|
20699
20562
|
...dayFlags,
|
20700
20563
|
// custom modifiers should override all the previous ones
|
20701
20564
|
...customModifiers
|
@@ -21100,7 +20963,7 @@ function DayPicker(props) {
|
|
21100
20963
|
};
|
21101
20964
|
const dateLib = new DateLib({
|
21102
20965
|
locale,
|
21103
|
-
weekStartsOn: props.
|
20966
|
+
weekStartsOn: props.weekStartsOn,
|
21104
20967
|
firstWeekContainsDate: props.firstWeekContainsDate,
|
21105
20968
|
useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
|
21106
20969
|
useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens
|
@@ -21119,7 +20982,7 @@ function DayPicker(props) {
|
|
21119
20982
|
...props.classNames
|
21120
20983
|
}
|
21121
20984
|
};
|
21122
|
-
}, [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]);
|
21123
20986
|
const {
|
21124
20987
|
captionLayout,
|
21125
20988
|
mode,
|
@@ -21229,16 +21092,6 @@ function DayPicker(props) {
|
|
21229
21092
|
const handleDayMouseLeave = useCallback((day, modifiers) => e => {
|
21230
21093
|
onDayMouseLeave?.(day.date, modifiers, e);
|
21231
21094
|
}, [onDayMouseLeave]);
|
21232
|
-
const handleMonthChange = useCallback(date => e => {
|
21233
|
-
const selectedMonth = Number(e.target.value);
|
21234
|
-
const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
|
21235
|
-
goToMonth(month);
|
21236
|
-
}, [dateLib, goToMonth]);
|
21237
|
-
const handleYearChange = useCallback(date => e => {
|
21238
|
-
const selectedYear = Number(e.target.value);
|
21239
|
-
const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
|
21240
|
-
goToMonth(month);
|
21241
|
-
}, [dateLib, goToMonth]);
|
21242
21095
|
const {
|
21243
21096
|
className,
|
21244
21097
|
style
|
@@ -21276,8 +21129,6 @@ function DayPicker(props) {
|
|
21276
21129
|
lang: props.lang,
|
21277
21130
|
nonce: props.nonce,
|
21278
21131
|
title: props.title,
|
21279
|
-
role: props.role,
|
21280
|
-
"aria-label": props["aria-label"],
|
21281
21132
|
...dataAttributes
|
21282
21133
|
}, /*#__PURE__*/React__default.createElement(components.Months, {
|
21283
21134
|
className: classNames[UI.Months],
|
@@ -21291,8 +21142,17 @@ function DayPicker(props) {
|
|
21291
21142
|
previousMonth: previousMonth,
|
21292
21143
|
nextMonth: nextMonth
|
21293
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
|
+
};
|
21294
21154
|
const dropdownMonths = getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib);
|
21295
|
-
const dropdownYears = getYearOptions(navStart, navEnd, formatters, dateLib);
|
21155
|
+
const dropdownYears = getYearOptions(months[0].date, navStart, navEnd, formatters, dateLib);
|
21296
21156
|
return /*#__PURE__*/React__default.createElement(components.Month, {
|
21297
21157
|
className: classNames[UI.Month],
|
21298
21158
|
style: styles?.[UI.Month],
|
@@ -21313,7 +21173,7 @@ function DayPicker(props) {
|
|
21313
21173
|
classNames: classNames,
|
21314
21174
|
components: components,
|
21315
21175
|
disabled: Boolean(props.disableNavigation),
|
21316
|
-
onChange: handleMonthChange
|
21176
|
+
onChange: handleMonthChange,
|
21317
21177
|
options: dropdownMonths,
|
21318
21178
|
style: styles?.[UI.Dropdown],
|
21319
21179
|
value: calendarMonth.date.getMonth()
|
@@ -21326,7 +21186,7 @@ function DayPicker(props) {
|
|
21326
21186
|
classNames: classNames,
|
21327
21187
|
components: components,
|
21328
21188
|
disabled: Boolean(props.disableNavigation),
|
21329
|
-
onChange: handleYearChange
|
21189
|
+
onChange: handleYearChange,
|
21330
21190
|
options: dropdownYears,
|
21331
21191
|
style: styles?.[UI.Dropdown],
|
21332
21192
|
value: calendarMonth.date.getFullYear()
|
@@ -21373,8 +21233,7 @@ function DayPicker(props) {
|
|
21373
21233
|
locale
|
21374
21234
|
}),
|
21375
21235
|
className: classNames[UI.WeekNumber],
|
21376
|
-
scope: "row"
|
21377
|
-
role: "rowheader"
|
21236
|
+
scope: "row"
|
21378
21237
|
}, formatWeekNumber(week.weekNumber))), week.days.map(day => {
|
21379
21238
|
const {
|
21380
21239
|
date
|
@@ -21394,14 +21253,14 @@ function DayPicker(props) {
|
|
21394
21253
|
}
|
21395
21254
|
const style = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
21396
21255
|
const className = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
21397
|
-
const ariaLabel = !isInteractive
|
21256
|
+
const ariaLabel = !isInteractive ? labelGridcell(date, modifiers, dateLib.options, dateLib) : undefined;
|
21398
21257
|
return /*#__PURE__*/React__default.createElement(components.Day, {
|
21399
21258
|
key: `${dateLib.format(date, "yyyy-MM-dd")}_${dateLib.format(day.displayMonth, "yyyy-MM")}`,
|
21400
21259
|
day: day,
|
21401
21260
|
modifiers: modifiers,
|
21402
21261
|
className: className.join(" "),
|
21403
21262
|
style: style,
|
21404
|
-
|
21263
|
+
"aria-hidden": modifiers.hidden || undefined,
|
21405
21264
|
"aria-selected": modifiers.selected || undefined,
|
21406
21265
|
"aria-label": ariaLabel,
|
21407
21266
|
"data-day": dateLib.format(date, "yyyy-MM-dd"),
|
@@ -21412,7 +21271,7 @@ function DayPicker(props) {
|
|
21412
21271
|
"data-outside": day.outside || undefined,
|
21413
21272
|
"data-focused": modifiers.focused || undefined,
|
21414
21273
|
"data-today": modifiers.today || undefined
|
21415
|
-
},
|
21274
|
+
}, isInteractive ? (/*#__PURE__*/React__default.createElement(components.DayButton, {
|
21416
21275
|
className: classNames[UI.DayButton],
|
21417
21276
|
style: styles?.[UI.DayButton],
|
21418
21277
|
type: "button",
|
@@ -21427,7 +21286,7 @@ function DayPicker(props) {
|
|
21427
21286
|
onKeyDown: handleDayKeyDown(day, modifiers),
|
21428
21287
|
onMouseEnter: handleDayMouseEnter(day, modifiers),
|
21429
21288
|
onMouseLeave: handleDayMouseLeave(day, modifiers)
|
21430
|
-
}, formatDay(date, dateLib.options, dateLib))) :
|
21289
|
+
}, formatDay(date, dateLib.options, dateLib))) : formatDay(day.date, dateLib.options, dateLib));
|
21431
21290
|
}));
|
21432
21291
|
}))));
|
21433
21292
|
})), props.footer && (/*#__PURE__*/React__default.createElement(components.Footer, {
|