@koine/react 1.0.11 → 1.0.12
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/Alert/Alert.js +7 -13
- package/Animations/Reveal.js +12 -10
- package/Animations/Underline.js +3 -13
- package/Animations/useReveal.js +18 -17
- package/Autocomplete/AutocompleteDownshift.js +1 -1
- package/Autocomplete/AutocompleteDownshiftMultiselect.js +1 -1
- package/Autocomplete/AutocompleteMui.js +61 -56
- package/Autocomplete/AutocompleteReach.js +1 -1
- package/Autocomplete/components.js +17 -72
- package/Autocomplete/helpers.js +1 -1
- package/Bg/BgColor.js +14 -24
- package/Bg/BgPhoto.js +11 -54
- package/Bg/BgSvg.js +6 -9
- package/Breadcrumbs/Breadcrumbs.js +14 -54
- package/Buttons/Button.js +8 -73
- package/Buttons/ButtonComposite.js +20 -41
- package/Buttons/ButtonFab.js +4 -6
- package/Buttons/ButtonLink.js +7 -6
- package/Buttons/IconButton.js +5 -17
- package/Calendar/CalendarDaygridCell.js +20 -14
- package/Calendar/CalendarDaygridNav.js +10 -9
- package/Calendar/CalendarDaygridTable.js +32 -30
- package/Calendar/CalendarLegend.js +7 -2
- package/Calendar/calendar-api-google.js +101 -68
- package/Calendar/useCalendar.js +114 -113
- package/Calendar/utils.js +73 -74
- package/Carousel/Carousel.js +1 -1
- package/Carousel/CarouselCss.js +12 -26
- package/Collapsable/Collapsable.js +1 -1
- package/Debug/Debug.js +5 -17
- package/Details/Details.js +30 -27
- package/Dialog/DialogMui.js +22 -20
- package/Dialog/css/bare.js +17 -15
- package/Dialog/m/bare.js +17 -13
- package/Dialog/m/basic.js +2 -2
- package/Dialog/m/index.js +4 -4
- package/Dialog/sc/bare.js +25 -43
- package/Dialog/sc/framer.js +6 -6
- package/Dialog/sc/framerMaterial.js +6 -6
- package/Dialog/sc/material.js +17 -37
- package/Dialog/tw/bare.js +25 -19
- package/Dialog/tw/elegant.js +17 -15
- package/Dialog/tw/framer.js +6 -6
- package/Dialog/tw/framerMaterial.js +6 -6
- package/Dialog/tw/material.js +17 -15
- package/Editor/Editor--tiptap.js +14 -11
- package/Editor/components.js +6 -24
- package/Favicon/FaviconTags.js +2 -1
- package/Form/Form.js +30 -28
- package/Form/sc/bare.js +9 -18
- package/Forms/Checkbox/Checkbox.js +9 -15
- package/Forms/Feedback/Feedback.js +6 -7
- package/Forms/Field/Field.js +15 -26
- package/Forms/Field/FieldControl.js +19 -15
- package/Forms/Field/FieldHint.js +3 -5
- package/Forms/Input/Input.js +10 -16
- package/Forms/InputGroup/InputGroup.js +9 -36
- package/Forms/Label/Label.js +5 -23
- package/Forms/Password/Password.js +10 -23
- package/Forms/Radio/Radio.js +15 -18
- package/Forms/Switch/Switch.js +9 -39
- package/Forms/Textarea/Textarea.js +6 -7
- package/Forms/Textarea/TextareaRich.js +10 -24
- package/Forms/Toggle/Toggle.js +19 -67
- package/Forms/Toggle/useToggle.js +29 -29
- package/Forms/antispam.js +12 -12
- package/Forms/helpers.js +7 -6
- package/Forms/styles.js +12 -43
- package/Gauge/Gauge.js +1 -1
- package/Grid/Grid.js +25 -51
- package/Hamburger/Hamburger.js +35 -47
- package/Header/useHeader.js +12 -12
- package/Hidden/Hidden.js +9 -13
- package/Img/sc/bare.js +3 -1
- package/Link/Link.js +3 -1
- package/Link/LinkBlank.js +8 -17
- package/Menu/Menu.js +3 -10
- package/MenuItem/MenuItem.js +3 -19
- package/Meta/Meta.js +3 -2
- package/NoJs/NoJs.js +2 -2
- package/Pagination/PaginationNav.js +26 -48
- package/Pagination/PaginationResults.js +7 -6
- package/Pill/Pill.js +6 -36
- package/Progress/ProgressCircular.js +9 -30
- package/Progress/ProgressLinear.js +8 -16
- package/Progress/ProgressOverlay.js +11 -27
- package/Rating/Rating.js +24 -44
- package/Rating/index.js +19 -15
- package/Select/SelectDownshift.js +1 -1
- package/Select/components.js +6 -12
- package/Sidebar/Sidebar.js +13 -38
- package/Spacing/Spacing.js +12 -12
- package/Sticky/Sticky.js +1 -1
- package/Sticky/StickyCss.js +4 -2
- package/Tabs/TabsMui.js +19 -16
- package/Tabs/tw/bare.js +13 -11
- package/Tabs/tw/material.js +15 -11
- package/Tabs/useTabs.js +16 -16
- package/Typography/CopyPasteVisible.js +3 -5
- package/Typography/Native.js +12 -45
- package/Typography/ReadMore.js +25 -51
- package/Typography/TextLoop.js +19 -22
- package/Typography/TypeStairs.js +20 -16
- package/helpers/classed.js +21 -18
- package/helpers/extend-component.js +6 -6
- package/hooks/useAsyncFn.js +18 -11
- package/hooks/useDateLocale.js +22 -13
- package/hooks/useEffectOnce.js +1 -1
- package/hooks/useFirstMountState.js +1 -1
- package/hooks/useFocus.js +3 -3
- package/hooks/useId.js +3 -2
- package/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/hooks/useMount.js +2 -2
- package/hooks/useMountedState.js +4 -4
- package/hooks/usePrevious.js +2 -2
- package/hooks/useScrollPosition.js +20 -15
- package/hooks/useScrollTo.js +7 -5
- package/hooks/useTraceUpdate.js +4 -3
- package/hooks/useUpdateEffect.js +3 -3
- package/hooks/useWindowSize.js +3 -3
- package/m/MotionProvider.js +4 -2
- package/node/Alert/Alert.js +9 -16
- package/node/Alert/index.js +1 -1
- package/node/Animations/Reveal.js +15 -13
- package/node/Animations/Underline.js +5 -16
- package/node/Animations/index.js +1 -1
- package/node/Animations/useReveal.js +19 -18
- package/node/Autocomplete/AutocompleteMui.js +69 -64
- package/node/Autocomplete/components.js +26 -82
- package/node/Autocomplete/helpers.js +2 -2
- package/node/Bg/BgColor.js +18 -29
- package/node/Bg/BgPhoto.js +15 -59
- package/node/Bg/BgSvg.js +8 -12
- package/node/Bg/index.js +1 -1
- package/node/Breadcrumbs/Breadcrumbs.js +20 -61
- package/node/Breadcrumbs/index.js +1 -1
- package/node/Buttons/Button.js +10 -76
- package/node/Buttons/ButtonComposite.js +23 -45
- package/node/Buttons/ButtonFab.js +6 -9
- package/node/Buttons/ButtonLink.js +10 -10
- package/node/Buttons/IconButton.js +7 -20
- package/node/Buttons/index.js +1 -1
- package/node/Calendar/CalendarDaygridCell.js +24 -18
- package/node/Calendar/CalendarDaygridNav.js +14 -13
- package/node/Calendar/CalendarDaygridTable.js +39 -38
- package/node/Calendar/CalendarLegend.js +8 -3
- package/node/Calendar/calendar-api-google.js +105 -73
- package/node/Calendar/index.js +1 -1
- package/node/Calendar/useCalendar.js +117 -116
- package/node/Calendar/utils.js +82 -84
- package/node/Carousel/CarouselCss.js +17 -32
- package/node/Carousel/index.js +1 -1
- package/node/Collapsable/index.js +1 -1
- package/node/Debug/Debug.js +7 -20
- package/node/Debug/index.js +1 -1
- package/node/Details/Details.js +24 -22
- package/node/Details/index.js +1 -1
- package/node/Dialog/DialogMui.js +12 -11
- package/node/Dialog/css/bare.js +11 -10
- package/node/Dialog/m/bare.js +18 -14
- package/node/Dialog/m/basic.js +1 -1
- package/node/Dialog/m/index.js +4 -4
- package/node/Dialog/sc/bare.js +22 -41
- package/node/Dialog/sc/framer.js +5 -5
- package/node/Dialog/sc/framerMaterial.js +5 -5
- package/node/Dialog/sc/material.js +12 -33
- package/node/Dialog/tw/bare.js +19 -14
- package/node/Dialog/tw/elegant.js +11 -9
- package/node/Dialog/tw/framer.js +5 -5
- package/node/Dialog/tw/framerMaterial.js +5 -5
- package/node/Dialog/tw/material.js +11 -9
- package/node/Editor/Editor--tiptap.js +19 -17
- package/node/Editor/components.js +9 -28
- package/node/Editor/index.js +1 -1
- package/node/Favicon/FaviconTags.js +3 -2
- package/node/Favicon/index.js +1 -1
- package/node/Form/Form.js +20 -18
- package/node/Form/index.js +1 -1
- package/node/Form/sc/bare.js +12 -22
- package/node/Forms/Checkbox/Checkbox.js +13 -20
- package/node/Forms/Checkbox/index.js +1 -1
- package/node/Forms/Feedback/Feedback.js +8 -10
- package/node/Forms/Feedback/index.js +1 -1
- package/node/Forms/Field/Field.js +18 -30
- package/node/Forms/Field/FieldControl.js +26 -22
- package/node/Forms/Field/FieldHint.js +4 -7
- package/node/Forms/Field/index.js +1 -1
- package/node/Forms/Input/Input.js +15 -22
- package/node/Forms/Input/index.js +1 -1
- package/node/Forms/InputGroup/InputGroup.js +14 -42
- package/node/Forms/InputGroup/index.js +1 -1
- package/node/Forms/Label/Label.js +6 -25
- package/node/Forms/Label/index.js +1 -1
- package/node/Forms/Password/Password.js +16 -30
- package/node/Forms/Password/index.js +1 -1
- package/node/Forms/Radio/Radio.js +21 -25
- package/node/Forms/Radio/index.js +1 -1
- package/node/Forms/Switch/Switch.js +15 -46
- package/node/Forms/Switch/index.js +1 -1
- package/node/Forms/Textarea/Textarea.js +11 -13
- package/node/Forms/Textarea/TextareaRich.js +16 -31
- package/node/Forms/Textarea/index.js +1 -1
- package/node/Forms/Toggle/Toggle.js +23 -72
- package/node/Forms/Toggle/index.js +1 -1
- package/node/Forms/Toggle/useToggle.js +33 -33
- package/node/Forms/antispam.js +14 -14
- package/node/Forms/helpers.js +8 -7
- package/node/Forms/index.js +1 -1
- package/node/Forms/styles.js +16 -48
- package/node/Gauge/Gauge.js +1 -1
- package/node/Grid/Grid.js +24 -51
- package/node/Grid/index.js +1 -1
- package/node/Hamburger/Hamburger.js +37 -50
- package/node/Hamburger/index.js +1 -1
- package/node/Header/index.js +1 -1
- package/node/Header/useHeader.js +16 -16
- package/node/Hidden/Hidden.js +10 -15
- package/node/Hidden/index.js +1 -1
- package/node/Img/index.js +1 -1
- package/node/Img/sc/bare.js +4 -3
- package/node/Link/Link.js +4 -3
- package/node/Link/LinkBlank.js +11 -21
- package/node/Link/index.js +1 -1
- package/node/Menu/Menu.js +4 -12
- package/node/Menu/index.js +1 -1
- package/node/MenuItem/MenuItem.js +4 -21
- package/node/MenuItem/index.js +1 -1
- package/node/Meta/Meta.js +4 -3
- package/node/Meta/index.js +1 -1
- package/node/NoJs/NoJs.js +3 -3
- package/node/NoJs/index.js +1 -1
- package/node/Pagination/PaginationNav.js +30 -53
- package/node/Pagination/PaginationResults.js +10 -10
- package/node/Pagination/index.js +1 -1
- package/node/Pill/Pill.js +7 -38
- package/node/Pill/index.js +1 -1
- package/node/Progress/ProgressCircular.js +11 -33
- package/node/Progress/ProgressLinear.js +11 -20
- package/node/Progress/ProgressOverlay.js +18 -35
- package/node/Progress/index.js +1 -1
- package/node/Rating/Rating.js +28 -49
- package/node/Rating/index.js +20 -16
- package/node/Select/components.js +11 -18
- package/node/Sidebar/Sidebar.js +21 -47
- package/node/Sidebar/index.js +1 -1
- package/node/Spacing/Spacing.js +16 -17
- package/node/Spacing/index.js +1 -1
- package/node/Sticky/StickyCss.js +5 -3
- package/node/Sticky/index.js +1 -1
- package/node/Tabs/TabsMui.js +16 -14
- package/node/Tabs/index.js +1 -1
- package/node/Tabs/tw/bare.js +9 -8
- package/node/Tabs/tw/material.js +11 -7
- package/node/Tabs/useTabs.js +19 -19
- package/node/Typography/CopyPasteVisible.js +4 -7
- package/node/Typography/Native.js +14 -48
- package/node/Typography/ReadMore.js +30 -57
- package/node/Typography/TextLoop.js +22 -25
- package/node/Typography/TypeStairs.js +22 -18
- package/node/Typography/index.js +1 -1
- package/node/css/index.js +1 -1
- package/node/helpers/classed.js +22 -19
- package/node/helpers/extend-component.js +7 -7
- package/node/helpers/index.js +1 -1
- package/node/hooks/index.js +1 -1
- package/node/hooks/useAsyncFn.js +20 -13
- package/node/hooks/useDateLocale.js +23 -37
- package/node/hooks/useEffectOnce.js +2 -2
- package/node/hooks/useFirstMountState.js +2 -2
- package/node/hooks/useFocus.js +4 -4
- package/node/hooks/useId.js +4 -3
- package/node/hooks/useIsomorphicLayoutEffect.js +2 -2
- package/node/hooks/useMount.js +3 -3
- package/node/hooks/useMountedState.js +5 -5
- package/node/hooks/usePrevious.js +3 -3
- package/node/hooks/useScrollPosition.js +23 -18
- package/node/hooks/useScrollTo.js +9 -7
- package/node/hooks/useTraceUpdate.js +5 -4
- package/node/hooks/useUpdateEffect.js +5 -5
- package/node/hooks/useWindowSize.js +4 -4
- package/node/index.js +1 -1
- package/node/m/MotionProvider.js +6 -4
- package/node/m/index.js +1 -1
- package/node/m/lite.js +1 -1
- package/node/m/max.js +1 -1
- package/node/sc/index.js +1 -1
- package/node/scm/index.js +1 -1
- package/node/shared/index.js +1 -1
- package/node/styles/Body.js +5 -10
- package/node/styles/Global.js +5 -37
- package/node/styles/index.js +1 -1
- package/node/styles/media.js +42 -38
- package/node/styles/spacing.js +15 -16
- package/node/styles/styled.js +7 -21
- package/node/styles/theme--vanilla.js +21 -19
- package/node/styles/theme.js +9 -9
- package/node/tw/index.js +1 -1
- package/node/twm/index.js +1 -1
- package/package.json +3 -2
- package/styles/Body.js +4 -8
- package/styles/Global.js +4 -36
- package/styles/media.js +41 -36
- package/styles/spacing.js +15 -16
- package/styles/styled.js +7 -21
- package/styles/theme--vanilla.js +20 -18
- package/styles/theme.js +11 -11
package/Calendar/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import isWithinInterval from "date-fns/isWithinInterval";
|
|
2
3
|
import endOfMonth from "date-fns/endOfMonth";
|
|
3
4
|
import startOfWeek from "date-fns/startOfWeek";
|
|
@@ -8,7 +9,7 @@ import subWeeks from "date-fns/subWeeks";
|
|
|
8
9
|
import addWeeks from "date-fns/addWeeks";
|
|
9
10
|
import addDays from "date-fns/addDays";
|
|
10
11
|
export function getEventTimestamp(dateLike) {
|
|
11
|
-
|
|
12
|
+
var date = new Date(dateLike);
|
|
12
13
|
date.setHours(0, 0, 0, 0);
|
|
13
14
|
return date.valueOf() / 1000;
|
|
14
15
|
}
|
|
@@ -29,7 +30,7 @@ export function getStartDate(date, view) {
|
|
|
29
30
|
return date;
|
|
30
31
|
}
|
|
31
32
|
export function getEndDate(start, view) {
|
|
32
|
-
|
|
33
|
+
var end = start;
|
|
33
34
|
if (view === "month") {
|
|
34
35
|
end = endOfMonth(start);
|
|
35
36
|
}
|
|
@@ -52,152 +53,150 @@ export function getNextDate(date, view) {
|
|
|
52
53
|
return addWeeks(date, 1);
|
|
53
54
|
}
|
|
54
55
|
export function isTodayInView(start, end) {
|
|
55
|
-
return isWithinInterval(new Date(), { start, end });
|
|
56
|
+
return isWithinInterval(new Date(), { start: start, end: end });
|
|
56
57
|
}
|
|
57
58
|
export function mergeCalendarEvents(first, second) {
|
|
58
|
-
|
|
59
|
+
var all = {};
|
|
59
60
|
addCalendarEvents(first, all);
|
|
60
61
|
addCalendarEvents(second, all);
|
|
61
62
|
return all;
|
|
62
63
|
}
|
|
63
64
|
export function addCalendarEvents(toAdd, toExtend) {
|
|
64
|
-
for (
|
|
65
|
-
|
|
66
|
-
toExtend[id] =
|
|
65
|
+
for (var id in toAdd) {
|
|
66
|
+
var event_1 = toAdd[id];
|
|
67
|
+
toExtend[id] = event_1;
|
|
67
68
|
}
|
|
68
69
|
return toExtend;
|
|
69
70
|
}
|
|
70
71
|
function getEventsByTimestamp(events) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
var output = {};
|
|
73
|
+
var _loop_1 = function (uid) {
|
|
74
|
+
var event_2 = events[uid];
|
|
75
|
+
event_2.days.forEach(function (timestamp) {
|
|
75
76
|
output[timestamp] = (output[timestamp] || {});
|
|
76
|
-
output[timestamp][uid] =
|
|
77
|
+
output[timestamp][uid] = event_2;
|
|
77
78
|
});
|
|
79
|
+
};
|
|
80
|
+
for (var uid in events) {
|
|
81
|
+
_loop_1(uid);
|
|
78
82
|
}
|
|
79
83
|
return output;
|
|
80
84
|
}
|
|
81
85
|
function getSortedEvents(events) {
|
|
82
|
-
|
|
83
|
-
for (
|
|
86
|
+
var output = [];
|
|
87
|
+
for (var uid in events) {
|
|
84
88
|
output.push(events[uid]);
|
|
85
89
|
}
|
|
86
90
|
// sort events first multi, then all day then by start then by created date
|
|
87
|
-
output.sort((a, b)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
output.sort(function (a, b) {
|
|
92
|
+
var multi = Number(b.multi) - Number(a.multi);
|
|
93
|
+
var allDay = Number(b.allDay) - Number(a.allDay);
|
|
94
|
+
var start = a.start.getTime() - b.start.getTime();
|
|
95
|
+
var created = a.created.getTime() - b.created.getTime();
|
|
92
96
|
return multi || allDay || start || created;
|
|
93
97
|
});
|
|
94
98
|
return output;
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
var FREE_SLOT = 0;
|
|
101
|
+
var BUSY_SLOT = 1;
|
|
98
102
|
export function processEventsInView(eventsMap, calendarView, month, weeks) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
props: { key:
|
|
103
|
+
var eventsByTimestamp = getEventsByTimestamp(eventsMap);
|
|
104
|
+
var eventsList = getSortedEvents(eventsMap);
|
|
105
|
+
var todayDate = new Date();
|
|
106
|
+
var todayTimestamp = getEventTimestamp(todayDate);
|
|
107
|
+
var startedAtTopMap = {};
|
|
108
|
+
var viewWeeks = [];
|
|
109
|
+
var _loop_2 = function (weekIdx) {
|
|
110
|
+
var viewWeek = {
|
|
111
|
+
props: { key: "week.".concat(weekIdx) },
|
|
108
112
|
days: [],
|
|
109
113
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
for (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
$isToday,
|
|
121
|
-
$isOutOfRange,
|
|
114
|
+
var weekStartDate = weeks[weekIdx];
|
|
115
|
+
var weekStartDay = weekStartDate.getDate();
|
|
116
|
+
var weekStartTimestamp = getEventTimestamp(new Date(weekStartDate));
|
|
117
|
+
var weekEndTimestamp = getEventTimestamp(addDays(new Date(weekStartDate), 6));
|
|
118
|
+
for (var dayNumber = 0; dayNumber < 7; dayNumber++) {
|
|
119
|
+
var dayDate = new Date(new Date(weekStartDate).setDate(weekStartDay + dayNumber));
|
|
120
|
+
var dayTimestamp = getEventTimestamp(dayDate);
|
|
121
|
+
var $isToday = todayTimestamp === dayTimestamp;
|
|
122
|
+
var $isOutOfRange = calendarView === "month" && dayDate.getMonth() !== month;
|
|
123
|
+
var contextualProps = {
|
|
124
|
+
$isToday: $isToday,
|
|
125
|
+
$isOutOfRange: $isOutOfRange,
|
|
122
126
|
};
|
|
123
|
-
|
|
124
|
-
props: { key:
|
|
127
|
+
var viewDay = {
|
|
128
|
+
props: __assign({ key: "day.".concat(dayTimestamp) }, contextualProps),
|
|
125
129
|
timestamp: dayTimestamp + "",
|
|
126
130
|
label: dayDate.getDate() + "",
|
|
127
131
|
events: [],
|
|
128
132
|
};
|
|
129
133
|
// check that we have events in this day
|
|
130
|
-
if (eventsByTimestamp
|
|
131
|
-
|
|
132
|
-
for (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (!
|
|
134
|
+
if (eventsByTimestamp === null || eventsByTimestamp === void 0 ? void 0 : eventsByTimestamp[dayTimestamp]) {
|
|
135
|
+
var verticalSlots = Object.keys(eventsByTimestamp[dayTimestamp]).map(function () { return FREE_SLOT; });
|
|
136
|
+
for (var eventIdx = 0; eventIdx < eventsList.length; eventIdx++) {
|
|
137
|
+
var event_3 = eventsList[eventIdx];
|
|
138
|
+
var width = 1;
|
|
139
|
+
var top_1 = 0;
|
|
140
|
+
var firstOfMulti = void 0;
|
|
141
|
+
if (!event_3.daysMap[dayTimestamp]) {
|
|
138
142
|
continue;
|
|
139
143
|
}
|
|
140
144
|
// only for multi days events:
|
|
141
|
-
if (
|
|
145
|
+
if (event_3.multi) {
|
|
142
146
|
// filter out the days outside of the current week view to avoid
|
|
143
147
|
// making a multi-days event chip wider than the week row or shorter
|
|
144
148
|
// than it should be (when event spans across weeks)
|
|
145
|
-
width =
|
|
149
|
+
width = event_3.days.filter(function (t) { return t >= weekStartTimestamp && t <= weekEndTimestamp; }).length;
|
|
146
150
|
// flag the first day of multi-days events, consider that an event
|
|
147
151
|
// might start in a day earlier (hence outside) of the current
|
|
148
152
|
// week/month view, so we always check for Mondays (dayNumber === 0)
|
|
149
|
-
if (
|
|
153
|
+
if (event_3.days.indexOf(dayTimestamp) === 0 || dayNumber === 0) {
|
|
150
154
|
firstOfMulti = true;
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
// if we already have the information on when the event has been
|
|
154
158
|
// vertically positioned use that index
|
|
155
|
-
if (startedAtTopMap[
|
|
156
|
-
|
|
159
|
+
if (startedAtTopMap[event_3.uid]) {
|
|
160
|
+
top_1 = startedAtTopMap[event_3.uid];
|
|
157
161
|
}
|
|
158
162
|
else {
|
|
159
163
|
// now look for a free slot and use its index as `top`
|
|
160
|
-
for (
|
|
161
|
-
|
|
164
|
+
for (var verticalIdx = 0; verticalIdx < verticalSlots.length; verticalIdx++) {
|
|
165
|
+
var freeOrBusy = verticalSlots[verticalIdx];
|
|
162
166
|
if (freeOrBusy !== BUSY_SLOT) {
|
|
163
|
-
|
|
167
|
+
top_1 = verticalIdx;
|
|
164
168
|
break;
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
// now mark the slot as busy
|
|
169
|
-
verticalSlots[
|
|
173
|
+
verticalSlots[top_1] = BUSY_SLOT;
|
|
170
174
|
// store the slot vertical position consistently for multi-days events
|
|
171
175
|
if (firstOfMulti) {
|
|
172
|
-
startedAtTopMap[
|
|
176
|
+
startedAtTopMap[event_3.uid] = top_1;
|
|
173
177
|
}
|
|
174
178
|
// push the event, they will be sorted later
|
|
175
|
-
viewDay.events.push({
|
|
176
|
-
key: `event.${dayTimestamp}-${top}`,
|
|
177
|
-
...contextualProps,
|
|
178
|
-
...event,
|
|
179
|
-
isPast: todayDate > event.end,
|
|
180
|
-
firstOfMulti,
|
|
181
|
-
top,
|
|
182
|
-
width,
|
|
183
|
-
});
|
|
179
|
+
viewDay.events.push(__assign(__assign(__assign({ key: "event.".concat(dayTimestamp, "-").concat(top_1) }, contextualProps), event_3), { isPast: todayDate > event_3.end, firstOfMulti: firstOfMulti, top: top_1, width: width }));
|
|
184
180
|
}
|
|
185
181
|
// fill the empty slots with events' placeholders
|
|
186
|
-
for (
|
|
182
|
+
for (var i = 0; i < verticalSlots.length; i++) {
|
|
187
183
|
if (verticalSlots[i] !== BUSY_SLOT) {
|
|
188
184
|
viewDay.events.push({
|
|
189
|
-
key:
|
|
185
|
+
key: "event.".concat(dayTimestamp, "-").concat(i, "}"),
|
|
190
186
|
placeholder: true,
|
|
191
187
|
top: i,
|
|
192
188
|
});
|
|
193
189
|
}
|
|
194
190
|
}
|
|
195
191
|
// sort events and events placeholders by top position
|
|
196
|
-
viewDay.events.sort((a, b)
|
|
192
|
+
viewDay.events.sort(function (a, b) { return a.top - b.top; });
|
|
197
193
|
}
|
|
198
194
|
viewWeek.days.push(viewDay);
|
|
199
195
|
}
|
|
200
196
|
viewWeeks.push(viewWeek);
|
|
197
|
+
};
|
|
198
|
+
for (var weekIdx = 0; weekIdx < weeks.length; weekIdx++) {
|
|
199
|
+
_loop_2(weekIdx);
|
|
201
200
|
}
|
|
202
201
|
return viewWeeks;
|
|
203
202
|
}
|
package/Carousel/Carousel.js
CHANGED
package/Carousel/CarouselCss.js
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { Children /* , useId */ } from "react";
|
|
3
4
|
import styled from "styled-components";
|
|
4
5
|
import { Row, Col, GRID_GUTTER_DEFAULT as DF, } from "../Grid";
|
|
5
6
|
import { useId } from "../hooks/useId";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
margin-left:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
padding-right: ${cs === DF ? gutter[DF] : gutter[DF] - gutter[cs]}px;
|
|
12
|
-
`}
|
|
13
|
-
|
|
14
|
-
scroll-behavior: smooth;
|
|
15
|
-
scroll-snap-type: x;
|
|
16
|
-
-ms-overflow-style: none;
|
|
17
|
-
scrollbar-width: none;
|
|
18
|
-
|
|
19
|
-
&::-webkit-scrollbar {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
export const CarouselCssCol = styled(Col) `
|
|
24
|
-
${(p) => p.$width && `flex-basis: ${p.$width}px; min-width: ${p.$width}px;`}
|
|
25
|
-
position: relative;
|
|
26
|
-
scroll-snap-align: ${(p) => p.$snap};
|
|
27
|
-
`;
|
|
7
|
+
export var CarouselCssRow = styled(Row)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n scroll-behavior: smooth;\n scroll-snap-type: x;\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n"], ["\n ", "\n\n scroll-behavior: smooth;\n scroll-snap-type: x;\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n"])), function (_a) {
|
|
8
|
+
var cs = _a.$gutter, gutter = _a.theme.gutter;
|
|
9
|
+
return "\n margin-left: -".concat(cs === DF ? gutter[DF] : (gutter[DF] - gutter[cs]) * 2, "px;\n margin-right: -").concat(cs === DF ? gutter[DF] : (gutter[DF] - gutter[cs]) * 2, "px;\n padding-left: ").concat(cs === DF ? gutter[DF] : gutter[DF] - gutter[cs], "px;\n padding-right: ").concat(cs === DF ? gutter[DF] : gutter[DF] - gutter[cs], "px;\n ");
|
|
10
|
+
});
|
|
11
|
+
export var CarouselCssCol = styled(Col)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n position: relative;\n scroll-snap-align: ", ";\n"], ["\n ", "\n position: relative;\n scroll-snap-align: ", ";\n"])), function (p) { return p.$width && "flex-basis: ".concat(p.$width, "px; min-width: ").concat(p.$width, "px;"); }, function (p) { return p.$snap; });
|
|
28
12
|
/**
|
|
29
13
|
* For programmatic usage an example here @see https://stackoverflow.com/a/65902068/9122820
|
|
30
14
|
*/
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
15
|
+
export var KoineCarouselCss = function (_a) {
|
|
16
|
+
var items = _a.items, $gutterRow = _a.$gutterRow, $gutterCol = _a.$gutterCol, _b = _a.$gutter, $gutter = _b === void 0 ? "quarter" : _b, $proportion = _a.$proportion, _c = _a.$snap, $snap = _c === void 0 ? "center" : _c, width = _a.width, children = _a.children, colProps = __rest(_a, ["items", "$gutterRow", "$gutterCol", "$gutter", "$proportion", "$snap", "width", "children"]);
|
|
17
|
+
var slides = children ? Children.toArray(children) : items;
|
|
18
|
+
var id = useId();
|
|
34
19
|
if (!slides)
|
|
35
20
|
return null;
|
|
36
|
-
return (_jsx(CarouselCssRow, { "$noWrap": true, "$gutter": $gutterRow || $gutter, children: slides.map((_slide, idx)
|
|
21
|
+
return (_jsx(CarouselCssRow, __assign({ "$noWrap": true, "$gutter": $gutterRow || $gutter }, { children: slides.map(function (_slide, idx) { return (_jsx(CarouselCssCol, __assign({}, colProps, { "$gutter": $gutterCol || $gutter, "$width": width }, { children: slides[idx] }), "CarouselCssCol-".concat(id, "-").concat(idx))); }) })));
|
|
37
22
|
};
|
|
23
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var Collapsable = null;
|
package/Debug/Debug.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import styled from "styled-components";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
border-left: 3px solid #f36d33;
|
|
7
|
-
color: #666;
|
|
8
|
-
page-break-inside: avoid;
|
|
9
|
-
font-family: monospace;
|
|
10
|
-
font-size: small;
|
|
11
|
-
line-height: 1.6;
|
|
12
|
-
margin-bottom: 1.6em;
|
|
13
|
-
max-width: 100%;
|
|
14
|
-
overflow: auto;
|
|
15
|
-
padding: 1em 1.5em;
|
|
16
|
-
display: block;
|
|
17
|
-
word-wrap: break-word;
|
|
18
|
-
`;
|
|
19
|
-
export const Debug = ({ data }) => {
|
|
4
|
+
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: #f4f4f4;\n border: 1px solid #ddd;\n border-left: 3px solid #f36d33;\n color: #666;\n page-break-inside: avoid;\n font-family: monospace;\n font-size: small;\n line-height: 1.6;\n margin-bottom: 1.6em;\n max-width: 100%;\n overflow: auto;\n padding: 1em 1.5em;\n display: block;\n word-wrap: break-word;\n"], ["\n background: #f4f4f4;\n border: 1px solid #ddd;\n border-left: 3px solid #f36d33;\n color: #666;\n page-break-inside: avoid;\n font-family: monospace;\n font-size: small;\n line-height: 1.6;\n margin-bottom: 1.6em;\n max-width: 100%;\n overflow: auto;\n padding: 1em 1.5em;\n display: block;\n word-wrap: break-word;\n"])));
|
|
5
|
+
export var Debug = function (_a) {
|
|
6
|
+
var data = _a.data;
|
|
20
7
|
return _jsx(Root, { children: JSON.stringify(data, undefined, 2) });
|
|
21
8
|
};
|
|
9
|
+
var templateObject_1;
|
package/Details/Details.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useCallback, useEffect,
|
|
3
|
+
import { forwardRef, useCallback, useEffect,
|
|
4
|
+
/* useId, */ useRef, useState, } from "react";
|
|
3
5
|
import { useWindowSize } from "../hooks/useWindowSize";
|
|
4
6
|
import { extendComponent, } from "../helpers";
|
|
5
7
|
import { useId } from "../hooks/useId";
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export var Root = "details";
|
|
9
|
+
export var Summary = "summary";
|
|
10
|
+
export var Body = "div";
|
|
11
|
+
export var Content = "div";
|
|
10
12
|
/**
|
|
11
13
|
* FIXME: it actually works even without forwardRef, check if we do need it
|
|
12
14
|
*
|
|
13
15
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
|
|
14
16
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
var DetailsWithRef = forwardRef(function Details(_a, ref) {
|
|
18
|
+
var id = _a.id, propOpen = _a.open, recalc = _a.recalc, summary = _a.summary, children = _a.children, _Root = _a.Root, _Summary = _a.Summary, _Body = _a.Body, _Content = _a.Content, onChange = _a.onChange, props = __rest(_a, ["id", "open", "recalc", "summary", "children", "Root", "Summary", "Body", "Content", "onChange"]);
|
|
19
|
+
var isControlled = typeof propOpen !== "undefined";
|
|
20
|
+
var _b = useState(propOpen), stateOpen = _b[0], setStateOpen = _b[1];
|
|
21
|
+
var _c = useState(0), height = _c[0], setHeight = _c[1];
|
|
22
|
+
var hash = id ? "#".concat(id) : "";
|
|
23
|
+
var winSize = useWindowSize();
|
|
24
|
+
var open = isControlled ? propOpen : stateOpen;
|
|
25
|
+
var _d = useState(open ? "unset" : "hidden"), overflow = _d[0], setOverflow = _d[1];
|
|
26
|
+
var content = useRef(null);
|
|
27
|
+
var defaultId = useId();
|
|
25
28
|
id = id || defaultId;
|
|
26
|
-
|
|
29
|
+
var handleClick = useCallback(function () {
|
|
27
30
|
if (hash) {
|
|
28
31
|
window.history.replaceState(null, "", open ? window.location.pathname + window.location.search : hash);
|
|
29
32
|
}
|
|
@@ -31,32 +34,32 @@ const DetailsWithRef = forwardRef(function Details({ id, open: propOpen, recalc,
|
|
|
31
34
|
onChange();
|
|
32
35
|
}
|
|
33
36
|
if (!isControlled) {
|
|
34
|
-
setStateOpen((prevOpen)
|
|
37
|
+
setStateOpen(function (prevOpen) { return !prevOpen; });
|
|
35
38
|
}
|
|
36
39
|
}, [open, hash, onChange, isControlled]);
|
|
37
|
-
useEffect(()
|
|
40
|
+
useEffect(function () {
|
|
38
41
|
if (content.current) {
|
|
39
42
|
setHeight(Math.ceil(content.current.offsetHeight));
|
|
40
43
|
}
|
|
41
44
|
}, [winSize, recalc]);
|
|
42
45
|
// deeplink on mount
|
|
43
|
-
useEffect(()
|
|
46
|
+
useEffect(function () {
|
|
44
47
|
if (!isControlled && hash && window.location.hash === hash) {
|
|
45
48
|
setStateOpen(true);
|
|
46
49
|
}
|
|
47
50
|
}, [hash, isControlled]);
|
|
48
|
-
return (_jsxs(Root, {
|
|
51
|
+
return (_jsxs(Root, __assign({}, props, { open: open || false }, { children: [_jsx(Summary, __assign({ "$open": open, onClick: handleClick }, { children: summary || " " })), _jsx(Body, __assign({ "$open": open, style: { overflow: overflow } }, { children: _jsx(Content
|
|
49
52
|
// ref={content}
|
|
50
|
-
, { "$open": open,
|
|
53
|
+
, __assign({ "$open": open,
|
|
51
54
|
// aria-expanded={open}
|
|
52
55
|
// aria-label={open ? ariaCollapse : ariaExpand}
|
|
53
56
|
style: {
|
|
54
57
|
pointerEvents: open ? "all" : "none",
|
|
55
|
-
}, children: children }) })] }));
|
|
58
|
+
} }, { children: children })) }))] })));
|
|
56
59
|
});
|
|
57
|
-
export
|
|
58
|
-
Root,
|
|
59
|
-
Summary,
|
|
60
|
-
Body,
|
|
61
|
-
Content,
|
|
60
|
+
export var KoineDetails = extendComponent(DetailsWithRef, {
|
|
61
|
+
Root: Root,
|
|
62
|
+
Summary: Summary,
|
|
63
|
+
Body: Body,
|
|
64
|
+
Content: Content,
|
|
62
65
|
});
|
package/Dialog/DialogMui.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useRef } from "react";
|
|
3
4
|
import ModalUnstyled from "@mui/base/ModalUnstyled";
|
|
4
5
|
import { MdClear as IconClose } from "react-icons/md";
|
|
5
6
|
import { extendComponent, } from "../helpers";
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
7
|
+
export var Root = ModalUnstyled;
|
|
8
|
+
export var Backdrop = "div";
|
|
9
|
+
export var Container = "div";
|
|
10
|
+
export var Paper = "div";
|
|
11
|
+
export var Close = "button";
|
|
12
|
+
export var Header = "div";
|
|
13
|
+
export var Body = "div";
|
|
13
14
|
// const Dialog = ({
|
|
14
15
|
// children,
|
|
15
16
|
// title,
|
|
@@ -45,16 +46,17 @@ export const Body = "div";
|
|
|
45
46
|
*
|
|
46
47
|
* FIXME: it actually works even without forwardRef, check if we do need it
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
+
var DialogWithRef = forwardRef(function Dialog(_a, ref) {
|
|
50
|
+
var children = _a.children, title = _a.title, $scrollPaper = _a.$scrollPaper, _Root = _a.Root, _Backdrop = _a.Backdrop, _Container = _a.Container, _Paper = _a.Paper, _Close = _a.Close, _Header = _a.Header, _Body = _a.Body, onClose = _a.onClose, props = __rest(_a, ["children", "title", "$scrollPaper", "Root", "Backdrop", "Container", "Paper", "Close", "Header", "Body", "onClose"]);
|
|
49
51
|
// click handling is taken from
|
|
50
52
|
// @see https://github.com/mui/material-ui/blob/c758b6c0b30f0831110458a746690b33147c45df/packages/mui-material/src/Dialog/Dialog.js#L205-L226
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
var backdropClick = useRef();
|
|
54
|
+
var handleMouseDown = function (event) {
|
|
53
55
|
// We don't want to close the dialog when clicking the dialog content.
|
|
54
56
|
// Make sure the event starts and ends on the same DOM element.
|
|
55
57
|
backdropClick.current = event.target === event.currentTarget;
|
|
56
58
|
};
|
|
57
|
-
|
|
59
|
+
var handleBackdropClick = function (event) {
|
|
58
60
|
// Ignore the events not coming from the "backdrop".
|
|
59
61
|
if (!backdropClick.current) {
|
|
60
62
|
return;
|
|
@@ -65,14 +67,14 @@ const DialogWithRef = forwardRef(function Dialog({ children, title, $scrollPaper
|
|
|
65
67
|
onClose(event, "backdropClick");
|
|
66
68
|
}
|
|
67
69
|
};
|
|
68
|
-
return (_jsx(Root, { BackdropComponent: Backdrop, onClick: handleBackdropClick, onClose: onClose, ref: ref,
|
|
70
|
+
return (_jsx(Root, __assign({ BackdropComponent: Backdrop, onClick: handleBackdropClick, onClose: onClose, ref: ref }, props, { children: _jsx(Container, __assign({ "$scrollPaper": $scrollPaper, onMouseDown: handleMouseDown }, { children: _jsxs(Paper, __assign({ "aria-label": title || "", "$scrollPaper": $scrollPaper }, { children: [title && _jsx(Header, { children: title }), _jsx(Close, __assign({ onClick: onClose }, { children: _jsx(IconClose, {}) })), _jsx(Body, { children: children })] })) })) })));
|
|
69
71
|
});
|
|
70
|
-
export
|
|
71
|
-
Root,
|
|
72
|
-
Backdrop,
|
|
73
|
-
Container,
|
|
74
|
-
Paper,
|
|
75
|
-
Close,
|
|
76
|
-
Header,
|
|
77
|
-
Body,
|
|
72
|
+
export var KoineDialog = extendComponent(DialogWithRef, {
|
|
73
|
+
Root: Root,
|
|
74
|
+
Backdrop: Backdrop,
|
|
75
|
+
Container: Container,
|
|
76
|
+
Paper: Paper,
|
|
77
|
+
Close: Close,
|
|
78
|
+
Header: Header,
|
|
79
|
+
Body: Body,
|
|
78
80
|
});
|
package/Dialog/css/bare.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import { classed, extendComponent } from "../../helpers";
|
|
2
3
|
import * as _ from "../DialogMui";
|
|
3
4
|
// export type { KoineDialogProps } from "../DialogMui";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
Root,
|
|
13
|
-
Backdrop,
|
|
14
|
-
Container,
|
|
15
|
-
Paper,
|
|
16
|
-
Close,
|
|
17
|
-
Header,
|
|
18
|
-
Body,
|
|
5
|
+
export var Root = classed(_.Root)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["dialog"], ["dialog"])));
|
|
6
|
+
export var Backdrop = classed(_.Backdrop)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["dialogBackdrop"], ["dialogBackdrop"])));
|
|
7
|
+
export var Container = classed(_.Container)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["dialogContainer"], ["dialogContainer"])));
|
|
8
|
+
export var Paper = classed(_.Paper)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["dialogPaper"], ["dialogPaper"])));
|
|
9
|
+
export var Close = classed(_.Close)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\"dialogClose"], ["\"dialogClose"])));
|
|
10
|
+
export var Header = classed(_.Header)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["dialogHeader"], ["dialogHeader"])));
|
|
11
|
+
export var Body = classed(_.Body)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["dialogBody"], ["dialogBody"])));
|
|
12
|
+
export var KoineDialog = extendComponent(_.KoineDialog, {
|
|
13
|
+
Root: Root,
|
|
14
|
+
Backdrop: Backdrop,
|
|
15
|
+
Container: Container,
|
|
16
|
+
Paper: Paper,
|
|
17
|
+
Close: Close,
|
|
18
|
+
Header: Header,
|
|
19
|
+
Body: Body,
|
|
19
20
|
});
|
|
21
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
package/Dialog/m/bare.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useMemo, useRef } from "react";
|
|
3
4
|
import { MdClear as IconClose } from "react-icons/md";
|
|
@@ -11,18 +12,21 @@ import { Root, Backdrop, Container, Paper, Close, Header, Body, } from "../Dialo
|
|
|
11
12
|
* - https://github.com/framer/motion/issues/478
|
|
12
13
|
* - https://codesandbox.io/s/clever-banzai-7km49?file=/src/Modal.js
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
var Dialog = forwardRef(function Dialog(_a, ref) {
|
|
16
|
+
var children = _a.children, title = _a.title, $scrollPaper = _a.$scrollPaper, Root = _a.Root, Backdrop = _a.Backdrop, Container = _a.Container, Paper = _a.Paper, Close = _a.Close, Header = _a.Header, Body = _a.Body, mBackdrop = _a.mBackdrop, mPaper = _a.mPaper, onClose = _a.onClose, props = __rest(_a, ["children", "title", "$scrollPaper", "Root", "Backdrop", "Container", "Paper", "Close", "Header", "Body", "mBackdrop", "mPaper", "onClose"]);
|
|
17
|
+
var BackdropMotion = useMemo(function () { return function (props) {
|
|
18
|
+
return (_jsx(AnimatePresence, { children: props.open && _jsx(Backdrop, __assign({}, mBackdrop, props)) }));
|
|
19
|
+
}; }, [Backdrop, mBackdrop]);
|
|
16
20
|
// FIXME: extract this logic either in a useDialog hook or in a useclickOutside hook
|
|
17
21
|
// click handling is taken from
|
|
18
22
|
// @see https://github.com/mui/material-ui/blob/c758b6c0b30f0831110458a746690b33147c45df/packages/mui-material/src/Dialog/Dialog.js#L205-L226
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
var backdropClick = useRef();
|
|
24
|
+
var handleMouseDown = function (event) {
|
|
21
25
|
// We don't want to close the dialog when clicking the dialog content.
|
|
22
26
|
// Make sure the event starts and ends on the same DOM element.
|
|
23
27
|
backdropClick.current = event.target === event.currentTarget;
|
|
24
28
|
};
|
|
25
|
-
|
|
29
|
+
var handleBackdropClick = function (event) {
|
|
26
30
|
// Ignore the events not coming from the "backdrop".
|
|
27
31
|
if (!backdropClick.current) {
|
|
28
32
|
return;
|
|
@@ -33,16 +37,16 @@ const Dialog = forwardRef(function Dialog({ children, title, $scrollPaper, Root,
|
|
|
33
37
|
onClose(event, "backdropClick");
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
|
-
return (_jsx(Root, { keepMounted: true, BackdropComponent: BackdropMotion, onClick: handleBackdropClick, onClose: onClose, ref: ref,
|
|
40
|
+
return (_jsx(Root, __assign({ keepMounted: true, BackdropComponent: BackdropMotion, onClick: handleBackdropClick, onClose: onClose, ref: ref }, props, { style: mRootStyle(props) }, { children: _jsx(Container, __assign({ "$scrollPaper": $scrollPaper, onMouseDown: handleMouseDown }, { children: _jsx(AnimatePresence, { children: props.open && (
|
|
37
41
|
// @ts-expect-error framer props collision...
|
|
38
|
-
_jsxs(Paper, {
|
|
42
|
+
_jsxs(Paper, __assign({}, mPaper, { "aria-label": title || "", "$scrollPaper": $scrollPaper }, { children: [title && _jsx(Header, { children: title }), _jsx(Close, __assign({ onClick: onClose }, { children: _jsx(IconClose, {}) })), _jsx(Body, { children: children })] }))) }) })) })));
|
|
39
43
|
});
|
|
40
|
-
export
|
|
41
|
-
Root,
|
|
44
|
+
export var KoineDialog = extendComponent(Dialog, {
|
|
45
|
+
Root: Root,
|
|
42
46
|
Backdrop: m(Backdrop),
|
|
43
|
-
Container,
|
|
47
|
+
Container: Container,
|
|
44
48
|
Paper: m(Paper),
|
|
45
|
-
Close,
|
|
46
|
-
Header,
|
|
47
|
-
Body,
|
|
49
|
+
Close: Close,
|
|
50
|
+
Header: Header,
|
|
51
|
+
Body: Body,
|
|
48
52
|
});
|
package/Dialog/m/basic.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./index";
|
|
2
|
-
export
|
|
2
|
+
export var dialogBackdropMotion = {
|
|
3
3
|
initial: {
|
|
4
4
|
opacity: 0,
|
|
5
5
|
},
|
|
@@ -12,7 +12,7 @@ export const dialogBackdropMotion = {
|
|
|
12
12
|
opacity: 0,
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export var dialogPaperMotion = {
|
|
16
16
|
initial: {
|
|
17
17
|
// scale: .9,
|
|
18
18
|
translateY: -60,
|
package/Dialog/m/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
export var mRootStyle = function (props) {
|
|
3
|
+
return (__assign({ pointerEvents: props.open ? "all" : "none" }, (props.style || {})));
|
|
4
|
+
};
|