@startlibs/components 1.1.5 → 1.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BasicBulletList.mjs +1 -1
- package/lib/BasicBulletList.mjs.map +1 -1
- package/lib/Button.mjs +3 -3
- package/lib/Button.mjs.map +1 -1
- package/lib/ContextMenu.mjs +22 -6
- package/lib/ContextMenu.mjs.map +1 -1
- package/lib/Dialog.mjs +60 -24
- package/lib/Dialog.mjs.map +1 -1
- package/lib/Icon.mjs +10 -4
- package/lib/Icon.mjs.map +1 -1
- package/lib/Loading.mjs +26 -3
- package/lib/Loading.mjs.map +1 -1
- package/lib/PageLoader.mjs +2 -2
- package/lib/PageLoader.mjs.map +1 -1
- package/lib/PersistentNotifications.mjs +1 -1
- package/lib/PersistentNotifications.mjs.map +1 -1
- package/lib/SplitColumnsContainer.mjs +77 -6
- package/lib/SplitColumnsContainer.mjs.map +1 -1
- package/lib/TextButton.mjs +1 -1
- package/lib/TextButton.mjs.map +1 -1
- package/lib/ToastNotifications.mjs +16 -14
- package/lib/ToastNotifications.mjs.map +1 -1
- package/lib/alt/dialogs/DialogWithImageHeader.mjs +1 -1
- package/lib/alt/dialogs/DialogWithImageHeader.mjs.map +1 -1
- package/lib/alt/dialogs/DialogWithSidebar.mjs +7 -3
- package/lib/alt/dialogs/DialogWithSidebar.mjs.map +1 -1
- package/lib/alt/dialogs/MobileBubbleDialog.mjs +1 -1
- package/lib/alt/dialogs/MobileBubbleDialog.mjs.map +1 -1
- package/lib/containers/DialogContainer.mjs +29 -10
- package/lib/containers/DialogContainer.mjs.map +1 -1
- package/lib/index.cjs +286 -93
- package/lib/index.cjs.map +1 -1
- package/lib/willUseIsSticky.mjs +23 -2
- package/lib/willUseIsSticky.mjs.map +1 -1
- package/lib-yak/BasicBulletList.mjs +27 -0
- package/lib-yak/BasicBulletList.mjs.map +1 -0
- package/lib-yak/Button.mjs +374 -0
- package/lib-yak/Button.mjs.map +1 -0
- package/lib-yak/ContextMenu.mjs +642 -0
- package/lib-yak/ContextMenu.mjs.map +1 -0
- package/lib-yak/Dialog.mjs +469 -0
- package/lib-yak/Dialog.mjs.map +1 -0
- package/lib-yak/Draggable.mjs +892 -0
- package/lib-yak/Draggable.mjs.map +1 -0
- package/lib-yak/ErrorBoundary.mjs +108 -0
- package/lib-yak/ErrorBoundary.mjs.map +1 -0
- package/lib-yak/FillLastLineResizer.mjs +238 -0
- package/lib-yak/FillLastLineResizer.mjs.map +1 -0
- package/lib-yak/Flip.mjs +644 -0
- package/lib-yak/Flip.mjs.map +1 -0
- package/lib-yak/FlipList.mjs +186 -0
- package/lib-yak/FlipList.mjs.map +1 -0
- package/lib-yak/FormatDate.mjs +25 -0
- package/lib-yak/FormatDate.mjs.map +1 -0
- package/lib-yak/Icon.mjs +74 -0
- package/lib-yak/Icon.mjs.map +1 -0
- package/lib-yak/Image.mjs +41 -0
- package/lib-yak/Image.mjs.map +1 -0
- package/lib-yak/Link.mjs +116 -0
- package/lib-yak/Link.mjs.map +1 -0
- package/lib-yak/Loading.mjs +54 -0
- package/lib-yak/Loading.mjs.map +1 -0
- package/lib-yak/LoadingDiv.mjs +82 -0
- package/lib-yak/LoadingDiv.mjs.map +1 -0
- package/lib-yak/Notifications.mjs +99 -0
- package/lib-yak/Notifications.mjs.map +1 -0
- package/lib-yak/PageLoader.mjs +61 -0
- package/lib-yak/PageLoader.mjs.map +1 -0
- package/lib-yak/PersistentNotifications.mjs +209 -0
- package/lib-yak/PersistentNotifications.mjs.map +1 -0
- package/lib-yak/Popup.mjs +66 -0
- package/lib-yak/Popup.mjs.map +1 -0
- package/lib-yak/SplitColumnsContainer.mjs +140 -0
- package/lib-yak/SplitColumnsContainer.mjs.map +1 -0
- package/lib-yak/SwitchDiv.mjs +60 -0
- package/lib-yak/SwitchDiv.mjs.map +1 -0
- package/lib-yak/TextButton.mjs +61 -0
- package/lib-yak/TextButton.mjs.map +1 -0
- package/lib-yak/ToastNotifications.mjs +316 -0
- package/lib-yak/ToastNotifications.mjs.map +1 -0
- package/lib-yak/Tooltip.mjs +176 -0
- package/lib-yak/Tooltip.mjs.map +1 -0
- package/lib-yak/TransitionDiv.mjs +59 -0
- package/lib-yak/TransitionDiv.mjs.map +1 -0
- package/lib-yak/WarningDialog.mjs +107 -0
- package/lib-yak/WarningDialog.mjs.map +1 -0
- package/lib-yak/alt/buttons/OnClickLoadingButton.mjs +36 -0
- package/lib-yak/alt/buttons/OnClickLoadingButton.mjs.map +1 -0
- package/lib-yak/alt/dialogs/DialogWithImageHeader.mjs +50 -0
- package/lib-yak/alt/dialogs/DialogWithImageHeader.mjs.map +1 -0
- package/lib-yak/alt/dialogs/DialogWithSidebar.mjs +193 -0
- package/lib-yak/alt/dialogs/DialogWithSidebar.mjs.map +1 -0
- package/lib-yak/alt/dialogs/MobileBubbleDialog.mjs +82 -0
- package/lib-yak/alt/dialogs/MobileBubbleDialog.mjs.map +1 -0
- package/lib-yak/containers/DialogContainer.mjs +482 -0
- package/lib-yak/containers/DialogContainer.mjs.map +1 -0
- package/lib-yak/containers/Reposition.mjs +35 -0
- package/lib-yak/containers/Reposition.mjs.map +1 -0
- package/lib-yak/containers/usePositioning.mjs +311 -0
- package/lib-yak/containers/usePositioning.mjs.map +1 -0
- package/lib-yak/index.mjs +37 -0
- package/lib-yak/index.mjs.map +1 -0
- package/lib-yak/useDialogWithToggle.mjs +18 -0
- package/lib-yak/useDialogWithToggle.mjs.map +1 -0
- package/lib-yak/willUseIsSticky.mjs +147 -0
- package/lib-yak/willUseIsSticky.mjs.map +1 -0
- package/package.json +12 -3
- package/src/BasicBulletList.jsx +1 -1
- package/src/Button.jsx +36 -30
- package/src/ContextMenu.jsx +21 -7
- package/src/Dialog.jsx +31 -12
- package/src/Icon.jsx +5 -4
- package/src/Loading.jsx +19 -5
- package/src/PageLoader.jsx +3 -3
- package/src/PersistentNotifications.jsx +2 -2
- package/src/SplitColumnsContainer.jsx +89 -30
- package/src/TextButton.jsx +1 -1
- package/src/ToastNotifications.jsx +15 -8
- package/src/alt/dialogs/DialogWithImageHeader.jsx +2 -2
- package/src/alt/dialogs/DialogWithSidebar.jsx +6 -5
- package/src/alt/dialogs/MobileBubbleDialog.jsx +1 -1
- package/src/containers/DialogContainer.jsx +11 -4
- package/src/willUseIsSticky.jsx +22 -2
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _map from 'lodash/fp/map';
|
|
3
|
+
import _concat from 'lodash/fp/concat';
|
|
4
|
+
import _differenceBy from 'lodash/fp/differenceBy';
|
|
5
|
+
import _isObject from 'lodash/fp/isObject';
|
|
6
|
+
import { yakDomTag } from '@startlibs/utils/yakDomTag';
|
|
7
|
+
import React, { useMemo, useEffect, useRef } from 'react';
|
|
8
|
+
import { getColor, ifUndefined, getUID, oneWayAnimation, callIfFunction, constrainEvent } from '@startlibs/utils';
|
|
9
|
+
import { styled, css } from '@yak/react';
|
|
10
|
+
import { rgba } from 'polished';
|
|
11
|
+
import { willUseSharedState, useToggle, Fill } from '@startlibs/core';
|
|
12
|
+
import { FlipList } from './FlipList.mjs';
|
|
13
|
+
import { Icon } from './Icon.mjs';
|
|
14
|
+
import { Loading } from './Loading.mjs';
|
|
15
|
+
import { SwitchDiv } from './SwitchDiv.mjs';
|
|
16
|
+
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
const NotificationContainer = styled(yakDomTag("div"))`
|
|
20
|
+
position: fixed;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
max-height: 100%;
|
|
23
|
+
z-index: 999999;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column-reverse;
|
|
26
|
+
align-items: flex-end;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
right: 1.5rem;
|
|
29
|
+
@media (min-width: 601px) {
|
|
30
|
+
padding-bottom: 1.5rem;
|
|
31
|
+
}
|
|
32
|
+
@media (max-width: 600px) {
|
|
33
|
+
padding-bottom: 0.75rem;
|
|
34
|
+
}
|
|
35
|
+
&::-webkit-scrollbar {
|
|
36
|
+
width: 21px;
|
|
37
|
+
height: 21px;
|
|
38
|
+
}
|
|
39
|
+
&::-webkit-scrollbar-thumb {
|
|
40
|
+
pointer-events: all;
|
|
41
|
+
background: rgba(0,0,0,0.4);
|
|
42
|
+
border-radius: 100px;
|
|
43
|
+
background-clip: padding-box;
|
|
44
|
+
border: 6px solid transparent;
|
|
45
|
+
min-height: 30px;
|
|
46
|
+
min-width: 30px;
|
|
47
|
+
&:hover {
|
|
48
|
+
background: rgba(0,0,0,0.5);
|
|
49
|
+
background-clip: padding-box;
|
|
50
|
+
border: 6px solid transparent;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
&::-webkit-scrollbar-corner {
|
|
54
|
+
background: transparent;
|
|
55
|
+
}
|
|
56
|
+
@media (min-width: 601px) {
|
|
57
|
+
&.JS-dialog-open {
|
|
58
|
+
right: 2.75rem;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
@media (max-width: 600px) {
|
|
62
|
+
left: 0.75rem;
|
|
63
|
+
right: 0.75rem;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
const ToastBox = styled(yakDomTag("div"))`
|
|
67
|
+
color: white;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
border-radius: 12px;
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
margin-top: 0.5rem;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
transition: 0.3s background ease, 0.4s opacity 1.5s;
|
|
75
|
+
/* styled-components (stylis) hoista bloco aninhado de @media para depois do flat; o
|
|
76
|
+
yak preserva a ordem do fonte. Esse fallback sólido precisa vir ANTES dos media
|
|
77
|
+
abaixo, ou o yak aplicaria ele por último (ganhando sempre) nos dois breakpoints. */
|
|
78
|
+
${props => css`background: ${__yakProps => {
|
|
79
|
+
const v = getColor(props.type);
|
|
80
|
+
return typeof v === 'function' ? v(__yakProps) : v;
|
|
81
|
+
}};`}
|
|
82
|
+
@media (min-width: 601px) {
|
|
83
|
+
background: ${props => rgba(getColor(props.type)(props), ifUndefined(props.opacity, 0.7))};
|
|
84
|
+
max-width: 300px;
|
|
85
|
+
}
|
|
86
|
+
@media (max-width: 600px) {
|
|
87
|
+
background: ${props => rgba(getColor(props.type)(props), ifUndefined(props.opacity, 0.8))};
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
const NotificationTitleContainer = styled(yakDomTag("div"))`
|
|
91
|
+
background: rgba(0,0,0,0.1);
|
|
92
|
+
padding: 0.5rem 2.25rem 0.5rem 0.75rem;
|
|
93
|
+
border-radius: 12px 12px 0 0;
|
|
94
|
+
position: relative;
|
|
95
|
+
min-height: 30px;
|
|
96
|
+
font-size: 13px;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
font-weight: 400;
|
|
100
|
+
${props => props.onClick && css`cursor: pointer;`}
|
|
101
|
+
`;
|
|
102
|
+
const NotificationTitle = styled(yakDomTag("div"))`
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
overflow: hidden;
|
|
106
|
+
`;
|
|
107
|
+
const NotificationContent = styled(yakDomTag("div"))`
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
text-align: left;
|
|
111
|
+
padding: 1rem 1.5rem;
|
|
112
|
+
@media (max-width: 600px) {
|
|
113
|
+
justify-content: center;
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
// Task 13c: substitui a prop JSX `css="min-width: 0;"` (R13 proíbe essa forma no yak) por um
|
|
117
|
+
// styled component equivalente.
|
|
118
|
+
const NotificationContentBody = styled(yakDomTag("div"))`
|
|
119
|
+
min-width: 0;
|
|
120
|
+
`;
|
|
121
|
+
const NotificationIconWrapper = styled(yakDomTag("div"))`
|
|
122
|
+
margin-right: 1rem;
|
|
123
|
+
position: relative;
|
|
124
|
+
width: 36px;
|
|
125
|
+
text-align: center;
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
${Icon} {
|
|
128
|
+
font-size: ${props => props.isLoading ? 22 : props.iconFontSize || 40}px;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
const CloseIcon = styled(Icon).attrs({
|
|
132
|
+
icon: 'x'
|
|
133
|
+
})`
|
|
134
|
+
font-size: 20px;
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
width: 2rem;
|
|
137
|
+
height: 2rem;
|
|
138
|
+
line-height: 2rem;
|
|
139
|
+
text-align: center;
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 50%;
|
|
142
|
+
right: 0.25rem;
|
|
143
|
+
transform: translateY(-50%);
|
|
144
|
+
border-radius: 100px;
|
|
145
|
+
opacity: 0.8;
|
|
146
|
+
&:hover, &:active {
|
|
147
|
+
background: rgba(0,0,0,0.1);
|
|
148
|
+
opacity: 1;
|
|
149
|
+
}
|
|
150
|
+
`;
|
|
151
|
+
const NotificationDetails = styled(yakDomTag("div"))`
|
|
152
|
+
background: rgba(0,0,0,0.1);
|
|
153
|
+
border-radius: 8px;
|
|
154
|
+
padding: 1rem;
|
|
155
|
+
margin: 0 1rem 1rem;
|
|
156
|
+
font-weight: 400;
|
|
157
|
+
font-size: 13px;
|
|
158
|
+
`;
|
|
159
|
+
const [useToastNotifications, _useToastNotificationsRef, setToastNotifications] = willUseSharedState([]);
|
|
160
|
+
const formatNotification = (notification, extra) => _isObject(notification) ? _objectSpread(_objectSpread(_objectSpread({}, notification), extra), {}, {
|
|
161
|
+
_key: getUID()
|
|
162
|
+
}) : _objectSpread(_objectSpread({
|
|
163
|
+
type: "success",
|
|
164
|
+
content: notification
|
|
165
|
+
}, extra), {}, {
|
|
166
|
+
_key: getUID()
|
|
167
|
+
});
|
|
168
|
+
const createToastNotification = (notification, timeout, closeCallback) => {
|
|
169
|
+
const uid = getUID();
|
|
170
|
+
let currentTimer = -1;
|
|
171
|
+
let hasClosed = false;
|
|
172
|
+
const close = () => {
|
|
173
|
+
clearTimeout(currentTimer);
|
|
174
|
+
if (hasClosed) return;
|
|
175
|
+
setToastNotifications(_differenceBy('uid', _differenceBy.placeholder, [{
|
|
176
|
+
uid
|
|
177
|
+
}]));
|
|
178
|
+
hasClosed = true;
|
|
179
|
+
callIfFunction(closeCallback);
|
|
180
|
+
};
|
|
181
|
+
const notificationObj = formatNotification(notification, {
|
|
182
|
+
uid,
|
|
183
|
+
close
|
|
184
|
+
});
|
|
185
|
+
setToastNotifications(_concat(notificationObj));
|
|
186
|
+
if (timeout > 0) {
|
|
187
|
+
currentTimer = setTimeout(close, timeout);
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
close,
|
|
191
|
+
openWith: (obj, timeout) => {
|
|
192
|
+
clearTimeout(currentTimer);
|
|
193
|
+
if (timeout > 0) {
|
|
194
|
+
currentTimer = setTimeout(close, timeout);
|
|
195
|
+
}
|
|
196
|
+
const notificationObj = formatNotification(obj, {
|
|
197
|
+
uid,
|
|
198
|
+
close
|
|
199
|
+
});
|
|
200
|
+
if (hasClosed) {
|
|
201
|
+
hasClosed = false;
|
|
202
|
+
setToastNotifications(_concat(notificationObj));
|
|
203
|
+
} else {
|
|
204
|
+
setToastNotifications(_map(n => n.uid === uid ? _objectSpread(_objectSpread({}, notificationObj), {}, {
|
|
205
|
+
_key: n._key
|
|
206
|
+
}) : n));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
const useToastNotificationToggle = (notification, timeout) => {
|
|
212
|
+
const toggle = useToggle();
|
|
213
|
+
const extraProps = useMemo(() => notification.content || notification.element ? {} : notification, []);
|
|
214
|
+
const make = (notification, timeout) => notification && createToastNotification(formatNotification(notification, extraProps), timeout, () => toggle.close());
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (notification.content || notification.element) {
|
|
217
|
+
toggle.openWith(make(notification));
|
|
218
|
+
}
|
|
219
|
+
}, []);
|
|
220
|
+
return useMemo(() => ({
|
|
221
|
+
close: () => {
|
|
222
|
+
var _toggle$get;
|
|
223
|
+
return (_toggle$get = toggle.get()) === null || _toggle$get === void 0 ? void 0 : _toggle$get.close();
|
|
224
|
+
},
|
|
225
|
+
openWith: (notification, timeout) => toggle.get() ? toggle.get().openWith(formatNotification(notification, extraProps), timeout) : toggle.openWith(make(notification, timeout)),
|
|
226
|
+
open: () => toggle.get() ? toggle.get().openWith(formatNotification(notification, extraProps), timeout) : toggle.openWith(make(notification, timeout))
|
|
227
|
+
}), [toggle.isOpen]);
|
|
228
|
+
};
|
|
229
|
+
const willShowToastNotification = (str, timeout) => () => createToastNotification(str, timeout);
|
|
230
|
+
const EXIT_ANIMATION_MS = 300;
|
|
231
|
+
const TOAST_EASING = 'cubic-bezier(0.22, 0.61, 0.36, 1)';
|
|
232
|
+
const TOAST_TIMING = `${EXIT_ANIMATION_MS}ms ${TOAST_EASING}`;
|
|
233
|
+
const animation = oneWayAnimation('transform: translateY(0); opacity: 1;', 'transform: translateY(0.25rem); opacity: 1;', 'transform: translateY(1rem); opacity: 0;');
|
|
234
|
+
const removeAnimationReinsertPosition = e => e.style.position = '';
|
|
235
|
+
const ToastNotifications = () => {
|
|
236
|
+
const [notifications, setNotifications] = useToastNotifications();
|
|
237
|
+
const containerRef = useRef(null);
|
|
238
|
+
const {
|
|
239
|
+
lockWidth,
|
|
240
|
+
unlockWidth
|
|
241
|
+
} = useNotificationContainerWidthLock(containerRef);
|
|
242
|
+
return /*#__PURE__*/React.createElement(Fill, {
|
|
243
|
+
name: "Notifications"
|
|
244
|
+
}, /*#__PURE__*/React.createElement(NotificationContainer, {
|
|
245
|
+
ref: containerRef,
|
|
246
|
+
className: "JS-on-open-dialog"
|
|
247
|
+
}, /*#__PURE__*/React.createElement(FlipList, {
|
|
248
|
+
animation: animation,
|
|
249
|
+
timing: TOAST_TIMING,
|
|
250
|
+
onReinsert: removeAnimationReinsertPosition,
|
|
251
|
+
skipParentMorph: true,
|
|
252
|
+
anchoredDownList: true
|
|
253
|
+
}, notifications.map(notification => {
|
|
254
|
+
const closeWithLock = () => {
|
|
255
|
+
lockWidth();
|
|
256
|
+
notification.close();
|
|
257
|
+
setTimeout(unlockWidth, EXIT_ANIMATION_MS);
|
|
258
|
+
};
|
|
259
|
+
return callIfFunction(notification.element, closeWithLock) || /*#__PURE__*/React.createElement(ToastBox, {
|
|
260
|
+
key: `toast-${notification.uid}`,
|
|
261
|
+
type: notification.type,
|
|
262
|
+
onClick: notification.onClick,
|
|
263
|
+
opacity: notification.opacity
|
|
264
|
+
}, notification.title ? /*#__PURE__*/React.createElement(NotificationTitleContainer, {
|
|
265
|
+
onClick: notification.onClickTitle ? e => notification.onClickTitle(e, closeWithLock) : undefined
|
|
266
|
+
}, /*#__PURE__*/React.createElement(NotificationTitle, null, notification.title), notification.closeOnX && /*#__PURE__*/React.createElement(CloseIcon, {
|
|
267
|
+
onClick: constrainEvent(closeWithLock)
|
|
268
|
+
})) : notification.closeOnX && /*#__PURE__*/React.createElement(CloseIcon, {
|
|
269
|
+
onClick: closeWithLock
|
|
270
|
+
}), /*#__PURE__*/React.createElement(SwitchDiv, {
|
|
271
|
+
on: notification._key
|
|
272
|
+
}, /*#__PURE__*/React.createElement(NotificationContent, null, notification.icon && /*#__PURE__*/React.createElement(NotificationIconWrapper, {
|
|
273
|
+
isLoading: notification.isLoading,
|
|
274
|
+
iconFontSize: notification.iconFontSize
|
|
275
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
276
|
+
icon: notification.icon
|
|
277
|
+
}), notification.isLoading && /*#__PURE__*/React.createElement(Loading, {
|
|
278
|
+
size: 36,
|
|
279
|
+
white: true,
|
|
280
|
+
absolute: true
|
|
281
|
+
})), /*#__PURE__*/React.createElement(NotificationContentBody, null, callIfFunction(notification.content, closeWithLock))), notification.details && /*#__PURE__*/React.createElement(NotificationDetails, {
|
|
282
|
+
onClick: constrainEvent()
|
|
283
|
+
}, notification.details)));
|
|
284
|
+
}))));
|
|
285
|
+
};
|
|
286
|
+
const useNotificationContainerWidthLock = containerRef => {
|
|
287
|
+
const lockCountRef = useRef(0);
|
|
288
|
+
const prevWidthRef = useRef(null);
|
|
289
|
+
const lockWidth = () => {
|
|
290
|
+
const el = containerRef.current;
|
|
291
|
+
if (!el) return;
|
|
292
|
+
if (lockCountRef.current === 0) {
|
|
293
|
+
prevWidthRef.current = el.style.width;
|
|
294
|
+
const measured = el.getBoundingClientRect().width;
|
|
295
|
+
el.style.width = measured + 'px';
|
|
296
|
+
}
|
|
297
|
+
lockCountRef.current = lockCountRef.current + 1;
|
|
298
|
+
};
|
|
299
|
+
const unlockWidth = () => {
|
|
300
|
+
const el = containerRef.current;
|
|
301
|
+
if (!el) return;
|
|
302
|
+
const next = Math.max(0, lockCountRef.current - 1);
|
|
303
|
+
lockCountRef.current = next;
|
|
304
|
+
if (next === 0) {
|
|
305
|
+
el.style.width = prevWidthRef.current || '';
|
|
306
|
+
prevWidthRef.current = null;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
return {
|
|
310
|
+
lockWidth,
|
|
311
|
+
unlockWidth
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export { ToastNotifications, createToastNotification, useToastNotificationToggle, useToastNotifications, willShowToastNotification };
|
|
316
|
+
//# sourceMappingURL=ToastNotifications.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastNotifications.mjs","sources":["../src/ToastNotifications.jsx"],"sourcesContent":["import React, {useEffect, useMemo, useRef} from 'react'\nimport {oneWayAnimation, constrainEvent} from '@startlibs/utils'\nimport _ from 'lodash/fp'\nimport styled, {css} from 'styled-components'\nimport {rgba} from 'polished'\nimport {Fill, useToggle, willUseSharedState} from '@startlibs/core'\nimport {getUID, ifUndefined, media, callIfFunction, getColor} from '@startlibs/utils'\nimport {FlipList} from './FlipList'\nimport {Icon} from './Icon'\nimport {Loading} from './Loading'\nimport {SwitchDiv} from './SwitchDiv'\n\nconst NotificationContainer = styled.div `\n position: fixed;\n bottom: 0;\n max-height: 100%;\n z-index: 999999; \n display: flex;\n flex-direction: column-reverse;\n align-items: flex-end;\n overflow-y: auto;\n right: 1.5rem;\n ${media.desktop`\n padding-bottom: 1.5rem;\n `}\n ${media.mobile`\n padding-bottom: 0.75rem;\n `}\n &::-webkit-scrollbar {\n width: 21px;\n height: 21px;\n }\n &::-webkit-scrollbar-thumb {\n pointer-events: all;\n background: rgba(0,0,0,0.4);\n border-radius: 100px;\n background-clip: padding-box;\n border: 6px solid transparent;\n min-height: 30px;\n min-width: 30px;\n &:hover {\n background: rgba(0,0,0,0.5);\n background-clip: padding-box;\n border: 6px solid transparent;\n }\n }\n &::-webkit-scrollbar-corner {\n background: transparent;\n }\n ${media.desktop`\n &.JS-dialog-open {\n right: 2.75rem;\n }\n `}\n ${media.mobile`\n left: 0.75rem;\n right: 0.75rem;\n `}\n`\n\nconst ToastBox = styled.div`\n color: white;\n font-size: 14px;\n font-weight: 500;\n border-radius: 12px;\n flex-shrink: 0;\n margin-top: 0.5rem;\n overflow: hidden;\n transition: 0.3s background ease, 0.4s opacity 1.5s;\n /* styled-components (stylis) hoista bloco aninhado de @media para depois do flat; o\n yak preserva a ordem do fonte. Esse fallback sólido precisa vir ANTES dos media\n abaixo, ou o yak aplicaria ele por último (ganhando sempre) nos dois breakpoints. */\n ${props => css`background: ${getColor(props.type)};`}\n ${media.desktop`\n background: ${props => rgba(getColor(props.type)(props),ifUndefined(props.opacity,0.7))};\n max-width: 300px;\n `}\n ${media.mobile`\n background: ${props => rgba(getColor(props.type)(props),ifUndefined(props.opacity,0.8))};\n `}\n`\nconst NotificationTitleContainer = styled.div`\n background: rgba(0,0,0,0.1);\n padding: 0.5rem 2.25rem 0.5rem 0.75rem;\n border-radius: 12px 12px 0 0;\n position: relative;\n min-height: 30px;\n font-size: 13px;\n display: flex;\n align-items: center;\n font-weight: 400;\n ${props => props.onClick && \"cursor: pointer;\"}\n`\nconst NotificationTitle = styled.div`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n`\nconst NotificationContent = styled.div`\n display: flex;\n align-items: center;\n text-align: left;\n padding: 1rem 1.5rem;\n ${media.mobile`\n justify-content: center;\n `}\n`\n// Task 13c: substitui a prop JSX `css=\"min-width: 0;\"` (R13 proíbe essa forma no yak) por um\n// styled component equivalente.\nconst NotificationContentBody = styled.div`\n min-width: 0;\n`\nconst NotificationIconWrapper = styled.div`\n margin-right: 1rem;\n position: relative;\n width: 36px;\n text-align: center;\n flex-shrink: 0;\n ${Icon} {\n font-size: ${props => (props.isLoading ? 22 : (props.iconFontSize || 40))}px;\n }\n`\nconst CloseIcon = styled(Icon).attrs({icon: 'x'})`\n font-size: 20px;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n line-height: 2rem;\n text-align: center;\n position: absolute;\n top: 50%;\n right: 0.25rem;\n transform: translateY(-50%);\n border-radius: 100px;\n opacity: 0.8;\n &:hover, &:active {\n background: rgba(0,0,0,0.1);\n opacity: 1;\n }\n`\nconst NotificationDetails = styled.div`\n background: rgba(0,0,0,0.1);\n border-radius: 8px;\n padding: 1rem;\n margin: 0 1rem 1rem;\n font-weight: 400;\n font-size: 13px;\n`\n\nconst [useToastNotifications, _useToastNotificationsRef,setToastNotifications] = willUseSharedState([])\nexport {useToastNotifications}\nconst formatNotification = (notification,extra) =>\n _.isObject(notification)\n ? {...notification,...extra, _key: getUID()}\n : {type:\"success\",content:notification,...extra, _key: getUID()}\n\nexport const createToastNotification = (notification,timeout, closeCallback) => {\n const uid = getUID()\n let currentTimer = -1;\n let hasClosed = false;\n const close = () => {\n clearTimeout(currentTimer);\n if (hasClosed) return\n setToastNotifications(_.differenceBy('uid',_, [{uid}]))\n hasClosed = true\n callIfFunction(closeCallback)\n }\n const notificationObj = formatNotification(notification,{uid,close})\n setToastNotifications(_.concat(notificationObj))\n if (timeout>0) {\n currentTimer = setTimeout(close,timeout)\n }\n return {\n close,\n openWith:(obj,timeout) => {\n clearTimeout(currentTimer);\n if (timeout > 0) {\n currentTimer = setTimeout(close,timeout)\n }\n const notificationObj = formatNotification(obj,{uid,close})\n if (hasClosed) {\n hasClosed = false\n setToastNotifications(_.concat(notificationObj))\n } else {\n setToastNotifications(_.map(n => n.uid === uid ? {...notificationObj, _key: n._key} : n))\n }\n }\n }\n}\nexport const useToastNotificationToggle = (notification,timeout) => {\n const toggle = useToggle()\n const extraProps = useMemo(() => notification.content || notification.element ? {} : notification,[])\n const make = (notification,timeout) => notification && createToastNotification(formatNotification(notification,extraProps),timeout,() => toggle.close())\n useEffect(() => {\n if (notification.content || notification.element) {\n toggle.openWith(make(notification))\n }\n },[])\n\n return useMemo(() => ({\n close: () => toggle.get()?.close(),\n openWith: (notification,timeout) => toggle.get() ? toggle.get().openWith(formatNotification(notification,extraProps),timeout) : toggle.openWith(make(notification,timeout)),\n open: () => toggle.get() ? toggle.get().openWith(formatNotification(notification,extraProps),timeout) : toggle.openWith(make(notification,timeout))\n }),[toggle.isOpen])\n}\nexport const willShowToastNotification = (str,timeout) => () => createToastNotification(str,timeout)\n\nconst EXIT_ANIMATION_MS = 300\nconst TOAST_EASING = 'cubic-bezier(0.22, 0.61, 0.36, 1)'\nconst TOAST_TIMING = `${EXIT_ANIMATION_MS}ms ${TOAST_EASING}`\n\nconst animation = oneWayAnimation(\n 'transform: translateY(0); opacity: 1;',\n 'transform: translateY(0.25rem); opacity: 1;',\n 'transform: translateY(1rem); opacity: 0;'\n)\nconst removeAnimationReinsertPosition = e => e.style.position=''\nexport const ToastNotifications = () => {\n const [notifications,setNotifications] = useToastNotifications()\n const containerRef = useRef(null)\n const {lockWidth, unlockWidth} = useNotificationContainerWidthLock(containerRef)\n\n return (<Fill name=\"Notifications\">\n <NotificationContainer ref={containerRef} className=\"JS-on-open-dialog\">\n <FlipList animation={animation} timing={TOAST_TIMING} onReinsert={removeAnimationReinsertPosition} skipParentMorph anchoredDownList>\n {\n notifications.map(notification => {\n const closeWithLock = () => {\n lockWidth()\n notification.close()\n setTimeout(unlockWidth, EXIT_ANIMATION_MS)\n }\n\n return (\n callIfFunction(notification.element,closeWithLock) ||\n <ToastBox\n key={`toast-${notification.uid}`}\n type={notification.type}\n onClick={notification.onClick}\n opacity={notification.opacity}\n >\n {notification.title ? \n <NotificationTitleContainer onClick={notification.onClickTitle ? (e) => notification.onClickTitle(e,closeWithLock) : undefined}>\n <NotificationTitle>{notification.title}</NotificationTitle>\n {notification.closeOnX && <CloseIcon onClick={constrainEvent(closeWithLock)}/>}\n </NotificationTitleContainer>\n :\n notification.closeOnX && <CloseIcon onClick={closeWithLock}/>\n }\n <SwitchDiv on={notification._key}>\n <NotificationContent>\n {notification.icon &&\n <NotificationIconWrapper\n isLoading={notification.isLoading}\n iconFontSize={notification.iconFontSize}\n >\n <Icon icon={notification.icon}/>\n {notification.isLoading && <Loading size={36} white absolute/>}\n </NotificationIconWrapper>\n }\n <NotificationContentBody>{callIfFunction(notification.content,closeWithLock)}</NotificationContentBody>\n </NotificationContent>\n {notification.details &&\n <NotificationDetails onClick={constrainEvent()}>\n {notification.details}\n </NotificationDetails>\n }\n </SwitchDiv>\n </ToastBox>\n )\n })\n }\n </FlipList>\n </NotificationContainer>\n </Fill>)\n}\n\nconst useNotificationContainerWidthLock = (containerRef) => {\n const lockCountRef = useRef(0)\n const prevWidthRef = useRef(null)\n\n const lockWidth = () => {\n const el = containerRef.current\n if (!el) return\n if (lockCountRef.current === 0) {\n prevWidthRef.current = el.style.width\n const measured = el.getBoundingClientRect().width\n el.style.width = measured + 'px'\n }\n lockCountRef.current = lockCountRef.current + 1\n }\n\n const unlockWidth = () => {\n const el = containerRef.current\n if (!el) return\n const next = Math.max(0, lockCountRef.current - 1)\n lockCountRef.current = next\n if (next === 0) {\n el.style.width = prevWidthRef.current || ''\n prevWidthRef.current = null\n }\n }\n\n return {lockWidth, unlockWidth}\n}"],"names":["NotificationContainer","styled","yakDomTag","ToastBox","props","css","__yakProps","v","getColor","type","rgba","ifUndefined","opacity","NotificationTitleContainer","onClick","NotificationTitle","NotificationContent","NotificationContentBody","NotificationIconWrapper","Icon","isLoading","iconFontSize","CloseIcon","attrs","icon","NotificationDetails","useToastNotifications","_useToastNotificationsRef","setToastNotifications","willUseSharedState","formatNotification","notification","extra","_isObject","_objectSpread","_key","getUID","content","createToastNotification","timeout","closeCallback","uid","currentTimer","hasClosed","close","clearTimeout","_differenceBy","placeholder","callIfFunction","notificationObj","_concat","setTimeout","openWith","obj","_map","n","useToastNotificationToggle","toggle","useToggle","extraProps","useMemo","element","make","useEffect","_toggle$get","get","open","isOpen","willShowToastNotification","str","EXIT_ANIMATION_MS","TOAST_EASING","TOAST_TIMING","animation","oneWayAnimation","removeAnimationReinsertPosition","e","style","position","ToastNotifications","notifications","setNotifications","containerRef","useRef","lockWidth","unlockWidth","useNotificationContainerWidthLock","React","createElement","Fill","name","ref","className","FlipList","timing","onReinsert","skipParentMorph","anchoredDownList","map","closeWithLock","key","title","onClickTitle","undefined","closeOnX","constrainEvent","SwitchDiv","on","Loading","size","white","absolute","details","lockCountRef","prevWidthRef","el","current","width","measured","getBoundingClientRect","next","Math","max"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAMA,qBAAqB,GAAGC,MAAA,CAAAC,SAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AAC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ClC,KAAA;AACAL,IAAAA,YAAY,CAACG,OAAO,GAAGH,YAAY,CAACG,OAAO,GAAG,CAAC,CAAA;GAChD,CAAA;EAED,MAAM/B,WAAW,GAAGA,MAAM;AACxB,IAAA,MAAM8B,EAAE,GAAGjC,YAAY,CAACkC,OAAO,CAAA;IAC/B,IAAI,CAACD,EAAE,EAAE,OAAA;AACT,IAAA,MAAMK,IAAI,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAET,YAAY,CAACG,OAAO,GAAG,CAAC,CAAC,CAAA;IAClDH,YAAY,CAACG,OAAO,GAAGI,IAAI,CAAA;IAC3B,IAAIA,IAAI,KAAK,CAAC,EAAE;MACdL,EAAE,CAACtC,KAAK,CAACwC,KAAK,GAAGH,YAAY,CAACE,OAAO,IAAI,EAAE,CAAA;MAC3CF,YAAY,CAACE,OAAO,GAAG,IAAI,CAAA;AAC7B,KAAA;GACD,CAAA;EAED,OAAO;IAAChC,SAAS;AAAEC,IAAAA,WAAAA;GAAY,CAAA;AACjC,CAAC;;;;"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import _isFunction from 'lodash/fp/isFunction';
|
|
4
|
+
import { yakDomTag } from '@startlibs/utils/yakDomTag';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
|
+
import { styled, css } from '@yak/react';
|
|
7
|
+
import { Popup } from './Popup.mjs';
|
|
8
|
+
import { useToggle, useRefState } from '@startlibs/core';
|
|
9
|
+
import { twoWayAnimation } from '@startlibs/utils';
|
|
10
|
+
|
|
11
|
+
const _excluded = ["children", "delay", "instant", "whenEllipsis", "content", "showOnClick", "showOnMount", "clickTimeout"];
|
|
12
|
+
const TooltipContainer = styled(yakDomTag("div"))`
|
|
13
|
+
display: inline-block;
|
|
14
|
+
${props => props.isWrapper ? css`position:relative;` : css`
|
|
15
|
+
position:absolute;
|
|
16
|
+
top:0;
|
|
17
|
+
left:0;
|
|
18
|
+
bottom:0;
|
|
19
|
+
right:0;
|
|
20
|
+
${props => props.isOpen && css`pointer-events: none;`}
|
|
21
|
+
`}
|
|
22
|
+
`;
|
|
23
|
+
const TooltipPopup = styled(Popup).attrs({
|
|
24
|
+
className: "styled-theme-tooltip"
|
|
25
|
+
})`
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
background-color: rgba(0,0,0,0.6);
|
|
29
|
+
box-shadow: none;
|
|
30
|
+
color: white;
|
|
31
|
+
padding: 0.25rem 1rem;
|
|
32
|
+
border-radius: 100px;
|
|
33
|
+
|
|
34
|
+
`;
|
|
35
|
+
const [fadeIn, fadeOut] = twoWayAnimation(`opacity:0;`, `opacity:1;`);
|
|
36
|
+
const isEllipsis = event => event.currentTarget.firstChild && event.currentTarget.firstChild.offsetWidth < event.currentTarget.firstChild.scrollWidth;
|
|
37
|
+
const RECENTLY_CLOSED_TIMEOUT = 200;
|
|
38
|
+
let recentlyClosed = false;
|
|
39
|
+
const openRef = {
|
|
40
|
+
current: null
|
|
41
|
+
};
|
|
42
|
+
const Tooltip = _ref => {
|
|
43
|
+
let {
|
|
44
|
+
children,
|
|
45
|
+
delay = 400,
|
|
46
|
+
instant,
|
|
47
|
+
whenEllipsis,
|
|
48
|
+
content,
|
|
49
|
+
showOnClick,
|
|
50
|
+
showOnMount,
|
|
51
|
+
clickTimeout = 3000
|
|
52
|
+
} = _ref,
|
|
53
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
54
|
+
const tooltip = useToggle();
|
|
55
|
+
const timeout = useRefState(-1);
|
|
56
|
+
|
|
57
|
+
// showOnMount (ms): abre sozinho ao montar (hint) e some após o tempo dado. O
|
|
58
|
+
// hover continua normal — se o usuário passa o mouse durante a janela, o open
|
|
59
|
+
// cancela o closeAfter (clearClosing) e o tooltip fica até o mouseleave.
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (!showOnMount) return;
|
|
62
|
+
tooltip.open();
|
|
63
|
+
tooltip.closeAfter(showOnMount);
|
|
64
|
+
// Dispensa o hint na primeira interação do usuário: clique em qualquer lugar
|
|
65
|
+
// (o popup tem pointer-events:none, então todo clique é "fora") ou scroll.
|
|
66
|
+
// O assentamento da página é resize (não scroll), então não dispara isso.
|
|
67
|
+
const dismiss = () => tooltip.close();
|
|
68
|
+
document.addEventListener('click', dismiss, {
|
|
69
|
+
once: true
|
|
70
|
+
});
|
|
71
|
+
window.addEventListener('scroll', dismiss, {
|
|
72
|
+
once: true,
|
|
73
|
+
passive: true
|
|
74
|
+
});
|
|
75
|
+
// O conteúdo da página pode assentar depois do mount (imagens/dados async),
|
|
76
|
+
// mudando a posição do âncora — mas o popup fixed só reposiciona em scroll/
|
|
77
|
+
// resize, então ficava travado no lugar antigo. Enquanto o hint está visível,
|
|
78
|
+
// observa o crescimento da página e reposiciona (portalReposition → setPosition).
|
|
79
|
+
const ro = new ResizeObserver(() => window.dispatchEvent(new CustomEvent('portalReposition')));
|
|
80
|
+
ro.observe(document.body);
|
|
81
|
+
const stopRO = setTimeout(() => ro.disconnect(), showOnMount);
|
|
82
|
+
return () => {
|
|
83
|
+
document.removeEventListener('click', dismiss);
|
|
84
|
+
window.removeEventListener('scroll', dismiss);
|
|
85
|
+
ro.disconnect();
|
|
86
|
+
clearTimeout(stopRO);
|
|
87
|
+
};
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
// Modo clique: abre no clique e some sozinho após clickTimeout (closeAfter é
|
|
91
|
+
// à prova de unmount). Não borbulha stopPropagation — quem usa decide isso.
|
|
92
|
+
const openOnClick = () => {
|
|
93
|
+
tooltip.open();
|
|
94
|
+
tooltip.closeAfter(clickTimeout);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Long-press no mobile: hover não existe e "segurar" não dispara mouseenter, então
|
|
98
|
+
// sem isso o tooltip não reaparece no toque. touchstart arma um timer; se segurou
|
|
99
|
+
// além do delay, reusa o openOnClick. Se o press disparou, preventDefault no touchend
|
|
100
|
+
// suprime o clique sintético (segurar espia, não aciona).
|
|
101
|
+
const touchTimer = useRefState(-1);
|
|
102
|
+
const didLongPress = useRefState(false);
|
|
103
|
+
const onTouchStart = () => {
|
|
104
|
+
didLongPress.set(false);
|
|
105
|
+
touchTimer.set(setTimeout(() => {
|
|
106
|
+
didLongPress.set(true);
|
|
107
|
+
openOnClick();
|
|
108
|
+
// Dispensa no scroll em QUALQUER lugar (como o hint do showOnMount): o touchmove do
|
|
109
|
+
// container só pegaria scroll com o dedo ainda no alvo — soltar e rolar não fecharia.
|
|
110
|
+
// tooltip.close é estável (useMemo []) e no-op após unmount; {once} se auto-remove.
|
|
111
|
+
window.addEventListener('scroll', tooltip.close, {
|
|
112
|
+
once: true,
|
|
113
|
+
passive: true
|
|
114
|
+
});
|
|
115
|
+
}, delay));
|
|
116
|
+
};
|
|
117
|
+
const onTouchEnd = e => {
|
|
118
|
+
clearTimeout(touchTimer.get());
|
|
119
|
+
if (didLongPress.get()) e.preventDefault();
|
|
120
|
+
};
|
|
121
|
+
// Só cancela o press pendente — não abrir no meio de um scroll iniciado sobre o alvo.
|
|
122
|
+
const onTouchMove = () => clearTimeout(touchTimer.get());
|
|
123
|
+
|
|
124
|
+
// Remove o listener de scroll pendente se desmontar antes de rolar (evita leak da closure).
|
|
125
|
+
useEffect(() => () => window.removeEventListener('scroll', tooltip.close), []);
|
|
126
|
+
const mouseEnter = e => {
|
|
127
|
+
if (!whenEllipsis || (_isFunction(whenEllipsis) ? whenEllipsis : isEllipsis)(e)) {
|
|
128
|
+
timeout.set(setTimeout(() => {
|
|
129
|
+
tooltip.open();
|
|
130
|
+
if (recentlyClosed && openRef.current) {
|
|
131
|
+
openRef.current.remove();
|
|
132
|
+
}
|
|
133
|
+
}, instant || recentlyClosed ? 0 : delay));
|
|
134
|
+
!children && e.currentTarget.parentNode.addEventListener('mouseleave', onMouseLeave);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const onMouseLeave = e => {
|
|
138
|
+
clearTimeout(timeout.get());
|
|
139
|
+
if (tooltip.get()) {
|
|
140
|
+
timeout.set(false);
|
|
141
|
+
!children && e.currentTarget.removeEventListener('mouseleave', onMouseLeave);
|
|
142
|
+
const currentlyClosed = recentlyClosed = setTimeout(() => {
|
|
143
|
+
recentlyClosed = recentlyClosed === currentlyClosed ? false : recentlyClosed;
|
|
144
|
+
}, RECENTLY_CLOSED_TIMEOUT);
|
|
145
|
+
tooltip.close();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const getAnimation = () => {
|
|
149
|
+
if (recentlyClosed && timeout.get() !== false) {
|
|
150
|
+
return '';
|
|
151
|
+
} else {
|
|
152
|
+
return fadeIn;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const canLongPress = content && !showOnClick;
|
|
156
|
+
return /*#__PURE__*/React.createElement(TooltipContainer, {
|
|
157
|
+
isOpen: tooltip.isOpen,
|
|
158
|
+
isWrapper: !!children,
|
|
159
|
+
onMouseUp: showOnClick ? undefined : onMouseLeave,
|
|
160
|
+
onMouseLeave: children && !showOnClick ? onMouseLeave : undefined,
|
|
161
|
+
onMouseEnter: showOnClick ? undefined : mouseEnter,
|
|
162
|
+
onTouchStart: canLongPress ? onTouchStart : undefined,
|
|
163
|
+
onTouchEnd: canLongPress ? onTouchEnd : undefined,
|
|
164
|
+
onTouchMove: canLongPress ? onTouchMove : undefined,
|
|
165
|
+
onClick: showOnClick ? openOnClick : undefined
|
|
166
|
+
}, tooltip.isOpen && content && /*#__PURE__*/React.createElement(TooltipPopup, _extends({
|
|
167
|
+
animation: getAnimation,
|
|
168
|
+
animationOptions: {
|
|
169
|
+
ref: openRef
|
|
170
|
+
},
|
|
171
|
+
top: !(rest.bottom || rest.left || rest.right || rest.at || rest.my)
|
|
172
|
+
}, rest), content), children);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { Tooltip };
|
|
176
|
+
//# sourceMappingURL=Tooltip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.mjs","sources":["../src/Tooltip.jsx"],"sourcesContent":["import React, {useEffect, useMemo} from 'react'\nimport _ from 'lodash/fp'\nimport styled, {css} from 'styled-components'\nimport {Popup} from './Popup'\nimport {useRefState, useToggle} from '@startlibs/core'\nimport {customTheme,twoWayAnimation} from '@startlibs/utils'\n\nconst TooltipContainer = styled.div`\n display: inline-block;\n ${props => props.isWrapper ?\n `position:relative;` :\n css`\n position:absolute;\n top:0;\n left:0;\n bottom:0;\n right:0;\n ${props => props.isOpen && 'pointer-events: none;'}\n `} \n`\nconst TooltipPopup = styled(Popup)`\n font-size: 12px;\n pointer-events: none;\n background-color: rgba(0,0,0,0.6);\n box-shadow: none;\n color: white;\n padding: 0.25rem 1rem;\n border-radius: 100px;\n ${customTheme('Tooltip')}\n`\n\nconst [fadeIn, fadeOut] = twoWayAnimation(`opacity:0;`, `opacity:1;`)\n\nconst isEllipsis = (event) => event.currentTarget.firstChild && event.currentTarget.firstChild.offsetWidth < event.currentTarget.firstChild.scrollWidth\n\nconst RECENTLY_CLOSED_TIMEOUT = 200\nlet recentlyClosed = false\nconst openRef = {current:null}\n\nexport const Tooltip = ({children, delay = 400, instant, whenEllipsis, content, showOnClick, showOnMount, clickTimeout = 3000, ...rest}) => {\n\n const tooltip = useToggle()\n const timeout = useRefState(-1)\n\n // showOnMount (ms): abre sozinho ao montar (hint) e some após o tempo dado. O\n // hover continua normal — se o usuário passa o mouse durante a janela, o open\n // cancela o closeAfter (clearClosing) e o tooltip fica até o mouseleave.\n useEffect(() => {\n if (!showOnMount) return\n tooltip.open()\n tooltip.closeAfter(showOnMount)\n // Dispensa o hint na primeira interação do usuário: clique em qualquer lugar\n // (o popup tem pointer-events:none, então todo clique é \"fora\") ou scroll.\n // O assentamento da página é resize (não scroll), então não dispara isso.\n const dismiss = () => tooltip.close()\n document.addEventListener('click', dismiss, {once: true})\n window.addEventListener('scroll', dismiss, {once: true, passive: true})\n // O conteúdo da página pode assentar depois do mount (imagens/dados async),\n // mudando a posição do âncora — mas o popup fixed só reposiciona em scroll/\n // resize, então ficava travado no lugar antigo. Enquanto o hint está visível,\n // observa o crescimento da página e reposiciona (portalReposition → setPosition).\n const ro = new ResizeObserver(() => window.dispatchEvent(new CustomEvent('portalReposition')))\n ro.observe(document.body)\n const stopRO = setTimeout(() => ro.disconnect(), showOnMount)\n return () => {\n document.removeEventListener('click', dismiss)\n window.removeEventListener('scroll', dismiss)\n ro.disconnect()\n clearTimeout(stopRO)\n }\n }, [])\n\n // Modo clique: abre no clique e some sozinho após clickTimeout (closeAfter é\n // à prova de unmount). Não borbulha stopPropagation — quem usa decide isso.\n const openOnClick = () => {\n tooltip.open()\n tooltip.closeAfter(clickTimeout)\n }\n\n // Long-press no mobile: hover não existe e \"segurar\" não dispara mouseenter, então\n // sem isso o tooltip não reaparece no toque. touchstart arma um timer; se segurou\n // além do delay, reusa o openOnClick. Se o press disparou, preventDefault no touchend\n // suprime o clique sintético (segurar espia, não aciona).\n const touchTimer = useRefState(-1)\n const didLongPress = useRefState(false)\n const onTouchStart = () => {\n didLongPress.set(false)\n touchTimer.set(setTimeout(() => {\n didLongPress.set(true)\n openOnClick()\n // Dispensa no scroll em QUALQUER lugar (como o hint do showOnMount): o touchmove do\n // container só pegaria scroll com o dedo ainda no alvo — soltar e rolar não fecharia.\n // tooltip.close é estável (useMemo []) e no-op após unmount; {once} se auto-remove.\n window.addEventListener('scroll', tooltip.close, {once: true, passive: true})\n }, delay))\n }\n const onTouchEnd = (e) => {\n clearTimeout(touchTimer.get())\n if (didLongPress.get()) e.preventDefault()\n }\n // Só cancela o press pendente — não abrir no meio de um scroll iniciado sobre o alvo.\n const onTouchMove = () => clearTimeout(touchTimer.get())\n\n // Remove o listener de scroll pendente se desmontar antes de rolar (evita leak da closure).\n useEffect(() => () => window.removeEventListener('scroll', tooltip.close), [])\n\n const mouseEnter = (e) => {\n if (!whenEllipsis || (_.isFunction(whenEllipsis) ? whenEllipsis : isEllipsis)(e)) {\n timeout.set(setTimeout(() => {\n\n tooltip.open()\n if (recentlyClosed && openRef.current) {\n openRef.current.remove()\n }\n },(instant || recentlyClosed) ? 0 : delay))\n !children && e.currentTarget.parentNode.addEventListener('mouseleave', onMouseLeave)\n }\n }\n\n const onMouseLeave = (e) => {\n clearTimeout(timeout.get())\n if (tooltip.get()) {\n timeout.set(false)\n !children && e.currentTarget.removeEventListener('mouseleave', onMouseLeave)\n const currentlyClosed = recentlyClosed = setTimeout(() => {\n recentlyClosed = recentlyClosed === currentlyClosed ? false : recentlyClosed\n },RECENTLY_CLOSED_TIMEOUT)\n tooltip.close()\n }\n }\n\n const getAnimation = () => {\n if (recentlyClosed && timeout.get()!==false) {\n return ''\n } else {\n return fadeIn\n }\n }\n\n const canLongPress = content && !showOnClick\n\n return <TooltipContainer isOpen={tooltip.isOpen} isWrapper={!!children}\n onMouseUp={showOnClick ? undefined : onMouseLeave}\n onMouseLeave={(children && !showOnClick) ? onMouseLeave : undefined}\n onMouseEnter={showOnClick ? undefined : mouseEnter}\n onTouchStart={canLongPress ? onTouchStart : undefined}\n onTouchEnd={canLongPress ? onTouchEnd : undefined}\n onTouchMove={canLongPress ? onTouchMove : undefined}\n onClick={showOnClick ? openOnClick : undefined}>\n {\n tooltip.isOpen && content &&\n <TooltipPopup animation={getAnimation} animationOptions={{ref:openRef}} top={!(rest.bottom || rest.left || rest.right || rest.at || rest.my)} {...rest}>\n {content}\n </TooltipPopup>\n }\n {children}\n </TooltipContainer>\n}\n"],"names":["TooltipContainer","styled","yakDomTag","props","isWrapper","css","isOpen","TooltipPopup","Popup","attrs","className","fadeIn","fadeOut","twoWayAnimation","isEllipsis","event","currentTarget","firstChild","offsetWidth","scrollWidth","RECENTLY_CLOSED_TIMEOUT","recentlyClosed","openRef","current","Tooltip","_ref","children","delay","instant","whenEllipsis","content","showOnClick","showOnMount","clickTimeout","rest","_objectWithoutProperties","_excluded","tooltip","useToggle","timeout","useRefState","useEffect","open","closeAfter","dismiss","close","document","addEventListener","once","window","passive","ro","ResizeObserver","dispatchEvent","CustomEvent","observe","body","stopRO","setTimeout","disconnect","removeEventListener","clearTimeout","openOnClick","touchTimer","didLongPress","onTouchStart","set","onTouchEnd","e","get","preventDefault","onTouchMove","mouseEnter","_isFunction","remove","parentNode","onMouseLeave","currentlyClosed","getAnimation","canLongPress","React","createElement","onMouseUp","undefined","onMouseEnter","onClick","_extends","animation","animationOptions","ref","top","bottom","left","right","at","my"],"mappings":";;;;;;;;;;;AAOA,MAAMA,gBAAgB,GAAGC,MAAA,CAAAC,SAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACzB;AACA,EAAIC,EAAAA,KAAK,IAAIA,KAAK,CAACC,SAAS,GAAAC,GAAA,uBAEfA,GAAG,CAAA;AAChB;AACA;AACA;AACA;AACA;AACA,IAAA,EAAMF,KAAK,IAAIA,KAAK,CAACG,MAAM,IAAAD,GAAA,CAA2B,qBAAA,CAAA,CAAA;AACtD,EAAG,CAAA,CAAA;AACH,CAAC,CAAA;AACD,MAAME,YAAY,GAAGN,MAAM,CAACO,KAAK,CAAC,CAAAC,KAAA,CAAA;EAAAC,SAAA,EAAA,sBAAA;AAAA,CAAA,CAAA,CAAA;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAA;AAED,MAAM,CAACC,MAAM,EAAEC,OAAO,CAAC,GAAGC,eAAe,CAAC,CAAA,UAAA,CAAY,EAAE,CAAA,UAAA,CAAY,CAAC,CAAA;AAErE,MAAMC,UAAU,GAAIC,KAAK,IAAKA,KAAK,CAACC,aAAa,CAACC,UAAU,IAAIF,KAAK,CAACC,aAAa,CAACC,UAAU,CAACC,WAAW,GAAGH,KAAK,CAACC,aAAa,CAACC,UAAU,CAACE,WAAW,CAAA;AAEvJ,MAAMC,uBAAuB,GAAG,GAAG,CAAA;AACnC,IAAIC,cAAc,GAAG,KAAK,CAAA;AAC1B,MAAMC,OA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D,KAAA,CAAAC,aAAA,CAAC1E,YAAY,EAAA+E,QAAA,CAAA;AAAEC,IAAAA,SAAS,EAAET,YAAa;AAACU,IAAAA,gBAAgB,EAAE;AAACC,MAAAA,GAAG,EAACnE,OAAAA;KAAS;IAAEoE,GAAG,EAAE,EAAExD,IAAI,CAACyD,MAAM,IAAIzD,IAAI,CAAC0D,IAAI,IAAI1D,IAAI,CAAC2D,KAAK,IAAI3D,IAAI,CAAC4D,EAAE,IAAI5D,IAAI,CAAC6D,EAAE,CAAA;AAAE,GAAA,EAAK7D,IAAI,CACrJJ,EAAAA,OACW,CAAC,EAEhBJ,QACe,CAAC,CAAA;AACrB;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { yakDomTag } from '@startlibs/utils/yakDomTag';
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import { styled, css } from '@yak/react';
|
|
6
|
+
import { FlipList } from './FlipList.mjs';
|
|
7
|
+
import { oneWayAnimation } from '@startlibs/utils';
|
|
8
|
+
|
|
9
|
+
const _excluded = ["children", "animation", "skipChromeFix", "className", "block", "inline"];
|
|
10
|
+
const DEFAULT_ANIMATION = oneWayAnimation(`opacity: 1;`, `opacity: 0;`);
|
|
11
|
+
const AnimationBlockContainer = styled(yakDomTag("div")).attrs({
|
|
12
|
+
className: "styled-animation-block-container"
|
|
13
|
+
})`
|
|
14
|
+
${props => props.inline ? css`display: inline-block; ` : css``}
|
|
15
|
+
position:relative;
|
|
16
|
+
`;
|
|
17
|
+
const TransitionDiv = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
animation,
|
|
21
|
+
skipChromeFix,
|
|
22
|
+
className,
|
|
23
|
+
block,
|
|
24
|
+
inline
|
|
25
|
+
} = _ref,
|
|
26
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
const blockRef = useRef();
|
|
28
|
+
const overflowEffect = () => {
|
|
29
|
+
if (blockRef.current) {
|
|
30
|
+
const prevOverflow = blockRef.current.style.overflow;
|
|
31
|
+
blockRef.current.style.overflow = 'hidden';
|
|
32
|
+
return () => {
|
|
33
|
+
blockRef.current.style.overflow = prevOverflow;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const content = children ? /*#__PURE__*/React.createElement(FlipList, _extends({
|
|
38
|
+
smallJumpFix: inline && -3,
|
|
39
|
+
effect: overflowEffect,
|
|
40
|
+
skipChromeFix: skipChromeFix,
|
|
41
|
+
animation: animation || DEFAULT_ANIMATION
|
|
42
|
+
}, rest), [/*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: block || inline ? "" : className,
|
|
44
|
+
key: "first"
|
|
45
|
+
}, children)]) : /*#__PURE__*/React.createElement(FlipList, _extends({
|
|
46
|
+
smallJumpFix: inline && -3,
|
|
47
|
+
effect: overflowEffect,
|
|
48
|
+
skipChromeFix: skipChromeFix,
|
|
49
|
+
animation: animation || DEFAULT_ANIMATION
|
|
50
|
+
}, rest), []);
|
|
51
|
+
return block || inline ? /*#__PURE__*/React.createElement(AnimationBlockContainer, {
|
|
52
|
+
inline: inline,
|
|
53
|
+
ref: blockRef,
|
|
54
|
+
className: className
|
|
55
|
+
}, content) : content;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { AnimationBlockContainer, TransitionDiv };
|
|
59
|
+
//# sourceMappingURL=TransitionDiv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransitionDiv.mjs","sources":["../src/TransitionDiv.jsx"],"sourcesContent":["import React, {useRef} from 'react'\nimport styled from 'styled-components'\nimport {FlipList} from './FlipList'\nimport {oneWayAnimation} from '@startlibs/utils'\n\n\nconst DEFAULT_ANIMATION = oneWayAnimation(`opacity: 1;`, `opacity: 0;`)\n\nexport const AnimationBlockContainer = styled.div`\n ${props => props.inline ? 'display: inline-block; ' : ''}\n position:relative;\n`\n\n\nexport const TransitionDiv = ({children,animation, skipChromeFix, className, block, inline,...rest}) => {\n\n const blockRef = useRef()\n\n const overflowEffect = () => {\n if (blockRef.current) {\n const prevOverflow = blockRef.current.style.overflow\n blockRef.current.style.overflow = 'hidden'\n return () => {\n blockRef.current.style.overflow = prevOverflow\n }\n }\n }\n\n const content = children\n ? <FlipList smallJumpFix={inline && -3} effect={overflowEffect} skipChromeFix={skipChromeFix} animation={animation || DEFAULT_ANIMATION} {...rest}>{[<div className={(block || inline) ? \"\" : className} key=\"first\">{children}</div>]}</FlipList>\n : <FlipList smallJumpFix={inline && -3} effect={overflowEffect} skipChromeFix={skipChromeFix} animation={animation || DEFAULT_ANIMATION} {...rest}>{[]}</FlipList>\n\n return (block || inline) ? <AnimationBlockContainer inline={inline} ref={blockRef} className={className}>{content}</AnimationBlockContainer> : content\n}"],"names":["DEFAULT_ANIMATION","oneWayAnimation","AnimationBlockContainer","styled","yakDomTag","attrs","className","props","inline","css","TransitionDiv","_ref","children","animation","skipChromeFix","block","rest","_objectWithoutProperties","_excluded","blockRef","useRef","overflowEffect","current","prevOverflow","style","overflow","content","React","createElement","FlipList","_extends","smallJumpFix","effect","key","ref"],"mappings":";;;;;;;;;AAMA,MAAMA,iBAAiB,GAAGC,eAAe,CAAC,CAAa,WAAA,CAAA,EAAE,aAAa,CAAC,CAAA;MAE1DC,uBAAuB,GAAGC,MAAA,CAAAC,SAAA,SAAAC,KAAA,CAAA;EAAAC,SAAA,EAAA,kCAAA;AAAA,CAAA,CAAA,CAAA;AACvC,EAAIC,EAAAA,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAAC,GAAA,CAAAA,uBAAAA,CAAAA,GAAAA,GAAA,CAAiC,CAAA,CAAA;AAC1D;AACA,EAAC;AAGYC,MAAAA,aAAa,GAAGC,IAAA,IAA2E;EAAA,IAA1E;MAACC,QAAQ;MAACC,SAAS;MAAEC,aAAa;MAAER,SAAS;MA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