pixel-react 1.7.4 → 1.7.5

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.
Files changed (125) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
  3. package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
  4. package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
  5. package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
  6. package/lib/components/TableTree/TableTree copy.d.ts +25 -0
  7. package/lib/index.esm.js +209 -120
  8. package/lib/index.esm.js.map +1 -1
  9. package/lib/index.js +209 -120
  10. package/lib/index.js.map +1 -1
  11. package/lib/tsconfig.tsbuildinfo +1 -1
  12. package/package.json +1 -1
  13. package/src/components/MenuOption/MenuOption.tsx +29 -20
  14. package/lib/1fb4472b34e4fe07.css +0 -1
  15. package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +0 -6
  16. package/lib/StyleGuide/Typography/Typography.stories.d.ts +0 -6
  17. package/lib/components/Accordion/Accordion.stories.d.ts +0 -6
  18. package/lib/components/AddResourceButton/AddButton.stories.d.ts +0 -8
  19. package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +0 -7
  20. package/lib/components/AppHeader/AppHeader.stories.d.ts +0 -7
  21. package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +0 -9
  22. package/lib/components/Avatar/Avatar.stories.d.ts +0 -10
  23. package/lib/components/Button/Button.stories.d.ts +0 -13
  24. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +0 -7
  25. package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +0 -6
  26. package/lib/components/Charts/PieChart/PieChart.stories.d.ts +0 -7
  27. package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +0 -6
  28. package/lib/components/Checkbox/Checkbox.stories.d.ts +0 -8
  29. package/lib/components/Chip/Chip.stories.d.ts +0 -14
  30. package/lib/components/DatePicker/DatePicker.stories.d.ts +0 -9
  31. package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +0 -6
  32. package/lib/components/Drawer/Drawer.stories.d.ts +0 -12
  33. package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +0 -8
  34. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +0 -7
  35. package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +0 -4
  36. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +0 -5
  37. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +0 -3
  38. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +0 -5
  39. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +0 -5
  40. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +0 -8
  41. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +0 -10
  42. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +0 -3
  43. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +0 -3
  44. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +0 -5
  45. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +0 -3
  46. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +0 -80
  47. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +0 -3
  48. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +0 -174
  49. package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +0 -1
  50. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +0 -8
  51. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +0 -22
  52. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +0 -17
  53. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +0 -2
  54. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +0 -21
  55. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +0 -3
  56. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +0 -24
  57. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +0 -13
  58. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +0 -67
  59. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +0 -22
  60. package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +0 -11
  61. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +0 -27
  62. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +0 -95
  63. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +0 -178
  64. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +0 -3
  65. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +0 -3
  66. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +0 -44
  67. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +0 -19
  68. package/lib/components/ExcelFile/ExcelFile.stories.d.ts +0 -6
  69. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -12
  70. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +0 -15
  71. package/lib/components/ExcelFile/Types.d.ts +0 -129
  72. package/lib/components/ExcelFile/index.d.ts +0 -1
  73. package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +0 -7
  74. package/lib/components/FF_Captcha/captcha.stories.d.ts +0 -8
  75. package/lib/components/FileDropzone/FileDropzone.stories.d.ts +0 -8
  76. package/lib/components/Form/Form.stories.d.ts +0 -7
  77. package/lib/components/GridLayout/GridLayout.stories.d.ts +0 -8
  78. package/lib/components/HighlightText/HighlightText.stories.d.ts +0 -6
  79. package/lib/components/Icon/Icon.stories.d.ts +0 -8
  80. package/lib/components/IconButton/IconButton.stories.d.ts +0 -7
  81. package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +0 -7
  82. package/lib/components/Input/Input.stories.d.ts +0 -9
  83. package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +0 -9
  84. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +0 -11
  85. package/lib/components/LazyLoad/LazyLoad.stories.d.ts +0 -6
  86. package/lib/components/MachineInputField/MachineInputField.stories.d.ts +0 -6
  87. package/lib/components/MenuOption/MenuOption.stories.d.ts +0 -16
  88. package/lib/components/MiniModal/MiniModal.stories.d.ts +0 -10
  89. package/lib/components/Modal/Modal.stories.d.ts +0 -7
  90. package/lib/components/ModulesChip/ModuleChip.stories.d.ts +0 -6
  91. package/lib/components/MultiSelect/MultiSelect.stories.d.ts +0 -10
  92. package/lib/components/NLPInput/NlpInput.stories.d.ts +0 -7
  93. package/lib/components/Paper/Paper.stories.d.ts +0 -11
  94. package/lib/components/RadioButton/RadioButton.stories.d.ts +0 -10
  95. package/lib/components/RadioGroup/RadioGroup.stories.d.ts +0 -9
  96. package/lib/components/Search/Search.stories.d.ts +0 -6
  97. package/lib/components/Select/Select.stories.d.ts +0 -13
  98. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +0 -4
  99. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +0 -17
  100. package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +0 -6
  101. package/lib/components/StateDropdown/StateDropdown.stories.d.ts +0 -10
  102. package/lib/components/StatusButton/StatusButton.stories.d.ts +0 -14
  103. package/lib/components/Table/Table.stories.d.ts +0 -13
  104. package/lib/components/TableTree/TableTree.stories.d.ts +0 -7
  105. package/lib/components/Tabs/Tabs.stories.d.ts +0 -9
  106. package/lib/components/TextArea/Textarea.stories.d.ts +0 -9
  107. package/lib/components/Toast/Toast.stories.d.ts +0 -6
  108. package/lib/components/Toastify/Toastify.stories.d.ts +0 -6
  109. package/lib/components/Toggle/Toggle.stories.d.ts +0 -12
  110. package/lib/components/Tooltip/Tooltip.stories.d.ts +0 -15
  111. package/lib/components/Typography/Typography.stories.d.ts +0 -10
  112. package/lib/components/VariableInput/VariableInput.stories.d.ts +0 -6
  113. package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +0 -6
  114. package/lib/utils/compareArrays/compareArrays.stories.d.ts +0 -6
  115. package/lib/utils/compareObjects/compareObjects.stories.d.ts +0 -6
  116. package/lib/utils/debounce/debounce.stories.d.ts +0 -6
  117. package/lib/utils/ffID/ffID.stories.d.ts +0 -6
  118. package/lib/utils/find/findAndInsert.d.ts +0 -7
  119. package/lib/utils/find/findAndInsert.stories.d.ts +0 -7
  120. package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +0 -7
  121. package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +0 -6
  122. package/lib/utils/getExtension/getExtension.stories.d.ts +0 -6
  123. package/lib/utils/throttle/throttle.stories.d.ts +0 -6
  124. package/lib/utils/truncateText/truncateText.stories.d.ts +0 -6
  125. /package/lib/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.d.ts +0 -0
