@mui/lab 5.0.0-alpha.51 → 5.0.0-alpha.55
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/CHANGELOG.md +287 -6
- package/CalendarPicker/CalendarPicker.d.ts +10 -0
- package/CalendarPicker/CalendarPicker.js +13 -1
- package/CalendarPicker/PickersCalendar.d.ts +2 -0
- package/CalendarPicker/PickersCalendar.js +9 -3
- package/CalendarPicker/PickersCalendarHeader.d.ts +1 -0
- package/CalendarPicker/PickersCalendarHeader.js +5 -4
- package/CalendarPicker/PickersFadeTransitionGroup.js +3 -3
- package/CalendarPicker/PickersSlideTransition.js +1 -1
- package/CalendarPickerSkeleton/CalendarPickerSkeleton.d.ts +2 -1
- package/CalendarPickerSkeleton/CalendarPickerSkeleton.js +2 -2
- package/ClockPicker/ClockNumber.js +1 -1
- package/ClockPicker/ClockPicker.js +1 -1
- package/DatePicker/DatePicker.js +2 -0
- package/DatePicker/DatePickerToolbar.js +1 -1
- package/DateRangePicker/DateRangePicker.js +2 -0
- package/DateRangePicker/DateRangePickerToolbar.js +1 -1
- package/DateRangePickerDay/DateRangePickerDay.js +2 -2
- package/DateTimePicker/DateTimePicker.js +2 -0
- package/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +2 -0
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -0
- package/LoadingButton/LoadingButton.js +56 -13
- package/LoadingButton/loadingButtonClasses.js +1 -1
- package/Masonry/Masonry.d.ts +13 -1
- package/Masonry/Masonry.js +232 -60
- package/Masonry/masonryClasses.js +1 -1
- package/MobileDatePicker/MobileDatePicker.js +2 -0
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -0
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -0
- package/MonthPicker/MonthPicker.d.ts +4 -0
- package/MonthPicker/MonthPicker.js +23 -6
- package/MonthPicker/PickersMonth.js +19 -14
- package/PickersDay/PickersDay.js +2 -2
- package/StaticDatePicker/StaticDatePicker.js +2 -0
- package/StaticDateRangePicker/StaticDateRangePicker.js +2 -0
- package/StaticDateTimePicker/StaticDateTimePicker.js +2 -0
- package/TabPanel/TabPanel.js +2 -2
- package/TabPanel/tabPanelClasses.js +1 -1
- package/TimePicker/TimePickerToolbar.js +1 -1
- package/Timeline/Timeline.js +2 -2
- package/Timeline/timelineClasses.js +1 -1
- package/TimelineConnector/TimelineConnector.js +2 -2
- package/TimelineConnector/timelineConnectorClasses.js +1 -1
- package/TimelineContent/TimelineContent.js +2 -2
- package/TimelineContent/timelineContentClasses.js +1 -1
- package/TimelineDot/TimelineDot.js +2 -2
- package/TimelineDot/timelineDotClasses.js +1 -1
- package/TimelineItem/TimelineItem.js +2 -2
- package/TimelineItem/timelineItemClasses.js +1 -1
- package/TimelineOppositeContent/TimelineOppositeContent.js +2 -2
- package/TimelineOppositeContent/timelineOppositeContentClasses.js +1 -1
- package/TimelineSeparator/TimelineSeparator.js +2 -2
- package/TimelineSeparator/timelineSeparatorClasses.js +1 -1
- package/TreeItem/TreeItem.js +2 -2
- package/TreeItem/treeItemClasses.js +1 -1
- package/TreeView/TreeView.js +2 -2
- package/TreeView/treeViewClasses.js +1 -1
- package/YearPicker/PickersYear.js +2 -2
- package/YearPicker/YearPicker.d.ts +2 -0
- package/YearPicker/YearPicker.js +18 -2
- package/YearPicker/yearPickerClasses.js +1 -1
- package/index.js +1 -1
- package/internal/pickers/Picker/Picker.d.ts +1 -1
- package/internal/pickers/Picker/PickerView.d.ts +1 -1
- package/internal/pickers/PickersArrowSwitcher.d.ts +2 -2
- package/internal/pickers/PickersArrowSwitcher.js +1 -3
- package/internal/pickers/PickersToolbar.js +1 -1
- package/internal/pickers/PickersToolbarText.js +1 -1
- package/internal/pickers/test-utils.js +14 -7
- package/legacy/CalendarPicker/CalendarPicker.js +13 -1
- package/legacy/CalendarPicker/PickersCalendar.js +10 -3
- package/legacy/CalendarPicker/PickersCalendarHeader.js +5 -4
- package/legacy/CalendarPicker/PickersFadeTransitionGroup.js +4 -6
- package/legacy/CalendarPicker/PickersSlideTransition.js +1 -1
- package/legacy/CalendarPickerSkeleton/CalendarPickerSkeleton.js +2 -2
- package/legacy/ClockPicker/ClockNumber.js +1 -1
- package/legacy/ClockPicker/ClockPicker.js +1 -1
- package/legacy/DatePicker/DatePicker.js +2 -0
- package/legacy/DatePicker/DatePickerToolbar.js +1 -1
- package/legacy/DateRangePicker/DateRangePicker.js +2 -0
- package/legacy/DateRangePicker/DateRangePickerToolbar.js +1 -1
- package/legacy/DateRangePickerDay/DateRangePickerDay.js +2 -2
- package/legacy/DateTimePicker/DateTimePicker.js +2 -0
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -0
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -0
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -0
- package/legacy/LoadingButton/LoadingButton.js +55 -15
- package/legacy/LoadingButton/loadingButtonClasses.js +1 -1
- package/legacy/Masonry/Masonry.js +241 -58
- package/legacy/Masonry/masonryClasses.js +1 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +2 -0
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +2 -0
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -0
- package/legacy/MonthPicker/MonthPicker.js +22 -5
- package/legacy/MonthPicker/PickersMonth.js +20 -15
- package/legacy/PickersDay/PickersDay.js +2 -2
- package/legacy/StaticDatePicker/StaticDatePicker.js +2 -0
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +2 -0
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -0
- package/legacy/TabPanel/TabPanel.js +2 -2
- package/legacy/TabPanel/tabPanelClasses.js +1 -1
- package/legacy/TimePicker/TimePickerToolbar.js +1 -1
- package/legacy/Timeline/Timeline.js +2 -2
- package/legacy/Timeline/timelineClasses.js +1 -1
- package/legacy/TimelineConnector/TimelineConnector.js +2 -2
- package/legacy/TimelineConnector/timelineConnectorClasses.js +1 -1
- package/legacy/TimelineContent/TimelineContent.js +2 -2
- package/legacy/TimelineContent/timelineContentClasses.js +1 -1
- package/legacy/TimelineDot/TimelineDot.js +2 -2
- package/legacy/TimelineDot/timelineDotClasses.js +1 -1
- package/legacy/TimelineItem/TimelineItem.js +2 -2
- package/legacy/TimelineItem/timelineItemClasses.js +1 -1
- package/legacy/TimelineOppositeContent/TimelineOppositeContent.js +2 -2
- package/legacy/TimelineOppositeContent/timelineOppositeContentClasses.js +1 -1
- package/legacy/TimelineSeparator/TimelineSeparator.js +2 -2
- package/legacy/TimelineSeparator/timelineSeparatorClasses.js +1 -1
- package/legacy/TreeItem/TreeItem.js +2 -2
- package/legacy/TreeItem/treeItemClasses.js +1 -1
- package/legacy/TreeView/TreeView.js +2 -2
- package/legacy/TreeView/treeViewClasses.js +1 -1
- package/legacy/YearPicker/PickersYear.js +2 -2
- package/legacy/YearPicker/YearPicker.js +18 -2
- package/legacy/YearPicker/yearPickerClasses.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internal/pickers/PickersArrowSwitcher.js +1 -3
- package/legacy/internal/pickers/PickersToolbar.js +1 -1
- package/legacy/internal/pickers/PickersToolbarText.js +1 -1
- package/legacy/internal/pickers/test-utils.js +11 -8
- package/legacy/useAutocomplete/index.js +1 -1
- package/modern/CalendarPicker/CalendarPicker.js +13 -1
- package/modern/CalendarPicker/PickersCalendar.js +9 -3
- package/modern/CalendarPicker/PickersCalendarHeader.js +5 -4
- package/modern/CalendarPicker/PickersFadeTransitionGroup.js +3 -3
- package/modern/CalendarPicker/PickersSlideTransition.js +1 -1
- package/modern/CalendarPickerSkeleton/CalendarPickerSkeleton.js +2 -2
- package/modern/ClockPicker/ClockNumber.js +1 -1
- package/modern/ClockPicker/ClockPicker.js +1 -1
- package/modern/DatePicker/DatePicker.js +2 -0
- package/modern/DatePicker/DatePickerToolbar.js +1 -1
- package/modern/DateRangePicker/DateRangePicker.js +2 -0
- package/modern/DateRangePicker/DateRangePickerToolbar.js +1 -1
- package/modern/DateRangePickerDay/DateRangePickerDay.js +2 -2
- package/modern/DateTimePicker/DateTimePicker.js +2 -0
- package/modern/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -0
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -0
- package/modern/LoadingButton/LoadingButton.js +56 -13
- package/modern/LoadingButton/loadingButtonClasses.js +1 -1
- package/modern/Masonry/Masonry.js +228 -60
- package/modern/Masonry/masonryClasses.js +1 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -0
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -0
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -0
- package/modern/MonthPicker/MonthPicker.js +23 -6
- package/modern/MonthPicker/PickersMonth.js +19 -14
- package/modern/PickersDay/PickersDay.js +2 -2
- package/modern/StaticDatePicker/StaticDatePicker.js +2 -0
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -0
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -0
- package/modern/TabPanel/TabPanel.js +2 -2
- package/modern/TabPanel/tabPanelClasses.js +1 -1
- package/modern/TimePicker/TimePickerToolbar.js +1 -1
- package/modern/Timeline/Timeline.js +2 -2
- package/modern/Timeline/timelineClasses.js +1 -1
- package/modern/TimelineConnector/TimelineConnector.js +2 -2
- package/modern/TimelineConnector/timelineConnectorClasses.js +1 -1
- package/modern/TimelineContent/TimelineContent.js +2 -2
- package/modern/TimelineContent/timelineContentClasses.js +1 -1
- package/modern/TimelineDot/TimelineDot.js +2 -2
- package/modern/TimelineDot/timelineDotClasses.js +1 -1
- package/modern/TimelineItem/TimelineItem.js +2 -2
- package/modern/TimelineItem/timelineItemClasses.js +1 -1
- package/modern/TimelineOppositeContent/TimelineOppositeContent.js +2 -2
- package/modern/TimelineOppositeContent/timelineOppositeContentClasses.js +1 -1
- package/modern/TimelineSeparator/TimelineSeparator.js +2 -2
- package/modern/TimelineSeparator/timelineSeparatorClasses.js +1 -1
- package/modern/TreeItem/TreeItem.js +2 -2
- package/modern/TreeItem/treeItemClasses.js +1 -1
- package/modern/TreeView/TreeView.js +2 -2
- package/modern/TreeView/treeViewClasses.js +1 -1
- package/modern/YearPicker/PickersYear.js +2 -2
- package/modern/YearPicker/YearPicker.js +18 -2
- package/modern/YearPicker/yearPickerClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internal/pickers/PickersArrowSwitcher.js +1 -3
- package/modern/internal/pickers/PickersToolbar.js +1 -1
- package/modern/internal/pickers/PickersToolbarText.js +1 -1
- package/modern/internal/pickers/test-utils.js +14 -7
- package/modern/useAutocomplete/index.js +1 -1
- package/node/CalendarPicker/CalendarPicker.js +16 -4
- package/node/CalendarPicker/PickersCalendar.js +9 -3
- package/node/CalendarPicker/PickersCalendarHeader.js +5 -4
- package/node/CalendarPicker/PickersFadeTransitionGroup.js +4 -4
- package/node/CalendarPicker/PickersSlideTransition.js +2 -2
- package/node/CalendarPickerSkeleton/CalendarPickerSkeleton.js +5 -5
- package/node/ClockPicker/ClockNumber.js +2 -2
- package/node/ClockPicker/ClockPicker.js +4 -4
- package/node/DatePicker/DatePicker.js +2 -0
- package/node/DatePicker/DatePickerToolbar.js +2 -2
- package/node/DateRangePicker/DateRangePicker.js +2 -0
- package/node/DateRangePicker/DateRangePickerToolbar.js +2 -2
- package/node/DateRangePickerDay/DateRangePickerDay.js +5 -5
- package/node/DateTimePicker/DateTimePicker.js +2 -0
- package/node/DateTimePicker/DateTimePickerToolbar.js +2 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +2 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -0
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -0
- package/node/LoadingButton/LoadingButton.js +57 -14
- package/node/LoadingButton/loadingButtonClasses.js +3 -3
- package/node/Masonry/Masonry.js +237 -65
- package/node/Masonry/masonryClasses.js +3 -3
- package/node/MobileDatePicker/MobileDatePicker.js +2 -0
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -0
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -0
- package/node/MonthPicker/MonthPicker.js +26 -9
- package/node/MonthPicker/PickersMonth.js +20 -15
- package/node/PickersDay/PickersDay.js +5 -5
- package/node/StaticDatePicker/StaticDatePicker.js +2 -0
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -0
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +2 -0
- package/node/TabPanel/TabPanel.js +3 -3
- package/node/TabPanel/tabPanelClasses.js +3 -3
- package/node/TimePicker/TimePickerToolbar.js +4 -4
- package/node/Timeline/Timeline.js +3 -3
- package/node/Timeline/timelineClasses.js +3 -3
- package/node/TimelineConnector/TimelineConnector.js +3 -3
- package/node/TimelineConnector/timelineConnectorClasses.js +3 -3
- package/node/TimelineContent/TimelineContent.js +3 -3
- package/node/TimelineContent/timelineContentClasses.js +3 -3
- package/node/TimelineDot/TimelineDot.js +3 -3
- package/node/TimelineDot/timelineDotClasses.js +3 -3
- package/node/TimelineItem/TimelineItem.js +3 -3
- package/node/TimelineItem/timelineItemClasses.js +3 -3
- package/node/TimelineOppositeContent/TimelineOppositeContent.js +3 -3
- package/node/TimelineOppositeContent/timelineOppositeContentClasses.js +3 -3
- package/node/TimelineSeparator/TimelineSeparator.js +3 -3
- package/node/TimelineSeparator/timelineSeparatorClasses.js +3 -3
- package/node/TreeItem/TreeItem.js +3 -3
- package/node/TreeItem/treeItemClasses.js +3 -3
- package/node/TreeView/TreeView.js +3 -3
- package/node/TreeView/treeViewClasses.js +3 -3
- package/node/YearPicker/PickersYear.js +5 -5
- package/node/YearPicker/YearPicker.js +19 -3
- package/node/YearPicker/yearPickerClasses.js +3 -3
- package/node/index.js +1 -1
- package/node/internal/pickers/PickersArrowSwitcher.js +1 -3
- package/node/internal/pickers/PickersToolbar.js +2 -2
- package/node/internal/pickers/PickersToolbarText.js +2 -2
- package/node/internal/pickers/test-utils.js +14 -7
- package/node/useAutocomplete/index.js +3 -3
- package/package.json +6 -5
- package/useAutocomplete/index.d.ts +1 -1
- package/useAutocomplete/index.js +1 -1
- package/Masonry/MasonryContext.js +0 -12
- package/MasonryItem/MasonryItem.d.ts +0 -49
- package/MasonryItem/MasonryItem.js +0 -196
- package/MasonryItem/index.d.ts +0 -5
- package/MasonryItem/index.js +0 -3
- package/MasonryItem/masonryItemClasses.d.ts +0 -8
- package/MasonryItem/masonryItemClasses.js +0 -6
- package/MasonryItem/package.json +0 -6
- package/legacy/Masonry/MasonryContext.js +0 -12
- package/legacy/MasonryItem/MasonryItem.js +0 -201
- package/legacy/MasonryItem/index.js +0 -3
- package/legacy/MasonryItem/masonryItemClasses.js +0 -6
- package/modern/Masonry/MasonryContext.js +0 -12
- package/modern/MasonryItem/MasonryItem.js +0 -196
- package/modern/MasonryItem/index.js +0 -3
- package/modern/MasonryItem/masonryItemClasses.js +0 -6
- package/node/Masonry/MasonryContext.js +0 -24
- package/node/MasonryItem/MasonryItem.js +0 -220
- package/node/MasonryItem/index.js +0 -42
- package/node/MasonryItem/masonryItemClasses.js +0 -17
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { alpha, styled } from '@mui/material/styles';
|
|
8
|
-
import { unstable_composeClasses as composeClasses, generateUtilityClass, generateUtilityClasses } from '@mui/
|
|
8
|
+
import { unstable_composeClasses as composeClasses, generateUtilityClass, generateUtilityClasses } from '@mui/base';
|
|
9
9
|
import { DAY_MARGIN } from '../internal/pickers/constants/dimensions';
|
|
10
10
|
import { useUtils } from '../internal/pickers/hooks/useUtils';
|
|
11
11
|
import PickersDay, { areDayPropsEqual } from '../PickersDay/PickersDay';
|
|
@@ -228,7 +228,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDay.propTypes
|
|
|
228
228
|
/**
|
|
229
229
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
230
230
|
*/
|
|
231
|
-
sx: PropTypes.object
|
|
231
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object])), PropTypes.func, PropTypes.object])
|
|
232
232
|
} : void 0;
|
|
233
233
|
/**
|
|
234
234
|
*
|
|
@@ -172,6 +172,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes
|
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* If `true`, the picker and text field are disabled.
|
|
175
|
+
* @default false
|
|
175
176
|
*/
|
|
176
177
|
disabled: PropTypes.bool,
|
|
177
178
|
|
|
@@ -415,6 +416,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes
|
|
|
415
416
|
|
|
416
417
|
/**
|
|
417
418
|
* Make picker read only.
|
|
419
|
+
* @default false
|
|
418
420
|
*/
|
|
419
421
|
readOnly: PropTypes.bool,
|
|
420
422
|
|
|
@@ -6,7 +6,7 @@ var _DateTimePickerToolba, _DateTimePickerToolba2;
|
|
|
6
6
|
const _excluded = ["ampm", "date", "dateRangeIcon", "hideTabs", "isMobileKeyboardViewOpen", "onChange", "openView", "setOpenView", "timeIcon", "toggleMobileKeyboardView", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "views"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import { generateUtilityClasses } from '@mui/
|
|
9
|
+
import { generateUtilityClasses } from '@mui/base';
|
|
10
10
|
import PickersToolbarText from '../internal/pickers/PickersToolbarText';
|
|
11
11
|
import PickersToolbar from '../internal/pickers/PickersToolbar';
|
|
12
12
|
import PickersToolbarButton from '../internal/pickers/PickersToolbarButton';
|
|
@@ -134,6 +134,7 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* If `true`, the picker and text field are disabled.
|
|
137
|
+
* @default false
|
|
137
138
|
*/
|
|
138
139
|
disabled: PropTypes.bool,
|
|
139
140
|
|
|
@@ -319,6 +320,7 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes
|
|
|
319
320
|
|
|
320
321
|
/**
|
|
321
322
|
* Make picker read only.
|
|
323
|
+
* @default false
|
|
322
324
|
*/
|
|
323
325
|
readOnly: PropTypes.bool,
|
|
324
326
|
|
|
@@ -181,6 +181,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes
|
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
183
|
* If `true`, the picker and text field are disabled.
|
|
184
|
+
* @default false
|
|
184
185
|
*/
|
|
185
186
|
disabled: PropTypes.bool,
|
|
186
187
|
|
|
@@ -365,6 +366,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes
|
|
|
365
366
|
|
|
366
367
|
/**
|
|
367
368
|
* Make picker read only.
|
|
369
|
+
* @default false
|
|
368
370
|
*/
|
|
369
371
|
readOnly: PropTypes.bool,
|
|
370
372
|
|
|
@@ -149,6 +149,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes
|
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* If `true`, the picker and text field are disabled.
|
|
152
|
+
* @default false
|
|
152
153
|
*/
|
|
153
154
|
disabled: PropTypes.bool,
|
|
154
155
|
|
|
@@ -386,6 +387,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes
|
|
|
386
387
|
|
|
387
388
|
/**
|
|
388
389
|
* Make picker read only.
|
|
390
|
+
* @default false
|
|
389
391
|
*/
|
|
390
392
|
readOnly: PropTypes.bool,
|
|
391
393
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["children", "disabled", "loading", "loadingIndicator", "loadingPosition"];
|
|
3
|
+
const _excluded = ["children", "disabled", "loading", "loadingIndicator", "loadingPosition", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { chainPropTypes } from '@mui/utils';
|
|
7
7
|
import { capitalize } from '@mui/material/utils';
|
|
8
|
-
import { unstable_composeClasses as composeClasses } from '@mui/
|
|
8
|
+
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
9
9
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import Button from '@mui/material/Button';
|
|
11
11
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
@@ -60,6 +60,22 @@ const LoadingButtonRoot = styled(Button, {
|
|
|
60
60
|
[`&.${loadingButtonClasses.loading}`]: {
|
|
61
61
|
color: 'transparent'
|
|
62
62
|
}
|
|
63
|
+
}, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
|
|
64
|
+
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
65
|
+
transition: theme.transitions.create(['opacity'], {
|
|
66
|
+
duration: theme.transitions.duration.short
|
|
67
|
+
}),
|
|
68
|
+
opacity: 0,
|
|
69
|
+
marginRight: -8
|
|
70
|
+
}
|
|
71
|
+
}, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
|
|
72
|
+
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
73
|
+
transition: theme.transitions.create(['opacity'], {
|
|
74
|
+
duration: theme.transitions.duration.short
|
|
75
|
+
}),
|
|
76
|
+
opacity: 0,
|
|
77
|
+
marginLeft: -8
|
|
78
|
+
}
|
|
63
79
|
}));
|
|
64
80
|
const LoadingButtonLoadingIndicator = styled('div', {
|
|
65
81
|
name: 'MuiLoadingButton',
|
|
@@ -77,14 +93,24 @@ const LoadingButtonLoadingIndicator = styled('div', {
|
|
|
77
93
|
position: 'absolute',
|
|
78
94
|
visibility: 'visible',
|
|
79
95
|
display: 'flex'
|
|
80
|
-
}, ownerState.loadingPosition === 'start' && {
|
|
96
|
+
}, ownerState.loadingPosition === 'start' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
|
|
81
97
|
left: 14
|
|
98
|
+
}, ownerState.loadingPosition === 'start' && ownerState.variant === 'text' && {
|
|
99
|
+
left: 6
|
|
82
100
|
}, ownerState.loadingPosition === 'center' && {
|
|
83
101
|
left: '50%',
|
|
84
102
|
transform: 'translate(-50%)',
|
|
85
103
|
color: theme.palette.action.disabled
|
|
86
|
-
}, ownerState.loadingPosition === 'end' && {
|
|
104
|
+
}, ownerState.loadingPosition === 'end' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
|
|
87
105
|
right: 14
|
|
106
|
+
}, ownerState.loadingPosition === 'end' && ownerState.variant === 'text' && {
|
|
107
|
+
right: 6
|
|
108
|
+
}, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
|
|
109
|
+
position: 'relative',
|
|
110
|
+
left: -10
|
|
111
|
+
}, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
|
|
112
|
+
position: 'relative',
|
|
113
|
+
right: -10
|
|
88
114
|
}));
|
|
89
115
|
|
|
90
116
|
const LoadingIndicator = /*#__PURE__*/_jsx(CircularProgress, {
|
|
@@ -103,7 +129,8 @@ const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inPro
|
|
|
103
129
|
disabled = false,
|
|
104
130
|
loading = false,
|
|
105
131
|
loadingIndicator = LoadingIndicator,
|
|
106
|
-
loadingPosition = 'center'
|
|
132
|
+
loadingPosition = 'center',
|
|
133
|
+
variant = 'text'
|
|
107
134
|
} = props,
|
|
108
135
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
109
136
|
|
|
@@ -111,21 +138,31 @@ const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inPro
|
|
|
111
138
|
disabled,
|
|
112
139
|
loading,
|
|
113
140
|
loadingIndicator,
|
|
114
|
-
loadingPosition
|
|
141
|
+
loadingPosition,
|
|
142
|
+
variant
|
|
115
143
|
});
|
|
116
144
|
|
|
117
145
|
const classes = useUtilityClasses(ownerState);
|
|
118
|
-
return /*#__PURE__*/
|
|
146
|
+
return /*#__PURE__*/_jsx(LoadingButtonRoot, _extends({
|
|
119
147
|
disabled: disabled || loading,
|
|
120
148
|
ref: ref
|
|
121
149
|
}, other, {
|
|
150
|
+
variant: variant,
|
|
122
151
|
classes: classes,
|
|
123
152
|
ownerState: ownerState,
|
|
124
|
-
children:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
153
|
+
children: ownerState.loadingPosition === 'end' ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
154
|
+
children: [children, loading && /*#__PURE__*/_jsx(LoadingButtonLoadingIndicator, {
|
|
155
|
+
className: classes.loadingIndicator,
|
|
156
|
+
ownerState: ownerState,
|
|
157
|
+
children: loadingIndicator
|
|
158
|
+
})]
|
|
159
|
+
}) : /*#__PURE__*/_jsxs(React.Fragment, {
|
|
160
|
+
children: [loading && /*#__PURE__*/_jsx(LoadingButtonLoadingIndicator, {
|
|
161
|
+
className: classes.loadingIndicator,
|
|
162
|
+
ownerState: ownerState,
|
|
163
|
+
children: loadingIndicator
|
|
164
|
+
}), children]
|
|
165
|
+
})
|
|
129
166
|
}));
|
|
130
167
|
});
|
|
131
168
|
process.env.NODE_ENV !== "production" ? LoadingButton.propTypes
|
|
@@ -183,6 +220,12 @@ process.env.NODE_ENV !== "production" ? LoadingButton.propTypes
|
|
|
183
220
|
/**
|
|
184
221
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
185
222
|
*/
|
|
186
|
-
sx: PropTypes.object
|
|
223
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object])), PropTypes.func, PropTypes.object]),
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The variant to use.
|
|
227
|
+
* @default 'text'
|
|
228
|
+
*/
|
|
229
|
+
variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
|
|
187
230
|
} : void 0;
|
|
188
231
|
export default LoadingButton;
|
package/Masonry/Masonry.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { MasonryClasses } from './masonryClasses';
|
|
|
6
6
|
export interface MasonryTypeMap<P = {}, D extends React.ElementType = 'div'> {
|
|
7
7
|
props: P & {
|
|
8
8
|
/**
|
|
9
|
-
* The content of the component.
|
|
9
|
+
* The content of the component.
|
|
10
10
|
*/
|
|
11
11
|
children: NonNullable<React.ReactNode>;
|
|
12
12
|
/**
|
|
@@ -18,6 +18,18 @@ export interface MasonryTypeMap<P = {}, D extends React.ElementType = 'div'> {
|
|
|
18
18
|
* @default 4
|
|
19
19
|
*/
|
|
20
20
|
columns?: ResponsiveStyleValue<number | string>;
|
|
21
|
+
/**
|
|
22
|
+
* The default number of columns of the component. This is provided for server-side rendering.
|
|
23
|
+
*/
|
|
24
|
+
defaultColumns?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The default height of the component in px. This is provided for server-side rendering.
|
|
27
|
+
*/
|
|
28
|
+
defaultHeight?: number;
|
|
29
|
+
/**
|
|
30
|
+
* The default spacing of the component. Like `spacing`, it is a factor of the theme's spacing. This is provided for server-side rendering.
|
|
31
|
+
*/
|
|
32
|
+
defaultSpacing?: number;
|
|
21
33
|
/**
|
|
22
34
|
* Defines the space between children. It is a factor of the theme's spacing.
|
|
23
35
|
* @default 1
|
package/Masonry/Masonry.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["children", "className", "component", "columns", "spacing"];
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import clsx from 'clsx';
|
|
3
|
+
const _excluded = ["children", "className", "component", "columns", "spacing", "defaultColumns", "defaultHeight", "defaultSpacing"];
|
|
4
|
+
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
5
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
6
|
import { createUnarySpacing, getValue, handleBreakpoints, unstable_resolveBreakpointValues as resolveBreakpointValues } from '@mui/system';
|
|
8
7
|
import { deepmerge, unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import * as React from 'react';
|
|
11
11
|
import { getMasonryUtilityClass } from './masonryClasses';
|
|
12
|
-
import MasonryContext from './MasonryContext';
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
export const parseToNumber = val => {
|
|
15
|
+
return Number(val.replace('px', ''));
|
|
16
|
+
};
|
|
14
17
|
|
|
15
18
|
const useUtilityClasses = ownerState => {
|
|
16
19
|
const {
|
|
@@ -22,54 +25,104 @@ const useUtilityClasses = ownerState => {
|
|
|
22
25
|
return composeClasses(slots, getMasonryUtilityClass, classes);
|
|
23
26
|
};
|
|
24
27
|
|
|
25
|
-
export const
|
|
28
|
+
export const getStyle = ({
|
|
26
29
|
ownerState,
|
|
27
30
|
theme
|
|
28
31
|
}) => {
|
|
29
32
|
let styles = {
|
|
30
|
-
display: 'grid',
|
|
31
|
-
gridAutoRows: 0,
|
|
32
|
-
padding: 0,
|
|
33
|
-
overflow: 'auto',
|
|
34
33
|
width: '100%',
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexFlow: 'column wrap',
|
|
36
|
+
alignContent: 'space-between',
|
|
37
|
+
boxSizing: 'border-box',
|
|
38
|
+
'& > *': {
|
|
39
|
+
boxSizing: 'border-box'
|
|
40
|
+
}
|
|
37
41
|
};
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const stylesSSR = {};
|
|
43
|
+
|
|
44
|
+
if (ownerState.isSSR) {
|
|
45
|
+
const orderStyleSSR = {};
|
|
46
|
+
const defaultSpacing = Number(theme.spacing(ownerState.defaultSpacing).replace('px', ''));
|
|
47
|
+
|
|
48
|
+
for (let i = 1; i <= ownerState.defaultColumns; i += 1) {
|
|
49
|
+
orderStyleSSR[`&:nth-of-type(${ownerState.defaultColumns}n+${i % ownerState.defaultColumns})`] = {
|
|
50
|
+
order: i
|
|
51
|
+
};
|
|
42
52
|
}
|
|
43
|
-
|
|
53
|
+
|
|
54
|
+
stylesSSR.height = ownerState.defaultHeight;
|
|
55
|
+
stylesSSR.margin = -(defaultSpacing / 2);
|
|
56
|
+
stylesSSR['& > *'] = _extends({}, styles['& > *'], orderStyleSSR, {
|
|
57
|
+
margin: defaultSpacing / 2,
|
|
58
|
+
width: `calc(${(100 / ownerState.defaultColumns).toFixed(2)}% - ${defaultSpacing}px)`
|
|
59
|
+
});
|
|
60
|
+
return _extends({}, styles, stylesSSR);
|
|
61
|
+
}
|
|
62
|
+
|
|
44
63
|
const spacingValues = resolveBreakpointValues({
|
|
45
64
|
values: ownerState.spacing,
|
|
46
|
-
|
|
65
|
+
breakpoints: theme.breakpoints.values
|
|
47
66
|
});
|
|
48
67
|
const transformer = createUnarySpacing(theme);
|
|
49
68
|
|
|
50
69
|
const spacingStyleFromPropValue = propValue => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
const themeSpacingValue = Number(propValue);
|
|
71
|
+
const spacing = Number(getValue(transformer, themeSpacingValue).replace('px', ''));
|
|
72
|
+
return _extends({
|
|
73
|
+
margin: -(spacing / 2),
|
|
74
|
+
'& > *': {
|
|
75
|
+
margin: spacing / 2
|
|
76
|
+
}
|
|
77
|
+
}, ownerState.maxColumnHeight && {
|
|
78
|
+
height: Math.ceil(ownerState.maxColumnHeight + spacing)
|
|
79
|
+
});
|
|
54
80
|
};
|
|
55
81
|
|
|
56
|
-
styles =
|
|
82
|
+
styles = deepmerge(styles, handleBreakpoints({
|
|
57
83
|
theme
|
|
58
84
|
}, spacingValues, spacingStyleFromPropValue));
|
|
59
85
|
const columnValues = resolveBreakpointValues({
|
|
60
86
|
values: ownerState.columns,
|
|
61
|
-
|
|
87
|
+
breakpoints: theme.breakpoints.values
|
|
62
88
|
});
|
|
63
89
|
|
|
64
90
|
const columnStyleFromPropValue = propValue => {
|
|
91
|
+
const columnValue = Number(propValue);
|
|
92
|
+
const width = `${(100 / columnValue).toFixed(2)}%`;
|
|
93
|
+
const spacing = typeof spacingValues !== 'object' ? getValue(transformer, Number(spacingValues)) : '0px';
|
|
65
94
|
return {
|
|
66
|
-
|
|
95
|
+
'& > *': {
|
|
96
|
+
width: `calc(${width} - ${spacing})`
|
|
97
|
+
}
|
|
67
98
|
};
|
|
68
99
|
};
|
|
69
100
|
|
|
70
101
|
styles = deepmerge(styles, handleBreakpoints({
|
|
71
102
|
theme
|
|
72
|
-
}, columnValues, columnStyleFromPropValue));
|
|
103
|
+
}, columnValues, columnStyleFromPropValue)); // configure width for responsive spacing values
|
|
104
|
+
|
|
105
|
+
if (typeof spacingValues === 'object') {
|
|
106
|
+
styles = deepmerge(styles, handleBreakpoints({
|
|
107
|
+
theme
|
|
108
|
+
}, spacingValues, (propValue, breakpoint) => {
|
|
109
|
+
if (breakpoint) {
|
|
110
|
+
const themeSpacingValue = Number(propValue);
|
|
111
|
+
const lastBreakpoint = Object.keys(columnValues).pop();
|
|
112
|
+
const spacing = getValue(transformer, themeSpacingValue);
|
|
113
|
+
const column = typeof columnValues === 'object' ? columnValues[breakpoint] || columnValues[lastBreakpoint] : columnValues;
|
|
114
|
+
const width = `${(100 / column).toFixed(2)}%`;
|
|
115
|
+
return {
|
|
116
|
+
'& > *': {
|
|
117
|
+
width: `calc(${width} - ${spacing})`
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return null;
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
|
|
73
126
|
return styles;
|
|
74
127
|
};
|
|
75
128
|
const MasonryRoot = styled('div', {
|
|
@@ -78,61 +131,165 @@ const MasonryRoot = styled('div', {
|
|
|
78
131
|
overridesResolver: (props, styles) => {
|
|
79
132
|
return [styles.root];
|
|
80
133
|
}
|
|
81
|
-
})(
|
|
134
|
+
})(getStyle);
|
|
82
135
|
const Masonry = /*#__PURE__*/React.forwardRef(function Masonry(inProps, ref) {
|
|
83
136
|
const props = useThemeProps({
|
|
84
137
|
props: inProps,
|
|
85
138
|
name: 'MuiMasonry'
|
|
86
139
|
});
|
|
87
|
-
const masonryRef = React.useRef();
|
|
88
140
|
|
|
89
141
|
const {
|
|
90
142
|
children,
|
|
91
143
|
className,
|
|
92
144
|
component = 'div',
|
|
93
145
|
columns = 4,
|
|
94
|
-
spacing = 1
|
|
146
|
+
spacing = 1,
|
|
147
|
+
defaultColumns,
|
|
148
|
+
defaultHeight,
|
|
149
|
+
defaultSpacing
|
|
95
150
|
} = props,
|
|
96
151
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
97
152
|
|
|
153
|
+
const masonryRef = React.useRef();
|
|
154
|
+
const [maxColumnHeight, setMaxColumnHeight] = React.useState();
|
|
155
|
+
const isSSR = !maxColumnHeight && defaultHeight && defaultColumns !== undefined && defaultSpacing !== undefined;
|
|
156
|
+
const [numberOfLineBreaks, setNumberOfLineBreaks] = React.useState(isSSR ? defaultColumns - 1 : 0);
|
|
157
|
+
|
|
98
158
|
const ownerState = _extends({}, props, {
|
|
99
159
|
spacing,
|
|
100
|
-
columns
|
|
160
|
+
columns,
|
|
161
|
+
maxColumnHeight,
|
|
162
|
+
defaultColumns,
|
|
163
|
+
defaultHeight,
|
|
164
|
+
defaultSpacing,
|
|
165
|
+
isSSR
|
|
101
166
|
});
|
|
102
167
|
|
|
103
168
|
const classes = useUtilityClasses(ownerState);
|
|
104
|
-
const contextValue = React.useMemo(() => ({
|
|
105
|
-
spacing
|
|
106
|
-
}), [spacing]);
|
|
107
|
-
let didWarn = false;
|
|
108
|
-
React.useEffect(() => {
|
|
109
|
-
// scroller always appears when masonry's height goes beyond 2,000px on Chrome
|
|
110
|
-
const handleScroll = () => {
|
|
111
|
-
if (masonryRef.current.clientHeight === 1998 && !didWarn) {
|
|
112
|
-
console.warn(['MUI: The Masonry can have the maximum height of 2,000px on Chrome browser.', 'Items that go beyond this height fail to be rendered on Chrome browser.', 'You can find more in this open issue: https://github.com/mui-org/material-ui/issues/27934'].join('\n')); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
169
|
|
|
114
|
-
|
|
170
|
+
const handleResize = elements => {
|
|
171
|
+
if (!elements) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let masonry;
|
|
176
|
+
let masonryFirstChild;
|
|
177
|
+
let parentWidth;
|
|
178
|
+
let childWidth;
|
|
179
|
+
|
|
180
|
+
if (elements[0].target.className.includes(classes.root)) {
|
|
181
|
+
var _elements$, _masonryFirstChild, _masonryFirstChild$co, _masonryFirstChild2;
|
|
182
|
+
|
|
183
|
+
masonry = elements[0].target;
|
|
184
|
+
parentWidth = elements[0].contentRect.width;
|
|
185
|
+
masonryFirstChild = ((_elements$ = elements[1]) == null ? void 0 : _elements$.target) || masonry.firstChild;
|
|
186
|
+
childWidth = ((_masonryFirstChild = masonryFirstChild) == null ? void 0 : (_masonryFirstChild$co = _masonryFirstChild.contentRect) == null ? void 0 : _masonryFirstChild$co.width) || ((_masonryFirstChild2 = masonryFirstChild) == null ? void 0 : _masonryFirstChild2.clientWidth) || 0;
|
|
187
|
+
} else {
|
|
188
|
+
var _elements$2, _masonry$contentRect;
|
|
189
|
+
|
|
190
|
+
masonryFirstChild = elements[0].target;
|
|
191
|
+
childWidth = elements[0].contentRect.width;
|
|
192
|
+
masonry = ((_elements$2 = elements[1]) == null ? void 0 : _elements$2.target) || masonryFirstChild.parentElement;
|
|
193
|
+
parentWidth = ((_masonry$contentRect = masonry.contentRect) == null ? void 0 : _masonry$contentRect.width) || masonry.clientWidth;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (parentWidth === 0 || childWidth === 0 || !masonry || !masonryFirstChild) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const firstChildComputedStyle = window.getComputedStyle(masonryFirstChild);
|
|
201
|
+
const firstChildMarginLeft = parseToNumber(firstChildComputedStyle.marginLeft);
|
|
202
|
+
const firstChildMarginRight = parseToNumber(firstChildComputedStyle.marginRight);
|
|
203
|
+
const currentNumberOfColumns = Math.round(parentWidth / (childWidth + firstChildMarginLeft + firstChildMarginRight));
|
|
204
|
+
const columnHeights = new Array(currentNumberOfColumns).fill(0);
|
|
205
|
+
let skip = false;
|
|
206
|
+
masonry.childNodes.forEach(child => {
|
|
207
|
+
if (child.nodeType !== Node.ELEMENT_NODE || child.dataset.class === 'line-break' || skip) {
|
|
208
|
+
return;
|
|
115
209
|
}
|
|
116
|
-
|
|
210
|
+
|
|
211
|
+
const childComputedStyle = window.getComputedStyle(child);
|
|
212
|
+
const childMarginTop = parseToNumber(childComputedStyle.marginTop);
|
|
213
|
+
const childMarginBottom = parseToNumber(childComputedStyle.marginBottom); // if any one of children isn't rendered yet, masonry's height shouldn't be computed yet
|
|
214
|
+
|
|
215
|
+
const childHeight = parseToNumber(childComputedStyle.height) ? Math.ceil(parseToNumber(childComputedStyle.height)) + childMarginTop + childMarginBottom : 0;
|
|
216
|
+
|
|
217
|
+
if (childHeight === 0) {
|
|
218
|
+
skip = true;
|
|
219
|
+
return;
|
|
220
|
+
} // if there is a nested image that isn't rendered yet, masonry's height shouldn't be computed yet
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
for (let i = 0; i < child.childNodes.length; i += 1) {
|
|
224
|
+
const nestedChild = child.childNodes[i];
|
|
225
|
+
|
|
226
|
+
if (nestedChild.tagName === 'IMG' && nestedChild.clientHeight === 0) {
|
|
227
|
+
skip = true;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (!skip) {
|
|
233
|
+
// find the current shortest column (where the current item will be placed)
|
|
234
|
+
const currentMinColumnIndex = columnHeights.indexOf(Math.min(...columnHeights));
|
|
235
|
+
columnHeights[currentMinColumnIndex] += childHeight;
|
|
236
|
+
const order = currentMinColumnIndex + 1;
|
|
237
|
+
child.style.order = order;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
if (!skip) {
|
|
242
|
+
setMaxColumnHeight(Math.max(...columnHeights));
|
|
243
|
+
const numOfLineBreaks = currentNumberOfColumns > 0 ? currentNumberOfColumns - 1 : 0;
|
|
244
|
+
setNumberOfLineBreaks(numOfLineBreaks);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const observer = React.useRef(typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(handleResize));
|
|
249
|
+
React.useEffect(() => {
|
|
250
|
+
const resizeObserver = observer.current; // IE and old browsers are not supported
|
|
251
|
+
|
|
252
|
+
if (resizeObserver === undefined) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
117
255
|
|
|
118
256
|
const container = masonryRef.current;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
container
|
|
122
|
-
|
|
123
|
-
|
|
257
|
+
|
|
258
|
+
if (container && resizeObserver) {
|
|
259
|
+
// only the masonry container and its first child are observed for resizing;
|
|
260
|
+
// this might cause unforeseen problems in some use cases;
|
|
261
|
+
resizeObserver.observe(container);
|
|
262
|
+
|
|
263
|
+
if (container.firstChild) {
|
|
264
|
+
resizeObserver.observe(container.firstChild);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return () => resizeObserver ? resizeObserver.disconnect() : {};
|
|
269
|
+
}, [columns, spacing, children]);
|
|
124
270
|
const handleRef = useForkRef(ref, masonryRef);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
271
|
+
const lineBreakStyle = {
|
|
272
|
+
flexBasis: '100%',
|
|
273
|
+
width: 0,
|
|
274
|
+
margin: 0,
|
|
275
|
+
padding: 0
|
|
276
|
+
}; // columns are likely to have different heights and hence can start to merge;
|
|
277
|
+
// a line break at the end of each column prevents columns from merging
|
|
278
|
+
|
|
279
|
+
const lineBreaks = new Array(numberOfLineBreaks).fill('').map((_, index) => /*#__PURE__*/_jsx("span", {
|
|
280
|
+
"data-class": "line-break",
|
|
281
|
+
style: _extends({}, lineBreakStyle, {
|
|
282
|
+
order: index + 1
|
|
283
|
+
})
|
|
284
|
+
}, index));
|
|
285
|
+
return /*#__PURE__*/_jsxs(MasonryRoot, _extends({
|
|
286
|
+
as: component,
|
|
287
|
+
className: clsx(classes.root, className),
|
|
288
|
+
ref: handleRef,
|
|
289
|
+
ownerState: ownerState
|
|
290
|
+
}, other, {
|
|
291
|
+
children: [children, lineBreaks]
|
|
292
|
+
}));
|
|
136
293
|
});
|
|
137
294
|
process.env.NODE_ENV !== "production" ? Masonry.propTypes
|
|
138
295
|
/* remove-proptypes */
|
|
@@ -143,7 +300,7 @@ process.env.NODE_ENV !== "production" ? Masonry.propTypes
|
|
|
143
300
|
// ----------------------------------------------------------------------
|
|
144
301
|
|
|
145
302
|
/**
|
|
146
|
-
* The content of the component.
|
|
303
|
+
* The content of the component.
|
|
147
304
|
*/
|
|
148
305
|
children: PropTypes
|
|
149
306
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -171,6 +328,21 @@ process.env.NODE_ENV !== "production" ? Masonry.propTypes
|
|
|
171
328
|
*/
|
|
172
329
|
component: PropTypes.elementType,
|
|
173
330
|
|
|
331
|
+
/**
|
|
332
|
+
* The default number of columns of the component. This is provided for server-side rendering.
|
|
333
|
+
*/
|
|
334
|
+
defaultColumns: PropTypes.number,
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* The default height of the component in px. This is provided for server-side rendering.
|
|
338
|
+
*/
|
|
339
|
+
defaultHeight: PropTypes.number,
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* The default spacing of the component. Like `spacing`, it is a factor of the theme's spacing. This is provided for server-side rendering.
|
|
343
|
+
*/
|
|
344
|
+
defaultSpacing: PropTypes.number,
|
|
345
|
+
|
|
174
346
|
/**
|
|
175
347
|
* Defines the space between children. It is a factor of the theme's spacing.
|
|
176
348
|
* @default 1
|
|
@@ -180,6 +352,6 @@ process.env.NODE_ENV !== "production" ? Masonry.propTypes
|
|
|
180
352
|
/**
|
|
181
353
|
* Allows defining system overrides as well as additional CSS styles.
|
|
182
354
|
*/
|
|
183
|
-
sx: PropTypes.object
|
|
355
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object])), PropTypes.func, PropTypes.object])
|
|
184
356
|
} : void 0;
|
|
185
357
|
export default Masonry;
|
|
@@ -152,6 +152,7 @@ process.env.NODE_ENV !== "production" ? MobileDatePicker.propTypes
|
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* If `true`, the picker and text field are disabled.
|
|
155
|
+
* @default false
|
|
155
156
|
*/
|
|
156
157
|
disabled: PropTypes.bool,
|
|
157
158
|
|
|
@@ -333,6 +334,7 @@ process.env.NODE_ENV !== "production" ? MobileDatePicker.propTypes
|
|
|
333
334
|
|
|
334
335
|
/**
|
|
335
336
|
* Make picker read only.
|
|
337
|
+
* @default false
|
|
336
338
|
*/
|
|
337
339
|
readOnly: PropTypes.bool,
|
|
338
340
|
|