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.js
CHANGED
@@ -3950,8 +3950,6 @@ function LiveRegion(_ref) {
|
|
3950
3950
|
// Hide element visually but keep it readable by screen readers
|
3951
3951
|
const visuallyHidden = {
|
3952
3952
|
position: 'fixed',
|
3953
|
-
top: 0,
|
3954
|
-
left: 0,
|
3955
3953
|
width: 1,
|
3956
3954
|
height: 1,
|
3957
3955
|
margin: -1,
|
@@ -4941,12 +4939,11 @@ var KeyboardCode;
|
|
4941
4939
|
KeyboardCode["Up"] = "ArrowUp";
|
4942
4940
|
KeyboardCode["Esc"] = "Escape";
|
4943
4941
|
KeyboardCode["Enter"] = "Enter";
|
4944
|
-
KeyboardCode["Tab"] = "Tab";
|
4945
4942
|
})(KeyboardCode || (KeyboardCode = {}));
|
4946
4943
|
const defaultKeyboardCodes = {
|
4947
4944
|
start: [KeyboardCode.Space, KeyboardCode.Enter],
|
4948
4945
|
cancel: [KeyboardCode.Esc],
|
4949
|
-
end: [KeyboardCode.Space, KeyboardCode.Enter
|
4946
|
+
end: [KeyboardCode.Space, KeyboardCode.Enter]
|
4950
4947
|
};
|
4951
4948
|
const defaultKeyboardCoordinateGetter = (event, _ref) => {
|
4952
4949
|
let {
|
@@ -5245,9 +5242,6 @@ class AbstractPointerSensor {
|
|
5245
5242
|
passive: false
|
5246
5243
|
});
|
5247
5244
|
this.listeners.add(events.end.name, this.handleEnd);
|
5248
|
-
if (events.cancel) {
|
5249
|
-
this.listeners.add(events.cancel.name, this.handleCancel);
|
5250
|
-
}
|
5251
5245
|
this.windowListeners.add(EventName.Resize, this.handleCancel);
|
5252
5246
|
this.windowListeners.add(EventName.DragStart, preventDefault);
|
5253
5247
|
this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
|
@@ -5263,11 +5257,9 @@ class AbstractPointerSensor {
|
|
5263
5257
|
}
|
5264
5258
|
if (isDelayConstraint(activationConstraint)) {
|
5265
5259
|
this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
|
5266
|
-
this.handlePending(activationConstraint);
|
5267
5260
|
return;
|
5268
5261
|
}
|
5269
5262
|
if (isDistanceConstraint(activationConstraint)) {
|
5270
|
-
this.handlePending(activationConstraint);
|
5271
5263
|
return;
|
5272
5264
|
}
|
5273
5265
|
}
|
@@ -5284,13 +5276,6 @@ class AbstractPointerSensor {
|
|
5284
5276
|
this.timeoutId = null;
|
5285
5277
|
}
|
5286
5278
|
}
|
5287
|
-
handlePending(constraint, offset) {
|
5288
|
-
const {
|
5289
|
-
active,
|
5290
|
-
onPending
|
5291
|
-
} = this.props;
|
5292
|
-
onPending(active, constraint, this.initialCoordinates, offset);
|
5293
|
-
}
|
5294
5279
|
handleStart() {
|
5295
5280
|
const {
|
5296
5281
|
initialCoordinates
|
@@ -5344,7 +5329,6 @@ class AbstractPointerSensor {
|
|
5344
5329
|
return this.handleCancel();
|
5345
5330
|
}
|
5346
5331
|
}
|
5347
|
-
this.handlePending(activationConstraint, delta);
|
5348
5332
|
return;
|
5349
5333
|
}
|
5350
5334
|
if (event.cancelable) {
|
@@ -5354,24 +5338,16 @@ class AbstractPointerSensor {
|
|
5354
5338
|
}
|
5355
5339
|
handleEnd() {
|
5356
5340
|
const {
|
5357
|
-
onAbort,
|
5358
5341
|
onEnd
|
5359
5342
|
} = this.props;
|
5360
5343
|
this.detach();
|
5361
|
-
if (!this.activated) {
|
5362
|
-
onAbort(this.props.active);
|
5363
|
-
}
|
5364
5344
|
onEnd();
|
5365
5345
|
}
|
5366
5346
|
handleCancel() {
|
5367
5347
|
const {
|
5368
|
-
onAbort,
|
5369
5348
|
onCancel
|
5370
5349
|
} = this.props;
|
5371
5350
|
this.detach();
|
5372
|
-
if (!this.activated) {
|
5373
|
-
onAbort(this.props.active);
|
5374
|
-
}
|
5375
5351
|
onCancel();
|
5376
5352
|
}
|
5377
5353
|
handleKeydown(event) {
|
@@ -5385,9 +5361,6 @@ class AbstractPointerSensor {
|
|
5385
5361
|
}
|
5386
5362
|
}
|
5387
5363
|
const events = {
|
5388
|
-
cancel: {
|
5389
|
-
name: 'pointercancel'
|
5390
|
-
},
|
5391
5364
|
move: {
|
5392
5365
|
name: 'pointermove'
|
5393
5366
|
},
|
@@ -5460,9 +5433,6 @@ MouseSensor.activators = [{
|
|
5460
5433
|
}
|
5461
5434
|
}];
|
5462
5435
|
const events$2 = {
|
5463
|
-
cancel: {
|
5464
|
-
name: 'touchcancel'
|
5465
|
-
},
|
5466
5436
|
move: {
|
5467
5437
|
name: 'touchmove'
|
5468
5438
|
},
|
@@ -5664,11 +5634,11 @@ function useScrollIntent(_ref2) {
|
|
5664
5634
|
}, [disabled, delta, previousDelta]);
|
5665
5635
|
}
|
5666
5636
|
function useCachedNode(draggableNodes, id) {
|
5667
|
-
const draggableNode = id
|
5637
|
+
const draggableNode = id !== null ? draggableNodes.get(id) : undefined;
|
5668
5638
|
const node = draggableNode ? draggableNode.node.current : null;
|
5669
5639
|
return useLazyMemo(cachedNode => {
|
5670
5640
|
var _ref;
|
5671
|
-
if (id
|
5641
|
+
if (id === null) {
|
5672
5642
|
return null;
|
5673
5643
|
} // In some cases, the draggable node can unmount while dragging
|
5674
5644
|
// This is the case for virtualized lists. In those situations,
|
@@ -5876,26 +5846,7 @@ function useRect(element, measure, fallbackRect) {
|
|
5876
5846
|
if (measure === void 0) {
|
5877
5847
|
measure = defaultMeasure;
|
5878
5848
|
}
|
5879
|
-
const [rect,
|
5880
|
-
function measureRect() {
|
5881
|
-
setRect(currentRect => {
|
5882
|
-
if (!element) {
|
5883
|
-
return null;
|
5884
|
-
}
|
5885
|
-
if (element.isConnected === false) {
|
5886
|
-
var _ref;
|
5887
|
-
|
5888
|
-
// Fall back to last rect we measured if the element is
|
5889
|
-
// no longer connected to the DOM.
|
5890
|
-
return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
|
5891
|
-
}
|
5892
|
-
const newRect = measure(element);
|
5893
|
-
if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
|
5894
|
-
return currentRect;
|
5895
|
-
}
|
5896
|
-
return newRect;
|
5897
|
-
});
|
5898
|
-
}
|
5849
|
+
const [rect, measureRect] = React.useReducer(reducer, null);
|
5899
5850
|
const mutationObserver = useMutationObserver({
|
5900
5851
|
callback(records) {
|
5901
5852
|
if (!element) {
|
@@ -5930,6 +5881,23 @@ function useRect(element, measure, fallbackRect) {
|
|
5930
5881
|
}
|
5931
5882
|
}, [element]);
|
5932
5883
|
return rect;
|
5884
|
+
function reducer(currentRect) {
|
5885
|
+
if (!element) {
|
5886
|
+
return null;
|
5887
|
+
}
|
5888
|
+
if (element.isConnected === false) {
|
5889
|
+
var _ref;
|
5890
|
+
|
5891
|
+
// Fall back to last rect we measured if the element is
|
5892
|
+
// no longer connected to the DOM.
|
5893
|
+
return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
|
5894
|
+
}
|
5895
|
+
const newRect = measure(element);
|
5896
|
+
if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
|
5897
|
+
return currentRect;
|
5898
|
+
}
|
5899
|
+
return newRect;
|
5900
|
+
}
|
5933
5901
|
}
|
5934
5902
|
function useRectDelta(rect) {
|
5935
5903
|
const initialRect = useInitialValue(rect);
|
@@ -6075,24 +6043,28 @@ function useRects(elements, measure) {
|
|
6075
6043
|
}
|
6076
6044
|
const [firstElement] = elements;
|
6077
6045
|
const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
|
6078
|
-
const [rects,
|
6079
|
-
function measureRects() {
|
6080
|
-
setRects(() => {
|
6081
|
-
if (!elements.length) {
|
6082
|
-
return defaultValue$2;
|
6083
|
-
}
|
6084
|
-
return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
|
6085
|
-
});
|
6086
|
-
}
|
6046
|
+
const [rects, measureRects] = React.useReducer(reducer, defaultValue$2);
|
6087
6047
|
const resizeObserver = useResizeObserver({
|
6088
6048
|
callback: measureRects
|
6089
6049
|
});
|
6090
|
-
|
6091
|
-
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
6050
|
+
if (elements.length > 0 && rects === defaultValue$2) {
|
6092
6051
|
measureRects();
|
6093
|
-
|
6052
|
+
}
|
6053
|
+
useIsomorphicLayoutEffect$1(() => {
|
6054
|
+
if (elements.length) {
|
6055
|
+
elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
6056
|
+
} else {
|
6057
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
6058
|
+
measureRects();
|
6059
|
+
}
|
6094
6060
|
}, [elements]);
|
6095
6061
|
return rects;
|
6062
|
+
function reducer() {
|
6063
|
+
if (!elements.length) {
|
6064
|
+
return defaultValue$2;
|
6065
|
+
}
|
6066
|
+
return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
|
6067
|
+
}
|
6096
6068
|
}
|
6097
6069
|
function getMeasurableNode(node) {
|
6098
6070
|
if (!node) {
|
@@ -6259,7 +6231,7 @@ function reducer$1(state, action) {
|
|
6259
6231
|
}
|
6260
6232
|
};
|
6261
6233
|
case Action.DragMove:
|
6262
|
-
if (state.draggable.active
|
6234
|
+
if (!state.draggable.active) {
|
6263
6235
|
return state;
|
6264
6236
|
}
|
6265
6237
|
return {
|
@@ -6531,7 +6503,7 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6531
6503
|
containers: droppableContainers
|
6532
6504
|
}
|
6533
6505
|
} = state;
|
6534
|
-
const node = activeId
|
6506
|
+
const node = activeId ? draggableNodes.get(activeId) : null;
|
6535
6507
|
const activeRects = React.useRef({
|
6536
6508
|
initial: null,
|
6537
6509
|
translated: null
|
@@ -6566,7 +6538,7 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6566
6538
|
const autoScrollOptions = getAutoScrollerOptions();
|
6567
6539
|
const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
|
6568
6540
|
useLayoutShiftScrollCompensation({
|
6569
|
-
activeNode: activeId
|
6541
|
+
activeNode: activeId ? draggableNodes.get(activeId) : null,
|
6570
6542
|
config: autoScrollOptions.layoutShiftCompensation,
|
6571
6543
|
initialRect: initialActiveNodeRect,
|
6572
6544
|
measure: measuringConfiguration.draggable.measure
|
@@ -6644,7 +6616,6 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6644
6616
|
|
6645
6617
|
const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
|
6646
6618
|
const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
|
6647
|
-
const activeSensorRef = React.useRef(null);
|
6648
6619
|
const instantiateSensor = React.useCallback((event, _ref2) => {
|
6649
6620
|
let {
|
6650
6621
|
sensor: Sensor,
|
@@ -6666,43 +6637,6 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6666
6637
|
// Sensors need to be instantiated with refs for arguments that change over time
|
6667
6638
|
// otherwise they are frozen in time with the stale arguments
|
6668
6639
|
context: sensorContext,
|
6669
|
-
onAbort(id) {
|
6670
|
-
const draggableNode = draggableNodes.get(id);
|
6671
|
-
if (!draggableNode) {
|
6672
|
-
return;
|
6673
|
-
}
|
6674
|
-
const {
|
6675
|
-
onDragAbort
|
6676
|
-
} = latestProps.current;
|
6677
|
-
const event = {
|
6678
|
-
id
|
6679
|
-
};
|
6680
|
-
onDragAbort == null ? void 0 : onDragAbort(event);
|
6681
|
-
dispatchMonitorEvent({
|
6682
|
-
type: 'onDragAbort',
|
6683
|
-
event
|
6684
|
-
});
|
6685
|
-
},
|
6686
|
-
onPending(id, constraint, initialCoordinates, offset) {
|
6687
|
-
const draggableNode = draggableNodes.get(id);
|
6688
|
-
if (!draggableNode) {
|
6689
|
-
return;
|
6690
|
-
}
|
6691
|
-
const {
|
6692
|
-
onDragPending
|
6693
|
-
} = latestProps.current;
|
6694
|
-
const event = {
|
6695
|
-
id,
|
6696
|
-
constraint,
|
6697
|
-
initialCoordinates,
|
6698
|
-
offset
|
6699
|
-
};
|
6700
|
-
onDragPending == null ? void 0 : onDragPending(event);
|
6701
|
-
dispatchMonitorEvent({
|
6702
|
-
type: 'onDragPending',
|
6703
|
-
event
|
6704
|
-
});
|
6705
|
-
},
|
6706
6640
|
onStart(initialCoordinates) {
|
6707
6641
|
const id = activeRef.current;
|
6708
6642
|
if (id == null) {
|
@@ -6716,7 +6650,6 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6716
6650
|
onDragStart
|
6717
6651
|
} = latestProps.current;
|
6718
6652
|
const event = {
|
6719
|
-
activatorEvent,
|
6720
6653
|
active: {
|
6721
6654
|
id,
|
6722
6655
|
data: draggableNode.data,
|
@@ -6735,8 +6668,6 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6735
6668
|
type: 'onDragStart',
|
6736
6669
|
event
|
6737
6670
|
});
|
6738
|
-
setActiveSensor(activeSensorRef.current);
|
6739
|
-
setActivatorEvent(activatorEvent);
|
6740
6671
|
});
|
6741
6672
|
},
|
6742
6673
|
onMove(coordinates) {
|
@@ -6748,7 +6679,10 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6748
6679
|
onEnd: createHandler(Action.DragEnd),
|
6749
6680
|
onCancel: createHandler(Action.DragCancel)
|
6750
6681
|
});
|
6751
|
-
|
6682
|
+
ReactDOM.unstable_batchedUpdates(() => {
|
6683
|
+
setActiveSensor(sensorInstance);
|
6684
|
+
setActivatorEvent(event.nativeEvent);
|
6685
|
+
});
|
6752
6686
|
function createHandler(type) {
|
6753
6687
|
return async function handler() {
|
6754
6688
|
const {
|
@@ -6785,7 +6719,6 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
6785
6719
|
setOver(null);
|
6786
6720
|
setActiveSensor(null);
|
6787
6721
|
setActivatorEvent(null);
|
6788
|
-
activeSensorRef.current = null;
|
6789
6722
|
const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';
|
6790
6723
|
if (event) {
|
6791
6724
|
const handler = latestProps.current[eventName];
|
@@ -7007,7 +6940,7 @@ const DndContext = /*#__PURE__*/React.memo(function DndContext(_ref) {
|
|
7007
6940
|
});
|
7008
6941
|
const NullContext = /*#__PURE__*/React.createContext(null);
|
7009
6942
|
const defaultRole = 'button';
|
7010
|
-
const ID_PREFIX$1 = '
|
6943
|
+
const ID_PREFIX$1 = 'Droppable';
|
7011
6944
|
function useDraggable(_ref) {
|
7012
6945
|
let {
|
7013
6946
|
id,
|
@@ -7154,7 +7087,7 @@ function useDroppable(_ref) {
|
|
7154
7087
|
resizeObserverConnected.current = false;
|
7155
7088
|
resizeObserver.observe(nodeRef.current);
|
7156
7089
|
}, [nodeRef, resizeObserver]);
|
7157
|
-
|
7090
|
+
useIsomorphicLayoutEffect$1(() => {
|
7158
7091
|
dispatch({
|
7159
7092
|
type: Action.RegisterDroppable,
|
7160
7093
|
element: {
|
@@ -7569,7 +7502,6 @@ var DNDCore = /*#__PURE__*/Object.freeze({
|
|
7569
7502
|
defaultCoordinates: defaultCoordinates,
|
7570
7503
|
defaultDropAnimation: defaultDropAnimationConfiguration,
|
7571
7504
|
defaultDropAnimationSideEffects: defaultDropAnimationSideEffects,
|
7572
|
-
defaultKeyboardCoordinateGetter: defaultKeyboardCoordinateGetter,
|
7573
7505
|
defaultScreenReaderInstructions: defaultScreenReaderInstructions,
|
7574
7506
|
getClientRect: getClientRect,
|
7575
7507
|
getFirstCollision: getFirstCollision,
|
@@ -11350,14 +11282,13 @@ var isWeb = typeof window !== 'undefined' &&
|
|
11350
11282
|
function cloneObject(data) {
|
11351
11283
|
let copy;
|
11352
11284
|
const isArray = Array.isArray(data);
|
11353
|
-
const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
|
11354
11285
|
if (data instanceof Date) {
|
11355
11286
|
copy = new Date(data);
|
11356
11287
|
}
|
11357
11288
|
else if (data instanceof Set) {
|
11358
11289
|
copy = new Set(data);
|
11359
11290
|
}
|
11360
|
-
else if (!(isWeb && (data instanceof Blob ||
|
11291
|
+
else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
|
11361
11292
|
(isArray || isObject$2(data))) {
|
11362
11293
|
copy = isArray ? [] : {};
|
11363
11294
|
if (!isArray && !isPlainObject(data)) {
|
@@ -11416,7 +11347,7 @@ var set$1 = (object, path, value) => {
|
|
11416
11347
|
? []
|
11417
11348
|
: {};
|
11418
11349
|
}
|
11419
|
-
if (key === '__proto__'
|
11350
|
+
if (key === '__proto__') {
|
11420
11351
|
return;
|
11421
11352
|
}
|
11422
11353
|
object[key] = newValue;
|
@@ -11635,7 +11566,7 @@ function useFormState(props) {
|
|
11635
11566
|
_mounted.current = false;
|
11636
11567
|
};
|
11637
11568
|
}, [control]);
|
11638
|
-
return
|
11569
|
+
return getProxyFormState(formState, control, _localProxyFormState.current, false);
|
11639
11570
|
}
|
11640
11571
|
|
11641
11572
|
var isString = (value) => typeof value === 'string';
|
@@ -11731,67 +11662,6 @@ function useController(props) {
|
|
11731
11662
|
value,
|
11732
11663
|
...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
|
11733
11664
|
}));
|
11734
|
-
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
11735
|
-
invalid: {
|
11736
|
-
enumerable: true,
|
11737
|
-
get: () => !!get$1(formState.errors, name),
|
11738
|
-
},
|
11739
|
-
isDirty: {
|
11740
|
-
enumerable: true,
|
11741
|
-
get: () => !!get$1(formState.dirtyFields, name),
|
11742
|
-
},
|
11743
|
-
isTouched: {
|
11744
|
-
enumerable: true,
|
11745
|
-
get: () => !!get$1(formState.touchedFields, name),
|
11746
|
-
},
|
11747
|
-
isValidating: {
|
11748
|
-
enumerable: true,
|
11749
|
-
get: () => !!get$1(formState.validatingFields, name),
|
11750
|
-
},
|
11751
|
-
error: {
|
11752
|
-
enumerable: true,
|
11753
|
-
get: () => get$1(formState.errors, name),
|
11754
|
-
},
|
11755
|
-
}), [formState, name]);
|
11756
|
-
const field = React.useMemo(() => ({
|
11757
|
-
name,
|
11758
|
-
value,
|
11759
|
-
...(isBoolean(disabled) || formState.disabled
|
11760
|
-
? { disabled: formState.disabled || disabled }
|
11761
|
-
: {}),
|
11762
|
-
onChange: (event) => _registerProps.current.onChange({
|
11763
|
-
target: {
|
11764
|
-
value: getEventValue(event),
|
11765
|
-
name: name,
|
11766
|
-
},
|
11767
|
-
type: EVENTS.CHANGE,
|
11768
|
-
}),
|
11769
|
-
onBlur: () => _registerProps.current.onBlur({
|
11770
|
-
target: {
|
11771
|
-
value: get$1(control._formValues, name),
|
11772
|
-
name: name,
|
11773
|
-
},
|
11774
|
-
type: EVENTS.BLUR,
|
11775
|
-
}),
|
11776
|
-
ref: (elm) => {
|
11777
|
-
const field = get$1(control._fields, name);
|
11778
|
-
if (field && elm) {
|
11779
|
-
field._f.ref = {
|
11780
|
-
focus: () => elm.focus(),
|
11781
|
-
select: () => elm.select(),
|
11782
|
-
setCustomValidity: (message) => elm.setCustomValidity(message),
|
11783
|
-
reportValidity: () => elm.reportValidity(),
|
11784
|
-
};
|
11785
|
-
}
|
11786
|
-
},
|
11787
|
-
}), [
|
11788
|
-
name,
|
11789
|
-
control._formValues,
|
11790
|
-
disabled,
|
11791
|
-
formState.disabled,
|
11792
|
-
value,
|
11793
|
-
control._fields,
|
11794
|
-
]);
|
11795
11665
|
React.useEffect(() => {
|
11796
11666
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
11797
11667
|
const updateMounted = (name, value) => {
|
@@ -11817,7 +11687,7 @@ function useController(props) {
|
|
11817
11687
|
};
|
11818
11688
|
}, [name, control, isArrayField, shouldUnregister]);
|
11819
11689
|
React.useEffect(() => {
|
11820
|
-
if (
|
11690
|
+
if (get$1(control._fields, name)) {
|
11821
11691
|
control._updateDisabledField({
|
11822
11692
|
disabled,
|
11823
11693
|
fields: control._fields,
|
@@ -11826,11 +11696,63 @@ function useController(props) {
|
|
11826
11696
|
});
|
11827
11697
|
}
|
11828
11698
|
}, [disabled, name, control]);
|
11829
|
-
return
|
11830
|
-
field
|
11699
|
+
return {
|
11700
|
+
field: {
|
11701
|
+
name,
|
11702
|
+
value,
|
11703
|
+
...(isBoolean(disabled) || formState.disabled
|
11704
|
+
? { disabled: formState.disabled || disabled }
|
11705
|
+
: {}),
|
11706
|
+
onChange: React.useCallback((event) => _registerProps.current.onChange({
|
11707
|
+
target: {
|
11708
|
+
value: getEventValue(event),
|
11709
|
+
name: name,
|
11710
|
+
},
|
11711
|
+
type: EVENTS.CHANGE,
|
11712
|
+
}), [name]),
|
11713
|
+
onBlur: React.useCallback(() => _registerProps.current.onBlur({
|
11714
|
+
target: {
|
11715
|
+
value: get$1(control._formValues, name),
|
11716
|
+
name: name,
|
11717
|
+
},
|
11718
|
+
type: EVENTS.BLUR,
|
11719
|
+
}), [name, control]),
|
11720
|
+
ref: React.useCallback((elm) => {
|
11721
|
+
const field = get$1(control._fields, name);
|
11722
|
+
if (field && elm) {
|
11723
|
+
field._f.ref = {
|
11724
|
+
focus: () => elm.focus(),
|
11725
|
+
select: () => elm.select(),
|
11726
|
+
setCustomValidity: (message) => elm.setCustomValidity(message),
|
11727
|
+
reportValidity: () => elm.reportValidity(),
|
11728
|
+
};
|
11729
|
+
}
|
11730
|
+
}, [control._fields, name]),
|
11731
|
+
},
|
11831
11732
|
formState,
|
11832
|
-
fieldState,
|
11833
|
-
|
11733
|
+
fieldState: Object.defineProperties({}, {
|
11734
|
+
invalid: {
|
11735
|
+
enumerable: true,
|
11736
|
+
get: () => !!get$1(formState.errors, name),
|
11737
|
+
},
|
11738
|
+
isDirty: {
|
11739
|
+
enumerable: true,
|
11740
|
+
get: () => !!get$1(formState.dirtyFields, name),
|
11741
|
+
},
|
11742
|
+
isTouched: {
|
11743
|
+
enumerable: true,
|
11744
|
+
get: () => !!get$1(formState.touchedFields, name),
|
11745
|
+
},
|
11746
|
+
isValidating: {
|
11747
|
+
enumerable: true,
|
11748
|
+
get: () => !!get$1(formState.validatingFields, name),
|
11749
|
+
},
|
11750
|
+
error: {
|
11751
|
+
enumerable: true,
|
11752
|
+
get: () => get$1(formState.errors, name),
|
11753
|
+
},
|
11754
|
+
}),
|
11755
|
+
};
|
11834
11756
|
}
|
11835
11757
|
|
11836
11758
|
/**
|
@@ -11880,7 +11802,7 @@ const Controller = (props) => props.render(useController(props));
|
|
11880
11802
|
const flatten = (obj) => {
|
11881
11803
|
const output = {};
|
11882
11804
|
for (const key of Object.keys(obj)) {
|
11883
|
-
if (isObjectType(obj[key])
|
11805
|
+
if (isObjectType(obj[key])) {
|
11884
11806
|
const nested = flatten(obj[key]);
|
11885
11807
|
for (const nestedKey of Object.keys(nested)) {
|
11886
11808
|
output[`${key}.${nestedKey}`] = nested[nestedKey];
|
@@ -11949,7 +11871,7 @@ function Form(props) {
|
|
11949
11871
|
headers && headers['Content-Type'],
|
11950
11872
|
encType,
|
11951
11873
|
].some((value) => value && value.includes('json'));
|
11952
|
-
const response = await fetch(
|
11874
|
+
const response = await fetch(action, {
|
11953
11875
|
method,
|
11954
11876
|
headers: {
|
11955
11877
|
...headers,
|
@@ -12447,7 +12369,7 @@ var updateAt = (fieldValues, index, value) => {
|
|
12447
12369
|
*/
|
12448
12370
|
function useFieldArray(props) {
|
12449
12371
|
const methods = useFormContext();
|
12450
|
-
const { control = methods.control, name, keyName = 'id', shouldUnregister,
|
12372
|
+
const { control = methods.control, name, keyName = 'id', shouldUnregister, } = props;
|
12451
12373
|
const [fields, setFields] = React.useState(control._getFieldArray(name));
|
12452
12374
|
const ids = React.useRef(control._getFieldArray(name).map(generateId));
|
12453
12375
|
const _fieldIds = React.useRef(fields);
|
@@ -12456,8 +12378,8 @@ function useFieldArray(props) {
|
|
12456
12378
|
_name.current = name;
|
12457
12379
|
_fieldIds.current = fields;
|
12458
12380
|
control._names.array.add(name);
|
12459
|
-
rules &&
|
12460
|
-
control.register(name, rules);
|
12381
|
+
props.rules &&
|
12382
|
+
control.register(name, props.rules);
|
12461
12383
|
useSubscribe({
|
12462
12384
|
next: ({ values, name: fieldArrayName, }) => {
|
12463
12385
|
if (fieldArrayName === _name.current || !fieldArrayName) {
|
@@ -12501,8 +12423,6 @@ function useFieldArray(props) {
|
|
12501
12423
|
ids.current = removeArrayAt(ids.current, index);
|
12502
12424
|
updateValues(updatedFieldArrayValues);
|
12503
12425
|
setFields(updatedFieldArrayValues);
|
12504
|
-
!Array.isArray(get$1(control._fields, name)) &&
|
12505
|
-
set$1(control._fields, name, undefined);
|
12506
12426
|
control._updateFieldArray(name, updatedFieldArrayValues, removeArrayAt, {
|
12507
12427
|
argA: index,
|
12508
12428
|
});
|
@@ -12817,8 +12737,7 @@ var getRuleValue = (rule) => isUndefined(rule)
|
|
12817
12737
|
: rule;
|
12818
12738
|
|
12819
12739
|
const ASYNC_FUNCTION = 'AsyncFunction';
|
12820
|
-
var hasPromiseValidation = (fieldReference) =>
|
12821
|
-
!!fieldReference.validate &&
|
12740
|
+
var hasPromiseValidation = (fieldReference) => (!fieldReference || !fieldReference.validate) &&
|
12822
12741
|
!!((isFunction$1(fieldReference.validate) &&
|
12823
12742
|
fieldReference.validate.constructor.name === ASYNC_FUNCTION) ||
|
12824
12743
|
(isObject$2(fieldReference.validate) &&
|
@@ -12947,7 +12866,7 @@ function createFormControl(props = {}) {
|
|
12947
12866
|
timer = setTimeout(callback, wait);
|
12948
12867
|
};
|
12949
12868
|
const _updateValid = async (shouldUpdateValid) => {
|
12950
|
-
if (!
|
12869
|
+
if (!props.disabled && (_proxyFormState.isValid || shouldUpdateValid)) {
|
12951
12870
|
const isValid = _options.resolver
|
12952
12871
|
? isEmptyObject((await _executeSchema()).errors)
|
12953
12872
|
: await executeBuiltInValidation(_fields, true);
|
@@ -12959,7 +12878,7 @@ function createFormControl(props = {}) {
|
|
12959
12878
|
}
|
12960
12879
|
};
|
12961
12880
|
const _updateIsValidating = (names, isValidating) => {
|
12962
|
-
if (!
|
12881
|
+
if (!props.disabled &&
|
12963
12882
|
(_proxyFormState.isValidating || _proxyFormState.validatingFields)) {
|
12964
12883
|
(names || Array.from(_names.mount)).forEach((name) => {
|
12965
12884
|
if (name) {
|
@@ -12975,7 +12894,7 @@ function createFormControl(props = {}) {
|
|
12975
12894
|
}
|
12976
12895
|
};
|
12977
12896
|
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
12978
|
-
if (args && method && !
|
12897
|
+
if (args && method && !props.disabled) {
|
12979
12898
|
_state.action = true;
|
12980
12899
|
if (shouldUpdateFieldsAndState && Array.isArray(get$1(_fields, name))) {
|
12981
12900
|
const fieldValues = method(get$1(_fields, name), args.argA, args.argB);
|
@@ -13039,7 +12958,7 @@ function createFormControl(props = {}) {
|
|
13039
12958
|
const output = {
|
13040
12959
|
name,
|
13041
12960
|
};
|
13042
|
-
if (!
|
12961
|
+
if (!props.disabled) {
|
13043
12962
|
const disabledField = !!(get$1(_fields, name) &&
|
13044
12963
|
get$1(_fields, name)._f &&
|
13045
12964
|
get$1(_fields, name)._f.disabled);
|
@@ -13080,9 +12999,9 @@ function createFormControl(props = {}) {
|
|
13080
12999
|
const shouldUpdateValid = _proxyFormState.isValid &&
|
13081
13000
|
isBoolean(isValid) &&
|
13082
13001
|
_formState.isValid !== isValid;
|
13083
|
-
if (
|
13002
|
+
if (props.delayError && error) {
|
13084
13003
|
delayErrorCallback = debounce(() => updateErrors(name, error));
|
13085
|
-
delayErrorCallback(
|
13004
|
+
delayErrorCallback(props.delayError);
|
13086
13005
|
}
|
13087
13006
|
else {
|
13088
13007
|
clearTimeout(timer);
|
@@ -13175,7 +13094,7 @@ function createFormControl(props = {}) {
|
|
13175
13094
|
}
|
13176
13095
|
_names.unMount = new Set();
|
13177
13096
|
};
|
13178
|
-
const _getDirty = (name, data) => !
|
13097
|
+
const _getDirty = (name, data) => !props.disabled &&
|
13179
13098
|
(name && data && set$1(_formValues, name, data),
|
13180
13099
|
!deepEqual(getValues(), _defaultValues));
|
13181
13100
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
@@ -13187,7 +13106,7 @@ function createFormControl(props = {}) {
|
|
13187
13106
|
? { [names]: defaultValue }
|
13188
13107
|
: defaultValue),
|
13189
13108
|
}, isGlobal, defaultValue);
|
13190
|
-
const _getFieldArray = (name) => compact(get$1(_state.mount ? _formValues : _defaultValues, name,
|
13109
|
+
const _getFieldArray = (name) => compact(get$1(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get$1(_defaultValues, name, []) : []));
|
13191
13110
|
const setFieldValue = (name, value, options = {}) => {
|
13192
13111
|
const field = get$1(_fields, name);
|
13193
13112
|
let fieldValue = value;
|
@@ -13320,7 +13239,7 @@ function createFormControl(props = {}) {
|
|
13320
13239
|
});
|
13321
13240
|
if (shouldSkipValidation) {
|
13322
13241
|
if (_proxyFormState.isValid) {
|
13323
|
-
if (
|
13242
|
+
if (props.mode === 'onBlur') {
|
13324
13243
|
if (isBlurEvent) {
|
13325
13244
|
_updateValid();
|
13326
13245
|
}
|
@@ -13485,15 +13404,13 @@ function createFormControl(props = {}) {
|
|
13485
13404
|
: isUndefined(value)
|
13486
13405
|
? getFieldValue(field ? field._f : get$1(fields, name)._f)
|
13487
13406
|
: value;
|
13488
|
-
|
13489
|
-
set$1(_formValues, name, inputValue);
|
13490
|
-
}
|
13407
|
+
set$1(_formValues, name, inputValue);
|
13491
13408
|
updateTouchAndDirty(name, inputValue, false, false, true);
|
13492
13409
|
}
|
13493
13410
|
};
|
13494
13411
|
const register = (name, options = {}) => {
|
13495
13412
|
let field = get$1(_fields, name);
|
13496
|
-
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(
|
13413
|
+
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(props.disabled);
|
13497
13414
|
set$1(_fields, name, {
|
13498
13415
|
...(field || {}),
|
13499
13416
|
_f: {
|
@@ -13509,7 +13426,7 @@ function createFormControl(props = {}) {
|
|
13509
13426
|
field,
|
13510
13427
|
disabled: isBoolean(options.disabled)
|
13511
13428
|
? options.disabled
|
13512
|
-
:
|
13429
|
+
: props.disabled,
|
13513
13430
|
name,
|
13514
13431
|
value: options.value,
|
13515
13432
|
});
|
@@ -13519,7 +13436,7 @@ function createFormControl(props = {}) {
|
|
13519
13436
|
}
|
13520
13437
|
return {
|
13521
13438
|
...(disabledIsDefined
|
13522
|
-
? { disabled: options.disabled ||
|
13439
|
+
? { disabled: options.disabled || props.disabled }
|
13523
13440
|
: {}),
|
13524
13441
|
...(_options.progressive
|
13525
13442
|
? {
|
@@ -13603,12 +13520,6 @@ function createFormControl(props = {}) {
|
|
13603
13520
|
e.preventDefault && e.preventDefault();
|
13604
13521
|
e.persist && e.persist();
|
13605
13522
|
}
|
13606
|
-
if (_options.disabled) {
|
13607
|
-
if (onInvalid) {
|
13608
|
-
await onInvalid({ ..._formState.errors }, e);
|
13609
|
-
}
|
13610
|
-
return;
|
13611
|
-
}
|
13612
13523
|
let fieldValues = cloneObject(_formValues);
|
13613
13524
|
_subjects.state.next({
|
13614
13525
|
isSubmitting: true,
|
@@ -13716,7 +13627,7 @@ function createFormControl(props = {}) {
|
|
13716
13627
|
}
|
13717
13628
|
_fields = {};
|
13718
13629
|
}
|
13719
|
-
_formValues =
|
13630
|
+
_formValues = props.shouldUnregister
|
13720
13631
|
? keepStateOptions.keepDefaultValues
|
13721
13632
|
? cloneObject(_defaultValues)
|
13722
13633
|
: {}
|
@@ -13740,7 +13651,7 @@ function createFormControl(props = {}) {
|
|
13740
13651
|
!_proxyFormState.isValid ||
|
13741
13652
|
!!keepStateOptions.keepIsValid ||
|
13742
13653
|
!!keepStateOptions.keepDirtyValues;
|
13743
|
-
_state.watch = !!
|
13654
|
+
_state.watch = !!props.shouldUnregister;
|
13744
13655
|
_subjects.state.next({
|
13745
13656
|
submitCount: keepStateOptions.keepSubmitCount
|
13746
13657
|
? _formState.submitCount
|
@@ -13787,9 +13698,7 @@ function createFormControl(props = {}) {
|
|
13787
13698
|
: fieldReference.ref;
|
13788
13699
|
if (fieldRef.focus) {
|
13789
13700
|
fieldRef.focus();
|
13790
|
-
options.shouldSelect &&
|
13791
|
-
isFunction$1(fieldRef.select) &&
|
13792
|
-
fieldRef.select();
|
13701
|
+
options.shouldSelect && fieldRef.select();
|
13793
13702
|
}
|
13794
13703
|
}
|
13795
13704
|
};
|
@@ -13911,8 +13820,8 @@ function createFormControl(props = {}) {
|
|
13911
13820
|
* ```
|
13912
13821
|
*/
|
13913
13822
|
function useForm(props = {}) {
|
13914
|
-
const _formControl = React.useRef(
|
13915
|
-
const _values = React.useRef(
|
13823
|
+
const _formControl = React.useRef();
|
13824
|
+
const _values = React.useRef();
|
13916
13825
|
const [formState, updateFormState] = React.useState({
|
13917
13826
|
isDirty: false,
|
13918
13827
|
isValidating: false,
|
@@ -13990,6 +13899,11 @@ function useForm(props = {}) {
|
|
13990
13899
|
values: control._getWatch(),
|
13991
13900
|
});
|
13992
13901
|
}, [props.shouldUnregister, control]);
|
13902
|
+
React.useEffect(() => {
|
13903
|
+
if (_formControl.current) {
|
13904
|
+
_formControl.current.watch = _formControl.current.watch.bind({});
|
13905
|
+
}
|
13906
|
+
}, [formState]);
|
13993
13907
|
_formControl.current.formState = getProxyFormState(formState, control);
|
13994
13908
|
return _formControl.current;
|
13995
13909
|
}
|
@@ -14057,6 +13971,9 @@ const InputWithDropdown = /*#__PURE__*/React.forwardRef(({
|
|
14057
13971
|
onDropdownChangeHandler = () => {},
|
14058
13972
|
onInputChangeHandler,
|
14059
13973
|
onInputBlurHandler,
|
13974
|
+
onClick,
|
13975
|
+
onKeyUp,
|
13976
|
+
onFocus,
|
14060
13977
|
optionsRequired = true,
|
14061
13978
|
dropdownPosition = 'right',
|
14062
13979
|
type = 'text'
|
@@ -14118,6 +14035,9 @@ const InputWithDropdown = /*#__PURE__*/React.forwardRef(({
|
|
14118
14035
|
autoComplete: autoComplete,
|
14119
14036
|
required: required,
|
14120
14037
|
disabled: disabled,
|
14038
|
+
onClick: onClick,
|
14039
|
+
onKeyUp: onKeyUp,
|
14040
|
+
onFocus: onFocus,
|
14121
14041
|
className: classNames('ff-floating-input', {
|
14122
14042
|
'ff-floating-input--filled': isValueFilled,
|
14123
14043
|
'ff-floating-input--disabled': !!disabled,
|
@@ -14468,6 +14388,7 @@ const AddModule = ({
|
|
14468
14388
|
error,
|
14469
14389
|
value = ''
|
14470
14390
|
}) => {
|
14391
|
+
console.log('🚀 ~ value:', value);
|
14471
14392
|
const [text, setText] = React.useState(value);
|
14472
14393
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
14473
14394
|
children: [jsxRuntime.jsxs("div", {
|
@@ -14475,7 +14396,8 @@ const AddModule = ({
|
|
14475
14396
|
children: [jsxRuntime.jsx("input", {
|
14476
14397
|
type: "text",
|
14477
14398
|
className: "add-module-input",
|
14478
|
-
onChange: e => setText(e.target.value)
|
14399
|
+
onChange: e => setText(e.target.value),
|
14400
|
+
value: text
|
14479
14401
|
}), jsxRuntime.jsx(Icon, {
|
14480
14402
|
className: "icons",
|
14481
14403
|
name: "update_icon",
|
@@ -14485,7 +14407,9 @@ const AddModule = ({
|
|
14485
14407
|
name: "close",
|
14486
14408
|
onClick: onCancel
|
14487
14409
|
})]
|
14488
|
-
}),
|
14410
|
+
}), jsxRuntime.jsx("small", {
|
14411
|
+
children: error
|
14412
|
+
})]
|
14489
14413
|
});
|
14490
14414
|
};
|
14491
14415
|
|
@@ -14542,7 +14466,8 @@ const TableCell = /*#__PURE__*/React.memo(({
|
|
14542
14466
|
}), node.isNewNode && col.isTree ? jsxRuntime.jsx(AddModule, {
|
14543
14467
|
onCancel: onAddCancel,
|
14544
14468
|
onConfirm: onAddConfirm,
|
14545
|
-
error: node?.error || ''
|
14469
|
+
error: node?.error || '',
|
14470
|
+
value: node.value
|
14546
14471
|
}) : jsxRuntime.jsx("span", {
|
14547
14472
|
className: "tree-table-td-content-text",
|
14548
14473
|
children: prepareData(node, col)
|
@@ -14585,7 +14510,9 @@ const TableRow = /*#__PURE__*/React.memo(({
|
|
14585
14510
|
const addNewRow = (treeData, newNode) => {
|
14586
14511
|
const {
|
14587
14512
|
sourceId,
|
14588
|
-
action
|
14513
|
+
action,
|
14514
|
+
value = '',
|
14515
|
+
error = ''
|
14589
14516
|
} = newNode;
|
14590
14517
|
if (!sourceId || !action) return treeData;
|
14591
14518
|
const nodeMap = new Map(treeData.map(node => [node.key, node]));
|
@@ -14597,7 +14524,9 @@ const addNewRow = (treeData, newNode) => {
|
|
14597
14524
|
hierarchy: sourceNode.hierarchy,
|
14598
14525
|
sourceId: sourceNode.key,
|
14599
14526
|
isNewNode: true,
|
14600
|
-
key: 'new-node'
|
14527
|
+
key: 'new-node',
|
14528
|
+
value,
|
14529
|
+
error
|
14601
14530
|
};
|
14602
14531
|
switch (action) {
|
14603
14532
|
case 'addAbove':
|
@@ -14663,7 +14592,11 @@ const TreeTable = ({
|
|
14663
14592
|
loadMore = () => {},
|
14664
14593
|
tableBorder,
|
14665
14594
|
height = 'auto',
|
14666
|
-
newNode = {
|
14595
|
+
newNode = {
|
14596
|
+
action: 'addInside',
|
14597
|
+
sourceId: 'PAG1013',
|
14598
|
+
value: 'newNode'
|
14599
|
+
},
|
14667
14600
|
onAddConfirm = _name => {},
|
14668
14601
|
onAddCancel = () => {}
|
14669
14602
|
}) => {
|
@@ -18298,53 +18231,6 @@ function setYear(date, year, options) {
|
|
18298
18231
|
return date_;
|
18299
18232
|
}
|
18300
18233
|
|
18301
|
-
const FIVE_WEEKS = 5;
|
18302
|
-
const FOUR_WEEKS = 4;
|
18303
|
-
/**
|
18304
|
-
* Return the number of weeks to display in the broadcast calendar.
|
18305
|
-
*
|
18306
|
-
* @since 9.4.0
|
18307
|
-
*/
|
18308
|
-
function getBroadcastWeeksInMonth(month, dateLib) {
|
18309
|
-
// Get the first day of the month
|
18310
|
-
const firstDayOfMonth = dateLib.startOfMonth(month);
|
18311
|
-
// Get the day of the week for the first day of the month (1-7, where 1 is Monday)
|
18312
|
-
const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
|
18313
|
-
const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
|
18314
|
-
const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
|
18315
|
-
const numberOfWeeks = month.getMonth() === lastDateOfLastWeek.getMonth() ? FIVE_WEEKS : FOUR_WEEKS;
|
18316
|
-
return numberOfWeeks;
|
18317
|
-
}
|
18318
|
-
|
18319
|
-
/**
|
18320
|
-
* Return the start date of the week in the broadcast calendar.
|
18321
|
-
*
|
18322
|
-
* @since 9.4.0
|
18323
|
-
*/
|
18324
|
-
function startOfBroadcastWeek(date, dateLib) {
|
18325
|
-
const firstOfMonth = dateLib.startOfMonth(date);
|
18326
|
-
const dayOfWeek = firstOfMonth.getDay();
|
18327
|
-
if (dayOfWeek === 1) {
|
18328
|
-
return firstOfMonth;
|
18329
|
-
} else if (dayOfWeek === 0) {
|
18330
|
-
return dateLib.addDays(firstOfMonth, -1 * 6);
|
18331
|
-
} else {
|
18332
|
-
return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
|
18333
|
-
}
|
18334
|
-
}
|
18335
|
-
|
18336
|
-
/**
|
18337
|
-
* Return the end date of the week in the broadcast calendar.
|
18338
|
-
*
|
18339
|
-
* @since 9.4.0
|
18340
|
-
*/
|
18341
|
-
function endOfBroadcastWeek(date, dateLib) {
|
18342
|
-
const startDate = startOfBroadcastWeek(date, dateLib);
|
18343
|
-
const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
|
18344
|
-
const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
|
18345
|
-
return endDate;
|
18346
|
-
}
|
18347
|
-
|
18348
18234
|
/**
|
18349
18235
|
* A wrapper class around [date-fns](http://date-fns.org) sharing the same
|
18350
18236
|
* options. Methods of this class can be overridden using the
|
@@ -18425,15 +18311,6 @@ class DateLib {
|
|
18425
18311
|
this.differenceInCalendarMonths = (dateLeft, dateRight) => {
|
18426
18312
|
return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
|
18427
18313
|
};
|
18428
|
-
/**
|
18429
|
-
* Returns the end of the broadcast week for the given date.
|
18430
|
-
*
|
18431
|
-
* @param date The original date.
|
18432
|
-
* @returns The end of the broadcast week.
|
18433
|
-
*/
|
18434
|
-
this.endOfBroadcastWeek = date => {
|
18435
|
-
return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date, this) : endOfBroadcastWeek(date, this);
|
18436
|
-
};
|
18437
18314
|
/**
|
18438
18315
|
* Returns the end of the ISO week for the given date.
|
18439
18316
|
*
|
@@ -18595,15 +18472,6 @@ class DateLib {
|
|
18595
18472
|
this.setYear = (date, year) => {
|
18596
18473
|
return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
|
18597
18474
|
};
|
18598
|
-
/**
|
18599
|
-
* Returns the start of the broadcast week for the given date.
|
18600
|
-
*
|
18601
|
-
* @param date The original date.
|
18602
|
-
* @returns The start of the broadcast week.
|
18603
|
-
*/
|
18604
|
-
this.startOfBroadcastWeek = date => {
|
18605
|
-
return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
|
18606
|
-
};
|
18607
18475
|
/**
|
18608
18476
|
* Returns the start of the day for the given date.
|
18609
18477
|
*
|
@@ -19086,9 +18954,7 @@ function Weekday(props) {
|
|
19086
18954
|
* @see https://daypicker.dev/guides/custom-components
|
19087
18955
|
*/
|
19088
18956
|
function Weekdays(props) {
|
19089
|
-
return /*#__PURE__*/React.createElement("thead", {
|
19090
|
-
"aria-hidden": true
|
19091
|
-
}, /*#__PURE__*/React.createElement("tr", {
|
18957
|
+
return /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", {
|
19092
18958
|
...props
|
19093
18959
|
}));
|
19094
18960
|
}
|
@@ -19191,8 +19057,7 @@ function getDataAttributes(props) {
|
|
19191
19057
|
"data-mode": props.mode ?? undefined,
|
19192
19058
|
"data-required": "required" in props ? props.required : undefined,
|
19193
19059
|
"data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || undefined,
|
19194
|
-
"data-week-numbers": props.showWeekNumber || undefined
|
19195
|
-
"data-broadcast-calendar": props.broadcastCalendar || undefined
|
19060
|
+
"data-week-numbers": props.showWeekNumber || undefined
|
19196
19061
|
};
|
19197
19062
|
Object.entries(props).forEach(([key, val]) => {
|
19198
19063
|
if (key.startsWith("data-")) {
|
@@ -19258,7 +19123,7 @@ function formatDay(date, options, dateLib) {
|
|
19258
19123
|
*/
|
19259
19124
|
function formatMonthDropdown(/** The month number to format. */
|
19260
19125
|
monthNumber, /** The locale to use for formatting. */
|
19261
|
-
locale) {
|
19126
|
+
locale = enUS$1) {
|
19262
19127
|
return locale.localize?.month(monthNumber);
|
19263
19128
|
}
|
19264
19129
|
|
@@ -19348,12 +19213,13 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
19348
19213
|
if (!navEnd) return undefined;
|
19349
19214
|
const {
|
19350
19215
|
addMonths,
|
19351
|
-
startOfMonth
|
19216
|
+
startOfMonth,
|
19217
|
+
isBefore
|
19352
19218
|
} = dateLib;
|
19353
19219
|
const year = displayMonth.getFullYear();
|
19354
19220
|
const months = [];
|
19355
19221
|
let month = navStart;
|
19356
|
-
while (months.length < 12) {
|
19222
|
+
while (months.length < 12 && isBefore(month, addMonths(navEnd, 1))) {
|
19357
19223
|
months.push(month.getMonth());
|
19358
19224
|
month = addMonths(month, 1);
|
19359
19225
|
}
|
@@ -19361,7 +19227,7 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
19361
19227
|
return a - b;
|
19362
19228
|
});
|
19363
19229
|
const options = sortedMonths.map(value => {
|
19364
|
-
const label = formatters.formatMonthDropdown(value, dateLib.options.locale
|
19230
|
+
const label = formatters.formatMonthDropdown(value, dateLib.options.locale);
|
19365
19231
|
const month = dateLib.Date ? new dateLib.Date(year, value) : new Date(year, value);
|
19366
19232
|
const disabled = navStart && month < startOfMonth(navStart) || navEnd && month > startOfMonth(navEnd) || false;
|
19367
19233
|
return {
|
@@ -19736,8 +19602,7 @@ function tzName(tz, date) {
|
|
19736
19602
|
*/
|
19737
19603
|
function getWeekdays(/** The date library. */
|
19738
19604
|
dateLib, /** Use ISOWeek instead of locale/ */
|
19739
|
-
ISOWeek, timeZone
|
19740
|
-
broadcastCalendar) {
|
19605
|
+
ISOWeek, timeZone) {
|
19741
19606
|
const date = timeZone ? TZDate.tz(timeZone) : dateLib.Date ? new dateLib.Date() : new Date();
|
19742
19607
|
const start = ISOWeek ? dateLib.startOfISOWeek(date) : dateLib.startOfWeek(date);
|
19743
19608
|
const days = [];
|
@@ -19749,18 +19614,20 @@ broadcastCalendar) {
|
|
19749
19614
|
}
|
19750
19615
|
|
19751
19616
|
/** Return the years to show in the dropdown. */
|
19752
|
-
function getYearOptions(
|
19753
|
-
if (!
|
19754
|
-
if (!
|
19617
|
+
function getYearOptions(displayMonth, calendarStart, calendarEnd, formatters, dateLib) {
|
19618
|
+
if (!calendarStart) return undefined;
|
19619
|
+
if (!calendarEnd) return undefined;
|
19755
19620
|
const {
|
19621
|
+
startOfMonth,
|
19756
19622
|
startOfYear,
|
19757
19623
|
endOfYear,
|
19758
19624
|
addYears,
|
19759
19625
|
isBefore,
|
19760
19626
|
isSameYear
|
19761
19627
|
} = dateLib;
|
19762
|
-
const
|
19763
|
-
const
|
19628
|
+
const month = displayMonth.getMonth();
|
19629
|
+
const firstNavYear = startOfYear(calendarStart);
|
19630
|
+
const lastNavYear = endOfYear(calendarEnd);
|
19764
19631
|
const years = [];
|
19765
19632
|
let year = firstNavYear;
|
19766
19633
|
while (isBefore(year, lastNavYear) || isSameYear(year, lastNavYear)) {
|
@@ -19768,11 +19635,13 @@ function getYearOptions(navStart, navEnd, formatters, dateLib) {
|
|
19768
19635
|
year = addYears(year, 1);
|
19769
19636
|
}
|
19770
19637
|
return years.map(value => {
|
19638
|
+
const year = dateLib.Date ? new dateLib.Date(value, month) : new Date(value, month);
|
19639
|
+
const disabled = calendarStart && year < startOfMonth(calendarStart) || month && calendarEnd && year > startOfMonth(calendarEnd) || false;
|
19771
19640
|
const label = formatters.formatYearDropdown(value);
|
19772
19641
|
return {
|
19773
19642
|
value,
|
19774
19643
|
label,
|
19775
|
-
disabled
|
19644
|
+
disabled
|
19776
19645
|
};
|
19777
19646
|
});
|
19778
19647
|
}
|
@@ -19936,30 +19805,29 @@ var defaultLabels = /*#__PURE__*/Object.freeze({
|
|
19936
19805
|
labelYearDropdown: labelYearDropdown
|
19937
19806
|
});
|
19938
19807
|
|
19808
|
+
/** The number of days in a month when having 6 weeks. */
|
19809
|
+
const NrOfDaysWithFixedWeeks = 42;
|
19939
19810
|
/** Return all the dates to display in the calendar. */
|
19940
19811
|
function getDates(displayMonths, maxDate, props, dateLib) {
|
19941
19812
|
const firstMonth = displayMonths[0];
|
19942
19813
|
const lastMonth = displayMonths[displayMonths.length - 1];
|
19943
19814
|
const {
|
19944
19815
|
ISOWeek,
|
19945
|
-
fixedWeeks
|
19946
|
-
broadcastCalendar
|
19816
|
+
fixedWeeks
|
19947
19817
|
} = props ?? {};
|
19948
19818
|
const {
|
19819
|
+
startOfWeek,
|
19820
|
+
endOfWeek,
|
19821
|
+
startOfISOWeek,
|
19822
|
+
endOfISOWeek,
|
19949
19823
|
addDays,
|
19950
19824
|
differenceInCalendarDays,
|
19951
19825
|
differenceInCalendarMonths,
|
19952
|
-
endOfBroadcastWeek,
|
19953
|
-
endOfISOWeek,
|
19954
|
-
endOfMonth,
|
19955
|
-
endOfWeek,
|
19956
19826
|
isAfter,
|
19957
|
-
|
19958
|
-
startOfISOWeek,
|
19959
|
-
startOfWeek
|
19827
|
+
endOfMonth
|
19960
19828
|
} = dateLib;
|
19961
|
-
const startWeekFirstDate =
|
19962
|
-
const endWeekLastDate =
|
19829
|
+
const startWeekFirstDate = ISOWeek ? startOfISOWeek(firstMonth) : startOfWeek(firstMonth);
|
19830
|
+
const endWeekLastDate = ISOWeek ? endOfISOWeek(endOfMonth(lastMonth)) : endOfWeek(endOfMonth(lastMonth));
|
19963
19831
|
const nOfDays = differenceInCalendarDays(endWeekLastDate, startWeekFirstDate);
|
19964
19832
|
const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;
|
19965
19833
|
const dates = [];
|
@@ -19971,11 +19839,9 @@ function getDates(displayMonths, maxDate, props, dateLib) {
|
|
19971
19839
|
dates.push(date);
|
19972
19840
|
}
|
19973
19841
|
// If fixed weeks is enabled, add the extra dates to the array
|
19974
|
-
const
|
19975
|
-
const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
|
19842
|
+
const extraDates = NrOfDaysWithFixedWeeks * nOfMonths;
|
19976
19843
|
if (fixedWeeks && dates.length < extraDates) {
|
19977
|
-
|
19978
|
-
for (let i = 0; i < daysToAdd; i++) {
|
19844
|
+
for (let i = 0; i < 7; i++) {
|
19979
19845
|
const date = addDays(dates[dates.length - 1], 1);
|
19980
19846
|
dates.push(date);
|
19981
19847
|
}
|
@@ -20086,29 +19952,25 @@ displayMonths, /** The dates to display in the calendar. */
|
|
20086
19952
|
dates, /** Options from the props context. */
|
20087
19953
|
props, dateLib) {
|
20088
19954
|
const {
|
20089
|
-
|
20090
|
-
|
19955
|
+
startOfWeek,
|
19956
|
+
endOfWeek,
|
19957
|
+
startOfISOWeek,
|
20091
19958
|
endOfISOWeek,
|
20092
19959
|
endOfMonth,
|
20093
|
-
|
20094
|
-
getISOWeek,
|
19960
|
+
addDays,
|
20095
19961
|
getWeek,
|
20096
|
-
|
20097
|
-
startOfISOWeek,
|
20098
|
-
startOfWeek
|
19962
|
+
getISOWeek
|
20099
19963
|
} = dateLib;
|
20100
19964
|
const dayPickerMonths = displayMonths.reduce((months, month) => {
|
20101
|
-
const firstDateOfFirstWeek = props.
|
20102
|
-
const lastDateOfLastWeek = props.
|
19965
|
+
const firstDateOfFirstWeek = props.ISOWeek ? startOfISOWeek(month) : startOfWeek(month);
|
19966
|
+
const lastDateOfLastWeek = props.ISOWeek ? endOfISOWeek(endOfMonth(month)) : endOfWeek(endOfMonth(month));
|
20103
19967
|
/** The dates to display in the month. */
|
20104
19968
|
const monthDates = dates.filter(date => {
|
20105
19969
|
return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
|
20106
19970
|
});
|
20107
|
-
|
20108
|
-
if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
|
19971
|
+
if (props.fixedWeeks && monthDates.length < 42) {
|
20109
19972
|
const extraDates = dates.filter(date => {
|
20110
|
-
|
20111
|
-
return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, daysToAdd);
|
19973
|
+
return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, 7);
|
20112
19974
|
});
|
20113
19975
|
monthDates.push(...extraDates);
|
20114
19976
|
}
|
@@ -20546,30 +20408,27 @@ function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
|
|
20546
20408
|
/** Return the next date that should be focused. */
|
20547
20409
|
function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
|
20548
20410
|
const {
|
20549
|
-
ISOWeek
|
20550
|
-
broadcastCalendar
|
20411
|
+
ISOWeek
|
20551
20412
|
} = props;
|
20552
20413
|
const {
|
20553
20414
|
addDays,
|
20554
20415
|
addMonths,
|
20555
|
-
addWeeks,
|
20556
20416
|
addYears,
|
20557
|
-
|
20417
|
+
addWeeks,
|
20418
|
+
startOfISOWeek,
|
20558
20419
|
endOfISOWeek,
|
20420
|
+
startOfWeek,
|
20559
20421
|
endOfWeek,
|
20560
20422
|
max,
|
20561
|
-
min
|
20562
|
-
startOfBroadcastWeek,
|
20563
|
-
startOfISOWeek,
|
20564
|
-
startOfWeek
|
20423
|
+
min
|
20565
20424
|
} = dateLib;
|
20566
20425
|
const moveFns = {
|
20567
20426
|
day: addDays,
|
20568
20427
|
week: addWeeks,
|
20569
20428
|
month: addMonths,
|
20570
20429
|
year: addYears,
|
20571
|
-
startOfWeek: date =>
|
20572
|
-
endOfWeek: date =>
|
20430
|
+
startOfWeek: date => ISOWeek ? startOfISOWeek(date) : startOfWeek(date),
|
20431
|
+
endOfWeek: date => ISOWeek ? endOfISOWeek(date) : endOfWeek(date)
|
20573
20432
|
};
|
20574
20433
|
let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
|
20575
20434
|
if (moveDir === "before" && navStart) {
|
@@ -20635,8 +20494,6 @@ function useFocus(props, calendar, getModifiers, isSelected, dateLib) {
|
|
20635
20494
|
/**
|
20636
20495
|
* Return a function to get the modifiers for a given day.
|
20637
20496
|
*
|
20638
|
-
* NOTE: this is not an hook, but a factory for `getModifiers`.
|
20639
|
-
*
|
20640
20497
|
* @private
|
20641
20498
|
*/
|
20642
20499
|
function useGetModifiers(days, props, dateLib) {
|
@@ -20645,19 +20502,12 @@ function useGetModifiers(days, props, dateLib) {
|
|
20645
20502
|
hidden,
|
20646
20503
|
modifiers,
|
20647
20504
|
showOutsideDays,
|
20648
|
-
broadcastCalendar,
|
20649
20505
|
today
|
20650
20506
|
} = props;
|
20651
20507
|
const {
|
20652
20508
|
isSameDay,
|
20653
|
-
isSameMonth
|
20654
|
-
startOfMonth,
|
20655
|
-
isBefore,
|
20656
|
-
endOfMonth,
|
20657
|
-
isAfter
|
20509
|
+
isSameMonth
|
20658
20510
|
} = dateLib;
|
20659
|
-
const startMonth = props.startMonth && startOfMonth(props.startMonth);
|
20660
|
-
const endMonth = props.endMonth && endOfMonth(props.endMonth);
|
20661
20511
|
const internalModifiersMap = {
|
20662
20512
|
[DayFlag.focused]: [],
|
20663
20513
|
[DayFlag.outside]: [],
|
@@ -20666,18 +20516,20 @@ function useGetModifiers(days, props, dateLib) {
|
|
20666
20516
|
[DayFlag.today]: []
|
20667
20517
|
};
|
20668
20518
|
const customModifiersMap = {};
|
20519
|
+
const selectionModifiersMap = {
|
20520
|
+
[SelectionState.range_end]: [],
|
20521
|
+
[SelectionState.range_middle]: [],
|
20522
|
+
[SelectionState.range_start]: [],
|
20523
|
+
[SelectionState.selected]: []
|
20524
|
+
};
|
20669
20525
|
for (const day of days) {
|
20670
20526
|
const {
|
20671
20527
|
date,
|
20672
20528
|
displayMonth
|
20673
20529
|
} = day;
|
20674
20530
|
const isOutside = Boolean(displayMonth && !isSameMonth(date, displayMonth));
|
20675
|
-
const isBeforeStartMonth = Boolean(startMonth && isBefore(date, startMonth));
|
20676
|
-
const isAfterEndMonth = Boolean(endMonth && isAfter(date, endMonth));
|
20677
20531
|
const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));
|
20678
|
-
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) ||
|
20679
|
-
// Broadcast calendar will show outside days as default
|
20680
|
-
!broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
|
20532
|
+
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || !showOutsideDays && isOutside;
|
20681
20533
|
const isToday = isSameDay(date, today ?? (props.timeZone ? TZDate.tz(props.timeZone) : dateLib.Date ? new dateLib.Date() : new Date()));
|
20682
20534
|
if (isOutside) internalModifiersMap.outside.push(day);
|
20683
20535
|
if (isDisabled) internalModifiersMap.disabled.push(day);
|
@@ -20706,16 +20558,27 @@ function useGetModifiers(days, props, dateLib) {
|
|
20706
20558
|
[DayFlag.outside]: false,
|
20707
20559
|
[DayFlag.today]: false
|
20708
20560
|
};
|
20561
|
+
const selectionStates = {
|
20562
|
+
[SelectionState.range_end]: false,
|
20563
|
+
[SelectionState.range_middle]: false,
|
20564
|
+
[SelectionState.range_start]: false,
|
20565
|
+
[SelectionState.selected]: false
|
20566
|
+
};
|
20709
20567
|
const customModifiers = {};
|
20710
20568
|
// Find the modifiers for the given day
|
20711
20569
|
for (const name in internalModifiersMap) {
|
20712
20570
|
const days = internalModifiersMap[name];
|
20713
20571
|
dayFlags[name] = days.some(d => d === day);
|
20714
20572
|
}
|
20573
|
+
for (const name in selectionModifiersMap) {
|
20574
|
+
const days = selectionModifiersMap[name];
|
20575
|
+
selectionStates[name] = days.some(d => d === day);
|
20576
|
+
}
|
20715
20577
|
for (const name in customModifiersMap) {
|
20716
20578
|
customModifiers[name] = customModifiersMap[name].some(d => d === day);
|
20717
20579
|
}
|
20718
20580
|
return {
|
20581
|
+
...selectionStates,
|
20719
20582
|
...dayFlags,
|
20720
20583
|
// custom modifiers should override all the previous ones
|
20721
20584
|
...customModifiers
|
@@ -21120,7 +20983,7 @@ function DayPicker(props) {
|
|
21120
20983
|
};
|
21121
20984
|
const dateLib = new DateLib({
|
21122
20985
|
locale,
|
21123
|
-
weekStartsOn: props.
|
20986
|
+
weekStartsOn: props.weekStartsOn,
|
21124
20987
|
firstWeekContainsDate: props.firstWeekContainsDate,
|
21125
20988
|
useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
|
21126
20989
|
useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens
|
@@ -21139,7 +21002,7 @@ function DayPicker(props) {
|
|
21139
21002
|
...props.classNames
|
21140
21003
|
}
|
21141
21004
|
};
|
21142
|
-
}, [props.classNames, props.components, props.dateLib, props.firstWeekContainsDate, props.formatters, props.labels, props.locale, props.useAdditionalDayOfYearTokens, props.useAdditionalWeekYearTokens, props.weekStartsOn
|
21005
|
+
}, [props.classNames, props.components, props.dateLib, props.firstWeekContainsDate, props.formatters, props.labels, props.locale, props.useAdditionalDayOfYearTokens, props.useAdditionalWeekYearTokens, props.weekStartsOn]);
|
21143
21006
|
const {
|
21144
21007
|
captionLayout,
|
21145
21008
|
mode,
|
@@ -21249,16 +21112,6 @@ function DayPicker(props) {
|
|
21249
21112
|
const handleDayMouseLeave = React.useCallback((day, modifiers) => e => {
|
21250
21113
|
onDayMouseLeave?.(day.date, modifiers, e);
|
21251
21114
|
}, [onDayMouseLeave]);
|
21252
|
-
const handleMonthChange = React.useCallback(date => e => {
|
21253
|
-
const selectedMonth = Number(e.target.value);
|
21254
|
-
const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
|
21255
|
-
goToMonth(month);
|
21256
|
-
}, [dateLib, goToMonth]);
|
21257
|
-
const handleYearChange = React.useCallback(date => e => {
|
21258
|
-
const selectedYear = Number(e.target.value);
|
21259
|
-
const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
|
21260
|
-
goToMonth(month);
|
21261
|
-
}, [dateLib, goToMonth]);
|
21262
21115
|
const {
|
21263
21116
|
className,
|
21264
21117
|
style
|
@@ -21296,8 +21149,6 @@ function DayPicker(props) {
|
|
21296
21149
|
lang: props.lang,
|
21297
21150
|
nonce: props.nonce,
|
21298
21151
|
title: props.title,
|
21299
|
-
role: props.role,
|
21300
|
-
"aria-label": props["aria-label"],
|
21301
21152
|
...dataAttributes
|
21302
21153
|
}, /*#__PURE__*/React.createElement(components.Months, {
|
21303
21154
|
className: classNames[UI.Months],
|
@@ -21311,8 +21162,17 @@ function DayPicker(props) {
|
|
21311
21162
|
previousMonth: previousMonth,
|
21312
21163
|
nextMonth: nextMonth
|
21313
21164
|
})), months.map((calendarMonth, displayIndex) => {
|
21165
|
+
const handleMonthChange = e => {
|
21166
|
+
const selectedMonth = Number(e.target.value);
|
21167
|
+
const month = dateLib.setMonth(dateLib.startOfMonth(calendarMonth.date), selectedMonth);
|
21168
|
+
goToMonth(month);
|
21169
|
+
};
|
21170
|
+
const handleYearChange = e => {
|
21171
|
+
const month = dateLib.setYear(dateLib.startOfMonth(calendarMonth.date), Number(e.target.value));
|
21172
|
+
goToMonth(month);
|
21173
|
+
};
|
21314
21174
|
const dropdownMonths = getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib);
|
21315
|
-
const dropdownYears = getYearOptions(navStart, navEnd, formatters, dateLib);
|
21175
|
+
const dropdownYears = getYearOptions(months[0].date, navStart, navEnd, formatters, dateLib);
|
21316
21176
|
return /*#__PURE__*/React.createElement(components.Month, {
|
21317
21177
|
className: classNames[UI.Month],
|
21318
21178
|
style: styles?.[UI.Month],
|
@@ -21333,7 +21193,7 @@ function DayPicker(props) {
|
|
21333
21193
|
classNames: classNames,
|
21334
21194
|
components: components,
|
21335
21195
|
disabled: Boolean(props.disableNavigation),
|
21336
|
-
onChange: handleMonthChange
|
21196
|
+
onChange: handleMonthChange,
|
21337
21197
|
options: dropdownMonths,
|
21338
21198
|
style: styles?.[UI.Dropdown],
|
21339
21199
|
value: calendarMonth.date.getMonth()
|
@@ -21346,7 +21206,7 @@ function DayPicker(props) {
|
|
21346
21206
|
classNames: classNames,
|
21347
21207
|
components: components,
|
21348
21208
|
disabled: Boolean(props.disableNavigation),
|
21349
|
-
onChange: handleYearChange
|
21209
|
+
onChange: handleYearChange,
|
21350
21210
|
options: dropdownYears,
|
21351
21211
|
style: styles?.[UI.Dropdown],
|
21352
21212
|
value: calendarMonth.date.getFullYear()
|
@@ -21393,8 +21253,7 @@ function DayPicker(props) {
|
|
21393
21253
|
locale
|
21394
21254
|
}),
|
21395
21255
|
className: classNames[UI.WeekNumber],
|
21396
|
-
scope: "row"
|
21397
|
-
role: "rowheader"
|
21256
|
+
scope: "row"
|
21398
21257
|
}, formatWeekNumber(week.weekNumber))), week.days.map(day => {
|
21399
21258
|
const {
|
21400
21259
|
date
|
@@ -21414,14 +21273,14 @@ function DayPicker(props) {
|
|
21414
21273
|
}
|
21415
21274
|
const style = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
21416
21275
|
const className = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
21417
|
-
const ariaLabel = !isInteractive
|
21276
|
+
const ariaLabel = !isInteractive ? labelGridcell(date, modifiers, dateLib.options, dateLib) : undefined;
|
21418
21277
|
return /*#__PURE__*/React.createElement(components.Day, {
|
21419
21278
|
key: `${dateLib.format(date, "yyyy-MM-dd")}_${dateLib.format(day.displayMonth, "yyyy-MM")}`,
|
21420
21279
|
day: day,
|
21421
21280
|
modifiers: modifiers,
|
21422
21281
|
className: className.join(" "),
|
21423
21282
|
style: style,
|
21424
|
-
|
21283
|
+
"aria-hidden": modifiers.hidden || undefined,
|
21425
21284
|
"aria-selected": modifiers.selected || undefined,
|
21426
21285
|
"aria-label": ariaLabel,
|
21427
21286
|
"data-day": dateLib.format(date, "yyyy-MM-dd"),
|
@@ -21432,7 +21291,7 @@ function DayPicker(props) {
|
|
21432
21291
|
"data-outside": day.outside || undefined,
|
21433
21292
|
"data-focused": modifiers.focused || undefined,
|
21434
21293
|
"data-today": modifiers.today || undefined
|
21435
|
-
},
|
21294
|
+
}, isInteractive ? (/*#__PURE__*/React.createElement(components.DayButton, {
|
21436
21295
|
className: classNames[UI.DayButton],
|
21437
21296
|
style: styles?.[UI.DayButton],
|
21438
21297
|
type: "button",
|
@@ -21447,7 +21306,7 @@ function DayPicker(props) {
|
|
21447
21306
|
onKeyDown: handleDayKeyDown(day, modifiers),
|
21448
21307
|
onMouseEnter: handleDayMouseEnter(day, modifiers),
|
21449
21308
|
onMouseLeave: handleDayMouseLeave(day, modifiers)
|
21450
|
-
}, formatDay(date, dateLib.options, dateLib))) :
|
21309
|
+
}, formatDay(date, dateLib.options, dateLib))) : formatDay(day.date, dateLib.options, dateLib));
|
21451
21310
|
}));
|
21452
21311
|
}))));
|
21453
21312
|
})), props.footer && (/*#__PURE__*/React.createElement(components.Footer, {
|