package/lib/index.esm.js CHANGED
@@ -3180,9 +3180,9 @@ const OptionCard = ({
3180
3180
  const optionCardRef = useRef(null);
3181
3181
  useEffect(() => {
3182
3182
  if (optionCardRef?.current) {
3183
- const rect = optionCardRef?.current?.getBoundingClientRect();
3184
- setOptionsHeight(rect?.height);
3185
- setOptionsWidth(rect?.width);
3183
+ const rect = optionCardRef.current.getBoundingClientRect();
3184
+ setOptionsHeight(rect.height);
3185
+ setOptionsWidth(rect.width);
3186
3186
  }
3187
3187
  }, []);
3188
3188
  useClickOutside(menuRef, closeDropdown, [optionCardRef]);
@@ -3195,7 +3195,7 @@ const OptionCard = ({
3195
3195
  };
3196
3196
  case 'down':
3197
3197
  return {
3198
- top: menuPosition.top + 20,
3198
+ top: menuPosition.top + menuPosition.height + 7,
3199
3199
  left: menuPosition.left - 4
3200
3200
  };
3201
3201
  case 'left':
@@ -3206,23 +3206,25 @@ const OptionCard = ({
3206
3206
  case 'right':
3207
3207
  return {
3208
3208
  top: menuPosition.top - 4,
3209
- left: menuPosition.left + 20
3209
+ left: menuPosition.left + menuPosition.height + 20
3210
3210
  };
3211
3211
  default:
3212
3212
  return {
3213
- top: menuPosition.bottom,
3214
- left: menuPosition.rightSpaceAvailable + 12
3213
+ top: menuPosition.top,
3214
+ left: menuPosition.left
3215
3215
  };
3216
3216
  }
3217
3217
  })();
3218
+ const adjustedStyle = {
3219
+ top: Math.min(Math.max(style.top, 0), window.innerHeight - optionsHeight),
3220
+ left: Math.min(Math.max(style.left, 0), window.innerWidth - optionsWidth),
3221
+ zIndex
3222
+ };
3218
3223
  return /*#__PURE__*/createPortal(jsx("div", {
3219
3224
  className: classNames('ff-option-card', [{
3220
3225
  'ff-option-card--primary': variant === 'primary'
3221
3226
  }], currentTheme),
3222
- style: {
3223
- ...style,
3224
- zIndex
3225
- },
3227
+ style: adjustedStyle,
3226
3228
  ref: optionCardRef,
3227
3229
  children: options.map(opt => jsx(Option$1, {
3228
3230
  option: opt,
@@ -3256,26 +3258,28 @@ const MenuOption = ({
3256
3258
  right: 0
3257
3259
  });
3258
3260
  const closeDropDown = () => setIsClicked(false);
3259
- const onIconClickHandler = () => {
3260
- onClick();
3261
- calculateDims();
3262
- setIsClicked(prev => !prev);
3263
- };
3264
- const handleOptionClick = option => {
3265
- onOptionClick(option);
3266
- closeDropDown();
3267
- };
3268
3261
  const calculateDims = () => {
3269
3262
  if (targetRef?.current) {
3270
3263
  const rect = targetRef.current.getBoundingClientRect();
3264
+ const containerScrollTop = targetRef.current?.offsetParent?.scrollTop || 0;
3265
+ const containerScrollLeft = targetRef.current?.offsetParent?.scrollLeft || 0;
3271
3266
  setMenuPosition({
3272
- top: rect.top + window.scrollY,
3273
- left: rect.left + window.scrollX,
3267
+ top: rect.top + window.scrollY - containerScrollTop,
3268
+ left: rect.left + window.scrollX - containerScrollLeft,
3274
3269
  height: rect.height,
3275
3270
  right: rect.right
3276
3271
  });
3277
3272
  }
3278
3273
  };
3274
+ const onIconClickHandler = () => {
3275
+ onClick();
3276
+ calculateDims();
3277
+ setIsClicked(prev => !prev);
3278
+ };
3279
+ const handleOptionClick = option => {
3280
+ onOptionClick(option);
3281
+ closeDropDown();
3282
+ };
3279
3283
  return jsxs("div", {
3280
3284
  className: "ff-menu-option-container",
3281
3285
  ref: menuRef,
@@ -13235,6 +13239,53 @@ function setYear(date, year, options) {
13235
13239
  return date_;
13236
13240
  }
13237
13241
 
13242
+ const FIVE_WEEKS = 5;
13243
+ const FOUR_WEEKS = 4;
13244
+ /**
13245
+ * Return the number of weeks to display in the broadcast calendar.
13246
+ *
13247
+ * @since 9.4.0
13248
+ */
13249
+ function getBroadcastWeeksInMonth(month, dateLib) {
13250
+ // Get the first day of the month
13251
+ const firstDayOfMonth = dateLib.startOfMonth(month);
13252
+ // Get the day of the week for the first day of the month (1-7, where 1 is Monday)
13253
+ const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
13254
+ const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
13255
+ const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
13256
+ const numberOfWeeks = month.getMonth() === lastDateOfLastWeek.getMonth() ? FIVE_WEEKS : FOUR_WEEKS;
13257
+ return numberOfWeeks;
13258
+ }
13259
+
13260
+ /**
13261
+ * Return the start date of the week in the broadcast calendar.
13262
+ *
13263
+ * @since 9.4.0
13264
+ */
13265
+ function startOfBroadcastWeek(date, dateLib) {
13266
+ const firstOfMonth = dateLib.startOfMonth(date);
13267
+ const dayOfWeek = firstOfMonth.getDay();
13268
+ if (dayOfWeek === 1) {
13269
+ return firstOfMonth;
13270
+ } else if (dayOfWeek === 0) {
13271
+ return dateLib.addDays(firstOfMonth, -1 * 6);
13272
+ } else {
13273
+ return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
13274
+ }
13275
+ }
13276
+
13277
+ /**
13278
+ * Return the end date of the week in the broadcast calendar.
13279
+ *
13280
+ * @since 9.4.0
13281
+ */
13282
+ function endOfBroadcastWeek(date, dateLib) {
13283
+ const startDate = startOfBroadcastWeek(date, dateLib);
13284
+ const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
13285
+ const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
13286
+ return endDate;
13287
+ }
13288
+
13238
13289
  /**
13239
13290
  * A wrapper class around [date-fns](http://date-fns.org) sharing the same
13240
13291
  * options. Methods of this class can be overridden using the
@@ -13315,6 +13366,15 @@ class DateLib {
13315
13366
  this.differenceInCalendarMonths = (dateLeft, dateRight) => {
13316
13367
  return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
13317
13368
  };
13369
+ /**
13370
+ * Returns the end of the broadcast week for the given date.
13371
+ *
13372
+ * @param date The original date.
13373
+ * @returns The end of the broadcast week.
13374
+ */
13375
+ this.endOfBroadcastWeek = date => {
13376
+ return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date, this) : endOfBroadcastWeek(date, this);
13377
+ };
13318
13378
  /**
13319
13379
  * Returns the end of the ISO week for the given date.
13320
13380
  *
@@ -13476,6 +13536,15 @@ class DateLib {
13476
13536
  this.setYear = (date, year) => {
13477
13537
  return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
13478
13538
  };
13539
+ /**
13540
+ * Returns the start of the broadcast week for the given date.
13541
+ *
13542
+ * @param date The original date.
13543
+ * @returns The start of the broadcast week.
13544
+ */
13545
+ this.startOfBroadcastWeek = date => {
13546
+ return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
13547
+ };
13479
13548
  /**
13480
13549
  * Returns the start of the day for the given date.
13481
13550
  *
@@ -14061,7 +14130,8 @@ function getDataAttributes(props) {
14061
14130
  "data-mode": props.mode ?? undefined,
14062
14131
  "data-required": "required" in props ? props.required : undefined,
14063
14132
  "data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || undefined,
14064
- "data-week-numbers": props.showWeekNumber || undefined
14133
+ "data-week-numbers": props.showWeekNumber || undefined,
14134
+ "data-broadcast-calendar": props.broadcastCalendar || undefined
14065
14135
  };
14066
14136
  Object.entries(props).forEach(([key, val]) => {
14067
14137
  if (key.startsWith("data-")) {
@@ -14127,7 +14197,7 @@ function formatDay(date, options, dateLib) {
14127
14197
  */
14128
14198
  function formatMonthDropdown(/** The month number to format. */
14129
14199
  monthNumber, /** The locale to use for formatting. */
14130
- locale = enUS) {
14200
+ locale) {
14131
14201
  return locale.localize?.month(monthNumber);
14132
14202
  }
14133
14203
 
@@ -14231,7 +14301,7 @@ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
14231
14301
  return a - b;
14232
14302
  });
14233
14303
  const options = sortedMonths.map(value => {
14234
- const label = formatters.formatMonthDropdown(value, dateLib.options.locale);
14304
+ const label = formatters.formatMonthDropdown(value, dateLib.options.locale ?? enUS);
14235
14305
  const month = dateLib.Date ? new dateLib.Date(year, value) : new Date(year, value);
14236
14306
  const disabled = navStart && month < startOfMonth(navStart) || navEnd && month > startOfMonth(navEnd) || false;
14237
14307
  return {
@@ -14606,7 +14676,8 @@ function tzName(tz, date) {
14606
14676
  */
14607
14677
  function getWeekdays(/** The date library. */
14608
14678
  dateLib, /** Use ISOWeek instead of locale/ */
14609
- ISOWeek, timeZone) {
14679
+ ISOWeek, timeZone, /** @since 9.4.0 */
14680
+ broadcastCalendar) {
14610
14681
  const date = timeZone ? TZDate.tz(timeZone) : dateLib.Date ? new dateLib.Date() : new Date();
14611
14682
  const start = ISOWeek ? dateLib.startOfISOWeek(date) : dateLib.startOfWeek(date);
14612
14683
  const days = [];
@@ -14809,29 +14880,30 @@ var defaultLabels = /*#__PURE__*/Object.freeze({
14809
14880
  labelYearDropdown: labelYearDropdown
14810
14881
  });
14811
14882
 
14812
- /** The number of days in a month when having 6 weeks. */
14813
- const NrOfDaysWithFixedWeeks = 42;
14814
14883
  /** Return all the dates to display in the calendar. */
14815
14884
  function getDates(displayMonths, maxDate, props, dateLib) {
14816
14885
  const firstMonth = displayMonths[0];
14817
14886
  const lastMonth = displayMonths[displayMonths.length - 1];
14818
14887
  const {
14819
14888
  ISOWeek,
14820
- fixedWeeks
14889
+ fixedWeeks,
14890
+ broadcastCalendar
14821
14891
  } = props ?? {};
14822
14892
  const {
14823
- startOfWeek,
14824
- endOfWeek,
14825
- startOfISOWeek,
14826
- endOfISOWeek,
14827
14893
  addDays,
14828
14894
  differenceInCalendarDays,
14829
14895
  differenceInCalendarMonths,
14896
+ endOfBroadcastWeek,
14897
+ endOfISOWeek,
14898
+ endOfMonth,
14899
+ endOfWeek,
14830
14900
  isAfter,
14831
- endOfMonth
14901
+ startOfBroadcastWeek,
14902
+ startOfISOWeek,
14903
+ startOfWeek
14832
14904
  } = dateLib;
14833
- const startWeekFirstDate = ISOWeek ? startOfISOWeek(firstMonth) : startOfWeek(firstMonth);
14834
- const endWeekLastDate = ISOWeek ? endOfISOWeek(endOfMonth(lastMonth)) : endOfWeek(endOfMonth(lastMonth));
14905
+ const startWeekFirstDate = broadcastCalendar ? startOfBroadcastWeek(firstMonth, dateLib) : ISOWeek ? startOfISOWeek(firstMonth) : startOfWeek(firstMonth);
14906
+ const endWeekLastDate = broadcastCalendar ? endOfBroadcastWeek(lastMonth, dateLib) : ISOWeek ? endOfISOWeek(endOfMonth(lastMonth)) : endOfWeek(endOfMonth(lastMonth));
14835
14907
  const nOfDays = differenceInCalendarDays(endWeekLastDate, startWeekFirstDate);
14836
14908
  const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;
14837
14909
  const dates = [];
@@ -14843,9 +14915,11 @@ function getDates(displayMonths, maxDate, props, dateLib) {
14843
14915
  dates.push(date);
14844
14916
  }
14845
14917
  // If fixed weeks is enabled, add the extra dates to the array
14846
- const extraDates = NrOfDaysWithFixedWeeks * nOfMonths;
14918
+ const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;
14919
+ const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
14847
14920
  if (fixedWeeks && dates.length < extraDates) {
14848
- for (let i = 0; i < 7; i++) {
14921
+ const daysToAdd = extraDates - dates.length;
14922
+ for (let i = 0; i < daysToAdd; i++) {
14849
14923
  const date = addDays(dates[dates.length - 1], 1);
14850
14924
  dates.push(date);
14851
14925
  }
@@ -14956,25 +15030,29 @@ displayMonths, /** The dates to display in the calendar. */
14956
15030
  dates, /** Options from the props context. */
14957
15031
  props, dateLib) {
14958
15032
  const {
14959
- startOfWeek,
14960
- endOfWeek,
14961
- startOfISOWeek,
15033
+ addDays,
15034
+ endOfBroadcastWeek,
14962
15035
  endOfISOWeek,
14963
15036
  endOfMonth,
14964
- addDays,
15037
+ endOfWeek,
15038
+ getISOWeek,
14965
15039
  getWeek,
14966
- getISOWeek
15040
+ startOfBroadcastWeek,
15041
+ startOfISOWeek,
15042
+ startOfWeek
14967
15043
  } = dateLib;
14968
15044
  const dayPickerMonths = displayMonths.reduce((months, month) => {
14969
- const firstDateOfFirstWeek = props.ISOWeek ? startOfISOWeek(month) : startOfWeek(month);
14970
- const lastDateOfLastWeek = props.ISOWeek ? endOfISOWeek(endOfMonth(month)) : endOfWeek(endOfMonth(month));
15045
+ const firstDateOfFirstWeek = props.broadcastCalendar ? startOfBroadcastWeek(month, dateLib) : props.ISOWeek ? startOfISOWeek(month) : startOfWeek(month);
15046
+ const lastDateOfLastWeek = props.broadcastCalendar ? endOfBroadcastWeek(month, dateLib) : props.ISOWeek ? endOfISOWeek(endOfMonth(month)) : endOfWeek(endOfMonth(month));
14971
15047
  /** The dates to display in the month. */
14972
15048
  const monthDates = dates.filter(date => {
14973
15049
  return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
14974
15050
  });
14975
- if (props.fixedWeeks && monthDates.length < 42) {
15051
+ const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;
15052
+ if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
14976
15053
  const extraDates = dates.filter(date => {
14977
- return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, 7);
15054
+ const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;
15055
+ return date > lastDateOfLastWeek && date <= addDays(lastDateOfLastWeek, daysToAdd);
14978
15056
  });
14979
15057
  monthDates.push(...extraDates);
14980
15058
  }
@@ -15412,27 +15490,30 @@ function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
15412
15490
  /** Return the next date that should be focused. */
15413
15491
  function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
15414
15492
  const {
15415
- ISOWeek
15493
+ ISOWeek,
15494
+ broadcastCalendar
15416
15495
  } = props;
15417
15496
  const {
15418
15497
  addDays,
15419
15498
  addMonths,
15420
- addYears,
15421
15499
  addWeeks,
15422
- startOfISOWeek,
15500
+ addYears,
15501
+ endOfBroadcastWeek,
15423
15502
  endOfISOWeek,
15424
- startOfWeek,
15425
15503
  endOfWeek,
15426
15504
  max,
15427
- min
15505
+ min,
15506
+ startOfBroadcastWeek,
15507
+ startOfISOWeek,
15508
+ startOfWeek
15428
15509
  } = dateLib;
15429
15510
  const moveFns = {
15430
15511
  day: addDays,
15431
15512
  week: addWeeks,
15432
15513
  month: addMonths,
15433
15514
  year: addYears,
15434
- startOfWeek: date => ISOWeek ? startOfISOWeek(date) : startOfWeek(date),
15435
- endOfWeek: date => ISOWeek ? endOfISOWeek(date) : endOfWeek(date)
15515
+ startOfWeek: date => broadcastCalendar ? startOfBroadcastWeek(date, dateLib) : ISOWeek ? startOfISOWeek(date) : startOfWeek(date),
15516
+ endOfWeek: date => broadcastCalendar ? endOfBroadcastWeek(date, dateLib) : ISOWeek ? endOfISOWeek(date) : endOfWeek(date)
15436
15517
  };
15437
15518
  let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
15438
15519
  if (moveDir === "before" && navStart) {
@@ -15498,6 +15579,8 @@ function useFocus(props, calendar, getModifiers, isSelected, dateLib) {
15498
15579
  /**
15499
15580
  * Return a function to get the modifiers for a given day.
15500
15581
  *
15582
+ * NOTE: this is not an hook, but a factory for `getModifiers`.
15583
+ *
15501
15584
  * @private
15502
15585
  */
15503
15586
  function useGetModifiers(days, props, dateLib) {
@@ -15506,12 +15589,19 @@ function useGetModifiers(days, props, dateLib) {
15506
15589
  hidden,
15507
15590
  modifiers,
15508
15591
  showOutsideDays,
15592
+ broadcastCalendar,
15509
15593
  today
15510
15594
  } = props;
15511
15595
  const {
15512
15596
  isSameDay,
15513
- isSameMonth
15597
+ isSameMonth,
15598
+ startOfMonth,
15599
+ isBefore,
15600
+ endOfMonth,
15601
+ isAfter
15514
15602
  } = dateLib;
15603
+ const startMonth = props.startMonth && startOfMonth(props.startMonth);
15604
+ const endMonth = props.endMonth && endOfMonth(props.endMonth);
15515
15605
  const internalModifiersMap = {
15516
15606
  [DayFlag.focused]: [],
15517
15607
  [DayFlag.outside]: [],
@@ -15520,20 +15610,18 @@ function useGetModifiers(days, props, dateLib) {
15520
15610
  [DayFlag.today]: []
15521
15611
  };
15522
15612
  const customModifiersMap = {};
15523
- const selectionModifiersMap = {
15524
- [SelectionState.range_end]: [],
15525
- [SelectionState.range_middle]: [],
15526
- [SelectionState.range_start]: [],
15527
- [SelectionState.selected]: []
15528
- };
15529
15613
  for (const day of days) {
15530
15614
  const {
15531
15615
  date,
15532
15616
  displayMonth
15533
15617
  } = day;
15534
15618
  const isOutside = Boolean(displayMonth && !isSameMonth(date, displayMonth));
15619
+ const isBeforeStartMonth = Boolean(startMonth && isBefore(date, startMonth));
15620
+ const isAfterEndMonth = Boolean(endMonth && isAfter(date, endMonth));
15535
15621
  const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));
15536
- const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || !showOutsideDays && isOutside;
15622
+ const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeStartMonth || isAfterEndMonth ||
15623
+ // Broadcast calendar will show outside days as default
15624
+ !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
15537
15625
  const isToday = isSameDay(date, today ?? (props.timeZone ? TZDate.tz(props.timeZone) : dateLib.Date ? new dateLib.Date() : new Date()));
15538
15626
  if (isOutside) internalModifiersMap.outside.push(day);
15539
15627
  if (isDisabled) internalModifiersMap.disabled.push(day);
@@ -15562,27 +15650,16 @@ function useGetModifiers(days, props, dateLib) {
15562
15650
  [DayFlag.outside]: false,
15563
15651
  [DayFlag.today]: false
15564
15652
  };
15565
- const selectionStates = {
15566
- [SelectionState.range_end]: false,
15567
- [SelectionState.range_middle]: false,
15568
- [SelectionState.range_start]: false,
15569
- [SelectionState.selected]: false
15570
- };
15571
15653
  const customModifiers = {};
15572
15654
  // Find the modifiers for the given day
15573
15655
  for (const name in internalModifiersMap) {
15574
15656
  const days = internalModifiersMap[name];
15575
15657
  dayFlags[name] = days.some(d => d === day);
15576
15658
  }
15577
- for (const name in selectionModifiersMap) {
15578
- const days = selectionModifiersMap[name];
15579
- selectionStates[name] = days.some(d => d === day);
15580
- }
15581
15659
  for (const name in customModifiersMap) {
15582
15660
  customModifiers[name] = customModifiersMap[name].some(d => d === day);
15583
15661
  }
15584
15662
  return {
15585
- ...selectionStates,
15586
15663
  ...dayFlags,
15587
15664
  // custom modifiers should override all the previous ones
15588
15665
  ...customModifiers
@@ -15987,7 +16064,7 @@ function DayPicker(props) {
15987
16064
  };
15988
16065
  const dateLib = new DateLib({
15989
16066
  locale,
15990
- weekStartsOn: props.weekStartsOn,
16067
+ weekStartsOn: props.broadcastCalendar ? 1 : props.weekStartsOn,
15991
16068
  firstWeekContainsDate: props.firstWeekContainsDate,
15992
16069
  useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
15993
16070
  useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens
@@ -16006,7 +16083,7 @@ function DayPicker(props) {
16006
16083
  ...props.classNames
16007
16084
  }
16008
16085
  };
16009
- }, [props.classNames, props.components, props.dateLib, props.firstWeekContainsDate, props.formatters, props.labels, props.locale, props.useAdditionalDayOfYearTokens, props.useAdditionalWeekYearTokens, props.weekStartsOn]);
16086
+ }, [props.classNames, props.components, props.dateLib, props.firstWeekContainsDate, props.formatters, props.labels, props.locale, props.useAdditionalDayOfYearTokens, props.useAdditionalWeekYearTokens, props.weekStartsOn, props.broadcastCalendar]);
16010
16087
  const {
16011
16088
  captionLayout,
16012
16089
  mode,
@@ -18784,6 +18861,8 @@ function LiveRegion(_ref) {
18784
18861
  // Hide element visually but keep it readable by screen readers
18785
18862
  const visuallyHidden = {
18786
18863
  position: 'fixed',
18864
+ top: 0,
18865
+ left: 0,
18787
18866
  width: 1,
18788
18867
  height: 1,
18789
18868
  margin: -1,
@@ -20076,6 +20155,9 @@ class AbstractPointerSensor {
20076
20155
  passive: false
20077
20156
  });
20078
20157
  this.listeners.add(events.end.name, this.handleEnd);
20158
+ if (events.cancel) {
20159
+ this.listeners.add(events.cancel.name, this.handleCancel);
20160
+ }
20079
20161
  this.windowListeners.add(EventName.Resize, this.handleCancel);
20080
20162
  this.windowListeners.add(EventName.DragStart, preventDefault);
20081
20163
  this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
@@ -20195,6 +20277,9 @@ class AbstractPointerSensor {
20195
20277
  }
20196
20278
  }
20197
20279
  const events = {
20280
+ cancel: {
20281
+ name: 'pointercancel'
20282
+ },
20198
20283
  move: {
20199
20284
  name: 'pointermove'
20200
20285
  },
@@ -20267,6 +20352,9 @@ MouseSensor.activators = [{
20267
20352
  }
20268
20353
  }];
20269
20354
  const events$2 = {
20355
+ cancel: {
20356
+ name: 'touchcancel'
20357
+ },
20270
20358
  move: {
20271
20359
  name: 'touchmove'
20272
20360
  },
@@ -20468,11 +20556,11 @@ function useScrollIntent(_ref2) {
20468
20556
  }, [disabled, delta, previousDelta]);
20469
20557
  }
20470
20558
  function useCachedNode(draggableNodes, id) {
20471
- const draggableNode = id !== null ? draggableNodes.get(id) : undefined;
20559
+ const draggableNode = id != null ? draggableNodes.get(id) : undefined;
20472
20560
  const node = draggableNode ? draggableNode.node.current : null;
20473
20561
  return useLazyMemo(cachedNode => {
20474
20562
  var _ref;
20475
- if (id === null) {
20563
+ if (id == null) {
20476
20564
  return null;
20477
20565
  } // In some cases, the draggable node can unmount while dragging
20478
20566
  // This is the case for virtualized lists. In those situations,
@@ -20680,7 +20768,26 @@ function useRect(element, measure, fallbackRect) {
20680
20768
  if (measure === void 0) {
20681
20769
  measure = defaultMeasure;
20682
20770
  }
20683
- const [rect, measureRect] = useReducer(reducer, null);
20771
+ const [rect, setRect] = useState(null);
20772
+ function measureRect() {
20773
+ setRect(currentRect => {
20774
+ if (!element) {
20775
+ return null;
20776
+ }
20777
+ if (element.isConnected === false) {
20778
+ var _ref;
20779
+
20780
+ // Fall back to last rect we measured if the element is
20781
+ // no longer connected to the DOM.
20782
+ return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
20783
+ }
20784
+ const newRect = measure(element);
20785
+ if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
20786
+ return currentRect;
20787
+ }
20788
+ return newRect;
20789
+ });
20790
+ }
20684
20791
  const mutationObserver = useMutationObserver({
20685
20792
  callback(records) {
20686
20793
  if (!element) {
@@ -20715,23 +20822,6 @@ function useRect(element, measure, fallbackRect) {
20715
20822
  }
20716
20823
  }, [element]);
20717
20824
  return rect;
20718
- function reducer(currentRect) {
20719
- if (!element) {
20720
- return null;
20721
- }
20722
- if (element.isConnected === false) {
20723
- var _ref;
20724
-
20725
- // Fall back to last rect we measured if the element is
20726
- // no longer connected to the DOM.
20727
- return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
20728
- }
20729
- const newRect = measure(element);
20730
- if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
20731
- return currentRect;
20732
- }
20733
- return newRect;
20734
- }
20735
20825
  }
20736
20826
  function useRectDelta(rect) {
20737
20827
  const initialRect = useInitialValue(rect);
@@ -20877,28 +20967,24 @@ function useRects(elements, measure) {
20877
20967
  }
20878
20968
  const [firstElement] = elements;
20879
20969
  const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
20880
- const [rects, measureRects] = useReducer(reducer, defaultValue$2);
20970
+ const [rects, setRects] = useState(defaultValue$2);
20971
+ function measureRects() {
20972
+ setRects(() => {
20973
+ if (!elements.length) {
20974
+ return defaultValue$2;
20975
+ }
20976
+ return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
20977
+ });
20978
+ }
20881
20979
  const resizeObserver = useResizeObserver({
20882
20980
  callback: measureRects
20883
20981
  });
20884
- if (elements.length > 0 && rects === defaultValue$2) {
20885
- measureRects();
20886
- }
20887
20982
  useIsomorphicLayoutEffect$1(() => {
20888
- if (elements.length) {
20889
- elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));
20890
- } else {
20891
- resizeObserver == null ? void 0 : resizeObserver.disconnect();
20892
- measureRects();
20893
- }
20983
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
20984
+ measureRects();
20985
+ elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));
20894
20986
  }, [elements]);
20895
20987
  return rects;
20896
- function reducer() {
20897
- if (!elements.length) {
20898
- return defaultValue$2;
20899
- }
20900
- return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
20901
- }
20902
20988
  }
20903
20989
  function getMeasurableNode(node) {
20904
20990
  if (!node) {
@@ -21065,7 +21151,7 @@ function reducer$1(state, action) {
21065
21151
  }
21066
21152
  };
21067
21153
  case Action.DragMove:
21068
- if (!state.draggable.active) {
21154
+ if (state.draggable.active == null) {
21069
21155
  return state;
21070
21156
  }
21071
21157
  return {
@@ -21337,7 +21423,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21337
21423
  containers: droppableContainers
21338
21424
  }
21339
21425
  } = state;
21340
- const node = activeId ? draggableNodes.get(activeId) : null;
21426
+ const node = activeId != null ? draggableNodes.get(activeId) : null;
21341
21427
  const activeRects = useRef({
21342
21428
  initial: null,
21343
21429
  translated: null
@@ -21372,7 +21458,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21372
21458
  const autoScrollOptions = getAutoScrollerOptions();
21373
21459
  const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
21374
21460
  useLayoutShiftScrollCompensation({
21375
- activeNode: activeId ? draggableNodes.get(activeId) : null,
21461
+ activeNode: activeId != null ? draggableNodes.get(activeId) : null,
21376
21462
  config: autoScrollOptions.layoutShiftCompensation,
21377
21463
  initialRect: initialActiveNodeRect,
21378
21464
  measure: measuringConfiguration.draggable.measure
@@ -21450,6 +21536,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21450
21536
 
21451
21537
  const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
21452
21538
  const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
21539
+ const activeSensorRef = useRef(null);
21453
21540
  const instantiateSensor = useCallback((event, _ref2) => {
21454
21541
  let {
21455
21542
  sensor: Sensor,
@@ -21484,6 +21571,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21484
21571
  onDragStart
21485
21572
  } = latestProps.current;
21486
21573
  const event = {
21574
+ activatorEvent,
21487
21575
  active: {
21488
21576
  id,
21489
21577
  data: draggableNode.data,
@@ -21502,6 +21590,8 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21502
21590
  type: 'onDragStart',
21503
21591
  event
21504
21592
  });
21593
+ setActiveSensor(activeSensorRef.current);
21594
+ setActivatorEvent(activatorEvent);
21505
21595
  });
21506
21596
  },
21507
21597
  onMove(coordinates) {
@@ -21513,10 +21603,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21513
21603
  onEnd: createHandler(Action.DragEnd),
21514
21604
  onCancel: createHandler(Action.DragCancel)
21515
21605
  });
21516
- unstable_batchedUpdates(() => {
21517
- setActiveSensor(sensorInstance);
21518
- setActivatorEvent(event.nativeEvent);
21519
- });
21606
+ activeSensorRef.current = sensorInstance;
21520
21607
  function createHandler(type) {
21521
21608
  return async function handler() {
21522
21609
  const {
@@ -21553,6 +21640,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21553
21640
  setOver(null);
21554
21641
  setActiveSensor(null);
21555
21642
  setActivatorEvent(null);
21643
+ activeSensorRef.current = null;
21556
21644
  const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';
21557
21645
  if (event) {
21558
21646
  const handler = latestProps.current[eventName];
@@ -21774,7 +21862,7 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
21774
21862
  });
21775
21863
  const NullContext = /*#__PURE__*/createContext$1(null);
21776
21864
  const defaultRole = 'button';
21777
- const ID_PREFIX$1 = 'Droppable';
21865
+ const ID_PREFIX$1 = 'Draggable';
21778
21866
  function useDraggable(_ref) {
21779
21867
  let {
21780
21868
  id,
@@ -21921,7 +22009,7 @@ function useDroppable(_ref) {
21921
22009
  resizeObserverConnected.current = false;
21922
22010
  resizeObserver.observe(nodeRef.current);
21923
22011
  }, [nodeRef, resizeObserver]);
21924
- useIsomorphicLayoutEffect$1(() => {
22012
+ useEffect(() => {
21925
22013
  dispatch({
21926
22014
  type: Action.RegisterDroppable,
21927
22015
  element: {
@@ -22336,6 +22424,7 @@ var DNDCore = /*#__PURE__*/Object.freeze({
22336
22424
  defaultCoordinates: defaultCoordinates,
22337
22425
  defaultDropAnimation: defaultDropAnimationConfiguration,
22338
22426
  defaultDropAnimationSideEffects: defaultDropAnimationSideEffects,
22427
+ defaultKeyboardCoordinateGetter: defaultKeyboardCoordinateGetter,
22339
22428
  defaultScreenReaderInstructions: defaultScreenReaderInstructions,
22340
22429
  getClientRect: getClientRect,
22341
22430
  getFirstCollision: getFirstCollision,